[edk2-devel] [PATCH V3 02/29] MdePkg: Add TdxLib to wrap Tdx operations

Gerd Hoffmann kraxel at redhat.com
Tue Nov 2 14:06:43 UTC 2021


  Hi,

> +UINT64  mTdSharedPageMask = 0;
> +UINT32  mTdMaxVCpuNum     = 0;
> +UINT32  mTdVCpuNum        = 0;

> +UINT64
> +EFIAPI
> +TdSharedPageMask (
> +  VOID
> +  )
> +{
> +  UINT64                      Status;
> +  UINT8                       Gpaw;
> +  TD_RETURN_DATA              TdReturnData;
> +
> +  if (mTdSharedPageMask != 0) {
> +    return mTdSharedPageMask;
> +  }

Small possible optimization: you can cache the whole TD_RETURN_DATA
struct instead of the three extracted values, then ...

> +  Status = TdCall (TDCALL_TDINFO, 0, 0, 0, &TdReturnData);
> +  ASSERT (Status == TDX_EXIT_REASON_SUCCESS);

... you need a single TDCALL_TDINFO call only.

> +       tdcall
> +
> +       ; Panic if TDCALL reports failure.
> +       test rax, rax
> +       jnz .no_return_data

> +.panic:
> +       ud2

Comment doesn't match code.  jnz .panic ?

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83135): https://edk2.groups.io/g/devel/message/83135
Mute This Topic: https://groups.io/mt/86739959/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