Skip to content

Commit 5ddfc24

Browse files
committed
Merge tag 'pci-v6.8-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci
Pull pci fixes from Bjorn Helgaas: - Fix an unintentional truncation of DWC MSI-X address to 32 bits and update similar MSI code to match (Dan Carpenter) * tag 'pci-v6.8-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: PCI: dwc: Clean up dw_pcie_ep_raise_msi_irq() alignment PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
2 parents 5ca243c + 67057f4 commit 5ddfc24

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Author: Kishon Vijay Abraham I <kishon@ti.com>
77
*/
88

9+
#include <linux/align.h>
910
#include <linux/bitfield.h>
1011
#include <linux/of.h>
1112
#include <linux/platform_device.h>
@@ -482,9 +483,10 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
482483
reg = ep_func->msi_cap + PCI_MSI_DATA_32;
483484
msg_data = dw_pcie_ep_readw_dbi(ep, func_no, reg);
484485
}
485-
aligned_offset = msg_addr_lower & (epc->mem->window.page_size - 1);
486-
msg_addr = ((u64)msg_addr_upper) << 32 |
487-
(msg_addr_lower & ~aligned_offset);
486+
msg_addr = ((u64)msg_addr_upper) << 32 | msg_addr_lower;
487+
488+
aligned_offset = msg_addr & (epc->mem->window.page_size - 1);
489+
msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size);
488490
ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr,
489491
epc->mem->window.page_size);
490492
if (ret)
@@ -551,7 +553,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
551553
}
552554

553555
aligned_offset = msg_addr & (epc->mem->window.page_size - 1);
554-
msg_addr &= ~aligned_offset;
556+
msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size);
555557
ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr,
556558
epc->mem->window.page_size);
557559
if (ret)

0 commit comments

Comments
 (0)