linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers
       [not found] <CGME20200227115151eucas1p22ff7409009d917addcc7e20f523c9051@eucas1p2.samsung.com>
@ 2020-02-27 11:51 ` Marek Szyprowski
  2020-02-27 11:56   ` Nicolas Saenz Julienne
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Szyprowski @ 2020-02-27 11:51 UTC (permalink / raw)
  To: linux-rpi-kernel, linux-arm-kernel, linux-pci, linux-kernel
  Cc: Marek Szyprowski, Nicolas Saenz Julienne, Florian Fainelli,
	bcm-kernel-feedback-list, Lorenzo Pieralisi, Andrew Murray,
	Bjorn Helgaas

Some older compilers have no implementation for the helper for 64-bit
unsigned division/modulo, so linking pcie-brcmstb driver causes the
"undefined reference to `__aeabi_uldivmod'" error.

*rc_bar2_size is always a power of two, because it is calculated as:
"1ULL << fls64(entry->res->end - entry->res->start)", so the modulo
operation in the subsequent check can be replaced by a simple logical
AND with a proper mask.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/pci/controller/pcie-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index d20aabc26273..3a10e678c7f4 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -670,7 +670,7 @@ static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie,
 	 *   outbound memory @ 3GB). So instead it will  start at the 1x
 	 *   multiple of its size
 	 */
-	if (!*rc_bar2_size || *rc_bar2_offset % *rc_bar2_size ||
+	if (!*rc_bar2_size || (*rc_bar2_offset & (*rc_bar2_size - 1)) ||
 	    (*rc_bar2_offset < SZ_4G && *rc_bar2_offset > SZ_2G)) {
 		dev_err(dev, "Invalid rc_bar2_offset/size: size 0x%llx, off 0x%llx\n",
 			*rc_bar2_size, *rc_bar2_offset);
-- 
2.17.1


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

* Re: [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers
  2020-02-27 11:51 ` [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers Marek Szyprowski
@ 2020-02-27 11:56   ` Nicolas Saenz Julienne
  2020-02-27 12:30   ` Lorenzo Pieralisi
  2020-02-27 14:09   ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Saenz Julienne @ 2020-02-27 11:56 UTC (permalink / raw)
  To: Marek Szyprowski, linux-rpi-kernel, linux-arm-kernel, linux-pci,
	linux-kernel
  Cc: Lorenzo Pieralisi, Florian Fainelli, bcm-kernel-feedback-list,
	Bjorn Helgaas, Andrew Murray

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

On Thu, 2020-02-27 at 12:51 +0100, Marek Szyprowski wrote:
> Some older compilers have no implementation for the helper for 64-bit
> unsigned division/modulo, so linking pcie-brcmstb driver causes the
> "undefined reference to `__aeabi_uldivmod'" error.
> 
> *rc_bar2_size is always a power of two, because it is calculated as:
> "1ULL << fls64(entry->res->end - entry->res->start)", so the modulo
> operation in the subsequent check can be replaced by a simple logical
> AND with a proper mask.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Thanks!
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers
  2020-02-27 11:51 ` [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers Marek Szyprowski
  2020-02-27 11:56   ` Nicolas Saenz Julienne
@ 2020-02-27 12:30   ` Lorenzo Pieralisi
  2020-02-27 14:09   ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Pieralisi @ 2020-02-27 12:30 UTC (permalink / raw)
  To: Marek Szyprowski, Bjorn Helgaas
  Cc: linux-rpi-kernel, linux-arm-kernel, linux-pci, linux-kernel,
	Nicolas Saenz Julienne, Florian Fainelli,
	bcm-kernel-feedback-list, Andrew Murray

Subject should be:

PCI: brcmstb: Fix build on 32bit ARM platforms with older compilers

On Thu, Feb 27, 2020 at 12:51:46PM +0100, Marek Szyprowski wrote:
> Some older compilers have no implementation for the helper for 64-bit
> unsigned division/modulo, so linking pcie-brcmstb driver causes the
> "undefined reference to `__aeabi_uldivmod'" error.
> 
> *rc_bar2_size is always a power of two, because it is calculated as:
> "1ULL << fls64(entry->res->end - entry->res->start)", so the modulo
> operation in the subsequent check can be replaced by a simple logical
> AND with a proper mask.
> 

Add a Fixes: tag please.

Fixes: c0452137034b ("PCI: brcmstb: Add Broadcom STB PCIe host controller driver")

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/pci/controller/pcie-brcmstb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Hi Bjorn,

I think this should be merged in one of the upcoming -rc, given that
it fixes v5.6 material.

Here is my ACK to that end, if you prefer postponing it to v5.7
please let me know.

Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index d20aabc26273..3a10e678c7f4 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -670,7 +670,7 @@ static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie,
>  	 *   outbound memory @ 3GB). So instead it will  start at the 1x
>  	 *   multiple of its size
>  	 */
> -	if (!*rc_bar2_size || *rc_bar2_offset % *rc_bar2_size ||
> +	if (!*rc_bar2_size || (*rc_bar2_offset & (*rc_bar2_size - 1)) ||
>  	    (*rc_bar2_offset < SZ_4G && *rc_bar2_offset > SZ_2G)) {
>  		dev_err(dev, "Invalid rc_bar2_offset/size: size 0x%llx, off 0x%llx\n",
>  			*rc_bar2_size, *rc_bar2_offset);
> -- 
> 2.17.1
> 

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

* Re: [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers
  2020-02-27 11:51 ` [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers Marek Szyprowski
  2020-02-27 11:56   ` Nicolas Saenz Julienne
  2020-02-27 12:30   ` Lorenzo Pieralisi
@ 2020-02-27 14:09   ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2020-02-27 14:09 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-rpi-kernel, linux-arm-kernel, linux-pci, linux-kernel,
	Nicolas Saenz Julienne, Florian Fainelli,
	bcm-kernel-feedback-list, Lorenzo Pieralisi, Andrew Murray

On Thu, Feb 27, 2020 at 12:51:46PM +0100, Marek Szyprowski wrote:
> Some older compilers have no implementation for the helper for 64-bit
> unsigned division/modulo, so linking pcie-brcmstb driver causes the
> "undefined reference to `__aeabi_uldivmod'" error.
> 
> *rc_bar2_size is always a power of two, because it is calculated as:
> "1ULL << fls64(entry->res->end - entry->res->start)", so the modulo
> operation in the subsequent check can be replaced by a simple logical
> AND with a proper mask.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Applied to for-linus for v5.6, thanks!  I added acks from Nicolas and
Lorenzo and also the Fixes: tag from Lorenzo.

> ---
>  drivers/pci/controller/pcie-brcmstb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index d20aabc26273..3a10e678c7f4 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -670,7 +670,7 @@ static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie,
>  	 *   outbound memory @ 3GB). So instead it will  start at the 1x
>  	 *   multiple of its size
>  	 */
> -	if (!*rc_bar2_size || *rc_bar2_offset % *rc_bar2_size ||
> +	if (!*rc_bar2_size || (*rc_bar2_offset & (*rc_bar2_size - 1)) ||
>  	    (*rc_bar2_offset < SZ_4G && *rc_bar2_offset > SZ_2G)) {
>  		dev_err(dev, "Invalid rc_bar2_offset/size: size 0x%llx, off 0x%llx\n",
>  			*rc_bar2_size, *rc_bar2_offset);
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2020-02-27 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200227115151eucas1p22ff7409009d917addcc7e20f523c9051@eucas1p2.samsung.com>
2020-02-27 11:51 ` [PATCH] pci: brcmstb: Fix build on 32bit ARM platforms with older compilers Marek Szyprowski
2020-02-27 11:56   ` Nicolas Saenz Julienne
2020-02-27 12:30   ` Lorenzo Pieralisi
2020-02-27 14:09   ` 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).