From 0bb00314aafe385ea6b6a8dbbb32d39d35842319 Mon Sep 17 00:00:00 2001 From: hanliyang Date: Sat, 19 Apr 2025 16:48:11 +0800 Subject: [PATCH] anolis: KVM: SVM: CSV: Return 0 at the beginning of csv_guest_hygon_coco_extension() for non-CSV3 VMs ANBZ: #20680 The commit a311941e4e34 ("anolis: KVM: SVM: CSV: Provide KVM_CAP_HYGON_COCO_EXT interface") provides a helper function csv_guest_hygon_coco_extension() to express that the available Hygon Confidential-Computing extensions can be used by the current VM. Obviously, a Non-Confidential-Computing VM will not be able to use these extensions, so return 0 at the beginning of csv_guest_hygon_coco_extension() for Non-CSV3 VMs. Fixes: a311941e4e34 ("anolis: KVM: SVM: CSV: Provide KVM_CAP_HYGON_COCO_EXT interface") Signed-off-by: hanliyang --- arch/x86/kvm/svm/csv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/csv.c b/arch/x86/kvm/svm/csv.c index 147a43e38254..55e3c751c6a3 100644 --- a/arch/x86/kvm/svm/csv.c +++ b/arch/x86/kvm/svm/csv.c @@ -2950,7 +2950,7 @@ static int csv_get_hygon_coco_extension(struct kvm *kvm) size_t len = sizeof(uint32_t); int ret = 0; - if (!kvm) + if (!kvm || !csv3_guest(kvm)) return 0; csv = &to_kvm_svm_csv(kvm)->csv_info; -- Gitee