From: Babu Moger Subject: [PATCH v13 3/5] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Fri, 8 Jun 2018 18:56:19 -0400 Message-ID: <1528498581-131037-4-git-send-email-babu.moger@amd.com> References: <1528498581-131037-1-git-send-email-babu.moger@amd.com> Mime-Version: 1.0 Content-Type: text/plain Cc: geoff@hostfission.com, babu.moger@amd.com, kash@tripleback.net, qemu-devel@nongnu.org, kvm@vger.kernel.org To: mst@redhat.com, marcel.apfelbaum@gmail.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mtosatti@redhat.com Return-path: In-Reply-To: <1528498581-131037-1-git-send-email-babu.moger@amd.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org Enable TOPOEXT feature on EPYC CPU. This is required to support hyperthreading on VM guests. Also extend xlevel to 0x8000001E. TOPOEXT feature is disabled for legacy machines. Signed-off-by: Babu Moger --- target/i386/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d3411ed..4dd9a82 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2574,6 +2574,7 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000000A, .model_id = "AMD EPYC Processor", .cache_info = &epyc_cache_info, + .auto_topoext = 1, }, { .name = "EPYC-IBPB", @@ -2621,6 +2622,7 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000000A, .model_id = "AMD EPYC Processor (with IBPB)", .cache_info = &epyc_cache_info, + .auto_topoext = 1, }, }; @@ -4672,6 +4674,11 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000000A); } + /* TOPOEXT feature requires 0x8000001E */ + if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) { + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001E); + } + /* SEV requires CPUID[0x8000001F] */ if (sev_enabled()) { x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F); -- 1.8.3.1