irqchip/sifive-plic: Improve naming scheme for per context offsets
authorNiklas Cassel <niklas.cassel@wdc.com>
Wed, 2 Mar 2022 13:15:52 +0000 (13:15 +0000)
committerMarc Zyngier <maz@kernel.org>
Wed, 2 Mar 2022 13:30:50 +0000 (13:30 +0000)
commit0d3616bbd03cdfaa8a5fdf38e0fec2b1ef6ec0a0
treeabb46280f745a97117fe1000df6c62a9b5bc6feb
parentdfd42facf1e4ada021b939b4e19c935dcdd55566
irqchip/sifive-plic: Improve naming scheme for per context offsets

The PLIC supports a fixed number of contexts (15872).
Each context has fixed register offsets in PLIC.

The number of contexts that we need to initialize depends on the privilege
modes supported by each hart. Therefore, this mapping between PLIC context
registers to hart privilege modes is platform specific, and is currently
supplied via device tree.

For example, canaan,k210 has the following mapping:
Context0: hart0 M-mode
Context1: hart0 S-mode
Context2: hart1 M-mode
Context3: hart1 S-mode

While sifive,fu540 has the following mapping:
Context0: hart0 M-mode
Context1: hart1 M-mode
Context2: hart1 S-mode

Because the number of contexts per hart is not fixed, the names
ENABLE_PER_HART and CONTEXT_PER_HART for the register offsets are quite
confusing and might mislead the reader to think that these are fixed
register offsets per hart.

Rename the offsets to more clearly highlight that these are per PLIC
context and not per hart.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220302131544.3166154-2-Niklas.Cassel@wdc.com
drivers/irqchip/irq-sifive-plic.c