mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
Add live migration support via the VFIO subsystem. The migration implementation aligns with the definition from uapi/vfio.h and uses the pds_core PF's adminq for device configuration. The ability to suspend, resume, and transfer VF device state data is included along with the required admin queue command structures and implementations. PDS_LM_CMD_SUSPEND and PDS_LM_CMD_SUSPEND_STATUS are added to support the VF device suspend operation. PDS_LM_CMD_RESUME is added to support the VF device resume operation. PDS_LM_CMD_STATE_SIZE is added to determine the exact size of the VF device state data. PDS_LM_CMD_SAVE is added to get the VF device state data. PDS_LM_CMD_RESTORE is added to restore the VF device with the previously saved data from PDS_LM_CMD_SAVE. PDS_LM_CMD_HOST_VF_STATUS is added to notify the DSC/firmware when a migration is in/not-in progress from the host's perspective. The DSC/firmware can use this to clear/setup any necessary state related to a migration. Signed-off-by: Brett Creeley <brett.creeley@amd.com> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20230807205755.29579-6-brett.creeley@amd.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
34 lines
918 B
C
34 lines
918 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright(c) 2023 Advanced Micro Devices, Inc. */
|
|
|
|
#ifndef _VFIO_DEV_H_
|
|
#define _VFIO_DEV_H_
|
|
|
|
#include <linux/pci.h>
|
|
#include <linux/vfio_pci_core.h>
|
|
|
|
#include "lm.h"
|
|
|
|
struct pds_vfio_pci_device {
|
|
struct vfio_pci_core_device vfio_coredev;
|
|
|
|
struct pds_vfio_lm_file *save_file;
|
|
struct pds_vfio_lm_file *restore_file;
|
|
struct mutex state_mutex; /* protect migration state */
|
|
enum vfio_device_mig_state state;
|
|
spinlock_t reset_lock; /* protect reset_done flow */
|
|
u8 deferred_reset;
|
|
|
|
int vf_id;
|
|
u16 client_id;
|
|
};
|
|
|
|
const struct vfio_device_ops *pds_vfio_ops_info(void);
|
|
struct pds_vfio_pci_device *pds_vfio_pci_drvdata(struct pci_dev *pdev);
|
|
void pds_vfio_reset(struct pds_vfio_pci_device *pds_vfio);
|
|
|
|
struct pci_dev *pds_vfio_to_pci_dev(struct pds_vfio_pci_device *pds_vfio);
|
|
struct device *pds_vfio_to_dev(struct pds_vfio_pci_device *pds_vfio);
|
|
|
|
#endif /* _VFIO_DEV_H_ */
|