x86/boot: Cache cpu_has_hypervisor very early on boot

We cache Long Mode and No Execute early on boot, so take the opportunity to
cache HYPERVISOR early as well.

Replace opencoded early access to the feature bit.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Andrew Cooper committed 2019-11-21 15:49:54 +00:00
1 parent 9678167db9
commit a7b88f0545
5 files changed
+11 -10

No files matched your search

+1 -1
View File
@@ -1156,7 +1156,7 @@ static void __init check_deadline_errata(void)
const struct x86_cpu_id *m;
unsigned int rev;
if ( boot_cpu_has(X86_FEATURE_HYPERVISOR) )
if ( cpu_has_hypervisor )
return;
m = x86_match_cpu(deadline_match);
+4
View File
@@ -630,6 +630,10 @@ trampoline_setup:
1:
/* Interrogate CPU extended features via CPUID. */
mov $1, %eax
cpuid
mov %ecx, sym_fs(boot_cpu_data) + CPUINFO_FEATURE_OFFSET(X86_FEATURE_HYPERVISOR)
mov $0x80000000,%eax
cpuid
shld $16,%eax,%ecx
+4 -2
View File
@@ -637,11 +637,13 @@ static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,
static void __init efi_arch_cpu(void)
{
uint32_t eax = cpuid_eax(0x80000000);
uint32_t *caps = boot_cpu_data.x86_capability;
caps[cpufeat_word(X86_FEATURE_HYPERVISOR)] = cpuid_ecx(1);
if ( (eax >> 16) == 0x8000 && eax > 0x80000000 )
{
boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_SYSCALL)]
= cpuid_edx(0x80000001);
caps[cpufeat_word(X86_FEATURE_SYSCALL)] = cpuid_edx(0x80000001);
if ( cpu_has_nx )
trampoline_efer |= EFER_NX;
+1 -5
View File
@@ -69,11 +69,7 @@ static void __init find_xen_leaves(void)
void __init probe_hypervisor(void)
{
if ( xen_guest )
return;
/* Too early to use cpu_has_hypervisor */
if ( !(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) )
if ( xen_guest || !cpu_has_hypervisor )
return;
find_xen_leaves();
+1 -2
View File
@@ -6112,8 +6112,7 @@ const struct platform_bad_page *__init get_platform_badpages(unsigned int *array
case 0x000506e0: /* errata SKL167 / SKW159 */
case 0x000806e0: /* erratum KBL??? */
case 0x000906e0: /* errata KBL??? / KBW114 / CFW103 */
*array_size = (cpuid_eax(0) >= 7 &&
!(cpuid_ecx(1) & cpufeat_mask(X86_FEATURE_HYPERVISOR)) &&
*array_size = (cpuid_eax(0) >= 7 && !cpu_has_hypervisor &&
(cpuid_count_ebx(7, 0) & cpufeat_mask(X86_FEATURE_HLE)));
return &hle_bad_page;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.