On Sat, 18 Jan 2020 14:23:45 +0000 "Liu, Yi L" <yi.l.liu@xxxxxxxxx> wrote: > > From: Cornelia Huck [mailto:cohuck@xxxxxxxxxx] > > Sent: Friday, January 17, 2020 1:40 AM > > To: Liu, Yi L <yi.l.liu@xxxxxxxxx> > > Subject: Re: [PATCH v4 11/12] samples: add vfio-mdev-pci driver > > > > On Thu, 16 Jan 2020 13:23:28 +0000 > > "Liu, Yi L" <yi.l.liu@xxxxxxxxx> wrote: > > > > > > From: Cornelia Huck [mailto:cohuck@xxxxxxxxxx] > > > > Sent: Wednesday, January 15, 2020 8:30 PM > > > > To: Liu, Yi L <yi.l.liu@xxxxxxxxx> > > > > Subject: Re: [PATCH v4 11/12] samples: add vfio-mdev-pci driver > > > > > > > > On Tue, 7 Jan 2020 20:01:48 +0800 > > > > Liu Yi L <yi.l.liu@xxxxxxxxx> wrote: > > > > > > > diff --git a/samples/Kconfig b/samples/Kconfig index > > > > > 9d236c3..50d207c 100644 > > > > > --- a/samples/Kconfig > > > > > +++ b/samples/Kconfig > > > > > @@ -190,5 +190,15 @@ config SAMPLE_INTEL_MEI > > > > > help > > > > > Build a sample program to work with mei device. > > > > > > > > > > +config SAMPLE_VFIO_MDEV_PCI > > > > > + tristate "Sample driver for wrapping PCI device as a mdev" > > > > > + select VFIO_PCI_COMMON > > > > > + select VFIO_PCI > > > > > > > > Why does this still need to select VFIO_PCI? Shouldn't all needed > > > > infrastructure rather be covered by VFIO_PCI_COMMON already? > > > > > > VFIO_PCI_COMMON is supposed to be the dependency of both VFIO_PCI and > > > SAMPLE_VFIO_MDEV_PCI. However, the source code of VFIO_PCI_COMMON are > > > under drivers/vfio/pci which is compiled per the configuration of VFIO_PCI. > > > Besides of letting SAMPLE_VFIO_MDEV_PCI select VFIO_PCI, I can also > > > add a line in drivers/vfio/Makefile to make the source code under > > > drivers/vfio/pci to be compiled when either VFIO_PCI or > > > VFIO_PCI_COMMON are configed. But I'm afraid it is a bit ugly. So I > > > choose to let SAMPLE_VFIO_MDEV_PCI select VFIO_PCI. If you have other > > > idea, I would be pleased to know it. :-) > > > > Shouldn't building drivers/vfio/pci/ for CONFIG_VFIO_PCI_COMMON already be > > enough (the Makefile changes look fine to me)? Or am I missing something obvious? > > The problem is in the drivers/vfio/Makefile. If CONFIG_VFIO_PCI is not > selected then the pci/ directory is not compiled. Even CONFIG_VFIO_PCI=M, > it will throw error if SAMPLE_VFIO_MDEV_PCI=y. So I let SAMPLE_VFIO_MDEV_PCI > select CONFIG_VFIO_PCI all the same. I'm not sure if this is good. Or maybe > there is better way to ensure pci/ is compiled. > > # SPDX-License-Identifier: GPL-2.0 > vfio_virqfd-y := virqfd.o > > obj-$(CONFIG_VFIO) += vfio.o > obj-$(CONFIG_VFIO_VIRQFD) += vfio_virqfd.o > obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o > obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o > obj-$(CONFIG_VFIO_SPAPR_EEH) += vfio_spapr_eeh.o > obj-$(CONFIG_VFIO_PCI) += pci/ That's actually what I meant: s/CONFIG_VFIO_PCI/CONFIG_VFIO_PCI_COMMON/ here. > obj-$(CONFIG_VFIO_PLATFORM) += platform/ > obj-$(CONFIG_VFIO_MDEV) += mdev/ > > Thanks, > Yi Liu >