OSDN Git Service

riscv: provide native clint access for M-mode
authorChristoph Hellwig <hch@lst.de>
Mon, 28 Oct 2019 12:10:38 +0000 (13:10 +0100)
committerPaul Walmsley <paul.walmsley@sifive.com>
Sun, 17 Nov 2019 23:17:39 +0000 (15:17 -0800)
commitfcdc65375186a5cd69cc2eedfb498b86f4f5a21e
treee5f23c3934dc954ff361e672af761365d37edc49
parent4f9bbcefa142862782275a4b29f390ca8d8b9242
riscv: provide native clint access for M-mode

RISC-V has the concept of a cpu level interrupt controller.  The
interface for it is split between a standardized part that is exposed
as bits in the mstatus/sstatus register and the mie/mip/sie/sip
CRS.  But the bit to actually trigger IPIs is not standardized and
just mentioned as implementable using MMIO.

Add support for IPIs using MMIO using the SiFive clint layout (which
is also shared by Ariane, Kendryte and the Qemu virt platform).
Additionally the MMIO block also supports the time value and timer
compare registers, so they are also set up using the same OF node.
Support for other layouts should also be relatively easy to add in the
future.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
[paul.walmsley@sifive.com: update include guard format; fix checkpatch
 issues; minor commit message cleanup]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
arch/riscv/include/asm/clint.h [new file with mode: 0644]
arch/riscv/include/asm/sbi.h
arch/riscv/kernel/Makefile
arch/riscv/kernel/clint.c [new file with mode: 0644]
arch/riscv/kernel/setup.c
arch/riscv/kernel/smp.c
arch/riscv/kernel/smpboot.c