From patchwork Wed Apr 25 09:23:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 154874 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 C24B6B6FD8 for ; Wed, 25 Apr 2012 20:45:11 +1000 (EST) Received: from localhost ([::1]:39872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMySf-0006zo-Gz for incoming@patchwork.ozlabs.org; Wed, 25 Apr 2012 05:24:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMyRv-0005Ag-FR for qemu-devel@nongnu.org; Wed, 25 Apr 2012 05:23:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMyRt-0005PE-BX for qemu-devel@nongnu.org; Wed, 25 Apr 2012 05:23:47 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38168 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMyRt-0005O0-5f for qemu-devel@nongnu.org; Wed, 25 Apr 2012 05:23:45 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 19F4AA398E; Wed, 25 Apr 2012 11:23:44 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 25 Apr 2012 11:23:29 +0200 Message-Id: <1335345816-22452-9-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1335345816-22452-1-git-send-email-afaerber@suse.de> References: <1335345816-22452-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori Subject: [Qemu-devel] [PATCH v3 08/15] target-i386: Add property getter for CPU family 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: Andreas Färber Reviewed-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- target-i386/cpu.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index bb57345..90c1373 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -599,6 +599,20 @@ static int check_features_against_host(x86_def_t *guest_def) return rv; } +static void x86_cpuid_version_get_family(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + CPUX86State *env = &cpu->env; + int64_t value; + + value = (env->cpuid_version >> 8) & 0xf; + if (value == 0xf) { + value += (env->cpuid_version >> 20) & 0xff; + } + visit_type_int(v, &value, name, errp); +} + static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { @@ -1538,7 +1552,7 @@ static void x86_cpu_initfn(Object *obj) cpu_exec_init(env); object_property_add(obj, "family", "int", - NULL, + x86_cpuid_version_get_family, x86_cpuid_version_set_family, NULL, NULL, NULL); object_property_add(obj, "model", "int", NULL,