mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Rick Wertenbroek <rick.wertenbroek@gmail.com>
Cc: "Damien Le Moal" <dlemoal@kernel.org>,
	rick.wertenbroek@heig-vd.ch, alberto.dassatti@heig-vd.ch,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Frank Li" <Frank.Li@nxp.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] PCI: endpoint: Introduce 'get_bar' to map fixed address BARs in EPC
Date: Tue, 23 Jul 2024 16:05:36 +0200	[thread overview]
Message-ID: <Zp+4sDfopSiAdWt/@x1-carbon.lan> (raw)
In-Reply-To: <CAAEEuhq1JLo+Lyhah6EGSTPZRbeEUFmbUehYXY1dA1f0KUwvrQ@mail.gmail.com>

On Tue, Jul 23, 2024 at 09:41:14AM +0200, Rick Wertenbroek wrote:
> 
> Interesting. I like this approach, this would also make it possible to
> combine the current 'pci_epf_alloc_space' and 'pci_epc_set_bar' into a
> single function which would simplify the endpoint functions.
> 
> The reason why it is separate now is so that 'pci_epf_alloc_space' can
> be called before the endpoint function is bound to a controller, and
> therefore the BAR memory can be filled and prepared before bind() is
> called. Merging 'pci_epf_alloc_bar' with 'pci_epc_set_bar' into a
> 'pci_epc_alloc_bar' (epc because it is dependent on the endpoint
> controller and prior to be bound to a specific controller we don't
> know if we need to allocate locally or remap) would make it impossible
> to access the BAR prior to be bound to a controller (because the
> function 'pci_epc_alloc_bar' would fail without a specific
> controller). I don't think this is a problem as an unbound endpoint
> function is kind of useless on its own, but this means the BAR memory
> could only be allocated/remapped/accessed once the endpoint is bound
> to a controller.

Back when I was looking it to this, I came to the conclusion:
"The proper place is to allocate them when receiving PERST,
but not all drivers have a PERST handler."

However, since:
https://github.com/torvalds/linux/commit/a01e7214bef904723d26d293eb17586078610379

All EPF drivers should get a epc_init event, either directly when the EPC
driver is loaded, or when PERST# is asserted.

So I definitely agree that it makes sense for all EPF function drivers to do
both alloc_space() + set_bar() is a single call, now when that is possible.

This will simplify a lot of PCIe endpoint code considerably.


Kind regards,
Niklas

  reply	other threads:[~2024-07-23 14:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 11:57 [PATCH 0/2] " Rick Wertenbroek
2024-07-19 11:57 ` [PATCH 1/2] " Rick Wertenbroek
2024-07-23  0:03   ` Damien Le Moal
2024-07-23  7:06     ` Rick Wertenbroek
2024-07-23  7:16       ` Damien Le Moal
2024-07-23  7:41         ` Rick Wertenbroek
2024-07-23 14:05           ` Niklas Cassel [this message]
2024-07-23 14:17   ` Niklas Cassel
2024-07-23 16:06     ` Rick Wertenbroek
2024-07-23 16:48       ` Niklas Cassel
2024-07-25  5:33         ` Manivannan Sadhasivam
2024-07-25  6:30           ` Damien Le Moal
2024-07-25  7:40             ` Manivannan Sadhasivam
2024-07-25  8:13               ` Damien Le Moal
2024-07-25  8:06           ` Rick Wertenbroek
2024-07-25  8:20             ` Damien Le Moal
2024-07-25 14:07               ` Manivannan Sadhasivam
2024-07-25 13:53             ` Manivannan Sadhasivam
2024-07-25 14:17             ` Niklas Cassel
2024-07-25 16:36               ` Manivannan Sadhasivam
2024-07-25 21:52                 ` Niklas Cassel
2024-07-25 22:53                   ` Damien Le Moal
2024-07-26 11:21                     ` Rick Wertenbroek
2024-07-26 13:41                       ` Niklas Cassel
2024-07-29 16:42                         ` Manivannan Sadhasivam
2024-07-19 11:57 ` [PATCH 2/2] PCI: endpoint: pci-epf-test: Add support for controller with fixed addr BARs Rick Wertenbroek

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=Zp+4sDfopSiAdWt/@x1-carbon.lan \
    --to=cassel@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=alberto.dassatti@heig-vd.ch \
    --cc=bhelgaas@google.com \
    --cc=dlemoal@kernel.org \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=rick.wertenbroek@gmail.com \
    --cc=rick.wertenbroek@heig-vd.ch \
    /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

all inboxes | Powered by JetHome®