Re: [PATCH v5 00/13] KVM/X86: Introduce a new guest mapping interface

From: Paolo Bonzini
Date: Wed Jan 30 2019 - 12:14:12 EST


On 25/01/19 19:28, Raslan, KarimAllah wrote:
> So the simple way to do it is:
>
> 1- Pass 'mem=' in the kernel command-line to limit the amount of memory managedÂ
> Â Âby the kernel.
> 2- Map this physical memory you want to give to the guest with
> Â Â Â mmap("/dev/mem", physical_address_offset, ..)
> 3- Use the user-space virtual address as the "userspace_addr" fieldÂ
> Â ÂinÂKVM_SET_USER_MEMORY_REGION ioctl.
>
> You will also need this patch (hopefully I will repost next week as well):
> https://patchwork.kernel.org/patch/9191755/

I took a look again at that patch and I guess I've changed my mind now
that the kernel provides e820__mapped_any and e820__mapped_all.
However, please do use e820__mapped_any instead of adding a new function
e820_is_ram.

Thanks,

Paolo

> I will make sure to expand on this in the cover letter in v6.