vfio: Extend the device migration protocol with RUNNING_P2P
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 24 Feb 2022 14:20:19 +0000 (16:20 +0200)
committerLeon Romanovsky <leonro@nvidia.com>
Thu, 3 Mar 2022 11:00:16 +0000 (13:00 +0200)
commit8cb3d83b959be0631cd719b995c40c3cda21cd47
tree86f1b2fd24b2b9c9d2ae2ab1083707c710ce83fd
parent115dcec65f61d53e25e1bed5e380468b30f98b14
vfio: Extend the device migration protocol with RUNNING_P2P

The RUNNING_P2P state is designed to support multiple devices in the same
VM that are doing P2P transactions between themselves. When in RUNNING_P2P
the device must be able to accept incoming P2P transactions but should not
generate outgoing P2P transactions.

As an optional extension to the mandatory states it is defined as
in between STOP and RUNNING:
   STOP -> RUNNING_P2P -> RUNNING -> RUNNING_P2P -> STOP

For drivers that are unable to support RUNNING_P2P the core code
silently merges RUNNING_P2P and RUNNING together. Unless driver support
is present, the new state cannot be used in SET_STATE.
Drivers that support this will be required to implement 4 FSM arcs
beyond the basic FSM. 2 of the basic FSM arcs become combination
transitions.

Compared to the v1 clarification, NDMA is redefined into FSM states and is
described in terms of the desired P2P quiescent behavior, noting that
halting all DMA is an acceptable implementation.

Link: https://lore.kernel.org/all/20220224142024.147653-11-yishaih@nvidia.com
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
drivers/vfio/vfio.c
include/linux/vfio.h
include/uapi/linux/vfio.h