diff mbox series

Subject: [PATCH 1/1] PCI: of: avoid warning for 4 GiB non-prefetchable

Message ID PA4PR07MB883875A86213C568BC2E08E2FD5B2@PA4PR07MB8838.eurprd07.prod.outlook.com (mailing list archive)
State New
Headers show
Series Subject: [PATCH 1/1] PCI: of: avoid warning for 4 GiB non-prefetchable | expand

Commit Message

Wannes Bouwen (Nokia) Nov. 14, 2024, 2:05 p.m. UTC
Subject: [PATCH 1/1] PCI: of: avoid warning for 4 GiB non-prefetchable
windows.

According to the PCIe spec, non-prefetchable memory supports only 32-bit
BAR registers and are hence limited to 4 GiB. In the kernel there is a
check that prints a warning if a non-prefetchable resource exceeds the
32-bit limit.

This check however prints a warning when a 4 GiB window on the host
bridge is used. This is perfectly possible according to the PCIe spec,
so in my opinion the warning is a bit too strict. This changeset
subtracts 1 from the resource_size to avoid printing a warning in the
case of a 4 GiB non-prefetchable window.

Signed-off-by: Wannes Bouwen <wannes.bouwen@nokia.com>
---
 drivers/pci/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.39.3
diff mbox series

Patch

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index dacea3fc5128..ccbb1f1c2212 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -622,7 +622,7 @@  static int pci_parse_request_of_pci_ranges(struct device *dev,
            res_valid |= !(res->flags & IORESOURCE_PREFETCH);

            if (!(res->flags & IORESOURCE_PREFETCH))
-               if (upper_32_bits(resource_size(res)))
+               if (upper_32_bits(resource_size(res) - 1))
                    dev_warn(dev, "Memory resource size exceeds max for 32 bits\n");

            break;