1 /* SandyBridge-EP/IvyTown uncore support */
4 /* SNB-EP Box level control */
5 #define SNBEP_PMON_BOX_CTL_RST_CTRL (1 << 0)
6 #define SNBEP_PMON_BOX_CTL_RST_CTRS (1 << 1)
7 #define SNBEP_PMON_BOX_CTL_FRZ (1 << 8)
8 #define SNBEP_PMON_BOX_CTL_FRZ_EN (1 << 16)
9 #define SNBEP_PMON_BOX_CTL_INT (SNBEP_PMON_BOX_CTL_RST_CTRL | \
10 SNBEP_PMON_BOX_CTL_RST_CTRS | \
11 SNBEP_PMON_BOX_CTL_FRZ_EN)
12 /* SNB-EP event control */
13 #define SNBEP_PMON_CTL_EV_SEL_MASK 0x000000ff
14 #define SNBEP_PMON_CTL_UMASK_MASK 0x0000ff00
15 #define SNBEP_PMON_CTL_RST (1 << 17)
16 #define SNBEP_PMON_CTL_EDGE_DET (1 << 18)
17 #define SNBEP_PMON_CTL_EV_SEL_EXT (1 << 21)
18 #define SNBEP_PMON_CTL_EN (1 << 22)
19 #define SNBEP_PMON_CTL_INVERT (1 << 23)
20 #define SNBEP_PMON_CTL_TRESH_MASK 0xff000000
21 #define SNBEP_PMON_RAW_EVENT_MASK (SNBEP_PMON_CTL_EV_SEL_MASK | \
22 SNBEP_PMON_CTL_UMASK_MASK | \
23 SNBEP_PMON_CTL_EDGE_DET | \
24 SNBEP_PMON_CTL_INVERT | \
25 SNBEP_PMON_CTL_TRESH_MASK)
27 /* SNB-EP Ubox event control */
28 #define SNBEP_U_MSR_PMON_CTL_TRESH_MASK 0x1f000000
29 #define SNBEP_U_MSR_PMON_RAW_EVENT_MASK \
30 (SNBEP_PMON_CTL_EV_SEL_MASK | \
31 SNBEP_PMON_CTL_UMASK_MASK | \
32 SNBEP_PMON_CTL_EDGE_DET | \
33 SNBEP_PMON_CTL_INVERT | \
34 SNBEP_U_MSR_PMON_CTL_TRESH_MASK)
36 #define SNBEP_CBO_PMON_CTL_TID_EN (1 << 19)
37 #define SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK (SNBEP_PMON_RAW_EVENT_MASK | \
38 SNBEP_CBO_PMON_CTL_TID_EN)
40 /* SNB-EP PCU event control */
41 #define SNBEP_PCU_MSR_PMON_CTL_OCC_SEL_MASK 0x0000c000
42 #define SNBEP_PCU_MSR_PMON_CTL_TRESH_MASK 0x1f000000
43 #define SNBEP_PCU_MSR_PMON_CTL_OCC_INVERT (1 << 30)
44 #define SNBEP_PCU_MSR_PMON_CTL_OCC_EDGE_DET (1 << 31)
45 #define SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK \
46 (SNBEP_PMON_CTL_EV_SEL_MASK | \
47 SNBEP_PCU_MSR_PMON_CTL_OCC_SEL_MASK | \
48 SNBEP_PMON_CTL_EDGE_DET | \
49 SNBEP_PMON_CTL_EV_SEL_EXT | \
50 SNBEP_PMON_CTL_INVERT | \
51 SNBEP_PCU_MSR_PMON_CTL_TRESH_MASK | \
52 SNBEP_PCU_MSR_PMON_CTL_OCC_INVERT | \
53 SNBEP_PCU_MSR_PMON_CTL_OCC_EDGE_DET)
55 #define SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK \
56 (SNBEP_PMON_RAW_EVENT_MASK | \
57 SNBEP_PMON_CTL_EV_SEL_EXT)
59 /* SNB-EP pci control register */
60 #define SNBEP_PCI_PMON_BOX_CTL 0xf4
61 #define SNBEP_PCI_PMON_CTL0 0xd8
62 /* SNB-EP pci counter register */
63 #define SNBEP_PCI_PMON_CTR0 0xa0
65 /* SNB-EP home agent register */
66 #define SNBEP_HA_PCI_PMON_BOX_ADDRMATCH0 0x40
67 #define SNBEP_HA_PCI_PMON_BOX_ADDRMATCH1 0x44
68 #define SNBEP_HA_PCI_PMON_BOX_OPCODEMATCH 0x48
69 /* SNB-EP memory controller register */
70 #define SNBEP_MC_CHy_PCI_PMON_FIXED_CTL 0xf0
71 #define SNBEP_MC_CHy_PCI_PMON_FIXED_CTR 0xd0
72 /* SNB-EP QPI register */
73 #define SNBEP_Q_Py_PCI_PMON_PKT_MATCH0 0x228
74 #define SNBEP_Q_Py_PCI_PMON_PKT_MATCH1 0x22c
75 #define SNBEP_Q_Py_PCI_PMON_PKT_MASK0 0x238
76 #define SNBEP_Q_Py_PCI_PMON_PKT_MASK1 0x23c
78 /* SNB-EP Ubox register */
79 #define SNBEP_U_MSR_PMON_CTR0 0xc16
80 #define SNBEP_U_MSR_PMON_CTL0 0xc10
82 #define SNBEP_U_MSR_PMON_UCLK_FIXED_CTL 0xc08
83 #define SNBEP_U_MSR_PMON_UCLK_FIXED_CTR 0xc09
85 /* SNB-EP Cbo register */
86 #define SNBEP_C0_MSR_PMON_CTR0 0xd16
87 #define SNBEP_C0_MSR_PMON_CTL0 0xd10
88 #define SNBEP_C0_MSR_PMON_BOX_CTL 0xd04
89 #define SNBEP_C0_MSR_PMON_BOX_FILTER 0xd14
90 #define SNBEP_CBO_MSR_OFFSET 0x20
92 #define SNBEP_CB0_MSR_PMON_BOX_FILTER_TID 0x1f
93 #define SNBEP_CB0_MSR_PMON_BOX_FILTER_NID 0x3fc00
94 #define SNBEP_CB0_MSR_PMON_BOX_FILTER_STATE 0x7c0000
95 #define SNBEP_CB0_MSR_PMON_BOX_FILTER_OPC 0xff800000
97 #define SNBEP_CBO_EVENT_EXTRA_REG(e, m, i) { \
99 .msr = SNBEP_C0_MSR_PMON_BOX_FILTER, \
100 .config_mask = (m), \
104 /* SNB-EP PCU register */
105 #define SNBEP_PCU_MSR_PMON_CTR0 0xc36
106 #define SNBEP_PCU_MSR_PMON_CTL0 0xc30
107 #define SNBEP_PCU_MSR_PMON_BOX_CTL 0xc24
108 #define SNBEP_PCU_MSR_PMON_BOX_FILTER 0xc34
109 #define SNBEP_PCU_MSR_PMON_BOX_FILTER_MASK 0xffffffff
110 #define SNBEP_PCU_MSR_CORE_C3_CTR 0x3fc
111 #define SNBEP_PCU_MSR_CORE_C6_CTR 0x3fd
113 /* IVBEP event control */
114 #define IVBEP_PMON_BOX_CTL_INT (SNBEP_PMON_BOX_CTL_RST_CTRL | \
115 SNBEP_PMON_BOX_CTL_RST_CTRS)
116 #define IVBEP_PMON_RAW_EVENT_MASK (SNBEP_PMON_CTL_EV_SEL_MASK | \
117 SNBEP_PMON_CTL_UMASK_MASK | \
118 SNBEP_PMON_CTL_EDGE_DET | \
119 SNBEP_PMON_CTL_TRESH_MASK)
121 #define IVBEP_U_MSR_PMON_GLOBAL_CTL 0xc00
122 #define IVBEP_U_PMON_GLOBAL_FRZ_ALL (1 << 31)
123 #define IVBEP_U_PMON_GLOBAL_UNFRZ_ALL (1 << 29)
125 #define IVBEP_U_MSR_PMON_RAW_EVENT_MASK \
126 (SNBEP_PMON_CTL_EV_SEL_MASK | \
127 SNBEP_PMON_CTL_UMASK_MASK | \
128 SNBEP_PMON_CTL_EDGE_DET | \
129 SNBEP_U_MSR_PMON_CTL_TRESH_MASK)
131 #define IVBEP_CBO_MSR_PMON_RAW_EVENT_MASK (IVBEP_PMON_RAW_EVENT_MASK | \
132 SNBEP_CBO_PMON_CTL_TID_EN)
134 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_TID (0x1fULL << 0)
135 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_LINK (0xfULL << 5)
136 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_STATE (0x3fULL << 17)
137 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_NID (0xffffULL << 32)
138 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_OPC (0x1ffULL << 52)
139 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_C6 (0x1ULL << 61)
140 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_NC (0x1ULL << 62)
141 #define IVBEP_CB0_MSR_PMON_BOX_FILTER_ISOC (0x1ULL << 63)
143 /* IVBEP home agent */
144 #define IVBEP_HA_PCI_PMON_CTL_Q_OCC_RST (1 << 16)
145 #define IVBEP_HA_PCI_PMON_RAW_EVENT_MASK \
146 (IVBEP_PMON_RAW_EVENT_MASK | \
147 IVBEP_HA_PCI_PMON_CTL_Q_OCC_RST)
149 #define IVBEP_PCU_MSR_PMON_RAW_EVENT_MASK \
150 (SNBEP_PMON_CTL_EV_SEL_MASK | \
151 SNBEP_PMON_CTL_EV_SEL_EXT | \
152 SNBEP_PCU_MSR_PMON_CTL_OCC_SEL_MASK | \
153 SNBEP_PMON_CTL_EDGE_DET | \
154 SNBEP_PCU_MSR_PMON_CTL_TRESH_MASK | \
155 SNBEP_PCU_MSR_PMON_CTL_OCC_INVERT | \
156 SNBEP_PCU_MSR_PMON_CTL_OCC_EDGE_DET)
158 #define IVBEP_QPI_PCI_PMON_RAW_EVENT_MASK \
159 (IVBEP_PMON_RAW_EVENT_MASK | \
160 SNBEP_PMON_CTL_EV_SEL_EXT)
162 #define __BITS_VALUE(x, i, n) ((typeof(x))(((x) >> ((i) * (n))) & \
163 ((1ULL << (n)) - 1)))
165 /* Haswell-EP Ubox */
166 #define HSWEP_U_MSR_PMON_CTR0 0x709
167 #define HSWEP_U_MSR_PMON_CTL0 0x705
168 #define HSWEP_U_MSR_PMON_FILTER 0x707
170 #define HSWEP_U_MSR_PMON_UCLK_FIXED_CTL 0x703
171 #define HSWEP_U_MSR_PMON_UCLK_FIXED_CTR 0x704
173 #define HSWEP_U_MSR_PMON_BOX_FILTER_TID (0x1 << 0)
174 #define HSWEP_U_MSR_PMON_BOX_FILTER_CID (0x1fULL << 1)
175 #define HSWEP_U_MSR_PMON_BOX_FILTER_MASK \
176 (HSWEP_U_MSR_PMON_BOX_FILTER_TID | \
177 HSWEP_U_MSR_PMON_BOX_FILTER_CID)
180 #define HSWEP_C0_MSR_PMON_CTR0 0xe08
181 #define HSWEP_C0_MSR_PMON_CTL0 0xe01
182 #define HSWEP_C0_MSR_PMON_BOX_CTL 0xe00
183 #define HSWEP_C0_MSR_PMON_BOX_FILTER0 0xe05
184 #define HSWEP_CBO_MSR_OFFSET 0x10
187 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_TID (0x3fULL << 0)
188 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_LINK (0xfULL << 6)
189 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_STATE (0x7fULL << 17)
190 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_NID (0xffffULL << 32)
191 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_OPC (0x1ffULL << 52)
192 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_C6 (0x1ULL << 61)
193 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_NC (0x1ULL << 62)
194 #define HSWEP_CB0_MSR_PMON_BOX_FILTER_ISOC (0x1ULL << 63)
197 /* Haswell-EP Sbox */
198 #define HSWEP_S0_MSR_PMON_CTR0 0x726
199 #define HSWEP_S0_MSR_PMON_CTL0 0x721
200 #define HSWEP_S0_MSR_PMON_BOX_CTL 0x720
201 #define HSWEP_SBOX_MSR_OFFSET 0xa
202 #define HSWEP_S_MSR_PMON_RAW_EVENT_MASK (SNBEP_PMON_RAW_EVENT_MASK | \
203 SNBEP_CBO_PMON_CTL_TID_EN)
206 #define HSWEP_PCU_MSR_PMON_CTR0 0x717
207 #define HSWEP_PCU_MSR_PMON_CTL0 0x711
208 #define HSWEP_PCU_MSR_PMON_BOX_CTL 0x710
209 #define HSWEP_PCU_MSR_PMON_BOX_FILTER 0x715
212 #define KNL_U_MSR_PMON_RAW_EVENT_MASK \
213 (SNBEP_U_MSR_PMON_RAW_EVENT_MASK | \
214 SNBEP_CBO_PMON_CTL_TID_EN)
216 #define KNL_CHA_MSR_OFFSET 0xc
217 #define KNL_CHA_MSR_PMON_CTL_QOR (1 << 16)
218 #define KNL_CHA_MSR_PMON_RAW_EVENT_MASK \
219 (SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK | \
220 KNL_CHA_MSR_PMON_CTL_QOR)
221 #define KNL_CHA_MSR_PMON_BOX_FILTER_TID 0x1ff
222 #define KNL_CHA_MSR_PMON_BOX_FILTER_STATE (7 << 18)
223 #define KNL_CHA_MSR_PMON_BOX_FILTER_OP (0xfffffe2aULL << 32)
225 /* KNL EDC/MC UCLK */
226 #define KNL_UCLK_MSR_PMON_CTR0_LOW 0x400
227 #define KNL_UCLK_MSR_PMON_CTL0 0x420
228 #define KNL_UCLK_MSR_PMON_BOX_CTL 0x430
229 #define KNL_UCLK_MSR_PMON_UCLK_FIXED_LOW 0x44c
230 #define KNL_UCLK_MSR_PMON_UCLK_FIXED_CTL 0x454
231 #define KNL_PMON_FIXED_CTL_EN 0x1
234 #define KNL_EDC0_ECLK_MSR_PMON_CTR0_LOW 0xa00
235 #define KNL_EDC0_ECLK_MSR_PMON_CTL0 0xa20
236 #define KNL_EDC0_ECLK_MSR_PMON_BOX_CTL 0xa30
237 #define KNL_EDC0_ECLK_MSR_PMON_ECLK_FIXED_LOW 0xa3c
238 #define KNL_EDC0_ECLK_MSR_PMON_ECLK_FIXED_CTL 0xa44
241 #define KNL_MC0_CH0_MSR_PMON_CTR0_LOW 0xb00
242 #define KNL_MC0_CH0_MSR_PMON_CTL0 0xb20
243 #define KNL_MC0_CH0_MSR_PMON_BOX_CTL 0xb30
244 #define KNL_MC0_CH0_MSR_PMON_FIXED_LOW 0xb3c
245 #define KNL_MC0_CH0_MSR_PMON_FIXED_CTL 0xb44
248 #define KNL_IRP_PCI_PMON_BOX_CTL 0xf0
249 #define KNL_IRP_PCI_PMON_RAW_EVENT_MASK (SNBEP_PMON_RAW_EVENT_MASK | \
250 KNL_CHA_MSR_PMON_CTL_QOR)
252 #define KNL_PCU_PMON_CTL_EV_SEL_MASK 0x0000007f
253 #define KNL_PCU_PMON_CTL_USE_OCC_CTR (1 << 7)
254 #define KNL_PCU_MSR_PMON_CTL_TRESH_MASK 0x3f000000
255 #define KNL_PCU_MSR_PMON_RAW_EVENT_MASK \
256 (KNL_PCU_PMON_CTL_EV_SEL_MASK | \
257 KNL_PCU_PMON_CTL_USE_OCC_CTR | \
258 SNBEP_PCU_MSR_PMON_CTL_OCC_SEL_MASK | \
259 SNBEP_PMON_CTL_EDGE_DET | \
260 SNBEP_CBO_PMON_CTL_TID_EN | \
261 SNBEP_PMON_CTL_EV_SEL_EXT | \
262 SNBEP_PMON_CTL_INVERT | \
263 KNL_PCU_MSR_PMON_CTL_TRESH_MASK | \
264 SNBEP_PCU_MSR_PMON_CTL_OCC_INVERT | \
265 SNBEP_PCU_MSR_PMON_CTL_OCC_EDGE_DET)
267 DEFINE_UNCORE_FORMAT_ATTR(event, event, "config:0-7");
268 DEFINE_UNCORE_FORMAT_ATTR(event2, event, "config:0-6");
269 DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21");
270 DEFINE_UNCORE_FORMAT_ATTR(use_occ_ctr, use_occ_ctr, "config:7");
271 DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15");
272 DEFINE_UNCORE_FORMAT_ATTR(qor, qor, "config:16");
273 DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18");
274 DEFINE_UNCORE_FORMAT_ATTR(tid_en, tid_en, "config:19");
275 DEFINE_UNCORE_FORMAT_ATTR(inv, inv, "config:23");
276 DEFINE_UNCORE_FORMAT_ATTR(thresh8, thresh, "config:24-31");
277 DEFINE_UNCORE_FORMAT_ATTR(thresh6, thresh, "config:24-29");
278 DEFINE_UNCORE_FORMAT_ATTR(thresh5, thresh, "config:24-28");
279 DEFINE_UNCORE_FORMAT_ATTR(occ_sel, occ_sel, "config:14-15");
280 DEFINE_UNCORE_FORMAT_ATTR(occ_invert, occ_invert, "config:30");
281 DEFINE_UNCORE_FORMAT_ATTR(occ_edge, occ_edge, "config:14-51");
282 DEFINE_UNCORE_FORMAT_ATTR(occ_edge_det, occ_edge_det, "config:31");
283 DEFINE_UNCORE_FORMAT_ATTR(filter_tid, filter_tid, "config1:0-4");
284 DEFINE_UNCORE_FORMAT_ATTR(filter_tid2, filter_tid, "config1:0");
285 DEFINE_UNCORE_FORMAT_ATTR(filter_tid3, filter_tid, "config1:0-5");
286 DEFINE_UNCORE_FORMAT_ATTR(filter_tid4, filter_tid, "config1:0-8");
287 DEFINE_UNCORE_FORMAT_ATTR(filter_cid, filter_cid, "config1:5");
288 DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8");
289 DEFINE_UNCORE_FORMAT_ATTR(filter_link2, filter_link, "config1:6-8");
290 DEFINE_UNCORE_FORMAT_ATTR(filter_link3, filter_link, "config1:12");
291 DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17");
292 DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47");
293 DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22");
294 DEFINE_UNCORE_FORMAT_ATTR(filter_state2, filter_state, "config1:17-22");
295 DEFINE_UNCORE_FORMAT_ATTR(filter_state3, filter_state, "config1:17-23");
296 DEFINE_UNCORE_FORMAT_ATTR(filter_state4, filter_state, "config1:18-20");
297 DEFINE_UNCORE_FORMAT_ATTR(filter_local, filter_local, "config1:33");
298 DEFINE_UNCORE_FORMAT_ATTR(filter_all_op, filter_all_op, "config1:35");
299 DEFINE_UNCORE_FORMAT_ATTR(filter_nnm, filter_nnm, "config1:37");
300 DEFINE_UNCORE_FORMAT_ATTR(filter_opc, filter_opc, "config1:23-31");
301 DEFINE_UNCORE_FORMAT_ATTR(filter_opc2, filter_opc, "config1:52-60");
302 DEFINE_UNCORE_FORMAT_ATTR(filter_opc3, filter_opc, "config1:41-60");
303 DEFINE_UNCORE_FORMAT_ATTR(filter_nc, filter_nc, "config1:62");
304 DEFINE_UNCORE_FORMAT_ATTR(filter_c6, filter_c6, "config1:61");
305 DEFINE_UNCORE_FORMAT_ATTR(filter_isoc, filter_isoc, "config1:63");
306 DEFINE_UNCORE_FORMAT_ATTR(filter_band0, filter_band0, "config1:0-7");
307 DEFINE_UNCORE_FORMAT_ATTR(filter_band1, filter_band1, "config1:8-15");
308 DEFINE_UNCORE_FORMAT_ATTR(filter_band2, filter_band2, "config1:16-23");
309 DEFINE_UNCORE_FORMAT_ATTR(filter_band3, filter_band3, "config1:24-31");
310 DEFINE_UNCORE_FORMAT_ATTR(match_rds, match_rds, "config1:48-51");
311 DEFINE_UNCORE_FORMAT_ATTR(match_rnid30, match_rnid30, "config1:32-35");
312 DEFINE_UNCORE_FORMAT_ATTR(match_rnid4, match_rnid4, "config1:31");
313 DEFINE_UNCORE_FORMAT_ATTR(match_dnid, match_dnid, "config1:13-17");
314 DEFINE_UNCORE_FORMAT_ATTR(match_mc, match_mc, "config1:9-12");
315 DEFINE_UNCORE_FORMAT_ATTR(match_opc, match_opc, "config1:5-8");
316 DEFINE_UNCORE_FORMAT_ATTR(match_vnw, match_vnw, "config1:3-4");
317 DEFINE_UNCORE_FORMAT_ATTR(match0, match0, "config1:0-31");
318 DEFINE_UNCORE_FORMAT_ATTR(match1, match1, "config1:32-63");
319 DEFINE_UNCORE_FORMAT_ATTR(mask_rds, mask_rds, "config2:48-51");
320 DEFINE_UNCORE_FORMAT_ATTR(mask_rnid30, mask_rnid30, "config2:32-35");
321 DEFINE_UNCORE_FORMAT_ATTR(mask_rnid4, mask_rnid4, "config2:31");
322 DEFINE_UNCORE_FORMAT_ATTR(mask_dnid, mask_dnid, "config2:13-17");
323 DEFINE_UNCORE_FORMAT_ATTR(mask_mc, mask_mc, "config2:9-12");
324 DEFINE_UNCORE_FORMAT_ATTR(mask_opc, mask_opc, "config2:5-8");
325 DEFINE_UNCORE_FORMAT_ATTR(mask_vnw, mask_vnw, "config2:3-4");
326 DEFINE_UNCORE_FORMAT_ATTR(mask0, mask0, "config2:0-31");
327 DEFINE_UNCORE_FORMAT_ATTR(mask1, mask1, "config2:32-63");
329 static void snbep_uncore_pci_disable_box(struct intel_uncore_box *box)
331 struct pci_dev *pdev = box->pci_dev;
332 int box_ctl = uncore_pci_box_ctl(box);
335 if (!pci_read_config_dword(pdev, box_ctl, &config)) {
336 config |= SNBEP_PMON_BOX_CTL_FRZ;
337 pci_write_config_dword(pdev, box_ctl, config);
341 static void snbep_uncore_pci_enable_box(struct intel_uncore_box *box)
343 struct pci_dev *pdev = box->pci_dev;
344 int box_ctl = uncore_pci_box_ctl(box);
347 if (!pci_read_config_dword(pdev, box_ctl, &config)) {
348 config &= ~SNBEP_PMON_BOX_CTL_FRZ;
349 pci_write_config_dword(pdev, box_ctl, config);
353 static void snbep_uncore_pci_enable_event(struct intel_uncore_box *box, struct perf_event *event)
355 struct pci_dev *pdev = box->pci_dev;
356 struct hw_perf_event *hwc = &event->hw;
358 pci_write_config_dword(pdev, hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
361 static void snbep_uncore_pci_disable_event(struct intel_uncore_box *box, struct perf_event *event)
363 struct pci_dev *pdev = box->pci_dev;
364 struct hw_perf_event *hwc = &event->hw;
366 pci_write_config_dword(pdev, hwc->config_base, hwc->config);
369 static u64 snbep_uncore_pci_read_counter(struct intel_uncore_box *box, struct perf_event *event)
371 struct pci_dev *pdev = box->pci_dev;
372 struct hw_perf_event *hwc = &event->hw;
375 pci_read_config_dword(pdev, hwc->event_base, (u32 *)&count);
376 pci_read_config_dword(pdev, hwc->event_base + 4, (u32 *)&count + 1);
381 static void snbep_uncore_pci_init_box(struct intel_uncore_box *box)
383 struct pci_dev *pdev = box->pci_dev;
384 int box_ctl = uncore_pci_box_ctl(box);
386 pci_write_config_dword(pdev, box_ctl, SNBEP_PMON_BOX_CTL_INT);
389 static void snbep_uncore_msr_disable_box(struct intel_uncore_box *box)
394 msr = uncore_msr_box_ctl(box);
397 config |= SNBEP_PMON_BOX_CTL_FRZ;
402 static void snbep_uncore_msr_enable_box(struct intel_uncore_box *box)
407 msr = uncore_msr_box_ctl(box);
410 config &= ~SNBEP_PMON_BOX_CTL_FRZ;
415 static void snbep_uncore_msr_enable_event(struct intel_uncore_box *box, struct perf_event *event)
417 struct hw_perf_event *hwc = &event->hw;
418 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
420 if (reg1->idx != EXTRA_REG_NONE)
421 wrmsrl(reg1->reg, uncore_shared_reg_config(box, 0));
423 wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
426 static void snbep_uncore_msr_disable_event(struct intel_uncore_box *box,
427 struct perf_event *event)
429 struct hw_perf_event *hwc = &event->hw;
431 wrmsrl(hwc->config_base, hwc->config);
434 static void snbep_uncore_msr_init_box(struct intel_uncore_box *box)
436 unsigned msr = uncore_msr_box_ctl(box);
439 wrmsrl(msr, SNBEP_PMON_BOX_CTL_INT);
442 static struct attribute *snbep_uncore_formats_attr[] = {
443 &format_attr_event.attr,
444 &format_attr_umask.attr,
445 &format_attr_edge.attr,
446 &format_attr_inv.attr,
447 &format_attr_thresh8.attr,
451 static struct attribute *snbep_uncore_ubox_formats_attr[] = {
452 &format_attr_event.attr,
453 &format_attr_umask.attr,
454 &format_attr_edge.attr,
455 &format_attr_inv.attr,
456 &format_attr_thresh5.attr,
460 static struct attribute *snbep_uncore_cbox_formats_attr[] = {
461 &format_attr_event.attr,
462 &format_attr_umask.attr,
463 &format_attr_edge.attr,
464 &format_attr_tid_en.attr,
465 &format_attr_inv.attr,
466 &format_attr_thresh8.attr,
467 &format_attr_filter_tid.attr,
468 &format_attr_filter_nid.attr,
469 &format_attr_filter_state.attr,
470 &format_attr_filter_opc.attr,
474 static struct attribute *snbep_uncore_pcu_formats_attr[] = {
475 &format_attr_event_ext.attr,
476 &format_attr_occ_sel.attr,
477 &format_attr_edge.attr,
478 &format_attr_inv.attr,
479 &format_attr_thresh5.attr,
480 &format_attr_occ_invert.attr,
481 &format_attr_occ_edge.attr,
482 &format_attr_filter_band0.attr,
483 &format_attr_filter_band1.attr,
484 &format_attr_filter_band2.attr,
485 &format_attr_filter_band3.attr,
489 static struct attribute *snbep_uncore_qpi_formats_attr[] = {
490 &format_attr_event_ext.attr,
491 &format_attr_umask.attr,
492 &format_attr_edge.attr,
493 &format_attr_inv.attr,
494 &format_attr_thresh8.attr,
495 &format_attr_match_rds.attr,
496 &format_attr_match_rnid30.attr,
497 &format_attr_match_rnid4.attr,
498 &format_attr_match_dnid.attr,
499 &format_attr_match_mc.attr,
500 &format_attr_match_opc.attr,
501 &format_attr_match_vnw.attr,
502 &format_attr_match0.attr,
503 &format_attr_match1.attr,
504 &format_attr_mask_rds.attr,
505 &format_attr_mask_rnid30.attr,
506 &format_attr_mask_rnid4.attr,
507 &format_attr_mask_dnid.attr,
508 &format_attr_mask_mc.attr,
509 &format_attr_mask_opc.attr,
510 &format_attr_mask_vnw.attr,
511 &format_attr_mask0.attr,
512 &format_attr_mask1.attr,
516 static struct uncore_event_desc snbep_uncore_imc_events[] = {
517 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff,umask=0x00"),
518 INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x04,umask=0x03"),
519 INTEL_UNCORE_EVENT_DESC(cas_count_read.scale, "6.103515625e-5"),
520 INTEL_UNCORE_EVENT_DESC(cas_count_read.unit, "MiB"),
521 INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x04,umask=0x0c"),
522 INTEL_UNCORE_EVENT_DESC(cas_count_write.scale, "6.103515625e-5"),
523 INTEL_UNCORE_EVENT_DESC(cas_count_write.unit, "MiB"),
524 { /* end: all zeroes */ },
527 static struct uncore_event_desc snbep_uncore_qpi_events[] = {
528 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x14"),
529 INTEL_UNCORE_EVENT_DESC(txl_flits_active, "event=0x00,umask=0x06"),
530 INTEL_UNCORE_EVENT_DESC(drs_data, "event=0x102,umask=0x08"),
531 INTEL_UNCORE_EVENT_DESC(ncb_data, "event=0x103,umask=0x04"),
532 { /* end: all zeroes */ },
535 static struct attribute_group snbep_uncore_format_group = {
537 .attrs = snbep_uncore_formats_attr,
540 static struct attribute_group snbep_uncore_ubox_format_group = {
542 .attrs = snbep_uncore_ubox_formats_attr,
545 static struct attribute_group snbep_uncore_cbox_format_group = {
547 .attrs = snbep_uncore_cbox_formats_attr,
550 static struct attribute_group snbep_uncore_pcu_format_group = {
552 .attrs = snbep_uncore_pcu_formats_attr,
555 static struct attribute_group snbep_uncore_qpi_format_group = {
557 .attrs = snbep_uncore_qpi_formats_attr,
560 #define __SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \
561 .disable_box = snbep_uncore_msr_disable_box, \
562 .enable_box = snbep_uncore_msr_enable_box, \
563 .disable_event = snbep_uncore_msr_disable_event, \
564 .enable_event = snbep_uncore_msr_enable_event, \
565 .read_counter = uncore_msr_read_counter
567 #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \
568 __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), \
569 .init_box = snbep_uncore_msr_init_box \
571 static struct intel_uncore_ops snbep_uncore_msr_ops = {
572 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
575 #define SNBEP_UNCORE_PCI_OPS_COMMON_INIT() \
576 .init_box = snbep_uncore_pci_init_box, \
577 .disable_box = snbep_uncore_pci_disable_box, \
578 .enable_box = snbep_uncore_pci_enable_box, \
579 .disable_event = snbep_uncore_pci_disable_event, \
580 .read_counter = snbep_uncore_pci_read_counter
582 static struct intel_uncore_ops snbep_uncore_pci_ops = {
583 SNBEP_UNCORE_PCI_OPS_COMMON_INIT(),
584 .enable_event = snbep_uncore_pci_enable_event, \
587 static struct event_constraint snbep_uncore_cbox_constraints[] = {
588 UNCORE_EVENT_CONSTRAINT(0x01, 0x1),
589 UNCORE_EVENT_CONSTRAINT(0x02, 0x3),
590 UNCORE_EVENT_CONSTRAINT(0x04, 0x3),
591 UNCORE_EVENT_CONSTRAINT(0x05, 0x3),
592 UNCORE_EVENT_CONSTRAINT(0x07, 0x3),
593 UNCORE_EVENT_CONSTRAINT(0x09, 0x3),
594 UNCORE_EVENT_CONSTRAINT(0x11, 0x1),
595 UNCORE_EVENT_CONSTRAINT(0x12, 0x3),
596 UNCORE_EVENT_CONSTRAINT(0x13, 0x3),
597 UNCORE_EVENT_CONSTRAINT(0x1b, 0xc),
598 UNCORE_EVENT_CONSTRAINT(0x1c, 0xc),
599 UNCORE_EVENT_CONSTRAINT(0x1d, 0xc),
600 UNCORE_EVENT_CONSTRAINT(0x1e, 0xc),
601 EVENT_CONSTRAINT_OVERLAP(0x1f, 0xe, 0xff),
602 UNCORE_EVENT_CONSTRAINT(0x21, 0x3),
603 UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
604 UNCORE_EVENT_CONSTRAINT(0x31, 0x3),
605 UNCORE_EVENT_CONSTRAINT(0x32, 0x3),
606 UNCORE_EVENT_CONSTRAINT(0x33, 0x3),
607 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
608 UNCORE_EVENT_CONSTRAINT(0x35, 0x3),
609 UNCORE_EVENT_CONSTRAINT(0x36, 0x1),
610 UNCORE_EVENT_CONSTRAINT(0x37, 0x3),
611 UNCORE_EVENT_CONSTRAINT(0x38, 0x3),
612 UNCORE_EVENT_CONSTRAINT(0x39, 0x3),
613 UNCORE_EVENT_CONSTRAINT(0x3b, 0x1),
617 static struct event_constraint snbep_uncore_r2pcie_constraints[] = {
618 UNCORE_EVENT_CONSTRAINT(0x10, 0x3),
619 UNCORE_EVENT_CONSTRAINT(0x11, 0x3),
620 UNCORE_EVENT_CONSTRAINT(0x12, 0x1),
621 UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
622 UNCORE_EVENT_CONSTRAINT(0x24, 0x3),
623 UNCORE_EVENT_CONSTRAINT(0x25, 0x3),
624 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
625 UNCORE_EVENT_CONSTRAINT(0x32, 0x3),
626 UNCORE_EVENT_CONSTRAINT(0x33, 0x3),
627 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
631 static struct event_constraint snbep_uncore_r3qpi_constraints[] = {
632 UNCORE_EVENT_CONSTRAINT(0x10, 0x3),
633 UNCORE_EVENT_CONSTRAINT(0x11, 0x3),
634 UNCORE_EVENT_CONSTRAINT(0x12, 0x3),
635 UNCORE_EVENT_CONSTRAINT(0x13, 0x1),
636 UNCORE_EVENT_CONSTRAINT(0x20, 0x3),
637 UNCORE_EVENT_CONSTRAINT(0x21, 0x3),
638 UNCORE_EVENT_CONSTRAINT(0x22, 0x3),
639 UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
640 UNCORE_EVENT_CONSTRAINT(0x24, 0x3),
641 UNCORE_EVENT_CONSTRAINT(0x25, 0x3),
642 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
643 UNCORE_EVENT_CONSTRAINT(0x28, 0x3),
644 UNCORE_EVENT_CONSTRAINT(0x29, 0x3),
645 UNCORE_EVENT_CONSTRAINT(0x2a, 0x3),
646 UNCORE_EVENT_CONSTRAINT(0x2b, 0x3),
647 UNCORE_EVENT_CONSTRAINT(0x2c, 0x3),
648 UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
649 UNCORE_EVENT_CONSTRAINT(0x2e, 0x3),
650 UNCORE_EVENT_CONSTRAINT(0x2f, 0x3),
651 UNCORE_EVENT_CONSTRAINT(0x30, 0x3),
652 UNCORE_EVENT_CONSTRAINT(0x31, 0x3),
653 UNCORE_EVENT_CONSTRAINT(0x32, 0x3),
654 UNCORE_EVENT_CONSTRAINT(0x33, 0x3),
655 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
656 UNCORE_EVENT_CONSTRAINT(0x36, 0x3),
657 UNCORE_EVENT_CONSTRAINT(0x37, 0x3),
658 UNCORE_EVENT_CONSTRAINT(0x38, 0x3),
659 UNCORE_EVENT_CONSTRAINT(0x39, 0x3),
663 static struct intel_uncore_type snbep_uncore_ubox = {
668 .fixed_ctr_bits = 48,
669 .perf_ctr = SNBEP_U_MSR_PMON_CTR0,
670 .event_ctl = SNBEP_U_MSR_PMON_CTL0,
671 .event_mask = SNBEP_U_MSR_PMON_RAW_EVENT_MASK,
672 .fixed_ctr = SNBEP_U_MSR_PMON_UCLK_FIXED_CTR,
673 .fixed_ctl = SNBEP_U_MSR_PMON_UCLK_FIXED_CTL,
674 .ops = &snbep_uncore_msr_ops,
675 .format_group = &snbep_uncore_ubox_format_group,
678 static struct extra_reg snbep_uncore_cbox_extra_regs[] = {
679 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
680 SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
681 SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
682 SNBEP_CBO_EVENT_EXTRA_REG(0x4334, 0xffff, 0x6),
683 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
684 SNBEP_CBO_EVENT_EXTRA_REG(0x4534, 0xffff, 0x6),
685 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
686 SNBEP_CBO_EVENT_EXTRA_REG(0x4934, 0xffff, 0x6),
687 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0x6),
688 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x8),
689 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x8),
690 SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0xa),
691 SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0xa),
692 SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x2),
693 SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x2),
694 SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x2),
695 SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x2),
696 SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x8),
697 SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x8),
698 SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0xa),
699 SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0xa),
700 SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x2),
701 SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x2),
702 SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x2),
703 SNBEP_CBO_EVENT_EXTRA_REG(0x4037, 0x40ff, 0x2),
707 static void snbep_cbox_put_constraint(struct intel_uncore_box *box, struct perf_event *event)
709 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
710 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
713 if (uncore_box_is_fake(box))
716 for (i = 0; i < 5; i++) {
717 if (reg1->alloc & (0x1 << i))
718 atomic_sub(1 << (i * 6), &er->ref);
723 static struct event_constraint *
724 __snbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event,
725 u64 (*cbox_filter_mask)(int fields))
727 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
728 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
733 if (reg1->idx == EXTRA_REG_NONE)
736 raw_spin_lock_irqsave(&er->lock, flags);
737 for (i = 0; i < 5; i++) {
738 if (!(reg1->idx & (0x1 << i)))
740 if (!uncore_box_is_fake(box) && (reg1->alloc & (0x1 << i)))
743 mask = cbox_filter_mask(0x1 << i);
744 if (!__BITS_VALUE(atomic_read(&er->ref), i, 6) ||
745 !((reg1->config ^ er->config) & mask)) {
746 atomic_add(1 << (i * 6), &er->ref);
748 er->config |= reg1->config & mask;
754 raw_spin_unlock_irqrestore(&er->lock, flags);
758 if (!uncore_box_is_fake(box))
759 reg1->alloc |= alloc;
763 for (; i >= 0; i--) {
764 if (alloc & (0x1 << i))
765 atomic_sub(1 << (i * 6), &er->ref);
767 return &uncore_constraint_empty;
770 static u64 snbep_cbox_filter_mask(int fields)
775 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_TID;
777 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_NID;
779 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_STATE;
781 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_OPC;
786 static struct event_constraint *
787 snbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
789 return __snbep_cbox_get_constraint(box, event, snbep_cbox_filter_mask);
792 static int snbep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
794 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
795 struct extra_reg *er;
798 for (er = snbep_uncore_cbox_extra_regs; er->msr; er++) {
799 if (er->event != (event->hw.config & er->config_mask))
805 reg1->reg = SNBEP_C0_MSR_PMON_BOX_FILTER +
806 SNBEP_CBO_MSR_OFFSET * box->pmu->pmu_idx;
807 reg1->config = event->attr.config1 & snbep_cbox_filter_mask(idx);
813 static struct intel_uncore_ops snbep_uncore_cbox_ops = {
814 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
815 .hw_config = snbep_cbox_hw_config,
816 .get_constraint = snbep_cbox_get_constraint,
817 .put_constraint = snbep_cbox_put_constraint,
820 static struct intel_uncore_type snbep_uncore_cbox = {
825 .event_ctl = SNBEP_C0_MSR_PMON_CTL0,
826 .perf_ctr = SNBEP_C0_MSR_PMON_CTR0,
827 .event_mask = SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK,
828 .box_ctl = SNBEP_C0_MSR_PMON_BOX_CTL,
829 .msr_offset = SNBEP_CBO_MSR_OFFSET,
830 .num_shared_regs = 1,
831 .constraints = snbep_uncore_cbox_constraints,
832 .ops = &snbep_uncore_cbox_ops,
833 .format_group = &snbep_uncore_cbox_format_group,
836 static u64 snbep_pcu_alter_er(struct perf_event *event, int new_idx, bool modify)
838 struct hw_perf_event *hwc = &event->hw;
839 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
840 u64 config = reg1->config;
842 if (new_idx > reg1->idx)
843 config <<= 8 * (new_idx - reg1->idx);
845 config >>= 8 * (reg1->idx - new_idx);
848 hwc->config += new_idx - reg1->idx;
849 reg1->config = config;
855 static struct event_constraint *
856 snbep_pcu_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
858 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
859 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
862 u64 mask, config1 = reg1->config;
865 if (reg1->idx == EXTRA_REG_NONE ||
866 (!uncore_box_is_fake(box) && reg1->alloc))
869 mask = 0xffULL << (idx * 8);
870 raw_spin_lock_irqsave(&er->lock, flags);
871 if (!__BITS_VALUE(atomic_read(&er->ref), idx, 8) ||
872 !((config1 ^ er->config) & mask)) {
873 atomic_add(1 << (idx * 8), &er->ref);
875 er->config |= config1 & mask;
878 raw_spin_unlock_irqrestore(&er->lock, flags);
882 if (idx != reg1->idx) {
883 config1 = snbep_pcu_alter_er(event, idx, false);
886 return &uncore_constraint_empty;
889 if (!uncore_box_is_fake(box)) {
890 if (idx != reg1->idx)
891 snbep_pcu_alter_er(event, idx, true);
897 static void snbep_pcu_put_constraint(struct intel_uncore_box *box, struct perf_event *event)
899 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
900 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
902 if (uncore_box_is_fake(box) || !reg1->alloc)
905 atomic_sub(1 << (reg1->idx * 8), &er->ref);
909 static int snbep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *event)
911 struct hw_perf_event *hwc = &event->hw;
912 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
913 int ev_sel = hwc->config & SNBEP_PMON_CTL_EV_SEL_MASK;
915 if (ev_sel >= 0xb && ev_sel <= 0xe) {
916 reg1->reg = SNBEP_PCU_MSR_PMON_BOX_FILTER;
917 reg1->idx = ev_sel - 0xb;
918 reg1->config = event->attr.config1 & (0xff << (reg1->idx * 8));
923 static struct intel_uncore_ops snbep_uncore_pcu_ops = {
924 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
925 .hw_config = snbep_pcu_hw_config,
926 .get_constraint = snbep_pcu_get_constraint,
927 .put_constraint = snbep_pcu_put_constraint,
930 static struct intel_uncore_type snbep_uncore_pcu = {
935 .perf_ctr = SNBEP_PCU_MSR_PMON_CTR0,
936 .event_ctl = SNBEP_PCU_MSR_PMON_CTL0,
937 .event_mask = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
938 .box_ctl = SNBEP_PCU_MSR_PMON_BOX_CTL,
939 .num_shared_regs = 1,
940 .ops = &snbep_uncore_pcu_ops,
941 .format_group = &snbep_uncore_pcu_format_group,
944 static struct intel_uncore_type *snbep_msr_uncores[] = {
951 void snbep_uncore_cpu_init(void)
953 if (snbep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
954 snbep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
955 uncore_msr_uncores = snbep_msr_uncores;
959 SNBEP_PCI_QPI_PORT0_FILTER,
960 SNBEP_PCI_QPI_PORT1_FILTER,
964 static int snbep_qpi_hw_config(struct intel_uncore_box *box, struct perf_event *event)
966 struct hw_perf_event *hwc = &event->hw;
967 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
968 struct hw_perf_event_extra *reg2 = &hwc->branch_reg;
970 if ((hwc->config & SNBEP_PMON_CTL_EV_SEL_MASK) == 0x38) {
972 reg1->reg = SNBEP_Q_Py_PCI_PMON_PKT_MATCH0;
973 reg1->config = event->attr.config1;
974 reg2->reg = SNBEP_Q_Py_PCI_PMON_PKT_MASK0;
975 reg2->config = event->attr.config2;
980 static void snbep_qpi_enable_event(struct intel_uncore_box *box, struct perf_event *event)
982 struct pci_dev *pdev = box->pci_dev;
983 struct hw_perf_event *hwc = &event->hw;
984 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
985 struct hw_perf_event_extra *reg2 = &hwc->branch_reg;
987 if (reg1->idx != EXTRA_REG_NONE) {
988 int idx = box->pmu->pmu_idx + SNBEP_PCI_QPI_PORT0_FILTER;
989 struct pci_dev *filter_pdev = uncore_extra_pci_dev[box->phys_id][idx];
991 pci_write_config_dword(filter_pdev, reg1->reg,
993 pci_write_config_dword(filter_pdev, reg1->reg + 4,
994 (u32)(reg1->config >> 32));
995 pci_write_config_dword(filter_pdev, reg2->reg,
997 pci_write_config_dword(filter_pdev, reg2->reg + 4,
998 (u32)(reg2->config >> 32));
1002 pci_write_config_dword(pdev, hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
1005 static struct intel_uncore_ops snbep_uncore_qpi_ops = {
1006 SNBEP_UNCORE_PCI_OPS_COMMON_INIT(),
1007 .enable_event = snbep_qpi_enable_event,
1008 .hw_config = snbep_qpi_hw_config,
1009 .get_constraint = uncore_get_constraint,
1010 .put_constraint = uncore_put_constraint,
1013 #define SNBEP_UNCORE_PCI_COMMON_INIT() \
1014 .perf_ctr = SNBEP_PCI_PMON_CTR0, \
1015 .event_ctl = SNBEP_PCI_PMON_CTL0, \
1016 .event_mask = SNBEP_PMON_RAW_EVENT_MASK, \
1017 .box_ctl = SNBEP_PCI_PMON_BOX_CTL, \
1018 .ops = &snbep_uncore_pci_ops, \
1019 .format_group = &snbep_uncore_format_group
1021 static struct intel_uncore_type snbep_uncore_ha = {
1025 .perf_ctr_bits = 48,
1026 SNBEP_UNCORE_PCI_COMMON_INIT(),
1029 static struct intel_uncore_type snbep_uncore_imc = {
1033 .perf_ctr_bits = 48,
1034 .fixed_ctr_bits = 48,
1035 .fixed_ctr = SNBEP_MC_CHy_PCI_PMON_FIXED_CTR,
1036 .fixed_ctl = SNBEP_MC_CHy_PCI_PMON_FIXED_CTL,
1037 .event_descs = snbep_uncore_imc_events,
1038 SNBEP_UNCORE_PCI_COMMON_INIT(),
1041 static struct intel_uncore_type snbep_uncore_qpi = {
1045 .perf_ctr_bits = 48,
1046 .perf_ctr = SNBEP_PCI_PMON_CTR0,
1047 .event_ctl = SNBEP_PCI_PMON_CTL0,
1048 .event_mask = SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK,
1049 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
1050 .num_shared_regs = 1,
1051 .ops = &snbep_uncore_qpi_ops,
1052 .event_descs = snbep_uncore_qpi_events,
1053 .format_group = &snbep_uncore_qpi_format_group,
1057 static struct intel_uncore_type snbep_uncore_r2pcie = {
1061 .perf_ctr_bits = 44,
1062 .constraints = snbep_uncore_r2pcie_constraints,
1063 SNBEP_UNCORE_PCI_COMMON_INIT(),
1066 static struct intel_uncore_type snbep_uncore_r3qpi = {
1070 .perf_ctr_bits = 44,
1071 .constraints = snbep_uncore_r3qpi_constraints,
1072 SNBEP_UNCORE_PCI_COMMON_INIT(),
1076 SNBEP_PCI_UNCORE_HA,
1077 SNBEP_PCI_UNCORE_IMC,
1078 SNBEP_PCI_UNCORE_QPI,
1079 SNBEP_PCI_UNCORE_R2PCIE,
1080 SNBEP_PCI_UNCORE_R3QPI,
1083 static struct intel_uncore_type *snbep_pci_uncores[] = {
1084 [SNBEP_PCI_UNCORE_HA] = &snbep_uncore_ha,
1085 [SNBEP_PCI_UNCORE_IMC] = &snbep_uncore_imc,
1086 [SNBEP_PCI_UNCORE_QPI] = &snbep_uncore_qpi,
1087 [SNBEP_PCI_UNCORE_R2PCIE] = &snbep_uncore_r2pcie,
1088 [SNBEP_PCI_UNCORE_R3QPI] = &snbep_uncore_r3qpi,
1092 static const struct pci_device_id snbep_uncore_pci_ids[] = {
1094 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_HA),
1095 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_HA, 0),
1097 { /* MC Channel 0 */
1098 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC0),
1099 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_IMC, 0),
1101 { /* MC Channel 1 */
1102 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC1),
1103 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_IMC, 1),
1105 { /* MC Channel 2 */
1106 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC2),
1107 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_IMC, 2),
1109 { /* MC Channel 3 */
1110 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC3),
1111 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_IMC, 3),
1114 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_QPI0),
1115 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_QPI, 0),
1118 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_QPI1),
1119 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_QPI, 1),
1122 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R2PCIE),
1123 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_R2PCIE, 0),
1125 { /* R3QPI Link 0 */
1126 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R3QPI0),
1127 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_R3QPI, 0),
1129 { /* R3QPI Link 1 */
1130 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R3QPI1),
1131 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_R3QPI, 1),
1133 { /* QPI Port 0 filter */
1134 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3c86),
1135 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
1136 SNBEP_PCI_QPI_PORT0_FILTER),
1138 { /* QPI Port 0 filter */
1139 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3c96),
1140 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
1141 SNBEP_PCI_QPI_PORT1_FILTER),
1143 { /* end: all zeroes */ }
1146 static struct pci_driver snbep_uncore_pci_driver = {
1147 .name = "snbep_uncore",
1148 .id_table = snbep_uncore_pci_ids,
1152 * build pci bus to socket mapping
1154 static int snbep_pci2phy_map_init(int devid)
1156 struct pci_dev *ubox_dev = NULL;
1157 int i, bus, nodeid, segment;
1158 struct pci2phy_map *map;
1163 /* find the UBOX device */
1164 ubox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, devid, ubox_dev);
1167 bus = ubox_dev->bus->number;
1168 /* get the Node ID of the local register */
1169 err = pci_read_config_dword(ubox_dev, 0x40, &config);
1173 /* get the Node ID mapping */
1174 err = pci_read_config_dword(ubox_dev, 0x54, &config);
1178 segment = pci_domain_nr(ubox_dev->bus);
1179 raw_spin_lock(&pci2phy_map_lock);
1180 map = __find_pci2phy_map(segment);
1182 raw_spin_unlock(&pci2phy_map_lock);
1188 * every three bits in the Node ID mapping register maps
1189 * to a particular node.
1191 for (i = 0; i < 8; i++) {
1192 if (nodeid == ((config >> (3 * i)) & 0x7)) {
1193 map->pbus_to_physid[bus] = i;
1197 raw_spin_unlock(&pci2phy_map_lock);
1202 * For PCI bus with no UBOX device, find the next bus
1203 * that has UBOX device and use its mapping.
1205 raw_spin_lock(&pci2phy_map_lock);
1206 list_for_each_entry(map, &pci2phy_map_head, list) {
1208 for (bus = 255; bus >= 0; bus--) {
1209 if (map->pbus_to_physid[bus] >= 0)
1210 i = map->pbus_to_physid[bus];
1212 map->pbus_to_physid[bus] = i;
1215 raw_spin_unlock(&pci2phy_map_lock);
1218 pci_dev_put(ubox_dev);
1220 return err ? pcibios_err_to_errno(err) : 0;
1223 int snbep_uncore_pci_init(void)
1225 int ret = snbep_pci2phy_map_init(0x3ce0);
1228 uncore_pci_uncores = snbep_pci_uncores;
1229 uncore_pci_driver = &snbep_uncore_pci_driver;
1232 /* end of Sandy Bridge-EP uncore support */
1234 /* IvyTown uncore support */
1235 static void ivbep_uncore_msr_init_box(struct intel_uncore_box *box)
1237 unsigned msr = uncore_msr_box_ctl(box);
1239 wrmsrl(msr, IVBEP_PMON_BOX_CTL_INT);
1242 static void ivbep_uncore_pci_init_box(struct intel_uncore_box *box)
1244 struct pci_dev *pdev = box->pci_dev;
1246 pci_write_config_dword(pdev, SNBEP_PCI_PMON_BOX_CTL, IVBEP_PMON_BOX_CTL_INT);
1249 #define IVBEP_UNCORE_MSR_OPS_COMMON_INIT() \
1250 .init_box = ivbep_uncore_msr_init_box, \
1251 .disable_box = snbep_uncore_msr_disable_box, \
1252 .enable_box = snbep_uncore_msr_enable_box, \
1253 .disable_event = snbep_uncore_msr_disable_event, \
1254 .enable_event = snbep_uncore_msr_enable_event, \
1255 .read_counter = uncore_msr_read_counter
1257 static struct intel_uncore_ops ivbep_uncore_msr_ops = {
1258 IVBEP_UNCORE_MSR_OPS_COMMON_INIT(),
1261 static struct intel_uncore_ops ivbep_uncore_pci_ops = {
1262 .init_box = ivbep_uncore_pci_init_box,
1263 .disable_box = snbep_uncore_pci_disable_box,
1264 .enable_box = snbep_uncore_pci_enable_box,
1265 .disable_event = snbep_uncore_pci_disable_event,
1266 .enable_event = snbep_uncore_pci_enable_event,
1267 .read_counter = snbep_uncore_pci_read_counter,
1270 #define IVBEP_UNCORE_PCI_COMMON_INIT() \
1271 .perf_ctr = SNBEP_PCI_PMON_CTR0, \
1272 .event_ctl = SNBEP_PCI_PMON_CTL0, \
1273 .event_mask = IVBEP_PMON_RAW_EVENT_MASK, \
1274 .box_ctl = SNBEP_PCI_PMON_BOX_CTL, \
1275 .ops = &ivbep_uncore_pci_ops, \
1276 .format_group = &ivbep_uncore_format_group
1278 static struct attribute *ivbep_uncore_formats_attr[] = {
1279 &format_attr_event.attr,
1280 &format_attr_umask.attr,
1281 &format_attr_edge.attr,
1282 &format_attr_inv.attr,
1283 &format_attr_thresh8.attr,
1287 static struct attribute *ivbep_uncore_ubox_formats_attr[] = {
1288 &format_attr_event.attr,
1289 &format_attr_umask.attr,
1290 &format_attr_edge.attr,
1291 &format_attr_inv.attr,
1292 &format_attr_thresh5.attr,
1296 static struct attribute *ivbep_uncore_cbox_formats_attr[] = {
1297 &format_attr_event.attr,
1298 &format_attr_umask.attr,
1299 &format_attr_edge.attr,
1300 &format_attr_tid_en.attr,
1301 &format_attr_thresh8.attr,
1302 &format_attr_filter_tid.attr,
1303 &format_attr_filter_link.attr,
1304 &format_attr_filter_state2.attr,
1305 &format_attr_filter_nid2.attr,
1306 &format_attr_filter_opc2.attr,
1307 &format_attr_filter_nc.attr,
1308 &format_attr_filter_c6.attr,
1309 &format_attr_filter_isoc.attr,
1313 static struct attribute *ivbep_uncore_pcu_formats_attr[] = {
1314 &format_attr_event_ext.attr,
1315 &format_attr_occ_sel.attr,
1316 &format_attr_edge.attr,
1317 &format_attr_thresh5.attr,
1318 &format_attr_occ_invert.attr,
1319 &format_attr_occ_edge.attr,
1320 &format_attr_filter_band0.attr,
1321 &format_attr_filter_band1.attr,
1322 &format_attr_filter_band2.attr,
1323 &format_attr_filter_band3.attr,
1327 static struct attribute *ivbep_uncore_qpi_formats_attr[] = {
1328 &format_attr_event_ext.attr,
1329 &format_attr_umask.attr,
1330 &format_attr_edge.attr,
1331 &format_attr_thresh8.attr,
1332 &format_attr_match_rds.attr,
1333 &format_attr_match_rnid30.attr,
1334 &format_attr_match_rnid4.attr,
1335 &format_attr_match_dnid.attr,
1336 &format_attr_match_mc.attr,
1337 &format_attr_match_opc.attr,
1338 &format_attr_match_vnw.attr,
1339 &format_attr_match0.attr,
1340 &format_attr_match1.attr,
1341 &format_attr_mask_rds.attr,
1342 &format_attr_mask_rnid30.attr,
1343 &format_attr_mask_rnid4.attr,
1344 &format_attr_mask_dnid.attr,
1345 &format_attr_mask_mc.attr,
1346 &format_attr_mask_opc.attr,
1347 &format_attr_mask_vnw.attr,
1348 &format_attr_mask0.attr,
1349 &format_attr_mask1.attr,
1353 static struct attribute_group ivbep_uncore_format_group = {
1355 .attrs = ivbep_uncore_formats_attr,
1358 static struct attribute_group ivbep_uncore_ubox_format_group = {
1360 .attrs = ivbep_uncore_ubox_formats_attr,
1363 static struct attribute_group ivbep_uncore_cbox_format_group = {
1365 .attrs = ivbep_uncore_cbox_formats_attr,
1368 static struct attribute_group ivbep_uncore_pcu_format_group = {
1370 .attrs = ivbep_uncore_pcu_formats_attr,
1373 static struct attribute_group ivbep_uncore_qpi_format_group = {
1375 .attrs = ivbep_uncore_qpi_formats_attr,
1378 static struct intel_uncore_type ivbep_uncore_ubox = {
1382 .perf_ctr_bits = 44,
1383 .fixed_ctr_bits = 48,
1384 .perf_ctr = SNBEP_U_MSR_PMON_CTR0,
1385 .event_ctl = SNBEP_U_MSR_PMON_CTL0,
1386 .event_mask = IVBEP_U_MSR_PMON_RAW_EVENT_MASK,
1387 .fixed_ctr = SNBEP_U_MSR_PMON_UCLK_FIXED_CTR,
1388 .fixed_ctl = SNBEP_U_MSR_PMON_UCLK_FIXED_CTL,
1389 .ops = &ivbep_uncore_msr_ops,
1390 .format_group = &ivbep_uncore_ubox_format_group,
1393 static struct extra_reg ivbep_uncore_cbox_extra_regs[] = {
1394 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
1395 SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
1396 SNBEP_CBO_EVENT_EXTRA_REG(0x1031, 0x10ff, 0x2),
1397 SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4),
1398 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0xc),
1399 SNBEP_CBO_EVENT_EXTRA_REG(0x5134, 0xffff, 0xc),
1400 SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
1401 SNBEP_CBO_EVENT_EXTRA_REG(0x4334, 0xffff, 0xc),
1402 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
1403 SNBEP_CBO_EVENT_EXTRA_REG(0x4534, 0xffff, 0xc),
1404 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
1405 SNBEP_CBO_EVENT_EXTRA_REG(0x4934, 0xffff, 0xc),
1406 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x10),
1407 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x10),
1408 SNBEP_CBO_EVENT_EXTRA_REG(0x2135, 0xffff, 0x10),
1409 SNBEP_CBO_EVENT_EXTRA_REG(0x2335, 0xffff, 0x10),
1410 SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0x18),
1411 SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0x18),
1412 SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x8),
1413 SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x8),
1414 SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x8),
1415 SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x8),
1416 SNBEP_CBO_EVENT_EXTRA_REG(0x8135, 0xffff, 0x10),
1417 SNBEP_CBO_EVENT_EXTRA_REG(0x8335, 0xffff, 0x10),
1418 SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x10),
1419 SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x10),
1420 SNBEP_CBO_EVENT_EXTRA_REG(0x2136, 0xffff, 0x10),
1421 SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10),
1422 SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0x18),
1423 SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0x18),
1424 SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x8),
1425 SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x8),
1426 SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x8),
1427 SNBEP_CBO_EVENT_EXTRA_REG(0x5036, 0xffff, 0x8),
1428 SNBEP_CBO_EVENT_EXTRA_REG(0x8136, 0xffff, 0x10),
1429 SNBEP_CBO_EVENT_EXTRA_REG(0x8336, 0xffff, 0x10),
1430 SNBEP_CBO_EVENT_EXTRA_REG(0x4037, 0x40ff, 0x8),
1434 static u64 ivbep_cbox_filter_mask(int fields)
1439 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_TID;
1441 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_LINK;
1443 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_STATE;
1445 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_NID;
1446 if (fields & 0x10) {
1447 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_OPC;
1448 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_NC;
1449 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_C6;
1450 mask |= IVBEP_CB0_MSR_PMON_BOX_FILTER_ISOC;
1456 static struct event_constraint *
1457 ivbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
1459 return __snbep_cbox_get_constraint(box, event, ivbep_cbox_filter_mask);
1462 static int ivbep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
1464 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
1465 struct extra_reg *er;
1468 for (er = ivbep_uncore_cbox_extra_regs; er->msr; er++) {
1469 if (er->event != (event->hw.config & er->config_mask))
1475 reg1->reg = SNBEP_C0_MSR_PMON_BOX_FILTER +
1476 SNBEP_CBO_MSR_OFFSET * box->pmu->pmu_idx;
1477 reg1->config = event->attr.config1 & ivbep_cbox_filter_mask(idx);
1483 static void ivbep_cbox_enable_event(struct intel_uncore_box *box, struct perf_event *event)
1485 struct hw_perf_event *hwc = &event->hw;
1486 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
1488 if (reg1->idx != EXTRA_REG_NONE) {
1489 u64 filter = uncore_shared_reg_config(box, 0);
1490 wrmsrl(reg1->reg, filter & 0xffffffff);
1491 wrmsrl(reg1->reg + 6, filter >> 32);
1494 wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
1497 static struct intel_uncore_ops ivbep_uncore_cbox_ops = {
1498 .init_box = ivbep_uncore_msr_init_box,
1499 .disable_box = snbep_uncore_msr_disable_box,
1500 .enable_box = snbep_uncore_msr_enable_box,
1501 .disable_event = snbep_uncore_msr_disable_event,
1502 .enable_event = ivbep_cbox_enable_event,
1503 .read_counter = uncore_msr_read_counter,
1504 .hw_config = ivbep_cbox_hw_config,
1505 .get_constraint = ivbep_cbox_get_constraint,
1506 .put_constraint = snbep_cbox_put_constraint,
1509 static struct intel_uncore_type ivbep_uncore_cbox = {
1513 .perf_ctr_bits = 44,
1514 .event_ctl = SNBEP_C0_MSR_PMON_CTL0,
1515 .perf_ctr = SNBEP_C0_MSR_PMON_CTR0,
1516 .event_mask = IVBEP_CBO_MSR_PMON_RAW_EVENT_MASK,
1517 .box_ctl = SNBEP_C0_MSR_PMON_BOX_CTL,
1518 .msr_offset = SNBEP_CBO_MSR_OFFSET,
1519 .num_shared_regs = 1,
1520 .constraints = snbep_uncore_cbox_constraints,
1521 .ops = &ivbep_uncore_cbox_ops,
1522 .format_group = &ivbep_uncore_cbox_format_group,
1525 static struct intel_uncore_ops ivbep_uncore_pcu_ops = {
1526 IVBEP_UNCORE_MSR_OPS_COMMON_INIT(),
1527 .hw_config = snbep_pcu_hw_config,
1528 .get_constraint = snbep_pcu_get_constraint,
1529 .put_constraint = snbep_pcu_put_constraint,
1532 static struct intel_uncore_type ivbep_uncore_pcu = {
1536 .perf_ctr_bits = 48,
1537 .perf_ctr = SNBEP_PCU_MSR_PMON_CTR0,
1538 .event_ctl = SNBEP_PCU_MSR_PMON_CTL0,
1539 .event_mask = IVBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
1540 .box_ctl = SNBEP_PCU_MSR_PMON_BOX_CTL,
1541 .num_shared_regs = 1,
1542 .ops = &ivbep_uncore_pcu_ops,
1543 .format_group = &ivbep_uncore_pcu_format_group,
1546 static struct intel_uncore_type *ivbep_msr_uncores[] = {
1553 void ivbep_uncore_cpu_init(void)
1555 if (ivbep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
1556 ivbep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
1557 uncore_msr_uncores = ivbep_msr_uncores;
1560 static struct intel_uncore_type ivbep_uncore_ha = {
1564 .perf_ctr_bits = 48,
1565 IVBEP_UNCORE_PCI_COMMON_INIT(),
1568 static struct intel_uncore_type ivbep_uncore_imc = {
1572 .perf_ctr_bits = 48,
1573 .fixed_ctr_bits = 48,
1574 .fixed_ctr = SNBEP_MC_CHy_PCI_PMON_FIXED_CTR,
1575 .fixed_ctl = SNBEP_MC_CHy_PCI_PMON_FIXED_CTL,
1576 .event_descs = snbep_uncore_imc_events,
1577 IVBEP_UNCORE_PCI_COMMON_INIT(),
1580 /* registers in IRP boxes are not properly aligned */
1581 static unsigned ivbep_uncore_irp_ctls[] = {0xd8, 0xdc, 0xe0, 0xe4};
1582 static unsigned ivbep_uncore_irp_ctrs[] = {0xa0, 0xb0, 0xb8, 0xc0};
1584 static void ivbep_uncore_irp_enable_event(struct intel_uncore_box *box, struct perf_event *event)
1586 struct pci_dev *pdev = box->pci_dev;
1587 struct hw_perf_event *hwc = &event->hw;
1589 pci_write_config_dword(pdev, ivbep_uncore_irp_ctls[hwc->idx],
1590 hwc->config | SNBEP_PMON_CTL_EN);
1593 static void ivbep_uncore_irp_disable_event(struct intel_uncore_box *box, struct perf_event *event)
1595 struct pci_dev *pdev = box->pci_dev;
1596 struct hw_perf_event *hwc = &event->hw;
1598 pci_write_config_dword(pdev, ivbep_uncore_irp_ctls[hwc->idx], hwc->config);
1601 static u64 ivbep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event)
1603 struct pci_dev *pdev = box->pci_dev;
1604 struct hw_perf_event *hwc = &event->hw;
1607 pci_read_config_dword(pdev, ivbep_uncore_irp_ctrs[hwc->idx], (u32 *)&count);
1608 pci_read_config_dword(pdev, ivbep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1);
1613 static struct intel_uncore_ops ivbep_uncore_irp_ops = {
1614 .init_box = ivbep_uncore_pci_init_box,
1615 .disable_box = snbep_uncore_pci_disable_box,
1616 .enable_box = snbep_uncore_pci_enable_box,
1617 .disable_event = ivbep_uncore_irp_disable_event,
1618 .enable_event = ivbep_uncore_irp_enable_event,
1619 .read_counter = ivbep_uncore_irp_read_counter,
1622 static struct intel_uncore_type ivbep_uncore_irp = {
1626 .perf_ctr_bits = 48,
1627 .event_mask = IVBEP_PMON_RAW_EVENT_MASK,
1628 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
1629 .ops = &ivbep_uncore_irp_ops,
1630 .format_group = &ivbep_uncore_format_group,
1633 static struct intel_uncore_ops ivbep_uncore_qpi_ops = {
1634 .init_box = ivbep_uncore_pci_init_box,
1635 .disable_box = snbep_uncore_pci_disable_box,
1636 .enable_box = snbep_uncore_pci_enable_box,
1637 .disable_event = snbep_uncore_pci_disable_event,
1638 .enable_event = snbep_qpi_enable_event,
1639 .read_counter = snbep_uncore_pci_read_counter,
1640 .hw_config = snbep_qpi_hw_config,
1641 .get_constraint = uncore_get_constraint,
1642 .put_constraint = uncore_put_constraint,
1645 static struct intel_uncore_type ivbep_uncore_qpi = {
1649 .perf_ctr_bits = 48,
1650 .perf_ctr = SNBEP_PCI_PMON_CTR0,
1651 .event_ctl = SNBEP_PCI_PMON_CTL0,
1652 .event_mask = IVBEP_QPI_PCI_PMON_RAW_EVENT_MASK,
1653 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
1654 .num_shared_regs = 1,
1655 .ops = &ivbep_uncore_qpi_ops,
1656 .format_group = &ivbep_uncore_qpi_format_group,
1659 static struct intel_uncore_type ivbep_uncore_r2pcie = {
1663 .perf_ctr_bits = 44,
1664 .constraints = snbep_uncore_r2pcie_constraints,
1665 IVBEP_UNCORE_PCI_COMMON_INIT(),
1668 static struct intel_uncore_type ivbep_uncore_r3qpi = {
1672 .perf_ctr_bits = 44,
1673 .constraints = snbep_uncore_r3qpi_constraints,
1674 IVBEP_UNCORE_PCI_COMMON_INIT(),
1678 IVBEP_PCI_UNCORE_HA,
1679 IVBEP_PCI_UNCORE_IMC,
1680 IVBEP_PCI_UNCORE_IRP,
1681 IVBEP_PCI_UNCORE_QPI,
1682 IVBEP_PCI_UNCORE_R2PCIE,
1683 IVBEP_PCI_UNCORE_R3QPI,
1686 static struct intel_uncore_type *ivbep_pci_uncores[] = {
1687 [IVBEP_PCI_UNCORE_HA] = &ivbep_uncore_ha,
1688 [IVBEP_PCI_UNCORE_IMC] = &ivbep_uncore_imc,
1689 [IVBEP_PCI_UNCORE_IRP] = &ivbep_uncore_irp,
1690 [IVBEP_PCI_UNCORE_QPI] = &ivbep_uncore_qpi,
1691 [IVBEP_PCI_UNCORE_R2PCIE] = &ivbep_uncore_r2pcie,
1692 [IVBEP_PCI_UNCORE_R3QPI] = &ivbep_uncore_r3qpi,
1696 static const struct pci_device_id ivbep_uncore_pci_ids[] = {
1697 { /* Home Agent 0 */
1698 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe30),
1699 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_HA, 0),
1701 { /* Home Agent 1 */
1702 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe38),
1703 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_HA, 1),
1705 { /* MC0 Channel 0 */
1706 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb4),
1707 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 0),
1709 { /* MC0 Channel 1 */
1710 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb5),
1711 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 1),
1713 { /* MC0 Channel 3 */
1714 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb0),
1715 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 2),
1717 { /* MC0 Channel 4 */
1718 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb1),
1719 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 3),
1721 { /* MC1 Channel 0 */
1722 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef4),
1723 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 4),
1725 { /* MC1 Channel 1 */
1726 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef5),
1727 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 5),
1729 { /* MC1 Channel 3 */
1730 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef0),
1731 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 6),
1733 { /* MC1 Channel 4 */
1734 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef1),
1735 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IMC, 7),
1738 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe39),
1739 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_IRP, 0),
1742 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe32),
1743 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_QPI, 0),
1746 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe33),
1747 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_QPI, 1),
1750 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe3a),
1751 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_QPI, 2),
1754 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe34),
1755 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_R2PCIE, 0),
1757 { /* R3QPI0 Link 0 */
1758 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe36),
1759 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_R3QPI, 0),
1761 { /* R3QPI0 Link 1 */
1762 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe37),
1763 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_R3QPI, 1),
1765 { /* R3QPI1 Link 2 */
1766 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe3e),
1767 .driver_data = UNCORE_PCI_DEV_DATA(IVBEP_PCI_UNCORE_R3QPI, 2),
1769 { /* QPI Port 0 filter */
1770 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe86),
1771 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
1772 SNBEP_PCI_QPI_PORT0_FILTER),
1774 { /* QPI Port 0 filter */
1775 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe96),
1776 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
1777 SNBEP_PCI_QPI_PORT1_FILTER),
1779 { /* end: all zeroes */ }
1782 static struct pci_driver ivbep_uncore_pci_driver = {
1783 .name = "ivbep_uncore",
1784 .id_table = ivbep_uncore_pci_ids,
1787 int ivbep_uncore_pci_init(void)
1789 int ret = snbep_pci2phy_map_init(0x0e1e);
1792 uncore_pci_uncores = ivbep_pci_uncores;
1793 uncore_pci_driver = &ivbep_uncore_pci_driver;
1796 /* end of IvyTown uncore support */
1798 /* KNL uncore support */
1799 static struct attribute *knl_uncore_ubox_formats_attr[] = {
1800 &format_attr_event.attr,
1801 &format_attr_umask.attr,
1802 &format_attr_edge.attr,
1803 &format_attr_tid_en.attr,
1804 &format_attr_inv.attr,
1805 &format_attr_thresh5.attr,
1809 static struct attribute_group knl_uncore_ubox_format_group = {
1811 .attrs = knl_uncore_ubox_formats_attr,
1814 static struct intel_uncore_type knl_uncore_ubox = {
1818 .perf_ctr_bits = 48,
1819 .fixed_ctr_bits = 48,
1820 .perf_ctr = HSWEP_U_MSR_PMON_CTR0,
1821 .event_ctl = HSWEP_U_MSR_PMON_CTL0,
1822 .event_mask = KNL_U_MSR_PMON_RAW_EVENT_MASK,
1823 .fixed_ctr = HSWEP_U_MSR_PMON_UCLK_FIXED_CTR,
1824 .fixed_ctl = HSWEP_U_MSR_PMON_UCLK_FIXED_CTL,
1825 .ops = &snbep_uncore_msr_ops,
1826 .format_group = &knl_uncore_ubox_format_group,
1829 static struct attribute *knl_uncore_cha_formats_attr[] = {
1830 &format_attr_event.attr,
1831 &format_attr_umask.attr,
1832 &format_attr_qor.attr,
1833 &format_attr_edge.attr,
1834 &format_attr_tid_en.attr,
1835 &format_attr_inv.attr,
1836 &format_attr_thresh8.attr,
1837 &format_attr_filter_tid4.attr,
1838 &format_attr_filter_link3.attr,
1839 &format_attr_filter_state4.attr,
1840 &format_attr_filter_local.attr,
1841 &format_attr_filter_all_op.attr,
1842 &format_attr_filter_nnm.attr,
1843 &format_attr_filter_opc3.attr,
1844 &format_attr_filter_nc.attr,
1845 &format_attr_filter_isoc.attr,
1849 static struct attribute_group knl_uncore_cha_format_group = {
1851 .attrs = knl_uncore_cha_formats_attr,
1854 static struct event_constraint knl_uncore_cha_constraints[] = {
1855 UNCORE_EVENT_CONSTRAINT(0x11, 0x1),
1856 UNCORE_EVENT_CONSTRAINT(0x1f, 0x1),
1857 UNCORE_EVENT_CONSTRAINT(0x36, 0x1),
1858 EVENT_CONSTRAINT_END
1861 static struct extra_reg knl_uncore_cha_extra_regs[] = {
1862 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
1863 SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
1864 SNBEP_CBO_EVENT_EXTRA_REG(0x3d, 0xff, 0x2),
1865 SNBEP_CBO_EVENT_EXTRA_REG(0x35, 0xff, 0x4),
1866 SNBEP_CBO_EVENT_EXTRA_REG(0x36, 0xff, 0x4),
1870 static u64 knl_cha_filter_mask(int fields)
1875 mask |= KNL_CHA_MSR_PMON_BOX_FILTER_TID;
1877 mask |= KNL_CHA_MSR_PMON_BOX_FILTER_STATE;
1879 mask |= KNL_CHA_MSR_PMON_BOX_FILTER_OP;
1883 static struct event_constraint *
1884 knl_cha_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
1886 return __snbep_cbox_get_constraint(box, event, knl_cha_filter_mask);
1889 static int knl_cha_hw_config(struct intel_uncore_box *box,
1890 struct perf_event *event)
1892 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
1893 struct extra_reg *er;
1896 for (er = knl_uncore_cha_extra_regs; er->msr; er++) {
1897 if (er->event != (event->hw.config & er->config_mask))
1903 reg1->reg = HSWEP_C0_MSR_PMON_BOX_FILTER0 +
1904 KNL_CHA_MSR_OFFSET * box->pmu->pmu_idx;
1905 reg1->config = event->attr.config1 & knl_cha_filter_mask(idx);
1911 static void hswep_cbox_enable_event(struct intel_uncore_box *box,
1912 struct perf_event *event);
1914 static struct intel_uncore_ops knl_uncore_cha_ops = {
1915 .init_box = snbep_uncore_msr_init_box,
1916 .disable_box = snbep_uncore_msr_disable_box,
1917 .enable_box = snbep_uncore_msr_enable_box,
1918 .disable_event = snbep_uncore_msr_disable_event,
1919 .enable_event = hswep_cbox_enable_event,
1920 .read_counter = uncore_msr_read_counter,
1921 .hw_config = knl_cha_hw_config,
1922 .get_constraint = knl_cha_get_constraint,
1923 .put_constraint = snbep_cbox_put_constraint,
1926 static struct intel_uncore_type knl_uncore_cha = {
1930 .perf_ctr_bits = 48,
1931 .event_ctl = HSWEP_C0_MSR_PMON_CTL0,
1932 .perf_ctr = HSWEP_C0_MSR_PMON_CTR0,
1933 .event_mask = KNL_CHA_MSR_PMON_RAW_EVENT_MASK,
1934 .box_ctl = HSWEP_C0_MSR_PMON_BOX_CTL,
1935 .msr_offset = KNL_CHA_MSR_OFFSET,
1936 .num_shared_regs = 1,
1937 .constraints = knl_uncore_cha_constraints,
1938 .ops = &knl_uncore_cha_ops,
1939 .format_group = &knl_uncore_cha_format_group,
1942 static struct attribute *knl_uncore_pcu_formats_attr[] = {
1943 &format_attr_event2.attr,
1944 &format_attr_use_occ_ctr.attr,
1945 &format_attr_occ_sel.attr,
1946 &format_attr_edge.attr,
1947 &format_attr_tid_en.attr,
1948 &format_attr_inv.attr,
1949 &format_attr_thresh6.attr,
1950 &format_attr_occ_invert.attr,
1951 &format_attr_occ_edge_det.attr,
1955 static struct attribute_group knl_uncore_pcu_format_group = {
1957 .attrs = knl_uncore_pcu_formats_attr,
1960 static struct intel_uncore_type knl_uncore_pcu = {
1964 .perf_ctr_bits = 48,
1965 .perf_ctr = HSWEP_PCU_MSR_PMON_CTR0,
1966 .event_ctl = HSWEP_PCU_MSR_PMON_CTL0,
1967 .event_mask = KNL_PCU_MSR_PMON_RAW_EVENT_MASK,
1968 .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL,
1969 .ops = &snbep_uncore_msr_ops,
1970 .format_group = &knl_uncore_pcu_format_group,
1973 static struct intel_uncore_type *knl_msr_uncores[] = {
1980 void knl_uncore_cpu_init(void)
1982 uncore_msr_uncores = knl_msr_uncores;
1985 static void knl_uncore_imc_enable_box(struct intel_uncore_box *box)
1987 struct pci_dev *pdev = box->pci_dev;
1988 int box_ctl = uncore_pci_box_ctl(box);
1990 pci_write_config_dword(pdev, box_ctl, 0);
1993 static void knl_uncore_imc_enable_event(struct intel_uncore_box *box,
1994 struct perf_event *event)
1996 struct pci_dev *pdev = box->pci_dev;
1997 struct hw_perf_event *hwc = &event->hw;
1999 if ((event->attr.config & SNBEP_PMON_CTL_EV_SEL_MASK)
2000 == UNCORE_FIXED_EVENT)
2001 pci_write_config_dword(pdev, hwc->config_base,
2002 hwc->config | KNL_PMON_FIXED_CTL_EN);
2004 pci_write_config_dword(pdev, hwc->config_base,
2005 hwc->config | SNBEP_PMON_CTL_EN);
2008 static struct intel_uncore_ops knl_uncore_imc_ops = {
2009 .init_box = snbep_uncore_pci_init_box,
2010 .disable_box = snbep_uncore_pci_disable_box,
2011 .enable_box = knl_uncore_imc_enable_box,
2012 .read_counter = snbep_uncore_pci_read_counter,
2013 .enable_event = knl_uncore_imc_enable_event,
2014 .disable_event = snbep_uncore_pci_disable_event,
2017 static struct intel_uncore_type knl_uncore_imc_uclk = {
2021 .perf_ctr_bits = 48,
2022 .fixed_ctr_bits = 48,
2023 .perf_ctr = KNL_UCLK_MSR_PMON_CTR0_LOW,
2024 .event_ctl = KNL_UCLK_MSR_PMON_CTL0,
2025 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
2026 .fixed_ctr = KNL_UCLK_MSR_PMON_UCLK_FIXED_LOW,
2027 .fixed_ctl = KNL_UCLK_MSR_PMON_UCLK_FIXED_CTL,
2028 .box_ctl = KNL_UCLK_MSR_PMON_BOX_CTL,
2029 .ops = &knl_uncore_imc_ops,
2030 .format_group = &snbep_uncore_format_group,
2033 static struct intel_uncore_type knl_uncore_imc_dclk = {
2037 .perf_ctr_bits = 48,
2038 .fixed_ctr_bits = 48,
2039 .perf_ctr = KNL_MC0_CH0_MSR_PMON_CTR0_LOW,
2040 .event_ctl = KNL_MC0_CH0_MSR_PMON_CTL0,
2041 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
2042 .fixed_ctr = KNL_MC0_CH0_MSR_PMON_FIXED_LOW,
2043 .fixed_ctl = KNL_MC0_CH0_MSR_PMON_FIXED_CTL,
2044 .box_ctl = KNL_MC0_CH0_MSR_PMON_BOX_CTL,
2045 .ops = &knl_uncore_imc_ops,
2046 .format_group = &snbep_uncore_format_group,
2049 static struct intel_uncore_type knl_uncore_edc_uclk = {
2053 .perf_ctr_bits = 48,
2054 .fixed_ctr_bits = 48,
2055 .perf_ctr = KNL_UCLK_MSR_PMON_CTR0_LOW,
2056 .event_ctl = KNL_UCLK_MSR_PMON_CTL0,
2057 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
2058 .fixed_ctr = KNL_UCLK_MSR_PMON_UCLK_FIXED_LOW,
2059 .fixed_ctl = KNL_UCLK_MSR_PMON_UCLK_FIXED_CTL,
2060 .box_ctl = KNL_UCLK_MSR_PMON_BOX_CTL,
2061 .ops = &knl_uncore_imc_ops,
2062 .format_group = &snbep_uncore_format_group,
2065 static struct intel_uncore_type knl_uncore_edc_eclk = {
2069 .perf_ctr_bits = 48,
2070 .fixed_ctr_bits = 48,
2071 .perf_ctr = KNL_EDC0_ECLK_MSR_PMON_CTR0_LOW,
2072 .event_ctl = KNL_EDC0_ECLK_MSR_PMON_CTL0,
2073 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
2074 .fixed_ctr = KNL_EDC0_ECLK_MSR_PMON_ECLK_FIXED_LOW,
2075 .fixed_ctl = KNL_EDC0_ECLK_MSR_PMON_ECLK_FIXED_CTL,
2076 .box_ctl = KNL_EDC0_ECLK_MSR_PMON_BOX_CTL,
2077 .ops = &knl_uncore_imc_ops,
2078 .format_group = &snbep_uncore_format_group,
2081 static struct event_constraint knl_uncore_m2pcie_constraints[] = {
2082 UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
2083 EVENT_CONSTRAINT_END
2086 static struct intel_uncore_type knl_uncore_m2pcie = {
2090 .perf_ctr_bits = 48,
2091 .constraints = knl_uncore_m2pcie_constraints,
2092 SNBEP_UNCORE_PCI_COMMON_INIT(),
2095 static struct attribute *knl_uncore_irp_formats_attr[] = {
2096 &format_attr_event.attr,
2097 &format_attr_umask.attr,
2098 &format_attr_qor.attr,
2099 &format_attr_edge.attr,
2100 &format_attr_inv.attr,
2101 &format_attr_thresh8.attr,
2105 static struct attribute_group knl_uncore_irp_format_group = {
2107 .attrs = knl_uncore_irp_formats_attr,
2110 static struct intel_uncore_type knl_uncore_irp = {
2114 .perf_ctr_bits = 48,
2115 .perf_ctr = SNBEP_PCI_PMON_CTR0,
2116 .event_ctl = SNBEP_PCI_PMON_CTL0,
2117 .event_mask = KNL_IRP_PCI_PMON_RAW_EVENT_MASK,
2118 .box_ctl = KNL_IRP_PCI_PMON_BOX_CTL,
2119 .ops = &snbep_uncore_pci_ops,
2120 .format_group = &knl_uncore_irp_format_group,
2124 KNL_PCI_UNCORE_MC_UCLK,
2125 KNL_PCI_UNCORE_MC_DCLK,
2126 KNL_PCI_UNCORE_EDC_UCLK,
2127 KNL_PCI_UNCORE_EDC_ECLK,
2128 KNL_PCI_UNCORE_M2PCIE,
2132 static struct intel_uncore_type *knl_pci_uncores[] = {
2133 [KNL_PCI_UNCORE_MC_UCLK] = &knl_uncore_imc_uclk,
2134 [KNL_PCI_UNCORE_MC_DCLK] = &knl_uncore_imc_dclk,
2135 [KNL_PCI_UNCORE_EDC_UCLK] = &knl_uncore_edc_uclk,
2136 [KNL_PCI_UNCORE_EDC_ECLK] = &knl_uncore_edc_eclk,
2137 [KNL_PCI_UNCORE_M2PCIE] = &knl_uncore_m2pcie,
2138 [KNL_PCI_UNCORE_IRP] = &knl_uncore_irp,
2143 * KNL uses a common PCI device ID for multiple instances of an Uncore PMU
2144 * device type. prior to KNL, each instance of a PMU device type had a unique
2147 * PCI Device ID Uncore PMU Devices
2148 * ----------------------------------
2149 * 0x7841 MC0 UClk, MC1 UClk
2150 * 0x7843 MC0 DClk CH 0, MC0 DClk CH 1, MC0 DClk CH 2,
2151 * MC1 DClk CH 0, MC1 DClk CH 1, MC1 DClk CH 2
2152 * 0x7833 EDC0 UClk, EDC1 UClk, EDC2 UClk, EDC3 UClk,
2153 * EDC4 UClk, EDC5 UClk, EDC6 UClk, EDC7 UClk
2154 * 0x7835 EDC0 EClk, EDC1 EClk, EDC2 EClk, EDC3 EClk,
2155 * EDC4 EClk, EDC5 EClk, EDC6 EClk, EDC7 EClk
2160 static const struct pci_device_id knl_uncore_pci_ids[] = {
2162 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7841),
2163 .driver_data = UNCORE_PCI_DEV_DATA(KNL_PCI_UNCORE_MC_UCLK, 0),
2165 { /* MC DClk Channel */
2166 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7843),
2167 .driver_data = UNCORE_PCI_DEV_DATA(KNL_PCI_UNCORE_MC_DCLK, 0),
2170 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7833),
2171 .driver_data = UNCORE_PCI_DEV_DATA(KNL_PCI_UNCORE_EDC_UCLK, 0),
2174 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7835),
2175 .driver_data = UNCORE_PCI_DEV_DATA(KNL_PCI_UNCORE_EDC_ECLK, 0),
2178 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7817),
2179 .driver_data = UNCORE_PCI_DEV_DATA(KNL_PCI_UNCORE_M2PCIE, 0),
2182 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7814),
2183 .driver_data = UNCORE_PCI_DEV_DATA(KNL_PCI_UNCORE_IRP, 0),
2185 { /* end: all zeroes */ }
2188 static struct pci_driver knl_uncore_pci_driver = {
2189 .name = "knl_uncore",
2190 .id_table = knl_uncore_pci_ids,
2193 int knl_uncore_pci_init(void)
2197 /* All KNL PCI based PMON units are on the same PCI bus except IRP */
2198 ret = snb_pci2phy_map_init(0x7814); /* IRP */
2201 ret = snb_pci2phy_map_init(0x7817); /* M2PCIe */
2204 uncore_pci_uncores = knl_pci_uncores;
2205 uncore_pci_driver = &knl_uncore_pci_driver;
2209 /* end of KNL uncore support */
2211 /* Haswell-EP uncore support */
2212 static struct attribute *hswep_uncore_ubox_formats_attr[] = {
2213 &format_attr_event.attr,
2214 &format_attr_umask.attr,
2215 &format_attr_edge.attr,
2216 &format_attr_inv.attr,
2217 &format_attr_thresh5.attr,
2218 &format_attr_filter_tid2.attr,
2219 &format_attr_filter_cid.attr,
2223 static struct attribute_group hswep_uncore_ubox_format_group = {
2225 .attrs = hswep_uncore_ubox_formats_attr,
2228 static int hswep_ubox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
2230 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
2231 reg1->reg = HSWEP_U_MSR_PMON_FILTER;
2232 reg1->config = event->attr.config1 & HSWEP_U_MSR_PMON_BOX_FILTER_MASK;
2237 static struct intel_uncore_ops hswep_uncore_ubox_ops = {
2238 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
2239 .hw_config = hswep_ubox_hw_config,
2240 .get_constraint = uncore_get_constraint,
2241 .put_constraint = uncore_put_constraint,
2244 static struct intel_uncore_type hswep_uncore_ubox = {
2248 .perf_ctr_bits = 44,
2249 .fixed_ctr_bits = 48,
2250 .perf_ctr = HSWEP_U_MSR_PMON_CTR0,
2251 .event_ctl = HSWEP_U_MSR_PMON_CTL0,
2252 .event_mask = SNBEP_U_MSR_PMON_RAW_EVENT_MASK,
2253 .fixed_ctr = HSWEP_U_MSR_PMON_UCLK_FIXED_CTR,
2254 .fixed_ctl = HSWEP_U_MSR_PMON_UCLK_FIXED_CTL,
2255 .num_shared_regs = 1,
2256 .ops = &hswep_uncore_ubox_ops,
2257 .format_group = &hswep_uncore_ubox_format_group,
2260 static struct attribute *hswep_uncore_cbox_formats_attr[] = {
2261 &format_attr_event.attr,
2262 &format_attr_umask.attr,
2263 &format_attr_edge.attr,
2264 &format_attr_tid_en.attr,
2265 &format_attr_thresh8.attr,
2266 &format_attr_filter_tid3.attr,
2267 &format_attr_filter_link2.attr,
2268 &format_attr_filter_state3.attr,
2269 &format_attr_filter_nid2.attr,
2270 &format_attr_filter_opc2.attr,
2271 &format_attr_filter_nc.attr,
2272 &format_attr_filter_c6.attr,
2273 &format_attr_filter_isoc.attr,
2277 static struct attribute_group hswep_uncore_cbox_format_group = {
2279 .attrs = hswep_uncore_cbox_formats_attr,
2282 static struct event_constraint hswep_uncore_cbox_constraints[] = {
2283 UNCORE_EVENT_CONSTRAINT(0x01, 0x1),
2284 UNCORE_EVENT_CONSTRAINT(0x09, 0x1),
2285 UNCORE_EVENT_CONSTRAINT(0x11, 0x1),
2286 UNCORE_EVENT_CONSTRAINT(0x36, 0x1),
2287 UNCORE_EVENT_CONSTRAINT(0x38, 0x3),
2288 UNCORE_EVENT_CONSTRAINT(0x3b, 0x1),
2289 UNCORE_EVENT_CONSTRAINT(0x3e, 0x1),
2290 EVENT_CONSTRAINT_END
2293 static struct extra_reg hswep_uncore_cbox_extra_regs[] = {
2294 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
2295 SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
2296 SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
2297 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
2298 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
2299 SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4),
2300 SNBEP_CBO_EVENT_EXTRA_REG(0x2134, 0xffff, 0x4),
2301 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0x4),
2302 SNBEP_CBO_EVENT_EXTRA_REG(0x4037, 0x40ff, 0x8),
2303 SNBEP_CBO_EVENT_EXTRA_REG(0x4028, 0x40ff, 0x8),
2304 SNBEP_CBO_EVENT_EXTRA_REG(0x4032, 0x40ff, 0x8),
2305 SNBEP_CBO_EVENT_EXTRA_REG(0x4029, 0x40ff, 0x8),
2306 SNBEP_CBO_EVENT_EXTRA_REG(0x4033, 0x40ff, 0x8),
2307 SNBEP_CBO_EVENT_EXTRA_REG(0x402A, 0x40ff, 0x8),
2308 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x12),
2309 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x10),
2310 SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0x18),
2311 SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x8),
2312 SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x8),
2313 SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x8),
2314 SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0x18),
2315 SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x8),
2316 SNBEP_CBO_EVENT_EXTRA_REG(0x2335, 0xffff, 0x10),
2317 SNBEP_CBO_EVENT_EXTRA_REG(0x8335, 0xffff, 0x10),
2318 SNBEP_CBO_EVENT_EXTRA_REG(0x2135, 0xffff, 0x10),
2319 SNBEP_CBO_EVENT_EXTRA_REG(0x8135, 0xffff, 0x10),
2320 SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x10),
2321 SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x10),
2322 SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0x18),
2323 SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x8),
2324 SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x8),
2325 SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0x18),
2326 SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x8),
2327 SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10),
2328 SNBEP_CBO_EVENT_EXTRA_REG(0x8336, 0xffff, 0x10),
2329 SNBEP_CBO_EVENT_EXTRA_REG(0x2136, 0xffff, 0x10),
2330 SNBEP_CBO_EVENT_EXTRA_REG(0x8136, 0xffff, 0x10),
2331 SNBEP_CBO_EVENT_EXTRA_REG(0x5036, 0xffff, 0x8),
2335 static u64 hswep_cbox_filter_mask(int fields)
2339 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_TID;
2341 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_LINK;
2343 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_STATE;
2345 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_NID;
2346 if (fields & 0x10) {
2347 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_OPC;
2348 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_NC;
2349 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_C6;
2350 mask |= HSWEP_CB0_MSR_PMON_BOX_FILTER_ISOC;
2355 static struct event_constraint *
2356 hswep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
2358 return __snbep_cbox_get_constraint(box, event, hswep_cbox_filter_mask);
2361 static int hswep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
2363 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
2364 struct extra_reg *er;
2367 for (er = hswep_uncore_cbox_extra_regs; er->msr; er++) {
2368 if (er->event != (event->hw.config & er->config_mask))
2374 reg1->reg = HSWEP_C0_MSR_PMON_BOX_FILTER0 +
2375 HSWEP_CBO_MSR_OFFSET * box->pmu->pmu_idx;
2376 reg1->config = event->attr.config1 & hswep_cbox_filter_mask(idx);
2382 static void hswep_cbox_enable_event(struct intel_uncore_box *box,
2383 struct perf_event *event)
2385 struct hw_perf_event *hwc = &event->hw;
2386 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
2388 if (reg1->idx != EXTRA_REG_NONE) {
2389 u64 filter = uncore_shared_reg_config(box, 0);
2390 wrmsrl(reg1->reg, filter & 0xffffffff);
2391 wrmsrl(reg1->reg + 1, filter >> 32);
2394 wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
2397 static struct intel_uncore_ops hswep_uncore_cbox_ops = {
2398 .init_box = snbep_uncore_msr_init_box,
2399 .disable_box = snbep_uncore_msr_disable_box,
2400 .enable_box = snbep_uncore_msr_enable_box,
2401 .disable_event = snbep_uncore_msr_disable_event,
2402 .enable_event = hswep_cbox_enable_event,
2403 .read_counter = uncore_msr_read_counter,
2404 .hw_config = hswep_cbox_hw_config,
2405 .get_constraint = hswep_cbox_get_constraint,
2406 .put_constraint = snbep_cbox_put_constraint,
2409 static struct intel_uncore_type hswep_uncore_cbox = {
2413 .perf_ctr_bits = 48,
2414 .event_ctl = HSWEP_C0_MSR_PMON_CTL0,
2415 .perf_ctr = HSWEP_C0_MSR_PMON_CTR0,
2416 .event_mask = SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK,
2417 .box_ctl = HSWEP_C0_MSR_PMON_BOX_CTL,
2418 .msr_offset = HSWEP_CBO_MSR_OFFSET,
2419 .num_shared_regs = 1,
2420 .constraints = hswep_uncore_cbox_constraints,
2421 .ops = &hswep_uncore_cbox_ops,
2422 .format_group = &hswep_uncore_cbox_format_group,
2426 * Write SBOX Initialization register bit by bit to avoid spurious #GPs
2428 static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box)
2430 unsigned msr = uncore_msr_box_ctl(box);
2433 u64 init = SNBEP_PMON_BOX_CTL_INT;
2437 for_each_set_bit(i, (unsigned long *)&init, 64) {
2438 flags |= (1ULL << i);
2444 static struct intel_uncore_ops hswep_uncore_sbox_msr_ops = {
2445 __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
2446 .init_box = hswep_uncore_sbox_msr_init_box
2449 static struct attribute *hswep_uncore_sbox_formats_attr[] = {
2450 &format_attr_event.attr,
2451 &format_attr_umask.attr,
2452 &format_attr_edge.attr,
2453 &format_attr_tid_en.attr,
2454 &format_attr_inv.attr,
2455 &format_attr_thresh8.attr,
2459 static struct attribute_group hswep_uncore_sbox_format_group = {
2461 .attrs = hswep_uncore_sbox_formats_attr,
2464 static struct intel_uncore_type hswep_uncore_sbox = {
2468 .perf_ctr_bits = 44,
2469 .event_ctl = HSWEP_S0_MSR_PMON_CTL0,
2470 .perf_ctr = HSWEP_S0_MSR_PMON_CTR0,
2471 .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK,
2472 .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL,
2473 .msr_offset = HSWEP_SBOX_MSR_OFFSET,
2474 .ops = &hswep_uncore_sbox_msr_ops,
2475 .format_group = &hswep_uncore_sbox_format_group,
2478 static int hswep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *event)
2480 struct hw_perf_event *hwc = &event->hw;
2481 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
2482 int ev_sel = hwc->config & SNBEP_PMON_CTL_EV_SEL_MASK;
2484 if (ev_sel >= 0xb && ev_sel <= 0xe) {
2485 reg1->reg = HSWEP_PCU_MSR_PMON_BOX_FILTER;
2486 reg1->idx = ev_sel - 0xb;
2487 reg1->config = event->attr.config1 & (0xff << reg1->idx);
2492 static struct intel_uncore_ops hswep_uncore_pcu_ops = {
2493 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
2494 .hw_config = hswep_pcu_hw_config,
2495 .get_constraint = snbep_pcu_get_constraint,
2496 .put_constraint = snbep_pcu_put_constraint,
2499 static struct intel_uncore_type hswep_uncore_pcu = {
2503 .perf_ctr_bits = 48,
2504 .perf_ctr = HSWEP_PCU_MSR_PMON_CTR0,
2505 .event_ctl = HSWEP_PCU_MSR_PMON_CTL0,
2506 .event_mask = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
2507 .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL,
2508 .num_shared_regs = 1,
2509 .ops = &hswep_uncore_pcu_ops,
2510 .format_group = &snbep_uncore_pcu_format_group,
2513 static struct intel_uncore_type *hswep_msr_uncores[] = {
2521 void hswep_uncore_cpu_init(void)
2523 if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
2524 hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
2526 /* Detect 6-8 core systems with only two SBOXes */
2527 if (uncore_extra_pci_dev[0][HSWEP_PCI_PCU_3]) {
2530 pci_read_config_dword(uncore_extra_pci_dev[0][HSWEP_PCI_PCU_3],
2532 if (((capid4 >> 6) & 0x3) == 0)
2533 hswep_uncore_sbox.num_boxes = 2;
2536 uncore_msr_uncores = hswep_msr_uncores;
2539 static struct intel_uncore_type hswep_uncore_ha = {
2543 .perf_ctr_bits = 48,
2544 SNBEP_UNCORE_PCI_COMMON_INIT(),
2547 static struct uncore_event_desc hswep_uncore_imc_events[] = {
2548 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x00,umask=0x00"),
2549 INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x04,umask=0x03"),
2550 INTEL_UNCORE_EVENT_DESC(cas_count_read.scale, "6.103515625e-5"),
2551 INTEL_UNCORE_EVENT_DESC(cas_count_read.unit, "MiB"),
2552 INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x04,umask=0x0c"),
2553 INTEL_UNCORE_EVENT_DESC(cas_count_write.scale, "6.103515625e-5"),
2554 INTEL_UNCORE_EVENT_DESC(cas_count_write.unit, "MiB"),
2555 { /* end: all zeroes */ },
2558 static struct intel_uncore_type hswep_uncore_imc = {
2562 .perf_ctr_bits = 48,
2563 .fixed_ctr_bits = 48,
2564 .fixed_ctr = SNBEP_MC_CHy_PCI_PMON_FIXED_CTR,
2565 .fixed_ctl = SNBEP_MC_CHy_PCI_PMON_FIXED_CTL,
2566 .event_descs = hswep_uncore_imc_events,
2567 SNBEP_UNCORE_PCI_COMMON_INIT(),
2570 static unsigned hswep_uncore_irp_ctrs[] = {0xa0, 0xa8, 0xb0, 0xb8};
2572 static u64 hswep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event)
2574 struct pci_dev *pdev = box->pci_dev;
2575 struct hw_perf_event *hwc = &event->hw;
2578 pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx], (u32 *)&count);
2579 pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1);
2584 static struct intel_uncore_ops hswep_uncore_irp_ops = {
2585 .init_box = snbep_uncore_pci_init_box,
2586 .disable_box = snbep_uncore_pci_disable_box,
2587 .enable_box = snbep_uncore_pci_enable_box,
2588 .disable_event = ivbep_uncore_irp_disable_event,
2589 .enable_event = ivbep_uncore_irp_enable_event,
2590 .read_counter = hswep_uncore_irp_read_counter,
2593 static struct intel_uncore_type hswep_uncore_irp = {
2597 .perf_ctr_bits = 48,
2598 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
2599 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
2600 .ops = &hswep_uncore_irp_ops,
2601 .format_group = &snbep_uncore_format_group,
2604 static struct intel_uncore_type hswep_uncore_qpi = {
2608 .perf_ctr_bits = 48,
2609 .perf_ctr = SNBEP_PCI_PMON_CTR0,
2610 .event_ctl = SNBEP_PCI_PMON_CTL0,
2611 .event_mask = SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK,
2612 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
2613 .num_shared_regs = 1,
2614 .ops = &snbep_uncore_qpi_ops,
2615 .format_group = &snbep_uncore_qpi_format_group,
2618 static struct event_constraint hswep_uncore_r2pcie_constraints[] = {
2619 UNCORE_EVENT_CONSTRAINT(0x10, 0x3),
2620 UNCORE_EVENT_CONSTRAINT(0x11, 0x3),
2621 UNCORE_EVENT_CONSTRAINT(0x13, 0x1),
2622 UNCORE_EVENT_CONSTRAINT(0x23, 0x1),
2623 UNCORE_EVENT_CONSTRAINT(0x24, 0x1),
2624 UNCORE_EVENT_CONSTRAINT(0x25, 0x1),
2625 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
2626 UNCORE_EVENT_CONSTRAINT(0x27, 0x1),
2627 UNCORE_EVENT_CONSTRAINT(0x28, 0x3),
2628 UNCORE_EVENT_CONSTRAINT(0x29, 0x3),
2629 UNCORE_EVENT_CONSTRAINT(0x2a, 0x1),
2630 UNCORE_EVENT_CONSTRAINT(0x2b, 0x3),
2631 UNCORE_EVENT_CONSTRAINT(0x2c, 0x3),
2632 UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
2633 UNCORE_EVENT_CONSTRAINT(0x32, 0x3),
2634 UNCORE_EVENT_CONSTRAINT(0x33, 0x3),
2635 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
2636 UNCORE_EVENT_CONSTRAINT(0x35, 0x3),
2637 EVENT_CONSTRAINT_END
2640 static struct intel_uncore_type hswep_uncore_r2pcie = {
2644 .perf_ctr_bits = 48,
2645 .constraints = hswep_uncore_r2pcie_constraints,
2646 SNBEP_UNCORE_PCI_COMMON_INIT(),
2649 static struct event_constraint hswep_uncore_r3qpi_constraints[] = {
2650 UNCORE_EVENT_CONSTRAINT(0x01, 0x3),
2651 UNCORE_EVENT_CONSTRAINT(0x07, 0x7),
2652 UNCORE_EVENT_CONSTRAINT(0x08, 0x7),
2653 UNCORE_EVENT_CONSTRAINT(0x09, 0x7),
2654 UNCORE_EVENT_CONSTRAINT(0x0a, 0x7),
2655 UNCORE_EVENT_CONSTRAINT(0x0e, 0x7),
2656 UNCORE_EVENT_CONSTRAINT(0x10, 0x3),
2657 UNCORE_EVENT_CONSTRAINT(0x11, 0x3),
2658 UNCORE_EVENT_CONSTRAINT(0x12, 0x3),
2659 UNCORE_EVENT_CONSTRAINT(0x13, 0x1),
2660 UNCORE_EVENT_CONSTRAINT(0x14, 0x3),
2661 UNCORE_EVENT_CONSTRAINT(0x15, 0x3),
2662 UNCORE_EVENT_CONSTRAINT(0x1f, 0x3),
2663 UNCORE_EVENT_CONSTRAINT(0x20, 0x3),
2664 UNCORE_EVENT_CONSTRAINT(0x21, 0x3),
2665 UNCORE_EVENT_CONSTRAINT(0x22, 0x3),
2666 UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
2667 UNCORE_EVENT_CONSTRAINT(0x25, 0x3),
2668 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
2669 UNCORE_EVENT_CONSTRAINT(0x28, 0x3),
2670 UNCORE_EVENT_CONSTRAINT(0x29, 0x3),
2671 UNCORE_EVENT_CONSTRAINT(0x2c, 0x3),
2672 UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
2673 UNCORE_EVENT_CONSTRAINT(0x2e, 0x3),
2674 UNCORE_EVENT_CONSTRAINT(0x2f, 0x3),
2675 UNCORE_EVENT_CONSTRAINT(0x31, 0x3),
2676 UNCORE_EVENT_CONSTRAINT(0x32, 0x3),
2677 UNCORE_EVENT_CONSTRAINT(0x33, 0x3),
2678 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
2679 UNCORE_EVENT_CONSTRAINT(0x36, 0x3),
2680 UNCORE_EVENT_CONSTRAINT(0x37, 0x3),
2681 UNCORE_EVENT_CONSTRAINT(0x38, 0x3),
2682 UNCORE_EVENT_CONSTRAINT(0x39, 0x3),
2683 EVENT_CONSTRAINT_END
2686 static struct intel_uncore_type hswep_uncore_r3qpi = {
2690 .perf_ctr_bits = 44,
2691 .constraints = hswep_uncore_r3qpi_constraints,
2692 SNBEP_UNCORE_PCI_COMMON_INIT(),
2696 HSWEP_PCI_UNCORE_HA,
2697 HSWEP_PCI_UNCORE_IMC,
2698 HSWEP_PCI_UNCORE_IRP,
2699 HSWEP_PCI_UNCORE_QPI,
2700 HSWEP_PCI_UNCORE_R2PCIE,
2701 HSWEP_PCI_UNCORE_R3QPI,
2704 static struct intel_uncore_type *hswep_pci_uncores[] = {
2705 [HSWEP_PCI_UNCORE_HA] = &hswep_uncore_ha,
2706 [HSWEP_PCI_UNCORE_IMC] = &hswep_uncore_imc,
2707 [HSWEP_PCI_UNCORE_IRP] = &hswep_uncore_irp,
2708 [HSWEP_PCI_UNCORE_QPI] = &hswep_uncore_qpi,
2709 [HSWEP_PCI_UNCORE_R2PCIE] = &hswep_uncore_r2pcie,
2710 [HSWEP_PCI_UNCORE_R3QPI] = &hswep_uncore_r3qpi,
2714 static const struct pci_device_id hswep_uncore_pci_ids[] = {
2715 { /* Home Agent 0 */
2716 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f30),
2717 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_HA, 0),
2719 { /* Home Agent 1 */
2720 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f38),
2721 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_HA, 1),
2723 { /* MC0 Channel 0 */
2724 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fb0),
2725 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 0),
2727 { /* MC0 Channel 1 */
2728 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fb1),
2729 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 1),
2731 { /* MC0 Channel 2 */
2732 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fb4),
2733 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 2),
2735 { /* MC0 Channel 3 */
2736 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fb5),
2737 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 3),
2739 { /* MC1 Channel 0 */
2740 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fd0),
2741 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 4),
2743 { /* MC1 Channel 1 */
2744 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fd1),
2745 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 5),
2747 { /* MC1 Channel 2 */
2748 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fd4),
2749 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 6),
2751 { /* MC1 Channel 3 */
2752 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fd5),
2753 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IMC, 7),
2756 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f39),
2757 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_IRP, 0),
2760 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f32),
2761 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_QPI, 0),
2764 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f33),
2765 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_QPI, 1),
2768 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f3a),
2769 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_QPI, 2),
2772 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f34),
2773 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_R2PCIE, 0),
2775 { /* R3QPI0 Link 0 */
2776 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f36),
2777 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_R3QPI, 0),
2779 { /* R3QPI0 Link 1 */
2780 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f37),
2781 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_R3QPI, 1),
2783 { /* R3QPI1 Link 2 */
2784 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f3e),
2785 .driver_data = UNCORE_PCI_DEV_DATA(HSWEP_PCI_UNCORE_R3QPI, 2),
2787 { /* QPI Port 0 filter */
2788 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f86),
2789 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
2790 SNBEP_PCI_QPI_PORT0_FILTER),
2792 { /* QPI Port 1 filter */
2793 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f96),
2794 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
2795 SNBEP_PCI_QPI_PORT1_FILTER),
2797 { /* PCU.3 (for Capability registers) */
2798 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fc0),
2799 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
2802 { /* end: all zeroes */ }
2805 static struct pci_driver hswep_uncore_pci_driver = {
2806 .name = "hswep_uncore",
2807 .id_table = hswep_uncore_pci_ids,
2810 int hswep_uncore_pci_init(void)
2812 int ret = snbep_pci2phy_map_init(0x2f1e);
2815 uncore_pci_uncores = hswep_pci_uncores;
2816 uncore_pci_driver = &hswep_uncore_pci_driver;
2819 /* end of Haswell-EP uncore support */
2821 /* BDX uncore support */
2823 static struct intel_uncore_type bdx_uncore_ubox = {
2827 .perf_ctr_bits = 48,
2828 .fixed_ctr_bits = 48,
2829 .perf_ctr = HSWEP_U_MSR_PMON_CTR0,
2830 .event_ctl = HSWEP_U_MSR_PMON_CTL0,
2831 .event_mask = SNBEP_U_MSR_PMON_RAW_EVENT_MASK,
2832 .fixed_ctr = HSWEP_U_MSR_PMON_UCLK_FIXED_CTR,
2833 .fixed_ctl = HSWEP_U_MSR_PMON_UCLK_FIXED_CTL,
2834 .num_shared_regs = 1,
2835 .ops = &ivbep_uncore_msr_ops,
2836 .format_group = &ivbep_uncore_ubox_format_group,
2839 static struct event_constraint bdx_uncore_cbox_constraints[] = {
2840 UNCORE_EVENT_CONSTRAINT(0x09, 0x3),
2841 UNCORE_EVENT_CONSTRAINT(0x11, 0x1),
2842 UNCORE_EVENT_CONSTRAINT(0x36, 0x1),
2843 UNCORE_EVENT_CONSTRAINT(0x3e, 0x1),
2844 EVENT_CONSTRAINT_END
2847 static struct intel_uncore_type bdx_uncore_cbox = {
2851 .perf_ctr_bits = 48,
2852 .event_ctl = HSWEP_C0_MSR_PMON_CTL0,
2853 .perf_ctr = HSWEP_C0_MSR_PMON_CTR0,
2854 .event_mask = SNBEP_CBO_MSR_PMON_RAW_EVENT_MASK,
2855 .box_ctl = HSWEP_C0_MSR_PMON_BOX_CTL,
2856 .msr_offset = HSWEP_CBO_MSR_OFFSET,
2857 .num_shared_regs = 1,
2858 .constraints = bdx_uncore_cbox_constraints,
2859 .ops = &hswep_uncore_cbox_ops,
2860 .format_group = &hswep_uncore_cbox_format_group,
2863 static struct intel_uncore_type bdx_uncore_sbox = {
2867 .perf_ctr_bits = 48,
2868 .event_ctl = HSWEP_S0_MSR_PMON_CTL0,
2869 .perf_ctr = HSWEP_S0_MSR_PMON_CTR0,
2870 .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK,
2871 .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL,
2872 .msr_offset = HSWEP_SBOX_MSR_OFFSET,
2873 .ops = &hswep_uncore_sbox_msr_ops,
2874 .format_group = &hswep_uncore_sbox_format_group,
2877 static struct intel_uncore_type *bdx_msr_uncores[] = {
2885 void bdx_uncore_cpu_init(void)
2887 if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
2888 bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
2889 uncore_msr_uncores = bdx_msr_uncores;
2892 static struct intel_uncore_type bdx_uncore_ha = {
2896 .perf_ctr_bits = 48,
2897 SNBEP_UNCORE_PCI_COMMON_INIT(),
2900 static struct intel_uncore_type bdx_uncore_imc = {
2904 .perf_ctr_bits = 48,
2905 .fixed_ctr_bits = 48,
2906 .fixed_ctr = SNBEP_MC_CHy_PCI_PMON_FIXED_CTR,
2907 .fixed_ctl = SNBEP_MC_CHy_PCI_PMON_FIXED_CTL,
2908 .event_descs = hswep_uncore_imc_events,
2909 SNBEP_UNCORE_PCI_COMMON_INIT(),
2912 static struct intel_uncore_type bdx_uncore_irp = {
2916 .perf_ctr_bits = 48,
2917 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
2918 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
2919 .ops = &hswep_uncore_irp_ops,
2920 .format_group = &snbep_uncore_format_group,
2923 static struct intel_uncore_type bdx_uncore_qpi = {
2927 .perf_ctr_bits = 48,
2928 .perf_ctr = SNBEP_PCI_PMON_CTR0,
2929 .event_ctl = SNBEP_PCI_PMON_CTL0,
2930 .event_mask = SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK,
2931 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
2932 .num_shared_regs = 1,
2933 .ops = &snbep_uncore_qpi_ops,
2934 .format_group = &snbep_uncore_qpi_format_group,
2937 static struct event_constraint bdx_uncore_r2pcie_constraints[] = {
2938 UNCORE_EVENT_CONSTRAINT(0x10, 0x3),
2939 UNCORE_EVENT_CONSTRAINT(0x11, 0x3),
2940 UNCORE_EVENT_CONSTRAINT(0x13, 0x1),
2941 UNCORE_EVENT_CONSTRAINT(0x23, 0x1),
2942 UNCORE_EVENT_CONSTRAINT(0x25, 0x1),
2943 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
2944 UNCORE_EVENT_CONSTRAINT(0x28, 0x3),
2945 UNCORE_EVENT_CONSTRAINT(0x2c, 0x3),
2946 UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
2947 EVENT_CONSTRAINT_END
2950 static struct intel_uncore_type bdx_uncore_r2pcie = {
2954 .perf_ctr_bits = 48,
2955 .constraints = bdx_uncore_r2pcie_constraints,
2956 SNBEP_UNCORE_PCI_COMMON_INIT(),
2959 static struct event_constraint bdx_uncore_r3qpi_constraints[] = {
2960 UNCORE_EVENT_CONSTRAINT(0x01, 0x7),
2961 UNCORE_EVENT_CONSTRAINT(0x07, 0x7),
2962 UNCORE_EVENT_CONSTRAINT(0x08, 0x7),
2963 UNCORE_EVENT_CONSTRAINT(0x09, 0x7),
2964 UNCORE_EVENT_CONSTRAINT(0x0a, 0x7),
2965 UNCORE_EVENT_CONSTRAINT(0x0e, 0x7),
2966 UNCORE_EVENT_CONSTRAINT(0x10, 0x3),
2967 UNCORE_EVENT_CONSTRAINT(0x11, 0x3),
2968 UNCORE_EVENT_CONSTRAINT(0x13, 0x1),
2969 UNCORE_EVENT_CONSTRAINT(0x14, 0x3),
2970 UNCORE_EVENT_CONSTRAINT(0x15, 0x3),
2971 UNCORE_EVENT_CONSTRAINT(0x1f, 0x3),
2972 UNCORE_EVENT_CONSTRAINT(0x20, 0x3),
2973 UNCORE_EVENT_CONSTRAINT(0x21, 0x3),
2974 UNCORE_EVENT_CONSTRAINT(0x22, 0x3),
2975 UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
2976 UNCORE_EVENT_CONSTRAINT(0x25, 0x3),
2977 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
2978 UNCORE_EVENT_CONSTRAINT(0x28, 0x3),
2979 UNCORE_EVENT_CONSTRAINT(0x29, 0x3),
2980 UNCORE_EVENT_CONSTRAINT(0x2c, 0x3),
2981 UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
2982 UNCORE_EVENT_CONSTRAINT(0x2e, 0x3),
2983 UNCORE_EVENT_CONSTRAINT(0x2f, 0x3),
2984 UNCORE_EVENT_CONSTRAINT(0x33, 0x3),
2985 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
2986 UNCORE_EVENT_CONSTRAINT(0x36, 0x3),
2987 UNCORE_EVENT_CONSTRAINT(0x37, 0x3),
2988 UNCORE_EVENT_CONSTRAINT(0x38, 0x3),
2989 UNCORE_EVENT_CONSTRAINT(0x39, 0x3),
2990 EVENT_CONSTRAINT_END
2993 static struct intel_uncore_type bdx_uncore_r3qpi = {
2997 .perf_ctr_bits = 48,
2998 .constraints = bdx_uncore_r3qpi_constraints,
2999 SNBEP_UNCORE_PCI_COMMON_INIT(),
3007 BDX_PCI_UNCORE_R2PCIE,
3008 BDX_PCI_UNCORE_R3QPI,
3011 static struct intel_uncore_type *bdx_pci_uncores[] = {
3012 [BDX_PCI_UNCORE_HA] = &bdx_uncore_ha,
3013 [BDX_PCI_UNCORE_IMC] = &bdx_uncore_imc,
3014 [BDX_PCI_UNCORE_IRP] = &bdx_uncore_irp,
3015 [BDX_PCI_UNCORE_QPI] = &bdx_uncore_qpi,
3016 [BDX_PCI_UNCORE_R2PCIE] = &bdx_uncore_r2pcie,
3017 [BDX_PCI_UNCORE_R3QPI] = &bdx_uncore_r3qpi,
3021 static const struct pci_device_id bdx_uncore_pci_ids[] = {
3022 { /* Home Agent 0 */
3023 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f30),
3024 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_HA, 0),
3026 { /* Home Agent 1 */
3027 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f38),
3028 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_HA, 1),
3030 { /* MC0 Channel 0 */
3031 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fb0),
3032 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 0),
3034 { /* MC0 Channel 1 */
3035 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fb1),
3036 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 1),
3038 { /* MC0 Channel 2 */
3039 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fb4),
3040 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 2),
3042 { /* MC0 Channel 3 */
3043 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fb5),
3044 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 3),
3046 { /* MC1 Channel 0 */
3047 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fd0),
3048 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 4),
3050 { /* MC1 Channel 1 */
3051 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fd1),
3052 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 5),
3054 { /* MC1 Channel 2 */
3055 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fd4),
3056 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 6),
3058 { /* MC1 Channel 3 */
3059 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fd5),
3060 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IMC, 7),
3063 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f39),
3064 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_IRP, 0),
3067 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f32),
3068 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_QPI, 0),
3071 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f33),
3072 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_QPI, 1),
3075 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f3a),
3076 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_QPI, 2),
3079 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f34),
3080 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_R2PCIE, 0),
3082 { /* R3QPI0 Link 0 */
3083 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f36),
3084 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_R3QPI, 0),
3086 { /* R3QPI0 Link 1 */
3087 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f37),
3088 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_R3QPI, 1),
3090 { /* R3QPI1 Link 2 */
3091 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f3e),
3092 .driver_data = UNCORE_PCI_DEV_DATA(BDX_PCI_UNCORE_R3QPI, 2),
3094 { /* QPI Port 0 filter */
3095 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f86),
3096 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 0),
3098 { /* QPI Port 1 filter */
3099 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f96),
3100 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 1),
3102 { /* QPI Port 2 filter */
3103 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46),
3104 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2),
3106 { /* end: all zeroes */ }
3109 static struct pci_driver bdx_uncore_pci_driver = {
3110 .name = "bdx_uncore",
3111 .id_table = bdx_uncore_pci_ids,
3114 int bdx_uncore_pci_init(void)
3116 int ret = snbep_pci2phy_map_init(0x6f1e);
3120 uncore_pci_uncores = bdx_pci_uncores;
3121 uncore_pci_driver = &bdx_uncore_pci_driver;
3125 /* end of BDX uncore support */