[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 08/18] intel_iommu: provide helper function vtd_g
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH v5 08/18] intel_iommu: provide helper function vtd_get_iommu |
Date: |
Thu, 28 Apr 2016 15:05:34 +0800 |
Moves acpi_get_iommu() under VT-d to make it a public function.
Signed-off-by: Peter Xu <address@hidden>
---
hw/i386/acpi-build.c | 7 +------
hw/i386/intel_iommu.c | 13 +++++++++++++
include/hw/i386/intel_iommu.h | 2 ++
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 5d2d87b..b064bc2 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2677,12 +2677,7 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
static bool acpi_has_iommu(void)
{
- bool ambiguous;
- Object *intel_iommu;
-
- intel_iommu = object_resolve_path_type("", TYPE_INTEL_IOMMU_DEVICE,
- &ambiguous);
- return intel_iommu && !ambiguous;
+ return !!vtd_iommu_get();
}
static
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 4d14124..a44289f 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2001,6 +2001,19 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s,
PCIBus *bus, int devfn)
return vtd_dev_as;
}
+IntelIOMMUState *vtd_iommu_get(void)
+{
+ bool ambiguous = false;
+ Object *intel_iommu = NULL;
+
+ intel_iommu = object_resolve_path_type("", TYPE_INTEL_IOMMU_DEVICE,
+ &ambiguous);
+ if (ambiguous)
+ intel_iommu = NULL;
+
+ return (IntelIOMMUState *)intel_iommu;
+}
+
/* Do the initialization. It will also be called when reset, so pay
* attention when adding new initialization stuff.
*/
diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h
index 4914fe6..9ee84f7 100644
--- a/include/hw/i386/intel_iommu.h
+++ b/include/hw/i386/intel_iommu.h
@@ -196,5 +196,7 @@ struct IntelIOMMUState {
* create a new one if none exists
*/
VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn);
+/* Get default IOMMU object */
+IntelIOMMUState *vtd_iommu_get(void);
#endif
--
2.4.3
- [Qemu-devel] [PATCH v5 00/18] IOMMU: Enable interrupt remapping for Intel IOMMU, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 01/18] acpi: enable INTR for DMAR report structure, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 02/18] intel_iommu: allow queued invalidation for IR, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 03/18] intel_iommu: set IR bit for ECAP register, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 04/18] acpi: add DMAR scope definition for root IOAPIC, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 05/18] intel_iommu: define interrupt remap table addr register, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 06/18] intel_iommu: handle interrupt remap enable, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 08/18] intel_iommu: provide helper function vtd_get_iommu,
Peter Xu <=
- [Qemu-devel] [PATCH v5 07/18] intel_iommu: define several structs for IOMMU IR, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 09/18] intel_iommu: add IR translation faults defines, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 10/18] intel_iommu: Add support for PCI MSI remap, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 11/18] q35: ioapic: add support for emulated IOAPIC IR, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 13/18] intel_iommu: add support for split irqchip, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 12/18] ioapic: introduce ioapic_entry_parse() helper, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 14/18] q35: add "intremap" parameter to enable IR, Peter Xu, 2016/04/28
- [Qemu-devel] [PATCH v5 15/18] intel_iommu: introduce IEC notifiers, Peter Xu, 2016/04/28