On Wed, Jul 10, 2019 at 1:13 PM Singh, Brijesh <brijesh.singh@xxxxxxx> wrote: > > struct kvm_arch_async_pf { > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index e675fd89bb9a..31653e8d5927 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -7466,6 +7466,47 @@ static int svm_get_page_enc_bitmap(struct kvm *kvm, > return ret; > } > > +static int svm_set_page_enc_bitmap(struct kvm *kvm, > + struct kvm_page_enc_bitmap *bmap) > +{ > + struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; > + unsigned long gfn_start, gfn_end; > + unsigned long *bitmap; > + unsigned long sz, i; > + int ret; > + > + if (!sev_guest(kvm)) > + return -ENOTTY; > + > + gfn_start = bmap->start_gfn; > + gfn_end = gfn_start + bmap->num_pages; > + > + sz = ALIGN(bmap->num_pages, BITS_PER_LONG) / 8; > + bitmap = kmalloc(sz, GFP_KERNEL); This kmalloc should probably be either a vmalloc or kvmalloc. The max size, if I'm reading kmalloc correctly, is 2^10 pages. That's 4MB, which should correspond to a bitmap for a 128GB VM, which is a plausible VM size. --Steve