[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v4 02/29] memory: Add IOMMU_ATTR_VFIO_NESTED IOMMU mem
From: |
Eric Auger |
Subject: |
[Qemu-devel] [RFC v4 02/29] memory: Add IOMMU_ATTR_VFIO_NESTED IOMMU memory region attribute |
Date: |
Thu, 11 Jul 2019 19:28:18 +0200 |
We introduce a new IOMMU Memory Region attribute,
IOMMU_ATTR_VFIO_NESTED that tells whether the virtual IOMMU
requires HW nested paging for VFIO integration.
Current Intel virtual IOMMU device supports "Caching
Mode" and does not require 2 stages at physical level to be
integrated with VFIO. However SMMUv3 does not implement such
"caching mode" and requires to use HW nested paging.
As such SMMUv3 is the first IOMMU device to advertise this
attribute.
Signed-off-by: Eric Auger <address@hidden>
---
hw/arm/smmuv3.c | 12 ++++++++++++
include/exec/memory.h | 3 ++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index e96d5beb9a..384c02cb91 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -1490,6 +1490,17 @@ static void smmuv3_notify_flag_changed(IOMMUMemoryRegion
*iommu,
}
}
+static int smmuv3_get_attr(IOMMUMemoryRegion *iommu,
+ enum IOMMUMemoryRegionAttr attr,
+ void *data)
+{
+ if (attr == IOMMU_ATTR_VFIO_NESTED) {
+ *(bool *) data = true;
+ return 0;
+ }
+ return -EINVAL;
+}
+
static void smmuv3_iommu_memory_region_class_init(ObjectClass *klass,
void *data)
{
@@ -1497,6 +1508,7 @@ static void
smmuv3_iommu_memory_region_class_init(ObjectClass *klass,
imrc->translate = smmuv3_translate;
imrc->notify_flag_changed = smmuv3_notify_flag_changed;
+ imrc->get_attr = smmuv3_get_attr;
}
static const TypeInfo smmuv3_type_info = {
diff --git a/include/exec/memory.h b/include/exec/memory.h
index a078cd033f..e477a630a8 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -204,7 +204,8 @@ struct MemoryRegionOps {
};
enum IOMMUMemoryRegionAttr {
- IOMMU_ATTR_SPAPR_TCE_FD
+ IOMMU_ATTR_SPAPR_TCE_FD,
+ IOMMU_ATTR_VFIO_NESTED,
};
/**
--
2.20.1
- [Qemu-devel] [RFC v4 00/29] vSMMUv3/pSMMUv3 2 stage VFIO integration, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 01/29] memory: Remove unused memory_region_iommu_replay_all(), Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 02/29] memory: Add IOMMU_ATTR_VFIO_NESTED IOMMU memory region attribute,
Eric Auger <=
- [Qemu-devel] [RFC v4 03/29] hw/vfio/common: Assert in case of nested mode, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 05/29] hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 04/29] hw/arm/smmuv3: Log a guest error when decoding an invalid STE, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 06/29] update-linux-headers: Import iommu.h, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 07/29] update-linux-headers: Add sve_context.h to asm-arm64, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 08/29] header update against 5.3.0-rc0 and IOMMU/VFIO nested stage APIs, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 09/29] memory: Add IOMMU_ATTR_MSI_TRANSLATE IOMMU memory region attribute, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 10/29] memory: Introduce IOMMU Memory Region inject_faults API, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 11/29] memory: Add arch_id and leaf fields in IOTLBEntry, Eric Auger, 2019/07/11
- [Qemu-devel] [RFC v4 12/29] iommu: Introduce generic header, Eric Auger, 2019/07/11