[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 43/47] vfio/ap: Move VFIODevice initializations in vfio_ap_instanc
From: |
Cédric Le Goater |
Subject: |
[PULL 43/47] vfio/ap: Move VFIODevice initializations in vfio_ap_instance_init |
Date: |
Tue, 19 Dec 2023 19:56:39 +0100 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
Some of the VFIODevice initializations is in vfio_ap_realize,
move all of them in vfio_ap_instance_init.
No functional change intended.
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/ap.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index
f180e4a32aa00f391f02e49b6c1bc2e8ebd2fecb..95fe7cd98b6fdad5d8ca12a798f9aff91ca5b3f4
100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -164,18 +164,6 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
return;
}
- vbasedev->ops = &vfio_ap_ops;
- vbasedev->type = VFIO_DEVICE_TYPE_AP;
- vbasedev->dev = dev;
-
- /*
- * vfio-ap devices operate in a way compatible with discarding of
- * memory in RAM blocks, as no pages are pinned in the host.
- * This needs to be set before vfio_get_device() for vfio common to
- * handle ram_block_discard_disable().
- */
- vapdev->vdev.ram_block_discard_allowed = true;
-
ret = vfio_attach_device(vbasedev->name, vbasedev,
&address_space_memory, errp);
if (ret) {
@@ -236,8 +224,20 @@ static const VMStateDescription vfio_ap_vmstate = {
static void vfio_ap_instance_init(Object *obj)
{
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(obj);
+ VFIODevice *vbasedev = &vapdev->vdev;
- vapdev->vdev.fd = -1;
+ vbasedev->type = VFIO_DEVICE_TYPE_AP;
+ vbasedev->ops = &vfio_ap_ops;
+ vbasedev->dev = DEVICE(vapdev);
+ vbasedev->fd = -1;
+
+ /*
+ * vfio-ap devices operate in a way compatible with discarding of
+ * memory in RAM blocks, as no pages are pinned in the host.
+ * This needs to be set before vfio_get_device() for vfio common to
+ * handle ram_block_discard_disable().
+ */
+ vbasedev->ram_block_discard_allowed = true;
}
#ifdef CONFIG_IOMMUFD
--
2.43.0
- [PULL 34/47] vfio/ap: Make vfio cdev pre-openable by passing a file handle, (continued)
- [PULL 34/47] vfio/ap: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 35/47] vfio/ccw: Allow the selection of a given iommu backend, Cédric Le Goater, 2023/12/19
- [PULL 38/47] hw/arm: Activate IOMMUFD for virt machines, Cédric Le Goater, 2023/12/19
- [PULL 32/47] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 45/47] vfio: Introduce a helper function to initialize VFIODevice, Cédric Le Goater, 2023/12/19
- [PULL 46/47] docs/devel: Add VFIO iommufd backend documentation, Cédric Le Goater, 2023/12/19
- [PULL 42/47] vfio/platform: Move VFIODevice initializations in vfio_platform_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 44/47] vfio/ccw: Move VFIODevice initializations in vfio_ccw_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 39/47] kconfig: Activate IOMMUFD for s390x machines, Cédric Le Goater, 2023/12/19
- [PULL 41/47] vfio/pci: Move VFIODevice initializations in vfio_instance_init, Cédric Le Goater, 2023/12/19
- [PULL 43/47] vfio/ap: Move VFIODevice initializations in vfio_ap_instance_init,
Cédric Le Goater <=
- [PULL 47/47] hw/ppc/Kconfig: Imply VFIO_PCI, Cédric Le Goater, 2023/12/19
- [PULL 40/47] hw/i386: Activate IOMMUFD for q35 machines, Cédric Le Goater, 2023/12/19
- Re: [PULL 00/47] vfio queue, Stefan Hajnoczi, 2023/12/20