[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 7/7] vfio/pci: register vfio_iommu_bind_pasidtbl_
From: |
Liu, Yi L |
Subject: |
[Qemu-devel] [PATCH v2 7/7] vfio/pci: register vfio_iommu_bind_pasidtbl_notify notifier |
Date: |
Fri, 24 Nov 2017 16:52:40 +0800 |
This is an example to show the usage of IOMMUObject based notifier.
For passthru devices, if there is a vIOMMU exposed to guest, guest
would issue iommu operation on the devices. And the iommu operations
needs to be propagated to host iommu driver.
In future, the IOMMUObject notifiers may include:
* notifier for guest pasid table binding
* notifier for guest iommu tlb invalidation
Both of the two notifiers would be include in future virt-SVM patchset.
In virt-SVM patchset, this notifier would be fulfilled.
Signed-off-by: Liu, Yi L <address@hidden>
---
hw/vfio/pci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 5b77c7e..3ed521e 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2637,6 +2637,14 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice
*vdev)
vdev->req_enabled = false;
}
+static void vfio_iommu_bind_pasidtbl_notify(IOMMUNotifier *n,
+ IOMMUEventData *event_data)
+{
+/* Sample code, would be detailed in coming virt-SVM patchset.
+ VFIOGuestIOMMUObject *giommu = container_of(n, VFIOGuestIOMMUObject, n);
+ VFIOContainer *container = giommu->container;
+*/
+}
static void vfio_realize(PCIDevice *pdev, Error **errp)
{
VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev);
@@ -2889,6 +2897,12 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
QLIST_INSERT_HEAD(&group->container->giommu_object_list,
giommu,
giommu_next);
+ /* Register vfio_iommu_bind_pasidtbl_notify with event flag
+ IOMMU_EVENT_BIND_PASIDT */
+ iommu_notifier_register(iommu,
+ &giommu->n,
+ vfio_iommu_bind_pasidtbl_notify,
+ IOMMU_EVENT_BIND_PASIDT);
}
return;
--
1.9.1
- [Qemu-devel] [PATCH v2 0/7] Introduce new iommu notifier framework, Liu, Yi L, 2017/11/24
- [Qemu-devel] [PATCH v2 1/7] memory: rename existing iommu notifier to be iommu mr notifier, Liu, Yi L, 2017/11/24
- [Qemu-devel] [PATCH v2 4/7] memory: introduce AddressSpaceOps, Liu, Yi L, 2017/11/24
- [Qemu-devel] [PATCH v2 3/7] hw/core: introduce IOMMUObject, Liu, Yi L, 2017/11/24
- [Qemu-devel] [PATCH v2 2/7] vfio: rename GuestIOMMU to be GuestIOMMUMR, Liu, Yi L, 2017/11/24
- [Qemu-devel] [PATCH v2 6/7] vfio/pci: add notify framework based on IOMMUObject, Liu, Yi L, 2017/11/24
- [Qemu-devel] [PATCH v2 7/7] vfio/pci: register vfio_iommu_bind_pasidtbl_notify notifier,
Liu, Yi L <=
- [Qemu-devel] [PATCH v2 5/7] intel_iommu: provide AddressSpaceOps.iommu_get instance, Liu, Yi L, 2017/11/24