1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2023-2024 Intel Corporation 4 */ 5 6 #ifndef _XE_GT_SRIOV_VF_TYPES_H_ 7 #define _XE_GT_SRIOV_VF_TYPES_H_ 8 9 #include <linux/types.h> 10 #include <linux/wait.h> 11 #include <linux/workqueue.h> 12 #include "xe_uc_fw_types.h" 13 14 /** 15 * struct xe_gt_sriov_vf_selfconfig - VF configuration data. 16 */ 17 struct xe_gt_sriov_vf_selfconfig { 18 /** @num_ctxs: assigned number of GuC submission context IDs. */ 19 u16 num_ctxs; 20 /** @num_dbs: assigned number of GuC doorbells IDs. */ 21 u16 num_dbs; 22 }; 23 24 /** 25 * struct xe_gt_sriov_vf_runtime - VF runtime data. 26 */ 27 struct xe_gt_sriov_vf_runtime { 28 /** @gmdid: cached value of the GDMID register. */ 29 u32 gmdid; 30 /** @regs_size: size of runtime register array. */ 31 u32 regs_size; 32 /** @num_regs: number of runtime registers in the array. */ 33 u32 num_regs; 34 /** @regs: pointer to array of register offset/value pairs. */ 35 struct vf_runtime_reg { 36 /** @regs.offset: register offset. */ 37 u32 offset; 38 /** @regs.value: register value. */ 39 u32 value; 40 } *regs; 41 }; 42 43 /** 44 * xe_gt_sriov_vf_migration - VF migration data. 45 */ 46 struct xe_gt_sriov_vf_migration { 47 /** @migration: VF migration recovery worker */ 48 struct work_struct worker; 49 /** @lock: Protects recovery_queued, teardown */ 50 spinlock_t lock; 51 /** @wq: wait queue for migration fixes */ 52 wait_queue_head_t wq; 53 /** @scratch: Scratch memory for VF recovery */ 54 void *scratch; 55 /** @recovery_teardown: VF post migration recovery is being torn down */ 56 bool recovery_teardown; 57 /** @recovery_queued: VF post migration recovery in queued */ 58 bool recovery_queued; 59 /** @recovery_inprogress: VF post migration recovery in progress */ 60 bool recovery_inprogress; 61 /** @ggtt_need_fixes: VF GGTT needs fixes */ 62 bool ggtt_need_fixes; 63 }; 64 65 /** 66 * struct xe_gt_sriov_vf - GT level VF virtualization data. 67 */ 68 struct xe_gt_sriov_vf { 69 /** @wanted_guc_version: minimum wanted GuC ABI version. */ 70 struct xe_uc_fw_version wanted_guc_version; 71 /** @guc_version: negotiated GuC ABI version. */ 72 struct xe_uc_fw_version guc_version; 73 /** @self_config: resource configurations. */ 74 struct xe_gt_sriov_vf_selfconfig self_config; 75 /** @runtime: runtime data retrieved from the PF. */ 76 struct xe_gt_sriov_vf_runtime runtime; 77 /** @migration: migration data for the VF. */ 78 struct xe_gt_sriov_vf_migration migration; 79 }; 80 81 #endif 82