Re: [PATCH v3 09/11] KVM: x86: Introduce KVM_GET_PAGE_ENC_BITMAP ioctl

From: Singh, Brijesh
Date: Thu Aug 29 2019 - 12:41:54 EST




On 8/29/19 11:26 AM, Borislav Petkov wrote:
> On Wed, Jul 10, 2019 at 08:13:10PM +0000, Singh, Brijesh wrote:
>> @@ -7767,7 +7808,8 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
>>
>> .need_emulation_on_page_fault = svm_need_emulation_on_page_fault,
>>
>> - .page_enc_status_hc = svm_page_enc_status_hc
>> + .page_enc_status_hc = svm_page_enc_status_hc,
>> + .get_page_enc_bitmap = svm_get_page_enc_bitmap
>> };
>>
>> static int __init svm_init(void)
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 6baf48ec0ed4..59ae49b1b914 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -4927,6 +4927,18 @@ long kvm_arch_vm_ioctl(struct file *filp,
>> r = kvm_vm_ioctl_hv_eventfd(kvm, &hvevfd);
>> break;
>> }
>> + case KVM_GET_PAGE_ENC_BITMAP: {
>> + struct kvm_page_enc_bitmap bitmap;
>> +
>> + r = -EFAULT;
>> + if (copy_from_user(&bitmap, argp, sizeof(bitmap)))
>> + goto out;
>> +
>> + r = -ENOTTY;
>> + if (kvm_x86_ops->get_page_enc_bitmap)
>> + r = kvm_x86_ops->get_page_enc_bitmap(kvm, &bitmap);
>
> I don't know what tree you've done those patches against but against -rc6+, the
> first argument above needs to be vcpu->kvm:
>
> arch/x86/kvm/x86.c: In function âkvm_arch_vcpu_ioctlâ:
> arch/x86/kvm/x86.c:4343:41: error: âkvmâ undeclared (first use in this function)
> r = kvm_x86_ops->get_page_enc_bitmap(kvm, &bitmap);
> ^~~
> arch/x86/kvm/x86.c:4343:41: note: each undeclared identifier is reported only once for each function it appears in
> make[2]: *** [scripts/Makefile.build:280: arch/x86/kvm/x86.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [scripts/Makefile.build:497: arch/x86/kvm] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1083: arch/x86] Error 2
> make: *** Waiting for unfinished jobs....
>

The patches were based on KVM tree July 9th

commit id: e9a83bd2322035ed9d7dcf35753d3f984d76c6a5

I have been waiting for some feedback before refreshing it. If you want
then I can refresh the patch with latest from Linus and send v4.

thanks