1 /* 2 * display support for mdev based vgpu devices 3 * 4 * Copyright Red Hat, Inc. 2017 5 * 6 * Authors: 7 * Gerd Hoffmann 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2. See 10 * the COPYING file in the top-level directory. 11 */ 12 13 #include "qemu/osdep.h" 14 #include <linux/vfio.h> 15 #include <sys/ioctl.h> 16 17 #include "sysemu/sysemu.h" 18 #include "ui/console.h" 19 #include "qapi/error.h" 20 #include "pci.h" 21 22 int vfio_display_probe(VFIOPCIDevice *vdev, Error **errp) 23 { 24 struct vfio_device_gfx_plane_info probe; 25 int ret; 26 27 memset(&probe, 0, sizeof(probe)); 28 probe.argsz = sizeof(probe); 29 probe.flags = VFIO_GFX_PLANE_TYPE_PROBE | VFIO_GFX_PLANE_TYPE_DMABUF; 30 ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_QUERY_GFX_PLANE, &probe); 31 if (ret == 0) { 32 error_setg(errp, "vfio-display: dmabuf support not implemented yet"); 33 return -1; 34 } 35 36 memset(&probe, 0, sizeof(probe)); 37 probe.argsz = sizeof(probe); 38 probe.flags = VFIO_GFX_PLANE_TYPE_PROBE | VFIO_GFX_PLANE_TYPE_REGION; 39 ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_QUERY_GFX_PLANE, &probe); 40 if (ret == 0) { 41 error_setg(errp, "vfio-display: region support not implemented yet"); 42 return -1; 43 } 44 45 if (vdev->display == ON_OFF_AUTO_AUTO) { 46 /* not an error in automatic mode */ 47 return 0; 48 } 49 50 error_setg(errp, "vfio: device doesn't support any (known) display method"); 51 return -1; 52 } 53 54 void vfio_display_finalize(VFIOPCIDevice *vdev) 55 { 56 } 57