@@ -49,6 +49,7 @@ tests = $(TEST_DIR)/timer.$(exe)
tests += $(TEST_DIR)/micro-bench.$(exe)
tests += $(TEST_DIR)/cache.$(exe)
tests += $(TEST_DIR)/debug.$(exe)
+tests += $(TEST_DIR)/realm-rsi.$(exe)
include $(SRCDIR)/$(TEST_DIR)/Makefile.common
new file mode 100644
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2022 Arm Limited.
+ * All rights reserved.
+ */
+
+#include <libcflat.h>
+#include <asm/io.h>
+#include <asm/page.h>
+#include <asm/processor.h>
+#include <asm/psci.h>
+#include <alloc_page.h>
+#include <asm/rsi.h>
+#include <asm/pgtable.h>
+#include <asm/processor.h>
+
+static void rsi_test_version(void)
+{
+ struct smccc_result res;
+ int ret, version;
+
+ report_prefix_push("version");
+
+ ret = __rsi_get_version(RSI_ABI_VERSION, &res);
+ if (ret < 0) {
+ report(false, "SMC_RSI_ABI_VERSION failed (%d)", ret);
+ return;
+ }
+
+ version = res.r1;
+ report(res.r0 == RSI_SUCCESS, "RSI ABI version %u.%u (expected: %u.%u)",
+ 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));
+ report_prefix_pop();
+}
+
+int main(int argc, char **argv)
+{
+ report_prefix_push("rsi");
+
+ if (!is_realm()) {
+ report_skip("Not a realm, skipping tests");
+ goto exit;
+ }
+
+ rsi_test_version();
+exit:
+ return report_summary();
+}
@@ -281,3 +281,10 @@ file = debug.flat
arch = arm64
extra_params = -append 'ss-migration'
groups = debug migration
+
+# Realm RSI ABI test
+[realm-rsi]
+file = realm-rsi.flat
+groups = nodefault realms
+accel = kvm
+arch = arm64