diff options
author | Jett Rink <jettrink@chromium.org> | 2019-06-03 07:30:07 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-04 21:39:55 +0000 |
commit | 307ec620c4d3d6532fa353e6201bf39c197ced91 (patch) | |
tree | aad38dd7883b76765721fa63c8181beb0982c7d6 | |
parent | 1722f074ed3cc5eaa948be1cdbfc3294cf0865d4 (diff) | |
download | chrome-ec-307ec620c4d3d6532fa353e6201bf39c197ced91.tar.gz |
ish: reload watchdog after lower power exit
Reload the watchdog timer immediately after exiting from D0ix before
re-enabling the reset of the IRQs.
Also re-enable all ISRs in a batch while interrupts are disabled to
limit the number of context switched if multiple interrupts are pending.
BRANCH=none
BUG=b:133190570
TEST=let arcada enter and exit D0i[0123] without issue for a couple of
minutes. There are not adverse affects of this change.
Change-Id: I3ef5878b0618a0c1858664cad061d415329d4302
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1644212
-rw-r--r-- | chip/ish/power_mgt.c | 10 | ||||
-rw-r--r-- | core/minute-ia/ia_structs.h | 2 | ||||
-rw-r--r-- | core/minute-ia/interrupts.c | 4 |
3 files changed, 15 insertions, 1 deletions
diff --git a/chip/ish/power_mgt.c b/chip/ish/power_mgt.c index e61838b953..26cc42e104 100644 --- a/chip/ish/power_mgt.c +++ b/chip/ish/power_mgt.c @@ -12,6 +12,7 @@ #include "system.h" #include "task.h" #include "util.h" +#include "watchdog.h" #ifdef CONFIG_ISH_PM_DEBUG #define CPUTS(outstr) cputs(CC_SYSTEM, outstr) @@ -363,6 +364,9 @@ static void enter_d0i1(void) t1 = __hw_clock_source_read(); log_pm_stat(&pm_stats.d0i1, t0, t1); + /* Reload watchdog before enabling interrupts again */ + watchdog_reload(); + /* restore interrupts */ task_disable_irq(ISH_PMU_WAKEUP_IRQ); restore_interrupts(current_irq_map); @@ -413,6 +417,9 @@ static void enter_d0i2(void) pm_ctx.aon_share->pm_state = ISH_PM_STATE_D0; log_pm_stat(&pm_stats.d0i2, t0, t1); + /* Reload watchdog before enabling interrupts again */ + watchdog_reload(); + /* restore interrupts */ task_disable_irq(ISH_PMU_WAKEUP_IRQ); restore_interrupts(current_irq_map); @@ -463,6 +470,9 @@ static void enter_d0i3(void) pm_ctx.aon_share->pm_state = ISH_PM_STATE_D0; log_pm_stat(&pm_stats.d0i3, t0, t1); + /* Reload watchdog before enabling interrupts again */ + watchdog_reload(); + /* restore interrupts */ task_disable_irq(ISH_PMU_WAKEUP_IRQ); restore_interrupts(current_irq_map); diff --git a/core/minute-ia/ia_structs.h b/core/minute-ia/ia_structs.h index 08447cb242..29bbb6c005 100644 --- a/core/minute-ia/ia_structs.h +++ b/core/minute-ia/ia_structs.h @@ -8,7 +8,7 @@ #ifndef __ASSEMBLER__ -#include <stdint.h> +#include "common.h" /** diff --git a/core/minute-ia/interrupts.c b/core/minute-ia/interrupts.c index a4a3569c22..3ce0e2a2a4 100644 --- a/core/minute-ia/interrupts.c +++ b/core/minute-ia/interrupts.c @@ -13,6 +13,7 @@ #include "irq_handler.h" #include "registers.h" #include "task_defs.h" +#include "task.h" #include "util.h" /* Console output macros */ @@ -81,10 +82,13 @@ void restore_interrupts(uint64_t irq_map) { int i; + /* Disable interrupts until everything is unmasked */ + interrupt_disable(); for (i = 0; i < ISH_MAX_IOAPIC_IRQS; i++) { if (((uint64_t)0x1 << i) & irq_map) unmask_interrupt(i); } + interrupt_enable(); } /* |