Re: [PATCH v2] KVM: X86: deprecate obsolete KVM_GET_CPUID2 ioctl

From: linmiaohe
Date: Thu Feb 27 2020 - 20:36:24 EST


Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> writes:
>linmiaohe <linmiaohe@xxxxxxxxxx> writes:
>
>> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>> - if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid)))
>> - goto out;
>> - r = 0;
>> + r = -EINVAL;
>> break;
>> }
>
>Braces are not really needed not but all other cases in the switch have it so let's leave them here too.
>

That's what I think too. :)

>>
>> case KVM_GET_MSRS: {
>> +/* KVM_GET_CPUID2 is deprecated, should not be used. */
>
>"should not be used" pre-patch, post-patch we can say "Can only be used as a reliable source of -EINVAL" :-)

That's right.

>
> #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
> /* Available with KVM_CAP_VAPIC */
> #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct
> kvm_tpr_access_ctl)
>
>Surprisingly (or not), KVM_GET_CPUID2 is not even described in Documentation/virt/kvm/api.txt.
>

Maybe KVM_GET_CPUID2 is defined for integrity only.

>
>Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
>

Many thanks for your review!