[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/18] intel-iommu: Implement get_attr() method
From: |
Avihai Horon |
Subject: |
[PATCH 14/18] intel-iommu: Implement get_attr() method |
Date: |
Thu, 26 Jan 2023 20:49:44 +0200 |
Implement get_attr() method and use the address width property to report
the IOMMU_ATTR_MAX_IOVA attribute.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
hw/i386/intel_iommu.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 98a5c304a7..b0068b0df4 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3841,6 +3841,23 @@ static void vtd_iommu_replay(IOMMUMemoryRegion
*iommu_mr, IOMMUNotifier *n)
return;
}
+static int vtd_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
+ enum IOMMUMemoryRegionAttr attr, void *data)
+{
+ VTDAddressSpace *vtd_as = container_of(iommu_mr, VTDAddressSpace, iommu);
+ IntelIOMMUState *s = vtd_as->iommu_state;
+
+ if (attr == IOMMU_ATTR_MAX_IOVA) {
+ hwaddr *max_iova = data;
+
+ *max_iova = (1ULL << s->aw_bits) - 1;
+
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
/* Do the initialization. It will also be called when reset, so pay
* attention when adding new initialization stuff.
*/
@@ -4173,6 +4190,7 @@ static void
vtd_iommu_memory_region_class_init(ObjectClass *klass,
imrc->translate = vtd_iommu_translate;
imrc->notify_flag_changed = vtd_iommu_notify_flag_changed;
imrc->replay = vtd_iommu_replay;
+ imrc->get_attr = vtd_iommu_get_attr;
}
static const TypeInfo vtd_iommu_memory_region_info = {
--
2.26.3
- [PATCH 07/18] util: Extend iova_tree_foreach() to take data argument, (continued)
- [PATCH 07/18] util: Extend iova_tree_foreach() to take data argument, Avihai Horon, 2023/01/26
- [PATCH 05/18] vfio/common: Add VFIOBitmap and (de)alloc functions, Avihai Horon, 2023/01/26
- [PATCH 08/18] vfio/common: Record DMA mapped IOVA ranges, Avihai Horon, 2023/01/26
- [PATCH 09/18] vfio/common: Add device dirty page tracking start/stop, Avihai Horon, 2023/01/26
- [PATCH 06/18] util: Add iova_tree_nnodes(), Avihai Horon, 2023/01/26
- [PATCH 17/18] vfio/migration: Query device dirty page tracking support, Avihai Horon, 2023/01/26
- [PATCH 11/18] vfio/common: Add device dirty page bitmap sync, Avihai Horon, 2023/01/26
- [PATCH 13/18] memory/iommu: Add IOMMU_ATTR_MAX_IOVA attribute, Avihai Horon, 2023/01/26
- [PATCH 16/18] vfio/common: Optimize device dirty page tracking with vIOMMU, Avihai Horon, 2023/01/26
- [PATCH 12/18] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap(), Avihai Horon, 2023/01/26
- [PATCH 14/18] intel-iommu: Implement get_attr() method,
Avihai Horon <=
- [PATCH 15/18] vfio/common: Support device dirty page tracking with vIOMMU, Avihai Horon, 2023/01/26
- [PATCH 10/18] vfio/common: Extract code from vfio_get_dirty_bitmap() to new function, Avihai Horon, 2023/01/26
- [PATCH 18/18] docs/devel: Document VFIO device dirty page tracking, Avihai Horon, 2023/01/26