Messages in this thread | | | Date | Sat, 25 Apr 2015 10:24:13 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH] x86, fpu: rename XCR0 access macro |
| |
On Fri, Apr 24, 2015 at 04:00:35PM -0700, Dave Hansen wrote: > > From: Dave Hansen <dave.hansen@linux.intel.com> > > The SDM says that the xgetbv instruction: > > Reads the contents of the extended control register (XCR) > specified in the ECX register into registers EDX:EAX. > > In other words, xgetbv(0) gets the thing that the SDM calls XCR0. > We have a macro for that "0" and we call it > XCR_XFEATURE_ENABLED_MASK. That's a bit unfortunate because it > is not a mask nor does the "0" have much to do with the features > we have enabled. It's an index if anything. > > Rename the macro to what it means: "XCR0". > > Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> > Cc: x86@kernel.org > Cc: Fenghua Yu <fenghua.yu@intel.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: Oleg Nesterov <oleg@redhat.com> > Cc: Andy Lutomirski <luto@amacapital.net> > > --- > > b/arch/x86/crypto/camellia_aesni_avx2_glue.c | 2 +- > b/arch/x86/crypto/camellia_aesni_avx_glue.c | 2 +- > b/arch/x86/crypto/cast5_avx_glue.c | 2 +- > b/arch/x86/crypto/cast6_avx_glue.c | 2 +- > b/arch/x86/crypto/serpent_avx2_glue.c | 2 +- > b/arch/x86/crypto/serpent_avx_glue.c | 2 +- > b/arch/x86/crypto/sha1_ssse3_glue.c | 2 +- > b/arch/x86/crypto/sha256_ssse3_glue.c | 2 +- > b/arch/x86/crypto/sha512_ssse3_glue.c | 2 +- > b/arch/x86/crypto/twofish_avx_glue.c | 2 +- > b/arch/x86/include/asm/xcr.h | 6 +++++- > b/arch/x86/kernel/xsave.c | 2 +- > b/arch/x86/kvm/x86.c | 16 ++++++++-------- > b/arch/x86/power/cpu.c | 2 +- > 14 files changed, 25 insertions(+), 21 deletions(-)
Applied, but...
> diff -puN arch/x86/include/asm/xcr.h~x86-fpu-rename-xcr0-macro arch/x86/include/asm/xcr.h > --- a/arch/x86/include/asm/xcr.h~x86-fpu-rename-xcr0-macro 2015-04-24 15:55:10.456089437 -0700 > +++ b/arch/x86/include/asm/xcr.h 2015-04-24 15:55:10.483090655 -0700 > @@ -17,13 +17,17 @@ > #ifndef _ASM_X86_XCR_H > #define _ASM_X86_XCR_H > > -#define XCR_XFEATURE_ENABLED_MASK 0x00000000 > +#define XCR0 0x00000000
... changed that to a simple "0".
Btw, I can imagine this becoming a macro, i.e. XCR(num) later. I see there already is the %ecx==1 call option of XGETBV which gives you the optimization used by XSAVEOPT/XSAVES so it is all a matter of time. :)
Thanks.
-- Regards/Gruss, Boris.
ECO tip #101: Trim your mails when you reply. --
| |