Skip to contentSkip to conversation

PCI: iproc: Fix incorrect MSI address alignment

PATCH Applied Ray Jui 2 participants 2 messages Nov 22, 2016 – Nov 23, 2016

Subsystems (2)
lore
Share & tools
lore

Ray Jui

author
#0 lore raw

PATCH 1/1 PCI: iproc: Fix incorrect MSI address alignment

In the code to handle PAXB v2 based MSI steering, the logic aligns the MSI register address to the size of supported inbound mapping range. This is incorrect since it rounds "up" the starting address to the next aligned address, but what we want is the starting address to be rounded "down" to the aligned address.

This patch fixes the issue and allows MSI writes to be properly steered to the GIC

Fixes 4b073155fbd3 ("PCI: iproc: Add support for the next-gen PAXB

controller")

---
 drivers/pci/host/pcie-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-iproc.c +1 -1
index 8ffb9d4..fb09668 100644
@@ -1018,7 +1018,7 @@ static int iproc_pcie_paxb_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr)
 
 	memset(&range, 0, sizeof(range));
 	range.size = SZ_32K;
-	range.pci_addr = range.cpu_addr = ALIGN(msi_addr, range.size);
+	range.pci_addr = range.cpu_addr = msi_addr & ~(range.size - 1);
 
 	ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_IO);
 	return ret;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 6 lines · Ray Jui

In the code to handle PAXB v2 based MSI steering, the logic aligns the MSI register address to the size of supported inbound mapping range. This is incorrect since it rounds "up" the starting address to the next aligned address, but what we want is the starting address to be rounded "down" to the aligned address.

Quoted 7 lines

This patch fixes the issue and allows MSI writes to be properly steered to the GIC

Fixes 4b073155fbd3 ("PCI: iproc: Add support for the next-gen PAXB

controller")

Applied to pci/host-iproc for v4.10, thanks, Ray!

Quoted 20 lines
---
 drivers/pci/host/pcie-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-iproc.c +1 -1
index 8ffb9d4..fb09668 100644
@@ -1018,7 +1018,7 @@ static int iproc_pcie_paxb_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr)
 
 	memset(&range, 0, sizeof(range));
 	range.size = SZ_32K;
-	range.pci_addr = range.cpu_addr = ALIGN(msi_addr, range.size);
+	range.pci_addr = range.cpu_addr = msi_addr & ~(range.size - 1);
 
 	ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_IO);
 	return ret;
Signature · 1 line
2.1.4