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


Groups > linux.kernel > #1538847

Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support
Date 2016-12-08 21:10 +0100
Message-ID <sMdaV-254-15@gated-at.bofh.it> (permalink)
References <sM9K2-8la-5@gated-at.bofh.it> <sM9K2-8la-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 08, 2016 at 07:21:37PM +0300, Kirill A. Shutemov wrote:
> 5-level paging support is required from hardware when compiled with
> CONFIG_X86_5LEVEL=y. We may implement runtime switch support later.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

...

> diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
> index 6687ab953257..26e9a287805f 100644
> --- a/arch/x86/boot/cpuflags.c
> +++ b/arch/x86/boot/cpuflags.c
> @@ -80,6 +80,17 @@ static inline void cpuid(u32 id, u32 *a, u32 *b, u32 *c, u32 *d)
>  	);
>  }
>  
> +static inline void cpuid_count(u32 id, u32 count,
> +		u32 *a, u32 *b, u32 *c, u32 *d)
> +{
> +	asm volatile(".ifnc %%ebx,%3 ; movl  %%ebx,%3 ; .endif	\n\t"
> +		     "cpuid					\n\t"
> +		     ".ifnc %%ebx,%3 ; xchgl %%ebx,%3 ; .endif	\n\t"
> +		    : "=a" (*a), "=c" (*c), "=d" (*d), EBX_REG (*b)
> +		    : "a" (id), "c" (count)
> +	);
> +}

Pls make those like cpuid() and cpuid_count() in
arch/x86/include/asm/processor.h, which explicitly assign ecx and then
call the underlying helper.

The cpuid() in cpuflags.c doesn't zero ecx which, if we have to be
pedantic, it should do. It calls CPUID now with the ptr value of its 4th
on 64-bit and 3rd arg on 32-bit, respectively, IINM.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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


Thread

[RFC, PATCHv1 15/28] x86: detect 5-level paging support "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-12-08 17:30 +0100
  Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support Borislav Petkov <bp@alien8.de> - 2016-12-08 21:10 +0100
    Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-08 21:10 +0100
      Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support Borislav Petkov <bp@alien8.de> - 2016-12-08 21:30 +0100
    Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-12-09 16:40 +0100
      Re: [RFC, PATCHv1 15/28] x86: detect 5-level paging support Borislav Petkov <bp@alien8.de> - 2016-12-09 17:40 +0100

csiph-web