linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: iproc: Fix incorrect MSI address alignment
@ 2016-11-22  1:48 Ray Jui
  2016-11-23 23:16 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Ray Jui @ 2016-11-22  1:48 UTC (permalink / raw)
  To: Bjorn Helgaas, Bjorn Helgaas
  Cc: linux-kernel, bcm-kernel-feedback-list, linux-pci, Alex Barba,
	Oza Oza, 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.

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")

Signed-off-by: Ray Jui <ray.jui@broadcom.com>
---
 drivers/pci/host/pcie-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 8ffb9d4..fb09668 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -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;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: iproc: Fix incorrect MSI address alignment
  2016-11-22  1:48 [PATCH] PCI: iproc: Fix incorrect MSI address alignment Ray Jui
@ 2016-11-23 23:16 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2016-11-23 23:16 UTC (permalink / raw)
  To: Ray Jui
  Cc: Bjorn Helgaas, linux-kernel, bcm-kernel-feedback-list, linux-pci,
	Alex Barba, Oza Oza

On Mon, Nov 21, 2016 at 05:48:30PM -0800, Ray Jui wrote:
> 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")
> 
> Signed-off-by: Ray Jui <ray.jui@broadcom.com>

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

> ---
>  drivers/pci/host/pcie-iproc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index 8ffb9d4..fb09668 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -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;
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-23 23:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22  1:48 [PATCH] PCI: iproc: Fix incorrect MSI address alignment Ray Jui
2016-11-23 23:16 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).