[edk2-devel] [PATCH v5 2/4] OvmfPkg/VmgExitLib: Add support for hypercalls with SEV-ES.

Lendacky, Thomas via groups.io thomas.lendacky=amd.com at groups.io
Fri Jul 16 14:16:00 UTC 2021


On 7/8/21 9:08 AM, Ashish Kalra wrote:
> From: Ashish Kalra <ashish.kalra at amd.com>
> 

The subject isn't correct since the #VC handler already supports
hypercalls. It should say something like "Make the #VC handler aware of
the encryption state change hypercall" or "Update the #VC handler to
support the encryption state change hypercall" or something like that.

> Make the VC handler hypercall aware by adding support
> to compare the hypercall number and add the additional
> register values used by hypercall in the GHCB.
> 
> Also mark the SEC GHCB page (that is mapped as
> unencrypted in ResetVector code) in the hypervisor
> guest page status tracking.

This part of the commit message shoudn't be here any more.

> 
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
> Signed-off-by: Ashish Kalra <ashish.kalra at amd.com>
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
> index 41b0c8cc53..7f69bfab5f 100644
> --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
> +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
> @@ -1171,6 +1171,15 @@ VmmCallExit (
>    Ghcb->SaveArea.Cpl = (UINT8) (Regs->Cs & 0x3);
>    VmgSetOffsetValid (Ghcb, GhcbCpl);
>  

Add a comment that this hypercall requires these extra registers so you
are explicitly adding them.

Thanks,
Tom

> +  if (Regs->Rax == KVM_HC_MAP_GPA_RANGE) {
> +    Ghcb->SaveArea.Rbx = Regs->Rbx;
> +    VmgSetOffsetValid (Ghcb, GhcbRbx);
> +    Ghcb->SaveArea.Rcx = Regs->Rcx;
> +    VmgSetOffsetValid (Ghcb, GhcbRcx);
> +    Ghcb->SaveArea.Rdx = Regs->Rdx;
> +    VmgSetOffsetValid (Ghcb, GhcbRdx);
> +  }
> +
>    Status = VmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);
>    if (Status != 0) {
>      return Status;
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77829): https://edk2.groups.io/g/devel/message/77829
Mute This Topic: https://groups.io/mt/84068349/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list