Re: [PATCH 2/2] regmap: Allow setting IRQ domain name suffix

Matti Vaittinen
2024-08-08T05:30:07Z

On 8/7/24 18:57, Thomas Gleixner wrote:
> Matti!
>
> On Wed, Aug 07 2024 at 15:02, Thomas Gleixner wrote:
>> On Tue, Aug 06 2024 at 14:51, Matti Vaittinen wrote:
>>> Hence I'd rather learn from a small explanation (what is the
>>> expected .size) than by fixing this after I see regression reports from
>>> real users of the irq_domain_create_legacy() :)
>>
>> So the size of the domain is sum of the parameters @size and
>> @first_hwirq. That's so that the hardware interrupt is zero indexed for
>> an array based lookup.

Ah, thanks. This was what I expected, but wasn't really sure. Makes sense.

>> The association obviously wants only the @size parameter because that's
>> what the caller wants interrupts for as it obviously can't provide
>> interrupts below @first_hwirq.

Still makes sense :) I'll fix my patches based on this, thanks :)

> For more background.
>
> The legacy domain is for configurations which have fixed interrupt
> numbers either in general or for parts of the interrupt space.
>
> The trivial case is that there is a single interrupt domain with
> interrupt numbers from 0 to $MAX.
>
> But there are cases which have the interrupt space devided into chunks:
>
> hwirq virq domain
> 0-15 0-15 A
> 16-31 16-31 B
> ...
>
> To support such configurations in the irq domain world, the legacy
> domain was added. Similar to that is the simple domain which allows the
> caller to specify a linux interrupt number from which the domain should
> start. See
>
> 1bc04f2cf8c2 ("irq_domain: Add support for base irq and hwirq in legacy mappings")
> 781d0f46d81e ("irq_domain: Standardise legacy/linear domain selection")
>
> for further enlightment.

Thomas - Thank You. I appreciate the time you took to explain this
further. I didn't really expect it :) I was more afraid of getting a
reply: "Please, go read the code and don't expect others to do your
work." :) This explanation and the pointers to commits are very much
appreciated!

I think I've seen code where some drivers used fixed IRQs - but this was
a long long time ago in a galaxy far far away :)

Yours,
-- Matti

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~