From patchwork Mon Aug 24 23:19:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Kiarie X-Patchwork-Id: 510330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 63DE01401DA for ; Tue, 25 Aug 2015 09:20:12 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=EAdoAPvH; dkim-atps=neutral Received: from localhost ([::1]:57142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU12A-000463-Hz for incoming@patchwork.ozlabs.org; Mon, 24 Aug 2015 19:20:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU11j-0003Jl-Cw for qemu-devel@nongnu.org; Mon, 24 Aug 2015 19:19:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZU11h-0006tm-1y for qemu-devel@nongnu.org; Mon, 24 Aug 2015 19:19:43 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:35871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU11g-0006sY-RS for qemu-devel@nongnu.org; Mon, 24 Aug 2015 19:19:40 -0400 Received: by wicja10 with SMTP id ja10so85144662wic.1 for ; Mon, 24 Aug 2015 16:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tzj+e2Jv6k097T5LOImuQjOoeroz7znlwWlujsVbohk=; b=EAdoAPvHPh+rT2BkVwmQkSq/8iU4hEFp+Blp6834kKKBiBqujsYWAKMxWn7GXUDn9U hOr4HBqtFSLqliDwfL5IdSvkNhxZcOeaCDW0/II9cOVQ8f1DuQc5Vaw9WPFC1r0fzxnv sJC03K5ZrVaOaJZoribxvqzeUXJ95PPK11dfCFGa/oE1iEphHwfSEtgBDUnAOGKafzlF 8QF96f9EQQOzNWHc7GGRaSacyi3HJf2BAwmKxQlWxw9EBkbCb+Mc2kYjb2wm1PCitVCj ND7j9E8vUd+0Lgi73Stqn0nBwzydwdGYLhISW8aMHu6Dh1WUxXRUGSGEtcNdUr8aXKXg ROGQ== X-Received: by 10.180.75.48 with SMTP id z16mr34199639wiv.2.1440458380250; Mon, 24 Aug 2015 16:19:40 -0700 (PDT) Received: from debian.flybox.orange ([154.122.104.232]) by smtp.googlemail.com with ESMTPSA id bq7sm25218153wjc.31.2015.08.24.16.19.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Aug 2015 16:19:39 -0700 (PDT) From: David Kiarie To: qemu-devel@nongnu.org Date: Tue, 25 Aug 2015 02:19:26 +0300 Message-Id: <1440458369-7384-2-git-send-email-davidkiarie4@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440458369-7384-1-git-send-email-davidkiarie4@gmail.com> References: <1440458369-7384-1-git-send-email-davidkiarie4@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::230 Cc: valentine.sinitsyn@gmail.com, jan.kiszka@web.de, David , mst@redhat.com Subject: [Qemu-devel] [RFC 1/4] hw/core: Prepare for introducing AMD IOMMU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Add AMD IOMMU as one of the devices that can possibly be emulated by Qemu. Also, add some helper functions for manipulating presence/absence of 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 ac4654e..b326a80 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -255,6 +255,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); @@ -400,6 +414,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); @@ -436,6 +456,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 3f84afd..88324b2 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); @@ -139,6 +140,7 @@ struct MachineState { bool usb_disabled; char *firmware; bool iommu; + bool amd_iommu; bool suppress_vmdesc; ram_addr_t ram_size;