]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
refactor(errata_abi): factor in non-arm interconnect
authorSona Mathew <SonaRebecca.Mathew@arm.com>
Tue, 14 Mar 2023 19:02:03 +0000 (14:02 -0500)
committerSona Mathew <SonaRebecca.Mathew@arm.com>
Fri, 5 May 2023 18:23:10 +0000 (13:23 -0500)
Workaround to help enable the kernel to query errata status using the
errata abi feature for platforms with a non-arm interconnect.

Change-Id: I47b03eaee5a0a763056ae71883fa30dfacb9b3f7
Signed-off-by: Sona Mathew <SonaRebecca.Mathew@arm.com>
Makefile
make_helpers/defaults.mk
services/std_svc/errata_abi/cpu_errata_info.h
services/std_svc/errata_abi/errata_abi_main.c

index 21d65cfed6582d9c240210f3f301d4a5b2812441..b54787de3d0ca71da6387d87681949a7d5d3166b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1164,6 +1164,7 @@ $(eval $(call assert_booleans,\
         FEATURE_DETECTION \
        TRNG_SUPPORT \
        ERRATA_ABI_SUPPORT \
+       ERRATA_NON_ARM_INTERCONNECT \
        CONDITIONAL_CMO \
 )))
 
@@ -1297,6 +1298,7 @@ $(eval $(call add_defines,\
         CRYPTO_SUPPORT \
         TRNG_SUPPORT \
         ERRATA_ABI_SUPPORT \
+       ERRATA_NON_ARM_INTERCONNECT \
         USE_COHERENT_MEM \
         USE_DEBUGFS \
         ARM_IO_IN_DTB \
index 0916d1d4c5d0717ee285c83a9a5be0f825636301..26fd68ddea351ff7ebdfdb3ca961706f57ba0f98 100644 (file)
@@ -294,6 +294,9 @@ TRNG_SUPPORT                        := 0
 # Check to see if Errata ABI is supported
 ERRATA_ABI_SUPPORT             := 0
 
+# Check to enable Errata ABI for platforms with non-arm interconnect
+ERRATA_NON_ARM_INTERCONNECT    := 0
+
 # SMCCC PCI support
 SMC_PCI_SUPPORT                        := 0
 
index 168bc9556a4b471c202e80e1e4893b0b90706d14..ad05724f821e0d9ac9edfb31c5eb4433f3058761 100644 (file)
@@ -58,6 +58,8 @@ struct em_cpu{
        unsigned char em_rxpx_lo;       /* lowest revision of errata applicable for the cpu */
        unsigned char em_rxpx_hi;       /* highest revision of errata applicable for the cpu */
        bool errata_enabled;            /* indicate if errata enabled */
+       /* flag to indicate if errata query is based out of non-arm interconnect */
+       bool non_arm_interconnect;
 };
 
 struct em_cpu_list{
index 80fc39a56e08eb68a6c0e43a791c434a995997de..d473df6e2210d0ab55695e822e9c906a42d5313f 100644 (file)
@@ -384,27 +384,38 @@ struct em_cpu_list cpu_list[] = {
  * Function to do binary search and check for the specific errata ID
  * in the array of structures specific to the cpu identified.
  */
-int32_t binary_search(struct em_cpu_list *ptr, uint32_t erratum_id,
-                       uint8_t rxpx_val)
+int32_t binary_search(struct em_cpu_list *ptr, uint32_t erratum_id, uint8_t rxpx_val)
 {
        int low_index = 0U, mid_index = 0U;
 
        int high_index = MAX_ERRATA_ENTRIES - 1;
 
+       assert(ptr != NULL);
+
+       /*
+        * Pointer to the errata list of the cpu that matches
+        * extracted partnumber in the cpu list
+        */
+       struct em_cpu *erratum_ptr = NULL;
+
        while (low_index <= high_index) {
                mid_index = (low_index + high_index) / 2;
-               if (erratum_id < ptr->cpu_errata_list[mid_index].em_errata_id) {
+
+               erratum_ptr = &ptr->cpu_errata_list[mid_index];
+               assert(erratum_ptr != NULL);
+
+               if (erratum_id < erratum_ptr->em_errata_id) {
                        high_index = mid_index - 1;
-               } else if (erratum_id > ptr->cpu_errata_list[mid_index].em_errata_id) {
+               } else if (erratum_id > erratum_ptr->em_errata_id) {
                        low_index = mid_index + 1;
-               } else if (erratum_id == ptr->cpu_errata_list[mid_index].em_errata_id) {
-
-                       if (RXPX_RANGE(rxpx_val, ptr->cpu_errata_list[mid_index].em_rxpx_lo, \
-                               ptr->cpu_errata_list[mid_index].em_rxpx_hi)) {
-                                       if (ptr->cpu_errata_list[mid_index].errata_enabled) {
-                                               return EM_HIGHER_EL_MITIGATION;
-                                       }
-                                       return EM_AFFECTED;
+               } else if (erratum_id == erratum_ptr->em_errata_id) {
+                       if (RXPX_RANGE(rxpx_val, erratum_ptr->em_rxpx_lo, \
+                               erratum_ptr->em_rxpx_hi)) {
+                               if ((erratum_ptr->errata_enabled) && \
+                               (!(erratum_ptr->non_arm_interconnect))) {
+                                       return EM_HIGHER_EL_MITIGATION;
+                               }
+                               return EM_AFFECTED;
                        }
                        return EM_NOT_AFFECTED;
                }