1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2024 Intel Corporation 4 */ 5 6 #ifndef _XE_GT_SRIOV_PF_CONTROL_TYPES_H_ 7 #define _XE_GT_SRIOV_PF_CONTROL_TYPES_H_ 8 9 #include <linux/completion.h> 10 #include <linux/spinlock.h> 11 #include <linux/workqueue_types.h> 12 13 /** 14 * enum xe_gt_sriov_control_bits - Various bits used by the PF to represent a VF state 15 * 16 * @XE_GT_SRIOV_STATE_WIP: indicates that some operations are in progress. 17 * @XE_GT_SRIOV_STATE_FLR_WIP: indicates that a VF FLR is in progress. 18 * @XE_GT_SRIOV_STATE_FLR_SEND_START: indicates that the PF wants to send a FLR START command. 19 * @XE_GT_SRIOV_STATE_FLR_WAIT_GUC: indicates that the PF awaits for a response from the GuC. 20 * @XE_GT_SRIOV_STATE_FLR_GUC_DONE: indicates that the PF has received a response from the GuC. 21 * @XE_GT_SRIOV_STATE_FLR_RESET_CONFIG: indicates that the PF needs to clear VF's resources. 22 * @XE_GT_SRIOV_STATE_FLR_RESET_DATA: indicates that the PF needs to clear VF's data. 23 * @XE_GT_SRIOV_STATE_FLR_RESET_MMIO: indicates that the PF needs to reset VF's registers. 24 * @XE_GT_SRIOV_STATE_FLR_SEND_FINISH: indicates that the PF wants to send a FLR FINISH message. 25 * @XE_GT_SRIOV_STATE_FLR_FAILED: indicates that VF FLR sequence failed. 26 * @XE_GT_SRIOV_STATE_PAUSE_WIP: indicates that a VF pause operation is in progress. 27 * @XE_GT_SRIOV_STATE_PAUSE_SEND_PAUSE: indicates that the PF is about to send a PAUSE command. 28 * @XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC: indicates that the PF awaits for a response from the GuC. 29 * @XE_GT_SRIOV_STATE_PAUSE_GUC_DONE: indicates that the PF has received a response from the GuC. 30 * @XE_GT_SRIOV_STATE_PAUSE_SAVE_GUC: indicates that the PF needs to save the VF GuC state. 31 * @XE_GT_SRIOV_STATE_PAUSE_FAILED: indicates that a VF pause operation has failed. 32 * @XE_GT_SRIOV_STATE_PAUSED: indicates that the VF is paused. 33 * @XE_GT_SRIOV_STATE_RESUME_WIP: indicates the a VF resume operation is in progress. 34 * @XE_GT_SRIOV_STATE_RESUME_SEND_RESUME: indicates that the PF is about to send RESUME command. 35 * @XE_GT_SRIOV_STATE_RESUME_FAILED: indicates that a VF resume operation has failed. 36 * @XE_GT_SRIOV_STATE_RESUMED: indicates that the VF was resumed. 37 * @XE_GT_SRIOV_STATE_STOP_WIP: indicates that a VF stop operation is in progress. 38 * @XE_GT_SRIOV_STATE_STOP_SEND_STOP: indicates that the PF wants to send a STOP command. 39 * @XE_GT_SRIOV_STATE_STOP_FAILED: indicates that the VF stop operation has failed 40 * @XE_GT_SRIOV_STATE_STOPPED: indicates that the VF was stopped. 41 * @XE_GT_SRIOV_STATE_MISMATCH: indicates that the PF has detected a VF state mismatch. 42 */ 43 enum xe_gt_sriov_control_bits { 44 XE_GT_SRIOV_STATE_WIP = 1, 45 46 XE_GT_SRIOV_STATE_FLR_WIP, 47 XE_GT_SRIOV_STATE_FLR_SEND_START, 48 XE_GT_SRIOV_STATE_FLR_WAIT_GUC, 49 XE_GT_SRIOV_STATE_FLR_GUC_DONE, 50 XE_GT_SRIOV_STATE_FLR_RESET_CONFIG, 51 XE_GT_SRIOV_STATE_FLR_RESET_DATA, 52 XE_GT_SRIOV_STATE_FLR_RESET_MMIO, 53 XE_GT_SRIOV_STATE_FLR_SEND_FINISH, 54 XE_GT_SRIOV_STATE_FLR_FAILED, 55 56 XE_GT_SRIOV_STATE_PAUSE_WIP, 57 XE_GT_SRIOV_STATE_PAUSE_SEND_PAUSE, 58 XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC, 59 XE_GT_SRIOV_STATE_PAUSE_GUC_DONE, 60 XE_GT_SRIOV_STATE_PAUSE_SAVE_GUC, 61 XE_GT_SRIOV_STATE_PAUSE_FAILED, 62 XE_GT_SRIOV_STATE_PAUSED, 63 64 XE_GT_SRIOV_STATE_RESUME_WIP, 65 XE_GT_SRIOV_STATE_RESUME_SEND_RESUME, 66 XE_GT_SRIOV_STATE_RESUME_FAILED, 67 XE_GT_SRIOV_STATE_RESUMED, 68 69 XE_GT_SRIOV_STATE_STOP_WIP, 70 XE_GT_SRIOV_STATE_STOP_SEND_STOP, 71 XE_GT_SRIOV_STATE_STOP_FAILED, 72 XE_GT_SRIOV_STATE_STOPPED, 73 74 XE_GT_SRIOV_STATE_MISMATCH = BITS_PER_LONG - 1, 75 }; 76 77 /** 78 * struct xe_gt_sriov_control_state - GT-level per-VF control state. 79 * 80 * Used by the PF driver to maintain per-VF control data. 81 */ 82 struct xe_gt_sriov_control_state { 83 /** @state: VF state bits */ 84 unsigned long state; 85 86 /** @done: completion of async operations */ 87 struct completion done; 88 89 /** @link: link into worker list */ 90 struct list_head link; 91 }; 92 93 /** 94 * struct xe_gt_sriov_pf_control - GT-level control data. 95 * 96 * Used by the PF driver to maintain its data. 97 */ 98 struct xe_gt_sriov_pf_control { 99 /** @worker: worker that executes a VF operations */ 100 struct work_struct worker; 101 102 /** @list: list of VF entries that have a pending work */ 103 struct list_head list; 104 105 /** @lock: protects VF pending list */ 106 spinlock_t lock; 107 }; 108 109 #endif 110