Skip to content

Commit

Permalink
sample: vfio mdev display - host device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kraxel authored and awilliam committed Jun 8, 2018
1 parent 48d8476 commit d61fc96
Show file tree
Hide file tree
Showing 4 changed files with 838 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ config SAMPLE_VFIO_MDEV_MTTY
Build a virtual tty sample driver for use as a VFIO
mediated device

config SAMPLE_VFIO_MDEV_MDPY
tristate "Build VFIO mdpy example mediated device sample code -- loadable modules only"
depends on VFIO_MDEV_DEVICE && m
help
Build a virtual display sample driver for use as a VFIO
mediated device. It is a simple framebuffer and supports
the region display interface (VFIO_GFX_PLANE_TYPE_REGION).

config SAMPLE_STATX
bool "Build example extended-stat using code"
depends on BROKEN
Expand Down
1 change: 1 addition & 0 deletions samples/vfio-mdev/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY) += mdpy.o
22 changes: 22 additions & 0 deletions samples/vfio-mdev/mdpy-defs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Simple pci display device.
*
* Framebuffer memory is pci bar 0.
* Configuration (read-only) is in pci config space.
* Format field uses drm fourcc codes.
* ATM only DRM_FORMAT_XRGB8888 is supported.
*/

/* pci ids */
#define MDPY_PCI_VENDOR_ID 0x1b36 /* redhat */
#define MDPY_PCI_DEVICE_ID 0x000f
#define MDPY_PCI_SUBVENDOR_ID PCI_SUBVENDOR_ID_REDHAT_QUMRANET
#define MDPY_PCI_SUBDEVICE_ID PCI_SUBDEVICE_ID_QEMU

/* pci cfg space offsets for fb config (dword) */
#define MDPY_VENDORCAP_OFFSET 0x40
#define MDPY_VENDORCAP_SIZE 0x10
#define MDPY_FORMAT_OFFSET (MDPY_VENDORCAP_OFFSET + 0x04)
#define MDPY_WIDTH_OFFSET (MDPY_VENDORCAP_OFFSET + 0x08)
#define MDPY_HEIGHT_OFFSET (MDPY_VENDORCAP_OFFSET + 0x0c)
Loading

0 comments on commit d61fc96

Please sign in to comment.