Skip to content

Commit

Permalink
x86/xen: simplify sysenter and syscall setup
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jgross1 committed Nov 3, 2022
1 parent 354d8a4 commit 4bff677
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions arch/x86/xen/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,17 +910,9 @@ static int register_callback(unsigned type, const void *func)

void xen_enable_sysenter(void)
{
int ret;
unsigned sysenter_feature;

sysenter_feature = X86_FEATURE_SYSENTER32;

if (!boot_cpu_has(sysenter_feature))
return;

ret = register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat);
if(ret != 0)
setup_clear_cpu_cap(sysenter_feature);
if (cpu_feature_enabled(X86_FEATURE_SYSENTER32) &&
register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat))
setup_clear_cpu_cap(X86_FEATURE_SYSENTER32);
}

void xen_enable_syscall(void)
Expand All @@ -934,12 +926,9 @@ void xen_enable_syscall(void)
mechanism for syscalls. */
}

if (boot_cpu_has(X86_FEATURE_SYSCALL32)) {
ret = register_callback(CALLBACKTYPE_syscall32,
xen_entry_SYSCALL_compat);
if (ret != 0)
setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
}
if (cpu_feature_enabled(X86_FEATURE_SYSCALL32) &&
register_callback(CALLBACKTYPE_syscall32, xen_entry_SYSCALL_compat))
setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
}

static void __init xen_pvmmu_arch_setup(void)
Expand Down

0 comments on commit 4bff677

Please sign in to comment.