From: Niklas Cassel <cassel@kernel.org>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: linux-pci@vger.kernel.org,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Wang Jiang" <jiangwang@kylinos.cn>,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs
Date: Fri, 5 Sep 2025 14:27:44 +0200 [thread overview]
Message-ID: <aLrXQGzYBB8JVE0Z@ryzen> (raw)
In-Reply-To: <20250905121259.9378-1-marek.vasut+renesas@mailbox.org>
On Fri, Sep 05, 2025 at 02:12:43PM +0200, Marek Vasut wrote:
> Currently, the test allocates BAR sizes according to fixed table
> bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 } . This
> does not work with controllers which have fixed size BARs, like
> Renesas R-Car V4H PCIe controller, which has BAR4 size limited
> to 256 Bytes, which is much less than 131072 currently requested
> by this test.
Perhaps rephase this to more clearly state that:
This does not work with controllers with have fixed size BARs that is
smaller than the requested BAR size.
(Since a lot of controllers drivers in-tree have fixed size BARs,
and they do work perfectly fine, but it is only because their fixed
size is larger than the size requested by pci-epf-test.c)
>
> Adjust the test such, that in case a fixed size BAR is detected
> on a controller, minimum of requested size and fixed size BAR
> size is used during the test instead.
This sentence needs to be updated, since you no longer take the minimum
of requested size and fixed size BAR.
Perhaps simply:
"Adjust the test such that in case a fixed size BAR is detected,
the fixed BAR size is used, as that is the only possibly option."
With that:
Reviewed-by: Niklas Cassel <cassel@kernel.org>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index e091193bd8a8a..2418add64104a 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -1050,7 +1050,12 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf)
> if (bar == test_reg_bar)
> continue;
>
> - base = pci_epf_alloc_space(epf, bar_size[bar], bar,
> + if (epc_features->bar[bar].type == BAR_FIXED)
> + test_reg_size = epc_features->bar[bar].fixed_size;
> + else
> + test_reg_size = bar_size[bar];
> +
> + base = pci_epf_alloc_space(epf, test_reg_size, bar,
> epc_features, PRIMARY_INTERFACE);
> if (!base)
> dev_err(dev, "Failed to allocate space for BAR%d\n",
> --
> 2.50.1
>
next prev parent reply other threads:[~2025-09-05 12:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 12:12 [PATCH v2] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs Marek Vasut
2025-09-05 12:27 ` Niklas Cassel [this message]
2025-09-05 18:41 ` Marek Vasut
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=aLrXQGzYBB8JVE0Z@ryzen \
--to=cassel@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=jiangwang@kylinos.cn \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@mailbox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox