[AMD Official Use Only - General]

 

Hello Nikunj,

 

Yes we can move MemEncryptSevLiveMigrationIsEnabled() check here before calling SetMemoryEncDecHypercall3()

but then we also need to remove the same check from inside SetMemoryEncDecHypercall3() function.

 

Thanks,

Ashish

 

From: nikunj via groups.io <nikunj=amd.com@groups.io>
Sent: Tuesday, June 7, 2022 3:39 AM
To: Kalra, Ashish <Ashish.Kalra@amd.com>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH v8 3/6] OvmfPkg/BaseMemEncryptLib: Invoke page encryption state change hypercall

 

Hi Ashish,

For case with latest OVMF and older qemu that does not enable live migrations,
SetMemoryEncDecHypercall3() returns RETURN_UNSUPPORTED, which is correct.
But then its actually treated as an error and OVMF sees an assert. This is a valid usecase
and OVMF should move ahead without live migration and HC_MAP_GPA_RANGE.
....

> + //
> + // Notify Hypervisor on C-bit status
> + //
> + if (CBitChanged) {

Should we call the SetMemoryEncDecHypercall() only if migration is enabled like below?

if (CBitChanged && MemEncryptSevLiveMigrationIsEnabled () {

> + Status = SetMemoryEncDecHypercall3 (
> + OrigPhysicalAddress,
> + EFI_SIZE_TO_PAGES (OrigLength),
> + (Mode == SetCBit) ? TRUE : FALSE
> + );
> + }
> +
> ...
>
> return Status;

Regards
Nikunj