Skip to content

Commit

Permalink
riscv: matrix: Fixup kernel panic
Browse files Browse the repository at this point in the history
Enable matrix in sstatus when read matrix CSR.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
  • Loading branch information
guoren83 committed Mar 7, 2024
1 parent 363299d commit abe4db1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/riscv/kernel/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ static int riscv_v_thread_zalloc(void)
static int riscv_m_thread_zalloc(void)
{
void *datap;
size_t alloc_size;

datap = kzalloc(csr_read(CSR_XMLENB) * 8, GFP_KERNEL);
riscv_m_enable();
alloc_size = csr_read(CSR_XMLENB) * 8;
riscv_m_disable();

datap = kzalloc(alloc_size, GFP_KERNEL);
if (!datap)
return -ENOMEM;

Expand Down

0 comments on commit abe4db1

Please sign in to comment.