Skip to contentSkip to conversation

accel/kvm: check for KVM_CAP_READONLY_MEM on VM

PATCH Applied Tom Dohrmann 2 participants 3 messages Sep 3, 2024 – Oct 11, 2024 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/kvm: check for KVM_CAP_READONLY_MEM on VM

KVM_CAP_READONLY_MEM used to be a global capability, but with the introduction of AMD SEV-SNP confidential VMs, this extension is not always available on all VM types [1,2].

Query the extension on the VM level instead of on the KVM level.

[1] https://patchwork.kernel.org/project/kvm/patch/[email protected]/
[2] https://patchwork.kernel.org/project/kvm/patch/[email protected]/

---
 accel/kvm/kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
accel/kvm/kvm-all.c +1 -1
index 75d11a07b2..acc23092e7 100644
@@ -2603,7 +2603,7 @@ static int kvm_init(MachineState *ms)
     }
 
     kvm_readonly_mem_allowed =
-        (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
+        (kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
 
     kvm_resamplefds_allowed =
         (kvm_check_extension(s, KVM_CAP_IRQFD_RESAMPLE) > 0);

--
2.34.1

#1 lore raw

Ping: [PATCH] accel/kvm: check for KVM_CAP_READONLY_MEM on VM

I haven't heard anything about this patch for a while.
https://patchew.org/QEMU/[email protected]/

From 5c1ad1ff44438402ec824a224ac4659c8044ec7e Mon Sep 17 00:00:00 2001
From: Tom Dohrmann <[email protected]>
Date: Tue, 3 Sep 2024 06:25:04 +0000
Subject: [PATCH] accel/kvm: check for KVM_CAP_READONLY_MEM on VM

KVM_CAP_READONLY_MEM used to be a global capability, but with the introduction of AMD SEV-SNP confidential VMs, this extension is not always available on all VM types [1,2].

Query the extension on the VM level instead of on the KVM level.

[1] https://patchwork.kernel.org/project/kvm/patch/[email protected]/
[2] https://patchwork.kernel.org/project/kvm/patch/[email protected]/

---
 accel/kvm/kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
accel/kvm/kvm-all.c +1 -1
index 75d11a07b2..acc23092e7 100644
@@ -2603,7 +2603,7 @@ static int kvm_init(MachineState *ms)
     }
 
     kvm_readonly_mem_allowed =
-        (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
+        (kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
 
     kvm_resamplefds_allowed =
         (kvm_check_extension(s, KVM_CAP_IRQFD_RESAMPLE) > 0);

--
2.34.1