On Mon, 29 May 2023 14:47:59 -0300 Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > Make VFIO_PCI_CORE the top level menu choice and make it directly > selectable by the user. > > This makes a sub menu with all the different PCI driver choices and causes > VFIO_PCI to be enabled by default if the user selects "VFIO support for > PCI devices" > > Remove the duplicated 'depends on' from variant drivers and enclose all > the different sub driver choices (including S390 which was wrongly missing > a depends) in a single if block. This makes all the dependencies more > robust. > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > drivers/vfio/pci/Kconfig | 17 ++++++++++++----- > drivers/vfio/pci/hisilicon/Kconfig | 1 - > drivers/vfio/pci/mlx5/Kconfig | 1 - > 3 files changed, 12 insertions(+), 7 deletions(-) > > Slightly different than as discussed as this seem more robust at the cost of > adding another menu layer. > > diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig > index f9d0c908e738c3..5e9868d5ff1569 100644 > --- a/drivers/vfio/pci/Kconfig > +++ b/drivers/vfio/pci/Kconfig > @@ -1,9 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0-only > if PCI && MMU > -config VFIO_PCI_CORE > - tristate > - select VFIO_VIRQFD > - select IRQ_BYPASS_MANAGER > > config VFIO_PCI_MMAP > def_bool y if !S390 > @@ -11,9 +7,19 @@ config VFIO_PCI_MMAP > config VFIO_PCI_INTX > def_bool y if !S390 > > +config VFIO_PCI_CORE > + tristate "VFIO support for PCI devices" > + select VFIO_VIRQFD > + select IRQ_BYPASS_MANAGER > + help > + Base support for VFIO drivers that support PCI devices. At least one > + of the implementation drivers must be selected. As enforced by what? This is just adding one more layer of dependencies in order to select the actual endpoint driver that is actually what anyone cares about. Despite the above help text, I think this also allows a kernel to be built with vfio-pci-core and nothing in-kernel that uses it. I don't see why we wouldn't just make each of the variant drivers select VFIO_PCI_CORE. Thanks, Alex > + > +if VFIO_PCI_CORE > + > config VFIO_PCI > tristate "Generic VFIO support for any PCI device" > - select VFIO_PCI_CORE > + default y > help > Support for the generic PCI VFIO bus driver which can connect any > PCI device to the VFIO framework. > @@ -60,3 +66,4 @@ source "drivers/vfio/pci/mlx5/Kconfig" > source "drivers/vfio/pci/hisilicon/Kconfig" > > endif > +endif > diff --git a/drivers/vfio/pci/hisilicon/Kconfig b/drivers/vfio/pci/hisilicon/Kconfig > index 5daa0f45d2f99b..86826513765062 100644 > --- a/drivers/vfio/pci/hisilicon/Kconfig > +++ b/drivers/vfio/pci/hisilicon/Kconfig > @@ -2,7 +2,6 @@ > config HISI_ACC_VFIO_PCI > tristate "VFIO PCI support for HiSilicon ACC devices" > depends on ARM64 || (COMPILE_TEST && 64BIT) > - depends on VFIO_PCI_CORE > depends on PCI_MSI > depends on CRYPTO_DEV_HISI_QM > depends on CRYPTO_DEV_HISI_HPRE > diff --git a/drivers/vfio/pci/mlx5/Kconfig b/drivers/vfio/pci/mlx5/Kconfig > index 29ba9c504a7560..d36b18d3e21fe7 100644 > --- a/drivers/vfio/pci/mlx5/Kconfig > +++ b/drivers/vfio/pci/mlx5/Kconfig > @@ -2,7 +2,6 @@ > config MLX5_VFIO_PCI > tristate "VFIO support for MLX5 PCI devices" > depends on MLX5_CORE > - depends on VFIO_PCI_CORE > help > This provides migration support for MLX5 devices using the VFIO > framework. > > base-commit: 8c1ee346da583718fb0a7791a1f84bdafb103caf