Re: [PATCH 05/25] irqchip/gic-v3: Add FW info retrieval support

Thomas Gleixner
2025-09-09T09:37:56Z

On Mon, Sep 08 2025 at 17:31, Marc Zyngier wrote:
> +static int gic_irq_get_info(struct irq_fwspec_info *info)
> +{
> + struct irq_fwspec *fwspec = &info->fwspec;
> + const struct cpumask *mask = NULL;
> +
> + info->flags = 0;
> + info->affinity = NULL;

:)

> + /* ACPI is not capable of describing PPI affinity -- yet */
> + if (!is_of_node(fwspec->fwnode))
> + goto out;

'goto out' to return 0? Seriously?

> + /* If the specifier provides an affinity, use it */
> + if (fwspec->param_count == 4 && fwspec->param[3]) {
> + struct fwnode_handle *fw;
> +
> + switch (fwspec->param[0]) {
> + case 1: /* PPI */
> + case 3: /* EPPI */
> + break;
> + default:
> + goto out;
> + }
> +
> + fw = of_node_to_fwnode(of_find_node_by_phandle(fwspec->param[3]));
> + if (!fw)
> + goto out;
> +
> + for (int i = 0; i < gic_data.nr_parts; i++) {
> + if (gic_data.parts[i].partition_id == fw) {
> + mask = &gic_data.parts[i].mask;
> + break;
> + }
> + }
> +
> + if (!mask)
> + goto out;
> + } else {
> + mask = cpu_possible_mask;
> + }
> +
> + info->affinity = mask;
> + info->flags = (IRQ_FWSPEC_INFO_FWSPEC_VALID |
> + IRQ_FWSPEC_INFO_AFFINITY_VALID);

It's not really clear to me what the purpose
ofIRQ_FWSPEC_INFO_FWSPEC_VALID is. That firmware spec was handed in by
the caller, so it should be valid no matter what, no?

Thanks,

tglx