Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1684785

Re: [PATCH v9 04/38] x86/CPU/AMD: Add the Secure Memory Encryption CPU feature

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [PATCH v9 04/38] x86/CPU/AMD: Add the Secure Memory Encryption CPU feature
Date 2017-07-11 08:00 +0200
Message-ID <u1Wnf-6Mo-1@gated-at.bofh.it> (permalink)
References <u0UdP-oM-3@gated-at.bofh.it> <u0Xv4-2jl-23@gated-at.bofh.it> <u0Xv4-2jl-21@gated-at.bofh.it> <u1VAS-6uO-9@gated-at.bofh.it> <u1VAS-6uO-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 11, 2017 at 01:07:46AM -0400, Brian Gerst wrote:
> > If I make the scattered feature support conditional on CONFIG_X86_64
> > (based on comment below) then cpu_has() will always be false unless
> > CONFIG_X86_64 is enabled. So this won't need to be wrapped by the
> > #ifdef.
> 
> If you change it to use cpu_feature_enabled(), gcc will see that it is
> disabled and eliminate the dead code at compile time.

Just do this:

       if (cpu_has(c, X86_FEATURE_SME)) {
	       if (IS_ENABLED(CONFIG_X86_32)) {
                       clear_cpu_cap(c, X86_FEATURE_SME);
	       } else {
		       u64 msr;

		       /* Check if SME is enabled */
	              rdmsrl(MSR_K8_SYSCFG, msr);
	              if (!(msr & MSR_K8_SYSCFG_MEM_ENCRYPT))
	                      clear_cpu_cap(c, X86_FEATURE_SME);
	       }
       }

so that it is explicit that we disable it on 32-bit and we can save us
the ifdeffery elsewhere.

Thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v9 04/38] x86/CPU/AMD: Add the Secure Memory Encryption  CPU feature Brian Gerst <brgerst@gmail.com> - 2017-07-08 15:00 +0200
  Re: [PATCH v9 04/38] x86/CPU/AMD: Add the Secure Memory Encryption  CPU feature Brian Gerst <brgerst@gmail.com> - 2017-07-11 07:10 +0200
    Re: [PATCH v9 04/38] x86/CPU/AMD: Add the Secure Memory Encryption  CPU feature Borislav Petkov <bp@alien8.de> - 2017-07-11 08:00 +0200

csiph-web