Skip to contentSkip to conversation

x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()

PATCH Applied Peter Gonda 3 participants 4 messages Mar 17, 2022 – Apr 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()

Replace the hlt loop in handle_vc_boot_ghcb() with an sev_es_terminate(). The hlt gives the system no indication the guest is unhappy. The termination request will signal there was an error during VC handling during boot.

---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/sev.c +1 -2
index e6d316a01fdd..ae87fbf27724 100644
@@ -1425,6 +1425,5 @@ bool __init handle_vc_boot_ghcb(struct pt_regs *regs)
 fail:
 	show_regs(regs);
 
-	while (true)
-		halt();
+	sev_es_terminate(GHCB_SEV_ES_GEN_REQ);
 }
Signature · 1 line
2.35.1.894.gb6a874cedc-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Peter Gonda

Replace the hlt loop in handle_vc_boot_ghcb() with an sev_es_terminate(). The hlt gives the system no indication the guest is unhappy. The termination request will signal there was an error during VC handling during boot.

---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/sev.c +0 -0
index e6d316a01fdd..ae87fbf27724 100644

arch/x86/kernel/sev.c bool __init handle_vc_boot_ghcb(struct pt_regs *regs) · line 1428

Quoted 6 lines
arch/x86/kernel/sev.c +1 -2
@@ -1425,6 +1425,5 @@ bool __init handle_vc_boot_ghcb(struct pt_regs *regs)
 fail:
 	show_regs(regs);
 
-	while (true)
-		halt();
+	sev_es_terminate(GHCB_SEV_ES_GEN_REQ);
merge bot Applied
#2 lore raw
In reply to Peter Gonda
The following commit has been merged into the x86/sev branch of tip:

The following commit has been merged into the x86/sev branch of tip:

Commit-ID:     453e580abcdb53f688d5711c68bec96bea35430d
Gitweb:        https://git.kernel.org/tip/453e580abcdb53f688d5711c68bec96bea35430d
Author:        Peter Gonda <[email protected]>
AuthorDate:    Thu, 17 Mar 2022 14:19:13 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 05 Apr 2022 19:33:55 +02:00

x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()

Replace the halt loop in handle_vc_boot_ghcb() with an sev_es_terminate(). The HLT gives the system no indication the guest is unhappy. The termination request will signal there was an error during VC handling during boot.

---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/sev.c +1 -2
index e6d316a..ae87fbf 100644
@@ -1425,6 +1425,5 @@ bool __init handle_vc_boot_ghcb(struct pt_regs *regs)
 fail:
 	show_regs(regs);
 
-	while (true)
-		halt();
+	sev_es_terminate(GHCB_SEV_ES_GEN_REQ);
 }
merge bot Applied
#3 lore raw
In reply to Peter Gonda
The following commit has been merged into the x86/sev branch of tip:

The following commit has been merged into the x86/sev branch of tip:

Commit-ID:     e720ea52e85c9d00cf8c5769795d0a3e585524f6
Gitweb:        https://git.kernel.org/tip/e720ea52e85c9d00cf8c5769795d0a3e585524f6
Author:        Peter Gonda <[email protected]>
AuthorDate:    Thu, 17 Mar 2022 14:19:13 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Fri, 08 Apr 2022 10:57:35 +02:00

x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()

Replace the halt loop in handle_vc_boot_ghcb() with an sev_es_terminate(). The HLT gives the system no indication the guest is unhappy. The termination request will signal there was an error during VC handling during boot.

[ bp: Update it to pass the reason set too. ]

---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/sev.c +1 -2
index ace43e1..f01f455 100644
@@ -1982,8 +1982,7 @@ bool __init handle_vc_boot_ghcb(struct pt_regs *regs)
 fail:
 	show_regs(regs);
 
-	while (true)
-		halt();
+	sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SEV_ES_GEN_REQ);
 }
 
 /*