Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1527542 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-11-22 15:30 +0100 |
| Last post | 2016-11-24 00:00 +0100 |
| Articles | 9 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 1/2] PCI: iproc: fix 32-bit build Arnd Bergmann <arnd@arndb.de> - 2016-11-22 15:30 +0100
[PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-11-22 15:30 +0100
Re: [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning Ray Jui <ray.jui@broadcom.com> - 2016-11-22 18:50 +0100
Re: [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-11-22 22:20 +0100
Re: [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning Ray Jui <ray.jui@broadcom.com> - 2016-11-23 04:10 +0100
Re: [PATCH 1/2] PCI: iproc: fix 32-bit build Ray Jui <ray.jui@broadcom.com> - 2016-11-22 18:50 +0100
Re: [PATCH 1/2] PCI: iproc: fix 32-bit build Arnd Bergmann <arnd@arndb.de> - 2016-11-22 22:20 +0100
Re: [PATCH 1/2] PCI: iproc: fix 32-bit build Ray Jui <ray.jui@broadcom.com> - 2016-11-23 04:00 +0100
Re: [PATCH 1/2] PCI: iproc: fix 32-bit build Bjorn Helgaas <helgaas@kernel.org> - 2016-11-24 00:00 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-11-22 15:30 +0100 |
| Subject | [PATCH 1/2] PCI: iproc: fix 32-bit build |
| Message-ID | <sGkf7-8lc-5@gated-at.bofh.it> |
The newly added code to setup the inbound ranges causes a link error
on 32-bit machines from a 32-bit division:
drivers/pci/host/pcie-iproc.o: In function `iproc_pcie_setup_ib':
pcie-iproc.c:(.text.iproc_pcie_setup_ib+0x14c): undefined reference to `__aeabi_uldivmod'
As both sides of the division are always power-of-two numbers and
we already rely on that, we can use a shift instead.
Fixes: 87c240b19bba ("PCI: iproc: Add inbound DMA mapping support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
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 d10e6aa32e0d..857ff5198317 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -865,7 +865,7 @@ static int iproc_pcie_ib_write(struct iproc_pcie *pcie, int region_idx,
* Now program the IMAP registers. Each IARR region may have one or
* more IMAP windows.
*/
- size /= nr_windows;
+ size >>= ilog2(nr_windows);
for (window_idx = 0; window_idx < nr_windows; window_idx++) {
val = readl(pcie->base + imap_offset);
val |= lower_32_bits(axi_addr) | IMAP_VALID;
--
2.9.0
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-11-22 15:30 +0100 |
| Subject | [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning |
| Message-ID | <sGkf8-8lc-21@gated-at.bofh.it> |
| In reply to | #1527542 |
gcc notices that calling iproc_pcie_setup_ib with ib->nr_regions==0
would result in an uninitialized return value:
drivers/pci/host/pcie-iproc.c: In function 'iproc_pcie_setup_ib':
drivers/pci/host/pcie-iproc.c:894:6: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This can't really happen, but the correct behavior of the function
is probably to return -EINVAL if it ever did.
Fixes: 4213e15c364e ("PCI: iproc: Make outbound mapping code more generic")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/pci/host/pcie-iproc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 857ff5198317..0359569c8d78 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -936,6 +936,7 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie,
}
}
+ ret = -EINVAL;
err_ib:
dev_err(dev, "unable to configure inbound mapping\n");
dev_err(dev, "axi %pap, pci %pap, res size %pap\n",
--
2.9.0
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2016-11-22 18:50 +0100 |
| Subject | Re: [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning |
| Message-ID | <sGnmG-1SY-15@gated-at.bofh.it> |
| In reply to | #1527554 |
Hi Arnd,
On 11/22/2016 6:17 AM, Arnd Bergmann wrote:
> gcc notices that calling iproc_pcie_setup_ib with ib->nr_regions==0
> would result in an uninitialized return value:
>
> drivers/pci/host/pcie-iproc.c: In function 'iproc_pcie_setup_ib':
> drivers/pci/host/pcie-iproc.c:894:6: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> This can't really happen, but the correct behavior of the function
> is probably to return -EINVAL if it ever did.
>
> Fixes: 4213e15c364e ("PCI: iproc: Make outbound mapping code more generic")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/pci/host/pcie-iproc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index 857ff5198317..0359569c8d78 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -936,6 +936,7 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie,
>
> }
> }
> + ret = -EINVAL;
> err_ib:
> dev_err(dev, "unable to configure inbound mapping\n");
> dev_err(dev, "axi %pap, pci %pap, res size %pap\n",
>
This change is good, but in my opinion, a further improvement for
clarity would be to initialize 'ret' to -EINVAL in the beginning of this
function when 'ret' is declared. What do you think?
Thanks,
Ray
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-11-22 22:20 +0100 |
| Subject | Re: [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning |
| Message-ID | <sGqDT-493-5@gated-at.bofh.it> |
| In reply to | #1527771 |
On Tuesday, November 22, 2016 9:45:24 AM CET Ray Jui wrote: > > diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c > > index 857ff5198317..0359569c8d78 100644 > > --- a/drivers/pci/host/pcie-iproc.c > > +++ b/drivers/pci/host/pcie-iproc.c > > @@ -936,6 +936,7 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie, > > > > } > > } > > + ret = -EINVAL; > > err_ib: > > dev_err(dev, "unable to configure inbound mapping\n"); > > dev_err(dev, "axi %pap, pci %pap, res size %pap\n", > > > > This change is good, but in my opinion, a further improvement for > clarity would be to initialize 'ret' to -EINVAL in the beginning of this > function when 'ret' is declared. What do you think? > I never do that, see https://rusty.ozlabs.org/?p=232 for a great explanation about why. Arnd
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2016-11-23 04:10 +0100 |
| Subject | Re: [PATCH 2/2] PCI: iproc: avoid maybe-uninitialized warning |
| Message-ID | <sGw6B-7BU-5@gated-at.bofh.it> |
| In reply to | #1527933 |
On 11/22/2016 1:15 PM, Arnd Bergmann wrote: > On Tuesday, November 22, 2016 9:45:24 AM CET Ray Jui wrote: >>> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c >>> index 857ff5198317..0359569c8d78 100644 >>> --- a/drivers/pci/host/pcie-iproc.c >>> +++ b/drivers/pci/host/pcie-iproc.c >>> @@ -936,6 +936,7 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie, >>> >>> } >>> } >>> + ret = -EINVAL; >>> err_ib: >>> dev_err(dev, "unable to configure inbound mapping\n"); >>> dev_err(dev, "axi %pap, pci %pap, res size %pap\n", >>> >> >> This change is good, but in my opinion, a further improvement for >> clarity would be to initialize 'ret' to -EINVAL in the beginning of this >> function when 'ret' is declared. What do you think? >> > > I never do that, see https://rusty.ozlabs.org/?p=232 for a great > explanation about why. > > Arnd > Okay got it. Thanks! Ray
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2016-11-22 18:50 +0100 |
| Message-ID | <sGnmH-1SY-49@gated-at.bofh.it> |
| In reply to | #1527542 |
On 11/22/2016 6:17 AM, Arnd Bergmann wrote:
> The newly added code to setup the inbound ranges causes a link error
> on 32-bit machines from a 32-bit division:
>
> drivers/pci/host/pcie-iproc.o: In function `iproc_pcie_setup_ib':
> pcie-iproc.c:(.text.iproc_pcie_setup_ib+0x14c): undefined reference to `__aeabi_uldivmod'
>
> As both sides of the division are always power-of-two numbers and
> we already rely on that, we can use a shift instead.
>
> Fixes: 87c240b19bba ("PCI: iproc: Add inbound DMA mapping support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 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 d10e6aa32e0d..857ff5198317 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -865,7 +865,7 @@ static int iproc_pcie_ib_write(struct iproc_pcie *pcie, int region_idx,
> * Now program the IMAP registers. Each IARR region may have one or
> * more IMAP windows.
> */
> - size /= nr_windows;
> + size >>= ilog2(nr_windows);
> for (window_idx = 0; window_idx < nr_windows; window_idx++) {
> val = readl(pcie->base + imap_offset);
> val |= lower_32_bits(axi_addr) | IMAP_VALID;
>
Hmmm, somehow we've never seen this link error for the ARM32 based
platforms that we build for. Does it behave differently between
different versions of compilers?
Nevertheless, this is a good change to take, thanks!
Acked-by: Ray Jui <ray.jui@broadcom.com>
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-11-22 22:20 +0100 |
| Message-ID | <sGqDT-493-13@gated-at.bofh.it> |
| In reply to | #1527781 |
On Tuesday, November 22, 2016 9:42:05 AM CET Ray Jui wrote: > > Hmmm, somehow we've never seen this link error for the ARM32 based > platforms that we build for. Does it behave differently between > different versions of compilers? > > Nevertheless, this is a good change to take, thanks! I looked at it again, and see now that it only happens with a 64-bit RESOURCE_SIZE_T, which is only used on 32-bit platforms with more than 4GB of memory addresses. It would however show up in a multiplatform distro build for ARMv7VE, so the fix is still clearly needed. Arnd
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2016-11-23 04:00 +0100 |
| Message-ID | <sGvWV-7jS-1@gated-at.bofh.it> |
| In reply to | #1527936 |
On 11/22/2016 1:13 PM, Arnd Bergmann wrote: > On Tuesday, November 22, 2016 9:42:05 AM CET Ray Jui wrote: >> >> Hmmm, somehow we've never seen this link error for the ARM32 based >> platforms that we build for. Does it behave differently between >> different versions of compilers? >> >> Nevertheless, this is a good change to take, thanks! > > I looked at it again, and see now that it only happens with > a 64-bit RESOURCE_SIZE_T, which is only used on 32-bit > platforms with more than 4GB of memory addresses. It would > however show up in a multiplatform distro build for ARMv7VE, > so the fix is still clearly needed. > > Arnd > Yes, got it for how it showed up in your environment, :) This change stands good as it has been. Thanks, Ray
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2016-11-24 00:00 +0100 |
| Message-ID | <sGOGd-2vZ-1@gated-at.bofh.it> |
| In reply to | #1527542 |
On Tue, Nov 22, 2016 at 03:17:51PM +0100, Arnd Bergmann wrote:
> The newly added code to setup the inbound ranges causes a link error
> on 32-bit machines from a 32-bit division:
>
> drivers/pci/host/pcie-iproc.o: In function `iproc_pcie_setup_ib':
> pcie-iproc.c:(.text.iproc_pcie_setup_ib+0x14c): undefined reference to `__aeabi_uldivmod'
>
> As both sides of the division are always power-of-two numbers and
> we already rely on that, we can use a shift instead.
>
> Fixes: 87c240b19bba ("PCI: iproc: Add inbound DMA mapping support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I folded these fixes into the pci/host-iproc branch for v4.10, thanks!
For some reason, I don't see Ray's responses on the list. Maybe still
some email problem?
> ---
> 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 d10e6aa32e0d..857ff5198317 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -865,7 +865,7 @@ static int iproc_pcie_ib_write(struct iproc_pcie *pcie, int region_idx,
> * Now program the IMAP registers. Each IARR region may have one or
> * more IMAP windows.
> */
> - size /= nr_windows;
> + size >>= ilog2(nr_windows);
> for (window_idx = 0; window_idx < nr_windows; window_idx++) {
> val = readl(pcie->base + imap_offset);
> val |= lower_32_bits(axi_addr) | IMAP_VALID;
> --
> 2.9.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web