All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: Arnd Bergmann <arnd@arndb.de>, linux-arm-kernel@lists.infradead.org
Cc: Kevin Hilman <khilman@kernel.org>, Ray Jui <rjui@broadcom.com>,
	Tyler Baker <tyler.baker@linaro.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Olof Johansson <olof@lixom.net>, Mark Brown <broonie@kernel.org>,
	bcm-kernel-feedback-list@broadcom.com,
	Linux PCI <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH] PCI: iproc: fix 32-bit build error
Date: Tue, 13 Oct 2015 22:06:48 +0200	[thread overview]
Message-ID: <561D6458.40504@hauke-m.de> (raw)
In-Reply-To: <11199595.GgDE2yo8AA@wuerfel>

On 10/13/2015 10:02 PM, Arnd Bergmann wrote:
> The iproc PCI driver tries to figure out whether the MMIO window has
> a valid size, but does this using a 64-bit modulo operation, which
> is not allowed on 32-bit kernels and leads to a link error:
> 
> drivers/built-in.o: In function `iproc_pcie_setup':
> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
> 
> This works around that error by using the div64_u64() function
> provided by the kernel. While this is an expensive operation,
> it is harmless because we only call it during the probing
> of the driver.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
> 
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index f3481ddff344..abcb4be2ee19 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
>   *
>   * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
>   */
> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,

Why are you removing the static here?

>  			       u64 pci_addr, resource_size_t size)
>  {
>  	struct iproc_pcie_ob *ob = &pcie->ob;
>  	unsigned i;
>  	u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
> +	u64 remainder;
>  
>  	if (size > max_size) {
>  		dev_err(pcie->dev,
> @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>  		return -EINVAL;
>  	}
>  
> -	if (size % ob->window_size) {
> +	div64_u64_rem(size, ob->window_size, &remainder);
> +	if (remainder) {
>  		dev_err(pcie->dev,
>  			"res size %pap needs to be multiple of window size %pap\n",
>  			&size, &ob->window_size);
> 


WARNING: multiple messages have this Message-ID (diff)
From: hauke@hauke-m.de (Hauke Mehrtens)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI: iproc: fix 32-bit build error
Date: Tue, 13 Oct 2015 22:06:48 +0200	[thread overview]
Message-ID: <561D6458.40504@hauke-m.de> (raw)
In-Reply-To: <11199595.GgDE2yo8AA@wuerfel>

On 10/13/2015 10:02 PM, Arnd Bergmann wrote:
> The iproc PCI driver tries to figure out whether the MMIO window has
> a valid size, but does this using a 64-bit modulo operation, which
> is not allowed on 32-bit kernels and leads to a link error:
> 
> drivers/built-in.o: In function `iproc_pcie_setup':
> :(.text+0x4b798): undefined reference to `__aeabi_uldivmod'
> 
> This works around that error by using the div64_u64() function
> provided by the kernel. While this is an expensive operation,
> it is harmless because we only call it during the probing
> of the driver.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings")
> 
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index f3481ddff344..abcb4be2ee19 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie)
>   *
>   * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address
>   */
> -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
> +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,

Why are you removing the static here?

>  			       u64 pci_addr, resource_size_t size)
>  {
>  	struct iproc_pcie_ob *ob = &pcie->ob;
>  	unsigned i;
>  	u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS;
> +	u64 remainder;
>  
>  	if (size > max_size) {
>  		dev_err(pcie->dev,
> @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr,
>  		return -EINVAL;
>  	}
>  
> -	if (size % ob->window_size) {
> +	div64_u64_rem(size, ob->window_size, &remainder);
> +	if (remainder) {
>  		dev_err(pcie->dev,
>  			"res size %pap needs to be multiple of window size %pap\n",
>  			&size, &ob->window_size);
> 

  reply	other threads:[~2015-10-13 20:06 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16  0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
2015-09-16  0:39 ` Ray Jui
2015-09-16  0:39 ` [PATCH 1/8] PCI: iproc: Fix code comment Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-16  0:39 ` [PATCH 2/8] PCI: iproc: Remove unused code Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-16  0:39 ` [PATCH 3/8] PCI: iproc: Remove ARCH specific flag Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-16  0:39 ` [PATCH 4/8] PCI: iproc: Fix PCIe reset logic Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-16  0:39 ` [PATCH 5/8] PCI: iproc: Improve link detection logic Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-16  0:39 ` [PATCH 6/8] PCI: iproc: Update iProc PCIe device tree bindings Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-16  0:39 ` [PATCH 7/8] PCI: iproc: Add outbound mapping support Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-10-13 17:58   ` Kevin Hilman
2015-10-13 17:58     ` Kevin Hilman
2015-10-13 17:58     ` Kevin Hilman
2015-10-13 20:02     ` [PATCH] PCI: iproc: fix 32-bit build error Arnd Bergmann
2015-10-13 20:02       ` Arnd Bergmann
2015-10-13 20:06       ` Hauke Mehrtens [this message]
2015-10-13 20:06         ` Hauke Mehrtens
2015-10-13 20:11         ` Ray Jui
2015-10-13 20:11           ` Ray Jui
2015-10-13 21:00           ` Arnd Bergmann
2015-10-13 21:00             ` Arnd Bergmann
2015-10-15 16:00             ` Bjorn Helgaas
2015-10-15 16:00               ` Bjorn Helgaas
2015-10-15 16:19               ` Ray Jui
2015-10-15 16:19                 ` Ray Jui
2015-10-15 19:40                 ` [PATCH v2] " Arnd Bergmann
2015-10-15 19:40                   ` Arnd Bergmann
2015-10-15 20:57                   ` Hauke Mehrtens
2015-10-15 20:57                     ` Hauke Mehrtens
2015-10-15 21:01                   ` Bjorn Helgaas
2015-10-15 21:01                     ` Bjorn Helgaas
2015-10-16  9:47                     ` Arnd Bergmann
2015-10-16  9:47                       ` Arnd Bergmann
2015-10-16 13:23                       ` Bjorn Helgaas
2015-10-16 13:23                         ` Bjorn Helgaas
2015-10-13 21:21       ` [PATCH] " Kevin Hilman
2015-10-13 21:21         ` Kevin Hilman
2015-09-16  0:39 ` [PATCH 8/8] PCI: iproc: Fix compile warnings Ray Jui
2015-09-16  0:39   ` Ray Jui
2015-09-25 23:21 ` [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Bjorn Helgaas
2015-09-25 23:21   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561D6458.40504@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=broonie@kernel.org \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=rjui@broadcom.com \
    --cc=tyler.baker@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.