2 * Copyright (c) 2013-2018, Intel Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * * Neither the name of Intel Corporation nor the names of its contributors
13 * may be used to endorse or promote products derived from this software
14 * without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
33 /* A one byte opcode. */
37 pt_opc_psb = pt_opc_ext,
40 pt_opc_tip_pge = 0x11,
41 pt_opc_tip_pgd = 0x01,
48 /* A free opcode to trigger a decode fault. */
52 /* A one byte extension code for ext opcodes. */
65 pt_ext_exstop_ip = 0xe2,
74 /* A one byte extension 2 code for ext2 extension opcodes. */
81 /* A one byte opcode mask. */
86 pt_opm_fup = pt_opm_tip,
88 /* The bit mask for the compression bits in the opcode. */
91 /* The shift right value for ipc bits. */
94 /* The bit mask for the compression bits after shifting. */
95 pt_opm_ipc_shr_mask = 0x7,
97 /* Shift counts and masks for decoding the cyc packet. */
99 pt_opm_cyc_ext = 0x04,
100 pt_opm_cyc_bits = 0xf8,
102 pt_opm_cycx_ext = 0x01,
105 /* The bit mask for the IP bit in the exstop packet. */
106 pt_opm_exstop_ip = 0x80,
108 /* The PTW opcode. */
111 /* The bit mask for the IP bit in the ptw packet. */
112 pt_opm_ptw_ip = 0x80,
114 /* The bit mask and shr value for the payload bytes field in ptw. */
115 pt_opm_ptw_pb = 0x60,
116 pt_opm_ptw_pb_shr = 5,
118 /* The bit mask for the payload bytes field in ptw after shifting. */
119 pt_opm_ptw_pb_shr_mask = 0x3
122 /* The size of the various opcodes in bytes. */
123 enum pt_opcode_size {
151 /* The psb magic payload.
153 * The payload is a repeating 2-byte pattern.
155 enum pt_psb_pattern {
156 /* The high and low bytes in the pattern. */
157 pt_psb_hi = pt_opc_psb,
158 pt_psb_lo = pt_ext_psb,
160 /* Various combinations of the above parts. */
161 pt_psb_lohi = pt_psb_lo | pt_psb_hi << 8,
162 pt_psb_hilo = pt_psb_hi | pt_psb_lo << 8,
164 /* The repeat count of the payload, not including opc and ext. */
165 pt_psb_repeat_count = 7,
167 /* The size of the repeated pattern in bytes. */
168 pt_psb_repeat_size = 2
171 /* The payload details. */
173 /* The shift counts for post-processing the PIP payload. */
177 /* The size of a PIP payload in bytes. */
180 /* The non-root bit in the first byte of the PIP payload. */
183 /* The size of a 8bit TNT packet's payload in bits. */
184 pt_pl_tnt_8_bits = 8 - pt_opm_tnt_8_shr,
186 /* The size of a 64bit TNT packet's payload in bytes. */
187 pt_pl_tnt_64_size = 6,
189 /* The size of a 64bit TNT packet's payload in bits. */
190 pt_pl_tnt_64_bits = 48,
192 /* The size of a TSC packet's payload in bytes and in bits. */
194 pt_pl_tsc_bit_size = pt_pl_tsc_size * 8,
196 /* The size of a CBR packet's payload in bytes. */
199 /* The size of a PSB packet's payload in bytes. */
200 pt_pl_psb_size = pt_psb_repeat_count * pt_psb_repeat_size,
202 /* The size of a MODE packet's payload in bytes. */
205 /* The size of an IP packet's payload with update-16 compression. */
206 pt_pl_ip_upd16_size = 2,
208 /* The size of an IP packet's payload with update-32 compression. */
209 pt_pl_ip_upd32_size = 4,
211 /* The size of an IP packet's payload with update-48 compression. */
212 pt_pl_ip_upd48_size = 6,
214 /* The size of an IP packet's payload with sext-48 compression. */
215 pt_pl_ip_sext48_size = 6,
217 /* The size of an IP packet's payload with full-ip compression. */
218 pt_pl_ip_full_size = 8,
220 /* Byte locations, sizes, and masks for processing TMA packets. */
222 pt_pl_tma_ctc_size = 2,
223 pt_pl_tma_ctc_bit_size = pt_pl_tma_ctc_size * 8,
226 pt_pl_tma_ctc_mask = (1 << pt_pl_tma_ctc_bit_size) - 1,
227 pt_pl_tma_fc_size = 2,
228 pt_pl_tma_fc_bit_size = 9,
231 pt_pl_tma_fc_mask = (1 << pt_pl_tma_fc_bit_size) - 1,
233 /* The size of a MTC packet's payload in bytes and in bits. */
235 pt_pl_mtc_bit_size = pt_pl_mtc_size * 8,
237 /* A mask for the MTC payload bits. */
238 pt_pl_mtc_mask = (1 << pt_pl_mtc_bit_size) - 1,
240 /* The maximal payload size in bytes of a CYC packet. */
241 pt_pl_cyc_max_size = 15,
243 /* The size of a VMCS packet's payload in bytes. */
246 /* The shift counts for post-processing the VMCS payload. */
249 /* The size of a MNT packet's payload in bytes. */
252 /* The bit-mask for the IP bit in the EXSTOP opcode extension. */
253 pt_pl_exstop_ip_mask = 0x80,
255 /* The size of the hints field in the MWAIT payload in bytes. */
256 pt_pl_mwait_hints_size = 4,
258 /* The size of the extensions field in the MWAIT payload in bytes. */
259 pt_pl_mwait_ext_size = 4,
261 /* The size of the MWAIT payload in bytes. */
262 pt_pl_mwait_size = pt_pl_mwait_hints_size + pt_pl_mwait_ext_size,
264 /* The size of the PWRE payload in bytes. */
267 /* The bit-mask for the h/w bit in the PWRE payload. */
268 pt_pl_pwre_hw_mask = 0x8,
270 /* The bit-mask for the resolved thread sub C-state in the PWRE
273 pt_pl_pwre_sub_state_mask = 0xf00,
275 /* The shift right value for the resolved thread sub C-state in the
278 pt_pl_pwre_sub_state_shr = 8,
280 /* The bit-mask for the resolved thread C-state in the PWRE payload. */
281 pt_pl_pwre_state_mask = 0xf000,
283 /* The shift right value for the resolved thread C-state in the
286 pt_pl_pwre_state_shr = 12,
288 /* The size of the PWRX payload in bytes. */
291 /* The bit-mask for the deepest core C-state in the PWRX payload. */
292 pt_pl_pwrx_deepest_mask = 0xf,
294 /* The shift right value for the deepest core C-state in the PWRX
297 pt_pl_pwrx_deepest_shr = 0,
299 /* The bit-mask for the last core C-state in the PWRX payload. */
300 pt_pl_pwrx_last_mask = 0xf0,
302 /* The shift right value for the last core C-state in the PWRX
305 pt_pl_pwrx_last_shr = 4,
307 /* The bit-mask for the wake reason in the PWRX payload. */
308 pt_pl_pwrx_wr_mask = 0xf00,
310 /* The shift right value for the wake reason in the PWRX payload. */
311 pt_pl_pwrx_wr_shr = 8,
313 /* The bit-mask for the interrupt wake reason in the PWRX payload. */
314 pt_pl_pwrx_wr_int = 0x100,
316 /* The bit-mask for the store wake reason in the PWRX payload. */
317 pt_pl_pwrx_wr_store = 0x400,
319 /* The bit-mask for the autonomous wake reason in the PWRX payload. */
320 pt_pl_pwrx_wr_hw = 0x800
323 /* Mode packet masks. */
330 /* Mode packet bits. */
333 pt_mob_exec_csl = 0x01,
334 pt_mob_exec_csd = 0x02,
337 pt_mob_tsx_intx = 0x01,
338 pt_mob_tsx_abrt = 0x02
341 /* The size of the various packets in bytes. */
342 enum pt_packet_size {
343 ptps_pad = pt_opcs_pad,
344 ptps_tnt_8 = pt_opcs_tnt_8,
345 ptps_mode = pt_opcs_mode + pt_pl_mode_size,
346 ptps_tsc = pt_opcs_tsc + pt_pl_tsc_size,
347 ptps_mtc = pt_opcs_mtc + pt_pl_mtc_size,
348 ptps_psb = pt_opcs_psb + pt_pl_psb_size,
349 ptps_psbend = pt_opcs_psbend,
350 ptps_ovf = pt_opcs_ovf,
351 ptps_pip = pt_opcs_pip + pt_pl_pip_size,
352 ptps_tnt_64 = pt_opcs_tnt_64 + pt_pl_tnt_64_size,
353 ptps_cbr = pt_opcs_cbr + pt_pl_cbr_size,
354 ptps_tip_supp = pt_opcs_tip,
355 ptps_tip_upd16 = pt_opcs_tip + pt_pl_ip_upd16_size,
356 ptps_tip_upd32 = pt_opcs_tip + pt_pl_ip_upd32_size,
357 ptps_tip_upd48 = pt_opcs_tip + pt_pl_ip_upd48_size,
358 ptps_tip_sext48 = pt_opcs_tip + pt_pl_ip_sext48_size,
359 ptps_tip_full = pt_opcs_tip + pt_pl_ip_full_size,
360 ptps_tip_pge_supp = pt_opcs_tip_pge,
361 ptps_tip_pge_upd16 = pt_opcs_tip_pge + pt_pl_ip_upd16_size,
362 ptps_tip_pge_upd32 = pt_opcs_tip_pge + pt_pl_ip_upd32_size,
363 ptps_tip_pge_upd48 = pt_opcs_tip_pge + pt_pl_ip_upd48_size,
364 ptps_tip_pge_sext48 = pt_opcs_tip_pge + pt_pl_ip_sext48_size,
365 ptps_tip_pge_full = pt_opcs_tip_pge + pt_pl_ip_full_size,
366 ptps_tip_pgd_supp = pt_opcs_tip_pgd,
367 ptps_tip_pgd_upd16 = pt_opcs_tip_pgd + pt_pl_ip_upd16_size,
368 ptps_tip_pgd_upd32 = pt_opcs_tip_pgd + pt_pl_ip_upd32_size,
369 ptps_tip_pgd_upd48 = pt_opcs_tip_pgd + pt_pl_ip_upd48_size,
370 ptps_tip_pgd_sext48 = pt_opcs_tip_pgd + pt_pl_ip_sext48_size,
371 ptps_tip_pgd_full = pt_opcs_tip_pgd + pt_pl_ip_full_size,
372 ptps_fup_supp = pt_opcs_fup,
373 ptps_fup_upd16 = pt_opcs_fup + pt_pl_ip_upd16_size,
374 ptps_fup_upd32 = pt_opcs_fup + pt_pl_ip_upd32_size,
375 ptps_fup_upd48 = pt_opcs_fup + pt_pl_ip_upd48_size,
376 ptps_fup_sext48 = pt_opcs_fup + pt_pl_ip_sext48_size,
377 ptps_fup_full = pt_opcs_fup + pt_pl_ip_full_size,
378 ptps_tma = pt_opcs_tma + pt_pl_tma_size,
379 ptps_stop = pt_opcs_stop,
380 ptps_vmcs = pt_opcs_vmcs + pt_pl_vmcs_size,
381 ptps_mnt = pt_opcs_mnt + pt_pl_mnt_size,
382 ptps_exstop = pt_opcs_exstop,
383 ptps_mwait = pt_opcs_mwait + pt_pl_mwait_size,
384 ptps_pwre = pt_opcs_pwre + pt_pl_pwre_size,
385 ptps_pwrx = pt_opcs_pwrx + pt_pl_pwrx_size,
386 ptps_ptw_32 = pt_opcs_ptw + 4,
387 ptps_ptw_64 = pt_opcs_ptw + 8
390 /* Supported address range configurations. */
392 pt_addr_cfg_disabled = 0,
393 pt_addr_cfg_filter = 1,
397 #endif /* PT_OPCODES_H */