From patchwork Mon Sep 24 14:32:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Slutz X-Patchwork-Id: 186445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 710ED2C0086 for ; Tue, 25 Sep 2012 00:40:09 +1000 (EST) Received: from localhost ([::1]:51183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG9pO-0003Io-Fd for incoming@patchwork.ozlabs.org; Mon, 24 Sep 2012 10:40:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG9iu-0006yx-3V for qemu-devel@nongnu.org; Mon, 24 Sep 2012 10:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TG9ik-0000wJ-Hi for qemu-devel@nongnu.org; Mon, 24 Sep 2012 10:33:23 -0400 Received: from hub021-nj-6.exch021.serverdata.net ([206.225.164.222]:59825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG9ik-0000wF-Dh for qemu-devel@nongnu.org; Mon, 24 Sep 2012 10:33:14 -0400 Received: from localhost.localdomain (131.239.15.22) by east.exch021.serverdata.net (10.240.4.93) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 24 Sep 2012 07:33:13 -0700 From: Don Slutz To: , , , , , , , , Date: Mon, 24 Sep 2012 10:32:15 -0400 Message-ID: <1348497138-2516-14-git-send-email-Don@CloudSwitch.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1348497138-2516-1-git-send-email-Don@CloudSwitch.com> References: <1348497138-2516-1-git-send-email-Don@CloudSwitch.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+, XP SP1+ (seldom 98) X-Received-From: 206.225.164.222 Cc: Don Slutz Subject: [Qemu-devel] [PATCH v6 13/16] target-i386: Add cpu object access routines for Hypervisor leaf extra. 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 Signed-off-by: Don Slutz --- target-i386/cpu.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 9ab29a7..8bb20c7 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1279,6 +1279,63 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value, env->cpuid_hv_vendor_set = true; } +static void x86_cpuid_get_hv_extra(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + + visit_type_uint32(v, &cpu->env.cpuid_hv_extra, name, errp); +} + +static void x86_cpuid_set_hv_extra(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + uint32_t value; + + visit_type_uint32(v, &value, name, errp); + if (error_is_set(errp)) { + return; + } + + if ((value != 0) && (value < 0x40000000)) { + value += 0x40000000; + } + cpu->env.cpuid_hv_extra = value; +} + +static void x86_cpuid_get_hv_extra_a(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + + visit_type_uint32(v, &cpu->env.cpuid_hv_extra_a, name, errp); +} + +static void x86_cpuid_set_hv_extra_a(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + + visit_type_uint32(v, &cpu->env.cpuid_hv_extra_a, name, errp); +} + +static void x86_cpuid_get_hv_extra_b(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + + visit_type_uint32(v, &cpu->env.cpuid_hv_extra_b, name, errp); +} + +static void x86_cpuid_set_hv_extra_b(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + + visit_type_uint32(v, &cpu->env.cpuid_hv_extra_b, name, errp); +} + #if !defined(CONFIG_USER_ONLY) static void x86_set_hyperv(Object *obj, Error **errp) { @@ -2225,6 +2282,15 @@ static void x86_cpu_initfn(Object *obj) object_property_add_str(obj, "hypervisor-vendor", x86_cpuid_get_hv_vendor, x86_cpuid_set_hv_vendor, NULL); + object_property_add(obj, "hypervisor-extra", "int", + x86_cpuid_get_hv_extra, + x86_cpuid_set_hv_extra, NULL, NULL, NULL); + object_property_add(obj, "hypervisor-extra-a", "int", + x86_cpuid_get_hv_extra_a, + x86_cpuid_set_hv_extra_a, NULL, NULL, NULL); + object_property_add(obj, "hypervisor-extra-b", "int", + x86_cpuid_get_hv_extra_b, + x86_cpuid_set_hv_extra_b, NULL, NULL, NULL); #if !defined(CONFIG_USER_ONLY) object_property_add(obj, "hv_spinlocks", "int", x86_get_hv_spinlocks,