From nobody Sat Nov 1 09:48:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509711642059801.7970557042485; Fri, 3 Nov 2017 05:20:42 -0700 (PDT) Received: from localhost ([::1]:36451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAaxb-0000VM-6t for importer@patchew.org; Fri, 03 Nov 2017 08:20:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAava-0007ml-LM for qemu-devel@nongnu.org; Fri, 03 Nov 2017 08:18:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAavZ-0004RT-N9 for qemu-devel@nongnu.org; Fri, 03 Nov 2017 08:18:26 -0400 Received: from mga11.intel.com ([192.55.52.93]:37808) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eAavZ-0004Mu-Dm for qemu-devel@nongnu.org; Fri, 03 Nov 2017 08:18:25 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2017 05:18:24 -0700 Received: from sky-dev.bj.intel.com ([10.238.144.127]) by orsmga003.jf.intel.com with ESMTP; 03 Nov 2017 05:18:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,338,1505804400"; d="scan'208";a="1033103177" From: "Liu, Yi L" To: qemu-devel@nongnu.org, mst@redhat.com, david@gibson.dropbear.id.au, pbonzini@redhat.com, alex.williamson@redhat.com Date: Fri, 3 Nov 2017 20:01:53 +0800 Message-Id: <1509710516-21084-4-git-send-email-yi.l.liu@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509710516-21084-1-git-send-email-yi.l.liu@linux.intel.com> References: <1509710516-21084-1-git-send-email-yi.l.liu@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.93 Subject: [Qemu-devel] [RESEND PATCH 3/6] intel_iommu: provide AddressSpaceOps.iommu_get instance X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tianyu.lan@intel.com, "Liu, Yi L" , kevin.tian@intel.com, yi.l.liu@intel.com, jasowang@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu Provide AddressSpaceOps.iommu_get() in Intel IOMMU emulator. Signed-off-by: Peter Xu Signed-off-by: Liu, Yi L --- hw/i386/intel_iommu.c | 7 +++++++ include/hw/i386/intel_iommu.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index e81c706..54343e5 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2687,6 +2687,12 @@ static const MemoryRegionOps vtd_mem_ir_ops =3D { }, }; =20 +static IOMMUObject *vtd_as_iommu_get(AddressSpace *as) +{ + VTDAddressSpace *vtd_dev_as =3D container_of(as, VTDAddressSpace, as); + return &vtd_dev_as->iommu_object; +} + VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devf= n) { uintptr_t key =3D (uintptr_t)bus; @@ -2748,6 +2754,7 @@ 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 =3D 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, diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index c85f9ff..a3c6d45 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -27,6 +27,7 @@ #include "hw/i386/ioapic.h" #include "hw/pci/msi.h" #include "hw/sysbus.h" +#include "hw/core/iommu.h" =20 #define TYPE_INTEL_IOMMU_DEVICE "intel-iommu" #define INTEL_IOMMU_DEVICE(obj) \ @@ -90,6 +91,7 @@ struct VTDAddressSpace { MemoryRegion sys_alias; MemoryRegion iommu_ir; /* Interrupt region: 0xfeeXXXXX */ IntelIOMMUState *iommu_state; + IOMMUObject iommu_object; VTDContextCacheEntry context_cache_entry; }; =20 --=20 1.9.1