Re: [PATCH RFC 10/11] nvmet: Add addr fam and trtype for mdev pci driver

Mike Christie
2025-03-13T17:56:29Z

On 3/13/25 1:42 AM, Christoph Hellwig wrote:
> On Thu, Mar 13, 2025 at 12:18:11AM -0500, Mike Christie wrote:
>> This allocates 253 for mdev pci since it might not fit into any
>> existing value (not sure how to co-exist with pci-epf).
>>
>> One of the reasons this patchset is a RFC is because I was not sure
>> if allocating a new number for this was the best. Another approach
>> is that I could break up pci-epf into a:
>>
>> 1. PCI component - Common PCI and NVMe PCI code.
>> 2. Interface/bus component - Callouts so pci-epf can use the
>> pci_epf_driver/pci_epf_ops and mdev-pci can use mdev and vfio
>> callouts.
>> 3. Memory management component - Callouts for using DMA for pci-epf
>> vs vfio related memory for mdev-pci.
>>
>> On one hand, by creating a core nvmet pci driver then have subdrivers
>> we could share NVMF_ADDR_FAMILY_PCI and NVMF_TRTYPE_PCI. However,
>> it will get messy. There is some PCI code we could share for 1
>> but 2 and 3 will make sharing difficult becuse of how different the
>> drivers work (mdev-vfio vs pci-epf layers).
>
> I think we'll need to discuss this more based on concrete code proposals
> once we go along, but here's my handwavy 2cents for now:
>
> - in addition to the pure software endpoint and mdev I also expect
> hardardware offloaded PCIe endpoints to show up really soon, so
> we'll have more than just the two
> - having common code for different PCIe tagets where applicable is
> thus a good idea, but I'd expect it to be a set of library
> functions or conditionals in the core code, not a new layer
> with indirect calls

A lib based approach will be easier. I'll take a stab at it on the next
posting.

> - I had quite a lot of discussions with Damien about the trtype and
> related bits. I suspect by the time we get to having multiple
> PCIe endpoints we just need to split the configfs interface naming
> from the on-wire fabrics trtrype enum to not need trtype assignments.