blob: 9780409d250205724c504ee15f2796c72fbd4f58 [file] [log] [blame]
Fenghua Yu113c6092016-10-22 06:19:54 -07001#ifndef _ASM_X86_INTEL_RDT_H
2#define _ASM_X86_INTEL_RDT_H
3
4#define IA32_L3_CBM_BASE 0xc90
Fenghua Yuc1c7c3f2016-10-22 06:19:55 -07005#define IA32_L2_CBM_BASE 0xd10
Fenghua Yu113c6092016-10-22 06:19:54 -07006
Fenghua Yuc1c7c3f2016-10-22 06:19:55 -07007/**
8 * struct rdt_resource - attributes of an RDT resource
9 * @enabled: Is this feature enabled on this machine
10 * @capable: Is this feature available on this machine
11 * @name: Name to use in "schemata" file
12 * @num_closid: Number of CLOSIDs available
13 * @max_cbm: Largest Cache Bit Mask allowed
14 * @min_cbm_bits: Minimum number of consecutive bits to be set
15 * in a cache bit mask
16 * @domains: All domains for this resource
17 * @num_domains: Number of domains active
18 * @msr_base: Base MSR address for CBMs
19 * @tmp_cbms: Scratch space when updating schemata
20 * @cache_level: Which cache level defines scope of this domain
21 * @cbm_idx_multi: Multiplier of CBM index
22 * @cbm_idx_offset: Offset of CBM index. CBM index is computed by:
23 * closid * cbm_idx_multi + cbm_idx_offset
24 */
25struct rdt_resource {
26 bool enabled;
27 bool capable;
28 char *name;
29 int num_closid;
30 int cbm_len;
31 int min_cbm_bits;
32 u32 max_cbm;
33 struct list_head domains;
34 int num_domains;
35 int msr_base;
36 u32 *tmp_cbms;
37 int cache_level;
38 int cbm_idx_multi;
39 int cbm_idx_offset;
40};
41
42extern struct rdt_resource rdt_resources_all[];
43
44enum {
45 RDT_RESOURCE_L3,
46 RDT_RESOURCE_L3DATA,
47 RDT_RESOURCE_L3CODE,
48 RDT_RESOURCE_L2,
49
50 /* Must be the last */
51 RDT_NUM_RESOURCES,
52};
53
54#define for_each_capable_rdt_resource(r) \
55 for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
56 r++) \
57 if (r->capable)
58
59/* CPUID.(EAX=10H, ECX=ResID=1).EAX */
60union cpuid_0x10_1_eax {
61 struct {
62 unsigned int cbm_len:5;
63 } split;
64 unsigned int full;
65};
66
67/* CPUID.(EAX=10H, ECX=ResID=1).EDX */
68union cpuid_0x10_1_edx {
69 struct {
70 unsigned int cos_max:16;
71 } split;
72 unsigned int full;
73};
Fenghua Yu113c6092016-10-22 06:19:54 -070074#endif /* _ASM_X86_INTEL_RDT_H */