xref: /linux/drivers/gpu/drm/xe/xe_gt_mcr.h (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
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 void xe_gt_mcr_steering_dump(struct xe_gt *gt, struct drm_printer *p);
30 void xe_gt_mcr_get_dss_steering(struct xe_gt *gt, unsigned int dss, u16 *group, u16 *instance);
31 
32 /*
33  * Loop over each DSS and determine the group and instance IDs that
34  * should be used to steer MCR accesses toward this DSS.
35  * @dss: DSS ID to obtain steering for
36  * @gt: GT structure
37  * @group: steering group ID, data type: u16
38  * @instance: steering instance ID, data type: u16
39  */
40 #define for_each_dss_steering(dss, gt, group, instance) \
41 	for_each_dss((dss), (gt)) \
42 		for_each_if((xe_gt_mcr_get_dss_steering((gt), (dss), &(group), &(instance)), true))
43 
44 /*
45  * Loop over each DSS available for geometry and determine the group and
46  * instance IDs that should be used to steer MCR accesses toward this DSS.
47  * @dss: DSS ID to obtain steering for
48  * @gt: GT structure
49  * @group: steering group ID, data type: u16
50  * @instance: steering instance ID, data type: u16
51  */
52 #define for_each_geometry_dss(dss, gt, group, instance) \
53 		for_each_dss_steering(dss, gt, group, instance) \
54 			if (xe_gt_has_geometry_dss(gt, dss))
55 
56 /*
57  * Loop over each DSS available for compute and determine the group and
58  * instance IDs that should be used to steer MCR accesses toward this DSS.
59  * @dss: DSS ID to obtain steering for
60  * @gt: GT structure
61  * @group: steering group ID, data type: u16
62  * @instance: steering instance ID, data type: u16
63  */
64 #define for_each_compute_dss(dss, gt, group, instance) \
65 		for_each_dss_steering(dss, gt, group, instance) \
66 			if (xe_gt_has_compute_dss(gt, dss))
67 
68 #endif /* _XE_GT_MCR_H_ */
69