public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()
@ 2022-03-17 21:19 Peter Gonda
  2022-03-18  8:51 ` Joerg Roedel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Gonda @ 2022-03-17 21:19 UTC (permalink / raw)
  To: x86
  Cc: Peter Gonda, Borislav Petkov, Tom Lendacky, Brijesh Singh,
	Joerg Roedel, kvm, linux-kernel

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.


Cc: Borislav Petkov <bp@alien8.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: x86@kernel.org
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Peter Gonda <pgonda@google.com>
---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index e6d316a01fdd..ae87fbf27724 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -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);
 }
-- 
2.35.1.894.gb6a874cedc-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()
  2022-03-17 21:19 [PATCH] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate() Peter Gonda
@ 2022-03-18  8:51 ` Joerg Roedel
  2022-04-05 19:27 ` [tip: x86/sev] " tip-bot2 for Peter Gonda
  2022-04-08  9:08 ` tip-bot2 for Peter Gonda
  2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2022-03-18  8:51 UTC (permalink / raw)
  To: Peter Gonda
  Cc: x86, Borislav Petkov, Tom Lendacky, Brijesh Singh, kvm,
	linux-kernel

On Thu, Mar 17, 2022 at 02:19:13PM -0700, Peter Gonda wrote:
> 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.
> 
> 
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Joerg Roedel <jroedel@suse.de>
> Cc: x86@kernel.org
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Peter Gonda <pgonda@google.com>
> ---
>  arch/x86/kernel/sev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
> index e6d316a01fdd..ae87fbf27724 100644
> --- a/arch/x86/kernel/sev.c
> +++ b/arch/x86/kernel/sev.c
> @@ -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);

Reviewed-by: Joerg Roedel <jroedel@suse.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: x86/sev] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()
  2022-03-17 21:19 [PATCH] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate() Peter Gonda
  2022-03-18  8:51 ` Joerg Roedel
@ 2022-04-05 19:27 ` tip-bot2 for Peter Gonda
  2022-04-08  9:08 ` tip-bot2 for Peter Gonda
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Peter Gonda @ 2022-04-05 19:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Peter Gonda, Borislav Petkov, Joerg Roedel, x86, linux-kernel

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 <pgonda@google.com>
AuthorDate:    Thu, 17 Mar 2022 14:19:13 -07:00
Committer:     Borislav Petkov <bp@suse.de>
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.

Signed-off-by: Peter Gonda <pgonda@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20220317211913.1397427-1-pgonda@google.com
---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index e6d316a..ae87fbf 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -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);
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip: x86/sev] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate()
  2022-03-17 21:19 [PATCH] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate() Peter Gonda
  2022-03-18  8:51 ` Joerg Roedel
  2022-04-05 19:27 ` [tip: x86/sev] " tip-bot2 for Peter Gonda
@ 2022-04-08  9:08 ` tip-bot2 for Peter Gonda
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Peter Gonda @ 2022-04-08  9:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Peter Gonda, Borislav Petkov, Joerg Roedel, x86, linux-kernel

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 <pgonda@google.com>
AuthorDate:    Thu, 17 Mar 2022 14:19:13 -07:00
Committer:     Borislav Petkov <bp@suse.de>
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. ]

Signed-off-by: Peter Gonda <pgonda@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20220317211913.1397427-1-pgonda@google.com
---
 arch/x86/kernel/sev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index ace43e1..f01f455 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -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);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-08  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-17 21:19 [PATCH] x86/sev-es: Replace open-coded hlt-loop with sev_es_terminate() Peter Gonda
2022-03-18  8:51 ` Joerg Roedel
2022-04-05 19:27 ` [tip: x86/sev] " tip-bot2 for Peter Gonda
2022-04-08  9:08 ` tip-bot2 for Peter Gonda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox