Re: [PATCH v3 03/11] irqchip: mip: Add Broadcom bcm2712 MSI-X interrupt controller

From: Thomas Gleixner
Date: Mon Oct 14 2024 - 12:31:55 EST



> Subject: irqchip: mip:

is not a valid prefix

Just make it: irqchip: Add Broadcom .....

> +static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs, void *arg)
> +{
> + struct mip_priv *mip = domain->host_data;
> + struct irq_fwspec fwspec = {0};
> + struct irq_data *irqd;
> + unsigned int hwirq, irq, i;

unsigned int hwirq, irq, i;
struct irq_data *irqd;

> +
> +#define MIP_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
> + MSI_FLAG_USE_DEF_CHIP_OPS | \
> + MSI_FLAG_PCI_MSI_MASK_PARENT | \
> + MSI_FLAG_PCI_MSIX)

Why are you requiring MSI_FLAG_PCI_MSIX here? That's a supported flag,
not a required one.

> +#define MIP_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
> + MSI_FLAG_PCI_MSIX | \

So this does not support multi MSI, but your allocation function looks
like it supports it (nr_irqs is not range checked).

> + IRQ_DOMAIN_FLAG_MSI_PARENT)

This is not a MSI flag and has no place here.

> +static const struct msi_parent_ops mip_msi_parent_ops = {
> + .supported_flags = MIP_MSI_FLAGS_SUPPORTED,
> + .required_flags = MIP_MSI_FLAGS_REQUIRED,
> + .bus_select_token = DOMAIN_BUS_PCI_MSI,
> + .bus_select_mask = MATCH_PCI_MSI,
> + .prefix = "MIP-MSI-",
> + .init_dev_msi_info = msi_lib_init_dev_msi_info,
> +};
> +
> +static int mip_init_domains(struct mip_priv *mip, struct device_node *np)
> +{
> + struct irq_domain *middle;
> +
> + middle = irq_domain_add_hierarchy(mip->parent, 0, mip->num_msis, np,
> + &mip_middle_domain_ops, mip);
> + if (!middle)
> + return -ENOMEM;
> +
> + irq_domain_update_bus_token(middle, DOMAIN_BUS_PCI_MSI);

That's the wrong token. DOMAIN_BUS_PCI_MSI is what the v2 global PCI/MSI
domain uses. But that's not what this is about. This is the parent
domain for PCI/MSI. DOMAIN_BUS_GENERIC_MSI or DOMAIN_BUS_NEXUS is what
you want here.

> + middle->dev = mip->dev;
> + middle->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
> + middle->msi_parent_ops = &mip_msi_parent_ops;
> +

Other than this, this looks good now.

Thanks,

tglx