summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-06-03 07:30:07 -0600
committerCommit Bot <commit-bot@chromium.org>2019-06-06 14:43:51 +0000
commitadfc20841f18f3ad52fd90d193785890ea86a7fc (patch)
treeae001c51a8f07268ad44b2836f1eadf4b09f3daa
parentf3cf4ee5b38d75b87aba60562f6e28aa5cd00f3e (diff)
downloadchrome-ec-adfc20841f18f3ad52fd90d193785890ea86a7fc.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/+/1644210 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--chip/ish/power_mgt.c10
-rw-r--r--core/minute-ia/ia_structs.h2
-rw-r--r--core/minute-ia/interrupts.c4
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();
}
/*