[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v2 05/22] vfio/common: add iommu_ctx_notifier in container
From: |
Liu Yi L |
Subject: |
[RFC v2 05/22] vfio/common: add iommu_ctx_notifier in container |
Date: |
Thu, 24 Oct 2019 08:34:26 -0400 |
This patch adds a list in VFIOContainer to store iommu_ctx_notifier
which is based on IOMMUContext. As a preparation of registering
iommu_ctx_notifiers.
Cc: Kevin Tian <address@hidden>
Cc: Jacob Pan <address@hidden>
Cc: Peter Xu <address@hidden>
Cc: Eric Auger <address@hidden>
Cc: Yi Sun <address@hidden>
Cc: David Gibson <address@hidden>
Signed-off-by: Liu Yi L <address@hidden>
---
hw/vfio/common.c | 1 +
include/hw/vfio/vfio-common.h | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 5ca1148..d418527 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -1271,6 +1271,7 @@ static int vfio_connect_container(VFIOGroup *group,
AddressSpace *as,
container->error = NULL;
QLIST_INIT(&container->giommu_list);
QLIST_INIT(&container->hostwin_list);
+ QLIST_INIT(&container->iommu_ctx_list);
ret = vfio_init_container(container, group->fd, errp);
if (ret) {
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index fd56420..975d12b 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -29,6 +29,7 @@
#ifdef CONFIG_LINUX
#include <linux/vfio.h>
#endif
+#include "hw/iommu/iommu.h"
#define VFIO_MSG_PREFIX "vfio %s: "
@@ -75,6 +76,7 @@ typedef struct VFIOContainer {
bool initialized;
unsigned long pgsizes;
QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
+ QLIST_HEAD(, VFIOIOMMUContext) iommu_ctx_list;
QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list;
QLIST_HEAD(, VFIOGroup) group_list;
QLIST_ENTRY(VFIOContainer) next;
@@ -88,6 +90,13 @@ typedef struct VFIOGuestIOMMU {
QLIST_ENTRY(VFIOGuestIOMMU) giommu_next;
} VFIOGuestIOMMU;
+typedef struct VFIOIOMMUContext {
+ VFIOContainer *container;
+ IOMMUContext *iommu_ctx;
+ IOMMUCTXNotifier n;
+ QLIST_ENTRY(VFIOIOMMUContext) iommu_ctx_next;
+} VFIOIOMMUContext;
+
typedef struct VFIOHostDMAWindow {
hwaddr min_iova;
hwaddr max_iova;
--
2.7.4
- [RFC v2 00/22] intel_iommu: expose Shared Virtual Addressing to VM, Liu Yi L, 2019/10/24
- [RFC v2 01/22] update-linux-headers: Import iommu.h, Liu Yi L, 2019/10/24
- [RFC v2 06/22] hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps, Liu Yi L, 2019/10/24
- [RFC v2 09/22] vfio/pci: add iommu_context notifier for pasid alloc/free, Liu Yi L, 2019/10/24
- [RFC v2 10/22] intel_iommu: add virtual command capability support, Liu Yi L, 2019/10/24
- [RFC v2 05/22] vfio/common: add iommu_ctx_notifier in container,
Liu Yi L <=
- [RFC v2 03/22] intel_iommu: modify x-scalable-mode to be string option, Liu Yi L, 2019/10/24
- [RFC v2 04/22] hw/iommu: introduce IOMMUContext, Liu Yi L, 2019/10/24
- [RFC v2 07/22] hw/pci: introduce pci_device_iommu_context(), Liu Yi L, 2019/10/24
- [RFC v2 08/22] intel_iommu: provide get_iommu_context() callback, Liu Yi L, 2019/10/24
- [RFC v2 02/22] header update VFIO/IOMMU vSVA APIs against 5.4.0-rc3+, Liu Yi L, 2019/10/24
- [RFC v2 11/22] intel_iommu: process pasid cache invalidation, Liu Yi L, 2019/10/24
- [RFC v2 12/22] intel_iommu: add present bit check for pasid table entries, Liu Yi L, 2019/10/24
- [RFC v2 14/22] vfio/pci: add iommu_context notifier for pasid bind/unbind, Liu Yi L, 2019/10/24