From: Niklas Cassel <cassel@kernel.org>
To: Rick Wertenbroek <rick.wertenbroek@gmail.com>
Cc: "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
rick.wertenbroek@heig-vd.ch, alberto.dassatti@heig-vd.ch,
"Krzysztof Wilczyński" <kw@linux.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Frank Li" <Frank.Li@nxp.com>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
"Arnd Bergmann" <arnd@arndb.de>
Subject: Re: [PATCH 1/2] PCI: endpoint: Introduce 'get_bar' to map fixed address BARs in EPC
Date: Thu, 25 Jul 2024 16:17:03 +0200 [thread overview]
Message-ID: <ZqJeX9D0ra2g9ifP@ryzen.lan> (raw)
In-Reply-To: <CAAEEuhpH-HB-tLinkLcCmiJ-9fmrGVjJFTjj7Nxk5M8M3XxSPA@mail.gmail.com>
On Thu, Jul 25, 2024 at 10:06:38AM +0200, Rick Wertenbroek wrote:
>
> I don't know if the EPF node in the DT is the right place for the
> following reasons. First, it describes the requirements of the EPF and
> not the restrictions imposed by the EPC (so for example one function
> requires the BAR to use a given physical address and this is described
> in the DT EPF node, but the controller could use any address, it just
> configures the controller to use the address the EPF wants, but in the
> other case (e.g., on FPGA), the EPC can only handle a BAR at a given
> physical address and no other address so this should be in the EPC
> node). Second, it is very static, so the EPC relation EPF would be
> bound in the DT, I prefer being able to bind-unbind from configfs so
> that I can make changes without reboot (e.g., alternate between two or
> more endpoint functions, which may have different BAR requirements and
> configurations).
I agree that the MHI case (EPF requires a specific host address for the BAR)
and the FPGA case (EPC requires a specific host address for the BAR),
is different.
Right now, for EPC requirements, we have epc_features in the driver that
describes hardware for this EPC (e.g. fixed size BARs). Right now, I don't
see a reason to move this to DT (or let a DT alternative co-exist).
For EPF requirements, the MHI EPF driver exposes several different
versions (pci_epf_mhi_sa8775p, pci_epf_mhi_sdx55, pci_epf_mhi_sm8450)
in configfs, and each have their own specific driver data.
The only negative I can see with this is that it might clutter the
/sys/kernel/config/pci_ep/functions/ directory. Perhaps it is possible
to create a /sys/kernel/config/pci_ep/functions/pci_epf_mhi/ directory
where all the different versions reside?
Keeping this per-platform data in the MHI EPF driver is fine IMO.
If you would prefer to create a "pci_epf_mhi" generic version, that instead
takes this information from configfs, that would be fine too. I would also
be fine if you created a "pci_epf_mhi" generic version that tries to take
this information from device tree (as long as it is also possible to supply
the same information via configfs).
Good luck getting it accepted by the DT maintainers though. The configfs
interface was chosen because some developers (including Arnd Bergmann, IIRC)
didn't like the idea of having EPF specific information in DT.
> For combining pci_epf_alloc_space and pci_epc_set_bar into a single
> function, everyone seems to agree on this one.
Indeed, but as usual, good naming is one of the hardest problems :)
Instead of pci_epf_alloc_set_bar(), perhaps pci_epf_setup_bar() ?
If the EPC has a fixed address requirement, it will use that instead of
allocating memory.
If the EPF has a fixed address requirement, the API call will only succeed
if EPC does not have a fixed address requirement.
Perhaps EPF drivers that have a fixed address requirement could supply
that as a parameter to the API (and the EPC driver will fail the request
if it itself has fixed address requirement).
We already supply 'struct pci_epf_bar' to .set_bar(). I think the simplest
is just to extend this struct with more members (e.g. requires_fixed_addr,
fixed_addr). Basically 'struct pci_epf_bar' has all the wishes of the EPF
(32-bit/64-bit, IO/MEM BAR, BAR size, etc.).
It is already up to the EPC driver to fail the .set_bar() request if it
can't be satisfied, so pci_epf_setup_bar() could behave like .set_bar().
Kind regards,
Niklas
next prev parent reply other threads:[~2024-07-25 14:17 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 11:57 [PATCH 0/2] PCI: endpoint: Introduce 'get_bar' to map fixed address BARs in EPC 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
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 [this message]
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=ZqJeX9D0ra2g9ifP@ryzen.lan \
--to=cassel@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=alberto.dassatti@heig-vd.ch \
--cc=arnd@arndb.de \
--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