lkml.org 
[lkml]   [2023]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 5/7] x86/cpu: Enable LASS (Linear Address Space Separation)
From
> +static __always_inline void setup_lass(struct cpuinfo_x86 *c)
> +{
> + if (cpu_feature_enabled(X86_FEATURE_LASS)) {
> + cr4_set_bits(X86_CR4_LASS);
> + } else {
> + /*
> + * only clear the feature and cr4 bits when hardware
> + * supports LASS, in case it was enabled in a previous
> + * boot (e.g., via kexec)
> + */
> + if (cpu_has(c, X86_FEATURE_LASS)) {
> + cr4_clear_bits(X86_CR4_LASS);
> + clear_cpu_cap(c, X86_FEATURE_LASS);
> + }
> + }
> +}

I am quite confused by the "else" code flow. Can you please help
understand how this code path would be exercised?

Also, why don't other features such as SMAP or SMEP need this type of
handling? I see something on similar lines for UMIP.

Also, how does the CR4 pinning code in the following patch play into
this? Could it flag a warning when cr4_clear_bits() is called above?

> +
> /* These bits should not change their value after CPU init is finished. */
> static const unsigned long cr4_pinned_mask =
> X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP |
> @@ -1848,6 +1865,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)
> setup_smep(c);
> setup_smap(c);
> setup_umip(c);
> + setup_lass(c);
>

\
 
 \ /
  Last update: 2023-03-26 23:36    [W:0.199 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site