Patch "virt/coco/sev-guest: Convert the sw_exit_info_2 checking to a switch-case" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    virt/coco/sev-guest: Convert the sw_exit_info_2 checking to a switch-case

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     virt-coco-sev-guest-convert-the-sw_exit_info_2-checking-to-a-switch-case.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From fa4ae42cc60a7dea30e8f2db444b808d80862345 Mon Sep 17 00:00:00 2001
From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>
Date: Thu, 16 Feb 2023 10:50:11 +0100
Subject: virt/coco/sev-guest: Convert the sw_exit_info_2 checking to a switch-case

From: Borislav Petkov (AMD) <bp@xxxxxxxxx>

commit fa4ae42cc60a7dea30e8f2db444b808d80862345 upstream.

snp_issue_guest_request() checks the value returned by the hypervisor in
sw_exit_info_2 and returns a different error depending on it.

Convert those checks into a switch-case to make it more readable when
more error values are going to be checked in the future.

No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
Link: https://lore.kernel.org/r/20230307192449.24732-8-bp@xxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/kernel/sev.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -2210,15 +2210,21 @@ int snp_issue_guest_request(u64 exit_cod
 		goto e_put;
 
 	*fw_err = ghcb->save.sw_exit_info_2;
-	if (ghcb->save.sw_exit_info_2) {
+	switch (*fw_err) {
+	case 0:
+		break;
+
+	case SNP_GUEST_REQ_INVALID_LEN:
 		/* Number of expected pages are returned in RBX */
-		if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST &&
-		    ghcb->save.sw_exit_info_2 == SNP_GUEST_REQ_INVALID_LEN) {
+		if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST) {
 			input->data_npages = ghcb_get_rbx(ghcb);
 			ret = -ENOSPC;
-		} else {
-			ret = -EIO;
+			break;
 		}
+		fallthrough;
+	default:
+		ret = -EIO;
+		break;
 	}
 
 e_put:


Patches currently in stable-queue which might be from bp@xxxxxxxxx are

queue-6.2/virt-coco-sev-guest-do-some-code-style-cleanups.patch
queue-6.2/virt-coco-sev-guest-add-throttling-awareness.patch
queue-6.2/virt-coco-sev-guest-simplify-extended-guest-request-handling.patch
queue-6.2/x86-mm-fix-use-of-uninitialized-buffer-in-sme_enable.patch
queue-6.2/ftrace-kcfi-define-ftrace_stub_graph-conditionally.patch
queue-6.2/x86-mce-make-sure-logged-mces-are-processed-after-sysfs-update.patch
queue-6.2/virt-coco-sev-guest-convert-the-sw_exit_info_2-checking-to-a-switch-case.patch
queue-6.2/virt-coco-sev-guest-remove-the-disable_vmpck-label-in-handle_guest_request.patch
queue-6.2/virt-coco-sev-guest-carve-out-the-request-issuing-logic-into-a-helper.patch
queue-6.2/virt-coco-sev-guest-check-sev_snp-attribute-at-probe-time.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux