xref: /linux/drivers/gpu/drm/xe/xe_gt_sriov_vf_types.h (revision d3b402c5a2d47f51eb0581da1a7b142f82cb10d1)
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 	/** @uses_sched_groups: whether PF enabled sched groups or not. */
31 	bool uses_sched_groups;
32 	/** @regs_size: size of runtime register array. */
33 	u32 regs_size;
34 	/** @num_regs: number of runtime registers in the array. */
35 	u32 num_regs;
36 	/** @regs: pointer to array of register offset/value pairs. */
37 	struct vf_runtime_reg {
38 		/** @regs.offset: register offset. */
39 		u32 offset;
40 		/** @regs.value: register value. */
41 		u32 value;
42 	} *regs;
43 };
44 
45 /**
46  * struct xe_gt_sriov_vf_migration - VF migration data.
47  */
48 struct xe_gt_sriov_vf_migration {
49 	/** @worker: VF migration recovery worker */
50 	struct work_struct worker;
51 	/** @lock: Protects recovery_queued, teardown */
52 	spinlock_t lock;
53 	/** @wq: wait queue for migration fixes */
54 	wait_queue_head_t wq;
55 	/** @scratch: Scratch memory for VF recovery */
56 	void *scratch;
57 	/** @debug: Debug hooks for delaying migration */
58 	struct {
59 		/**
60 		 * @debug.resfix_stoppers: Stop and wait at different stages
61 		 * during post migration recovery
62 		 */
63 		u8 resfix_stoppers;
64 	} debug;
65 	/**
66 	 * @resfix_marker: Marker sent on start and on end of post-migration
67 	 * steps.
68 	 */
69 	u8 resfix_marker;
70 	/** @recovery_teardown: VF post migration recovery is being torn down */
71 	bool recovery_teardown;
72 	/** @recovery_queued: VF post migration recovery in queued */
73 	bool recovery_queued;
74 	/** @recovery_inprogress: VF post migration recovery in progress */
75 	bool recovery_inprogress;
76 	/** @ggtt_need_fixes: VF GGTT needs fixes */
77 	bool ggtt_need_fixes;
78 };
79 
80 /**
81  * struct xe_gt_sriov_vf - GT level VF virtualization data.
82  */
83 struct xe_gt_sriov_vf {
84 	/** @wanted_guc_version: minimum wanted GuC ABI version. */
85 	struct xe_uc_fw_version wanted_guc_version;
86 	/** @guc_version: negotiated GuC ABI version. */
87 	struct xe_uc_fw_version guc_version;
88 	/** @self_config: resource configurations. */
89 	struct xe_gt_sriov_vf_selfconfig self_config;
90 	/** @runtime: runtime data retrieved from the PF. */
91 	struct xe_gt_sriov_vf_runtime runtime;
92 	/** @migration: migration data for the VF. */
93 	struct xe_gt_sriov_vf_migration migration;
94 };
95 
96 #endif
97