diff mbox series

[RFC,v2,24/28] memory: Introduce IOMMU_NOTIFIER_INIT_CFG IOMMU Config Notifier

Message ID 20180921081819.9203-25-eric.auger@redhat.com
State New
Headers show
Series vSMMUv3/pSMMUv3 2 stage VFIO integration | expand

Commit Message

Eric Auger Sept. 21, 2018, 8:18 a.m. UTC
This patch adds a new IOMMU config notifier. It aims at
configuring the fault reporting from host to guest.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---

I acknowledge I am not a big fan of having a vfio uapi struct
referenced in IOMMUConfig. However this config really sets
something at VFIO layer. Also I may rename IOMMU_NOTIFIER_INIT_CFG
into IOMMU_NOTIFIER_FAULT_CONFIG. Globally it is also questionnable
at this stage if such a notifier really is requested. I devised that
to allow the SMMU to pass a fifo size to the kernel. This size can
be aligned to the size as seen/set by the guest. However for
unrecoverable errors we may consider that having an arbitrary size
determined by vfio/common.c can be sufficient?
---
 include/exec/memory.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 93150e1450..f54c39b248 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -28,6 +28,7 @@ 
 #include "hw/qdev-core.h"
 #ifdef CONFIG_LINUX
 #include <linux/iommu.h>
+#include <linux/vfio.h>
 #endif
 
 #define RAM_ADDR_INVALID (~(ram_addr_t)0)
@@ -82,6 +83,7 @@  typedef struct IOMMUConfig {
     union {
 #ifdef __linux__
         struct iommu_pasid_table_config pasid_cfg;
+        struct vfio_iommu_type1_guest_fault_config fault_cfg;
 #endif
           };
 } IOMMUConfig;
@@ -98,10 +100,13 @@  typedef enum {
     IOMMU_NOTIFIER_MAP = 0x2,
     /* Notify stage 1 config changes */
     IOMMU_NOTIFIER_PASID_CFG = 0x4,
+    /* Notify IOMMU initial setup */
+    IOMMU_NOTIFIER_INIT_CFG = 0x8,
 } IOMMUNotifierFlag;
 
 #define IOMMU_NOTIFIER_IOTLB_ALL (IOMMU_NOTIFIER_MAP | IOMMU_NOTIFIER_UNMAP)
-#define IOMMU_NOTIFIER_CONFIG_ALL (IOMMU_NOTIFIER_PASID_CFG)
+#define IOMMU_NOTIFIER_CONFIG_ALL (IOMMU_NOTIFIER_PASID_CFG | \
+                                   IOMMU_NOTIFIER_INIT_CFG)
 
 struct IOMMUNotifier;
 struct IOMMUConfig;