git: 787e2e411d2a - main - amd64_cpu_init_fred(): set stack level for NMI and not #NM

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 27 Oct 2026 12:01:16 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=787e2e411d2a169fd28581f9bbf1e87c51757303

commit 787e2e411d2a169fd28581f9bbf1e87c51757303
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-27 08:54:43 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-27 11:58:48 +0000

    amd64_cpu_init_fred(): set stack level for NMI and not #NM
    
    Fixes:  6e93f5e4d693 ("amd64: FRED support")
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 sys/amd64/amd64/initcpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index 6ca89f2b36d4..5eac340505c2 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -451,14 +451,14 @@ amd64_cpu_init_fred(void)
 	/*
 	 * With FRED, there is no need for workarounds requiring
 	 * dedicated stack for #DB.  Also, there is no need to have
-	 * separate stacks for #NM and #MC, because CSL rules ensure
+	 * separate stacks for NMI and #MC, because CSL rules ensure
 	 * that interrupted frame is safe even if NMI was interrupted
 	 * by machine check or vice versa.
 	 *
 	 * Still, we need to provide a stack for events that can occur
 	 * with the interrupts disabled, to avoid caring about the
 	 * ordering of the context update in cpu_switch.S.  Use CSL 1
-	 * for #NM and #MC.
+	 * for NMI and #MC.
 	 *
 	 * Since double fault handler is used to handle stack
 	 * overflow, it gets the dedicated stack, of the highest used
@@ -467,7 +467,7 @@ amd64_cpu_init_fred(void)
 	 * CSL 3 is unused, and we have some space to re-arrange this
 	 * if a need in the future appears.
 	 */
-	wrmsr(MSR_FRED_STKLVLS, (1ul << (IDT_NM * 2)) |
+	wrmsr(MSR_FRED_STKLVLS, (1ul << (IDT_NMI * 2)) |
 	    (1ul << (IDT_MC * 2)) | (2ul << (IDT_DF * 2)));
 	wrmsr(MSR_FRED_RSP3, 0);
 	load_cr4(rcr4() | CR4_FRED);