1
2
3
4
5
6
7
8
9
10
11#include "qemu/osdep.h"
12#include "qapi/error.h"
13#include "virtio-vga.h"
14#include "qom/object.h"
15
16#define TYPE_VHOST_USER_VGA "vhost-user-vga"
17
18typedef struct VhostUserVGA VhostUserVGA;
19DECLARE_INSTANCE_CHECKER(VhostUserVGA, VHOST_USER_VGA,
20 TYPE_VHOST_USER_VGA)
21
22struct VhostUserVGA {
23 VirtIOVGABase parent_obj;
24
25 VhostUserGPU vdev;
26};
27
28static void vhost_user_vga_inst_initfn(Object *obj)
29{
30 VhostUserVGA *dev = VHOST_USER_VGA(obj);
31
32 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
33 TYPE_VHOST_USER_GPU);
34
35 VIRTIO_VGA_BASE(dev)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
36
37 object_property_add_alias(obj, "chardev",
38 OBJECT(&dev->vdev), "chardev");
39}
40
41static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
42 .generic_name = TYPE_VHOST_USER_VGA,
43 .parent = TYPE_VIRTIO_VGA_BASE,
44 .instance_size = sizeof(VhostUserVGA),
45 .instance_init = vhost_user_vga_inst_initfn,
46};
47
48static void vhost_user_vga_register_types(void)
49{
50 virtio_pci_types_register(&vhost_user_vga_info);
51}
52
53type_init(vhost_user_vga_register_types)
54