Re: [PATCH v2 2/4] mm: x86: Invoke hypercall when page encryption status is changed

From: Borislav Petkov
Date: Wed May 12 2021 - 13:57:10 EST


On Wed, May 12, 2021 at 03:51:10PM +0000, Sean Christopherson wrote:
> TL;DR: I think the KVM hypercall should be something like this, so that it can
> be used for SNP and TDX, and possibly for other purposes, e.g. for paravirt
> performance enhancements or something.

Ok, good, I was only making sure this is on people's radar but it
actually is more than that. I'll let Tom and Jörg comment on the meat
of the thing - as always, thanks for the detailed explanation.

>From my !virt guy POV, I like the aspect of sharing stuff as much as
possible and it all makes sense to me but what the hell do I know...

> 8. KVM_HC_MAP_GPA_RANGE
> -----------------------
> :Architecture: x86
> :Status: active
> :Purpose: Request KVM to map a GPA range with the specified attributes.
>
> a0: the guest physical address of the start page
> a1: the number of (4kb) pages (must be contiguous in GPA space)
> a2: attributes
>
> where 'attributes' could be something like:
>
> bits 3:0 - preferred page size encoding 0 = 4kb, 1 = 2mb, 2 = 1gb, etc...
> bit 4 - plaintext = 0, encrypted = 1
> bits 63:5 - reserved (must be zero)

Yah, nice and simple. I like.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette