Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

SiFive CLIC (Core Level Interrupt Controller) test-beta1 #157

Open
wants to merge 41 commits into
base: qemu-for-upstream
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
59a2a11
RISC-V: Update address bits to support sv39 and sv48
Mar 5, 2018
67110fb
RISC-V: Improve page table walker spec compliance
Mar 4, 2018
458d08e
RISC-V: Use atomic_cmpxchg to update PLIC bitmaps
Apr 10, 2018
0461550
RISC-V: Simplify riscv_cpu_local_irqs_pending
Apr 19, 2018
dabcc50
RISC-V: Allow setting and clearing multiple irqs
Apr 8, 2018
970b95b
RISC-V: Move non-ops from op_helper to cpu_helper
Apr 10, 2018
e0bc582
RISC-V: Update CSR and interrupt definitions
Mar 5, 2018
0bf5716
RISC-V: Implement modular CSR helper interface
Apr 8, 2018
31aa0b4
RISC-V: Implement atomic mip/sip CSR updates
Apr 10, 2018
5fe21a8
RISC-V: Implement existential predicates for CSRs
Apr 11, 2018
3737960
RISC-V: Split out mstatus_fs from tb_flags
rth7680 Mar 28, 2018
24ece65
RISC-V: Mark mstatus.fs dirty
rth7680 Mar 28, 2018
0a656f3
RISC-V: Implement mstatus.TSR/TW/TVM
Apr 15, 2018
b379f5a
RISC-V: Add public API for the CSR dispatch table
Apr 20, 2018
c2901dd
RISC-V: Add hartid and \n to interrupt logging
Apr 22, 2018
f4399d2
RISC-V: Use riscv prefix consistently on cpu helpers
Apr 23, 2018
ad21000
RISC-V: Replace __builtin_popcount with ctpop8 in PLIC
Apr 29, 2018
8812433
RISC-V: Add missing free for plic_hart_config
Apr 30, 2018
bea8bb0
RISC-V: Allow interrupt controllers to claim interrupts
May 6, 2018
764aa94
RISC-V: Add misa to DisasContext
May 12, 2018
fc5d882
RISC-V: Add misa.MAFD checks to translate
May 9, 2018
2ad9b10
RISC-V: Add misa runtime write support
May 9, 2018
eec015a
RISC-V: Fix CLINT timecmp low 32-bit writes
May 12, 2018
e8ae79c
RISC-V: Fix PLIC pending bitfield reads
May 12, 2018
e8b5944
RISC-V: Enable second UART on sifive_e and sifive_u
May 12, 2018
25571ed
RISC-V: Remove unnecessary disassembler constraints
May 16, 2018
fc4d86d
elf: Add RISC-V PSABI ELF header defines
May 17, 2018
34f9902
RISC-V: linux-user support for RVE ABI
kito-cheng Jun 16, 2017
9d4473b
RISC-V: Don't add NULL bootargs to device-tree
May 22, 2018
6338416
RISC-V: Support separate firmware and kernel payload
May 19, 2018
3e20277
RISC-V: Change local interrupts from edge to level
May 25, 2018
27016af
RISC-V: Add SiFive Test device to E and U series machines
Jun 19, 2018
c7b1e00
RISC-V: Add support for vectored interrupts
Jun 21, 2018
884c701
RISC-V: Convert trap debugging to trace events
Jun 21, 2018
0a13267
RISC-V: Update load reservation comment in do_interrupt
Jun 22, 2018
0b22435
sifive_prci: Read and write PRCI registers
nategraff-sifive Jul 24, 2018
d7e5d78
sifive_uart: Implement interrupt pending register
nategraff-sifive Jul 24, 2018
577f7aa
target/riscv/pmp.c: Fix PMP NAPOT decoding bug
dayeol Jul 17, 2018
cf5f50f
target/riscv/pmp.c: Fix PMP range boundary address bug
dayeol Jul 17, 2018
63801b3
riscv: remove define cpu_init()
May 15, 2018
206d9ac
SiFive CLIC (Core Level Interrupt Controller) test-beta1
Jun 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
SiFive CLIC (Core Level Interrupt Controller) test-beta1
- Implements draft clic-spec (20180728)
  - Implements non-vectored mode and vectored mode
  - Implements mode+level+priority configuration
  - Implements mode+level+priority preemption model
  - Seperated M-mode (mtvec) and S-mode (stvec) delivery
  - CLIC supports backwards compatible CLINT mode for
    legacy interrupts using MIE/MIP,SIE/SIP (irq < 16)
    depending on mtvec (MTI,MSI) and stvec (STI,SSI)
  - CLINT mode supports S-mode stimecmp{h} and ssip{h}

- QEMU CLINT/CLIC Test Cases
  - https://github.com/michaeljclark/qemu-riscv-tests

- Adds two experimental machines
  - SiFive Freedom E-Series with CLIC
    - Implements M-mode CLINT/CLIC config memory map
    - Parameters
      - CLICINTBITS=4
      - CLICCFGMBITS=0
      - CLICCFGLBITS=4
    - Invocation
      - qemu-system-riscv{32,64} -machine sifive_ex
  - SiFive Freedom U-Series with CLIC
    - Implements M-mode and S-mode CLINT/CLIC memory map
    - Parameters
      - CLICINTBITS=8
      - CLICCFGMBITS=2
      - CLICCFGLBITS=4
    - Invocation
      - qemu-system-riscv{32,64} -machine sifive_ux

- CLIC combined CLINT/CLIC memory map
  - M-Mode CLINT = 0x02000000
    - msip       = 0x02000000 + hartid * 4
    - mtimecmp   = 0x02004000 + hartid * 4
    - mtime      = 0x0200bff8
  - S-Mode CLINT = 0x02020000
  - M-mode CLIC  = 0x02080000
    - clicintip  = 0x02080000 + hartid * 0x1000 + 0x000
    - clicintie  = 0x02080000 + hartid * 0x1000 + 0x400
    - clicintcfg = 0x02080000 + hartid * 0x1000 + 0x800
    - cliccfg    = 0x02080000 + hartid * 0x1000 + 0xc00
  - S-Mode CLIC  = 0x020c0000
    - clicintip  = 0x020c0000 + hartid * 0x1000 + 0x000
    - clicintie  = 0x020c0000 + hartid * 0x1000 + 0x400
    - clicintcfg = 0x020c0000 + hartid * 0x1000 + 0x800

- Adds CLIC interrupt tracing (`-d trace:riscv_trap,...`)
  - riscv_trap         # existing core interrupt tracing
  - sifive_clic_cfg    # CLIC global configuration
  - sifive_clic_intcfg # CLIC interrupt configuration
  - sifive_clic_intie  # CliC interrupt enable
  - sifive_clic_intip  # CLIC interrupt pending
  - sifive_clic_irq    # CLIC irq entry

- Notes / Limitations
  - Enforces clicintcfg writes based on cliccfg and mode
  - Reads/writes to intcfg/intie/intip in lower mode MMIO
    apetures are currently allowed. Access checks need to
    be added to suppress writes and hardwire read reults to
    zero for any entries that where mode < clicintcfg.mode
  - Interrupts pending bits are writable by software.
    Edge/Level configuration needs to be added to control
    software access to interrupt pending bits
  - Selective vectoring in non-vectored mode is unimplemented
  - PLIC is currently not routed via the CLIC however pending
    bits can be written by software to test pre-emption.
  - mnxti/snxti sets mstatus flags but returns 0 (slow path).
    The CLIC state is currenetly not accessible from target/riscv
    as cpu implementations can't include anything from include/hw
    so the CLIC state needs to be in a CPU accessible structure.
  - Potential race condition if an interrupt is posted
    before the CPU has received and processed an outstanding
    interrupt due to env->exccode being overwritten.
    Needs changes to the interface from the CLIC so that the
    CPU interrupt handler pulls the highest priority interrupt
    from the CLIC at the time it is woken up. This requires the
    CLIC state to be accessible from the CPU similarly to mnxti
  - CPU core changes are relatively intrusive. The CPU interrupt
    handling requires some abstraction/hooks for a more modular
    CLIC implementation. CLIC state needs to be attached to
    the CPU, and accessible to the MMIO device with hooks in
    riscv_cpu_exec_interrupt and riscv_cpu_do_interrupt

Changes since v0

- Fix array index calculation in sifive_clic_realize
- Raise CLIC_LEVEL_BITS to 8 and fix assertion
- Move CLIC parameterization constants to its header
  • Loading branch information
Michael Clark committed Sep 21, 2018
commit 206d9ac339feb9ef2c325402a00f0f45f453d019
1 change: 1 addition & 0 deletions Makefile.objs
Expand Up @@ -228,6 +228,7 @@ trace-events-subdirs += hw/nvram
trace-events-subdirs += hw/pci
trace-events-subdirs += hw/pci-host
trace-events-subdirs += hw/ppc
trace-events-subdirs += hw/riscv
trace-events-subdirs += hw/rdma
trace-events-subdirs += hw/rdma/vmw
trace-events-subdirs += hw/s390x
Expand Down
1 change: 1 addition & 0 deletions hw/riscv/Makefile.objs
Expand Up @@ -2,6 +2,7 @@ obj-y += boot.o
obj-y += riscv_htif.o
obj-y += riscv_hart.o
obj-y += sifive_e.o
obj-y += sifive_clic.o
obj-y += sifive_clint.o
obj-y += sifive_prci.o
obj-y += sifive_plic.o
Expand Down