summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-07-29 17:07:52 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-30 03:54:36 +0000
commit73e3bc14c69b52207b0bd170f5fd1fa7d9c6bc9e (patch)
tree5b0543915b976f11d0e076e2d122005fe945441d /chip
parent31146a9a0acdf42ef5148a473242f77886fcbd2e (diff)
downloadchrome-ec-73e3bc14c69b52207b0bd170f5fd1fa7d9c6bc9e.tar.gz
npcx: rtc: Prevent locking a mutex in interrupt context
In the RTC interrupt, it calls host_set_single_event() directly, that eventually tries to lock a mutex. Trying to lock a mutex in the interrupt context should be forbidden. So move the call to a deferred function. BRANCH=None BUG=b:162434716 TEST=Running suspend_stress_test doesn't result any EC crash. Change-Id: I80d1f1d8cefa4b8d01e707edff602dfdc860fc35 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2327248 Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/npcx/gpio.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index 26d5345b22..d24525bad1 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -713,6 +713,14 @@ void __gpio_wk0efgh_interrupt(void)
}
}
+#ifdef CONFIG_HOSTCMD_RTC
+static void set_rtc_host_event(void)
+{
+ host_set_single_event(EC_HOST_EVENT_RTC);
+}
+DECLARE_DEFERRED(set_rtc_host_event);
+#endif
+
void __gpio_rtc_interrupt(void)
{
/* Check pending bit 7 */
@@ -720,7 +728,7 @@ void __gpio_rtc_interrupt(void)
if (NPCX_WKPND(MIWU_TABLE_0, MIWU_GROUP_4) & 0x80) {
/* Clear pending bit for WUI */
SET_BIT(NPCX_WKPCL(MIWU_TABLE_0, MIWU_GROUP_4), 7);
- host_set_single_event(EC_HOST_EVENT_RTC);
+ hook_call_deferred(&set_rtc_host_event_data, 0);
return;
}
#endif