Re: [PATCH v5 08/14] KVM: X86: Introduce KVM_HC_PAGE_ENC_STATUS hypercall

From: kbuild test robot
Date: Sun Mar 29 2020 - 23:31:25 EST


Hi Ashish,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/x86/mm]
[also build test ERROR on v5.6]
[cannot apply to kvm/linux-next tip/x86/core next-20200327]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Ashish-Kalra/Add-AMD-SEV-guest-live-migration-support/20200330-094122
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git aa61ee7b9ee3cb84c0d3a842b0d17937bf024c46
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/x86/kvm/svm.c: In function 'svm_page_enc_status_hc':
>> arch/x86/kvm/svm.c:7652:2: error: 'pfn_start' undeclared (first use in this function); did you mean 'gfn_start'?
pfn_start = gfn_to_pfn(kvm, gfn_start);
^~~~~~~~~
gfn_start
arch/x86/kvm/svm.c:7652:2: note: each undeclared identifier is reported only once for each function it appears in
>> arch/x86/kvm/svm.c:7653:2: error: 'pfn_end' undeclared (first use in this function); did you mean 'gfn_end'?
pfn_end = gfn_to_pfn(kvm, gfn_end);
^~~~~~~
gfn_end

vim +7652 arch/x86/kvm/svm.c

7630
7631 static int svm_page_enc_status_hc(struct kvm *kvm, unsigned long gpa,
7632 unsigned long npages, unsigned long enc)
7633 {
7634 struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
7635 gfn_t gfn_start, gfn_end;
7636 int ret;
7637
7638 if (!sev_guest(kvm))
7639 return -EINVAL;
7640
7641 if (!npages)
7642 return 0;
7643
7644 gfn_start = gpa_to_gfn(gpa);
7645 gfn_end = gfn_start + npages;
7646
7647 /* out of bound access error check */
7648 if (gfn_end <= gfn_start)
7649 return -EINVAL;
7650
7651 /* lets make sure that gpa exist in our memslot */
> 7652 pfn_start = gfn_to_pfn(kvm, gfn_start);
> 7653 pfn_end = gfn_to_pfn(kvm, gfn_end);
7654
7655 if (is_error_noslot_pfn(pfn_start) && !is_noslot_pfn(pfn_start)) {
7656 /*
7657 * Allow guest MMIO range(s) to be added
7658 * to the page encryption bitmap.
7659 */
7660 return -EINVAL;
7661 }
7662
7663 if (is_error_noslot_pfn(pfn_end) && !is_noslot_pfn(pfn_end)) {
7664 /*
7665 * Allow guest MMIO range(s) to be added
7666 * to the page encryption bitmap.
7667 */
7668 return -EINVAL;
7669 }
7670
7671 mutex_lock(&kvm->lock);
7672 ret = sev_resize_page_enc_bitmap(kvm, gfn_end);
7673 if (ret)
7674 goto unlock;
7675
7676 if (enc)
7677 __bitmap_set(sev->page_enc_bmap, gfn_start,
7678 gfn_end - gfn_start);
7679 else
7680 __bitmap_clear(sev->page_enc_bmap, gfn_start,
7681 gfn_end - gfn_start);
7682
7683 unlock:
7684 mutex_unlock(&kvm->lock);
7685 return ret;
7686 }
7687

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip