Message ID | 1c93f5dabe2ef573302ff362c0c6c525bbe8af43.1613188118.git.isaku.yamahata@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | TDX support | expand |
Hi Isaku, On 2/16/21 3:12 AM, Isaku Yamahata wrote: > Switch to making a VM ioctl() call for KVM_CAP_READONLY_MEM, which may > be conditional on VM type in recent versions of KVM, e.g. when TDX is > supported. > > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> > --- > accel/kvm/kvm-all.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c > index 47516913b7..351c25a5cb 100644 > --- a/accel/kvm/kvm-all.c > +++ b/accel/kvm/kvm-all.c > @@ -2164,7 +2164,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); Can this check with "recent KVM" be a problem with older ones? Maybe for backward compatibility we need: = (kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0) || (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0); > kvm_eventfds_allowed = > (kvm_check_extension(s, KVM_CAP_IOEVENTFD) > 0); >
On Tue, Feb 16, 2021 at 08:56:45AM +0100, Philippe Mathieu-Daudé <philmd@redhat.com> wrote: > Hi Isaku, > > On 2/16/21 3:12 AM, Isaku Yamahata wrote: > > Switch to making a VM ioctl() call for KVM_CAP_READONLY_MEM, which may > > be conditional on VM type in recent versions of KVM, e.g. when TDX is > > supported. > > > > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> > > --- > > accel/kvm/kvm-all.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c > > index 47516913b7..351c25a5cb 100644 > > --- a/accel/kvm/kvm-all.c > > +++ b/accel/kvm/kvm-all.c > > @@ -2164,7 +2164,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); > > Can this check with "recent KVM" be a problem with older ones? > > Maybe for backward compatibility we need: > > = (kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0) || > (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0); Agreed. That's safer and it's difficult to check the very old version of kenel and non-x86 arch. Thanks,
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 47516913b7..351c25a5cb 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2164,7 +2164,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_eventfds_allowed = (kvm_check_extension(s, KVM_CAP_IOEVENTFD) > 0);
Switch to making a VM ioctl() call for KVM_CAP_READONLY_MEM, which may be conditional on VM type in recent versions of KVM, e.g. when TDX is supported. Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> --- accel/kvm/kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)