1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_RESCTRL_INTERNAL_H
3 #define _ASM_X86_RESCTRL_INTERNAL_H
4 
5 #include <linux/sched.h>
6 #include <linux/kernfs.h>
7 #include <linux/fs_context.h>
8 #include <linux/jump_label.h>
9 
10 #define MSR_IA32_L3_QOS_CFG		0xc81
11 #define MSR_IA32_L2_QOS_CFG		0xc82
12 #define MSR_IA32_L3_CBM_BASE		0xc90
13 #define MSR_IA32_L2_CBM_BASE		0xd10
14 #define MSR_IA32_MBA_THRTL_BASE		0xd50
15 #define MSR_IA32_MBA_BW_BASE		0xc0000200
16 
17 #define MSR_IA32_QM_CTR			0x0c8e
18 #define MSR_IA32_QM_EVTSEL		0x0c8d
19 
20 #define L3_QOS_CDP_ENABLE		0x01ULL
21 
22 #define L2_QOS_CDP_ENABLE		0x01ULL
23 
24 /*
25  * Event IDs are used to program IA32_QM_EVTSEL before reading event
26  * counter from IA32_QM_CTR
27  */
28 #define QOS_L3_OCCUP_EVENT_ID		0x01
29 #define QOS_L3_MBM_TOTAL_EVENT_ID	0x02
30 #define QOS_L3_MBM_LOCAL_EVENT_ID	0x03
31 
32 #define CQM_LIMBOCHECK_INTERVAL	1000
33 
34 #define MBM_CNTR_WIDTH_BASE		24
35 #define MBM_OVERFLOW_INTERVAL		1000
36 #define MAX_MBA_BW			100u
37 #define MBA_IS_LINEAR			0x4
38 #define MBA_MAX_MBPS			U32_MAX
39 #define MAX_MBA_BW_AMD			0x800
40 #define MBM_CNTR_WIDTH_OFFSET_AMD	20
41 
42 #define RMID_VAL_ERROR			BIT_ULL(63)
43 #define RMID_VAL_UNAVAIL		BIT_ULL(62)
44 /*
45  * With the above fields in use 62 bits remain in MSR_IA32_QM_CTR for
46  * data to be returned. The counter width is discovered from the hardware
47  * as an offset from MBM_CNTR_WIDTH_BASE.
48  */
49 #define MBM_CNTR_WIDTH_OFFSET_MAX (62 - MBM_CNTR_WIDTH_BASE)
50 
51 
52 struct rdt_fs_context {
53 	struct kernfs_fs_context	kfc;
54 	bool				enable_cdpl2;
55 	bool				enable_cdpl3;
56 	bool				enable_mba_mbps;
57 };
58 
59 static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
60 {
61 	struct kernfs_fs_context *kfc = fc->fs_private;
62 
63 	return container_of(kfc, struct rdt_fs_context, kfc);
64 }
65 
66 DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
67 DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
68 
69 /**
70  * struct mon_evt - Entry in the event list of a resource
71  * @evtid:		event id
72  * @name:		name of the event
73  * @list:		entry in &rdt_resource->evt_list
74  */
75 struct mon_evt {
76 	u32			evtid;
77 	char			*name;
78 	struct list_head	list;
79 };
80 
81 /**
82  * union mon_data_bits - Monitoring details for each event file
83  * @priv:              Used to store monitoring event data in @u
84  *                     as kernfs private data
85  * @rid:               Resource id associated with the event file
86  * @evtid:             Event id associated with the event file
87  * @domid:             The domain to which the event file belongs
88  * @u:                 Name of the bit fields struct
89  */
90 union mon_data_bits {
91 	void *priv;
92 	struct {
93 		unsigned int rid	: 10;
94 		unsigned int evtid	: 8;
95 		unsigned int domid	: 14;
96 	} u;
97 };
98 
99 struct rmid_read {
100 	struct rdtgroup		*rgrp;
101 	struct rdt_resource	*r;
102 	struct rdt_domain	*d;
103 	int			evtid;
104 	bool			first;
105 	u64			val;
106 };
107 
108 extern unsigned int resctrl_cqm_threshold;
109 extern bool rdt_alloc_capable;
110 extern bool rdt_mon_capable;
111 extern unsigned int rdt_mon_features;
112 
113 enum rdt_group_type {
114 	RDTCTRL_GROUP = 0,
115 	RDTMON_GROUP,
116 	RDT_NUM_GROUP,
117 };
118 
119 /**
120  * enum rdtgrp_mode - Mode of a RDT resource group
121  * @RDT_MODE_SHAREABLE: This resource group allows sharing of its allocations
122  * @RDT_MODE_EXCLUSIVE: No sharing of this resource group's allocations allowed
123  * @RDT_MODE_PSEUDO_LOCKSETUP: Resource group will be used for Pseudo-Locking
124  * @RDT_MODE_PSEUDO_LOCKED: No sharing of this resource group's allocations
125  *                          allowed AND the allocations are Cache Pseudo-Locked
126  * @RDT_NUM_MODES: Total number of modes
127  *
128  * The mode of a resource group enables control over the allowed overlap
129  * between allocations associated with different resource groups (classes
130  * of service). User is able to modify the mode of a resource group by
131  * writing to the "mode" resctrl file associated with the resource group.
132  *
133  * The "shareable", "exclusive", and "pseudo-locksetup" modes are set by
134  * writing the appropriate text to the "mode" file. A resource group enters
135  * "pseudo-locked" mode after the schemata is written while the resource
136  * group is in "pseudo-locksetup" mode.
137  */
138 enum rdtgrp_mode {
139 	RDT_MODE_SHAREABLE = 0,
140 	RDT_MODE_EXCLUSIVE,
141 	RDT_MODE_PSEUDO_LOCKSETUP,
142 	RDT_MODE_PSEUDO_LOCKED,
143 
144 	/* Must be last */
145 	RDT_NUM_MODES,
146 };
147 
148 /**
149  * struct mongroup - store mon group's data in resctrl fs.
150  * @mon_data_kn:		kernfs node for the mon_data directory
151  * @parent:			parent rdtgrp
152  * @crdtgrp_list:		child rdtgroup node list
153  * @rmid:			rmid for this rdtgroup
154  */
155 struct mongroup {
156 	struct kernfs_node	*mon_data_kn;
157 	struct rdtgroup		*parent;
158 	struct list_head	crdtgrp_list;
159 	u32			rmid;
160 };
161 
162 /**
163  * struct pseudo_lock_region - pseudo-lock region information
164  * @r:			RDT resource to which this pseudo-locked region
165  *			belongs
166  * @d:			RDT domain to which this pseudo-locked region
167  *			belongs
168  * @cbm:		bitmask of the pseudo-locked region
169  * @lock_thread_wq:	waitqueue used to wait on the pseudo-locking thread
170  *			completion
171  * @thread_done:	variable used by waitqueue to test if pseudo-locking
172  *			thread completed
173  * @cpu:		core associated with the cache on which the setup code
174  *			will be run
175  * @line_size:		size of the cache lines
176  * @size:		size of pseudo-locked region in bytes
177  * @kmem:		the kernel memory associated with pseudo-locked region
178  * @minor:		minor number of character device associated with this
179  *			region
180  * @debugfs_dir:	pointer to this region's directory in the debugfs
181  *			filesystem
182  * @pm_reqs:		Power management QoS requests related to this region
183  */
184 struct pseudo_lock_region {
185 	struct rdt_resource	*r;
186 	struct rdt_domain	*d;
187 	u32			cbm;
188 	wait_queue_head_t	lock_thread_wq;
189 	int			thread_done;
190 	int			cpu;
191 	unsigned int		line_size;
192 	unsigned int		size;
193 	void			*kmem;
194 	unsigned int		minor;
195 	struct dentry		*debugfs_dir;
196 	struct list_head	pm_reqs;
197 };
198 
199 /**
200  * struct rdtgroup - store rdtgroup's data in resctrl file system.
201  * @kn:				kernfs node
202  * @rdtgroup_list:		linked list for all rdtgroups
203  * @closid:			closid for this rdtgroup
204  * @cpu_mask:			CPUs assigned to this rdtgroup
205  * @flags:			status bits
206  * @waitcount:			how many cpus expect to find this
207  *				group when they acquire rdtgroup_mutex
208  * @type:			indicates type of this rdtgroup - either
209  *				monitor only or ctrl_mon group
210  * @mon:			mongroup related data
211  * @mode:			mode of resource group
212  * @plr:			pseudo-locked region
213  */
214 struct rdtgroup {
215 	struct kernfs_node		*kn;
216 	struct list_head		rdtgroup_list;
217 	u32				closid;
218 	struct cpumask			cpu_mask;
219 	int				flags;
220 	atomic_t			waitcount;
221 	enum rdt_group_type		type;
222 	struct mongroup			mon;
223 	enum rdtgrp_mode		mode;
224 	struct pseudo_lock_region	*plr;
225 };
226 
227 /* rdtgroup.flags */
228 #define	RDT_DELETED		1
229 
230 /* rftype.flags */
231 #define RFTYPE_FLAGS_CPUS_LIST	1
232 
233 /*
234  * Define the file type flags for base and info directories.
235  */
236 #define RFTYPE_INFO			BIT(0)
237 #define RFTYPE_BASE			BIT(1)
238 #define RF_CTRLSHIFT			4
239 #define RF_MONSHIFT			5
240 #define RF_TOPSHIFT			6
241 #define RFTYPE_CTRL			BIT(RF_CTRLSHIFT)
242 #define RFTYPE_MON			BIT(RF_MONSHIFT)
243 #define RFTYPE_TOP			BIT(RF_TOPSHIFT)
244 #define RFTYPE_RES_CACHE		BIT(8)
245 #define RFTYPE_RES_MB			BIT(9)
246 #define RF_CTRL_INFO			(RFTYPE_INFO | RFTYPE_CTRL)
247 #define RF_MON_INFO			(RFTYPE_INFO | RFTYPE_MON)
248 #define RF_TOP_INFO			(RFTYPE_INFO | RFTYPE_TOP)
249 #define RF_CTRL_BASE			(RFTYPE_BASE | RFTYPE_CTRL)
250 
251 /* List of all resource groups */
252 extern struct list_head rdt_all_groups;
253 
254 extern int max_name_width, max_data_width;
255 
256 int __init rdtgroup_init(void);
257 void __exit rdtgroup_exit(void);
258 
259 /**
260  * struct rftype - describe each file in the resctrl file system
261  * @name:	File name
262  * @mode:	Access mode
263  * @kf_ops:	File operations
264  * @flags:	File specific RFTYPE_FLAGS_* flags
265  * @fflags:	File specific RF_* or RFTYPE_* flags
266  * @seq_show:	Show content of the file
267  * @write:	Write to the file
268  */
269 struct rftype {
270 	char			*name;
271 	umode_t			mode;
272 	const struct kernfs_ops	*kf_ops;
273 	unsigned long		flags;
274 	unsigned long		fflags;
275 
276 	int (*seq_show)(struct kernfs_open_file *of,
277 			struct seq_file *sf, void *v);
278 	/*
279 	 * write() is the generic write callback which maps directly to
280 	 * kernfs write operation and overrides all other operations.
281 	 * Maximum write size is determined by ->max_write_len.
282 	 */
283 	ssize_t (*write)(struct kernfs_open_file *of,
284 			 char *buf, size_t nbytes, loff_t off);
285 };
286 
287 /**
288  * struct mbm_state - status for each MBM counter in each domain
289  * @chunks:	Total data moved (multiply by rdt_group.mon_scale to get bytes)
290  * @prev_msr:	Value of IA32_QM_CTR for this RMID last time we read it
291  * @prev_bw_msr:Value of previous IA32_QM_CTR for bandwidth counting
292  * @prev_bw:	The most recent bandwidth in MBps
293  * @delta_bw:	Difference between the current and previous bandwidth
294  * @delta_comp:	Indicates whether to compute the delta_bw
295  */
296 struct mbm_state {
297 	u64	chunks;
298 	u64	prev_msr;
299 	u64	prev_bw_msr;
300 	u32	prev_bw;
301 	u32	delta_bw;
302 	bool	delta_comp;
303 };
304 
305 /**
306  * struct rdt_domain - group of cpus sharing an RDT resource
307  * @list:	all instances of this resource
308  * @id:		unique id for this instance
309  * @cpu_mask:	which cpus share this resource
310  * @rmid_busy_llc:
311  *		bitmap of which limbo RMIDs are above threshold
312  * @mbm_total:	saved state for MBM total bandwidth
313  * @mbm_local:	saved state for MBM local bandwidth
314  * @mbm_over:	worker to periodically read MBM h/w counters
315  * @cqm_limbo:	worker to periodically read CQM h/w counters
316  * @mbm_work_cpu:
317  *		worker cpu for MBM h/w counters
318  * @cqm_work_cpu:
319  *		worker cpu for CQM h/w counters
320  * @ctrl_val:	array of cache or mem ctrl values (indexed by CLOSID)
321  * @mbps_val:	When mba_sc is enabled, this holds the bandwidth in MBps
322  * @new_ctrl:	new ctrl value to be loaded
323  * @have_new_ctrl: did user provide new_ctrl for this domain
324  * @plr:	pseudo-locked region (if any) associated with domain
325  */
326 struct rdt_domain {
327 	struct list_head		list;
328 	int				id;
329 	struct cpumask			cpu_mask;
330 	unsigned long			*rmid_busy_llc;
331 	struct mbm_state		*mbm_total;
332 	struct mbm_state		*mbm_local;
333 	struct delayed_work		mbm_over;
334 	struct delayed_work		cqm_limbo;
335 	int				mbm_work_cpu;
336 	int				cqm_work_cpu;
337 	u32				*ctrl_val;
338 	u32				*mbps_val;
339 	u32				new_ctrl;
340 	bool				have_new_ctrl;
341 	struct pseudo_lock_region	*plr;
342 };
343 
344 /**
345  * struct msr_param - set a range of MSRs from a domain
346  * @res:       The resource to use
347  * @low:       Beginning index from base MSR
348  * @high:      End index
349  */
350 struct msr_param {
351 	struct rdt_resource	*res;
352 	int			low;
353 	int			high;
354 };
355 
356 /**
357  * struct rdt_cache - Cache allocation related data
358  * @cbm_len:		Length of the cache bit mask
359  * @min_cbm_bits:	Minimum number of consecutive bits to be set
360  * @cbm_idx_mult:	Multiplier of CBM index
361  * @cbm_idx_offset:	Offset of CBM index. CBM index is computed by:
362  *			closid * cbm_idx_multi + cbm_idx_offset
363  *			in a cache bit mask
364  * @shareable_bits:	Bitmask of shareable resource with other
365  *			executing entities
366  * @arch_has_sparse_bitmaps:	True if a bitmap like f00f is valid.
367  * @arch_has_empty_bitmaps:	True if the '0' bitmap is valid.
368  * @arch_has_per_cpu_cfg:	True if QOS_CFG register for this cache
369  *				level has CPU scope.
370  */
371 struct rdt_cache {
372 	unsigned int	cbm_len;
373 	unsigned int	min_cbm_bits;
374 	unsigned int	cbm_idx_mult;
375 	unsigned int	cbm_idx_offset;
376 	unsigned int	shareable_bits;
377 	bool		arch_has_sparse_bitmaps;
378 	bool		arch_has_empty_bitmaps;
379 	bool		arch_has_per_cpu_cfg;
380 };
381 
382 /**
383  * enum membw_throttle_mode - System's memory bandwidth throttling mode
384  * @THREAD_THROTTLE_UNDEFINED:	Not relevant to the system
385  * @THREAD_THROTTLE_MAX:	Memory bandwidth is throttled at the core
386  *				always using smallest bandwidth percentage
387  *				assigned to threads, aka "max throttling"
388  * @THREAD_THROTTLE_PER_THREAD:	Memory bandwidth is throttled at the thread
389  */
390 enum membw_throttle_mode {
391 	THREAD_THROTTLE_UNDEFINED = 0,
392 	THREAD_THROTTLE_MAX,
393 	THREAD_THROTTLE_PER_THREAD,
394 };
395 
396 /**
397  * struct rdt_membw - Memory bandwidth allocation related data
398  * @min_bw:		Minimum memory bandwidth percentage user can request
399  * @bw_gran:		Granularity at which the memory bandwidth is allocated
400  * @delay_linear:	True if memory B/W delay is in linear scale
401  * @arch_needs_linear:	True if we can't configure non-linear resources
402  * @throttle_mode:	Bandwidth throttling mode when threads request
403  *			different memory bandwidths
404  * @mba_sc:		True if MBA software controller(mba_sc) is enabled
405  * @mb_map:		Mapping of memory B/W percentage to memory B/W delay
406  */
407 struct rdt_membw {
408 	u32				min_bw;
409 	u32				bw_gran;
410 	u32				delay_linear;
411 	bool				arch_needs_linear;
412 	enum membw_throttle_mode	throttle_mode;
413 	bool				mba_sc;
414 	u32				*mb_map;
415 };
416 
417 static inline bool is_llc_occupancy_enabled(void)
418 {
419 	return (rdt_mon_features & (1 << QOS_L3_OCCUP_EVENT_ID));
420 }
421 
422 static inline bool is_mbm_total_enabled(void)
423 {
424 	return (rdt_mon_features & (1 << QOS_L3_MBM_TOTAL_EVENT_ID));
425 }
426 
427 static inline bool is_mbm_local_enabled(void)
428 {
429 	return (rdt_mon_features & (1 << QOS_L3_MBM_LOCAL_EVENT_ID));
430 }
431 
432 static inline bool is_mbm_enabled(void)
433 {
434 	return (is_mbm_total_enabled() || is_mbm_local_enabled());
435 }
436 
437 static inline bool is_mbm_event(int e)
438 {
439 	return (e >= QOS_L3_MBM_TOTAL_EVENT_ID &&
440 		e <= QOS_L3_MBM_LOCAL_EVENT_ID);
441 }
442 
443 struct rdt_parse_data {
444 	struct rdtgroup		*rdtgrp;
445 	char			*buf;
446 };
447 
448 /**
449  * struct rdt_resource - attributes of an RDT resource
450  * @rid:		The index of the resource
451  * @alloc_enabled:	Is allocation enabled on this machine
452  * @mon_enabled:	Is monitoring enabled for this feature
453  * @alloc_capable:	Is allocation available on this machine
454  * @mon_capable:	Is monitor feature available on this machine
455  * @name:		Name to use in "schemata" file
456  * @num_closid:		Number of CLOSIDs available
457  * @cache_level:	Which cache level defines scope of this resource
458  * @default_ctrl:	Specifies default cache cbm or memory B/W percent.
459  * @msr_base:		Base MSR address for CBMs
460  * @msr_update:		Function pointer to update QOS MSRs
461  * @data_width:		Character width of data when displaying
462  * @domains:		All domains for this resource
463  * @cache:		Cache allocation related data
464  * @membw:		If the component has bandwidth controls, their properties.
465  * @format_str:		Per resource format string to show domain value
466  * @parse_ctrlval:	Per resource function pointer to parse control values
467  * @evt_list:		List of monitoring events
468  * @num_rmid:		Number of RMIDs available
469  * @mon_scale:		cqm counter * mon_scale = occupancy in bytes
470  * @mbm_width:		Monitor width, to detect and correct for overflow.
471  * @fflags:		flags to choose base and info files
472  */
473 struct rdt_resource {
474 	int			rid;
475 	bool			alloc_enabled;
476 	bool			mon_enabled;
477 	bool			alloc_capable;
478 	bool			mon_capable;
479 	char			*name;
480 	int			num_closid;
481 	int			cache_level;
482 	u32			default_ctrl;
483 	unsigned int		msr_base;
484 	void (*msr_update)	(struct rdt_domain *d, struct msr_param *m,
485 				 struct rdt_resource *r);
486 	int			data_width;
487 	struct list_head	domains;
488 	struct rdt_cache	cache;
489 	struct rdt_membw	membw;
490 	const char		*format_str;
491 	int (*parse_ctrlval)(struct rdt_parse_data *data,
492 			     struct rdt_resource *r,
493 			     struct rdt_domain *d);
494 	struct list_head	evt_list;
495 	int			num_rmid;
496 	unsigned int		mon_scale;
497 	unsigned int		mbm_width;
498 	unsigned long		fflags;
499 };
500 
501 int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
502 	      struct rdt_domain *d);
503 int parse_bw(struct rdt_parse_data *data, struct rdt_resource *r,
504 	     struct rdt_domain *d);
505 
506 extern struct mutex rdtgroup_mutex;
507 
508 extern struct rdt_resource rdt_resources_all[];
509 extern struct rdtgroup rdtgroup_default;
510 DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
511 
512 extern struct dentry *debugfs_resctrl;
513 
514 enum {
515 	RDT_RESOURCE_L3,
516 	RDT_RESOURCE_L3DATA,
517 	RDT_RESOURCE_L3CODE,
518 	RDT_RESOURCE_L2,
519 	RDT_RESOURCE_L2DATA,
520 	RDT_RESOURCE_L2CODE,
521 	RDT_RESOURCE_MBA,
522 
523 	/* Must be the last */
524 	RDT_NUM_RESOURCES,
525 };
526 
527 #define for_each_rdt_resource(r)					      \
528 	for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
529 	     r++)
530 
531 #define for_each_capable_rdt_resource(r)				      \
532 	for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
533 	     r++)							      \
534 		if (r->alloc_capable || r->mon_capable)
535 
536 #define for_each_alloc_capable_rdt_resource(r)				      \
537 	for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
538 	     r++)							      \
539 		if (r->alloc_capable)
540 
541 #define for_each_mon_capable_rdt_resource(r)				      \
542 	for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
543 	     r++)							      \
544 		if (r->mon_capable)
545 
546 #define for_each_alloc_enabled_rdt_resource(r)				      \
547 	for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
548 	     r++)							      \
549 		if (r->alloc_enabled)
550 
551 #define for_each_mon_enabled_rdt_resource(r)				      \
552 	for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
553 	     r++)							      \
554 		if (r->mon_enabled)
555 
556 /* CPUID.(EAX=10H, ECX=ResID=1).EAX */
557 union cpuid_0x10_1_eax {
558 	struct {
559 		unsigned int cbm_len:5;
560 	} split;
561 	unsigned int full;
562 };
563 
564 /* CPUID.(EAX=10H, ECX=ResID=3).EAX */
565 union cpuid_0x10_3_eax {
566 	struct {
567 		unsigned int max_delay:12;
568 	} split;
569 	unsigned int full;
570 };
571 
572 /* CPUID.(EAX=10H, ECX=ResID).EDX */
573 union cpuid_0x10_x_edx {
574 	struct {
575 		unsigned int cos_max:16;
576 	} split;
577 	unsigned int full;
578 };
579 
580 void rdt_last_cmd_clear(void);
581 void rdt_last_cmd_puts(const char *s);
582 __printf(1, 2)
583 void rdt_last_cmd_printf(const char *fmt, ...);
584 
585 void rdt_ctrl_update(void *arg);
586 struct rdtgroup *rdtgroup_kn_lock_live(struct kernfs_node *kn);
587 void rdtgroup_kn_unlock(struct kernfs_node *kn);
588 int rdtgroup_kn_mode_restrict(struct rdtgroup *r, const char *name);
589 int rdtgroup_kn_mode_restore(struct rdtgroup *r, const char *name,
590 			     umode_t mask);
591 struct rdt_domain *rdt_find_domain(struct rdt_resource *r, int id,
592 				   struct list_head **pos);
593 ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
594 				char *buf, size_t nbytes, loff_t off);
595 int rdtgroup_schemata_show(struct kernfs_open_file *of,
596 			   struct seq_file *s, void *v);
597 bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
598 			   unsigned long cbm, int closid, bool exclusive);
599 unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_domain *d,
600 				  unsigned long cbm);
601 enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
602 int rdtgroup_tasks_assigned(struct rdtgroup *r);
603 int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp);
604 int rdtgroup_locksetup_exit(struct rdtgroup *rdtgrp);
605 bool rdtgroup_cbm_overlaps_pseudo_locked(struct rdt_domain *d, unsigned long cbm);
606 bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_domain *d);
607 int rdt_pseudo_lock_init(void);
608 void rdt_pseudo_lock_release(void);
609 int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp);
610 void rdtgroup_pseudo_lock_remove(struct rdtgroup *rdtgrp);
611 struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
612 int update_domains(struct rdt_resource *r, int closid);
613 int closids_supported(void);
614 void closid_free(int closid);
615 int alloc_rmid(void);
616 void free_rmid(u32 rmid);
617 int rdt_get_mon_l3_config(struct rdt_resource *r);
618 void mon_event_count(void *info);
619 int rdtgroup_mondata_show(struct seq_file *m, void *arg);
620 void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
621 				    unsigned int dom_id);
622 void mkdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
623 				    struct rdt_domain *d);
624 void mon_event_read(struct rmid_read *rr, struct rdt_resource *r,
625 		    struct rdt_domain *d, struct rdtgroup *rdtgrp,
626 		    int evtid, int first);
627 void mbm_setup_overflow_handler(struct rdt_domain *dom,
628 				unsigned long delay_ms);
629 void mbm_handle_overflow(struct work_struct *work);
630 void __init intel_rdt_mbm_apply_quirk(void);
631 bool is_mba_sc(struct rdt_resource *r);
632 void setup_default_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm);
633 u32 delay_bw_map(unsigned long bw, struct rdt_resource *r);
634 void cqm_setup_limbo_handler(struct rdt_domain *dom, unsigned long delay_ms);
635 void cqm_handle_limbo(struct work_struct *work);
636 bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);
637 void __check_limbo(struct rdt_domain *d, bool force_free);
638 void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
639 void __init thread_throttle_mode_init(void);
640 
641 #endif /* _ASM_X86_RESCTRL_INTERNAL_H */
642