Re: [PATCH hyperv-next v5 11/11] PCI: hv: Get vPCI MSI IRQ domain from DeviceTree

From: Bjorn Helgaas
Date: Mon Mar 10 2025 - 12:50:56 EST


On Fri, Mar 07, 2025 at 02:03:03PM -0800, Roman Kisel wrote:
> The hyperv-pci driver uses ACPI for MSI IRQ domain configuration on
> arm64. It won't be able to do that in the VTL mode where only DeviceTree
> can be used.
>
> Update the hyperv-pci driver to get vPCI MSI IRQ domain in the DeviceTree
> case, too.
>
> Signed-off-by: Roman Kisel <romank@xxxxxxxxxxxxxxxxxxx>

A couple minor comments below, but I don't have any objection to this,
so if it's OK with the pci-hyperv.c folks, it's OK with me.

> +#ifdef CONFIG_OF
> +
> +static struct irq_domain *hv_pci_of_irq_domain_parent(void)
> +{
> + struct device_node *parent;
> + struct irq_domain *domain;
> +
> + parent = of_irq_find_parent(hv_get_vmbus_root_device()->of_node);
> + domain = NULL;
> + if (parent) {
> + domain = irq_find_host(parent);
> + of_node_put(parent);
> + }
> +
> + return domain;

I think this would be a little simpler as:

parent = of_irq_find_parent(hv_get_vmbus_root_device()->of_node);
if (!parent)
return NULL;

domain = irq_find_host(parent);
of_node_put(parent);
return domain;

> +}
> +
> +#endif
> +
> +#ifdef CONFIG_ACPI
> +
> +static struct irq_domain *hv_pci_acpi_irq_domain_parent(void)
> +{
> + struct irq_domain *domain;
> + acpi_gsi_domain_disp_fn gsi_domain_disp_fn;
> +
> + if (acpi_irq_model != ACPI_IRQ_MODEL_GIC)
> + return NULL;
> + gsi_domain_disp_fn = acpi_get_gsi_dispatcher();
> + if (!gsi_domain_disp_fn)
> + return NULL;
> + domain = irq_find_matching_fwnode(gsi_domain_disp_fn(0),
> + DOMAIN_BUS_ANY);
> +
> + if (!domain)
> + return NULL;
> +
> + return domain;

if (!domain)
return NULL;

return domain;

is the same as:

return domain;

or even just:

return irq_find_matching_fwnode(gsi_domain_disp_fn(0), DOMAIN_BUS_ANY);

> +}