[PATCH v5 24/27] irqchip/gic-v5: Add GICv5 ITS support

Lorenzo Pieralisi lpieralisi at kernel.org
Wed Jun 18 12:56:54 PDT 2025


On Wed, Jun 18, 2025 at 12:17:39PM +0200, Lorenzo Pieralisi wrote:

[...]

> +static int its_v5_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
> +				  int nvec, msi_alloc_info_t *info)
> +{
> +	struct msi_domain_info *msi_info;
> +	struct device_node *msi_node;
> +	struct pci_dev *pdev;
> +	phys_addr_t pa;
> +	int ret;
> +
> +	if (!dev_is_pci(dev))
> +		return -EINVAL;
> +
> +	pdev = to_pci_dev(dev);
> +
> +	msi_node = pci_msi_get_device_msi_ctlr_node(pdev);
> +	if (!msi_node)
> +		return -ENODEV;
> +
> +	ret = its_translate_frame_address(msi_node, &pa);
> +	if (ret)
> +		return -ENODEV;
> +
> +	of_node_put(msi_node);
> +
> +	/* ITS specific DeviceID */
> +	info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain->parent, pdev);

Heads-up: it turned out I was too optimistic and reusing

pci_msi_domain_get_msi_rid()

on GICv5 does not work (or better it works incorrectly).

It calls (for DT) of_msi_map_id() with the IRQ domain of_node (why, I am
not sure but for GICv3 it works because the phandle in the msi-map and
the IRQ domain of_node are equivalent). This does _not_ work on GICv5,
I failed to spot it because in of_msi_map_id() if the IRQ domain of_node
and msi-map phandle do not match a 1:1 translation is carried out, which
ironically is what the RID<->DID translation looks like in the test
platform. Sigh.

I have already patched the code to augment:

pci_msi_get_device_msi_ctlr_node()

so that it grabs the msi-controller of_node pointer in msi-map AND maps the
RID->DID (and to be honest that's what I should have done but I wanted to
reuse pci_msi_domain_get_msi_rid(), it does not work for GICv5 unless I
change it but I fear I could break platforms, we don't fix what it is not
broken).

Long story short: apologies, I missed this snag for the reasons above, I
will update it for v6.

Thanks,
Lorenzo



More information about the linux-arm-kernel mailing list