The RMM 1.0-eac3 specification extends the RSI_IPA_STATE_SET command to return a new RsiResponse value to indicate if the Host accepts or rejects the IPA state change request to RAM.
Therefore, define the RsiResponse enum and return an error RETURN_ACCESS_DENIED if the Host rejects the RIPAS change request to RAM. Such a failure is fatal and not recoverable and the caller is then expected to tear down the Realm. 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 | 26 +++++++++++++++++++- ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c | 8 +++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h index 5c2f996d3b4376e831a901f2919780acffec3313..88351f53336c42c032fcff6ea97ea7728b917b76 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-eac2 + - Realm Management Monitor (RMM) Specification, version 1.0-eac3 (https://developer.arm.com/documentation/den0137/) **/ @@ -91,6 +91,29 @@ */ #define RIPAS_CHANGE_FLAGS_RSI_CHANGE_DESTROYED 1 +/* The RsiResponse type is a value returned by the + RSI_IPA_STATE_SET command and represents whether + the Host accepted or rejected a Realm request. + See section B4.4.6 RsiResponse type in the + RMM Specification, version 1.0-eac3. + The width of the RsiResponse enumeration is 1 bit + and the following macros prefixed RIPAS_CHANGE_RESPONSE_xxx + define the values of the RsiResponse type. +*/ + +/* The RIPAS change request to RAM was accepted + by the host. +*/ +#define RIPAS_CHANGE_RESPONSE_ACCEPT 0 + +/* The RIPAS change request to RAM was rejected + by the host. +*/ +#define RIPAS_CHANGE_RESPONSE_REJECT 1 + +/* A mask for the RSI Response bit */ +#define RSI_RESPONSE_MASK BIT0 + /** An enum describing the RSI RIPAS. See Section A5.2.2 Realm IPA state, RMM Specification, version 1.0-eac2 */ @@ -209,6 +232,7 @@ RsiGetIpaState ( @retval RETURN_SUCCESS Success. @retval RETURN_INVALID_PARAMETER A parameter is invalid. + @retval RETURN_ACCESS_DENIED RIPAS change request was rejected. **/ RETURN_STATUS EFIAPI diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c index 0535254a3991bfe7a19b904e83b9482f801da20c..12636c484824426b2ea81ca007d962f5f7c58f8c 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-eac2 + - Realm Management Monitor (RMM) Specification, version 1.0-eac3 (https://developer.arm.com/documentation/den0137/) **/ @@ -322,6 +322,7 @@ RsiGetIpaState ( @retval RETURN_SUCCESS Success. @retval RETURN_INVALID_PARAMETER A parameter is invalid. + @retval RETURN_ACCESS_DENIED RIPAS change request was rejected. **/ RETURN_STATUS EFIAPI @@ -365,6 +366,11 @@ RsiSetIpaState ( BaseAddress = (UINT64 *)SmcCmd.Arg1; Size = EndAddress - BaseAddress; + + if ((SmcCmd.Arg2 & RSI_RESPONSE_MASK) == RIPAS_CHANGE_RESPONSE_REJECT) { + Status = RETURN_ACCESS_DENIED; + break; + } } // while return Status; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117707): https://edk2.groups.io/g/devel/message/117707 Mute This Topic: https://groups.io/mt/105483451/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-