fix(errata-abi): add support for handling split workarounds
Certain erratum workarounds like Neoverse N1 1542419, need a part
of their mitigation done in EL3 and the rest in lower EL. But currently
such workarounds return HIGHER_EL_MITIGATION which indicates that the
erratum has already been mitigated by a higher EL(EL3 in this case)
which causes the lower EL to not apply it's part of the mitigation.
This patch fixes this issue by adding support for split workarounds
so that on certain errata we return AFFECTED even though EL3 has
applied it's workaround. This is done by reusing the chosen field of
erratum_entry structure into a bitfield that has two bitfields -
Bit 0 indicates that the erratum has been enabled in build,
Bit 1 indicates that the erratum is a split workaround and should
return AFFECTED instead of HIGHER_EL_MITIGATION.
SDEN documentation:
https://developer.arm.com/documentation/SDEN885747/latest
Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: Iec94d665b5f55609507a219a7d1771eb75e7f4a7
diff --git a/include/lib/cpus/errata.h b/include/lib/cpus/errata.h
index 10b949f..9eae276 100644
--- a/include/lib/cpus/errata.h
+++ b/include/lib/cpus/errata.h
@@ -42,6 +42,12 @@
uint32_t id;
/* Denote CVEs with their year or errata with 0 */
uint16_t cve;
+ /*
+ * a bitfield:
+ * bit 0 - denotes if the erratum is enabled in build.
+ * bit 1 - denotes if the erratum workaround is split and
+ * also needs to be implemented at a lower EL.
+ */
uint8_t chosen;
uint8_t _alignment;
} __packed;
@@ -96,4 +102,11 @@
/* Macro to get CPU revision code for checking errata version compatibility. */
#define CPU_REV(r, p) ((r << 4) | p)
+/* Used for errata that have split workaround */
+#define SPLIT_WA 1
+
+/* chosen bitfield entries */
+#define WA_ENABLED_MASK BIT(0)
+#define SPLIT_WA_MASK BIT(1)
+
#endif /* ERRATA_H */