From patchwork Tue Apr 21 22:38:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 463530 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 85A401402ED for ; Wed, 22 Apr 2015 08:38:40 +1000 (AEST) Received: from localhost ([::1]:60636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkgoP-0007u9-2I for incoming@patchwork.ozlabs.org; Tue, 21 Apr 2015 18:38:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ykgo4-0007Lo-Kg for qemu-devel@nongnu.org; Tue, 21 Apr 2015 18:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ykgo1-0002g9-EY for qemu-devel@nongnu.org; Tue, 21 Apr 2015 18:38:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39804 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ykgo1-0002g2-8b for qemu-devel@nongnu.org; Tue, 21 Apr 2015 18:38:13 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E9702AB9A; Tue, 21 Apr 2015 22:38:11 +0000 (UTC) From: Alexander Graf To: qemu-devel@nongnu.org Date: Wed, 22 Apr 2015 00:38:11 +0200 Message-Id: <1429655891-198219-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1429655891-198219-1-git-send-email-agraf@suse.de> References: <1429655891-198219-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: bonzini@redhat.com, "Bernhard M. Wiedemann" , afaerber@suse.de, Eduardo Habkost Subject: [Qemu-devel] [PATCH 2/2] x86: Fix Opteron xlevels 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 AMD Opteron family has different xlevel levels depending on the generation. I looked up Gen1, Gen2 and Gen3 hardware and adapted the levels according to real silicon. The reason this came up is that there is a sanity check in KVM making sure that SVM is only used when xlevel is high enough. Using real hardware levels, they now are. Reported-by: Bernhard M. Wiedemann Signed-off-by: Alexander Graf Reviewed-by: Eduardo Habkost --- v1 -> v2: - add compat handling for machine types < 2.4 --- include/hw/i386/pc.h | 13 +++++++++++++ target-i386/cpu.c | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 05ac5f9..c3cfe18 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -296,6 +296,19 @@ int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_COMPAT_2_3 \ + {\ + .driver = "Opteron_G1-" TYPE_X86_CPU,\ + .property = "xlevel",\ + .value = stringify(0x80000008),\ + },{\ + .driver = "Opteron_G2-" TYPE_X86_CPU,\ + .property = "xlevel",\ + .value = stringify(0x80000008),\ + },{\ + .driver = "Opteron_G3-" TYPE_X86_CPU,\ + .property = "xlevel",\ + .value = stringify(0x80000008),\ + } #define PC_COMPAT_2_0 \ PC_COMPAT_2_3, \ diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 03b33cf..d1b1b8c 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1234,7 +1234,7 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL | CPUID_EXT2_APIC | CPUID_EXT2_CX8 | CPUID_EXT2_MCE | CPUID_EXT2_PAE | CPUID_EXT2_MSR | CPUID_EXT2_TSC | CPUID_EXT2_PSE | CPUID_EXT2_DE | CPUID_EXT2_FPU, - .xlevel = 0x80000008, + .xlevel = 0x80000018, .model_id = "AMD Opteron 240 (Gen 1 Class Opteron)", }, { @@ -1262,7 +1262,7 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_EXT2_DE | CPUID_EXT2_FPU, .features[FEAT_8000_0001_ECX] = CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, - .xlevel = 0x80000008, + .xlevel = 0x80000018, .model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)", }, { @@ -1292,7 +1292,7 @@ static X86CPUDefinition builtin_x86_defs[] = { .features[FEAT_8000_0001_ECX] = CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, - .xlevel = 0x80000008, + .xlevel = 0x8000001A, .model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)", }, {