[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/xstate: Rename _xstate_ctxt_size() to hw_uncompressed_size()
commit 8cccd6438e86112ab383e41b433b5a7e73be9621 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Apr 30 20:17:55 2021 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue May 4 19:14:23 2021 +0100 x86/xstate: Rename _xstate_ctxt_size() to hw_uncompressed_size() The latter is a more descriptive name, as it explicitly highlights the query from hardware. Simplify the internal logic using cpuid_count_ebx(), and drop the curr/max assertion as this property is guaranteed by the x86 ISA. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/xstate.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index 65c720a26a..6aaf9a2f15 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -554,19 +554,18 @@ void xstate_free_save_area(struct vcpu *v) v->arch.xsave_area = NULL; } -static unsigned int _xstate_ctxt_size(u64 xcr0) +static unsigned int hw_uncompressed_size(uint64_t xcr0) { u64 act_xcr0 = get_xcr0(); - u32 eax, ebx = 0, ecx, edx; + unsigned int size; bool ok = set_xcr0(xcr0); ASSERT(ok); - cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx); - ASSERT(ebx <= ecx); + size = cpuid_count_ebx(XSTATE_CPUID, 0); ok = set_xcr0(act_xcr0); ASSERT(ok); - return ebx; + return size; } /* Fastpath for common xstate size requests, avoiding reloads of xcr0. */ @@ -578,7 +577,7 @@ unsigned int xstate_ctxt_size(u64 xcr0) if ( xcr0 == 0 ) return 0; - return _xstate_ctxt_size(xcr0); + return hw_uncompressed_size(xcr0); } static bool valid_xcr0(uint64_t xcr0) @@ -662,14 +661,14 @@ void xstate_init(struct cpuinfo_x86 *c) * xsave_cntxt_size is the max size required by enabled features. * We know FP/SSE and YMM about eax, and nothing about edx at present. */ - xsave_cntxt_size = _xstate_ctxt_size(feature_mask); + xsave_cntxt_size = hw_uncompressed_size(feature_mask); printk("xstate: size: %#x and states: %#"PRIx64"\n", xsave_cntxt_size, xfeature_mask); } else { BUG_ON(xfeature_mask != feature_mask); - BUG_ON(xsave_cntxt_size != _xstate_ctxt_size(feature_mask)); + BUG_ON(xsave_cntxt_size != hw_uncompressed_size(feature_mask)); } if ( setup_xstate_features(bsp) && bsp ) -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |