Re: [PATCH v13 10/12] KVM: x86: Introduce new KVM_FEATURE_SEV_LIVE_MIGRATION feature & Custom MSR.

Paolo Bonzini
2021-04-20T10:50:56Z

On 20/04/21 01:06, Sean Christopherson wrote:
>> diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h
>> index 950afebfba88..f6bfa138874f 100644
>> --- a/arch/x86/include/uapi/asm/kvm_para.h
>> +++ b/arch/x86/include/uapi/asm/kvm_para.h
>> @@ -33,6 +33,7 @@
>> #define KVM_FEATURE_PV_SCHED_YIELD 13
>> #define KVM_FEATURE_ASYNC_PF_INT 14
>> #define KVM_FEATURE_MSI_EXT_DEST_ID 15
>> +#define KVM_FEATURE_SEV_LIVE_MIGRATION 16
>>
>> #define KVM_HINTS_REALTIME 0
>>
>> @@ -54,6 +55,7 @@
>> #define MSR_KVM_POLL_CONTROL 0x4b564d05
>> #define MSR_KVM_ASYNC_PF_INT 0x4b564d06
>> #define MSR_KVM_ASYNC_PF_ACK 0x4b564d07
>> +#define MSR_KVM_SEV_LIVE_MIGRATION 0x4b564d08
>>
>> struct kvm_steal_time {
>> __u64 steal;
>> @@ -136,4 +138,6 @@ struct kvm_vcpu_pv_apf_data {
>> #define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK
>> #define KVM_PV_EOI_DISABLED 0x0
>>
>> +#define KVM_SEV_LIVE_MIGRATION_ENABLED BIT_ULL(0)
>
> Even though the intent is to "force" userspace to intercept the MSR, I think KVM
> should at least emulate the legal bits as a nop. Deferring completely to
> userspace is rather bizarre as there's not really anything to justify KVM
> getting involved. It would also force userspace to filter the MSR just to
> support the hypercall.

I think this is the intention, the hypercall by itself cannot do much if
you cannot tell userspace that it's up-to-date.

On the other hand it is kind of wrong that KVM_GET_SUPPORTED_CPUID
returns the feature, but the MSR is not supported.

> Somewhat of a nit, but I think we should do something like s/ENABLED/READY,

Agreed. I'll send a patch that puts everything together.

Paolo