[GIT,PULL] VFIO updates for v6.2-rc1

Message ID 20221215132415.07f82cda.alex.williamson@redhat.com
State New
Headers
Series [GIT,PULL] VFIO updates for v6.2-rc1 |

Pull-request

https://github.com/awilliam/linux-vfio.git tags/vfio-v6.2-rc1

Commit Message

Alex Williamson Dec. 15, 2022, 8:24 p.m. UTC
  Hi Linus,

Happy holidays!  As Jason noted in his pull request[1], there were some
unavoidable conflicts between vfio and iommufd this cycle.  The iommufd
code has already been merged, so you'll encounter these with this pull
request.  I've provided resolution of the conflict chunks here below
the diffstat.  These are entirely predictable, perhaps with the exception
of the goto label renaming that Jason had proposed in his version and
I've copied here.  Thanks,

Alex

[1]https://lore.kernel.org/all/Y5dzTU8dlmXTbzoJ@nvidia.com/

The following changes since commit f0c4d9fc9cc9462659728d168387191387e903cc:

  Linux 6.1-rc4 (2022-11-06 15:07:11 -0800)

are available in the Git repository at:

  https://github.com/awilliam/linux-vfio.git tags/vfio-v6.2-rc1

for you to fetch changes up to 70be6f322860d322ebcd120cf0c05402ead5c6de:

  vfio/mlx5: error pointer dereference in error handling (2022-12-12 14:10:12 -0700)

----------------------------------------------------------------
VFIO updates for v6.2-rc1

 - Replace deprecated git://github.com link in MAINTAINERS. (Palmer Dabbelt)

 - Simplify vfio/mlx5 with module_pci_driver() helper. (Shang XiaoJing)

 - Drop unnecessary buffer from ACPI call. (Rafael Mendonca)

 - Correct latent missing include issue in iova-bitmap and fix support
   for unaligned bitmaps.  Follow-up with better fix through refactor.
   (Joao Martins)

 - Rework ccw mdev driver to split private data from parent structure,
   better aligning with the mdev lifecycle and allowing us to remove
   a temporary workaround. (Eric Farman)

 - Add an interface to get an estimated migration data size for a device,
   allowing userspace to make informed decisions, ex. more accurately
   predicting VM downtime. (Yishai Hadas)

 - Fix minor typo in vfio/mlx5 array declaration. (Yishai Hadas)

 - Simplify module and Kconfig through consolidating SPAPR/EEH code and
   config options and folding virqfd module into main vfio module.
   (Jason Gunthorpe)

 - Fix error path from device_register() across all vfio mdev and sample
   drivers. (Alex Williamson)

 - Define migration pre-copy interface and implement for vfio/mlx5
   devices, allowing portions of the device state to be saved while the
   device continues operation, towards reducing the stop-copy state
   size. (Jason Gunthorpe, Yishai Hadas, Shay Drory)

 - Implement pre-copy for hisi_acc devices. (Shameer Kolothum)

 - Fixes to mdpy mdev driver remove path and error path on probe.
   (Shang XiaoJing)

 - vfio/mlx5 fixes for incorrect return after copy_to_user() fault and
   incorrect buffer freeing. (Dan Carpenter)

----------------------------------------------------------------
Alex Williamson (1):
      vfio/ap/ccw/samples: Fix device_register() unwind path

Dan Carpenter (2):
      vfio/mlx5: fix error code in mlx5vf_precopy_ioctl()
      vfio/mlx5: error pointer dereference in error handling

Eric Farman (7):
      vfio/ccw: create a parent struct
      vfio/ccw: remove private->sch
      vfio/ccw: move private initialization to callback
      vfio/ccw: move private to mdev lifecycle
      vfio/ccw: remove release completion
      vfio/ccw: replace vfio_init_device with _alloc_
      vfio: Remove vfio_free_device

Jason Gunthorpe (6):
      vfio/pci: Move all the SPAPR PCI specific logic to vfio_pci_core.ko
      vfio/spapr: Move VFIO_CHECK_EXTENSION into tce_iommu_ioctl()
      vfio: Move vfio_spapr_iommu_eeh_ioctl into vfio_iommu_spapr_tce.c
      vfio: Remove CONFIG_VFIO_SPAPR_EEH
      vfio: Fold vfio_virqfd.ko into vfio.ko
      vfio: Extend the device migration protocol with PRE_COPY

Joao Martins (3):
      vfio/iova_bitmap: Explicitly include linux/slab.h
      vfio/iova_bitmap: Fix PAGE_SIZE unaligned bitmaps
      vfio/iova_bitmap: refactor iova_bitmap_set() to better handle page boundaries

Palmer Dabbelt (1):
      MAINTAINERS: git://github -> https://github.com for awilliam

Rafael Mendonca (1):
      vfio: platform: Do not pass return buffer to ACPI _RST method

Shameer Kolothum (4):
      hisi_acc_vfio_pci: Add support for precopy IOCTL
      hisi_acc_vfio_pci: Introduce support for PRE_COPY state transitions
      hisi_acc_vfio_pci: Move the dev compatibility tests for early check
      hisi_acc_vfio_pci: Enable PRE_COPY flag

Shang XiaoJing (2):
      vfio/mlx5: Switch to use module_pci_driver() macro
      samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe()

Shay Drory (3):
      net/mlx5: Introduce ifc bits for pre_copy
      vfio/mlx5: Fallback to STOP_COPY upon specific PRE_COPY error
      vfio/mlx5: Enable MIGRATION_PRE_COPY flag

Yishai Hadas (12):
      vfio: Add an option to get migration data size
      vfio/mlx5: Fix a typo in mlx5vf_cmd_load_vhca_state()
      vfio/mlx5: Enforce a single SAVE command at a time
      vfio/mlx5: Refactor PD usage
      vfio/mlx5: Refactor MKEY usage
      vfio/mlx5: Refactor migration file state
      vfio/mlx5: Refactor to use queue based data chunks
      vfio/mlx5: Introduce device transitions of PRE_COPY
      vfio/mlx5: Introduce SW headers for migration states
      vfio/mlx5: Introduce vfio precopy ioctl implementation
      vfio/mlx5: Consider temporary end of stream as part of PRE_COPY
      vfio/mlx5: Introduce multiple loads

 MAINTAINERS                                    |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c               |   1 -
 drivers/s390/cio/vfio_ccw_chp.c                |   5 +-
 drivers/s390/cio/vfio_ccw_drv.c                | 174 +++---
 drivers/s390/cio/vfio_ccw_fsm.c                |  27 +-
 drivers/s390/cio/vfio_ccw_ops.c                | 107 ++--
 drivers/s390/cio/vfio_ccw_private.h            |  37 +-
 drivers/s390/crypto/vfio_ap_drv.c              |   2 +-
 drivers/s390/crypto/vfio_ap_ops.c              |   6 -
 drivers/vfio/Kconfig                           |   7 +-
 drivers/vfio/Makefile                          |   5 +-
 drivers/vfio/fsl-mc/vfio_fsl_mc.c              |   1 -
 drivers/vfio/iova_bitmap.c                     |  33 +-
 drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 156 ++++-
 drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h |   2 +
 drivers/vfio/pci/mlx5/cmd.c                    | 413 ++++++++++---
 drivers/vfio/pci/mlx5/cmd.h                    |  96 ++-
 drivers/vfio/pci/mlx5/main.c                   | 784 ++++++++++++++++++++-----
 drivers/vfio/pci/vfio_pci_core.c               |  15 +-
 drivers/vfio/platform/vfio_amba.c              |   1 -
 drivers/vfio/platform/vfio_platform.c          |   1 -
 drivers/vfio/platform/vfio_platform_common.c   |   3 +-
 drivers/vfio/vfio.h                            |  13 +
 drivers/vfio/vfio_iommu_spapr_tce.c            |  65 +-
 drivers/vfio/vfio_main.c                       | 145 ++++-
 drivers/vfio/vfio_spapr_eeh.c                  | 107 ----
 drivers/vfio/virqfd.c                          |  17 +-
 include/linux/mlx5/mlx5_ifc.h                  |  14 +-
 include/linux/vfio.h                           |  31 +-
 include/uapi/linux/vfio.h                      | 136 ++++-
 samples/vfio-mdev/mbochs.c                     |   8 +-
 samples/vfio-mdev/mdpy-fb.c                    |   8 +-
 samples/vfio-mdev/mdpy.c                       |   8 +-
 samples/vfio-mdev/mtty.c                       |   8 +-
 34 files changed, 1792 insertions(+), 646 deletions(-)
 delete mode 100644 drivers/vfio/vfio_spapr_eeh.c

Conflict resolution chunks vs mainline (057b40f43ce4):

+++ b/drivers/vfio/Kconfig
@@@ -46,17 -38,6 +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"
+++ b/drivers/vfio/Makefile
@@@ -2,17 -2,12 +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/
+++ b/drivers/vfio/vfio_main.c
@@@ -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);
  }
  

Comments

Linus Torvalds Dec. 15, 2022, 9:20 p.m. UTC | #1
On Thu, Dec 15, 2022 at 12:24 PM Alex Williamson
<alex.williamson@redhat.com> wrote:
>
> I've provided resolution of the conflict chunks here below
> the diffstat.

Ok, mine is slightly different, but the differences seem to be either
irrelevant ordering differences (in the Makefile), and due to Jason
apparently renaming the goto targets which I didn't do.

But hey,. maybe I messed up, so please do check out it and test. I
verified that it all builds cleanly for me, but that's all the testing
it has gotten.

            Linus
  
pr-tracker-bot@kernel.org Dec. 15, 2022, 9:20 p.m. UTC | #2
The pull request you sent on Thu, 15 Dec 2022 13:24:15 -0700:

> https://github.com/awilliam/linux-vfio.git tags/vfio-v6.2-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/785d21ba2f447fb26df4b22f45653763beb767ea

Thank you!
  
Alex Williamson Dec. 15, 2022, 9:55 p.m. UTC | #3
On Thu, 15 Dec 2022 13:20:11 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Thu, Dec 15, 2022 at 12:24 PM Alex Williamson
> <alex.williamson@redhat.com> wrote:
> >
> > I've provided resolution of the conflict chunks here below
> > the diffstat.  
> 
> Ok, mine is slightly different, but the differences seem to be either
> irrelevant ordering differences (in the Makefile), and due to Jason
> apparently renaming the goto targets which I didn't do.
> 
> But hey,. maybe I messed up, so please do check out it and test. I
> verified that it all builds cleanly for me, but that's all the testing
> it has gotten.

Yep, all looks well.  Thanks!

Alex
  

Patch

diff --cc drivers/vfio/Kconfig
index 286c1663bd75,0b8d53f63c7e..a8f544629467
--- a/drivers/vfio/Kconfig
diff --cc drivers/vfio/Makefile
index 3783db7e8082,0721ed4831c9..7eae72e2c6bf
--- a/drivers/vfio/Makefile
diff --cc drivers/vfio/vfio_main.c
index e21ff965141e,03dbcd3d96f0..d4087fe74199
--- a/drivers/vfio/vfio_main.c