[MODERATED] Re: [PATCH v5 02/11] TAAv5 2

Borislav Petkov <[email protected]>
Newsgroups org.kernel.lore.historical-speck
Message-ID <[email protected]>
On Fri, Oct 04, 2019 at 11:27:31PM -0700, speck for Pawan Gupta wrote:
> Move IA32_ARCH_CAPABILITIES MSR read to a helper function. If the CPU
> doesn't support this MSR return 0. Use this function in following
> commits to read IA32_ARCH_CAPABILITIES MSR.
> 
> Signed-off-by: Pawan Gupta <[email protected]>
> Reviewed-by: Mark Gross <[email protected]>
> Reviewed-by: Tony Luck <[email protected]>
> Tested-by: Neelima Krishnan <[email protected]>
> ---
>  arch/x86/kernel/cpu/common.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index f125bf7ecb6f..af9e357b2ca9 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1091,19 +1091,27 @@ static bool __init cpu_matches(unsigned long which)
>  	return m && !!(m->driver_data & which);
>  }
>  
> -static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
> +u64 read_ia32_arch_cap(void)

If this is going to be used by other compilation units, call it
something more presentable and clear, with a proper prefix:

	x86_read_arch_cap_msr()

or so.

>  {
>  	u64 ia32_cap = 0;
>  
> +	/* Leave the MSR set to all 0's when not supported */

This comment is not really needed.

> +	if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES))
> +		rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap);
> +
> +	return ia32_cap;
> +}
> +
> +static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
		^^^^^^

Please audit your newly added functions whether they can be __init
too.

Thx.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 247165, AG München
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.