Skip to content

Commit d61fc96

Browse files
kraxelAlex Williamson
authored andcommitted
sample: vfio mdev display - host device
Simple framebuffer display, demo-ing the vfio region display interface (VFIO_GFX_PLANE_TYPE_REGION). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 48d8476 commit d61fc96

4 files changed

Lines changed: 838 additions & 0 deletions

File tree

‎samples/Kconfig‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ config SAMPLE_VFIO_MDEV_MTTY
115115
Build a virtual tty sample driver for use as a VFIO
116116
mediated device
117117

118+
config SAMPLE_VFIO_MDEV_MDPY
119+
tristate "Build VFIO mdpy example mediated device sample code -- loadable modules only"
120+
depends on VFIO_MDEV_DEVICE && m
121+
help
122+
Build a virtual display sample driver for use as a VFIO
123+
mediated device. It is a simple framebuffer and supports
124+
the region display interface (VFIO_GFX_PLANE_TYPE_REGION).
125+
118126
config SAMPLE_STATX
119127
bool "Build example extended-stat using code"
120128
depends on BROKEN

‎samples/vfio-mdev/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
2+
obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY) += mdpy.o

‎samples/vfio-mdev/mdpy-defs.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
/*
3+
* Simple pci display device.
4+
*
5+
* Framebuffer memory is pci bar 0.
6+
* Configuration (read-only) is in pci config space.
7+
* Format field uses drm fourcc codes.
8+
* ATM only DRM_FORMAT_XRGB8888 is supported.
9+
*/
10+
11+
/* pci ids */
12+
#define MDPY_PCI_VENDOR_ID 0x1b36 /* redhat */
13+
#define MDPY_PCI_DEVICE_ID 0x000f
14+
#define MDPY_PCI_SUBVENDOR_ID PCI_SUBVENDOR_ID_REDHAT_QUMRANET
15+
#define MDPY_PCI_SUBDEVICE_ID PCI_SUBDEVICE_ID_QEMU
16+
17+
/* pci cfg space offsets for fb config (dword) */
18+
#define MDPY_VENDORCAP_OFFSET 0x40
19+
#define MDPY_VENDORCAP_SIZE 0x10
20+
#define MDPY_FORMAT_OFFSET (MDPY_VENDORCAP_OFFSET + 0x04)
21+
#define MDPY_WIDTH_OFFSET (MDPY_VENDORCAP_OFFSET + 0x08)
22+
#define MDPY_HEIGHT_OFFSET (MDPY_VENDORCAP_OFFSET + 0x0c)

0 commit comments

Comments
 (0)