[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 01/25] acpi: enable INTR for DMAR report structur
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH v8 01/25] acpi: enable INTR for DMAR report structure |
Date: |
Mon, 30 May 2016 18:31:14 +0800 |
Introduce iommu_intr in MachineState to show whether IOMMU IR is
enabled. By default, IR is off.
In ACPI DMA remapping report structure, enable INTR flag when specified.
Signed-off-by: Peter Xu <address@hidden>
---
hw/core/machine.c | 2 ++
hw/i386/acpi-build.c | 12 +++++++++---
include/hw/boards.h | 1 +
include/hw/i386/intel_iommu.h | 2 ++
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index ccdd5fa..98471a7 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -397,6 +397,8 @@ static void machine_initfn(Object *obj)
ms->dump_guest_core = true;
ms->mem_merge = true;
ms->enable_graphics = true;
+ /* Disable interrupt remapping by default. */
+ ms->iommu_intr = false;
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 279f0d7..ddc6f16 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2554,16 +2554,22 @@ build_mcfg_q35(GArray *table_data, GArray *linker,
AcpiMcfgInfo *info)
}
static void
-build_dmar_q35(GArray *table_data, GArray *linker)
+build_dmar_q35(MachineState *ms, GArray *table_data, GArray *linker)
{
int dmar_start = table_data->len;
AcpiTableDmar *dmar;
AcpiDmarHardwareUnit *drhd;
+ uint8_t dmar_flags = 0;
+
+ if (ms->iommu_intr) {
+ /* enable INTR for the IOMMU device */
+ dmar_flags |= DMAR_REPORT_F_INTR;
+ }
dmar = acpi_data_push(table_data, sizeof(*dmar));
dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1;
- dmar->flags = 0; /* No intr_remap for now */
+ dmar->flags = dmar_flags;
/* DMAR Remapping Hardware Unit Definition structure */
drhd = acpi_data_push(table_data, sizeof(*drhd));
@@ -2724,7 +2730,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState
*machine)
}
if (acpi_has_iommu()) {
acpi_add_table(table_offsets, tables_blob);
- build_dmar_q35(tables_blob, tables->linker);
+ build_dmar_q35(MACHINE(pcms), tables_blob, tables->linker);
}
if (pcms->acpi_nvdimm_state.is_enabled) {
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index d268bd0..b27018d 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -152,6 +152,7 @@ struct MachineState {
bool igd_gfx_passthru;
char *firmware;
bool iommu;
+ bool iommu_intr;
bool suppress_vmdesc;
bool enforce_config_section;
bool enable_graphics;
diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h
index b024ffa..0d89796 100644
--- a/include/hw/i386/intel_iommu.h
+++ b/include/hw/i386/intel_iommu.h
@@ -44,6 +44,8 @@
#define VTD_HOST_ADDRESS_WIDTH 39
#define VTD_HAW_MASK ((1ULL << VTD_HOST_ADDRESS_WIDTH) - 1)
+#define DMAR_REPORT_F_INTR (1)
+
typedef struct VTDContextEntry VTDContextEntry;
typedef struct VTDContextCacheEntry VTDContextCacheEntry;
typedef struct IntelIOMMUState IntelIOMMUState;
--
2.4.11
- [Qemu-devel] [PATCH v8 00/25] IOMMU: Enable interrupt remapping for Intel IOMMU, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 01/25] acpi: enable INTR for DMAR report structure,
Peter Xu <=
- [Qemu-devel] [PATCH v8 02/25] intel_iommu: allow queued invalidation for IR, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 03/25] intel_iommu: set IR bit for ECAP register, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 04/25] acpi: add DMAR scope definition for root IOAPIC, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 06/25] intel_iommu: handle interrupt remap enable, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 05/25] intel_iommu: define interrupt remap table addr register, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 07/25] intel_iommu: define several structs for IOMMU IR, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 08/25] x86-iommu: introduce parent class, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 09/25] x86-iommu: provide x86_iommu_get_default, Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 10/25] x86-iommu: q35: generalize find_add_as(), Peter Xu, 2016/05/30
- [Qemu-devel] [PATCH v8 11/25] intel_iommu: add IR translation faults defines, Peter Xu, 2016/05/30