Re: [PATCH v2] xen: Remove dependency between pciback and privcmd

From: Jan Beulich
Date: Thu Oct 10 2024 - 04:40:22 EST


On 10.10.2024 09:58, Jiqian Chen wrote:
> --- a/drivers/xen/acpi.c
> +++ b/drivers/xen/acpi.c
> @@ -125,3 +125,20 @@ int xen_acpi_get_gsi_info(struct pci_dev *dev,
> return 0;
> }
> EXPORT_SYMBOL_GPL(xen_acpi_get_gsi_info);
> +
> +get_gsi_from_sbdf_t get_gsi_from_sbdf = NULL;
> +
> +void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func)
> +{
> + get_gsi_from_sbdf = func;
> +}
> +EXPORT_SYMBOL_GPL(xen_acpi_register_get_gsi_func);
> +
> +int xen_acpi_get_gsi_from_sbdf(u32 sbdf)
> +{
> + if (get_gsi_from_sbdf)
> + return get_gsi_from_sbdf(sbdf);
> +
> + return -EINVAL;

Perhaps better -EOPNOTSUPP?

> +}
> +EXPORT_SYMBOL_GPL(xen_acpi_get_gsi_from_sbdf);
> \ No newline at end of file

Can you please take care of this as well while touching the file? Or
maybe you are doing so, but the diff doesn't show it properly?

> @@ -484,6 +483,7 @@ static int pcistub_init_device(struct pcistub_device *psdev)
> if (err)
> goto config_release;
> psdev->gsi = gsi;
> + xen_acpi_register_get_gsi_func(pcistub_get_gsi_from_sbdf);
> }
> #endif

Why here rather than directly in xen_pcibk_init()? And why no change to
xen_pcibk_cleanup() to remove the hook again on unload? Which will then
raise the question of possible race conditions.

Jan