FILE
xe_sriov_vfio.h
File preview with syntax highlighting.
linux-6.19.14/include/drm/intel/xe_sriov_vfio.h
1/* SPDX-License-Identifier: MIT */ 2/* 3 * Copyright © 2025 Intel Corporation 4 */ 5 6#ifndef _XE_SRIOV_VFIO_H_ 7#define _XE_SRIOV_VFIO_H_ 8 9#include <linux/types.h> 10 11struct pci_dev; 12struct xe_device; 13 14/** 15 * xe_sriov_vfio_get_pf() - Get PF &xe_device. 16 * @pdev: the VF &pci_dev device 17 * 18 * Return: pointer to PF &xe_device, NULL otherwise. 19 */ 20struct xe_device *xe_sriov_vfio_get_pf(struct pci_dev *pdev); 21 22/** 23 * xe_sriov_vfio_migration_supported() - Check if migration is supported. 24 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 25 * 26 * Return: true if migration is supported, false otherwise. 27 */ 28bool xe_sriov_vfio_migration_supported(struct xe_device *xe); 29 30/** 31 * xe_sriov_vfio_wait_flr_done() - Wait for VF FLR completion. 32 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 33 * @vfid: the VF identifier (can't be 0) 34 * 35 * This function will wait until VF FLR is processed by PF on all tiles (or 36 * until timeout occurs). 37 * 38 * Return: 0 on success or a negative error code on failure. 39 */ 40int xe_sriov_vfio_wait_flr_done(struct xe_device *xe, unsigned int vfid); 41 42/** 43 * xe_sriov_vfio_suspend_device() - Suspend VF. 44 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 45 * @vfid: the VF identifier (can't be 0) 46 * 47 * This function will pause VF on all tiles/GTs. 48 * 49 * Return: 0 on success or a negative error code on failure. 50 */ 51int xe_sriov_vfio_suspend_device(struct xe_device *xe, unsigned int vfid); 52 53/** 54 * xe_sriov_vfio_resume_device() - Resume VF. 55 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 56 * @vfid: the VF identifier (can't be 0) 57 * 58 * This function will resume VF on all tiles. 59 * 60 * Return: 0 on success or a negative error code on failure. 61 */ 62int xe_sriov_vfio_resume_device(struct xe_device *xe, unsigned int vfid); 63 64/** 65 * xe_sriov_vfio_stop_copy_enter() - Initiate a VF device migration data save. 66 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 67 * @vfid: the VF identifier (can't be 0) 68 * 69 * Return: 0 on success or a negative error code on failure. 70 */ 71int xe_sriov_vfio_stop_copy_enter(struct xe_device *xe, unsigned int vfid); 72 73/** 74 * xe_sriov_vfio_stop_copy_exit() - Finish a VF device migration data save. 75 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 76 * @vfid: the VF identifier (can't be 0) 77 * 78 * Return: 0 on success or a negative error code on failure. 79 */ 80int xe_sriov_vfio_stop_copy_exit(struct xe_device *xe, unsigned int vfid); 81 82/** 83 * xe_sriov_vfio_resume_data_enter() - Initiate a VF device migration data restore. 84 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 85 * @vfid: the VF identifier (can't be 0) 86 * 87 * Return: 0 on success or a negative error code on failure. 88 */ 89int xe_sriov_vfio_resume_data_enter(struct xe_device *xe, unsigned int vfid); 90 91/** 92 * xe_sriov_vfio_resume_data_exit() - Finish a VF device migration data restore. 93 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 94 * @vfid: the VF identifier (can't be 0) 95 * 96 * Return: 0 on success or a negative error code on failure. 97 */ 98int xe_sriov_vfio_resume_data_exit(struct xe_device *xe, unsigned int vfid); 99 100/** 101 * xe_sriov_vfio_error() - Move VF device to error state. 102 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 103 * @vfid: the VF identifier (can't be 0) 104 * 105 * Reset is needed to move it out of error state. 106 * 107 * Return: 0 on success or a negative error code on failure. 108 */ 109int xe_sriov_vfio_error(struct xe_device *xe, unsigned int vfid); 110 111/** 112 * xe_sriov_vfio_data_read() - Read migration data from the VF device. 113 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 114 * @vfid: the VF identifier (can't be 0) 115 * @buf: start address of userspace buffer 116 * @len: requested read size from userspace 117 * 118 * Return: number of bytes that has been successfully read, 119 * 0 if no more migration data is available, -errno on failure. 120 */ 121ssize_t xe_sriov_vfio_data_read(struct xe_device *xe, unsigned int vfid, 122 char __user *buf, size_t len); 123/** 124 * xe_sriov_vfio_data_write() - Write migration data to the VF device. 125 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 126 * @vfid: the VF identifier (can't be 0) 127 * @buf: start address of userspace buffer 128 * @len: requested write size from userspace 129 * 130 * Return: number of bytes that has been successfully written, -errno on failure. 131 */ 132ssize_t xe_sriov_vfio_data_write(struct xe_device *xe, unsigned int vfid, 133 const char __user *buf, size_t len); 134/** 135 * xe_sriov_vfio_stop_copy_size() - Get a size estimate of VF device migration data. 136 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 137 * @vfid: the VF identifier (can't be 0) 138 * 139 * Return: migration data size in bytes or a negative error code on failure. 140 */ 141ssize_t xe_sriov_vfio_stop_copy_size(struct xe_device *xe, unsigned int vfid); 142 143#endif
~/
Read-only file preview.