@@ -2632,6 +2632,12 @@ static const MemoryRegionOps vtd_mem_ir_ops = {
},
};
+static IOMMUObject *vtd_as_iommu_get(AddressSpace *as)
+{
+ VTDAddressSpace *vtd_dev_as = container_of(as, VTDAddressSpace, as);
+ return (IOMMUObject *)vtd_dev_as->iommu_state;
+}
+
VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
{
uintptr_t key = (uintptr_t)bus;
@@ -2692,6 +2698,9 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
VTD_INTERRUPT_ADDR_FIRST,
&vtd_dev_as->iommu_ir, 64);
address_space_init(&vtd_dev_as->as, &vtd_dev_as->root, name);
+
+ vtd_dev_as->as.as_ops.iommu_get = vtd_as_iommu_get;
+
memory_region_add_subregion_overlap(&vtd_dev_as->root, 0,
&vtd_dev_as->sys_alias, 1);
memory_region_add_subregion_overlap(&vtd_dev_as->root, 0,
Then it'll be the first one to support address_space_iommu_get() API. Signed-off-by: Peter Xu <peterx@redhat.com> --- hw/i386/intel_iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+)