The RMM 1.0-eac4 introduces a new FID RSI_FEATURES to query the RSI features supported that have been implemented.
Therefore, introduce a new function RsiGetFeatures to query the features supported by the RSI. Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Leif Lindholm <quic_llind...@quicinc.com> Cc: Gerd Hoffmann <kra...@redhat.com> Signed-off-by: Sami Mujawar <sami.muja...@arm.com> --- ArmVirtPkg/Include/Library/ArmCcaRsiLib.h | 24 +++++++++++- ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h | 3 +- ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c | 39 +++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h index 88351f53336c42c032fcff6ea97ea7728b917b76..8c1c0d5bc19d14fa640464c8d0d44e3ef522ba79 100644 --- a/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h +++ b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h @@ -11,7 +11,7 @@ - REM - Realm Extensible Measurement @par Reference(s): - - Realm Management Monitor (RMM) Specification, version 1.0-eac3 + - Realm Management Monitor (RMM) Specification, version 1.0-eac4 (https://developer.arm.com/documentation/den0137/) **/ @@ -334,4 +334,26 @@ RsiGetVersion ( OUT UINT16 *CONST Minor ); +/** + Get the features supported by the RSI implementation. + + RMM implementations across different CCA platforms may support + disparate features and may offer disparate configuration options + for Realms. The features supported by an RSI implementation are + discovered by reading feature pseudo-register values using the + RSI_FEATURES command. + + @param [in] FeatureRegIndex The Feature Register Index. + @param [out] FeatureRegValue The Feature Register Value. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. +**/ +RETURN_STATUS +EFIAPI +RsiGetFeatures ( + IN UINT64 FeatureRegIndex, + OUT UINT64 *FeatureRegValue + ); + #endif // ARM_CCA_RSI_LIB_ diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h index b1c359e2486c20ee19493b10ed3fcef1e20f2689..cd2c9ac05c02413caeed26fd764320dd751ea05b 100644 --- a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h +++ b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h @@ -10,7 +10,7 @@ - RIPAS - Realm IPA state @par Reference(s): - - Realm Management Monitor (RMM) Specification, version A-bet0 + - Realm Management Monitor (RMM) Specification, version 1.0-eac4 (https://developer.arm.com/documentation/den0137/) **/ @@ -20,6 +20,7 @@ // FIDs for Realm Service Interface calls. #define FID_RSI_ATTESTATION_TOKEN_CONTINUE 0xC4000195 #define FID_RSI_ATTESTATION_TOKEN_INIT 0xC4000194 +#define FID_RSI_FEATURES 0xC4000191 #define FID_RSI_HOST_CALL 0xC4000199 #define FID_RSI_IPA_STATE_GET 0xC4000198 #define FID_RSI_IPA_STATE_SET 0xC4000197 diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c index 12636c484824426b2ea81ca007d962f5f7c58f8c..edd2e11f786d11191f13dd9b087cdeec4127b375 100644 --- a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c +++ b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c @@ -11,7 +11,7 @@ - REM - Realm Extensible Measurement @par Reference(s): - - Realm Management Monitor (RMM) Specification, version 1.0-eac3 + - Realm Management Monitor (RMM) Specification, version 1.0-eac4 (https://developer.arm.com/documentation/den0137/) **/ @@ -574,3 +574,40 @@ RsiGetVersion ( *Major = (SmcCmd.Arg0 & RSI_VER_MAJOR_MASK) >> RSI_VER_MAJOR_SHIFT; return RETURN_SUCCESS; } + +/** + Get the features supported by the RSI implementation. + + RMM implementations across different CCA platforms may support + disparate features and may offer disparate configuration options + for Realms. The features supported by an RSI implementation are + discovered by reading feature pseudo-register values using the + RSI_FEATURES command. + + @param [in] FeatureRegIndex The Feature Register Index. + @param [out] FeatureRegValue The Feature Register Value. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. +**/ +RETURN_STATUS +EFIAPI +RsiGetFeatures ( + IN UINT64 FeatureRegIndex, + OUT UINT64 *FeatureRegValue + ) +{ + ARM_SMC_ARGS SmcCmd; + + if (FeatureRegValue == NULL) { + return RETURN_INVALID_PARAMETER; + } + + ZeroMem (&SmcCmd, sizeof (SmcCmd)); + SmcCmd.Arg0 = FID_RSI_FEATURES; + SmcCmd.Arg1 = FeatureRegIndex; + + ArmCallSmc (&SmcCmd); + *FeatureRegValue = SmcCmd.Arg1; + return RsiCmdStatusToEfiStatus (SmcCmd.Arg0); +} -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117715): https://edk2.groups.io/g/devel/message/117715 Mute This Topic: https://groups.io/mt/105484267/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-