From: Bjorn Helgaas <helgaas@kernel.org>
To: "Wannes Bouwen (Nokia)" <wannes.bouwen@nokia.com>
Cc: "bhelgaas@google.com" <bhelgaas@google.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Vidya Sagar <vidyas@nvidia.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Rob Herring <robh@kernel.org>
Subject: Re: Subject: [PATCH 1/1] PCI: of: avoid warning for 4 GiB non-prefetchable
Date: Fri, 28 Feb 2025 12:27:30 -0600 [thread overview]
Message-ID: <20250228182730.GA59475@bhelgaas> (raw)
In-Reply-To: <PA4PR07MB883875A86213C568BC2E08E2FD5B2@PA4PR07MB8838.eurprd07.prod.outlook.com>
[+cc Vidya and reviewers of fede8526cc48]
On Thu, Nov 14, 2024 at 02:05:08PM +0000, Wannes Bouwen (Nokia) wrote:
> 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(-)
>
> 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");
I guess this relies on the fact that BARs must be a power of two in
size, right? So anything where the upper 32 bits of the size are
non-zero is either 0x1_0000_0000 (4GiB window that we shouldn't warn
about), or 0x2_0000_0000 or bigger (where we *do* want to warn about
it).
But it looks like this is used for host bridge resources, which are
windows, not BARs, so they don't have to be a power of two size. A
window of size 0x1_8000_0000 is perfectly legal and would fit the
criteria for this warning, but this patch would turn off the warning.
I don't really understand this warning in the first place, though. It
was added by fede8526cc48 ("PCI: of: Warn if non-prefetchable memory
aperture size is > 32-bit"). But I think the real issue would be
related to the highest address, not the size. For example, an
aperture of 0x0_c000_0000 - 0x1_4000_0000 is only 0x8000_0000 in size,
but the upper half of it it would be invalid for non-prefetchable
32-bit BARs.
Bjorn
next prev parent reply other threads:[~2025-02-28 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 14:05 Subject: [PATCH 1/1] PCI: of: avoid warning for 4 GiB non-prefetchable Wannes Bouwen (Nokia)
2025-02-28 18:27 ` Bjorn Helgaas [this message]
2025-02-28 23:01 ` Rob Herring
2025-02-28 23:17 ` Bjorn Helgaas
2025-03-03 10:35 ` Wannes Bouwen (Nokia)
2025-03-03 15:53 ` Bjorn Helgaas
2025-03-04 9:15 ` Wannes Bouwen (Nokia)
2025-03-04 21:30 ` 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=20250228182730.GA59475@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=robh@kernel.org \
--cc=vidyas@nvidia.com \
--cc=wannes.bouwen@nokia.com \
/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.