OSDN Git Service

riscv: clear the instruction cache and all registers when booting
authorChristoph Hellwig <hch@lst.de>
Mon, 28 Oct 2019 12:10:40 +0000 (13:10 +0100)
committerPaul Walmsley <paul.walmsley@sifive.com>
Sun, 17 Nov 2019 23:17:39 +0000 (15:17 -0800)
commit9e80635619b51ddc56bdeca4da4056eb7a2a77e0
treefda5d1465f1130cd9cc21920112e28b4ed7028c5
parentaccb9dbc4affdb7ebf30db7e9ba71eee47280081
riscv: clear the instruction cache and all registers when booting

When we get booted we want a clear slate without any leaks from previous
supervisors or the firmware.  Flush the instruction cache and then clear
all registers to known good values.  This is really important for the
upcoming nommu support that runs on M-mode, but can't really harm when
running in S-mode either.  Vaguely based on the concepts from opensbi.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
arch/riscv/include/asm/csr.h
arch/riscv/kernel/head.S