Re: [PATCH 1/4] KVM: x86: Add AMD SEV specific Hypercall3

From: Sean Christopherson
Date: Thu Apr 22 2021 - 20:03:46 EST


On Thu, Apr 22, 2021, Ashish Kalra wrote:
> From: Brijesh Singh <brijesh.singh@xxxxxxx>
>
> KVM hypercall framework relies on alternative framework to patch the
> VMCALL -> VMMCALL on AMD platform. If a hypercall is made before
> apply_alternative() is called then it defaults to VMCALL. The approach
> works fine on non SEV guest. A VMCALL would causes #UD, and hypervisor
> will be able to decode the instruction and do the right things. But
> when SEV is active, guest memory is encrypted with guest key and
> hypervisor will not be able to decode the instruction bytes.
>
> Add SEV specific hypercall3, it unconditionally uses VMMCALL. The hypercall
> will be used by the SEV guest to notify encrypted pages to the hypervisor.

I still think we should invert the default and avoid having an SEV specific
variant of kvm_hypercall3().

https://lore.kernel.org/kvm/X8gyhCsEMf8QU9H%2F@xxxxxxxxxx/