From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:47551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmeYy-0006mv-5V for qemu-devel@nongnu.org; Thu, 24 Jan 2019 07:56:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmeYx-0005hO-Ia for qemu-devel@nongnu.org; Thu, 24 Jan 2019 07:56:56 -0500 Received: from mga06.intel.com ([134.134.136.31]:20544) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmeYx-0005be-AO for qemu-devel@nongnu.org; Thu, 24 Jan 2019 07:56:55 -0500 From: Luwei Kang Date: Thu, 24 Jan 2019 20:54:43 -0500 Message-Id: <1548381283-16688-1-git-send-email-luwei.kang@intel.com> Subject: [Qemu-devel] [PATCH] i386: extended the cpuid level when Intel PT is enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, Luwei Kang Intel Processor Trace required CPUID[0x14] but the cpuid level is 0xd when create a kvm guest with e.g. "-cpu qemu64,+intel-pt". Signed-off-by: Luwei Kang --- target/i386/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2f54125..da477b3 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5023,6 +5023,13 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) x86_cpu_adjust_feat_level(cpu, FEAT_C000_0001_EDX); x86_cpu_adjust_feat_level(cpu, FEAT_SVM); x86_cpu_adjust_feat_level(cpu, FEAT_XSAVE); + + /* Intel Processor Trace requires CPUID[0x14] */ + if ((env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_INTEL_PT) && + kvm_enabled()) { + x86_cpu_adjust_level(cpu, &cpu->env.cpuid_min_level, 0x14); + } + /* SVM requires CPUID[0x8000000A] */ if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM) { x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000000A); -- 1.8.3.1