From patchwork Mon Sep 17 14:01:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Slutz X-Patchwork-Id: 1467531 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 805483FCFC for ; Mon, 17 Sep 2012 14:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756227Ab2IQODA (ORCPT ); Mon, 17 Sep 2012 10:03:00 -0400 Received: from hub021-nj-8.exch021.serverdata.net ([206.225.164.233]:1484 "EHLO hub021-nj-8.exch021.serverdata.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756218Ab2IQOC7 (ORCPT ); Mon, 17 Sep 2012 10:02:59 -0400 Received: from localhost.localdomain (131.239.15.22) by east.exch021.serverdata.net (10.240.4.118) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 17 Sep 2012 07:02:58 -0700 From: Don Slutz To: , , , , , , , , CC: Don Slutz Subject: [PATCH v3 14/17] target-i386: Add cpu object access routines for Hypervisor leaf extra. Date: Mon, 17 Sep 2012 10:01:04 -0400 Message-ID: <1347890467-9728-15-git-send-email-Don@CloudSwitch.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1346354435-21685-1-git-send-email-Don@CloudSwitch.com> References: <1346354435-21685-1-git-send-email-Don@CloudSwitch.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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 9ac3076..34d2291 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1265,6 +1265,63 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value, } } +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) { @@ -2199,6 +2256,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,