From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758663AbbDYIYd (ORCPT ); Sat, 25 Apr 2015 04:24:33 -0400 Received: from mail.skyhub.de ([78.46.96.112]:57252 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755210AbbDYIY1 (ORCPT ); Sat, 25 Apr 2015 04:24:27 -0400 Date: Sat, 25 Apr 2015 10:24:13 +0200 From: Borislav Petkov To: Dave Hansen Cc: linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com, x86@kernel.org, fenghua.yu@intel.com, oleg@redhat.com, luto@amacapital.net Subject: Re: [PATCH] x86, fpu: rename XCR0 access macro Message-ID: <20150425082413.GC32099@pd.tnic> References: <20150424230035.F66CA4BB@viggo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150424230035.F66CA4BB@viggo.jf.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 24, 2015 at 04:00:35PM -0700, Dave Hansen wrote: > > From: Dave Hansen > > 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 > Cc: x86@kernel.org > Cc: Fenghua Yu > Cc: Borislav Petkov > Cc: Oleg Nesterov > Cc: Andy Lutomirski > > --- > > 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. --