[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/32] vfio: Add vfio_get_object callback to VFIODeviceOps
From: |
Alex Williamson |
Subject: |
[PULL 02/32] vfio: Add vfio_get_object callback to VFIODeviceOps |
Date: |
Mon, 26 Oct 2020 13:32:32 -0600 |
User-agent: |
StGit/0.21-dirty |
From: Kirti Wankhede <kwankhede@nvidia.com>
Hook vfio_get_object callback for PCI devices.
Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Neo Jia <cjia@nvidia.com>
Suggested-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/pci.c | 8 ++++++++
include/hw/vfio/vfio-common.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 0d83eb0e47bb..bffd5bfe3b78 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2394,10 +2394,18 @@ static void vfio_pci_compute_needs_reset(VFIODevice
*vbasedev)
}
}
+static Object *vfio_pci_get_object(VFIODevice *vbasedev)
+{
+ VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
+
+ return OBJECT(vdev);
+}
+
static VFIODeviceOps vfio_pci_ops = {
.vfio_compute_needs_reset = vfio_pci_compute_needs_reset,
.vfio_hot_reset_multi = vfio_pci_hot_reset_multi,
.vfio_eoi = vfio_intx_eoi,
+ .vfio_get_object = vfio_pci_get_object,
};
int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp)
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index dc95f527b583..fe99c36a693a 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -119,6 +119,7 @@ struct VFIODeviceOps {
void (*vfio_compute_needs_reset)(VFIODevice *vdev);
int (*vfio_hot_reset_multi)(VFIODevice *vdev);
void (*vfio_eoi)(VFIODevice *vdev);
+ Object *(*vfio_get_object)(VFIODevice *vdev);
};
typedef struct VFIOGroup {
- [PULL 00/32] VFIO updates 2020-10-26 (for QEMU 5.2 soft-freeze), Alex Williamson, 2020/10/26
- [PULL 01/32] vfio: Add function to unmap VFIO region, Alex Williamson, 2020/10/26
- [PULL 02/32] vfio: Add vfio_get_object callback to VFIODeviceOps,
Alex Williamson <=
- [PULL 03/32] vfio: Add save and load functions for VFIO PCI devices, Alex Williamson, 2020/10/26
- [PULL 04/32] vfio: Add migration region initialization and finalize function, Alex Williamson, 2020/10/26
- [PULL 05/32] vfio: Add VM state change handler to know state of VM, Alex Williamson, 2020/10/26
- [PULL 06/32] vfio: Add migration state change notifier, Alex Williamson, 2020/10/26
- [PULL 07/32] vfio: Register SaveVMHandlers for VFIO device, Alex Williamson, 2020/10/26
- [PULL 09/32] vfio: Add load state functions to SaveVMHandlers, Alex Williamson, 2020/10/26
- [PULL 08/32] vfio: Add save state functions to SaveVMHandlers, Alex Williamson, 2020/10/26
- [PULL 10/32] memory: Set DIRTY_MEMORY_MIGRATION when IOMMU is enabled, Alex Williamson, 2020/10/26
- [PULL 11/32] vfio: Get migration capability flags for container, Alex Williamson, 2020/10/26
- [PULL 12/32] vfio: Add function to start and stop dirty pages tracking, Alex Williamson, 2020/10/26