Skip to content

Commit 4bff677

Browse files
committed
x86/xen: simplify sysenter and syscall setup
xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot. While at it, switch to use cpu_feature_enabled() instead of boot_cpu_has(). Signed-off-by: Juergen Gross <[email protected]>
1 parent 354d8a4 commit 4bff677

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

arch/x86/xen/setup.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -910,17 +910,9 @@ static int register_callback(unsigned type, const void *func)
910910

911911
void xen_enable_sysenter(void)
912912
{
913-
int ret;
914-
unsigned sysenter_feature;
915-
916-
sysenter_feature = X86_FEATURE_SYSENTER32;
917-
918-
if (!boot_cpu_has(sysenter_feature))
919-
return;
920-
921-
ret = register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat);
922-
if(ret != 0)
923-
setup_clear_cpu_cap(sysenter_feature);
913+
if (cpu_feature_enabled(X86_FEATURE_SYSENTER32) &&
914+
register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat))
915+
setup_clear_cpu_cap(X86_FEATURE_SYSENTER32);
924916
}
925917

926918
void xen_enable_syscall(void)
@@ -934,12 +926,9 @@ void xen_enable_syscall(void)
934926
mechanism for syscalls. */
935927
}
936928

937-
if (boot_cpu_has(X86_FEATURE_SYSCALL32)) {
938-
ret = register_callback(CALLBACKTYPE_syscall32,
939-
xen_entry_SYSCALL_compat);
940-
if (ret != 0)
941-
setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
942-
}
929+
if (cpu_feature_enabled(X86_FEATURE_SYSCALL32) &&
930+
register_callback(CALLBACKTYPE_syscall32, xen_entry_SYSCALL_compat))
931+
setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
943932
}
944933

945934
static void __init xen_pvmmu_arch_setup(void)

0 commit comments

Comments
 (0)