Re: Potential issue with (or misunderstanding of) of_irq_get()

From: Conor Dooley
Date: Mon Jun 12 2023 - 09:27:39 EST


On Thu, Jun 08, 2023 at 02:29:47PM +0100, Conor Dooley wrote:
> On Mon, May 22, 2023 at 12:56:30PM +0100, Conor Dooley wrote:
> > On Sun, May 21, 2023 at 01:38:11PM +0100, Marc Zyngier wrote:

> Sounds like it may be the latter... The hierarchical stuff for the
> direct interrupts is working well, so progress at least. I seem to
> have gotten stuck with the non-direct/muxxed interrupts though.
>
> My alloc() now looks like, for the direct interrupts:
> static int mpfs_irq_mux_alloc(struct irq_domain *d, unsigned int virq,
> unsigned int nr_irqs, void *arg)
> {
> struct mpfs_irq_mux *priv = d->host_data;
> struct irq_fwspec *fwspec = arg;
> struct irq_fwspec parent_fwspec;
> int ret;
>
> pr_info("attempting to allocate\n");
> ret = mpfs_irq_mux_is_direct_get_mapping(priv, fwspec);
> if (ret == -EINVAL) {
> irq_domain_disconnect_hierarchy(d, virq);

A weekend & sufficient caffeine later and I've realised that this
should probably be disconnecting the parent...
Modulo WIP bodging, things seem to be working. Touch wood it doesn't
collapse in a heap when the bodges are cleaned up.


> }
>
> parent_fwspec.fwnode = d->parent->fwnode;
> parent_fwspec.param[0] = priv->parent_irqs[ret];
> parent_fwspec.param_count = 1;
>
> ret = irq_domain_alloc_irqs_parent(d, virq, 1, &parent_fwspec);
> if (ret)
> return ret;
>
> irq_domain_set_hwirq_and_chip(d, virq, fwspec->param[0],
> &mpfs_irq_mux_irq_chip, priv);
>
> return 0;
> }

Attachment: signature.asc
Description: PGP signature