Re: [PATCH v5 21/23] irqchip/riscv-rpmi-sysmsi: Add ACPI support

From: Thomas Gleixner
Date: Fri Jun 13 2025 - 11:36:36 EST


On Wed, Jun 11 2025 at 11:52, Anup Patel wrote:
> @@ -211,6 +213,9 @@ static int rpmi_sysmsi_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct rpmi_sysmsi_priv *priv;
> + struct irq_domain *msi_domain;
> + struct fwnode_handle *fwnode;
> + u32 id;
> int rc;
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> @@ -241,6 +246,22 @@ static int rpmi_sysmsi_probe(struct platform_device *pdev)
> }
> priv->nr_irqs = rc;
>
> + fwnode = dev_fwnode(dev);
> + if (is_acpi_node(fwnode)) {
> + u32 nr_irqs;
> +
> + rc = riscv_acpi_get_gsi_info(fwnode, &priv->gsi_base, &id,
> + &nr_irqs, NULL);
> + if (rc) {
> + dev_err(dev, "failed to find GSI mapping\n");
> + return rc;
> + }
> +
> + /* Update with actual GSI range */
> + if (nr_irqs != priv->nr_irqs)
> + riscv_acpi_update_gsi_range(priv->gsi_base, priv->nr_irqs);
> + }
> +
> /* Set the device MSI domain if not available */
> if (!dev_get_msi_domain(dev)) {
> /*
> @@ -250,8 +271,13 @@ static int rpmi_sysmsi_probe(struct platform_device *pdev)
> * then we need to set it explicitly before using any platform
> * MSI functions.
> */
> - if (dev_of_node(dev))
> + if (is_of_node(fwnode)) {
> of_msi_configure(dev, dev_of_node(dev));
> + } else if (is_acpi_device_node(fwnode)) {
> + msi_domain = irq_find_matching_fwnode(imsic_acpi_get_fwnode(dev),
> + DOMAIN_BUS_PLATFORM_MSI);

msi_domain is only used here and so it should be declared in this scope
and not at the top of the function.

> + dev_set_msi_domain(dev, msi_domain);
> + }

Other than that:

Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>