Re: [PATCH 2/2] irqchip/riscv-aplic: add support for hart indexes

Vladimir Kondratiev
2025-01-05T08:13:30Z

>> Risc-V APLIC specification defines "hart index" in [1]:
>>
>> Within a given interrupt domain, each of the domain’s harts has a
>> unique index number in the range 0 to 214 − 1 (= 16,383). The index
>> number a domain associates with a hart may or may not have any
>> relationship to the unique hart identifier (“hart ID”) that the
>> RISC-V Privileged Architecture assigns to the hart. Two different
>> interrupt domains may employ entirely different index numbers for
>> the same set of harts.

>Rather than this, better cite the text in "4.5 Memory-mapped control
>region for an interrupt domain".

Adding quote from 4.5 to the commit message

>> Support arbitrary hart indexes specified in optional APLIC property
>> "riscv,hart-index" that should be array of u32 elements, one per
>> interrupt target. If this property not specified, fallback is to use
>> hart ids, with hart index for each APLIC to be (hartid - hartid0)
>> where hartid0 is hart id for the 1-st target.

>This is an incorrect assumption in the default cause. The HART IDs
>of the HARTs targeted by an APLIC domain can be non-contiguous.

Fixing this to say "fallback to logical indexes"

>How about this ?

Taking your approach. Applying idea from
ef7080bd30ba ("irqchip/riscv-aplic: Simplify the initialization code")

Will shortly re-submit as "V2"