[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ff715d6-c03c-4972-a92d-ff81c2bf61ba@zytor.com>
Date: Wed, 4 Jun 2025 15:35:20 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Khalid Ali <khaliidcaliy@...il.com>, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com
Cc: x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/kerrnel/FPU: clear MP bit of cr0
On 2025-05-26 01:22, Khalid Ali wrote:
> From: Khalid Ali <khaliidcaliy@...il.com>
>
> Clear MP bit when initializing x87 FPU, since what it does
> is making WAIT/FWAIT instructions to react to setting of TS flag.
> Right now TS bit is cleared so MP should be cleared, as it is not
> needed. This should set the bit in defined state.
Setting it to a defined value is probably good, but the bit should
definitely be SET, not clear.
If we end up relying on TS being set anywhere then we want WAIT/FWAIT to
match, and that is the meaning of the MP bit.
-hpa
>
> Signed-off-by: Khalid Ali <khaliidcaliy@...il.com>
> ---
> arch/x86/kernel/fpu/init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c
> index 998a08f17e33..2a2b45610b74 100644
> --- a/arch/x86/kernel/fpu/init.c
> +++ b/arch/x86/kernel/fpu/init.c
> @@ -30,7 +30,7 @@ static void fpu__init_cpu_generic(void)
> cr4_set_bits(cr4_mask);
>
> cr0 = read_cr0();
> - cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */
> + cr0 &= ~(X86_CR0_TS|X86_CR0_EM|X86_CR0_MP); /* clear TS, EM and MP*/
> if (!boot_cpu_has(X86_FEATURE_FPU))
> cr0 |= X86_CR0_EM;
> write_cr0(cr0);
Powered by blists - more mailing lists