10151a8dbSAnup Patel# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 20151a8dbSAnup Patel%YAML 1.2 30151a8dbSAnup Patel--- 40151a8dbSAnup Patel$id: http://devicetree.org/schemas/interrupt-controller/riscv,imsics.yaml# 50151a8dbSAnup Patel$schema: http://devicetree.org/meta-schemas/core.yaml# 60151a8dbSAnup Patel 70151a8dbSAnup Pateltitle: RISC-V Incoming MSI Controller (IMSIC) 80151a8dbSAnup Patel 90151a8dbSAnup Patelmaintainers: 100151a8dbSAnup Patel - Anup Patel <anup@brainfault.org> 110151a8dbSAnup Patel 120151a8dbSAnup Pateldescription: | 130151a8dbSAnup Patel The RISC-V advanced interrupt architecture (AIA) defines a per-CPU incoming 140151a8dbSAnup Patel MSI controller (IMSIC) for handling MSIs in a RISC-V platform. The RISC-V 150151a8dbSAnup Patel AIA specification can be found at https://github.com/riscv/riscv-aia. 160151a8dbSAnup Patel 170151a8dbSAnup Patel The IMSIC is a per-CPU (or per-HART) device with separate interrupt file 180151a8dbSAnup Patel for each privilege level (machine or supervisor). The configuration of 190151a8dbSAnup Patel a IMSIC interrupt file is done using AIA CSRs and it also has a 4KB MMIO 200151a8dbSAnup Patel space to receive MSIs from devices. Each IMSIC interrupt file supports a 210151a8dbSAnup Patel fixed number of interrupt identities (to distinguish MSIs from devices) 220151a8dbSAnup Patel which is same for given privilege level across CPUs (or HARTs). 230151a8dbSAnup Patel 240151a8dbSAnup Patel The device tree of a RISC-V platform will have one IMSIC device tree node 250151a8dbSAnup Patel for each privilege level (machine or supervisor) which collectively describe 260151a8dbSAnup Patel IMSIC interrupt files at that privilege level across CPUs (or HARTs). 270151a8dbSAnup Patel 280151a8dbSAnup Patel The arrangement of IMSIC interrupt files in MMIO space of a RISC-V platform 290151a8dbSAnup Patel follows a particular scheme defined by the RISC-V AIA specification. A IMSIC 300151a8dbSAnup Patel group is a set of IMSIC interrupt files co-located in MMIO space and we can 310151a8dbSAnup Patel have multiple IMSIC groups (i.e. clusters, sockets, chiplets, etc) in a 320151a8dbSAnup Patel RISC-V platform. The MSI target address of a IMSIC interrupt file at given 330151a8dbSAnup Patel privilege level (machine or supervisor) encodes group index, HART index, 340151a8dbSAnup Patel and guest index (shown below). 350151a8dbSAnup Patel 360151a8dbSAnup Patel XLEN-1 > (HART Index MSB) 12 0 370151a8dbSAnup Patel | | | | 380151a8dbSAnup Patel ------------------------------------------------------------- 390151a8dbSAnup Patel |xxxxxx|Group Index|xxxxxxxxxxx|HART Index|Guest Index| 0 | 400151a8dbSAnup Patel ------------------------------------------------------------- 410151a8dbSAnup Patel 420151a8dbSAnup PatelallOf: 430151a8dbSAnup Patel - $ref: /schemas/interrupt-controller.yaml# 440151a8dbSAnup Patel - $ref: /schemas/interrupt-controller/msi-controller.yaml# 450151a8dbSAnup Patel 460151a8dbSAnup Patelproperties: 470151a8dbSAnup Patel compatible: 480151a8dbSAnup Patel items: 490151a8dbSAnup Patel - enum: 500151a8dbSAnup Patel - qemu,imsics 510151a8dbSAnup Patel - const: riscv,imsics 520151a8dbSAnup Patel 530151a8dbSAnup Patel reg: 540151a8dbSAnup Patel minItems: 1 550151a8dbSAnup Patel maxItems: 16384 560151a8dbSAnup Patel description: 570151a8dbSAnup Patel Base address of each IMSIC group. 580151a8dbSAnup Patel 590151a8dbSAnup Patel interrupt-controller: true 600151a8dbSAnup Patel 610151a8dbSAnup Patel "#interrupt-cells": 620151a8dbSAnup Patel const: 0 630151a8dbSAnup Patel 640151a8dbSAnup Patel msi-controller: true 650151a8dbSAnup Patel 660151a8dbSAnup Patel "#msi-cells": 670151a8dbSAnup Patel const: 0 680151a8dbSAnup Patel 690151a8dbSAnup Patel interrupts-extended: 700151a8dbSAnup Patel minItems: 1 710151a8dbSAnup Patel maxItems: 16384 720151a8dbSAnup Patel description: 730151a8dbSAnup Patel This property represents the set of CPUs (or HARTs) for which given 740151a8dbSAnup Patel device tree node describes the IMSIC interrupt files. Each node pointed 750151a8dbSAnup Patel to should be a riscv,cpu-intc node, which has a CPU node (i.e. RISC-V 760151a8dbSAnup Patel HART) as parent. 770151a8dbSAnup Patel 780151a8dbSAnup Patel riscv,num-ids: 790151a8dbSAnup Patel $ref: /schemas/types.yaml#/definitions/uint32 800151a8dbSAnup Patel minimum: 63 810151a8dbSAnup Patel maximum: 2047 820151a8dbSAnup Patel description: 830151a8dbSAnup Patel Number of interrupt identities supported by IMSIC interrupt file. 840151a8dbSAnup Patel 850151a8dbSAnup Patel riscv,num-guest-ids: 860151a8dbSAnup Patel $ref: /schemas/types.yaml#/definitions/uint32 870151a8dbSAnup Patel minimum: 63 880151a8dbSAnup Patel maximum: 2047 890151a8dbSAnup Patel description: 900151a8dbSAnup Patel Number of interrupt identities are supported by IMSIC guest interrupt 910151a8dbSAnup Patel file. When not specified it is assumed to be same as specified by the 920151a8dbSAnup Patel riscv,num-ids property. 930151a8dbSAnup Patel 940151a8dbSAnup Patel riscv,guest-index-bits: 950151a8dbSAnup Patel minimum: 0 960151a8dbSAnup Patel maximum: 7 970151a8dbSAnup Patel default: 0 980151a8dbSAnup Patel description: 990151a8dbSAnup Patel Number of guest index bits in the MSI target address. 1000151a8dbSAnup Patel 1010151a8dbSAnup Patel riscv,hart-index-bits: 1020151a8dbSAnup Patel minimum: 0 1030151a8dbSAnup Patel maximum: 15 1040151a8dbSAnup Patel description: 1050151a8dbSAnup Patel Number of HART index bits in the MSI target address. When not 1060151a8dbSAnup Patel specified it is calculated based on the interrupts-extended property. 1070151a8dbSAnup Patel 1080151a8dbSAnup Patel riscv,group-index-bits: 1090151a8dbSAnup Patel minimum: 0 1100151a8dbSAnup Patel maximum: 7 1110151a8dbSAnup Patel default: 0 1120151a8dbSAnup Patel description: 1130151a8dbSAnup Patel Number of group index bits in the MSI target address. 1140151a8dbSAnup Patel 1150151a8dbSAnup Patel riscv,group-index-shift: 1160151a8dbSAnup Patel $ref: /schemas/types.yaml#/definitions/uint32 1170151a8dbSAnup Patel minimum: 0 1180151a8dbSAnup Patel maximum: 55 1190151a8dbSAnup Patel default: 24 1200151a8dbSAnup Patel description: 1210151a8dbSAnup Patel The least significant bit position of the group index bits in the 1220151a8dbSAnup Patel MSI target address. 1230151a8dbSAnup Patel 1240151a8dbSAnup Patelrequired: 1250151a8dbSAnup Patel - compatible 1260151a8dbSAnup Patel - reg 1270151a8dbSAnup Patel - interrupt-controller 1280151a8dbSAnup Patel - msi-controller 1290151a8dbSAnup Patel - "#msi-cells" 1300151a8dbSAnup Patel - interrupts-extended 1310151a8dbSAnup Patel - riscv,num-ids 1320151a8dbSAnup Patel 1330151a8dbSAnup PatelunevaluatedProperties: false 1340151a8dbSAnup Patel 1350151a8dbSAnup Patelexamples: 1360151a8dbSAnup Patel - | 1370151a8dbSAnup Patel // Example 1 (Machine-level IMSIC files with just one group): 1380151a8dbSAnup Patel 1390151a8dbSAnup Patel interrupt-controller@24000000 { 1400151a8dbSAnup Patel compatible = "qemu,imsics", "riscv,imsics"; 1410151a8dbSAnup Patel interrupts-extended = <&cpu1_intc 11>, 1420151a8dbSAnup Patel <&cpu2_intc 11>, 1430151a8dbSAnup Patel <&cpu3_intc 11>, 1440151a8dbSAnup Patel <&cpu4_intc 11>; 145*6adc9166SHuang Borong reg = <0x24000000 0x4000>; 1460151a8dbSAnup Patel interrupt-controller; 1470151a8dbSAnup Patel #interrupt-cells = <0>; 1480151a8dbSAnup Patel msi-controller; 1490151a8dbSAnup Patel #msi-cells = <0>; 1500151a8dbSAnup Patel riscv,num-ids = <127>; 1510151a8dbSAnup Patel }; 1520151a8dbSAnup Patel 1530151a8dbSAnup Patel - | 1540151a8dbSAnup Patel // Example 2 (Supervisor-level IMSIC files with two groups): 1550151a8dbSAnup Patel 1560151a8dbSAnup Patel interrupt-controller@28000000 { 1570151a8dbSAnup Patel compatible = "qemu,imsics", "riscv,imsics"; 1580151a8dbSAnup Patel interrupts-extended = <&cpu1_intc 9>, 1590151a8dbSAnup Patel <&cpu2_intc 9>, 1600151a8dbSAnup Patel <&cpu3_intc 9>, 1610151a8dbSAnup Patel <&cpu4_intc 9>; 1620151a8dbSAnup Patel reg = <0x28000000 0x2000>, /* Group0 IMSICs */ 1630151a8dbSAnup Patel <0x29000000 0x2000>; /* Group1 IMSICs */ 1640151a8dbSAnup Patel interrupt-controller; 1650151a8dbSAnup Patel #interrupt-cells = <0>; 1660151a8dbSAnup Patel msi-controller; 1670151a8dbSAnup Patel #msi-cells = <0>; 1680151a8dbSAnup Patel riscv,num-ids = <127>; 1690151a8dbSAnup Patel riscv,group-index-bits = <1>; 1700151a8dbSAnup Patel riscv,group-index-shift = <24>; 1710151a8dbSAnup Patel }; 1720151a8dbSAnup Patel... 173