[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5654b3bc-15d4-443b-a7b1-2f9fd1d3e0aa@zytor.com>
Date: Tue, 22 Jul 2025 10:22:01 -0700
From: Xin Li <xin@...or.com>
To: "H. Peter Anvin" <hpa@...or.com>,
Wieczor-Retman Maciej <maciej.wieczor-retman@...el.com>
Cc: Gleixner Thomas <tglx@...utronix.de>, Molnar Ingo <mingo@...hat.com>,
Petkov Borislav <bp@...en8.de>,
Hansen Dave <dave.hansen@...ux.intel.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: Clear LAM and FRED feature bits
On 7/22/2025 9:46 AM, H. Peter Anvin wrote:
>> The following code will work as a generic fix:
>>
>> c->x86_capability[i] &= ~DISABLED_MASK(i);
>>
>> And DISABLED_MASK(x) needs to be defined like DISABLED_MASK_BIT_SET(x).
>>
>> Thanks!
>> Xin
> The easiest thing would be to initialize the setup disabled mask with the DISABLED bitmask instead of zero. This can be done statically; if it isn't already the awk script can produce the disabled bitmask in array form.
Yes, something like:
void __init init_cpu_cap(void)
{
for (i = 0; i < NCAPINTS; i++) {
cpu_caps_set[i] = REQUIRED_MASK(i);
cpu_caps_cleared[i] = DISABLED_MASK(i);
}
}
And it would be better if it could be done at build time (to avoid
changing Xen which has a dedicated startup code path):
__u32 cpu_caps_{set,cleared}[NCAPINTS + NBUGINTS] = {
{REQUIRED,DISABLED}_MASK(i),
};
And then apply_forced_caps() will do the rest automatically :)
Powered by blists - more mailing lists