All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000
@ 2019-06-05 14:26 Bin Meng
  2019-06-07  5:50 ` Stefan Roese
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bin Meng @ 2019-06-05 14:26 UTC (permalink / raw)
  To: u-boot

commit b7598a43f2b4 ("[PATCH] Avoid assigning PCI resources from
zero address") only moved the bus lower address to 0x1000 if the
given bus start address is zero. The comment said 0x1000 is a
reasonable starting value, hence we'd better apply the same
adjustment when the given bus start address is below 0x1000.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- avoid changing res->bus_start

 drivers/pci/pci_auto_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci_auto_common.c b/drivers/pci/pci_auto_common.c
index 1837873..84908e6 100644
--- a/drivers/pci/pci_auto_common.c
+++ b/drivers/pci/pci_auto_common.c
@@ -21,9 +21,10 @@ void pciauto_region_init(struct pci_region *res)
 	/*
 	 * Avoid allocating PCI resources from address 0 -- this is illegal
 	 * according to PCI 2.1 and moreover, this is known to cause Linux IDE
-	 * drivers to fail. Use a reasonable starting value of 0x1000 instead.
+	 * drivers to fail. Use a reasonable starting value of 0x1000 instead
+	 * if the bus start address is below 0x1000.
 	 */
-	res->bus_lower = res->bus_start ? res->bus_start : 0x1000;
+	res->bus_lower = res->bus_start < 0x1000 ? 0x1000 : res->bus_start;
 }
 
 void pciauto_region_align(struct pci_region *res, pci_size_t size)
-- 
2.7.4

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

* [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000
  2019-06-05 14:26 [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000 Bin Meng
@ 2019-06-07  5:50 ` Stefan Roese
  2019-06-19  7:12 ` Bin Meng
  2019-06-22 16:08 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2019-06-07  5:50 UTC (permalink / raw)
  To: u-boot

On 05.06.19 16:26, Bin Meng wrote:
> commit b7598a43f2b4 ("[PATCH] Avoid assigning PCI resources from
> zero address") only moved the bus lower address to 0x1000 if the
> given bus start address is zero. The comment said 0x1000 is a
> reasonable starting value, hence we'd better apply the same
> adjustment when the given bus start address is below 0x1000.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Though again my question, where you did spot an issue with the
current implementation?

Thanks,
Stefan

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

* [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000
  2019-06-05 14:26 [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000 Bin Meng
  2019-06-07  5:50 ` Stefan Roese
@ 2019-06-19  7:12 ` Bin Meng
  2019-06-22 16:08 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2019-06-19  7:12 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On Wed, Jun 5, 2019 at 10:26 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> commit b7598a43f2b4 ("[PATCH] Avoid assigning PCI resources from
> zero address") only moved the bus lower address to 0x1000 if the
> given bus start address is zero. The comment said 0x1000 is a
> reasonable starting value, hence we'd better apply the same
> adjustment when the given bus start address is below 0x1000.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - avoid changing res->bus_start

Somehow I did not receive your RB in my inbox. However when I look at
the patch in patchwork [1], I found you already gave your RB tag, so
there must have be something wrong with gmail.

Regarding your question, first it was just pure code review before and
at that time I did not spot any actual issue. However I indeed created
a test case to trigger the issue.

If I modified qemu-x86_i440fx.dts pci range to have the PCI IO region
address starts from 0x100, when Linux boots, it reports the following:
[    0.445751] pci 0000:00:03.0: can't claim BAR 1 [io
0x0140-0x017f]: address conflict with 0000:00:01.1 [io  0x0170-0x0177]

With my patch, there is no longer such complaints from the kernel driver.

[1] http://patchwork.ozlabs.org/patch/1110510/

Regards,
Bin

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

* [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000
  2019-06-05 14:26 [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000 Bin Meng
  2019-06-07  5:50 ` Stefan Roese
  2019-06-19  7:12 ` Bin Meng
@ 2019-06-22 16:08 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2019-06-22 16:08 UTC (permalink / raw)
  To: u-boot

On Wed, Jun 05, 2019 at 07:26:44AM -0700, Bin Meng wrote:

> commit b7598a43f2b4 ("[PATCH] Avoid assigning PCI resources from
> zero address") only moved the bus lower address to 0x1000 if the
> given bus start address is zero. The comment said 0x1000 is a
> reasonable starting value, hence we'd better apply the same
> adjustment when the given bus start address is below 0x1000.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190622/306743a1/attachment.sig>

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

end of thread, other threads:[~2019-06-22 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 14:26 [U-Boot] [PATCH v2] pci: Avoid assigning PCI resources that are below 0x1000 Bin Meng
2019-06-07  5:50 ` Stefan Roese
2019-06-19  7:12 ` Bin Meng
2019-06-22 16:08 ` Tom Rini

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.