Commit b2534357 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xtensa-20220416' of https://github.com/jcmvbkbc/linux-xtensa

Pull xtensa fixes from Max Filippov:

 - fix patching CPU selection in patch_text

 - fix potential deadlock in ISS platform serial driver

 - fix potential register clobbering in coprocessor exception handler

* tag 'xtensa-20220416' of https://github.com/jcmvbkbc/linux-xtensa:
  xtensa: fix a7 clobbering in coprocessor context load/store
  arch: xtensa: platforms: Fix deadlock in rs_close()
  xtensa: patch_text: Fixup last cpu should be master
parents 10c5f102 839769c3
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
.if XTENSA_HAVE_COPROCESSOR(x); \ .if XTENSA_HAVE_COPROCESSOR(x); \
.align 4; \ .align 4; \
.Lsave_cp_regs_cp##x: \ .Lsave_cp_regs_cp##x: \
xchal_cp##x##_store a2 a4 a5 a6 a7; \ xchal_cp##x##_store a2 a3 a4 a5 a6; \
jx a0; \ jx a0; \
.endif .endif
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
.if XTENSA_HAVE_COPROCESSOR(x); \ .if XTENSA_HAVE_COPROCESSOR(x); \
.align 4; \ .align 4; \
.Lload_cp_regs_cp##x: \ .Lload_cp_regs_cp##x: \
xchal_cp##x##_load a2 a4 a5 a6 a7; \ xchal_cp##x##_load a2 a3 a4 a5 a6; \
jx a0; \ jx a0; \
.endif .endif
......
...@@ -40,7 +40,7 @@ static int patch_text_stop_machine(void *data) ...@@ -40,7 +40,7 @@ static int patch_text_stop_machine(void *data)
{ {
struct patch *patch = data; struct patch *patch = data;
if (atomic_inc_return(&patch->cpu_count) == 1) { if (atomic_inc_return(&patch->cpu_count) == num_online_cpus()) {
local_patch_text(patch->addr, patch->data, patch->sz); local_patch_text(patch->addr, patch->data, patch->sz);
atomic_inc(&patch->cpu_count); atomic_inc(&patch->cpu_count);
} else { } else {
......
...@@ -36,24 +36,19 @@ static void rs_poll(struct timer_list *); ...@@ -36,24 +36,19 @@ static void rs_poll(struct timer_list *);
static struct tty_driver *serial_driver; static struct tty_driver *serial_driver;
static struct tty_port serial_port; static struct tty_port serial_port;
static DEFINE_TIMER(serial_timer, rs_poll); static DEFINE_TIMER(serial_timer, rs_poll);
static DEFINE_SPINLOCK(timer_lock);
static int rs_open(struct tty_struct *tty, struct file * filp) static int rs_open(struct tty_struct *tty, struct file * filp)
{ {
spin_lock_bh(&timer_lock);
if (tty->count == 1) if (tty->count == 1)
mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
spin_unlock_bh(&timer_lock);
return 0; return 0;
} }
static void rs_close(struct tty_struct *tty, struct file * filp) static void rs_close(struct tty_struct *tty, struct file * filp)
{ {
spin_lock_bh(&timer_lock);
if (tty->count == 1) if (tty->count == 1)
del_timer_sync(&serial_timer); del_timer_sync(&serial_timer);
spin_unlock_bh(&timer_lock);
} }
...@@ -73,8 +68,6 @@ static void rs_poll(struct timer_list *unused) ...@@ -73,8 +68,6 @@ static void rs_poll(struct timer_list *unused)
int rd = 1; int rd = 1;
unsigned char c; unsigned char c;
spin_lock(&timer_lock);
while (simc_poll(0)) { while (simc_poll(0)) {
rd = simc_read(0, &c, 1); rd = simc_read(0, &c, 1);
if (rd <= 0) if (rd <= 0)
...@@ -87,7 +80,6 @@ static void rs_poll(struct timer_list *unused) ...@@ -87,7 +80,6 @@ static void rs_poll(struct timer_list *unused)
tty_flip_buffer_push(port); tty_flip_buffer_push(port);
if (rd) if (rd)
mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
spin_unlock(&timer_lock);
} }
......
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