Re: [PATCH] x86, fpu: rename XCR0 access macro
From: Borislav Petkov
Date: Sat Apr 25 2015 - 04:24:55 EST
On Fri, Apr 24, 2015 at 04:00:35PM -0700, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
> Cc: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
>
> ---
>
> 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.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/