Skip to contentSkip to conversation

Add support for Block Passthrough Endpoint function driver

PATCH In review Wadim Mueller 5 participants 12 messages Feb 24, 2024 – Sep 25, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add support for Block Passthrough Endpoint function driver

Hello,

This series adds support for the Block Passthrough PCI(e) Endpoint functionality.
PCI Block Device Passthrough allows one Linux Device running in EP mode to expose its Block devices to the PCI(e) host (RC). The device can export either the full disk or just certain partitions. Also an export in readonly mode is possible. This is useful if you want to share the same blockdevice between different SoCs, providing each SoC its own partition(s).

Block Passthrough
==================
The PCI Block Passthrough can be a useful feature if you have multiple SoCs in your system connected
through a PCI(e) link, one running in RC mode, the other in EP mode.
If the block devices are connected to one SoC (SoC2 in EP Mode from the diagramm below) and you want to access those from the other SoC (SoC1 in RC mode below), without having any direct connection to
those block devices (e.g. if you want to share an NVMe between two SoCs). An simple example of such a configurationis is shown below:

                                                           +-------------+
                                                           |             |
                                                           |   SD Card   |
                                                           |             |
                                                           +------^------+
                                                                  |
                                                                  |
    +--------------------------+                +-----------------v----------------+
    |                          |      PCI(e)    |                                  |
    |         SoC1 (RC)        |<-------------->|            SoC2 (EP)             |
    | (CONFIG_PCI_REMOTE_DISK) |                |(CONFIG_PCI_EPF_BLOCK_PASSTHROUGH)|
    |                          |                |                                  |
    +--------------------------+                +-----------------^----------------+
                                                                  |
                                                                  |
                                                           +------v------+
                                                           |             |
                                                           |    NVMe     |
                                                           |             |
                                                           +-------------+

This is to a certain extent a similar functionality which NBD exposes over Network, but on the PCI(e) bus utilizing the EPC/EPF Kernel Framework.

The Endpoint Function driver creates parallel Queues which run on seperate CPU Cores using percpu structures. The number of parallel queues is limited by the number of CPUs on the EP device. The actual number of queues is configurable (as all other features of the driver) through CONFIGFS.

A documentation about the functional description as well as a user guide showing how both drivers can be configured is part of this series.

Test setup
==========

This series has been tested on an NXP S32G2 SoC running in Endpoint mode with a direct connection to an ARM64 host machine.

A performance measurement on the described setup shows good performance metrics. The S32G2 SoC has a 2xGen3 link which has a maximum Bandwidth of ~2GiB/s. With the explained setup a Read Datarate of 1.3GiB/s (with DMA ... without DMA the speed saturated at ~200MiB/s) was achieved using an 512GiB Kingston NVMe when accessing the NVMe from the ARM64 (SoC1) Host. The local Read Datarate accessing the NVMe dirctly from the S32G2 (SoC2) was around 1.5GiB.

The measurement was done through the FIO tool [1] with 4kiB Blocks.

[1] https://linux.die.net/man/1/fio

Wadim Mueller (3):
PCI: Add PCI Endpoint function driver for Block-device passthrough
PCI: Add PCI driver for a PCI EP remote Blockdevice
Documentation: PCI: Add documentation for the PCI Block Passthrough

 .../function/binding/pci-block-passthru.rst   |   24 +
 Documentation/PCI/endpoint/index.rst          |    3 +
 .../pci-endpoint-block-passthru-function.rst  |  331 ++++
 .../pci-endpoint-block-passthru-howto.rst     |  158 ++
 MAINTAINERS                                   |    8 +
 drivers/block/Kconfig                         |   14 +
 drivers/block/Makefile                        |    1 +
 drivers/block/pci-remote-disk.c               | 1047 +++++++++++++
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 .../functions/pci-epf-block-passthru.c        | 1393 +++++++++++++++++
 include/linux/pci-epf-block-passthru.h        |   77 +
 12 files changed, 3069 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst
 create mode 100644 drivers/block/pci-remote-disk.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-passthru.c
 create mode 100644 include/linux/pci-epf-block-passthru.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 PCI: Add PCI Endpoint function driver for Block-device passthrough

PCI Block Device Passthrough Endpoint function driver. This driver implements the Block Device function over PCI(e) in the endpoint device.

This driver implements a simple Register interface which is configured by the Host (RC) to export a certain block device attached to the Device acting as an Endpoint.

Which devices are exposed and can be attached to from the Host side is configurable through ConfigFS. Exporting in Read-Only mode is also possible as well as exporting only certain partitions of a Block Device.

It further is responsible for carrying out all PCI(e) related activities like mapping the host memory, transferring the requested block sectors to the host and triggering MSIs on completion.

---
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 .../functions/pci-epf-block-passthru.c        | 1393 +++++++++++++++++
 include/linux/pci-epf-block-passthru.h        |   77 +
 4 files changed, 1483 insertions(+)
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-passthru.c
 create mode 100644 include/linux/pci-epf-block-passthru.h
drivers/pci/endpoint/functions/Kconfig +12 -0
index 0c9cea0698d7..3e7d1666642a 100644
@@ -47,3 +47,15 @@ config PCI_EPF_MHI
 	   devices such as SDX55.
 
 	   If in doubt, say "N" to disable Endpoint driver for MHI bus.
+
+config PCI_EPF_BLOCK_PASSTHROUGH
+	tristate "PCI Endpoint Block Passthrough driver"
+	depends on PCI_ENDPOINT
+	select CONFIGFS_FS
+	help
+	  Select this configuration option to enable the Block Device Passthrough functionality.
+	  This driver can pass through any Block device available on the Host on which this driver is loaded.
+	  The decision which device is provided as a PCI Endpoint function has to be configured through CONFIG_FS.
+
+	  If in doubt, say "N" to disable Endpoint Block Passhthrough driver.
+
drivers/pci/endpoint/functions/Makefile +1 -0
index 696473fce50e..a2564d817762 100644
@@ -7,3 +7,4 @@ obj-$(CONFIG_PCI_EPF_TEST)		+= pci-epf-test.o
 obj-$(CONFIG_PCI_EPF_NTB)		+= pci-epf-ntb.o
 obj-$(CONFIG_PCI_EPF_VNTB) 		+= pci-epf-vntb.o
 obj-$(CONFIG_PCI_EPF_MHI)		+= pci-epf-mhi.o
+obj-$(CONFIG_PCI_EPF_BLOCK_PASSTHROUGH)	+= pci-epf-block-passthru.o
drivers/pci/endpoint/functions/pci-epf-block-passthru.c new file +1393 -0

1,393 lines not on this page · raw message

include/linux/pci-epf-block-passthru.h new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 PCI: Add PCI driver for a PCI EP remote Blockdevice

In reply to Wadim Mueller

Add PCI Remote Disk Driver for the PCI Endpoint Block Passthrough function driver. This driver allows you to access the block devices from a remote PCI Endpoint driver (pci-epf-block-passthru) as local block devices.

This driver is the complement of the Endpoint
function driver (configured through the CONFIG_PCI_EPF_BLOCK_PASSTHROUGH option on the EP device which exposes its Block Devices).

After the endpoint driver has configured which Block devices it wants to export, this driver is responsible to configure (again through ConfigFS) on the Host
side to which of the exported devices the Host (RC) wants to attach to.

After the devices are attached to the Host, it can access those devices as local block devices.

---
 drivers/block/Kconfig           |   14 +
 drivers/block/Makefile          |    1 +
 drivers/block/pci-remote-disk.c | 1047 +++++++++++++++++++++++++++++++
 3 files changed, 1062 insertions(+)
 create mode 100644 drivers/block/pci-remote-disk.c
drivers/block/Kconfig +14 -0
index 5b9d4aaebb81..f01ae15f4a5e 100644
@@ -402,6 +402,20 @@ config BLKDEV_UBLK_LEGACY_OPCODES
 	  suggested to enable N if your application(ublk server) switches to
 	  ioctl command encoding.
 
+config PCI_REMOTE_DISK
+	tristate "PCI Remote Disk"
+	depends on BLOCK && PCI
+	select CONFIGFS_FS
+	help
+	  Say Y here if you want include the PCI remote disk, which allows you to map the blockdevices
+	  from a remote PCI Endpoint driver as local block devices. This can be useful if you
+	  have multiple SoCs in your system where the block devices are connected to one SoC and you want to access
+	  those from the other SoC. The decision to which remote disk you want to attach is done through CONFIG_FS.
+	  This option is the complement to the CONFIG_PCI_EPF_BLOCK_PASSTHROUGH options which must
+	  be set on the Endpoint device which exposes its Block Devices.
+
+	  If unsure, say N.
+
 source "drivers/block/rnbd/Kconfig"
 
 endif # BLK_DEV
drivers/block/Makefile +1 -0
index 101612cba303..94a10c87b97e 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_SUNVDC)		+= sunvdc.o
 
 obj-$(CONFIG_BLK_DEV_NBD)	+= nbd.o
 obj-$(CONFIG_VIRTIO_BLK)	+= virtio_blk.o
+obj-$(CONFIG_PCI_REMOTE_DISK)   += pci-remote-disk.o
 
 obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= xen-blkfront.o
 obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= xen-blkback/
drivers/block/pci-remote-disk.c new file +1047 -0

1,047 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 Documentation: PCI: Add documentation for the PCI Block Passthrough

In reply to Wadim Mueller

Add documentation for the PCI Block Passthrough function device. The endpoint function driver and the host PCI driver should be configured based on this documentation.

---
 .../function/binding/pci-block-passthru.rst   |  24 ++
 Documentation/PCI/endpoint/index.rst          |   3 +
 .../pci-endpoint-block-passthru-function.rst  | 331 ++++++++++++++++++
 .../pci-endpoint-block-passthru-howto.rst     | 158 +++++++++
 MAINTAINERS                                   |   8 +
 5 files changed, 524 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst
Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst new file +24 -0
new file mode 100644
index 000000000000..60820edce594
@@ -0,0 +1,24 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==========================
+PCI Test Endpoint Function
+==========================
+
+name: Should be "pci_epf_blockpt" to bind to the pci_epf_blockpt driver.
+
+Configurable Fields:
+
+================   ===========================================================
+vendorid	   should be 0x0000
+deviceid	   should be 0xc402 for S32CC
+revid		   don't care
+progif_code	   don't care
+subclass_code	   don't care
+baseclass_code	   should be 0xff
+cache_line_size	   don't care
+subsys_vendor_id   don't care
+subsys_id	   don't care
+interrupt_pin	   don't care
+msi_interrupts	   don't care
+msix_interrupts	   don't care
+================   ===========================================================
Documentation/PCI/endpoint/index.rst +3 -0
index 4d2333e7ae06..2e4e5ac114df 100644
@@ -15,6 +15,9 @@ PCI Endpoint Framework
    pci-ntb-howto
    pci-vntb-function
    pci-vntb-howto
+   pci-endpoint-block-passthru-function
+   pci-endpoint-block-passthru-howto
 
    function/binding/pci-test
    function/binding/pci-ntb
+   function/binding/pci-block-passthru
Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst new file +331 -0

331 lines not on this page · raw message

Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst new file +158 -0

158 lines not on this page · raw message

MAINTAINERS +8 -0
index 7c51a22cee93..f0ed873470f0 100644
@@ -17015,6 +17015,14 @@ F:	drivers/misc/pci_endpoint_test.c
 F:	drivers/pci/endpoint/
 F:	tools/pci/
 
+PCI ENDPOINT BLOCK PASSTHROUGH
+M:	Wadim Mueller <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	drivers/pci/endpoint/functions/pci-epf-block-passthru.c
+F:	drivers/block/pci-remote-disk.c
+F:	include/linux/pci-epf-block-passthru.h
+
 PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC
 M:	Mahesh J Salgaonkar <[email protected]>
 R:	Oliver O'Halloran <[email protected]>
Signature · 1 line
2.25.1
#4 lore raw
In reply to Wadim Mueller
Quoted 50 lines · Wadim Mueller

Hello,

This series adds support for the Block Passthrough PCI(e) Endpoint functionality.
PCI Block Device Passthrough allows one Linux Device running in EP mode to expose its Block devices to the PCI(e) host (RC). The device can export either the full disk or just certain partitions. Also an export in readonly mode is possible. This is useful if you want to share the same blockdevice between different SoCs, providing each SoC its own partition(s).

Block Passthrough
==================
The PCI Block Passthrough can be a useful feature if you have multiple SoCs in your system connected
through a PCI(e) link, one running in RC mode, the other in EP mode.
If the block devices are connected to one SoC (SoC2 in EP Mode from the diagramm below) and you want to access those from the other SoC (SoC1 in RC mode below), without having any direct connection to
those block devices (e.g. if you want to share an NVMe between two SoCs). An simple example of such a configurationis is shown below:

                                                           +-------------+
                                                           |             |
                                                           |   SD Card   |
                                                           |             |
                                                           +------^------+
                                                                  |
                                                                  |
    +--------------------------+                +-----------------v----------------+
    |                          |      PCI(e)    |                                  |
    |         SoC1 (RC)        |<-------------->|            SoC2 (EP)             |
    | (CONFIG_PCI_REMOTE_DISK) |                |(CONFIG_PCI_EPF_BLOCK_PASSTHROUGH)|
    |                          |                |                                  |
    +--------------------------+                +-----------------^----------------+
                                                                  |
                                                                  |
                                                           +------v------+
                                                           |             |
                                                           |    NVMe     |
                                                           |             |
                                                           +-------------+

This is to a certain extent a similar functionality which NBD exposes over Network, but on the PCI(e) bus utilizing the EPC/EPF Kernel Framework.

The Endpoint Function driver creates parallel Queues which run on seperate CPU Cores using percpu structures. The number of parallel queues is limited by the number of CPUs on the EP device. The actual number of queues is configurable (as all other features of the driver) through CONFIGFS.

A documentation about the functional description as well as a user guide showing how both drivers can be configured is part of this series.

Test setup
==========

This series has been tested on an NXP S32G2 SoC running in Endpoint mode with a direct connection to an ARM64 host machine.

Quoted 8 lines

A performance measurement on the described setup shows good performance metrics. The S32G2 SoC has a 2xGen3 link which has a maximum Bandwidth of ~2GiB/s. With the explained setup a Read Datarate of 1.3GiB/s (with DMA ... without DMA the speed saturated at ~200MiB/s) was achieved using an 512GiB Kingston NVMe when accessing the NVMe from the ARM64 (SoC1) Host. The local Read Datarate accessing the NVMe dirctly from the S32G2 (SoC2) was around 1.5GiB.

The measurement was done through the FIO tool [1] with 4kiB Blocks.

[1] https://linux.die.net/man/1/fio

Thanks for the proposal! We are planning to add virtio function support to endpoint subsystem to cover usecases like this. I think your usecase can be satisfied using vitio-blk. Maybe you can add the virtio-blk endpoint function support once we have the infra in place. Thoughts?

- Mani

Quoted 28 lines

Wadim Mueller (3):
PCI: Add PCI Endpoint function driver for Block-device passthrough
PCI: Add PCI driver for a PCI EP remote Blockdevice
Documentation: PCI: Add documentation for the PCI Block Passthrough

 .../function/binding/pci-block-passthru.rst   |   24 +
 Documentation/PCI/endpoint/index.rst          |    3 +
 .../pci-endpoint-block-passthru-function.rst  |  331 ++++
 .../pci-endpoint-block-passthru-howto.rst     |  158 ++
 MAINTAINERS                                   |    8 +
 drivers/block/Kconfig                         |   14 +
 drivers/block/Makefile                        |    1 +
 drivers/block/pci-remote-disk.c               | 1047 +++++++++++++
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 .../functions/pci-epf-block-passthru.c        | 1393 +++++++++++++++++
 include/linux/pci-epf-block-passthru.h        |   77 +
 12 files changed, 3069 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst
 create mode 100644 drivers/block/pci-remote-disk.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-passthru.c
 create mode 100644 include/linux/pci-epf-block-passthru.h
Signature · 1 line
2.25.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#5 lore raw
Quoted 60 lines · Manivannan Sadhasivam
Quoted 50 lines · Wadim Mueller

Hello,

This series adds support for the Block Passthrough PCI(e) Endpoint functionality.
PCI Block Device Passthrough allows one Linux Device running in EP mode to expose its Block devices to the PCI(e) host (RC). The device can export either the full disk or just certain partitions. Also an export in readonly mode is possible. This is useful if you want to share the same blockdevice between different SoCs, providing each SoC its own partition(s).

Block Passthrough
==================
The PCI Block Passthrough can be a useful feature if you have multiple SoCs in your system connected
through a PCI(e) link, one running in RC mode, the other in EP mode.
If the block devices are connected to one SoC (SoC2 in EP Mode from the diagramm below) and you want to access those from the other SoC (SoC1 in RC mode below), without having any direct connection to
those block devices (e.g. if you want to share an NVMe between two SoCs). An simple example of such a configurationis is shown below:

                                                           +-------------+
                                                           |             |
                                                           |   SD Card   |
                                                           |             |
                                                           +------^------+
                                                                  |
                                                                  |
    +--------------------------+                +-----------------v----------------+
    |                          |      PCI(e)    |                                  |
    |         SoC1 (RC)        |<-------------->|            SoC2 (EP)             |
    | (CONFIG_PCI_REMOTE_DISK) |                |(CONFIG_PCI_EPF_BLOCK_PASSTHROUGH)|
    |                          |                |                                  |
    +--------------------------+                +-----------------^----------------+
                                                                  |
                                                                  |
                                                           +------v------+
                                                           |             |
                                                           |    NVMe     |
                                                           |             |
                                                           +-------------+

This is to a certain extent a similar functionality which NBD exposes over Network, but on the PCI(e) bus utilizing the EPC/EPF Kernel Framework.

The Endpoint Function driver creates parallel Queues which run on seperate CPU Cores using percpu structures. The number of parallel queues is limited by the number of CPUs on the EP device. The actual number of queues is configurable (as all other features of the driver) through CONFIGFS.

A documentation about the functional description as well as a user guide showing how both drivers can be configured is part of this series.

Test setup
==========

This series has been tested on an NXP S32G2 SoC running in Endpoint mode with a direct connection to an ARM64 host machine.

Quoted 8 lines

A performance measurement on the described setup shows good performance metrics. The S32G2 SoC has a 2xGen3 link which has a maximum Bandwidth of ~2GiB/s. With the explained setup a Read Datarate of 1.3GiB/s (with DMA ... without DMA the speed saturated at ~200MiB/s) was achieved using an 512GiB Kingston NVMe when accessing the NVMe from the ARM64 (SoC1) Host. The local Read Datarate accessing the NVMe dirctly from the S32G2 (SoC2) was around 1.5GiB.

The measurement was done through the FIO tool [1] with 4kiB Blocks.

[1] https://linux.die.net/man/1/fio

Quoted 7 lines

Thanks for the proposal! We are planning to add virtio function support to endpoint subsystem to cover usecases like this. I think your usecase can be satisfied using vitio-blk. Maybe you can add the virtio-blk endpoint function support once we have the infra in place. Thoughts?

- Mani

Hi Mani,
I initially had the plan to implement the virtio-blk as an endpoint function driver instead of a self baked driver.

This for sure is more elegant as we could reuse the virtio-blk pci driver instead of implementing a new one (as I did)

But I initially had some concerns about the feasibility, especially that the virtio-blk pci driver is expecting immediate responses to some register writes which I would not be able to satisfy, simply because we do not have any kind of interrupt/event which would be triggered on the EP side when the RC is accessing some BAR Registers (at least there is no machanism I know of). As virtio is made mainly for Hypervisor <-> Guest communication I was afraid that a Hypersisor is able to Trap every Register access from the Guest and act accordingly, which I would not be able to do. I hope this make sense to you.

But to make a long story short, yes I agree with you that virtio-blk would satisfy my usecase, and I generally think it would be a better solution, I just did not know that you are working on some infrastructure for that. And yes I would like to implement the endpoint function driver for virtio-blk. Is there already an development tree you use to work on the infrastructre I could have a look at?

- Wadim

Quoted 31 lines
Quoted 28 lines

Wadim Mueller (3):
PCI: Add PCI Endpoint function driver for Block-device passthrough
PCI: Add PCI driver for a PCI EP remote Blockdevice
Documentation: PCI: Add documentation for the PCI Block Passthrough

 .../function/binding/pci-block-passthru.rst   |   24 +
 Documentation/PCI/endpoint/index.rst          |    3 +
 .../pci-endpoint-block-passthru-function.rst  |  331 ++++
 .../pci-endpoint-block-passthru-howto.rst     |  158 ++
 MAINTAINERS                                   |    8 +
 drivers/block/Kconfig                         |   14 +
 drivers/block/Makefile                        |    1 +
 drivers/block/pci-remote-disk.c               | 1047 +++++++++++++
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 .../functions/pci-epf-block-passthru.c        | 1393 +++++++++++++++++
 include/linux/pci-epf-block-passthru.h        |   77 +
 12 files changed, 3069 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst
 create mode 100644 drivers/block/pci-remote-disk.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-passthru.c
 create mode 100644 include/linux/pci-epf-block-passthru.h
Signature · 1 line
2.25.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#6 lore raw
Quoted 76 lines · Wadim Mueller
Quoted 60 lines · Manivannan Sadhasivam
Quoted 50 lines · Wadim Mueller

Hello,

This series adds support for the Block Passthrough PCI(e) Endpoint functionality.
PCI Block Device Passthrough allows one Linux Device running in EP mode to expose its Block devices to the PCI(e) host (RC). The device can export either the full disk or just certain partitions. Also an export in readonly mode is possible. This is useful if you want to share the same blockdevice between different SoCs, providing each SoC its own partition(s).

Block Passthrough
==================
The PCI Block Passthrough can be a useful feature if you have multiple SoCs in your system connected
through a PCI(e) link, one running in RC mode, the other in EP mode.
If the block devices are connected to one SoC (SoC2 in EP Mode from the diagramm below) and you want to access those from the other SoC (SoC1 in RC mode below), without having any direct connection to
those block devices (e.g. if you want to share an NVMe between two SoCs). An simple example of such a configurationis is shown below:

                                                           +-------------+
                                                           |             |
                                                           |   SD Card   |
                                                           |             |
                                                           +------^------+
                                                                  |
                                                                  |
    +--------------------------+                +-----------------v----------------+
    |                          |      PCI(e)    |                                  |
    |         SoC1 (RC)        |<-------------->|            SoC2 (EP)             |
    | (CONFIG_PCI_REMOTE_DISK) |                |(CONFIG_PCI_EPF_BLOCK_PASSTHROUGH)|
    |                          |                |                                  |
    +--------------------------+                +-----------------^----------------+
                                                                  |
                                                                  |
                                                           +------v------+
                                                           |             |
                                                           |    NVMe     |
                                                           |             |
                                                           +-------------+

This is to a certain extent a similar functionality which NBD exposes over Network, but on the PCI(e) bus utilizing the EPC/EPF Kernel Framework.

The Endpoint Function driver creates parallel Queues which run on seperate CPU Cores using percpu structures. The number of parallel queues is limited by the number of CPUs on the EP device. The actual number of queues is configurable (as all other features of the driver) through CONFIGFS.

A documentation about the functional description as well as a user guide showing how both drivers can be configured is part of this series.

Test setup
==========

This series has been tested on an NXP S32G2 SoC running in Endpoint mode with a direct connection to an ARM64 host machine.

Quoted 8 lines

A performance measurement on the described setup shows good performance metrics. The S32G2 SoC has a 2xGen3 link which has a maximum Bandwidth of ~2GiB/s. With the explained setup a Read Datarate of 1.3GiB/s (with DMA ... without DMA the speed saturated at ~200MiB/s) was achieved using an 512GiB Kingston NVMe when accessing the NVMe from the ARM64 (SoC1) Host. The local Read Datarate accessing the NVMe dirctly from the S32G2 (SoC2) was around 1.5GiB.

The measurement was done through the FIO tool [1] with 4kiB Blocks.

[1] https://linux.die.net/man/1/fio

Quoted 7 lines

Thanks for the proposal! We are planning to add virtio function support to endpoint subsystem to cover usecases like this. I think your usecase can be satisfied using vitio-blk. Maybe you can add the virtio-blk endpoint function support once we have the infra in place. Thoughts?

- Mani

Hi Mani,
I initially had the plan to implement the virtio-blk as an endpoint function driver instead of a self baked driver.

This for sure is more elegant as we could reuse the virtio-blk pci driver instead of implementing a new one (as I did)

Quoted 6 lines

But I initially had some concerns about the feasibility, especially that the virtio-blk pci driver is expecting immediate responses to some register writes which I would not be able to satisfy, simply because we do not have any kind of interrupt/event which would be triggered on the EP side when the RC is accessing some BAR Registers (at least there is no machanism I know of). As virtio is made mainly for Hypervisor <->

Right. There is a limitation currently w.r.t triggering doorbell from the host to endpoint. But I believe that could be addressed later by repurposing the endpoint MSI controller [1].

Quoted 5 lines

As virtio is made mainly for Hypervisor <->
Guest communication I was afraid that a Hypersisor is able to Trap every Register access from the Guest and act accordingly, which I would not be able to do. I hope this make sense to you.

I'm not worrying about the hypervisor right now. Here the endpoint is exposing the virtio devices and host is consuming it. There is no virtualization play here. I talked about this in the last plumbers [2].

Quoted 7 lines

But to make a long story short, yes I agree with you that virtio-blk would satisfy my usecase, and I generally think it would be a better solution, I just did not know that you are working on some infrastructure for that. And yes I would like to implement the endpoint function driver for virtio-blk. Is there already an development tree you use to work on the infrastructre I could have a look at?

Shunsuke has a WIP branch [3], that I plan to co-work in the coming days. You can use it as a reference in the meantime.

- Mani

[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.youtube.com/watch?v=1tqOTge0eq0
[3] https://github.com/ShunsukeMie/linux-virtio-rdma/tree/v6.6-rc1-epf-vcon

Quoted 35 lines

- Wadim

Quoted 31 lines
Quoted 28 lines

Wadim Mueller (3):
PCI: Add PCI Endpoint function driver for Block-device passthrough
PCI: Add PCI driver for a PCI EP remote Blockdevice
Documentation: PCI: Add documentation for the PCI Block Passthrough

 .../function/binding/pci-block-passthru.rst   |   24 +
 Documentation/PCI/endpoint/index.rst          |    3 +
 .../pci-endpoint-block-passthru-function.rst  |  331 ++++
 .../pci-endpoint-block-passthru-howto.rst     |  158 ++
 MAINTAINERS                                   |    8 +
 drivers/block/Kconfig                         |   14 +
 drivers/block/Makefile                        |    1 +
 drivers/block/pci-remote-disk.c               | 1047 +++++++++++++
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 .../functions/pci-epf-block-passthru.c        | 1393 +++++++++++++++++
 include/linux/pci-epf-block-passthru.h        |   77 +
 12 files changed, 3069 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst
 create mode 100644 drivers/block/pci-remote-disk.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-passthru.c
 create mode 100644 include/linux/pci-epf-block-passthru.h
Signature · 1 line
2.25.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#11 lore raw
In reply to Wadim Mueller

Please don't just create a new (and as far as I can tell underspecified) new "hardware" interface for this. If the nvme endpoint work is too much for your use case maybe just implement a minimal virtio_blk interface.

#7 lore raw
In reply to Manivannan Sadhasivam

On 2024/02/26 1:45, Manivannan Sadhasivam wrote:

[...]

Quoted 9 lines
Quoted 5 lines

As virtio is made mainly for Hypervisor <->
Guest communication I was afraid that a Hypersisor is able to Trap every Register access from the Guest and act accordingly, which I would not be able to do. I hope this make sense to you.

I'm not worrying about the hypervisor right now. Here the endpoint is exposing the virtio devices and host is consuming it. There is no virtualization play here. I talked about this in the last plumbers [2].

FYI, we are still working on our NVMe PCI EPF function driver. It is working OK using either a rockpro64 (PCI Gen2) board and a Radxa Rock 5B board (PCI Gen3, rk3588 SoC/DWC EPF driver). Just been super busy recently with the block layer & ATA stuff so I have not been able to rebase/cleanup and send stuff. This driver also depends on many cleanup/improvement patches (see below).

Quoted 11 lines
Quoted 8 lines

But to make a long story short, yes I agree with you that virtio-blk would satisfy my usecase, and I generally think it would be a better solution, I just did not know that you are working on some infrastructure for that. And yes I would like to implement the endpoint function driver for virtio-blk. Is there already an development tree you use to work on the infrastructre I could have a look at?

Shunsuke has a WIP branch [3], that I plan to co-work in the coming days. You can use it as a reference in the meantime.

This one is very similar to what I did in my series:

https://github.com/torvalds/linux/commit/05e21d458b1eaa8c22697f12a1ae42dcb04ff377

My series is here:

https://github.com/damien-lemoal/linux/tree/rock5b_ep_v8

It is a bit of a mess but what's there is:
1) Add the "map_info" EPF method to get mapping that are not dependent on the host address alignment. That is similar to the align_mem method Shunsuke introduced, but with more info to make it generic and allow EPF to deal with any host DMA address.
2) Fixes for the rockpro64 DMA mapping as it is broken
3) Adds rk2588 EPF driver
4) Adds the NVMe EPF function driver. That is implemented as a PCI EPF frontend to an NVMe-of controller so that any NMVe-Of supported device can be exposed over PCI (block device, file, real NVMe controller).

There are also a bunch of API changes and cleanups to make the EPF code (core and driver) more compact/easier to read.

Once I am done with my current work on the block layer side, I intend to come back to this for the next cycle. I still need to complete the IRQ lehacy -> intx renaming as well...

Cheers.

Signature · 2 lines
Damien Le Moal
Western Digital Research
#10 lore raw
In reply to Wadim Mueller
Quoted 76 lines · Wadim Mueller
Quoted 60 lines · Manivannan Sadhasivam
Quoted 50 lines · Wadim Mueller

Hello,

This series adds support for the Block Passthrough PCI(e) Endpoint functionality.
PCI Block Device Passthrough allows one Linux Device running in EP mode to expose its Block devices to the PCI(e) host (RC). The device can export either the full disk or just certain partitions. Also an export in readonly mode is possible. This is useful if you want to share the same blockdevice between different SoCs, providing each SoC its own partition(s).

Block Passthrough
==================
The PCI Block Passthrough can be a useful feature if you have multiple SoCs in your system connected
through a PCI(e) link, one running in RC mode, the other in EP mode.
If the block devices are connected to one SoC (SoC2 in EP Mode from the diagramm below) and you want to access those from the other SoC (SoC1 in RC mode below), without having any direct connection to
those block devices (e.g. if you want to share an NVMe between two SoCs). An simple example of such a configurationis is shown below:

                                                           +-------------+
                                                           |             |
                                                           |   SD Card   |
                                                           |             |
                                                           +------^------+
                                                                  |
                                                                  |
    +--------------------------+                +-----------------v----------------+
    |                          |      PCI(e)    |                                  |
    |         SoC1 (RC)        |<-------------->|            SoC2 (EP)             |
    | (CONFIG_PCI_REMOTE_DISK) |                |(CONFIG_PCI_EPF_BLOCK_PASSTHROUGH)|
    |                          |                |                                  |
    +--------------------------+                +-----------------^----------------+
                                                                  |
                                                                  |
                                                           +------v------+
                                                           |             |
                                                           |    NVMe     |
                                                           |             |
                                                           +-------------+

This is to a certain extent a similar functionality which NBD exposes over Network, but on the PCI(e) bus utilizing the EPC/EPF Kernel Framework.

The Endpoint Function driver creates parallel Queues which run on seperate CPU Cores using percpu structures. The number of parallel queues is limited by the number of CPUs on the EP device. The actual number of queues is configurable (as all other features of the driver) through CONFIGFS.

A documentation about the functional description as well as a user guide showing how both drivers can be configured is part of this series.

Test setup
==========

This series has been tested on an NXP S32G2 SoC running in Endpoint mode with a direct connection to an ARM64 host machine.

Quoted 8 lines

A performance measurement on the described setup shows good performance metrics. The S32G2 SoC has a 2xGen3 link which has a maximum Bandwidth of ~2GiB/s. With the explained setup a Read Datarate of 1.3GiB/s (with DMA ... without DMA the speed saturated at ~200MiB/s) was achieved using an 512GiB Kingston NVMe when accessing the NVMe from the ARM64 (SoC1) Host. The local Read Datarate accessing the NVMe dirctly from the S32G2 (SoC2) was around 1.5GiB.

The measurement was done through the FIO tool [1] with 4kiB Blocks.

[1] https://linux.die.net/man/1/fio

Quoted 7 lines

Thanks for the proposal! We are planning to add virtio function support to endpoint subsystem to cover usecases like this. I think your usecase can be satisfied using vitio-blk. Maybe you can add the virtio-blk endpoint function support once we have the infra in place. Thoughts?

- Mani

Hi Mani,
I initially had the plan to implement the virtio-blk as an endpoint function driver instead of a self baked driver.

This for sure is more elegant as we could reuse the virtio-blk pci driver instead of implementing a new one (as I did)

Quoted 6 lines

But I initially had some concerns about the feasibility, especially that the virtio-blk pci driver is expecting immediate responses to some register writes which I would not be able to satisfy, simply because we do not have any kind of interrupt/event which would be triggered on the EP side when the RC is accessing some BAR Registers (at least there is no machanism I know of). As virtio is made mainly for Hypervisor <->

A possible solution is use ITS MSI to triggger at irq at EP side.
https://lore.kernel.org/linux-pci/[email protected]/
Any ways, virtio layer need some modify.

Quoted 10 lines

Guest communication I was afraid that a Hypersisor is able to Trap every Register access from the Guest and act accordingly, which I would not be able to do. I hope this make sense to you.

But to make a long story short, yes I agree with you that virtio-blk would satisfy my usecase, and I generally think it would be a better solution, I just did not know that you are working on some infrastructure for that. And yes I would like to implement the endpoint function driver for virtio-blk. Is there already an development tree you use to work on the infrastructre I could have a look at?

There are many one try this
https://patchew.org/linux/[email protected]/
https://lore.kernel.org/linux-pci/[email protected]/
https://lore.kernel.org/imx/[email protected]/T/#t
https://lore.kernel.org/linux-pci/[email protected]/

With EDMA support and ITS MSI, it should be possible now.

Frank

Quoted 36 lines

- Wadim

Quoted 31 lines
Quoted 28 lines

Wadim Mueller (3):
PCI: Add PCI Endpoint function driver for Block-device passthrough
PCI: Add PCI driver for a PCI EP remote Blockdevice
Documentation: PCI: Add documentation for the PCI Block Passthrough

 .../function/binding/pci-block-passthru.rst   |   24 +
 Documentation/PCI/endpoint/index.rst          |    3 +
 .../pci-endpoint-block-passthru-function.rst  |  331 ++++
 .../pci-endpoint-block-passthru-howto.rst     |  158 ++
 MAINTAINERS                                   |    8 +
 drivers/block/Kconfig                         |   14 +
 drivers/block/Makefile                        |    1 +
 drivers/block/pci-remote-disk.c               | 1047 +++++++++++++
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +
 .../functions/pci-epf-block-passthru.c        | 1393 +++++++++++++++++
 include/linux/pci-epf-block-passthru.h        |   77 +
 12 files changed, 3069 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-block-passthru.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-function.rst
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-passthru-howto.rst
 create mode 100644 drivers/block/pci-remote-disk.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-passthru.c
 create mode 100644 include/linux/pci-epf-block-passthru.h
Signature · 1 line
2.25.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#8 lore raw
In reply to Manivannan Sadhasivam

--text follows this line--
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Quoted 6 lines · Manivannan Sadhasivam
Quoted 5 lines · Wadim Mueller
Quoted 4 lines · Manivannan Sadhasivam
Quoted 3 lines · Wadim Mueller

Hello,
=20
This series adds support for the Block Passthrough PCI(e) Endpoint f=

unctionality.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

PCI Block Device Passthrough allows one Linux Device running in EP m=

ode to expose its Block devices to the PCI(e) host (RC). The device can exp= ort either the full disk or just certain partitions.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Also an export in readonly mode is possible. This is useful if you w=

ant to share the same blockdevice between different SoCs, providing each So= C its own partition(s).

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

=20
=20
Block Passthrough =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The PCI Block Passthrough can be a useful feature if you have multip=

le SoCs in your system connected

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

through a PCI(e) link, one running in RC mode, the other in EP mode. If the block devices are connected to one SoC (SoC2 in EP Mode from =

the diagramm below) and you want to access

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

those from the other SoC (SoC1 in RC mode below), without having any=

direct connection to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

those block devices (e.g. if you want to share an NVMe between two S=

oCs). An simple example of such a configurationis is shown below:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

=20
=20

                                                           +--------=

-----+

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| =

     |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| SD Ca=

rd |

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| =

     |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
                                                           +------^-=

-----+

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
                                                                  |
                                                                  |
    +--------------------------+                +-----------------v-=

---------------+

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| | PCI(e) | =

               |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
    |         SoC1 (RC)        |<-------------->|            SoC2 (E=

P) |

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| (CONFIG_PCI_REMOTE_DISK) | |(CONFIG_PCI_EPF_BLO=

CK_PASSTHROUGH)|

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| | | =

               |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
    +--------------------------+                +-----------------^-=

---------------+

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
                                                                  |
                                                                  |
                                                           +------v-=

-----+

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| =

     |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| NVMe=

     |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| =

     |
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
                                                           +--------=

-----+

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

=20
=20
This is to a certain extent a similar functionality which NBD expose=

s over Network, but on the PCI(e) bus utilizing the EPC/EPF Kernel Framewor= k.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=20
The Endpoint Function driver creates parallel Queues which run on se=

perate CPU Cores using percpu structures. The number of parallel queues is = limited

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

by the number of CPUs on the EP device. The actual number of queues =

is configurable (as all other features of the driver) through CONFIGFS.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=20
A documentation about the functional description as well as a user g=

uide showing how both drivers can be configured is part of this series.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

=20
Test setup
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
This series has been tested on an NXP S32G2 SoC running in Endpoint =

mode with a direct connection to an ARM64 host machine.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=20
A performance measurement on the described setup shows good performa=

nce metrics. The S32G2 SoC has a 2xGen3 link which has a maximum Bandwidth = of ~2GiB/s.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

With the explained setup a Read Datarate of 1.3GiB/s (with DMA ... w=

ithout DMA the speed saturated at ~200MiB/s) was achieved using an 512GiB K= ingston NVMe

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

when accessing the NVMe from the ARM64 (SoC1) Host. The local Read D=

atarate accessing the NVMe dirctly from the S32G2 (SoC2) was around 1.5GiB.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

=20
The measurement was done through the FIO tool [1] with 4kiB Blocks. =20
[1] https://linux.die.net/man/1/fio
=20

=20
Thanks for the proposal! We are planning to add virtio function suppor=

t to

Quoted 1 line
Quoted 1 line
Quoted 1 line

endpoint subsystem to cover usecases like this. I think your usecase c=

an be

Quoted 1 line
Quoted 1 line
Quoted 1 line

satisfied using vitio-blk. Maybe you can add the virtio-blk endpoint f=

unction

Quoted 19 lines
Quoted 4 lines
Quoted 4 lines

support once we have the infra in place. Thoughts? =20
- Mani

Quoted 14 lines

=20
Hi Mani,
I initially had the plan to implement the virtio-blk as an endpoint function driver instead of a self baked driver.=20
=20
This for sure is more elegant as we could reuse the virtio-blk pci driver instead of implementing a new one (as I did)=20 =20
But I initially had some concerns about the feasibility, especially that the virtio-blk pci driver is expecting immediate responses to some register writes which I would not be able to satisfy, simply because we do not have any kind of interrupt/event which would be triggered on the EP side when the RC is accessing some BAR Registers (at least there is no machanism I know of). As virtio is made mainly for Hypervisor <->

Quoted 1 line

Right. There is a limitation currently w.r.t triggering doorbell from the=

host

Quoted 1 line

to endpoint. But I believe that could be addressed later by repurposing t=

he

Quoted 9 lines

endpoint MSI controller [1].

Quoted 5 lines

As virtio is made mainly for Hypervisor <->
Guest communication I was afraid that a Hypersisor is able to Trap every Register access from the Guest and act accordingly, which I would not be able to do. I hope this make sense to you.
=20

I'm not worrying about the hypervisor right now. Here the endpoint is exp=

osing

Quoted 1 line

the virtio devices and host is consuming it. There is no virtualization p=

lay

Quoted 2 lines

here. I talked about this in the last plumbers [2].

Okay, I understand this. The hypervisor was more of an example. I will try to explain.

I am currently reading through the virtio spec [1]. In chapter 4.1.4.5.1 there is the following statement:

"The device MUST reset ISR status to 0 on driver read."

So I was wondering, how we, as an PCI EP Device, supposed to clear a register when the driver reads the same register? I mean how do we detect a register read?
If you are a hypervisor its easy to do so, because you can intercept every memory access made my the guest (the same applies if you build custom HW for this purpose). But for us as an EP device its difficult to detect this, even with MSIs and Doorbell Registers in place.

Modifying the virtio layer to write to some doorbell register after reading the ISR status register would be possible, but kind of ugly.

[1] https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.=
pdf

Quoted 8 lines
Quoted 7 lines

But to make a long story short, yes I agree with you that virtio-blk would satisfy my usecase, and I generally think it would be a better solution, I just did not know that you are working on some infrastructure for that. And yes I would like to implement the endpoint function driver for virtio-blk. Is there already an development tree you use to work on the infrastructre I could have a look at?
=20

Quoted 8 lines

Shunsuke has a WIP branch [3], that I plan to co-work in the coming days. You can use it as a reference in the meantime.

- Mani

[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.youtube.com/watch?v=3D1tqOTge0eq0
[3] https://github.com/ShunsukeMie/linux-virtio-rdma/tree/v6.6-rc1-epf-vc=

on

Quoted 5 lines
Quoted 5 lines

- Wadim
=20
=20
=20

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Wadim Mueller (3):
PCI: Add PCI Endpoint function driver for Block-device passthrough
PCI: Add PCI driver for a PCI EP remote Blockdevice
Documentation: PCI: Add documentation for the PCI Block Passthrough
=20

 .../function/binding/pci-block-passthru.rst   |   24 +
 Documentation/PCI/endpoint/index.rst          |    3 +
 .../pci-endpoint-block-passthru-function.rst  |  331 ++++
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
 .../pci-endpoint-block-passthru-howto.rst     |  158 ++
 MAINTAINERS                                   |    8 +
 drivers/block/Kconfig                         |   14 +
 drivers/block/Makefile                        |    1 +
 drivers/block/pci-remote-disk.c               | 1047 +++++++++++++
 drivers/pci/endpoint/functions/Kconfig        |   12 +
 drivers/pci/endpoint/functions/Makefile       |    1 +

.../functions/pci-epf-block-passthru.c | 1393 ++++++++++++++=

+++

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
 include/linux/pci-epf-block-passthru.h        |   77 +
 12 files changed, 3069 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-=

block-passthru.rst

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-pa=

ssthru-function.rst

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-block-pa=

ssthru-howto.rst

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
 create mode 100644 drivers/block/pci-remote-disk.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-block-pas=

sthru.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
 create mode 100644 include/linux/pci-epf-block-passthru.h

=20
--=20
2.25.1
=20

=20
--=20 =E0=AE=AE=E0=AE=A3=E0=AE=BF=E0=AE=B5=E0=AE=A3=E0=AF=8D=E0=AE=A3=E0=AE=

=A9=E0=AF=8D =E0=AE=9A=E0=AE=A4=E0=AE=BE=E0=AE=9A=E0=AE=BF=E0=AE=B5=E0=AE= =AE=E0=AF=8D

#9 lore raw

On Mon, Feb 26, 2024 at 07:47:30PM +0100, Wadim Mueller wrote:

[...]

Quoted 8 lines

Okay, I understand this. The hypervisor was more of an example. I will try to explain.

I am currently reading through the virtio spec [1]. In chapter 4.1.4.5.1 there is the following statement:

"The device MUST reset ISR status to 0 on driver read."

Quoted 9 lines

So I was wondering, how we, as an PCI EP Device, supposed to clear a register when the driver reads the same register? I mean how do we detect a register read?
If you are a hypervisor its easy to do so, because you can intercept every memory access made my the guest (the same applies if you build custom HW for this purpose). But for us as an EP device its difficult to detect this, even with MSIs and Doorbell Registers in place.

Sorry for not responding earlier. Conversation got lost.

Yes, I do agree that some of the expecatations of the current Virtio spec cannot be satisfied by the physical endpoint device. So I presented some of these problems at this year plumbers and the Virtio maintainer in the room agreed to have changes in the spec to fix these issues.

But it is not clear atm on whether we should introduce the changes in the virtio-pci transport or introduce a new transport altogether. I can include you in the discussions if you are still interested.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்