diff options
| author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2023-11-21 16:44:25 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2023-12-19 19:03:38 +0100 |
| commit | 6106a329141af7d47bdc3346ce9820d4714e0e5d (patch) | |
| tree | 3de9916a47b3940bab139bdc3802ffafbae8073e /hw/vfio/helpers.c | |
| parent | c12b55ad6f9d3b4792b590e9211bd7319e4a2d70 (diff) | |
| download | focaccia-qemu-6106a329141af7d47bdc3346ce9820d4714e0e5d.tar.gz focaccia-qemu-6106a329141af7d47bdc3346ce9820d4714e0e5d.zip | |
vfio: Introduce a helper function to initialize VFIODevice
Introduce a helper function to replace the common code to initialize VFIODevice in pci, platform, ap and ccw VFIO device. No functional change intended. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/helpers.c')
| -rw-r--r-- | hw/vfio/helpers.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c index 3592c3d54e..6789870802 100644 --- a/hw/vfio/helpers.c +++ b/hw/vfio/helpers.c @@ -652,3 +652,14 @@ void vfio_device_set_fd(VFIODevice *vbasedev, const char *str, Error **errp) } vbasedev->fd = fd; } + +void vfio_device_init(VFIODevice *vbasedev, int type, VFIODeviceOps *ops, + DeviceState *dev, bool ram_discard) +{ + vbasedev->type = type; + vbasedev->ops = ops; + vbasedev->dev = dev; + vbasedev->fd = -1; + + vbasedev->ram_block_discard_allowed = ram_discard; +} |