test(ivy): S-EL0 partition using VHE

Starting from [1], Cactus remains the sample S-EL1 partition.
Ivy remains the sample "S-EL0 partition" either using the shim at S-EL1
(as of today), or leveraging Hafnium VHE (reason for this change).
The same code base is re-used by adding the IVY_SHIM toggle. IVY_SHIM=1
is default using the shim, or 0 to use VHE (and strip the shim out).
Using svc helper from spm/common/aarch64/sp_arch_helpers.S

We must modify generate_json.sh so it only adds the partition
information to the layout file for the sp given in arg1. This allows
the ability for sp's to pass flags to the script such as IVY_SHIM which
is used to vary the dts file included for ivy.

Typical build command for a VHE-enabled Ivy partition:
make CROSS_COMPILE=aarch64-none-elf- PLAT=fvp DEBUG=1 TESTS=spm
    ARM_ARCH_MINOR=5 BRANCH_PROTECTION=1 IVY_SHIM=0 ivy -j8

The intent is to create a dedicated tftf_config build config for the
VHE-enabled build in the CI.

[1] https://trustedfirmware-a-tests.readthedocs.io/en/latest/getting_started/build.html#cactus-and-ivy

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I34125b375b043c61c44ede558802d8ae757bd51f
diff --git a/spm/ivy/app/ivy_main.c b/spm/ivy/app/ivy_main.c
index 777ef82..232ab2e 100644
--- a/spm/ivy/app/ivy_main.c
+++ b/spm/ivy/app/ivy_main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -21,14 +21,20 @@
 {
 	u_register_t ret;
 	svc_args args;
+	ffa_id_t my_id;
 
 	set_putc_impl(SVC_CALL_AS_STDOUT);
 
-	args = (svc_args) {.fid = FFA_ID_GET};
+	/* Get FF-A id. */
+	args = (svc_args){.fid = FFA_ID_GET};
 	ret = sp_svc(&args);
+	if (ret != FFA_SUCCESS_SMC32) {
+		ERROR("Cannot get FF-A id.\n");
+		panic();
+	}
+	my_id = (ffa_id_t)args.arg2;
 
-	NOTICE("Booting Secure Partition (ID: %x)\n",
-		(unsigned int)args.arg2);
+	NOTICE("Booting Secure Partition (ID: %x)\n", my_id);
 	NOTICE("%s\n", build_message);
 	NOTICE("%s\n", version_string);
 
@@ -37,6 +43,8 @@
 	ret = sp_svc(&args);
 
 	while (1) {
+		ffa_id_t req_sender = (ffa_id_t)(args.arg1 >> 16);
+
 		if (ret != FFA_MSG_SEND_DIRECT_REQ_SMC32) {
 			ERROR("unknown FF-A request %lx\n", ret);
 			goto init;
@@ -44,8 +52,10 @@
 
 		VERBOSE("Received request: %lx\n", args.arg3);
 
+
 		args.fid = FFA_MSG_SEND_DIRECT_RESP_SMC32;
-		args.arg1 = 0x80020000;
+		args.arg1 = ((u_register_t)my_id) << 16 |
+			    (u_register_t)req_sender;
 		args.arg2 = 0;
 		args.arg3 = 0;