From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [PATCH v8 3/6] OvmfPkg/BaseMemEncryptLib: Invoke page encryption state change hypercall To: Ashish Kalra ,devel@edk2.groups.io From: nikunj@amd.com X-Originating-Location: IN (185.221.70.46) X-Originating-Platform: Windows Chrome 102 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 07 Jun 2022 01:38:46 -0700 References: In-Reply-To: Message-ID: <12370.1654591126491114870@groups.io> Content-Type: multipart/alternative; boundary="bHI4MfuGVusqCdnAClQ7" --bHI4MfuGVusqCdnAClQ7 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Ashish, For case with latest OVMF and older qemu that does not enable live migratio= ns, 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 =3D SetMemoryEncDecHypercall3 ( > + OrigPhysicalAddress, > + EFI_SIZE_TO_PAGES (OrigLength), > + (Mode =3D=3D SetCBit) ? TRUE : FALSE > + ); > + } > + > ... > > return Status; Regards Nikunj --bHI4MfuGVusqCdnAClQ7 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Ashish,

For case with latest OVMF and older qemu th= at does not enable live migrations,
SetMemoryEncDecHypercall3() retur= ns RETURN_UNSUPPORTED, which is correct.
But then its actually treate= d as an error and OVMF sees an assert. This is a valid usecase
and OV= MF should move ahead without live migration and HC_MAP_GPA_RANGE.
....

> + //<= br style=3D"white-space: pre-wrap;" />> + //
&= gt; + if (CBitChanged) {

Should we call the SetMemoryEncDecHypercall() only if migration is e= nabled like below?

if (CBitChanged && MemEncryptSevLiveMigrationIsEnabled () {
<= /span>
> + Status =3D SetMemoryEncDecHypercall3 (
> + Orig= PhysicalAddress,
> + EFI_SIZE_TO_PAGES (OrigLength),> + (Mode =3D=3D SetCBit) ? TRUE : FALSE
> + );
&g= t; + }
> +
&= gt; ...
>
> return Status;
Regards
Nikunj --bHI4MfuGVusqCdnAClQ7--