Lines Matching +full:- +full:alt
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
18 #define PM_PMC_SH 20 /* PMC number (1-based) for direct events */
38 #define MMCR1_TTMSEL_SH(n) (MMCR1_TTM0SEL_SH - (n) * 4)
48 #define MMCR1_PMCSEL_SH(n) (MMCR1_PMC1SEL_SH - (n) * 8)
58 * 4 = add/and event (PMC1 -> bits 0 & 4),
59 * 5 = add/and event (PMC1 -> bits 1 & 5),
60 * 6 = add/and event (PMC1 -> bits 2 & 6),
61 * 7 = add/and event (PMC1 -> bits 3 & 7).
123 0x000000c0, /* VMX set 2: byte 0 bits 4-7 */
148 bit = -1; in power6_marked_instr_event()
151 if (pmc == 0 || !(ptype & (1 << (pmc - 1)))) in power6_marked_instr_event()
159 bit = ptype ^ (pmc - 1); in power6_marked_instr_event()
163 if (!(event & PM_BUSEVENT_MSK) || bit == -1) in power6_marked_instr_event()
186 return -1; in p6_compute_mmcr()
190 if (pmc_inuse & (1 << (pmc - 1))) in p6_compute_mmcr()
191 return -1; /* collision! */ in p6_compute_mmcr()
192 pmc_inuse |= 1 << (pmc - 1); in p6_compute_mmcr()
199 --pmc; in p6_compute_mmcr()
206 return -1; in p6_compute_mmcr()
217 return -1; in p6_compute_mmcr()
225 return -1; in p6_compute_mmcr()
248 mmcr->mmcr0 = 0; in p6_compute_mmcr()
250 mmcr->mmcr0 = MMCR0_PMC1CE; in p6_compute_mmcr()
252 mmcr->mmcr0 |= MMCR0_PMCjCE; in p6_compute_mmcr()
253 mmcr->mmcr1 = mmcr1; in p6_compute_mmcr()
254 mmcr->mmcra = mmcra; in p6_compute_mmcr()
261 * 0-1 add field: number of uses of PMC1 (max 1)
262 * 2-3, 4-5, 6-7, 8-9, 10-11: ditto for PMC2, 3, 4, 5, 6
263 * 12-15 add field: number of uses of PMC1-4 (max 4)
264 * 16-19 select field: unit on byte 0 of event bus
265 * 20-23, 24-27, 28-31 ditto for bytes 1, 2, 3
266 * 32-34 select field: nest (subunit) event selector
277 return -1; in p6_get_constraint()
278 sh = (pmc - 1) * 2; in p6_get_constraint()
284 sh = byte * 4 + (16 - PM_UNIT_SH); in p6_get_constraint()
294 mask |= 0x8000; /* add field for count of PMC1-4 uses */ in p6_get_constraint()
344 unsigned int alt; in find_alternatives_list() local
348 return -1; in find_alternatives_list()
350 alt = event_alternatives[i][j]; in find_alternatives_list()
351 if (!alt || event < alt) in find_alternatives_list()
353 if (event == alt) in find_alternatives_list()
357 return -1; in find_alternatives_list()
360 static int p6_get_alternatives(u64 event, unsigned int flags, u64 alt[]) in p6_get_alternatives() argument
367 alt[0] = event; in p6_get_alternatives()
379 alt[nalt++] = aevent; in p6_get_alternatives()
385 /* PMCSEL 0x32 counter N == PMCSEL 0x34 counter 5-N */ in p6_get_alternatives()
389 alt[nalt++] = ((event ^ 0x6) & ~PM_PMC_MSKS) | in p6_get_alternatives()
390 ((5 - pmc) << PM_PMC_SH); in p6_get_alternatives()
392 /* PMCSEL 0x38 counter N == PMCSEL 0x3a counter N+/-2 */ in p6_get_alternatives()
394 alt[nalt++] = ((event ^ 0x2) & ~PM_PMC_MSKS) | in p6_get_alternatives()
395 ((pmc > 2? pmc - 2: pmc + 2) << PM_PMC_SH); in p6_get_alternatives()
411 switch (alt[i]) { in p6_get_alternatives()
413 alt[j++] = 0x600005; /* PM_RUN_CYC */ in p6_get_alternatives()
417 alt[j++] = 0x1e; /* PM_CYC */ in p6_get_alternatives()
420 alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */ in p6_get_alternatives()
424 alt[j++] = 2; /* PM_INST_CMPL */ in p6_get_alternatives()
427 alt[j++] = 0x4000f4; /* PM_RUN_PURR */ in p6_get_alternatives()
430 alt[j++] = 0x10000e; /* PM_PURR */ in p6_get_alternatives()
441 if (!p6_limited_pmc_event(alt[i])) { in p6_get_alternatives()
442 alt[j] = alt[i]; in p6_get_alternatives()
451 if (p6_limited_pmc_event(alt[i])) { in p6_get_alternatives()
452 alt[j] = alt[i]; in p6_get_alternatives()
466 mmcr->mmcr1 &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc)); in p6_disable_pmc()
481 * Table of generalized cache-related events.
482 * 0 means not supported, -1 means nonsensical, other values
494 [C(OP_WRITE)] = { -1, -1 },
504 [C(OP_WRITE)] = { -1, -1 },
505 [C(OP_PREFETCH)] = { -1, -1 },
509 [C(OP_WRITE)] = { -1, -1 },
510 [C(OP_PREFETCH)] = { -1, -1 },
514 [C(OP_WRITE)] = { -1, -1 },
515 [C(OP_PREFETCH)] = { -1, -1 },
518 [C(OP_READ)] = { -1, -1 },
519 [C(OP_WRITE)] = { -1, -1 },
520 [C(OP_PREFETCH)] = { -1, -1 },
543 if (!cur_cpu_spec->oprofile_cpu_type || in init_power6_pmu()
544 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6")) in init_power6_pmu()
545 return -ENODEV; in init_power6_pmu()