提交 ea5002fb 编写于 作者: M Max Filippov 提交者: Zheng Zengkai

xtensa: fix xtensa_wsr always writing 0

stable inclusion
from stable-v5.10.110
commit 1dd031eb99107bf81aa0e72399717a87da5d0433
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1dd031eb99107bf81aa0e72399717a87da5d0433

--------------------------------

commit a3d0245c upstream.

The commit cad6fade ("xtensa: clean up WSR*/RSR*/get_sr/set_sr")
replaced 'WSR' macro in the function xtensa_wsr with 'xtensa_set_sr',
but variable 'v' in the xtensa_set_sr body shadowed the argument 'v'
passed to it, resulting in wrong value written to debug registers.

Fix that by removing intermediate variable from the xtensa_set_sr
macro body.

Cc: stable@vger.kernel.org
Fixes: cad6fade ("xtensa: clean up WSR*/RSR*/get_sr/set_sr")
Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 01ba0d31
...@@ -226,8 +226,8 @@ extern unsigned long get_wchan(struct task_struct *p); ...@@ -226,8 +226,8 @@ extern unsigned long get_wchan(struct task_struct *p);
#define xtensa_set_sr(x, sr) \ #define xtensa_set_sr(x, sr) \
({ \ ({ \
unsigned int v = (unsigned int)(x); \ __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: \
__asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \ "a"((unsigned int)(x))); \
}) })
#define xtensa_get_sr(sr) \ #define xtensa_get_sr(sr) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册