Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Jerome Brunet <jbrunet@baylibre.com>
Cc: "Damien Le Moal" <dlemoal@kernel.org>,
	"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	linux-pci@vger.kernel.org,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Frank Li" <Frank.Li@nxp.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] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs
Date: Fri, 5 Sep 2025 10:36:07 +0200	[thread overview]
Message-ID: <aLqg90KqEJ8wSEPi@ryzen> (raw)
In-Reply-To: <1jplc54aoc.fsf@starbuckisacylon.baylibre.com>

On Fri, Sep 05, 2025 at 09:32:03AM +0200, Jerome Brunet wrote:
> On Thu 04 Sep 2025 at 14:28, Niklas Cassel <cassel@kernel.org> wrote:
> >> 
> >> I think this can be simplified to:
> >> 
> >> 		if (epc_features->bar[bar].type == BAR_FIXED)
> >> 			test_bar_size = epc_features->bar[bar].fixed_size;
> >> 		else
> >> 			test_bar_size = bar_size[bar];
> >
> > +1
> 
> It's what pci_epf_alloc_space() does too. so it makes sense but it also
> means the side must stay aligned.

Not really, pci_epf_alloc_space() will give you 'fixed_size'
if you request size < fixed_size.

If you request more, it will give you an error.

> 
> If a rework is needed, maybe it would be better to get size from
> pci_epf_alloc_space() instead of recomputing it ?

The pci-epf-test driver is just a test driver and we can use whatever
BAR size we want for each BAR.

However, I don't think that pci_epf_alloc_space() can always give us
a BAR size. Sure, for fixed_size BARs, there is only a single size
that is possible. But for Programmable and Resizable BARs, there are
many possible sizes, so which size should pci_epf_alloc_space() then
return?

And not all EPF drivers might be happy with an aribitrary BAR size
(which is the case for pci-epf-test), some EPF drivers might have
strict minimum sizes for a BAR.

So, I still think this proposal is the best thing we can do.

At least it appears that we only need to patch pci-epf-test.



Kind regards,
Niklas

  reply	other threads:[~2025-09-05  8:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  2:37 [PATCH] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs Marek Vasut
2025-09-04  2:40 ` Damien Le Moal
2025-09-04  3:32   ` Marek Vasut
2025-09-04  3:39     ` Damien Le Moal
2025-09-04 17:35       ` Marek Vasut
2025-09-04 12:28   ` Niklas Cassel
2025-09-04 21:29     ` Marek Vasut
2025-09-05  7:43       ` Jerome Brunet
2025-09-05 11:38         ` Marek Vasut
2025-09-05  7:32     ` Jerome Brunet
2025-09-05  8:36       ` Niklas Cassel [this message]
2025-09-05 12:14         ` 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=aLqg90KqEJ8wSEPi@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