[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xen,x86: introduce tcg_errata
The TCG emulator in QEMU is not good enough to pass the the tests in stub_selftest. Detect if Xen is running on TCG early, then drop the tests if it is the case. Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 4306e59..4229b30 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -621,6 +621,18 @@ void detect_ht(struct cpuinfo_x86 *c) } } +bool tcg_errata = false; +void __init detect_tcg_errata(void) +{ + uint32_t base, eax, signature[3]; + char *sig = "TCGTCGTCGTCG"; + + base = 0x40000000; + cpuid(base, &eax, &signature[0], &signature[1], &signature[2]); + if ( !memcmp(sig, signature, 12) ) + tcg_errata = true; +} + unsigned int __init apicid_to_socket(unsigned int apicid) { unsigned int dummy; diff --git a/xen/arch/x86/extable.c b/xen/arch/x86/extable.c index 72f30d9..6255f72 100644 --- a/xen/arch/x86/extable.c +++ b/xen/arch/x86/extable.c @@ -146,6 +146,9 @@ static int __init stub_selftest(void) unsigned long addr = this_cpu(stubs.addr) + STUB_BUF_SIZE / 2; unsigned int i; + if ( tcg_errata ) + return 0; + printk("Running stub recovery selftests...\n"); for ( i = 0; i < ARRAY_SIZE(tests); ++i ) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 9407247..e33b76a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1521,6 +1521,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) early_microcode_init(); identify_cpu(&boot_cpu_data); + detect_tcg_errata(); set_in_cr4(X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT); diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index e8c2f02..96b6125 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -169,6 +169,9 @@ extern void detect_extended_topology(struct cpuinfo_x86 *c); extern void detect_ht(struct cpuinfo_x86 *c); +extern bool tcg_errata; +extern void detect_tcg_errata(void); + #define cpu_to_core(_cpu) (cpu_data[_cpu].cpu_core_id) #define cpu_to_socket(_cpu) (cpu_data[_cpu].phys_proc_id) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |