Re: [PATCH v1] irqchip/irq-mvebu-icu: Fix irq_set_type for sei and nsr

Stefan Eichenberger
2025-01-20T16:57:45Z

On Mon, Jan 20, 2025 at 09:45:43AM +0100, Thomas Gleixner wrote:
> On Fri, Jan 17 2025 at 19:03, Stefan Eichenberger wrote:
> > It seems that irq_chip_set_type_parent is not failing. By adding some
> > debug messages to kernel/irq/manage.c I found that irqd_get_trigger_type
> > returns IRQF_TRIGGER_RISING even though it should return
> > IRQF_TRIGGER_HIGH according to the device tree. Maybe this was fixed
> > between 6.10 and 6.12 but I need to analyze that again in more detail.
>
> The trigger type is fixed up in mvebu_icu_irq_domain_translate(), but
> that should be the same with the new code in mvebu_icu_translate().
>
> Can you instrument mvebu_icu_translate() and validate that it is
>
> 1) Invoked at all
>
> 2) The type fixup is done:
>
> if (msi_data->subset_data->icu_group == ICU_GRP_SEI)
> *type = IRQ_TYPE_EDGE_RISING;

Thanks a lot for pointing me in the right direction. I think I found
what is going on. My instrumentation showed that we still end up in that
function but the translation does not work. I think the reason is that
the msi_data conversion is wrong. The following patch would solve the
issue:

diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c
index b337f6c05f18..4eebed39880a 100644
--- a/drivers/irqchip/irq-mvebu-icu.c
+++ b/drivers/irqchip/irq-mvebu-icu.c
@@ -68,7 +68,8 @@ static int mvebu_icu_translate(struct irq_domain *d, struct irq_fwspec *fwspec,
unsigned long *hwirq, unsigned int *type)
{
unsigned int param_count = static_branch_unlikely(&legacy_bindings) ? 3 : 2;
- struct mvebu_icu_msi_data *msi_data = d->host_data;
+ struct msi_domain_info *info = d->host_data;
+ struct mvebu_icu_msi_data *msi_data = info->chip_data;
struct mvebu_icu *icu = msi_data->icu;

/* Check the count of the parameters in dt */

Do you agree with that fix? If so I will prepare a proper patch.

Thanks for your help, regards,
Stefan