2 * vhost-user GPU PCI device
4 * Copyright Red Hat, Inc. 2018
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
11 #include "qemu/osdep.h"
12 #include "qapi/error.h"
13 #include "hw/virtio/virtio-gpu-pci.h"
14 #include "qom/object.h"
16 #define TYPE_VHOST_USER_GPU_PCI "vhost-user-gpu-pci"
17 typedef struct VhostUserGPUPCI VhostUserGPUPCI
;
18 DECLARE_INSTANCE_CHECKER(VhostUserGPUPCI
, VHOST_USER_GPU_PCI
,
19 TYPE_VHOST_USER_GPU_PCI
)
21 struct VhostUserGPUPCI
{
22 VirtIOGPUPCIBase parent_obj
;
27 static void vhost_user_gpu_pci_initfn(Object
*obj
)
29 VhostUserGPUPCI
*dev
= VHOST_USER_GPU_PCI(obj
);
31 virtio_instance_init_common(obj
, &dev
->vdev
, sizeof(dev
->vdev
),
34 VIRTIO_GPU_PCI_BASE(obj
)->vgpu
= VIRTIO_GPU_BASE(&dev
->vdev
);
36 object_property_add_alias(obj
, "chardev",
37 OBJECT(&dev
->vdev
), "chardev");
40 static const VirtioPCIDeviceTypeInfo vhost_user_gpu_pci_info
= {
41 .generic_name
= TYPE_VHOST_USER_GPU_PCI
,
42 .parent
= TYPE_VIRTIO_GPU_PCI_BASE
,
43 .instance_size
= sizeof(VhostUserGPUPCI
),
44 .instance_init
= vhost_user_gpu_pci_initfn
,
47 static void vhost_user_gpu_pci_register_types(void)
49 virtio_pci_types_register(&vhost_user_gpu_pci_info
);
52 type_init(vhost_user_gpu_pci_register_types
)