From patchwork Fri May 30 21:24:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 354346 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 33C4E1400A3 for ; Sat, 31 May 2014 07:25:59 +1000 (EST) Received: from localhost ([::1]:56637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqUJI-0001LW-QL for incoming@patchwork.ozlabs.org; Fri, 30 May 2014 17:25:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqUIL-0008Lf-U5 for qemu-devel@nongnu.org; Fri, 30 May 2014 17:25:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqUIF-0005BA-NM for qemu-devel@nongnu.org; Fri, 30 May 2014 17:24:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqUIF-0005Ax-Dd; Fri, 30 May 2014 17:24:51 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4ULOoib019763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 May 2014 17:24:50 -0400 Received: from localhost (ovpn-113-48.phx2.redhat.com [10.3.113.48]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4ULOnDc015296; Fri, 30 May 2014 17:24:50 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org Date: Fri, 30 May 2014 18:24:32 -0300 Message-Id: <1401485072-14781-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1401485072-14781-1-git-send-email-ehabkost@redhat.com> References: <1401485072-14781-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] spapr: Add kvm-type property 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 The kvm-type machine option was left out when MachineState was introduced, preventing the kvm-type option from being used. Add the missing property to the sPAPR machine class, so it can be used. Signed-off-by: Eduardo Habkost Tested-by: Aneesh Kumar K.V --- Changes v1 -> v2: * Add property only to the sPAPR machine class Tested in a x86 machine only. Help would be welcome to test it on a ppc64 machine supporting KVM. Before applying this patch: $ qemu-system-ppc64 -machine pseries,accel=kvm,kvm-type=HV qemu-system-ppc64: Property '.kvm-type' not found After applying this patch: $ qemu-system-ppc64 -machine pseries,accel=kvm,kvm-type=HV KVM not supported for this target No accelerator found! --- hw/ppc/spapr.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 30764aa..82b1ca8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -96,6 +96,9 @@ typedef struct SPAPRMachine SPAPRMachine; struct SPAPRMachine { /*< private >*/ MachineState parent_obj; + + /*< public >*/ + char *kvm_type; }; @@ -1489,6 +1492,27 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, return NULL; } +static char *spapr_get_kvm_type(Object *obj, Error **errp) +{ + SPAPRMachine *sm = SPAPR_MACHINE(obj); + + return g_strdup(sm->kvm_type); +} + +static void spapr_set_kvm_type(Object *obj, const char *value, Error **errp) +{ + SPAPRMachine *sm = SPAPR_MACHINE(obj); + + g_free(sm->kvm_type); + sm->kvm_type = g_strdup(value); +} + +static void spapr_machine_initfn(Object *obj) +{ + object_property_add_str(obj, "kvm-type", + spapr_get_kvm_type, spapr_set_kvm_type, NULL); +} + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -1512,6 +1536,7 @@ static const TypeInfo spapr_machine_info = { .name = TYPE_SPAPR_MACHINE, .parent = TYPE_MACHINE, .instance_size = sizeof(SPAPRMachine), + .instance_init = spapr_machine_initfn, .class_init = spapr_machine_class_init, .interfaces = (InterfaceInfo[]) { { TYPE_FW_PATH_PROVIDER },