feat(smc): add test for pmf version check

PMF is moved under vendor specific EL3 range, part of this
we have introduced each sub-service have an version scheme[1].

Add a simple test to check if the sub-service version
is probed.

[1]:
https://trustedfirmware-a.readthedocs.io/en/latest/components/ven-el3-service.html

Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
Change-Id: I885cd1378a8025371172e5cd82fdd111d6832619
diff --git a/include/runtime_services/pmf.h b/include/runtime_services/pmf.h
index 8b39fcb..5192999 100644
--- a/include/runtime_services/pmf.h
+++ b/include/runtime_services/pmf.h
@@ -24,13 +24,16 @@
 #define PMF_CACHE_MAINT		(1 << 0)
 #define PMF_NO_CACHE_MAINT	0
 
+#define PMF_SMC_VERSION		U(0x00000001)
 /*
  * Defines for PMF SMC function ids.
  */
 #ifndef __aarch64__
 #define PMF_SMC_GET_TIMESTAMP	0x87000020
+#define PMF_SMC_GET_VERSION	0x87000021
 #else
 #define PMF_SMC_GET_TIMESTAMP	0xC7000020
+#define PMF_SMC_GET_VERSION	0xC7000021
 #endif
 
 /* Following are the supported PMF service IDs */
diff --git a/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c b/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
index 3c1fdaf..43685e4 100644
--- a/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
+++ b/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
@@ -63,6 +63,26 @@
 	return ret.ret0;
 }
 
+/*
+ * Simple check to see if we are able to probe
+ * pmf versioning under vendor specific el3.
+ */
+test_result_t test_check_pmf_version(void)
+{
+	smc_args args = { 0 };
+	smc_ret_values ret;
+
+	args.fid = PMF_SMC_GET_VERSION;
+	ret = tftf_smc(&args);
+
+	if (ret.ret1 != PMF_SMC_VERSION)
+	{
+		return TEST_RESULT_FAIL;
+	}
+
+	return TEST_RESULT_SUCCESS;
+}
+
 static int cycles_to_ns(uint64_t cycles, uint64_t freq, uint64_t *ns)
 {
 	if (cycles > UINT64_MAX / 1000000000 || freq == 0)
diff --git a/tftf/tests/tests-smc.xml b/tftf/tests/tests-smc.xml
index b66c7a2..d63cfc3 100644
--- a/tftf/tests/tests-smc.xml
+++ b/tftf/tests/tests-smc.xml
@@ -20,6 +20,7 @@
      <testcase name="Unknown SMC" function="test_unknown_smc" />
      <testcase name="Query Standard Service" function="test_query_std_svc" />
      <testcase name="Query Vendor-Specific Service" function="test_query_ven_el3_svc" />
+     <testcase name="Probe PMF Version" function="test_check_pmf_version" />
   </testsuite>
 
 </testsuites>