[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v9 07/29] memory: Add IOMMU_ATTR_VFIO_NESTED IOMMU memory region at
From: |
Eric Auger |
Subject: |
[RFC v9 07/29] memory: Add IOMMU_ATTR_VFIO_NESTED IOMMU memory region attribute |
Date: |
Sun, 11 Apr 2021 14:08:50 +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 <eric.auger@redhat.com>
---
include/exec/memory.h | 3 ++-
hw/arm/smmuv3.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 94b9157249..3af3cc1adb 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -273,7 +273,8 @@ typedef struct MemoryRegionClass {
enum IOMMUMemoryRegionAttr {
- IOMMU_ATTR_SPAPR_TCE_FD
+ IOMMU_ATTR_SPAPR_TCE_FD,
+ IOMMU_ATTR_VFIO_NESTED,
};
/*
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index a4436868ba..7166008ab0 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -1582,6 +1582,17 @@ static int smmuv3_notify_flag_changed(IOMMUMemoryRegion
*iommu,
return 0;
}
+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)
{
@@ -1589,6 +1600,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 = {
--
2.26.3
- [RFC v9 00/29] vSMMUv3/pSMMUv3 2 stage VFIO integration, Eric Auger, 2021/04/11
- [RFC v9 01/29] hw/vfio/common: trace vfio_connect_container operations, Eric Auger, 2021/04/11
- [RFC v9 02/29] update-linux-headers: Import iommu.h, Eric Auger, 2021/04/11
- [RFC v9 03/29] header update against 5.12-rc6 and IOMMU/VFIO nested stage APIs, Eric Auger, 2021/04/11
- [RFC v9 04/29] memory: Add new fields in IOTLBEntry, Eric Auger, 2021/04/11
- [RFC v9 05/29] hw/arm/smmuv3: Improve stage1 ASID invalidation, Eric Auger, 2021/04/11
- [RFC v9 06/29] hw/arm/smmu-common: Allow domain invalidation for NH_ALL/NSNH_ALL, Eric Auger, 2021/04/11
- [RFC v9 07/29] memory: Add IOMMU_ATTR_VFIO_NESTED IOMMU memory region attribute,
Eric Auger <=
- [RFC v9 09/29] memory: Introduce IOMMU Memory Region inject_faults API, Eric Auger, 2021/04/11
- [RFC v9 08/29] memory: Add IOMMU_ATTR_MSI_TRANSLATE IOMMU memory region attribute, Eric Auger, 2021/04/11
- [RFC v9 10/29] iommu: Introduce generic header, Eric Auger, 2021/04/11
- [RFC v9 11/29] pci: introduce PCIPASIDOps to PCIDevice, Eric Auger, 2021/04/11
- [RFC v9 12/29] vfio: Force nested if iommu requires it, Eric Auger, 2021/04/11
- [RFC v9 13/29] vfio: Introduce hostwin_from_range helper, Eric Auger, 2021/04/11
- [RFC v9 14/29] vfio: Introduce helpers to DMA map/unmap a RAM section, Eric Auger, 2021/04/11
- [RFC v9 15/29] vfio: Set up nested stage mappings, Eric Auger, 2021/04/11