qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 7/8] intel_iommu: provide AddressSpaceOps.iommu_


From: Peter Xu
Subject: [Qemu-devel] [RFC PATCH 7/8] intel_iommu: provide AddressSpaceOps.iommu_get()
Date: Thu, 27 Apr 2017 17:34:19 +0800

Then it'll be the first one to support address_space_iommu_get() API.

Signed-off-by: Peter Xu <address@hidden>
---
 hw/i386/intel_iommu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 609732b..5131329 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -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,
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]