ARM platforms: Enable SDEI
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>
Fri, 22 Sep 2017 07:32:10 +0000 (08:32 +0100)
committerJeenu Viswambharan <jeenu.viswambharan@arm.com>
Mon, 13 Nov 2017 08:38:51 +0000 (08:38 +0000)
Support SDEI on ARM platforms using frameworks implemented in earlier
patches by defining and exporting SDEI events: this patch defines the
standard event 0, and a handful of shared and private dynamic events.

Change-Id: I9d3d92a92cff646b8cc55eabda78e140deaa24e1
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
include/plat/arm/common/arm_def.h
plat/arm/common/aarch64/arm_sdei.c [new file with mode: 0644]
plat/arm/common/arm_common.mk

index 5177b06ece5b96f6f4d5610ee535cb2b687798ca..b8955afcc48320b7495f7fec0abb9b5b4661e5db 100644 (file)
                        GIC_INTR_CFG_EDGE)
 
 #define ARM_G0_IRQ_PROPS(grp) \
-       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, PLAT_SDEI_NORMAL_PRI, grp, \
                        GIC_INTR_CFG_EDGE), \
        INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
                        GIC_INTR_CFG_EDGE)
 /* ARM platforms use 3 upper bits of secure interrupt priority */
 #define ARM_PRI_BITS                   3
 
+/* SGI used for SDEI signalling */
+#define ARM_SDEI_SGI                   ARM_IRQ_SEC_SGI_0
+
+/* ARM SDEI dynamic private event numbers */
+#define ARM_SDEI_DP_EVENT_0            1000
+#define ARM_SDEI_DP_EVENT_1            1001
+#define ARM_SDEI_DP_EVENT_2            1002
+
+/* ARM SDEI dynamic shared event numbers */
+#define ARM_SDEI_DS_EVENT_0            2000
+#define ARM_SDEI_DS_EVENT_1            2001
+#define ARM_SDEI_DS_EVENT_2            2002
+
 #endif /* __ARM_DEF_H__ */
diff --git a/plat/arm/common/aarch64/arm_sdei.c b/plat/arm/common/aarch64/arm_sdei.c
new file mode 100644 (file)
index 0000000..514800c
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/* SDEI configuration for ARM platforms */
+
+#include <ehf.h>
+#include <platform_def.h>
+#include <sdei.h>
+
+/* Private event mappings */
+static sdei_ev_map_t arm_private_sdei[] = {
+       /* Event 0 */
+       SDEI_DEFINE_EVENT_0(ARM_SDEI_SGI),
+
+       /* Dynamic private events */
+       SDEI_PRIVATE_EVENT(ARM_SDEI_DP_EVENT_0, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC),
+       SDEI_PRIVATE_EVENT(ARM_SDEI_DP_EVENT_1, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC),
+       SDEI_PRIVATE_EVENT(ARM_SDEI_DP_EVENT_2, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC),
+};
+
+/* Shared event mappings */
+static sdei_ev_map_t arm_shared_sdei[] = {
+       /* Dynamic shared events */
+       SDEI_SHARED_EVENT(ARM_SDEI_DS_EVENT_0, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC),
+       SDEI_SHARED_EVENT(ARM_SDEI_DS_EVENT_1, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC),
+       SDEI_SHARED_EVENT(ARM_SDEI_DS_EVENT_2, SDEI_DYN_IRQ, SDEI_MAPF_DYNAMIC),
+};
+
+/* Export ARM SDEI events */
+REGISTER_SDEI_MAP(arm_private_sdei, arm_shared_sdei);
index a3cd9d85013ba45dc3e76ff69f9abdc51bed6950..17acae52f74cf72d0aebf9526994c608bf88d696 100644 (file)
@@ -188,6 +188,10 @@ ifeq (${EL3_EXCEPTION_HANDLING},1)
 BL31_SOURCES           +=      plat/arm/common/aarch64/arm_ehf.c
 endif
 
+ifeq (${SDEI_SUPPORT},1)
+BL31_SOURCES           +=      plat/arm/common/aarch64/arm_sdei.c
+endif
+
 ifneq (${TRUSTED_BOARD_BOOT},0)
 
     # Include common TBB sources