Re: [PATCH v6 1/5] vfio/mdev: Register mdev bus earlier during boot

From: Alex Williamson
Date: Fri Oct 30 2020 - 13:02:44 EST


On Fri, 30 Oct 2020 12:58:05 +0800
Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx> wrote:

> Move mdev bus registration earlier than IOMMU probe processing so that
> the IOMMU drivers could be able to set iommu_ops for the mdev bus. This
> only applies when vfio-mdev module is setected to be built-in.
>
> Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> ---

Most kernels will build this as a module, so having different behavior
and apparently different IOMMU support for built-in vs module is
broken. Thanks,

Alex

> drivers/vfio/mdev/mdev_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
> index b558d4cfd082..6b9ab71f89e7 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
> @@ -417,8 +417,12 @@ static void __exit mdev_exit(void)
> mdev_bus_unregister();
> }
>
> +#if IS_BUILTIN(CONFIG_VFIO_MDEV)
> +postcore_initcall(mdev_init)
> +#else
> module_init(mdev_init)
> module_exit(mdev_exit)
> +#endif /* IS_BUILTIN(CONFIG_VFIO_MDEV) */
>
> MODULE_VERSION(DRIVER_VERSION);
> MODULE_LICENSE("GPL v2");