feat(sme): add sme helper routines and add streaming sve support

This patch adds a few helper routines to set the Streaming SVE vector
length (SVL) in the SMCR_EL2 register, to enable/disable FEAT_SME_FA64
and to get CPU's Streaming SVE mode status.

This patch also makes SVE compare routines compatible for both normal
SVE and streaming SVE mode.

Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I7294bb17a85de395a321e99241704066662c90e8
diff --git a/tftf/tests/extensions/sme/test_sme.c b/tftf/tests/extensions/sme/test_sme.c
index 43cd8b0..39c6457 100644
--- a/tftf/tests/extensions/sme/test_sme.c
+++ b/tftf/tests/extensions/sme/test_sme.c
@@ -98,23 +98,23 @@
 	saved_smcr = read_smcr_el2();
 
 	/* Write SMCR_EL2 with the LEN max to find implemented width. */
-	write_smcr_el2(SME_SMCR_LEN_MAX);
+	write_smcr_el2(MASK(SMCR_ELX_RAZ_LEN));
 	isb();
 
 	len_max = (unsigned int)read_smcr_el2();
 	VERBOSE("Maximum SMCR_EL2.LEN value: 0x%x\n", len_max);
 	VERBOSE("Enumerating supported vector lengths...\n");
 	for (unsigned int i = 0; i <= len_max; i++) {
-		/* Load new value into SMCR_EL2.LEN */
+		/* Load new value into SMCR_EL2.RAZ_LEN */
 		reg = read_smcr_el2();
-		reg &= ~(SMCR_ELX_LEN_MASK << SMCR_ELX_LEN_SHIFT);
-		reg |= (i << SMCR_ELX_LEN_SHIFT);
+		reg &= ~(MASK(SMCR_ELX_RAZ_LEN));
+		reg |= INPLACE(SMCR_ELX_RAZ_LEN, i);
 		write_smcr_el2(reg);
 		isb();
 
 		/* Compute current and requested vector lengths in bits. */
 		current_vector_len = ((unsigned int)sme_rdsvl_1() * 8U);
-		requested_vector_len = (i+1U)*128U;
+		requested_vector_len = (i + 1U) * 128U;
 
 		/*
 		 * We count down from the maximum SMLEN value, so if the values
@@ -122,13 +122,16 @@
 		 */
 		if (current_vector_len == requested_vector_len) {
 			svl_max = current_vector_len;
-			VERBOSE("SUPPORTED:     %u bits (LEN=%u)\n", requested_vector_len, i);
+			VERBOSE("SUPPORTED:     %u bits (LEN=%u)\n",
+				requested_vector_len, i);
 		} else {
-			VERBOSE("NOT SUPPORTED:     %u bits (LEN=%u)\n", requested_vector_len, i);
+			VERBOSE("NOT SUPPORTED:     %u bits (LEN=%u)\n",
+				requested_vector_len, i);
 		}
 	}
 
-	INFO("Largest Supported Streaming Vector Length(SVL): %u bits \n", svl_max);
+	INFO("Largest Supported Streaming Vector Length(SVL): %u bits\n",
+	     svl_max);
 
 	/* Exiting Streaming SVE mode */
 	sme_smstop(SMSTOP_SM);