[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/13] intel_iommu: provide helper function vtd_get_
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH 09/13] intel_iommu: provide helper function vtd_get_iommu |
Date: |
Fri, 19 Feb 2016 11:30:14 +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 | 17 ++---------------
hw/i386/intel_iommu.c | 13 +++++++++++++
include/hw/i386/intel_iommu.h | 2 ++
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1cefe43..3cc7886 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2491,19 +2491,6 @@ build_mcfg_q35(GArray *table_data, GArray *linker,
AcpiMcfgInfo *info)
build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL, NULL);
}
-static IntelIOMMUState *acpi_get_iommu(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;
-}
-
static void
build_dmar_q35(GArray *table_data, GArray *linker)
{
@@ -2512,7 +2499,7 @@ build_dmar_q35(GArray *table_data, GArray *linker)
AcpiTableDmar *dmar;
AcpiDmarHardwareUnit *drhd;
uint8_t dmar_flags = 0;
- IntelIOMMUState *intel_iommu = acpi_get_iommu();
+ IntelIOMMUState *intel_iommu = vtd_iommu_get();
AcpiDmarDeviceScope *scope = NULL;
/* Root complex IOAPIC use one path[0] only */
uint16_t scope_size = sizeof(*scope) + sizeof(uint16_t);
@@ -2613,7 +2600,7 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
static bool acpi_has_iommu(void)
{
- return !!acpi_get_iommu();
+ return !!vtd_iommu_get();
}
static bool acpi_has_nvdimm(void)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index f1cb574..a9cbd7d 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2000,6 +2000,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 89781b4..bb94fbd 100644
--- a/include/hw/i386/intel_iommu.h
+++ b/include/hw/i386/intel_iommu.h
@@ -197,5 +197,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 04/13] intel_iommu: set IR bit for ECAP register, (continued)
[Qemu-devel] [PATCH 06/13] intel_iommu: define interrupt remap table addr register, Peter Xu, 2016/02/18
[Qemu-devel] [PATCH 07/13] intel_iommu: handle interrupt remap enable, Peter Xu, 2016/02/18
[Qemu-devel] [PATCH 08/13] intel_iommu: define several structs for IOMMU IR, Peter Xu, 2016/02/18
[Qemu-devel] [PATCH 09/13] intel_iommu: provide helper function vtd_get_iommu,
Peter Xu <=
[Qemu-devel] [PATCH 10/13] ioapic-common: add iommu for IOAPICCommonState, Peter Xu, 2016/02/18
[Qemu-devel] [PATCH 11/13] intel_iommu: add IR translation faults defines, Peter Xu, 2016/02/18
[Qemu-devel] [PATCH 12/13] intel_iommu: ioapic: IR support for emulated IOAPIC, Peter Xu, 2016/02/18
[Qemu-devel] [PATCH 13/13] intel_iommu: Add support for PCI MSI remap, Peter Xu, 2016/02/18
Re: [Qemu-devel] [PATCH 00/13] IOMMU: Enable interrupt remapping for Intel IOMMU, Jan Kiszka, 2016/02/19