[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.15] x86/tsx: Move has_rtm_always_abort to an outer scope
commit 8ae80402a20e6469f6497367b313f1f3a3f4d1b6 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Jun 23 21:53:58 2021 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue Feb 8 18:04:52 2022 +0000 x86/tsx: Move has_rtm_always_abort to an outer scope We are about to introduce a second path which needs to conditionally force the presence of RTM_ALWAYS_ABORT. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> (cherry picked from commit 4116139131e93b4f075e5442e3c1b424280f6f1f) --- xen/arch/x86/tsx.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/tsx.c b/xen/arch/x86/tsx.c index 88adf08c49..c3b8a7ec00 100644 --- a/xen/arch/x86/tsx.c +++ b/xen/arch/x86/tsx.c @@ -42,6 +42,7 @@ void tsx_init(void) if ( unlikely(cpu_has_tsx_ctrl < 0) ) { uint64_t caps = 0; + bool has_rtm_always_abort; if ( boot_cpu_data.cpuid_level >= 7 ) boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_ARCH_CAPS)] @@ -51,6 +52,7 @@ void tsx_init(void) rdmsrl(MSR_ARCH_CAPABILITIES, caps); cpu_has_tsx_ctrl = !!(caps & ARCH_CAPS_TSX_CTRL); + has_rtm_always_abort = cpu_has_rtm_always_abort; if ( cpu_has_tsx_force_abort ) { @@ -67,11 +69,7 @@ void tsx_init(void) * RTM_ALWAYS_ABORT enumerates the new functionality, but is also * read as zero if TSX_FORCE_ABORT.ENABLE_RTM has been set before * we run. - * - * Undo this behaviour in Xen's view of the world. */ - bool has_rtm_always_abort = cpu_has_rtm_always_abort; - if ( !has_rtm_always_abort ) { uint64_t val; @@ -82,15 +80,6 @@ void tsx_init(void) has_rtm_always_abort = true; } - /* - * Always force RTM_ALWAYS_ABORT, even if it currently visible. - * If the user explicitly opts to enable TSX, we'll set - * TSX_FORCE_ABORT.ENABLE_RTM and cause RTM_ALWAYS_ABORT to be - * hidden from the general CPUID scan later. - */ - if ( has_rtm_always_abort ) - setup_force_cpu_cap(X86_FEATURE_RTM_ALWAYS_ABORT); - /* * If no explicit tsx= option is provided, pick a default. * @@ -108,9 +97,18 @@ void tsx_init(void) * With RTM_ALWAYS_ABORT, disable TSX. */ if ( opt_tsx < 0 ) - opt_tsx = !cpu_has_rtm_always_abort; + opt_tsx = !has_rtm_always_abort; } + /* + * Always force RTM_ALWAYS_ABORT, even if it currently visible. If + * the user explicitly opts to enable TSX, we'll set the appropriate + * RTM_ENABLE bit and cause RTM_ALWAYS_ABORT to be hidden from the + * general CPUID scan later. + */ + if ( has_rtm_always_abort ) + setup_force_cpu_cap(X86_FEATURE_RTM_ALWAYS_ABORT); + /* * The TSX features (HLE/RTM) are handled specially. They both * enumerate features but, on certain parts, have mechanisms to be -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.15
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |