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_FAILED: indicates that a VF pause operation has failed. 31 * @XE_GT_SRIOV_STATE_PAUSED: indicates that the VF is paused. 32 * @XE_GT_SRIOV_STATE_RESUME_WIP: indicates the a VF resume operation is in progress. 33 * @XE_GT_SRIOV_STATE_RESUME_SEND_RESUME: indicates that the PF is about to send RESUME command. 34 * @XE_GT_SRIOV_STATE_RESUME_FAILED: indicates that a VF resume operation has failed. 35 * @XE_GT_SRIOV_STATE_RESUMED: indicates that the VF was resumed. 36 * @XE_GT_SRIOV_STATE_STOP_WIP: indicates that a VF stop operation is in progress. 37 * @XE_GT_SRIOV_STATE_STOP_SEND_STOP: indicates that the PF wants to send a STOP command. 38 * @XE_GT_SRIOV_STATE_STOP_FAILED: indicates that the VF stop operation has failed 39 * @XE_GT_SRIOV_STATE_STOPPED: indicates that the VF was stopped. 40 * @XE_GT_SRIOV_STATE_MISMATCH: indicates that the PF has detected a VF state mismatch. 41 */ 42 enum xe_gt_sriov_control_bits { 43 XE_GT_SRIOV_STATE_WIP = 1, 44 45 XE_GT_SRIOV_STATE_FLR_WIP, 46 XE_GT_SRIOV_STATE_FLR_SEND_START, 47 XE_GT_SRIOV_STATE_FLR_WAIT_GUC, 48 XE_GT_SRIOV_STATE_FLR_GUC_DONE, 49 XE_GT_SRIOV_STATE_FLR_RESET_CONFIG, 50 XE_GT_SRIOV_STATE_FLR_RESET_DATA, 51 XE_GT_SRIOV_STATE_FLR_RESET_MMIO, 52 XE_GT_SRIOV_STATE_FLR_SEND_FINISH, 53 XE_GT_SRIOV_STATE_FLR_FAILED, 54 55 XE_GT_SRIOV_STATE_PAUSE_WIP, 56 XE_GT_SRIOV_STATE_PAUSE_SEND_PAUSE, 57 XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC, 58 XE_GT_SRIOV_STATE_PAUSE_GUC_DONE, 59 XE_GT_SRIOV_STATE_PAUSE_FAILED, 60 XE_GT_SRIOV_STATE_PAUSED, 61 62 XE_GT_SRIOV_STATE_RESUME_WIP, 63 XE_GT_SRIOV_STATE_RESUME_SEND_RESUME, 64 XE_GT_SRIOV_STATE_RESUME_FAILED, 65 XE_GT_SRIOV_STATE_RESUMED, 66 67 XE_GT_SRIOV_STATE_STOP_WIP, 68 XE_GT_SRIOV_STATE_STOP_SEND_STOP, 69 XE_GT_SRIOV_STATE_STOP_FAILED, 70 XE_GT_SRIOV_STATE_STOPPED, 71 72 XE_GT_SRIOV_STATE_MISMATCH = BITS_PER_LONG - 1, 73 }; 74 75 /** 76 * struct xe_gt_sriov_control_state - GT-level per-VF control state. 77 * 78 * Used by the PF driver to maintain per-VF control data. 79 */ 80 struct xe_gt_sriov_control_state { 81 /** @state: VF state bits */ 82 unsigned long state; 83 84 /** @done: completion of async operations */ 85 struct completion done; 86 87 /** @link: link into worker list */ 88 struct list_head link; 89 }; 90 91 /** 92 * struct xe_gt_sriov_pf_control - GT-level control data. 93 * 94 * Used by the PF driver to maintain its data. 95 */ 96 struct xe_gt_sriov_pf_control { 97 /** @worker: worker that executes a VF operations */ 98 struct work_struct worker; 99 100 /** @list: list of VF entries that have a pending work */ 101 struct list_head list; 102 103 /** @lock: protects VF pending list */ 104 spinlock_t lock; 105 }; 106 107 #endif 108