Re: [PATCH v2 2/2] vfio/cdx: update driver to build without CONFIG_GENERIC_MSI_IRQ

From: Alex Williamson
Date: Thu Aug 21 2025 - 17:06:19 EST


On Thu, 21 Aug 2025 12:43:08 +0530
Nipun Gupta <nipun.gupta@xxxxxxx> wrote:

> Define dummy MSI related APIs in VFIO CDX driver to build the
> driver without enabling CONFIG_GENERIC_MSI_IRQ flag.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508070308.opy5dIFX-lkp@xxxxxxxxx/
> Reviewed-by: Nikhil Agarwal <nikhil.agarwal@xxxxxxx>
> Signed-off-by: Nipun Gupta <nipun.gupta@xxxxxxx>
> ---
> Changes v1->v2:
> - fix linking intr.c file in Makefile
>
> drivers/vfio/cdx/Makefile | 6 +++++-
> drivers/vfio/cdx/private.h | 14 ++++++++++++++
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vfio/cdx/Makefile b/drivers/vfio/cdx/Makefile
> index df92b320122a..dadbef2419ea 100644
> --- a/drivers/vfio/cdx/Makefile
> +++ b/drivers/vfio/cdx/Makefile
> @@ -5,4 +5,8 @@
>
> obj-$(CONFIG_VFIO_CDX) += vfio-cdx.o
>
> -vfio-cdx-objs := main.o intr.o
> +vfio-cdx-objs := main.o
> +
> +ifdef CONFIG_GENERIC_MSI_IRQ
> +vfio-cdx-objs += intr.o
> +endif
> diff --git a/drivers/vfio/cdx/private.h b/drivers/vfio/cdx/private.h
> index dc56729b3114..0482a1516439 100644
> --- a/drivers/vfio/cdx/private.h
> +++ b/drivers/vfio/cdx/private.h
> @@ -38,11 +38,25 @@ struct vfio_cdx_device {
> u8 config_msi;
> };
>
> +#ifdef CONFIG_GENERIC_MSI_IRQ
> int vfio_cdx_set_irqs_ioctl(struct vfio_cdx_device *vdev,
> u32 flags, unsigned int index,
> unsigned int start, unsigned int count,
> void *data);
>
> void vfio_cdx_irqs_cleanup(struct vfio_cdx_device *vdev);
> +#else
> +static int vfio_cdx_set_irqs_ioctl(struct vfio_cdx_device *vdev,
> + u32 flags, unsigned int index,
> + unsigned int start, unsigned int count,
> + void *data)
> +{
> + return 0;
> +}
> +
> +static void vfio_cdx_irqs_cleanup(struct vfio_cdx_device *vdev)
> +{
> +}
> +#endif
>
> #endif /* VFIO_CDX_PRIVATE_H */

Why are we returning success if we don't implement the function? This
provides the wrong return value to the user.

Also, aren't we also missing in patch 1/ that cdx_dev->num_msi is
initialized and therefore vfio_cdx_ioctl_get_info() might return that
an interrupt is supported when it is not? Thanks,

Alex