On Fri, 30 Oct 2020 12:58:05 +0800 Lu Baolu <baolu...@linux.intel.com> 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...@linux.intel.com> > --- 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");