1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2023 Advanced Micro Devices, Inc. */
8 #include <linux/mutex.h>
9 #include <linux/scatterlist.h>
10 #include <linux/types.h>
12 #include <linux/pds/pds_common.h>
13 #include <linux/pds/pds_adminq.h>
15 struct pds_vfio_lm_file
{
17 struct mutex lock
; /* protect live migration data file */
18 u64 size
; /* Size with valid data */
19 u64 alloc_size
; /* Total allocated size. Always >= len */
20 void *page_mem
; /* memory allocated for pages */
21 struct page
**pages
; /* Backing pages for file */
22 unsigned long long npages
;
23 struct sg_table sg_table
; /* SG table for backing pages */
24 struct pds_lm_sg_elem
*sgl
; /* DMA mapping */
27 struct scatterlist
*last_offset_sg
; /* Iterator */
28 unsigned int sg_last_entry
;
29 unsigned long last_offset
;
33 struct pds_vfio_pci_device
;
36 pds_vfio_step_device_state_locked(struct pds_vfio_pci_device
*pds_vfio
,
37 enum vfio_device_mig_state next
);
39 void pds_vfio_put_save_file(struct pds_vfio_pci_device
*pds_vfio
);
40 void pds_vfio_put_restore_file(struct pds_vfio_pci_device
*pds_vfio
);