tftf(rme): check if RMM doesn't leak Realm contents in SVE registers
This test verifies that the Realm contents in SVE registers are not
seen by NS world once the Realm returns back to the host. This test
performs the below steps:
1. Set NS world SVE VQ to max and write a known pattern.
2. Set NS world ZCR_EL2 with VQ as 0 (128 bits).
3. Create Realm with max SVE VQ
4. Call Realm to fill in Z registers
5. Once Realm returns, NS sets ZCR_EL2 with max VQ and reads the
Z registers.
6. The upper bits of Z registers must be either 0 or the old values
filled by NS world at step 1.
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I8205190d1ce9c37b99d35cf5b15df21ca9b838c3
diff --git a/include/lib/extensions/sve.h b/include/lib/extensions/sve.h
index 5907ef9..60432a5 100644
--- a/include/lib/extensions/sve.h
+++ b/include/lib/extensions/sve.h
@@ -20,6 +20,7 @@
#define SVE_VECTOR_LEN_BYTES 256
#define SVE_NUM_VECTORS 32
+#define SVE_VQ_ARCH_MIN (0U)
#define SVE_VQ_ARCH_MAX ((1 << ZCR_EL2_SVE_VL_WIDTH) - 1)
/* convert SVE VL in bytes to VQ */
@@ -28,6 +29,9 @@
/* convert SVE VQ to bits */
#define SVE_VQ_TO_BITS(vq) (((vq) + 1U) << 7U)
+/* convert SVE VQ to bytes */
+#define SVE_VQ_TO_BYTES(vq) (SVE_VQ_TO_BITS(vq) / 8)
+
/* get a random SVE VQ b/w 0 to SVE_VQ_ARCH_MAX */
#define SVE_GET_RANDOM_VQ (rand() % (SVE_VQ_ARCH_MAX + 1))