[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v10 04/26] x86-iommu: introduce "intremap" property
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH v10 04/26] x86-iommu: introduce "intremap" property |
Date: |
Tue, 21 Jun 2016 15:47:32 +0800 |
Adding one property for intel-iommu devices to specify whether we should
support interrupt remapping. By default, IR is disabled. To enable it,
we should use (take Intel IOMMU as example):
-device intel_iommu,intremap=on
This property can be shared by Intel and future AMD IOMMUs.
Signed-off-by: Peter Xu <address@hidden>
---
hw/i386/x86-iommu.c | 23 +++++++++++++++++++++++
include/hw/i386/x86-iommu.h | 1 +
2 files changed, 24 insertions(+)
diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c
index f395139..4280839 100644
--- a/hw/i386/x86-iommu.c
+++ b/hw/i386/x86-iommu.c
@@ -59,9 +59,32 @@ static void x86_iommu_class_init(ObjectClass *klass, void
*data)
dc->realize = x86_iommu_realize;
}
+static bool x86_iommu_intremap_prop_get(Object *o, Error **errp)
+{
+ X86IOMMUState *s = X86_IOMMU_DEVICE(o);
+ return s->intr_supported;
+}
+
+static void x86_iommu_intremap_prop_set(Object *o, bool value, Error **errp)
+{
+ X86IOMMUState *s = X86_IOMMU_DEVICE(o);
+ s->intr_supported = value;
+}
+
+static void x86_iommu_instance_init(Object *o)
+{
+ X86IOMMUState *s = X86_IOMMU_DEVICE(o);
+
+ /* By default, do not support IR */
+ s->intr_supported = false;
+ object_property_add_bool(o, "intremap", x86_iommu_intremap_prop_get,
+ x86_iommu_intremap_prop_set, NULL);
+}
+
static const TypeInfo x86_iommu_info = {
.name = TYPE_X86_IOMMU_DEVICE,
.parent = TYPE_SYS_BUS_DEVICE,
+ .instance_init = x86_iommu_instance_init,
.instance_size = sizeof(X86IOMMUState),
.class_init = x86_iommu_class_init,
.class_size = sizeof(X86IOMMUClass),
diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h
index 2070cd1..07199be 100644
--- a/include/hw/i386/x86-iommu.h
+++ b/include/hw/i386/x86-iommu.h
@@ -47,6 +47,7 @@ struct X86IOMMUClass {
struct X86IOMMUState {
SysBusDevice busdev;
+ bool intr_supported; /* Whether vIOMMU supports IR */
};
/**
--
2.4.11
- [Qemu-devel] [PATCH v10 00/26] IOMMU: Enable interrupt remapping for Intel IOMMU, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 01/26] x86-iommu: introduce parent class, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 02/26] x86-iommu: provide x86_iommu_get_default, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 04/26] x86-iommu: introduce "intremap" property,
Peter Xu <=
- [Qemu-devel] [PATCH v10 03/26] x86-iommu: q35: generalize find_add_as(), Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 05/26] acpi: enable INTR for DMAR report structure, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 06/26] intel_iommu: allow queued invalidation for IR, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 07/26] intel_iommu: set IR bit for ECAP register, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 08/26] acpi: add DMAR scope definition for root IOAPIC, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 09/26] intel_iommu: define interrupt remap table addr register, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 10/26] intel_iommu: handle interrupt remap enable, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 11/26] intel_iommu: define several structs for IOMMU IR, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 12/26] intel_iommu: add IR translation faults defines, Peter Xu, 2016/06/21
- [Qemu-devel] [PATCH v10 13/26] intel_iommu: Add support for PCI MSI remap, Peter Xu, 2016/06/21