util/hbitmap: update orig_size on truncate
[qemu/ar7.git] / hw / display / vhost-user-gpu-pci.c
blob7d9b1f5a8c17b225269f5b7a885b20c7b218e3be
1 /*
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.
9 */
11 #include "qemu/osdep.h"
12 #include "qapi/error.h"
13 #include "hw/virtio/virtio-gpu-pci.h"
15 #define TYPE_VHOST_USER_GPU_PCI "vhost-user-gpu-pci"
16 #define VHOST_USER_GPU_PCI(obj) \
17 OBJECT_CHECK(VhostUserGPUPCI, (obj), TYPE_VHOST_USER_GPU_PCI)
19 typedef struct VhostUserGPUPCI {
20 VirtIOGPUPCIBase parent_obj;
22 VhostUserGPU vdev;
23 } VhostUserGPUPCI;
25 static void vhost_user_gpu_pci_initfn(Object *obj)
27 VhostUserGPUPCI *dev = VHOST_USER_GPU_PCI(obj);
29 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
30 TYPE_VHOST_USER_GPU);
32 VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev);
34 object_property_add_alias(obj, "chardev",
35 OBJECT(&dev->vdev), "chardev",
36 &error_abort);
39 static const VirtioPCIDeviceTypeInfo vhost_user_gpu_pci_info = {
40 .generic_name = TYPE_VHOST_USER_GPU_PCI,
41 .parent = TYPE_VIRTIO_GPU_PCI_BASE,
42 .instance_size = sizeof(VhostUserGPUPCI),
43 .instance_init = vhost_user_gpu_pci_initfn,
46 static void vhost_user_gpu_pci_register_types(void)
48 virtio_pci_types_register(&vhost_user_gpu_pci_info);
51 type_init(vhost_user_gpu_pci_register_types)