feat(rmm-eac5): update RSI_VERSION, RMI_VERSION
This patch adds necessary support for RMI_VERSION
and RSI_VERSION commands.
Macro SMC_RSI_ABI_VERSION renamed to SMC_RSI_VERSION.
Note.
This patch sets both RSI and RMI version numbers to
1.0 as per RMM Specification 1.0-eac5.
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: If4eb14d93f657388e2fe64ceefee002403cc4ae8
diff --git a/realm/include/realm_rsi.h b/realm/include/realm_rsi.h
index e9b6ce8..547db0d 100644
--- a/realm/include/realm_rsi.h
+++ b/realm/include/realm_rsi.h
@@ -26,7 +26,7 @@
* The major version number of the RSI implementation. Increase this whenever
* the binary format or semantics of the SMC calls change.
*/
-#define RSI_ABI_VERSION_MAJOR 12U
+#define RSI_ABI_VERSION_MAJOR 1U
/*
* The minor version number of the RSI implementation. Increase this when
@@ -94,7 +94,7 @@
#define RSI_HOST_CALL SMC_RSI_FID(9U)
-#define RSI_ABI_VERSION SMC_RSI_FID(0U)
+#define RSI_VERSION SMC_RSI_FID(0U)
/*
* arg0 == struct rsi_realm_config address
@@ -102,7 +102,7 @@
#define RSI_REALM_CONFIG SMC_RSI_FID(6U)
/* This function return RSI_ABI_VERSION */
-u_register_t rsi_get_version(void);
+u_register_t rsi_get_version(u_register_t req_ver);
/* This function will call the Host to request IPA of the NS shared buffer */
u_register_t rsi_get_ns_buffer(void);
diff --git a/realm/realm_payload_main.c b/realm/realm_payload_main.c
index 1440716..aaf7479 100644
--- a/realm/realm_payload_main.c
+++ b/realm/realm_payload_main.c
@@ -43,21 +43,22 @@
/*
* This function requests RSI/ABI version from RMM.
*/
-static void realm_get_rsi_version(void)
+static bool realm_get_rsi_version(void)
{
- u_register_t version;
+ u_register_t version = 0U;
- version = rsi_get_version();
+ version = rsi_get_version(RSI_ABI_VERSION_VAL);
if (version == (u_register_t)SMC_UNKNOWN) {
- realm_printf("SMC_RSI_ABI_VERSION failed (%ld)", (long)version);
- return;
+ realm_printf("SMC_RSI_ABI_VERSION failed\n");
+ return false;
}
- realm_printf("RSI ABI version %u.%u (expected: %u.%u)",
+ realm_printf("RSI ABI version %u.%u (expected: %u.%u)\n",
RSI_ABI_VERSION_GET_MAJOR(version),
RSI_ABI_VERSION_GET_MINOR(version),
- RSI_ABI_VERSION_GET_MAJOR(RSI_ABI_VERSION),
- RSI_ABI_VERSION_GET_MINOR(RSI_ABI_VERSION));
+ RSI_ABI_VERSION_GET_MAJOR(RSI_ABI_VERSION_VAL),
+ RSI_ABI_VERSION_GET_MINOR(RSI_ABI_VERSION_VAL));
+ return true;
}
/*
@@ -98,8 +99,7 @@
test_succeed = test_realm_pauth_fault();
break;
case REALM_GET_RSI_VERSION:
- realm_get_rsi_version();
- test_succeed = true;
+ test_succeed = realm_get_rsi_version();
break;
case REALM_PMU_CYCLE:
test_succeed = test_pmuv3_cycle_works_realm();
diff --git a/realm/realm_pmuv3.c b/realm/realm_pmuv3.c
index 862e93e..58c05f0 100644
--- a/realm/realm_pmuv3.c
+++ b/realm/realm_pmuv3.c
@@ -227,7 +227,7 @@
read_all_pmu_configs(pmu_cfg_start);
/* Give RMM a chance to scramble everything */
- (void)rsi_get_version();
+ (void)rsi_get_version(RSI_ABI_VERSION_VAL);
/* Get after reading */
read_all_counters(ctr_end, impl_ev_ctrs);
diff --git a/realm/realm_rsi.c b/realm/realm_rsi.c
index 586d4d2..d82aa6f 100644
--- a/realm/realm_rsi.c
+++ b/realm/realm_rsi.c
@@ -14,14 +14,18 @@
static struct rsi_host_call host_cal __aligned(sizeof(struct rsi_host_call));
/* This function return RSI_ABI_VERSION */
-u_register_t rsi_get_version(void)
+u_register_t rsi_get_version(u_register_t req_ver)
{
smc_ret_values res = {};
res = tftf_smc(&(smc_args)
- {RSI_ABI_VERSION, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL});
+ {RSI_VERSION, req_ver, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL});
- return res.ret0;
+ if (res.ret0 == SMC_UNKNOWN) {
+ return SMC_UNKNOWN;
+ }
+ /* Return lower version. */
+ return res.ret1;
}
/* This function will call the Host to request IPA of the NS shared buffer */