Skip to content

Commit 164a9f7

Browse files
Jason AndryukIngo Molnar
authored andcommitted
x86/xen: Fix __xen_hypercall_setfunc()
Hypercall detection is failing with xen_hypercall_intel() chosen even on an AMD processor. Looking at the disassembly, the call to xen_get_vendor() was removed. The check for boot_cpu_has(X86_FEATURE_CPUID) was used as a proxy for the x86_vendor having been set. When CONFIG_X86_REQUIRED_FEATURE_CPUID=y (the default value), DCE eliminates the call to xen_get_vendor(). An uninitialized value 0 means X86_VENDOR_INTEL, so the Intel function is always returned. Remove the if and always call xen_get_vendor() to avoid this issue. Fixes: 3d37d93 ("x86/cpufeatures: Add {REQUIRED,DISABLED} feature configs") Suggested-by: Juergen Gross <[email protected]> Signed-off-by: Jason Andryuk <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: "Xin Li (Intel)" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0c7cae1 commit 164a9f7

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

arch/x86/xen/enlighten.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ noinstr void *__xen_hypercall_setfunc(void)
103103
void (*func)(void);
104104

105105
/*
106-
* Xen is supported only on CPUs with CPUID, so testing for
107-
* X86_FEATURE_CPUID is a test for early_cpu_init() having been
108-
* run.
109-
*
110106
* Note that __xen_hypercall_setfunc() is noinstr only due to a nasty
111107
* dependency chain: it is being called via the xen_hypercall static
112108
* call when running as a PVH or HVM guest. Hypercalls need to be
@@ -118,8 +114,7 @@ noinstr void *__xen_hypercall_setfunc(void)
118114
*/
119115
instrumentation_begin();
120116

121-
if (!boot_cpu_has(X86_FEATURE_CPUID))
122-
xen_get_vendor();
117+
xen_get_vendor();
123118

124119
if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
125120
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON))

0 commit comments

Comments
 (0)