fix: implement PVM SMCCC VERSION emulation

In order to support the upstream kernel FF-A driver running in a PVM on
top of Hafnium, implement PSCI_FEATURES SMCC_VERSION emulation and
return v1.2 supported.

Change-Id: I3edb1d8834e85ee3a39013cdcc58ca8054a5a6b9
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/src/arch/aarch64/hypervisor/psci_handler.c b/src/arch/aarch64/hypervisor/psci_handler.c
index 3c78e57..053afad 100644
--- a/src/arch/aarch64/hypervisor/psci_handler.c
+++ b/src/arch/aarch64/hypervisor/psci_handler.c
@@ -47,6 +47,7 @@
 	 * This blocks more calls than just PSCI so it may need to be made more
 	 * lenient in future.
 	 */
+
 	if (plat_psci_version_get() == 0) {
 		*ret = SMCCC_ERROR_UNKNOWN;
 		return (func & SMCCC_SERVICE_CALL_MASK) ==
@@ -60,6 +61,10 @@
 
 	case PSCI_FEATURES:
 		switch (arg0 & ~SMCCC_CONVENTION_MASK) {
+		case SMCCC_VERSION_FUNC_ID:
+			*ret = SMCCC_VERSION_1_2;
+			break;
+
 		case PSCI_CPU_SUSPEND:
 			if (plat_psci_version_get() == PSCI_VERSION_0_2) {
 				/*
diff --git a/src/arch/aarch64/smc.h b/src/arch/aarch64/smc.h
index d35d2a6..dd7db0e 100644
--- a/src/arch/aarch64/smc.h
+++ b/src/arch/aarch64/smc.h
@@ -39,6 +39,9 @@
 
 #define SMCCC_ERROR_UNKNOWN  (-1)
 
+#define SMCCC_VERSION_FUNC_ID	0x80000000
+#define SMCCC_VERSION_1_2	0x10002
+
 /* clang-format on */
 
 struct ffa_value smc32(uint32_t func, uint32_t arg0, uint32_t arg1,