From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zk9li-0007of-LY for qemu-devel@nongnu.org; Thu, 08 Oct 2015 07:53:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zk9lh-0007mS-Mt for qemu-devel@nongnu.org; Thu, 08 Oct 2015 07:53:54 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:36829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zk9lh-0007lN-Hd for qemu-devel@nongnu.org; Thu, 08 Oct 2015 07:53:53 -0400 Received: by wicgb1 with SMTP id gb1so21937222wic.1 for ; Thu, 08 Oct 2015 04:53:53 -0700 (PDT) From: David Kiarie Date: Fri, 9 Oct 2015 05:53:54 +0300 Message-Id: <1444359237-27224-2-git-send-email-davidkiarie4@gmail.com> In-Reply-To: <1444359237-27224-1-git-send-email-davidkiarie4@gmail.com> References: <1444359237-27224-1-git-send-email-davidkiarie4@gmail.com> Subject: [Qemu-devel] [PATCH 1/4] hw/core: Add iommu to machine properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, jan.kiszka@web.de, valentine.sinitsyn@gmail.com, mst@redhat.com Cc: David From: David Add iommu to machine properties in preparation of introducing AMD IOMMU Signed-off-by: David Kiarie --- hw/core/machine.c | 25 +++++++++++++++++++++++++ include/hw/boards.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 51ed6b2..8cc7461 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -269,6 +269,20 @@ static void machine_set_iommu(Object *obj, bool value, Error **errp) ms->iommu = value; } +static bool machine_get_amd_iommu(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return ms->amd_iommu; +} + +static void machine_set_amd_iommu(Object *obj, bool value, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + ms->amd_iommu = value; +} + static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **errp) { MachineState *ms = MACHINE(obj); @@ -420,6 +434,12 @@ static void machine_initfn(Object *obj) object_property_set_description(obj, "iommu", "Set on/off to enable/disable Intel IOMMU (VT-d)", NULL); + object_property_add_bool(obj, "amd-iommu", + machine_get_amd_iommu, + machine_set_amd_iommu, NULL); + object_property_set_description(obj, "amd-iommu", + "Set on/off to enable/disable AMD-Vi", + NULL); object_property_add_bool(obj, "suppress-vmdesc", machine_get_suppress_vmdesc, machine_set_suppress_vmdesc, NULL); @@ -456,6 +476,11 @@ bool machine_iommu(MachineState *machine) return machine->iommu; } +bool machine_amd_iommu(MachineState *machine) +{ + return machine->amd_iommu; +} + bool machine_kernel_irqchip_allowed(MachineState *machine) { return machine->kernel_irqchip_allowed; diff --git a/include/hw/boards.h b/include/hw/boards.h index 566a5ca..c8424f7 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -54,6 +54,7 @@ extern MachineState *current_machine; bool machine_usb(MachineState *machine); bool machine_iommu(MachineState *machine); +bool machine_amd_iommu(MachineState *machine); bool machine_kernel_irqchip_allowed(MachineState *machine); bool machine_kernel_irqchip_required(MachineState *machine); int machine_kvm_shadow_mem(MachineState *machine); @@ -140,6 +141,7 @@ struct MachineState { bool igd_gfx_passthru; char *firmware; bool iommu; + bool amd_iommu; bool suppress_vmdesc; ram_addr_t ram_size; -- 2.1.4