vfio/mlx5: Enable querying state size which is > 4GB
authorYishai Hadas <yishaih@nvidia.com>
Mon, 11 Sep 2023 09:38:51 +0000 (12:38 +0300)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 28 Sep 2023 19:07:29 +0000 (13:07 -0600)
commit543640af84802e84f1e38ee102882d6ae1354701
tree59d84b7a10abb0668f23200dbd13224c002218d3
parent34a64c8eac2380a28eeab191dc5bf4e0dbadf7c6
vfio/mlx5: Enable querying state size which is > 4GB

Once the device supports 'chunk mode' the driver can support state size
which is larger than 4GB.

In that case the device has the capability to split a single image to
multiple chunks as long as the software provides a buffer in the minimum
size reported by the device.

The driver should query for the minimum buffer size required using
QUERY_VHCA_MIGRATION_STATE command with the 'chunk' bit set in its
input, in that case, the output will include both the minimum buffer
size (i.e.  required_umem_size) and also the remaining total size to be
reported/used where that it will be applicable.

At that point in the series the 'chunk' bit is off, the last patch will
activate the feature once all pieces will be ready.

Note:
Before this change we were limited to 4GB state size as of 4 bytes max
value based on the device specification for the query/save/load
commands.

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20230911093856.81910-5-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/mlx5/cmd.c
drivers/vfio/pci/mlx5/cmd.h
drivers/vfio/pci/mlx5/main.c