xref: /linux/drivers/gpu/drm/xe/xe_gt_mcr.h (revision 90d32e92011eaae8e70a9169b4e7acf4ca8f9d3a)
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(struct xe_gt *gt);
16 
17 void xe_gt_mcr_set_implicit_defaults(struct xe_gt *gt);
18 
19 u32 xe_gt_mcr_unicast_read(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
20 			   int group, int instance);
21 u32 xe_gt_mcr_unicast_read_any(struct xe_gt *gt, struct xe_reg_mcr mcr_reg);
22 
23 void xe_gt_mcr_unicast_write(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
24 			     u32 value, int group, int instance);
25 void xe_gt_mcr_multicast_write(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,
26 			       u32 value);
27 
28 void xe_gt_mcr_steering_dump(struct xe_gt *gt, struct drm_printer *p);
29 void xe_gt_mcr_get_dss_steering(struct xe_gt *gt, unsigned int dss, u16 *group, u16 *instance);
30 
31 /*
32  * Loop over each DSS and determine the group and instance IDs that
33  * should be used to steer MCR accesses toward this DSS.
34  * @dss: DSS ID to obtain steering for
35  * @gt: GT structure
36  * @group: steering group ID, data type: u16
37  * @instance: steering instance ID, data type: u16
38  */
39 #define for_each_dss_steering(dss, gt, group, instance) \
40 	for_each_dss((dss), (gt)) \
41 		for_each_if((xe_gt_mcr_get_dss_steering((gt), (dss), &(group), &(instance)), true))
42 
43 #endif /* _XE_GT_MCR_H_ */
44