diff options
author | Dino Li <Dino.Li@ite.com.tw> | 2018-03-12 18:31:58 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-03-15 00:20:47 +0000 |
commit | 23d8aee6c30f922d4e0b27117764674d220a9d0b (patch) | |
tree | e7f959588c4f43bc741e1142ea76b0aabc1ecf5f /core/nds32 | |
parent | 328f25f8814ac73a8db37fbacf071082afa3afeb (diff) | |
download | chrome-ec-23d8aee6c30f922d4e0b27117764674d220a9d0b.tar.gz |
nds32: task: allow context switching if task_start() is called
We got a symptom that keyboard didn't work without connecting
servo board after this change (CL:897315) was merged.
This is because our uart RX will receive a data (0) with framing
error if RX level is low and trigger a re-scheduling request in
uart ISR (HOOKS task will be wake at later and then start the
task scheduling).
And that will cause we don't return to main() function to finish
all operations of initialization after uart_init() is called.
I think we will get the same symptom if GPIO/peripheral interrupts
are enabled and wake some task at initialization.
This change makes sure we will start the task scheduling if
task_start() is called.
BUG=none
BRANCH=none
TEST=With this change, keyboard works after EC reboot without
servo board connected.
Change-Id: I0bda84b1cb56ced6aad2a38b0786d1b336e77211
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/956794
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 70a258a192787766289a2804a012337ad0bccc17)
Reviewed-on: https://chromium-review.googlesource.com/963739
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'core/nds32')
-rw-r--r-- | core/nds32/switch.S | 1 | ||||
-rw-r--r-- | core/nds32/task.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/core/nds32/switch.S b/core/nds32/switch.S index a9633782b3..286ed6022d 100644 --- a/core/nds32/switch.S +++ b/core/nds32/switch.S @@ -92,6 +92,7 @@ __task_start: addi $sp, $r3, 4 * 18 /* we are ready to re-schedule */ swi.gp $r4, [ + need_resched] + swi.gp $r4, [ + start_called] /* trigger scheduling to execute the task with the highest priority */ syscall 0 diff --git a/core/nds32/task.c b/core/nds32/task.c index 788f0c66bf..2de4c78303 100644 --- a/core/nds32/task.c +++ b/core/nds32/task.c @@ -166,7 +166,7 @@ static uint32_t tasks_ready = (1 << TASK_ID_HOOKS); */ static uint32_t tasks_enabled = (1 << TASK_ID_HOOKS) | (1 << TASK_ID_IDLE); -static int start_called; /* Has task swapping started */ +int start_called; /* Has task swapping started */ /* interrupt number of sw interrupt */ static int sw_int_num; @@ -457,7 +457,8 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait) if (in_interrupt_context()) { /* The receiver might run again */ atomic_or(&tasks_ready, 1 << tskid); - need_resched = 1; + if (start_called) + need_resched = 1; } else { if (wait) return __wait_evt(-1, tskid); @@ -781,7 +782,6 @@ int task_start(void) #ifdef CONFIG_TASK_PROFILING task_start_time = exc_end_time = get_time().val; #endif - start_called = 1; return __task_start(); } |