aboutsummaryrefslogtreecommitdiff
path: root/riscv/plic.cc
AgeCommit message (Collapse)AuthorFilesLines
2024-10-02fix typosYang Hau1-1/+1
2024-04-30Support per-device arguments and device factory reuseLIU Yu1-2/+2
As proposed in #1652, we made the following changes to MMIO device (factory) plugin API, to mitigate current limitations and facilitate factory reuse. - removed `sargs` from `device_factory_t`, and introduced a new type alias `device_factory_sargs_t` to capture `<device_factory_t *, sargs>` pairs, this is used to instantiate sim_t instances; - changed the signature of `device_factory_t::generate_fdt` and `device_factory_t::parse_from_fdt` to take on an extra `sargs` argument, for instantiating devices with per-device arguments; - made `device_factory_t` const and potentially resuable across multiple `sim_t` instances.
2024-01-22PLIC: Implement threshold maskingTilmann Bartsch1-0/+9
Signed-off-by: Tilmann Bartsch <info@tebartsch.ai>
2023-12-11riscv: sim.cc: Parse for "sifive,plic-1.0.0" if "riscv,plic0" is absentTan En De1-1/+2
"riscv,plic0" and "sifive,plic-1.0.0" in device tree's "compatible" string point to the same driver, as can be seen from drivers/irqchip/irq-sifive-plic.c in Linux kernel. https://github.com/torvalds/linux/commit/5873ba559101fa37ad9764e79856f71bf54021aa The other two "compatible" strings below isn't included, because of their different plic behavior (plic_edge_init instead of plic_init as explained in the Linux commit). - "andestech,nceplic100" - "thead,c900-plic" Signed-off-by: Tan En De <ende.tan@starfivetech.com>
2023-12-08Fix Spike --device option to pass on args to downstream pluginsjoey03201-1/+1
2023-06-20device_t: Add device_factory_t's for ns16550/clint/plicJerry Zhao1-0/+37
2023-06-20devices: Pass const pointers to sim_t to clint/plicJerry Zhao1-1/+1
2023-04-07Implement pending bits for plicJiajie Chen1-1/+21
2023-03-09Use simif_t instead of sim_t for clint/plicScott Johnson1-2/+2
In keeping with the spirit of simif_t.
2023-03-01Fix PLIC on big-endian hostsAndrew Waterman1-3/+3
2023-03-01Remove unnecessary conditional in plic_t::loadAndrew Waterman1-3/+1
It's safe to overwrite bytes when returning false.
2023-03-01Correctly instantiate PLIC contexts for mixed-hart targetsAndrew Waterman1-5/+8
This commit started as an attempt to make the PLIC tolerant of discontiguous hart IDs, but it turns out it was already most of the way there: PLIC contexts can still be dense even if the hart IDs are not. Nevertheless, I wanted to avoid passing the procs vector directly to the plic_t constructor. In removing it, I realized I could also get rid of the smode parameter by querying whether each hart has S-mode. This is also more correct; previously, we were instantiating the PLIC as though all harts had S-mode, regardless of whether they actually did.
2023-03-01Refactor plic_t and plic_context_t initializationAndrew Waterman1-18/+5
2023-02-28Remove unused plic_context_t::num fieldAndrew Waterman1-1/+0
2023-02-28Remove unused plic_t::procs fieldAndrew Waterman1-1/+1
2023-02-22optimize `num_ids_word` init logic;Wade1-6/+3
init `max_prio` by initialization-list
2023-02-18fix unintentionally plic context update when `val > max_prio` and `offset == ↵Wade1-3/+4
CONTEXT_THRESHOLD`
2022-11-23Make reserved PLIC behavior more realisticAndrew Waterman1-22/+32
Most implementations can't raise precise exceptions as a function of sub-page addressing, so don't attempt to do so here. Also, support double-word-sized writes. Although PLICs aren't required to support this behavior, they are allowed to. Some existing implementations support this behavior, and some existing software relies upon it (unfortunately).
2022-10-17Make PLIC/NS16550 coding style more conformantAndrew Waterman1-73/+55
2022-04-20Add PLIC emulationAnup Patel1-0/+393
We need an interrupt controller in Spike which will allow us to emulate more real-world devices such as UART, VirtIO net, VirtIO block, etc. The RISC-V PLIC (or SiFive PLIC) is the commonly used interrupt controller in existing RISC-V platforms so this patch adds PLIC emulation for Spike. Signed-off-by: Anup Patel <anup@brainfault.org>