]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(fvp): introduce PLATFORM_TEST_RAS_FFH config
authorManish Pandey <manish.pandey2@arm.com>
Mon, 24 Apr 2023 13:58:55 +0000 (14:58 +0100)
committerManish Pandey <manish.pandey2@arm.com>
Thu, 4 May 2023 13:39:53 +0000 (14:39 +0100)
While doing RAS related tests there were few patches related with
fault injection and handling were applied through CI hooks.
These patches were invisible as they were applied and removed after the
build is done.

This patch introduces build macro PLATFORM_TEST_RAS_FFH and moves the
patches applied through CI under this.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Iddba52f3ebf21f575a473e50c607a944391156b9

plat/arm/board/fvp/aarch64/fvp_ras.c
plat/arm/board/fvp/include/platform_def.h
plat/arm/board/fvp/platform.mk

index 759f6d0d86ed7e1b58e2ae42861f6ea80d6f0ff1..f9b96341aa6c5936af2f0e1b8bd74729eb1a0451 100644 (file)
@@ -4,12 +4,63 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <inttypes.h>
+#include <stdint.h>
+
 #include <lib/extensions/ras.h>
+#include <services/sdei.h>
+
+#ifdef PLATFORM_TEST_RAS_FFH
+static int injected_fault_handler(const struct err_record_info *info,
+               int probe_data, const struct err_handler_data *const data)
+{
+       uint64_t status;
+       int ret;
+
+       /*
+        * The faulting error record is already selected by the SER probe
+        * function.
+        */
+       status = read_erxstatus_el1();
+
+       ERROR("Fault reported by system error record %d on 0x%lx: status=0x%" PRIx64 "\n",
+                       probe_data, read_mpidr_el1(), status);
+       ERROR(" exception reason=%u syndrome=0x%" PRIx64 "\n", data->ea_reason,
+                       data->flags);
+
+       /* Clear error */
+       write_erxstatus_el1(status);
+
+       ret = sdei_dispatch_event(5000);
+       if (ret < 0) {
+               ERROR("Can't dispatch event to SDEI\n");
+               panic();
+       } else {
+               INFO("SDEI event dispatched\n");
+       }
+
+       return 0;
+}
+
+void plat_handle_uncontainable_ea(void)
+{
+       /* Do not change the string, CI expects it. Wait forever */
+       INFO("Injected Uncontainable Error\n");
+       while (true) {
+               wfe();
+       }
+}
+#endif
 
 struct ras_interrupt fvp_ras_interrupts[] = {
 };
 
 struct err_record_info fvp_err_records[] = {
+#ifdef PLATFORM_TEST_RAS_FFH
+       /* Record for injected fault */
+       ERR_RECORD_SYSREG_V1(0, 2, ras_err_ser_probe_sysreg,
+                       injected_fault_handler, NULL),
+#endif
 };
 
 REGISTER_ERR_RECORD_INFO(fvp_err_records);
index 79d7451efc1ac69a0ccf57dd6527ab91de0af300..9e72ba08c84c4d42538b827686ff4d92f5d72e1f 100644 (file)
@@ -397,7 +397,17 @@ defined(IMAGE_BL2) && MEASURED_BOOT
 #define PLAT_SDEI_DP_EVENT_MAX_CNT     ARM_SDEI_DP_EVENT_MAX_CNT
 #define PLAT_SDEI_DS_EVENT_MAX_CNT     ARM_SDEI_DS_EVENT_MAX_CNT
 #else
-#define PLAT_ARM_PRIVATE_SDEI_EVENTS   ARM_SDEI_PRIVATE_EVENTS
+  #if PLATFORM_TEST_RAS_FFH
+  #define PLAT_ARM_PRIVATE_SDEI_EVENTS \
+       ARM_SDEI_PRIVATE_EVENTS, \
+       SDEI_EXPLICIT_EVENT(5000, SDEI_MAPF_NORMAL), \
+       SDEI_EXPLICIT_EVENT(5001, SDEI_MAPF_NORMAL), \
+       SDEI_EXPLICIT_EVENT(5002, SDEI_MAPF_NORMAL), \
+       SDEI_EXPLICIT_EVENT(5003, SDEI_MAPF_CRITICAL), \
+       SDEI_EXPLICIT_EVENT(5004, SDEI_MAPF_CRITICAL)
+  #else
+  #define PLAT_ARM_PRIVATE_SDEI_EVENTS ARM_SDEI_PRIVATE_EVENTS
+  #endif
 #define PLAT_ARM_SHARED_SDEI_EVENTS    ARM_SDEI_SHARED_EVENTS
 #endif
 
index ea3f9548617a5b44a71a3f13bf85dfc7661fa591..f2df780c65f8c7962914c33e35560fb47849acf8 100644 (file)
@@ -505,6 +505,11 @@ endif
 
 PSCI_OS_INIT_MODE      :=      1
 
+ifeq (${SPD},spmd)
+BL31_SOURCES   +=      plat/arm/board/fvp/fvp_spmd.c
+endif
+
+# Test specific macros, keep them at bottom of this file
 $(eval $(call add_define,PLATFORM_TEST_EA_FFH))
 ifeq (${PLATFORM_TEST_EA_FFH}, 1)
     ifeq (${HANDLE_EA_EL3_FIRST_NS}, 0)
@@ -513,6 +518,9 @@ ifeq (${PLATFORM_TEST_EA_FFH}, 1)
 BL31_SOURCES   += plat/arm/board/fvp/aarch64/fvp_ea.c
 endif
 
-ifeq (${SPD},spmd)
-BL31_SOURCES   +=      plat/arm/board/fvp/fvp_spmd.c
+$(eval $(call add_define,PLATFORM_TEST_RAS_FFH))
+ifeq (${PLATFORM_TEST_RAS_FFH}, 1)
+    ifeq (${RAS_EXTENSION}, 0)
+         $(error "PLATFORM_TEST_RAS_FFH expects RAS_EXTENSION to be 1")
+    endif
 endif