Skip to content

RFC Introduce a PCIe endpoint virtio console

Shunsuke Mie linux-pci lkml oe-kbuild-all virtualization 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest3 patches 13 repliesIn review
  2. v1 RFC3 patches 6 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3PCI: endpoint: introduce a helper to implement pci ep virtio functiondrivers/pci/endpoint/functions/Kconfig drivers/pci/endpoint/functions/Makefile drivers/pci/endpoint/functions/pci-epf-virtio.c +1 more+592 -03 replies
2/3virtio_pci: add a definition of queue flag in ISRinclude/uapi/linux/virtio_pci.h+3 -02 replies
3/3PCI: endpoint: Add EP function driver to provide virtio-console functionalitydrivers/pci/endpoint/functions/Kconfig drivers/pci/endpoint/functions/Makefile drivers/pci/endpoint/functions/pci-epf-vcon.c+609 -07 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchJason Wang
1/3
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC PATCH v2 0/3] Introduce a PCIe endpoint virtio console

PCIe endpoint framework provides APIs to implement PCIe endpoint function. This framework allows defining various PCIe endpoint function behaviors in software. This patch extend the framework for virtio pci device. The virtio is defined to communicate guest on virtual machine and host side. Advantage of the virtio is the efficiency of data transfer and the conciseness of implementation device using software. It also be applied to PCIe endpoint function.

We designed and implemented a PCIe EP virtio console function driver using the extended PCIe endpoint framework for virtio. It can be communicate host and endpoint over virtio as console.

An architecture of the function driver is following:

 ┌────────────┐         ┌──────────────────────┬────────────┐
 │virtio      │         │                      │virtio      │
 │console drv │         ├───────────────┐      │console drv │
 ├────────────┤         │(virtio console│      ├────────────┤
 │ virtio bus │         │ device)       │◄────►│ virtio bus │
 ├────────────┤         ├---------------┤      └────────────┤
 │            │         │ pci ep virtio │                   │
 │  pci bus   │         │  console drv  │                   │
 │            │  pcie   ├───────────────┤                   │
 │            │ ◄─────► │  pci ep Bus   │                   │
 └────────────┘         └───────────────┴───────────────────┘
   PCIe Root              PCIe Endpoint

Introduced driver is pci ep virtio console drv in the figure. It works as ep function for PCIe root and virtual virtio console device for PCIe endpoint. Each side of virtio console driver has virtqueue, and introduced driver transfers data on the virtqueue to each other. A data on root tx queue is transfered to endpoint rx queue and vice versa.

This patchset is depend follwing patches which are under discussion.

- [RFC PATCH 0/3] Deal with alignment restriction on EP side

- [PATCH v3] vringh: IOMEM support

First of this patchset is introduce a helper function to realize pci virtio function using PCIe endpoint framework. The second one is adding a missing definition for virtio pci header. The last one is for PCIe endpoint virtio console driver.

This is tested on next-20230416 and RCar S4 board as PCIe endpoint.

Shunsuke Mie (3):
PCI: endpoint: introduce a helper to implement pci ep virtio function
virtio_pci: add a definition of queue flag in ISR
PCI: endpoint: Add EP function driver to provide virtio-console
functionality

 drivers/pci/endpoint/functions/Kconfig        |  19 +
 drivers/pci/endpoint/functions/Makefile       |   2 +
 drivers/pci/endpoint/functions/pci-epf-vcon.c | 596 ++++++++++++++++++
 .../pci/endpoint/functions/pci-epf-virtio.c   | 458 ++++++++++++++
 .../pci/endpoint/functions/pci-epf-virtio.h   | 126 ++++
 include/uapi/linux/virtio_pci.h               |   3 +
 6 files changed, 1204 insertions(+)
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-vcon.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-virtio.c
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-virtio.h
Signature · 1 line
2.25.1