Merge "Makefile: add missing help_tests info on help target"
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h
index 0692aa9..197879e 100644
--- a/include/runtime_services/ffa_helpers.h
+++ b/include/runtime_services/ffa_helpers.h
@@ -59,6 +59,7 @@
smc_ret_values ffa_features(uint32_t feature);
smc_ret_values ffa_partition_info_get(const uint32_t uuid[4]);
smc_ret_values ffa_rx_release(void);
+smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages);
#endif /* __ASSEMBLY__ */
diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/cactus-secondary.dts
index 8a140a9..71a56f4 100644
--- a/spm/cactus/cactus-secondary.dts
+++ b/spm/cactus/cactus-secondary.dts
@@ -45,14 +45,14 @@
rxbuffer: rx-buffer {
description = "rx-buffer";
pages-count = <1>;
- base-address = <0x00000000 0x7202000>;
+ base-address = <0x00000000 0x7302000>;
attributes = <0x1>; /* read-only */
};
txbuffer: tx-buffer {
description = "tx-buffer";
pages-count = <1>;
- base-address = <0x00000000 0x7203000>;
+ base-address = <0x00000000 0x7303000>;
attributes = <0x3>; /* read-write */
};
diff --git a/spm/cactus/cactus-tertiary.dts b/spm/cactus/cactus-tertiary.dts
new file mode 100644
index 0000000..d823ef3
--- /dev/null
+++ b/spm/cactus/cactus-tertiary.dts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * This file is a Partition Manifest (PM) for a minimal Secure Partition (SP)
+ * that has additional optional properties defined.
+ *
+ */
+
+/dts-v1/;
+
+/ {
+ compatible = "arm,ffa-manifest-1.0";
+
+ /* Properties */
+ description = "Base-1";
+ ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
+ uuid = <0x79b55c73 0x1d8c44b9 0x859361e1 0x770ad8d2>;
+ id = <3>;
+ auxiliary-id = <0xae>;
+ stream-endpoint-ids = <0 1 2 3>;
+ execution-ctx-count = <1>;
+ exception-level = <2>; /* S-EL1 */
+ execution-state = <0>; /* AARCH64 */
+ load-address = <0x7200000>;
+ entrypoint-offset = <0x00001000>;
+ xlat-granule = <0>; /* 4KiB */
+ boot-order = <0>;
+ messaging-method = <0>; /* Direct messaging only */
+ run-time-model = <0>; /* Run to completion */
+
+ /* Boot protocol */
+ gp-register-num = <0x0>;
+
+ memory-regions {
+ compatible = "arm,ffa-manifest-memory-regions";
+
+ /* Without optional base-address */
+ test-memory {
+ description = "test-memory";
+ pages-count = <4>;
+ attributes = <0x7>; /* read-write-execute */
+ };
+ };
+
+ device-regions {
+ compatible = "arm,ffa-manifest-device-regions";
+
+ test-reg {
+ /* Dummy values */
+ base-address = <0x00000000 0x25000000>;
+ pages-count = <16>;
+ attributes = <0x3>; /* read-write */
+ reg = <0x10000008 0x00000001 1>;
+ smmu-id = <1>;
+ stream-ids = <0x0 0x1>;
+ interrupts = <0x2 0x3>,
+ <0x4 0x5>;
+ };
+ };
+
+};
diff --git a/spm/cactus/cactus.dts b/spm/cactus/cactus.dts
index 2e30db4..919a5d5 100644
--- a/spm/cactus/cactus.dts
+++ b/spm/cactus/cactus.dts
@@ -45,14 +45,14 @@
rxbuffer: rx-buffer {
description = "rx-buffer";
pages-count = <1>;
- base-address = <0x00000000 0x7200000>;
+ base-address = <0x00000000 0x7300000>;
attributes = <0x1>; /* read-only */
};
txbuffer: tx-buffer {
description = "tx-buffer";
pages-count = <1>;
- base-address = <0x00000000 0x7201000>;
+ base-address = <0x00000000 0x7301000>;
attributes = <0x3>; /* read-write */
};
diff --git a/spm/cactus/cactus_def.h b/spm/cactus/cactus_def.h
index 0d3df2e..5a4a5dd 100644
--- a/spm/cactus/cactus_def.h
+++ b/spm/cactus/cactus_def.h
@@ -24,7 +24,7 @@
* RX/TX buffer used by VM's in SPM for memory sharing
* Each VM allocated 2 pages, one for RX and one for TX buffer.
*/
-#define CACTUS_RX_BASE ULL(0x7200000)
+#define CACTUS_RX_BASE ULL(0x7300000)
#define CACTUS_TX_BASE CACTUS_RX_BASE + PAGE_SIZE
#define CACTUS_RX_TX_SIZE PAGE_SIZE * 2
@@ -41,5 +41,7 @@
*/
#define PRIMARY_UUID {0xb4b5671e, 0x4a904fe1, 0xb81ffb13, 0xdae1dacb}
#define SECONDARY_UUID {0xd1582309, 0xf02347b9, 0x827c4464, 0xf5578fc8}
+#define TERTIARY_UUID {0x79b55c73, 0x1d8c44b9, 0x859361e1, 0x770ad8d2}
+
#endif /* CACTUS_DEF_H */
diff --git a/spm/cactus/cactus_ffa_tests.c b/spm/cactus/cactus_ffa_tests.c
index 25c20b0..085923a 100644
--- a/spm/cactus/cactus_ffa_tests.c
+++ b/spm/cactus/cactus_ffa_tests.c
@@ -16,6 +16,7 @@
static const uint32_t primary_uuid[4] = PRIMARY_UUID;
static const uint32_t secondary_uuid[4] = SECONDARY_UUID;
+static const uint32_t tertiary_uuid[4] = TERTIARY_UUID;
static const uint32_t null_uuid[4] = {0};
struct feature_test {
@@ -116,15 +117,21 @@
const char *test_partition_info = "FFA Partition info interface";
const char *test_primary = "Get primary partition info";
const char *test_secondary = "Get secondary partition info";
+ const char *test_tertiary = "Get tertiary partition info";
const char *test_all = "Get all partitions info";
const struct ffa_partition_info expected_info[] = {
{.id = SPM_VM_ID_FIRST, .exec_context = 8, .properties = 0}, /* Primary partition info */
- {.id = 2, .exec_context = 2, .properties = 0} /* Secondary partition info */
+ {.id = SPM_VM_ID_SECOND, .exec_context = 2, .properties = 0}, /* Secondary partition info */
+ {.id = SPM_VM_ID_THIRD, .exec_context = 2, .properties = 0} /* Tertiary partition info */
};
announce_test_section_start(test_partition_info);
+ announce_test_start(test_tertiary);
+ ffa_partition_info_helper(mb, tertiary_uuid, &expected_info[2], 1);
+ announce_test_end(test_tertiary);
+
announce_test_start(test_secondary);
ffa_partition_info_helper(mb, secondary_uuid, &expected_info[1], 1);
announce_test_end(test_secondary);
@@ -134,7 +141,7 @@
announce_test_end(test_primary);
announce_test_start(test_all);
- ffa_partition_info_helper(mb, null_uuid, expected_info, 2);
+ ffa_partition_info_helper(mb, null_uuid, expected_info, 3);
announce_test_end(test_all);
ffa_partition_info_wrong_test();
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 31906d5..e833310 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -185,8 +185,32 @@
} else {
set_putc_impl(HVC_CALL_AS_STDOUT);
- NOTICE("Booting Secondary Cactus Secure Partition\n%s\n%s\n",
- build_message, version_string);
+ NOTICE("Booting Secondary Cactus Secure Partition (ID: %u)\n%s\n%s\n",
+ ffa_id, build_message, version_string);
+
+ if (ffa_id == SPM_VM_ID_THIRD) {
+ NOTICE("Mapping RXTX Region\n");
+
+ /* Declare RX/TX buffers at virtual FF-A instance */
+ static struct {
+ uint8_t rx[PAGE_SIZE];
+ uint8_t tx[PAGE_SIZE];
+ } __aligned(PAGE_SIZE) ffa_buffers;
+
+ /* Map RX/TX buffers */
+ smc_ret_values ret = ffa_rxtx_map((uintptr_t) &ffa_buffers.tx,
+ (uintptr_t) &ffa_buffers.rx,
+ sizeof(ffa_buffers.rx) / PAGE_SIZE);
+
+ if (ret.ret0 != FFA_SUCCESS_SMC32) {
+ ERROR("ffa_rxtx_map error (%lu)\n", ret.ret2);
+ panic();
+ }
+
+ /* Update mailbox with RX/TX buffer */
+ mb.send = (void *) &ffa_buffers.tx;
+ mb.recv = (void *) &ffa_buffers.rx;
+ }
}
NOTICE("FFA id: %u\n", ffa_id);
diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h
index 2b9cc2e..7096daf 100644
--- a/spm/common/sp_helpers.h
+++ b/spm/common/sp_helpers.h
@@ -12,6 +12,8 @@
#include <ffa_helpers.h>
#define SPM_VM_ID_FIRST (1)
+#define SPM_VM_ID_SECOND (2)
+#define SPM_VM_ID_THIRD (3)
#define SPM_VM_GET_COUNT (0xFF01)
#define SPM_VCPU_GET_COUNT (0xFF02)
diff --git a/tftf/tests/runtime_services/secure_service/ffa_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
index c90cac8..7ccf890 100644
--- a/tftf/tests/runtime_services/secure_service/ffa_helpers.c
+++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c
@@ -247,3 +247,16 @@
return tftf_smc(&args);
}
+
+/* Map the RXTX buffer */
+smc_ret_values ffa_rxtx_map(uintptr_t send, uintptr_t recv, uint32_t pages)
+{
+ smc_args args = {
+ .fid = FFA_RXTX_MAP_SMC64,
+ .arg1 = send,
+ .arg2 = recv,
+ .arg3 = pages
+ };
+
+ return tftf_smc(&args);
+}
diff --git a/tools/generate_json/generate_json.sh b/tools/generate_json/generate_json.sh
index 7405378..449733c 100755
--- a/tools/generate_json/generate_json.sh
+++ b/tools/generate_json/generate_json.sh
@@ -17,8 +17,9 @@
GENERATED_JSON=build/$2/$3/sp_layout.json
# To demonstrate communication between SP's, two cactus S-EL1 instances used.
-# cactus-primary and cactus-secondary has same binary but different
-# partition manifest.
+# To also test mapping of the RXTX region a third cactus S-EL1 instance is used.
+# cactus-primary, cactus-secondary and cactus-tertiary have same binary but
+# different partition manifests.
if [ "$1" == "cactus" ]; then
echo -e "{\n\t\"$1-primary\" : {\n \
\t\"image\": \"$1.bin\",\n \
@@ -26,7 +27,9 @@
\t\"owner\": \"SiP\"\n\t},\n\n\t\"$1-secondary\" : {\n \
\t\"image\": \"$1.bin\",\n \
\t\"pm\": \"../../../spm/$1/$1-secondary.dts\",\n \
- \t\"owner\": \"Plat\"\n \
+ \t\"owner\": \"Plat\"\n\t},\n\n\t\"$1-tertiary\" : {\n \
+ \t\"image\": \"$1.bin\",\n \
+ \t\"pm\": \"../../../spm/$1/$1-tertiary.dts\" \n \
}\n}" \
> "$GENERATED_JSON"
else