Skip to content

Commit

Permalink
PCI: endpoint: Add EP function driver to provide virtio-console funct…
Browse files Browse the repository at this point in the history
…ionality

Add a new PCIe endpoint function driver that works as a pci virtio-console
device. The console connect to endpoint side console. It enables to
communicate PCIe host and endpoint.

Architecture is following:

 ┌────────────┐         ┌──────────────────────┬────────────┐
 │virtioe     │         │                      │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

This driver has two roles. The first is as a PCIe endpoint virtio console
function, which is implemented using the PCIe endpoint framework and PCIe
EP virtio helpers. The second is as a virtual virtio console device
connected to the virtio bus on PCIe endpoint Linux.

Communication between the two is achieved by copying the virtqueue data
between PCIe root and endpoint, respectively.

This is a simple implementation and does not include features of
virtio-console such as MULTIPORT, EMERG_WRITE, etc. As a result, each
virtio console driver only displays /dev/hvc0.

As an example of usage, by setting getty to /dev/hvc0, it is possible to
login to another host.

Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
  • Loading branch information
ShunsukeMie authored and intel-lab-lkp committed Apr 14, 2023
1 parent c42f8c4 commit 1351b90
Show file tree
Hide file tree
Showing 3 changed files with 567 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/pci/endpoint/functions/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,15 @@ config PCI_EPF_VIRTIO
select VHOST_IOMEM
help
Helpers to implement PCI virtio Endpoint function

config PCI_EPF_VCON
tristate "PCI Endpoint virito-console driver"
depends on PCI_ENDPOINT
select VHOST_RING
select PCI_EPF_VIRTIO
help
PCIe Endpoint virtio-console function implementatino. This module
enables to show the virtio-console as pci device to PCIe host side, and
another virtual virtio-console device registers to endpoint system.
Those devices are connected virtually and can communicate each other.

1 change: 1 addition & 0 deletions drivers/pci/endpoint/functions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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_VIRTIO) += pci-epf-virtio.o
obj-$(CONFIG_PCI_EPF_VCON) += pci-epf-vcon.o

0 comments on commit 1351b90

Please sign in to comment.