Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
xen.8005
5afc13ae-3-x86-rename-bits-of-spec_ctrl-infrast...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5afc13ae-3-x86-rename-bits-of-spec_ctrl-infrastructure.patch of Package xen.8005
# Commit d9822b8a38114e96e4516dc998f4055249364d5d # Date 2018-05-16 12:19:10 +0100 # Author Andrew Cooper <andrew.cooper3@citrix.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> x86/spec_ctrl: Rename bits of infrastructure to avoid NATIVE and VMEXIT In hindsight, using NATIVE and VMEXIT as naming terminology was not clever. A future change wants to split SPEC_CTRL_EXIT_TO_GUEST into PV and HVM specific implementations, and using VMEXIT as a term is completely wrong. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/hvm/svm/entry.S +++ b/xen/arch/x86/hvm/svm/entry.S @@ -82,7 +82,7 @@ UNLIKELY_END(svm_trace) mov VCPU_arch_spec_ctrl(%rbx), %eax /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ - SPEC_CTRL_EXIT_TO_GUEST /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ + SPEC_CTRL_EXIT_TO_HVM /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ pop %r15 pop %r14 @@ -107,7 +107,7 @@ UNLIKELY_END(svm_trace) GET_CURRENT(%rbx) - SPEC_CTRL_ENTRY_FROM_VMEXIT /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */ + SPEC_CTRL_ENTRY_FROM_HVM /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */ /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */ mov VCPU_svm_vmcb(%rbx),%rcx --- a/xen/arch/x86/hvm/vmx/entry.S +++ b/xen/arch/x86/hvm/vmx/entry.S @@ -38,7 +38,7 @@ ENTRY(vmx_asm_vmexit_handler) movb $1,VCPU_vmx_launched(%rbx) mov %rax,VCPU_hvm_guest_cr2(%rbx) - SPEC_CTRL_ENTRY_FROM_VMEXIT /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */ + SPEC_CTRL_ENTRY_FROM_HVM /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */ /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */ mov %rsp,%rdi @@ -73,7 +73,7 @@ UNLIKELY_END(realmode) mov VCPU_arch_spec_ctrl(%rbx), %eax /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ - SPEC_CTRL_EXIT_TO_GUEST /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ + SPEC_CTRL_EXIT_TO_HVM /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ mov VCPU_hvm_guest_cr2(%rbx),%rax --- a/xen/arch/x86/spec_ctrl.c +++ b/xen/arch/x86/spec_ctrl.c @@ -31,8 +31,8 @@ enum ind_thunk { THUNK_RETPOLINE, }; static int8_t __initdata opt_ibrs = -1; -static bool_t __initdata opt_rsb_native = 1; -static bool_t __initdata opt_rsb_vmexit = 1; +static bool_t __initdata opt_rsb_pv = 1; +static bool_t __initdata opt_rsb_hvm = 1; bool_t __read_mostly opt_ibpb = 1; int8_t __read_mostly default_xen_spec_ctrl = -1; uint8_t __read_mostly default_xen_rsb = 0; @@ -52,9 +52,9 @@ static int __init parse_bti(const char * else if ( (val = parse_boolean("ibpb", s, ss)) >= 0 ) opt_ibpb = val; else if ( (val = parse_boolean("rsb_native", s, ss)) >= 0 ) - opt_rsb_native = val; + opt_rsb_pv = val; else if ( (val = parse_boolean("rsb_vmexit", s, ss)) >= 0 ) - opt_rsb_vmexit = val; + opt_rsb_hvm = val; else rc = -EINVAL; @@ -155,14 +155,14 @@ void __init init_speculation_mitigations * If a processors speculates to 32bit PV guest kernel mappings, it is * speculating in 64bit supervisor mode, and can leak data. */ - if ( opt_rsb_native ) + if ( opt_rsb_pv ) default_xen_rsb |= XEN_RSB_NATIVE; /* * HVM guests can always poison the RSB to point at Xen supervisor * mappings. */ - if ( opt_rsb_vmexit ) + if ( opt_rsb_hvm ) default_xen_rsb |= XEN_RSB_VMEXIT; /* Check we have hardware IBPB support before using it... */ --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -199,7 +199,7 @@ ENTRY(compat_restore_all_guest) mov VCPU_arch_spec_ctrl(%rbx), %eax /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ - SPEC_CTRL_EXIT_TO_GUEST /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ + SPEC_CTRL_EXIT_TO_PV /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ RESTORE_ALL adj=8 compat=1 .Lft0: iretq --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -72,7 +72,7 @@ restore_all_guest: mov %r15d, %eax /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ - SPEC_CTRL_EXIT_TO_GUEST /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ + SPEC_CTRL_EXIT_TO_PV /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ RESTORE_ALL testw $TRAP_syscall,4(%rsp) --- a/xen/include/asm-x86/spec_ctrl_asm.h +++ b/xen/include/asm-x86/spec_ctrl_asm.h @@ -68,11 +68,12 @@ * * The following ASM fragments implement this algorithm. See their local * comments for further details. - * - SPEC_CTRL_ENTRY_FROM_VMEXIT + * - SPEC_CTRL_ENTRY_FROM_HVM * - SPEC_CTRL_ENTRY_FROM_PV * - SPEC_CTRL_ENTRY_FROM_INTR * - SPEC_CTRL_EXIT_TO_XEN - * - SPEC_CTRL_EXIT_TO_GUEST + * - SPEC_CTRL_EXIT_TO_PV + * - SPEC_CTRL_EXIT_TO_HVM */ .macro DO_OVERWRITE_RSB mask:req maybexen=0 @@ -122,7 +123,7 @@ .Lrsb_done\@: .endm -.macro DO_SPEC_CTRL_ENTRY_FROM_VMEXIT +.macro DO_SPEC_CTRL_ENTRY_FROM_HVM /* * Requires %rbx=current, %rsp=regs/cpuinfo * Clobbers %rax, %rcx, %rdx @@ -240,9 +241,9 @@ .endm /* Use after a VMEXIT from an HVM guest. */ -#define SPEC_CTRL_ENTRY_FROM_VMEXIT \ +#define SPEC_CTRL_ENTRY_FROM_HVM \ DO_OVERWRITE_RSB XEN_RSB_VMEXIT; \ - DO_SPEC_CTRL_ENTRY_FROM_VMEXIT + DO_SPEC_CTRL_ENTRY_FROM_HVM /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */ #define SPEC_CTRL_ENTRY_FROM_PV \ @@ -258,8 +259,12 @@ #define SPEC_CTRL_EXIT_TO_XEN \ DO_SPEC_CTRL_EXIT_TO_XEN -/* Use when exiting to guest context. */ -#define SPEC_CTRL_EXIT_TO_GUEST \ +/* Use when exiting to PV guest context. */ +#define SPEC_CTRL_EXIT_TO_PV \ + DO_SPEC_CTRL_EXIT_TO_GUEST + +/* Use when exiting to HVM guest context. */ +#define SPEC_CTRL_EXIT_TO_HVM \ DO_SPEC_CTRL_EXIT_TO_GUEST #endif /* __ASSEMBLY__ */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor