xref: /linux/drivers/gpu/drm/xe/xe_gt_mcr.h (revision 68a052239fc4b351e961f698b824f7654a346091)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 
6 #ifndef _XE_GT_MCR_H_
7 #define _XE_GT_MCR_H_
8 
9 #include "regs/xe_reg_defs.h"
10 #include "xe_gt_topology.h"
11 
12 struct drm_printer;
13 struct xe_gt;
14 
15 void xe_gt_mcr_init_early(struct xe_gt *gt);
16 void xe_gt_mcr_init(struct xe_gt *gt);
17 
18 void xe_gt_mcr_set_implicit_defaults(struct xe_gt *gt);
19 
20 u32 xe_gt_mcr_unicast_read(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
21 			   int group, int instance);
22 u32 xe_gt_mcr_unicast_read_any(struct xe_gt *gt, struct xe_reg_mcr mcr_reg);
23 
24 void xe_gt_mcr_unicast_write(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
25 			     u32 value, int group, int instance);
26 void xe_gt_mcr_multicast_write(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
27 			       u32 value);
28 
29 bool xe_gt_mcr_get_nonterminated_steering(struct xe_gt *gt,
30 					  struct xe_reg_mcr reg_mcr,
31 					  u8 *group, u8 *instance);
32 
33 void xe_gt_mcr_steering_dump(struct xe_gt *gt, struct drm_printer *p);
34 void xe_gt_mcr_get_dss_steering(const struct xe_gt *gt,
35 				unsigned int dss, u16 *group, u16 *instance);
36 u32 xe_gt_mcr_steering_info_to_dss_id(struct xe_gt *gt, u16 group, u16 instance);
37 
38 /*
39  * Loop over each DSS and determine the group and instance IDs that
40  * should be used to steer MCR accesses toward this DSS.
41  * @dss: DSS ID to obtain steering for
42  * @gt: GT structure
43  * @group: steering group ID, data type: u16
44  * @instance: steering instance ID, data type: u16
45  */
46 #define for_each_dss_steering(dss, gt, group, instance) \
47 	for_each_dss((dss), (gt)) \
48 		for_each_if((xe_gt_mcr_get_dss_steering((gt), (dss), &(group), &(instance)), true))
49 
50 /*
51  * Loop over each DSS available for geometry and determine the group and
52  * instance IDs that should be used to steer MCR accesses toward this DSS.
53  * @dss: DSS ID to obtain steering for
54  * @gt: GT structure
55  * @group: steering group ID, data type: u16
56  * @instance: steering instance ID, data type: u16
57  */
58 #define for_each_geometry_dss(dss, gt, group, instance) \
59 		for_each_dss_steering(dss, gt, group, instance) \
60 			if (xe_gt_has_geometry_dss(gt, dss))
61 
62 /*
63  * Loop over each DSS available for compute and determine the group and
64  * instance IDs that should be used to steer MCR accesses toward this DSS.
65  * @dss: DSS ID to obtain steering for
66  * @gt: GT structure
67  * @group: steering group ID, data type: u16
68  * @instance: steering instance ID, data type: u16
69  */
70 #define for_each_compute_dss(dss, gt, group, instance) \
71 		for_each_dss_steering(dss, gt, group, instance) \
72 			if (xe_gt_has_compute_dss(gt, dss))
73 
74 #endif /* _XE_GT_MCR_H_ */
75