linux-next: manual merge of the iommufd tree with the vfio tree

Stephen Rothwell posted 1 patch 2 years, 9 months ago
linux-next: manual merge of the iommufd tree with the vfio tree
Posted by Stephen Rothwell 2 years, 9 months ago
Hi all,

Today's linux-next merge of the iommufd tree got conflicts in:

  drivers/vfio/Kconfig
  drivers/vfio/Makefile

between commits:

  20601c45a0fa ("vfio: Remove CONFIG_VFIO_SPAPR_EEH")
  e2d55709398e ("vfio: Fold vfio_virqfd.ko into vfio.ko")

from the vfio tree and commits:

  a4d1f91db502 ("vfio-iommufd: Support iommufd for physical VFIO devices")
  e5a9ec7e096a ("vfio: Make vfio_container optionally compiled")
  c2849d718d26 ("vfio: Move vfio group specific code into group.c")

from the iommufd tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/vfio/Kconfig
index 0b8d53f63c7e,286c1663bd75..000000000000
--- a/drivers/vfio/Kconfig
+++ b/drivers/vfio/Kconfig
@@@ -38,6 -46,17 +46,12 @@@ config VFIO_NOIOMM
  	  this mode since there is no IOMMU to provide DMA translation.
  
  	  If you don't know what to do here, say N.
+ endif
+ 
 -config VFIO_SPAPR_EEH
 -	tristate
 -	depends on EEH && VFIO_IOMMU_SPAPR_TCE
 -	default VFIO
 -
+ config VFIO_VIRQFD
 -	tristate
++	bool
+ 	select EVENTFD
+ 	default n
  
  source "drivers/vfio/pci/Kconfig"
  source "drivers/vfio/platform/Kconfig"
diff --cc drivers/vfio/Makefile
index 0721ed4831c9,3783db7e8082..000000000000
--- a/drivers/vfio/Makefile
+++ b/drivers/vfio/Makefile
@@@ -2,12 -2,17 +2,14 @@@
  obj-$(CONFIG_VFIO) += vfio.o
  
  vfio-y += vfio_main.o \
- 	  iova_bitmap.o \
- 	  container.o
+ 	  group.o \
+ 	  iova_bitmap.o
 +vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o
+ vfio-$(CONFIG_IOMMUFD) += iommufd.o
+ vfio-$(CONFIG_VFIO_CONTAINER) += container.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/
  obj-$(CONFIG_VFIO_PLATFORM) += platform/
  obj-$(CONFIG_VFIO_MDEV) += mdev/
Re: linux-next: manual merge of the iommufd tree with the vfio tree
Posted by Stephen Rothwell 2 years, 9 months ago
Hi all,

On Tue, 6 Dec 2022 12:55:42 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> Today's linux-next merge of the iommufd tree got conflicts in:
> 
>   drivers/vfio/Kconfig
>   drivers/vfio/Makefile
> 
> between commits:
> 
>   20601c45a0fa ("vfio: Remove CONFIG_VFIO_SPAPR_EEH")
>   e2d55709398e ("vfio: Fold vfio_virqfd.ko into vfio.ko")
> 
> from the vfio tree and commits:
> 
>   a4d1f91db502 ("vfio-iommufd: Support iommufd for physical VFIO devices")
>   e5a9ec7e096a ("vfio: Make vfio_container optionally compiled")
>   c2849d718d26 ("vfio: Move vfio group specific code into group.c")
> 
> from the iommufd tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/vfio/Kconfig
> index 0b8d53f63c7e,286c1663bd75..000000000000
> --- a/drivers/vfio/Kconfig
> +++ b/drivers/vfio/Kconfig
> @@@ -38,6 -46,17 +46,12 @@@ config VFIO_NOIOMM
>   	  this mode since there is no IOMMU to provide DMA translation.
>   
>   	  If you don't know what to do here, say N.
> + endif
> + 
>  -config VFIO_SPAPR_EEH
>  -	tristate
>  -	depends on EEH && VFIO_IOMMU_SPAPR_TCE
>  -	default VFIO
>  -
> + config VFIO_VIRQFD
>  -	tristate
> ++	bool
> + 	select EVENTFD
> + 	default n
>   
>   source "drivers/vfio/pci/Kconfig"
>   source "drivers/vfio/platform/Kconfig"
> diff --cc drivers/vfio/Makefile
> index 0721ed4831c9,3783db7e8082..000000000000
> --- a/drivers/vfio/Makefile
> +++ b/drivers/vfio/Makefile
> @@@ -2,12 -2,17 +2,14 @@@
>   obj-$(CONFIG_VFIO) += vfio.o
>   
>   vfio-y += vfio_main.o \
> - 	  iova_bitmap.o \
> - 	  container.o
> + 	  group.o \
> + 	  iova_bitmap.o
>  +vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o
> + vfio-$(CONFIG_IOMMUFD) += iommufd.o
> + vfio-$(CONFIG_VFIO_CONTAINER) += container.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/
>   obj-$(CONFIG_VFIO_PLATFORM) += platform/
>   obj-$(CONFIG_VFIO_MDEV) += mdev/

This is now a conflict between the vfio tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell
Re: linux-next: manual merge of the iommufd tree with the vfio tree
Posted by Jason Gunthorpe 2 years, 9 months ago
On Tue, Dec 06, 2022 at 12:55:42PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the iommufd tree got conflicts in:
> 
>   drivers/vfio/Kconfig
>   drivers/vfio/Makefile
> 
> between commits:
> 
>   20601c45a0fa ("vfio: Remove CONFIG_VFIO_SPAPR_EEH")
>   e2d55709398e ("vfio: Fold vfio_virqfd.ko into vfio.ko")
> 
> from the vfio tree and commits:
> 
>   a4d1f91db502 ("vfio-iommufd: Support iommufd for physical VFIO devices")
>   e5a9ec7e096a ("vfio: Make vfio_container optionally compiled")
>   c2849d718d26 ("vfio: Move vfio group specific code into group.c")
> 
> from the iommufd tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

I got the same as you for what you showed, but I also got a hunk in
vfio_main.c as well? It looks close to your next-20221206 tag, but I
renamed 'err_virqfd' to 'err_group' and 'err_dev_class' to
'err_virqfd' for consistency with the rest of the file.

Thanks,
Jason

@@@ -1260,27 -1902,59 +1348,34 @@@ static int __init vfio_init(void
        if (ret)
                return ret;
  
+       ret = vfio_virqfd_init();
+       if (ret)
 -              goto err_virqfd;
 -
 -      /* /dev/vfio/$GROUP */
 -      vfio.class = class_create(THIS_MODULE, "vfio");
 -      if (IS_ERR(vfio.class)) {
 -              ret = PTR_ERR(vfio.class);
 -              goto err_group_class;
 -      }
 -
 -      vfio.class->devnode = vfio_devnode;
++              goto err_group;
+ 
        /* /sys/class/vfio-dev/vfioX */
        vfio.device_class = class_create(THIS_MODULE, "vfio-dev");
        if (IS_ERR(vfio.device_class)) {
                ret = PTR_ERR(vfio.device_class);
--              goto err_dev_class;
++              goto err_virqfd;
        }
  
 -      ret = alloc_chrdev_region(&vfio.group_devt, 0, MINORMASK + 1, "vfio");
 -      if (ret)
 -              goto err_alloc_chrdev;
 -
        pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
        return 0;
  
 -err_alloc_chrdev:
 -      class_destroy(vfio.device_class);
 -      vfio.device_class = NULL;
--err_dev_class:
 -      class_destroy(vfio.class);
 -      vfio.class = NULL;
 -err_group_class:
 -      vfio_virqfd_exit();
+ err_virqfd:
 -      vfio_container_cleanup();
++      vfio_virqfd_exit();
++err_group:
 +      vfio_group_cleanup();
        return ret;
  }
  
  static void __exit vfio_cleanup(void)
  {
 -      WARN_ON(!list_empty(&vfio.group_list));
 -
        ida_destroy(&vfio.device_ida);
 -      ida_destroy(&vfio.group_ida);
 -      unregister_chrdev_region(vfio.group_devt, MINORMASK + 1);
        class_destroy(vfio.device_class);
        vfio.device_class = NULL;
 -      class_destroy(vfio.class);
+       vfio_virqfd_exit();
 -      vfio_container_cleanup();
 -      vfio.class = NULL;
 +      vfio_group_cleanup();
        xa_destroy(&vfio_device_set_xa);
  }
Re: linux-next: manual merge of the iommufd tree with the vfio tree
Posted by Alex Williamson 2 years, 9 months ago
On Tue, 6 Dec 2022 12:55:42 +1100
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> Today's linux-next merge of the iommufd tree got conflicts in:
> 
>   drivers/vfio/Kconfig
>   drivers/vfio/Makefile
> 
> between commits:
> 
>   20601c45a0fa ("vfio: Remove CONFIG_VFIO_SPAPR_EEH")
>   e2d55709398e ("vfio: Fold vfio_virqfd.ko into vfio.ko")
> 
> from the vfio tree and commits:
> 
>   a4d1f91db502 ("vfio-iommufd: Support iommufd for physical VFIO devices")
>   e5a9ec7e096a ("vfio: Make vfio_container optionally compiled")
>   c2849d718d26 ("vfio: Move vfio group specific code into group.c")
> 
> from the iommufd tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 

Looks good, thank you,

Alex