Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 154 lines 5.3 kB view raw
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_flr_prepare() - Notify PF that VF FLR prepare has started. 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 marks VF FLR as pending before PF receives GuC FLR event. 36 * 37 * Return: 0 on success or a negative error code on failure. 38 */ 39int xe_sriov_vfio_flr_prepare(struct xe_device *xe, unsigned int vfid); 40 41/** 42 * xe_sriov_vfio_wait_flr_done() - Wait for VF FLR completion. 43 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 44 * @vfid: the VF identifier (can't be 0) 45 * 46 * This function will wait until VF FLR is processed by PF on all tiles (or 47 * until timeout occurs). 48 * 49 * Return: 0 on success or a negative error code on failure. 50 */ 51int xe_sriov_vfio_wait_flr_done(struct xe_device *xe, unsigned int vfid); 52 53/** 54 * xe_sriov_vfio_suspend_device() - Suspend 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 pause VF on all tiles/GTs. 59 * 60 * Return: 0 on success or a negative error code on failure. 61 */ 62int xe_sriov_vfio_suspend_device(struct xe_device *xe, unsigned int vfid); 63 64/** 65 * xe_sriov_vfio_resume_device() - Resume VF. 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 * This function will resume VF on all tiles. 70 * 71 * Return: 0 on success or a negative error code on failure. 72 */ 73int xe_sriov_vfio_resume_device(struct xe_device *xe, unsigned int vfid); 74 75/** 76 * xe_sriov_vfio_stop_copy_enter() - Initiate a VF device migration data save. 77 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 78 * @vfid: the VF identifier (can't be 0) 79 * 80 * Return: 0 on success or a negative error code on failure. 81 */ 82int xe_sriov_vfio_stop_copy_enter(struct xe_device *xe, unsigned int vfid); 83 84/** 85 * xe_sriov_vfio_stop_copy_exit() - Finish a VF device migration data save. 86 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 87 * @vfid: the VF identifier (can't be 0) 88 * 89 * Return: 0 on success or a negative error code on failure. 90 */ 91int xe_sriov_vfio_stop_copy_exit(struct xe_device *xe, unsigned int vfid); 92 93/** 94 * xe_sriov_vfio_resume_data_enter() - Initiate a VF device migration data restore. 95 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 96 * @vfid: the VF identifier (can't be 0) 97 * 98 * Return: 0 on success or a negative error code on failure. 99 */ 100int xe_sriov_vfio_resume_data_enter(struct xe_device *xe, unsigned int vfid); 101 102/** 103 * xe_sriov_vfio_resume_data_exit() - Finish a VF device migration data restore. 104 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 105 * @vfid: the VF identifier (can't be 0) 106 * 107 * Return: 0 on success or a negative error code on failure. 108 */ 109int xe_sriov_vfio_resume_data_exit(struct xe_device *xe, unsigned int vfid); 110 111/** 112 * xe_sriov_vfio_error() - Move VF device to error state. 113 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 114 * @vfid: the VF identifier (can't be 0) 115 * 116 * Reset is needed to move it out of error state. 117 * 118 * Return: 0 on success or a negative error code on failure. 119 */ 120int xe_sriov_vfio_error(struct xe_device *xe, unsigned int vfid); 121 122/** 123 * xe_sriov_vfio_data_read() - Read migration data from the VF device. 124 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 125 * @vfid: the VF identifier (can't be 0) 126 * @buf: start address of userspace buffer 127 * @len: requested read size from userspace 128 * 129 * Return: number of bytes that has been successfully read, 130 * 0 if no more migration data is available, -errno on failure. 131 */ 132ssize_t xe_sriov_vfio_data_read(struct xe_device *xe, unsigned int vfid, 133 char __user *buf, size_t len); 134/** 135 * xe_sriov_vfio_data_write() - Write migration data to the VF device. 136 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 137 * @vfid: the VF identifier (can't be 0) 138 * @buf: start address of userspace buffer 139 * @len: requested write size from userspace 140 * 141 * Return: number of bytes that has been successfully written, -errno on failure. 142 */ 143ssize_t xe_sriov_vfio_data_write(struct xe_device *xe, unsigned int vfid, 144 const char __user *buf, size_t len); 145/** 146 * xe_sriov_vfio_stop_copy_size() - Get a size estimate of VF device migration data. 147 * @xe: the PF &xe_device obtained by calling xe_sriov_vfio_get_pf() 148 * @vfid: the VF identifier (can't be 0) 149 * 150 * Return: migration data size in bytes or a negative error code on failure. 151 */ 152ssize_t xe_sriov_vfio_stop_copy_size(struct xe_device *xe, unsigned int vfid); 153 154#endif