Re: [RFC PATCH 03/13] kvm: Add XO memslot type

From: Paolo Bonzini
Date: Sun Oct 06 2019 - 12:15:48 EST


On 04/10/19 21:06, Edgecombe, Rick P wrote:
> The reasoning was that it seems like KVM leaves it to userspace to control the
> physical address space layout since userspace decides the supported physical
> address bits and lays out memory in the physical address space. So duplication
> with XO memslots was an attempt was to keep the logic around that together.
>
> I'll take another look at doing it this way though. I think userspace may still
> need to adjust the MAXPHYADDR and be aware it can't layout memory in the XO
> range.

Right, you would have to use KVM_ENABLE_CAP passing the desired X bit
(which must be < MAXPHYADDR) as the argument. Userspace needs to know
that it must then make MAXPHYADDR in the guest CPUID equal to the
argument. When the MSR is written to 1, bit "MAXPHYADDR-1" in the page
table entries becomes an XO bit.

Paolo