From: Thomas Gleixner <tglx@linutronix.de>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] regmap: Allow setting IRQ domain name suffix
Date: Wed, 07 Aug 2024 15:02:21 +0200 [thread overview]
Message-ID: <87a5ho4hb6.ffs@tglx> (raw)
In-Reply-To: <2eb39a8f-cc58-4774-836c-e6293300a4d9@gmail.com>
Matti!
On Tue, Aug 06 2024 at 14:51, Matti Vaittinen wrote:
> On 7/13/24 15:22, Thomas Gleixner wrote:
>> Something like the untested below should work. That would make your
>> info:
>>
>> struct irq_domain_info info = {
>> .fwnode = fwnode,
>> .size = chip->num_irqs,
>
> Based on my code reading, the .size is used for allocating the "revmap".
> Looking at the info struct for existing implementation of the
> irq_domain_create_legacy(), the .size is set as:
>
> .size = first_hwirq + size,
>
>> .hwirq_max = chip->num_irqs,
>
> Also, the irq_domain_create_legacy() sets hwirq_max as:
>
> .hwirq_max = first_hwirq + size.
>
> see:
>
> > @@ -476,18 +486,14 @@ struct irq_domain *irq_domain_create_leg
> > .fwnode = fwnode,
> > .size = first_hwirq + size,
> > .hwirq_max = first_hwirq + size,
> > + .hwirq_base = first_hwirq,
> > + .virq_base = first_irq,
> > .ops = ops,
> > .host_data = host_data,
> > };
> > - struct irq_domain *domain;
> > + struct irq_domain *domain = irq_domain_instantiate(&info);
> >
> > - domain = irq_domain_instantiate(&info);
> > - if (IS_ERR(domain))
> > - return NULL;
> > -
> > - irq_domain_associate_many(domain, first_irq, first_hwirq, size);
>
> Lookin at this, the existing code calls irq_domain_associate_many() with
> the given size parameter (without the + first_hwirq which is assigned to
> .size).
Indeed.
> I think this is not aligned with what the patch below results (and yes,
> I know Thomas told it's untested).
:)
> I'd better admit I am not 100% sure how the legacy domains work and that
> I don't (any more) fully trust on my ability to flawlessly interpret the
> code ;)
You definitely did better than me :)
> 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.
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.
> So, any guidance as to what the revmap allocation size should be (the
> info->size), and what should be the size for the
> irq_domain_associate_many()?
So that associate should be:
irq_domain_associate_many(domain, info->virq_base, info->hwirq_base,
info->size - info->hwirq_base);
Thanks,
tglx
next prev parent reply other threads:[~2024-08-07 13:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 10:58 [PATCH 0/2] regmap IRQ support for devices with multiple IRQs Matti Vaittinen
2024-07-01 10:58 ` [PATCH 1/2] irqdomain: Allow giving name suffix for domain Matti Vaittinen
2024-07-01 10:59 ` [PATCH 2/2] regmap: Allow setting IRQ domain name suffix Matti Vaittinen
2024-07-07 18:13 ` Thomas Gleixner
2024-07-08 12:40 ` Matti Vaittinen
2024-07-13 12:22 ` Thomas Gleixner
2024-08-05 13:04 ` Matti Vaittinen
2024-08-05 13:11 ` Thomas Gleixner
2024-08-06 8:18 ` Matti Vaittinen
2024-08-06 11:51 ` Matti Vaittinen
2024-08-07 13:02 ` Thomas Gleixner [this message]
2024-08-07 15:57 ` Thomas Gleixner
2024-08-08 5:30 ` Matti Vaittinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5ho4hb6.ffs@tglx \
--to=tglx@linutronix.de \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.