[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFMaBlByS8xPq6kc@lpieralisi>
Date: Wed, 18 Jun 2025 21:56:54 +0200
From: Lorenzo Pieralisi <lpieralisi@...nel.org>
To: Marc Zyngier <maz@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Sascha Bischoff <sascha.bischoff@....com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Timothy Hayes <timothy.hayes@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Peter Maydell <peter.maydell@...aro.org>,
Mark Rutland <mark.rutland@....com>,
Jiri Slaby <jirislaby@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH v5 24/27] irqchip/gic-v5: Add GICv5 ITS support
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
Powered by blists - more mailing lists