Skip to content

Commit

Permalink
accel/kvm: check for KVM_CAP_READONLY_MEM on VM
Browse files Browse the repository at this point in the history
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]/

Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Tom Dohrmann <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Pankaj Gupta <[email protected]>
  • Loading branch information
Freax13 authored and dfaggioli committed Oct 15, 2024
1 parent 363f722 commit 036b767
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion accel/kvm/kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 036b767

Please sign in to comment.