Commit 62250d39 authored by Manish Pandey's avatar Manish Pandey Committed by TrustedFirmware Code Review
Browse files

Merge "Tegra: enable EHF for watchdog timer interrupts" into integration

parents 61903ad7 adb20a17
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <arch_helpers.h> #include <arch_helpers.h>
#include <bl31/interrupt_mgmt.h> #include <bl31/interrupt_mgmt.h>
#include <bl31/ehf.h>
#include <common/bl_common.h> #include <common/bl_common.h>
#include <common/debug.h> #include <common/debug.h>
#include <context.h> #include <context.h>
...@@ -25,6 +26,15 @@ ...@@ -25,6 +26,15 @@
/* Legacy FIQ used by earlier Tegra platforms */ /* Legacy FIQ used by earlier Tegra platforms */
#define LEGACY_FIQ_PPI_WDT 28U #define LEGACY_FIQ_PPI_WDT 28U
/* Install priority level descriptors for each dispatcher */
ehf_pri_desc_t plat_exceptions[] = {
EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_TEGRA_WDT_PRIO),
};
/* Expose priority descriptors to Exception Handling Framework */
EHF_REGISTER_PRIORITIES(plat_exceptions, ARRAY_SIZE(plat_exceptions),
PLAT_PRI_BITS);
/******************************************************************************* /*******************************************************************************
* Static variables * Static variables
******************************************************************************/ ******************************************************************************/
...@@ -35,26 +45,17 @@ static pcpu_fiq_state_t fiq_state[PLATFORM_CORE_COUNT]; ...@@ -35,26 +45,17 @@ static pcpu_fiq_state_t fiq_state[PLATFORM_CORE_COUNT];
/******************************************************************************* /*******************************************************************************
* Handler for FIQ interrupts * Handler for FIQ interrupts
******************************************************************************/ ******************************************************************************/
static uint64_t tegra_fiq_interrupt_handler(uint32_t id, static int tegra_fiq_interrupt_handler(unsigned int id, unsigned int flags,
uint32_t flags, void *handle, void *cookie)
void *handle,
void *cookie)
{ {
cpu_context_t *ctx = cm_get_context(NON_SECURE); cpu_context_t *ctx = cm_get_context(NON_SECURE);
el3_state_t *el3state_ctx = get_el3state_ctx(ctx); el3_state_t *el3state_ctx = get_el3state_ctx(ctx);
uint32_t cpu = plat_my_core_pos(); uint32_t cpu = plat_my_core_pos();
uint32_t irq;
(void)id;
(void)flags; (void)flags;
(void)handle; (void)handle;
(void)cookie; (void)cookie;
/*
* Read the pending interrupt ID
*/
irq = plat_ic_get_pending_interrupt_id();
/* /*
* Jump to NS world only if the NS world's FIQ handler has * Jump to NS world only if the NS world's FIQ handler has
* been registered * been registered
...@@ -90,7 +91,7 @@ static uint64_t tegra_fiq_interrupt_handler(uint32_t id, ...@@ -90,7 +91,7 @@ static uint64_t tegra_fiq_interrupt_handler(uint32_t id,
* disable the routing so that we can mark it as "complete" in the * disable the routing so that we can mark it as "complete" in the
* GIC later. * GIC later.
*/ */
if (irq == LEGACY_FIQ_PPI_WDT) { if (id == LEGACY_FIQ_PPI_WDT) {
tegra_fc_disable_fiq_to_ccplex_routing(); tegra_fc_disable_fiq_to_ccplex_routing();
} }
#endif #endif
...@@ -98,10 +99,7 @@ static uint64_t tegra_fiq_interrupt_handler(uint32_t id, ...@@ -98,10 +99,7 @@ static uint64_t tegra_fiq_interrupt_handler(uint32_t id,
/* /*
* Mark this interrupt as complete to avoid a FIQ storm. * Mark this interrupt as complete to avoid a FIQ storm.
*/ */
if (irq < 1022U) { plat_ic_end_of_interrupt(id);
(void)plat_ic_acknowledge_interrupt();
plat_ic_end_of_interrupt(irq);
}
return 0; return 0;
} }
...@@ -111,23 +109,13 @@ static uint64_t tegra_fiq_interrupt_handler(uint32_t id, ...@@ -111,23 +109,13 @@ static uint64_t tegra_fiq_interrupt_handler(uint32_t id,
******************************************************************************/ ******************************************************************************/
void tegra_fiq_handler_setup(void) void tegra_fiq_handler_setup(void)
{ {
uint32_t flags;
int32_t rc;
/* return if already registered */ /* return if already registered */
if (fiq_handler_active == 0U) { if (fiq_handler_active == 0U) {
/* /*
* Register an interrupt handler for FIQ interrupts generated for * Register an interrupt handler for FIQ interrupts generated for
* NS interrupt sources * NS interrupt sources
*/ */
flags = 0U; ehf_register_priority_handler(PLAT_TEGRA_WDT_PRIO, tegra_fiq_interrupt_handler);
set_interrupt_rm_flag((flags), (NON_SECURE));
rc = register_interrupt_type_handler(INTR_TYPE_EL3,
tegra_fiq_interrupt_handler,
flags);
if (rc != 0) {
panic();
}
/* handler is now active */ /* handler is now active */
fiq_handler_active = 1; fiq_handler_active = 1;
......
...@@ -86,5 +86,10 @@ ...@@ -86,5 +86,10 @@
#define MAX_IO_DEVICES U(0) #define MAX_IO_DEVICES U(0)
#define MAX_IO_HANDLES U(0) #define MAX_IO_HANDLES U(0)
/*******************************************************************************
* Platform macros to support exception handling framework
******************************************************************************/
#define PLAT_PRI_BITS U(3)
#define PLAT_TEGRA_WDT_PRIO U(0x40)
#endif /* PLATFORM_DEF_H */ #endif /* PLATFORM_DEF_H */
...@@ -20,6 +20,10 @@ $(eval $(call add_define,PLAT_LOG_LEVEL_ASSERT)) ...@@ -20,6 +20,10 @@ $(eval $(call add_define,PLAT_LOG_LEVEL_ASSERT))
PLAT_XLAT_TABLES_DYNAMIC := 1 PLAT_XLAT_TABLES_DYNAMIC := 1
$(eval $(call add_define,PLAT_XLAT_TABLES_DYNAMIC)) $(eval $(call add_define,PLAT_XLAT_TABLES_DYNAMIC))
# Enable exception handling at EL3
EL3_EXCEPTION_HANDLING := 1
GICV2_G0_FOR_EL3 := 1
# Enable PSCI v1.0 extended state ID format # Enable PSCI v1.0 extended state ID format
PSCI_EXTENDED_STATE_ID := 1 PSCI_EXTENDED_STATE_ID := 1
......
...@@ -214,9 +214,9 @@ void plat_late_platform_setup(void) ...@@ -214,9 +214,9 @@ void plat_late_platform_setup(void)
/* Secure IRQs for Tegra186 */ /* Secure IRQs for Tegra186 */
static const interrupt_prop_t tegra186_interrupt_props[] = { static const interrupt_prop_t tegra186_interrupt_props[] = {
INTR_PROP_DESC(TEGRA186_TOP_WDT_IRQ, GIC_HIGHEST_SEC_PRIORITY, INTR_PROP_DESC(TEGRA186_TOP_WDT_IRQ, PLAT_TEGRA_WDT_PRIO,
GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE), GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE),
INTR_PROP_DESC(TEGRA186_AON_WDT_IRQ, GIC_HIGHEST_SEC_PRIORITY, INTR_PROP_DESC(TEGRA186_AON_WDT_IRQ, PLAT_TEGRA_WDT_PRIO,
GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE) GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE)
}; };
......
...@@ -275,9 +275,9 @@ void plat_early_platform_setup(void) ...@@ -275,9 +275,9 @@ void plat_early_platform_setup(void)
/* Secure IRQs for Tegra194 */ /* Secure IRQs for Tegra194 */
static const interrupt_prop_t tegra194_interrupt_props[] = { static const interrupt_prop_t tegra194_interrupt_props[] = {
INTR_PROP_DESC(TEGRA194_TOP_WDT_IRQ, GIC_HIGHEST_SEC_PRIORITY, INTR_PROP_DESC(TEGRA194_TOP_WDT_IRQ, PLAT_TEGRA_WDT_PRIO,
GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE), GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE),
INTR_PROP_DESC(TEGRA194_AON_WDT_IRQ, GIC_HIGHEST_SEC_PRIORITY, INTR_PROP_DESC(TEGRA194_AON_WDT_IRQ, PLAT_TEGRA_WDT_PRIO,
GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE) GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE)
}; };
......
...@@ -179,9 +179,9 @@ void plat_early_platform_setup(void) ...@@ -179,9 +179,9 @@ void plat_early_platform_setup(void)
/* Secure IRQs for Tegra186 */ /* Secure IRQs for Tegra186 */
static const interrupt_prop_t tegra210_interrupt_props[] = { static const interrupt_prop_t tegra210_interrupt_props[] = {
INTR_PROP_DESC(TEGRA210_TIMER1_IRQ, GIC_HIGHEST_SEC_PRIORITY, INTR_PROP_DESC(TEGRA210_TIMER1_IRQ, PLAT_TEGRA_WDT_PRIO,
GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE), GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE),
INTR_PROP_DESC(TEGRA210_WDT_CPU_LEGACY_FIQ, GIC_HIGHEST_SEC_PRIORITY, INTR_PROP_DESC(TEGRA210_WDT_CPU_LEGACY_FIQ, PLAT_TEGRA_WDT_PRIO,
GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE), GICV2_INTR_GROUP0, GIC_INTR_CFG_EDGE),
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment