From: "Sami Mujawar" <sami.mujawar@arm.com>
To: <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.mujawar@arm.com>, <ardb+tianocore@kernel.org>,
<quic_llindhol@quicinc.com>, <kraxel@redhat.com>,
<Matteo.Carlini@arm.com>, <Akanksha.Jain2@arm.com>,
<Sibel.Allinson@arm.com>, <nd@arm.com>
Subject: [edk2-devel] [PATCH v2 41/45] ArmVirtPkg: RMM 1.0-eac4 - Add RSI Features support
Date: Fri, 12 Apr 2024 16:13:38 +0100 [thread overview]
Message-ID: <20240412151341.16488-3-sami.mujawar@arm.com> (raw)
In-Reply-To: <20240412151341.16488-1-sami.mujawar@arm.com>
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+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sami Mujawar <sami.mujawar@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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-04-12 15:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 15:13 [edk2-devel] [PATCH v2 00/45] Support for Arm CCA guest firmware Sami Mujawar
2024-04-12 15:13 ` [edk2-devel] [PATCH v2 30/45] ArmVirtPkg: ArmCcaRsiLib: Fix incorrect RSI version masks Sami Mujawar
2024-04-12 15:13 ` Sami Mujawar [this message]
2024-04-12 15:13 ` [edk2-devel] [PATCH v2 43/45] ArmVirtPkg: RMM 1.0-eac5 - Update RSI Version support Sami Mujawar
2024-04-12 15:13 ` [edk2-devel] [PATCH v2 44/45] ArmVirtPkg: ArmCcaLib: Cache current world value Sami Mujawar
2024-04-12 15:13 ` [edk2-devel] [PATCH v2 45/45] ArmVirtPkg: ArmCcaIoMmu: Provide an implementation for SetAttribute Sami Mujawar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240412151341.16488-3-sami.mujawar@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox