]> git.ipfire.org Git - thirdparty/qemu.git/blame - hw/display/vhost-user-gpu-pci.c
Move QOM typedefs and add missing includes
[thirdparty/qemu.git] / hw / display / vhost-user-gpu-pci.c
CommitLineData
267f6646
MAL
1/*
2 * vhost-user GPU PCI device
3 *
4 * Copyright Red Hat, Inc. 2018
5 *
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.
8 *
9 */
10
11#include "qemu/osdep.h"
12#include "qapi/error.h"
13#include "hw/virtio/virtio-gpu-pci.h"
db1015e9 14#include "qom/object.h"
267f6646
MAL
15
16#define TYPE_VHOST_USER_GPU_PCI "vhost-user-gpu-pci"
db1015e9 17typedef struct VhostUserGPUPCI VhostUserGPUPCI;
267f6646
MAL
18#define VHOST_USER_GPU_PCI(obj) \
19 OBJECT_CHECK(VhostUserGPUPCI, (obj), TYPE_VHOST_USER_GPU_PCI)
20
db1015e9 21struct VhostUserGPUPCI {
267f6646
MAL
22 VirtIOGPUPCIBase parent_obj;
23
24 VhostUserGPU vdev;
db1015e9 25};
267f6646
MAL
26
27static void vhost_user_gpu_pci_initfn(Object *obj)
28{
29 VhostUserGPUPCI *dev = VHOST_USER_GPU_PCI(obj);
30
31 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
32 TYPE_VHOST_USER_GPU);
33
34 VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
35
36 object_property_add_alias(obj, "chardev",
d2623129 37 OBJECT(&dev->vdev), "chardev");
267f6646
MAL
38}
39
40static 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,
45};
46
47static void vhost_user_gpu_pci_register_types(void)
48{
49 virtio_pci_types_register(&vhost_user_gpu_pci_info);
50}
51
52type_init(vhost_user_gpu_pci_register_types)