Lines Matching +full:wr +full:- +full:active
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * APM X-Gene SoC PMU (Performance Monitor Unit)
81 #define GET_CNTR(ev) (ev->hw.idx)
82 #define GET_EVENTID(ev) (ev->hw.config & 0xFFULL)
83 #define GET_AGENTID(ev) (ev->hw.config_base & 0xFFFFFFFFUL)
84 #define GET_AGENT1ID(ev) ((ev->hw.config_base >> 32) & 0xFFFFFFFFUL)
173 return sprintf(buf, "%s\n", (char *) eattr->var); in xgene_pmu_format_show()
183 XGENE_PMU_FORMAT_ATTR(l3c_eventid, "config:0-7"),
184 XGENE_PMU_FORMAT_ATTR(l3c_agentid, "config1:0-9"),
189 XGENE_PMU_FORMAT_ATTR(iob_eventid, "config:0-7"),
190 XGENE_PMU_FORMAT_ATTR(iob_agentid, "config1:0-63"),
195 XGENE_PMU_FORMAT_ATTR(mcb_eventid, "config:0-5"),
196 XGENE_PMU_FORMAT_ATTR(mcb_agentid, "config1:0-9"),
201 XGENE_PMU_FORMAT_ATTR(mc_eventid, "config:0-28"),
226 XGENE_PMU_FORMAT_ATTR(l3c_eventid, "config:0-39"),
231 XGENE_PMU_FORMAT_ATTR(iob_eventid, "config:0-47"),
236 XGENE_PMU_FORMAT_ATTR(iob_slow_eventid, "config:0-16"),
241 XGENE_PMU_FORMAT_ATTR(mcb_eventid, "config:0-35"),
246 XGENE_PMU_FORMAT_ATTR(mc_eventid, "config:0-44"),
284 return sprintf(buf, "config=0x%lx\n", (unsigned long) eattr->var); in xgene_pmu_event_show()
294 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
295 XGENE_PMU_EVENT_ATTR(cycle-count-div-64, 0x01),
296 XGENE_PMU_EVENT_ATTR(read-hit, 0x02),
297 XGENE_PMU_EVENT_ATTR(read-miss, 0x03),
298 XGENE_PMU_EVENT_ATTR(write-need-replacement, 0x06),
299 XGENE_PMU_EVENT_ATTR(write-not-need-replacement, 0x07),
300 XGENE_PMU_EVENT_ATTR(tq-full, 0x08),
301 XGENE_PMU_EVENT_ATTR(ackq-full, 0x09),
302 XGENE_PMU_EVENT_ATTR(wdb-full, 0x0a),
303 XGENE_PMU_EVENT_ATTR(bank-fifo-full, 0x0b),
304 XGENE_PMU_EVENT_ATTR(odb-full, 0x0c),
305 XGENE_PMU_EVENT_ATTR(wbq-full, 0x0d),
306 XGENE_PMU_EVENT_ATTR(bank-conflict-fifo-issue, 0x0e),
307 XGENE_PMU_EVENT_ATTR(bank-fifo-issue, 0x0f),
312 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
313 XGENE_PMU_EVENT_ATTR(cycle-count-div-64, 0x01),
314 XGENE_PMU_EVENT_ATTR(axi0-read, 0x02),
315 XGENE_PMU_EVENT_ATTR(axi0-read-partial, 0x03),
316 XGENE_PMU_EVENT_ATTR(axi1-read, 0x04),
317 XGENE_PMU_EVENT_ATTR(axi1-read-partial, 0x05),
318 XGENE_PMU_EVENT_ATTR(csw-read-block, 0x06),
319 XGENE_PMU_EVENT_ATTR(csw-read-partial, 0x07),
320 XGENE_PMU_EVENT_ATTR(axi0-write, 0x10),
321 XGENE_PMU_EVENT_ATTR(axi0-write-partial, 0x11),
322 XGENE_PMU_EVENT_ATTR(axi1-write, 0x13),
323 XGENE_PMU_EVENT_ATTR(axi1-write-partial, 0x14),
324 XGENE_PMU_EVENT_ATTR(csw-inbound-dirty, 0x16),
329 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
330 XGENE_PMU_EVENT_ATTR(cycle-count-div-64, 0x01),
331 XGENE_PMU_EVENT_ATTR(csw-read, 0x02),
332 XGENE_PMU_EVENT_ATTR(csw-write-request, 0x03),
333 XGENE_PMU_EVENT_ATTR(mcb-csw-stall, 0x04),
334 XGENE_PMU_EVENT_ATTR(cancel-read-gack, 0x05),
339 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
340 XGENE_PMU_EVENT_ATTR(cycle-count-div-64, 0x01),
341 XGENE_PMU_EVENT_ATTR(act-cmd-sent, 0x02),
342 XGENE_PMU_EVENT_ATTR(pre-cmd-sent, 0x03),
343 XGENE_PMU_EVENT_ATTR(rd-cmd-sent, 0x04),
344 XGENE_PMU_EVENT_ATTR(rda-cmd-sent, 0x05),
345 XGENE_PMU_EVENT_ATTR(wr-cmd-sent, 0x06),
346 XGENE_PMU_EVENT_ATTR(wra-cmd-sent, 0x07),
347 XGENE_PMU_EVENT_ATTR(pde-cmd-sent, 0x08),
348 XGENE_PMU_EVENT_ATTR(sre-cmd-sent, 0x09),
349 XGENE_PMU_EVENT_ATTR(prea-cmd-sent, 0x0a),
350 XGENE_PMU_EVENT_ATTR(ref-cmd-sent, 0x0b),
351 XGENE_PMU_EVENT_ATTR(rd-rda-cmd-sent, 0x0c),
352 XGENE_PMU_EVENT_ATTR(wr-wra-cmd-sent, 0x0d),
353 XGENE_PMU_EVENT_ATTR(in-rd-collision, 0x0e),
354 XGENE_PMU_EVENT_ATTR(in-wr-collision, 0x0f),
355 XGENE_PMU_EVENT_ATTR(collision-queue-not-empty, 0x10),
356 XGENE_PMU_EVENT_ATTR(collision-queue-full, 0x11),
357 XGENE_PMU_EVENT_ATTR(mcu-request, 0x12),
358 XGENE_PMU_EVENT_ATTR(mcu-rd-request, 0x13),
359 XGENE_PMU_EVENT_ATTR(mcu-hp-rd-request, 0x14),
360 XGENE_PMU_EVENT_ATTR(mcu-wr-request, 0x15),
361 XGENE_PMU_EVENT_ATTR(mcu-rd-proceed-all, 0x16),
362 XGENE_PMU_EVENT_ATTR(mcu-rd-proceed-cancel, 0x17),
363 XGENE_PMU_EVENT_ATTR(mcu-rd-response, 0x18),
364 XGENE_PMU_EVENT_ATTR(mcu-rd-proceed-speculative-all, 0x19),
365 XGENE_PMU_EVENT_ATTR(mcu-rd-proceed-speculative-cancel, 0x1a),
366 XGENE_PMU_EVENT_ATTR(mcu-wr-proceed-all, 0x1b),
367 XGENE_PMU_EVENT_ATTR(mcu-wr-proceed-cancel, 0x1c),
392 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
393 XGENE_PMU_EVENT_ATTR(read-hit, 0x01),
394 XGENE_PMU_EVENT_ATTR(read-miss, 0x02),
395 XGENE_PMU_EVENT_ATTR(index-flush-eviction, 0x03),
396 XGENE_PMU_EVENT_ATTR(write-caused-replacement, 0x04),
397 XGENE_PMU_EVENT_ATTR(write-not-caused-replacement, 0x05),
398 XGENE_PMU_EVENT_ATTR(clean-eviction, 0x06),
399 XGENE_PMU_EVENT_ATTR(dirty-eviction, 0x07),
403 XGENE_PMU_EVENT_ATTR(tq-bank-conflict-issue-stall, 0x0b),
404 XGENE_PMU_EVENT_ATTR(tq-full, 0x0c),
405 XGENE_PMU_EVENT_ATTR(ackq-full, 0x0d),
406 XGENE_PMU_EVENT_ATTR(wdb-full, 0x0e),
407 XGENE_PMU_EVENT_ATTR(odb-full, 0x10),
408 XGENE_PMU_EVENT_ATTR(wbq-full, 0x11),
409 XGENE_PMU_EVENT_ATTR(input-req-async-fifo-stall, 0x12),
410 XGENE_PMU_EVENT_ATTR(output-req-async-fifo-stall, 0x13),
411 XGENE_PMU_EVENT_ATTR(output-data-async-fifo-stall, 0x14),
412 XGENE_PMU_EVENT_ATTR(total-insertion, 0x15),
413 XGENE_PMU_EVENT_ATTR(sip-insertions-r-set, 0x16),
414 XGENE_PMU_EVENT_ATTR(sip-insertions-r-clear, 0x17),
415 XGENE_PMU_EVENT_ATTR(dip-insertions-r-set, 0x18),
416 XGENE_PMU_EVENT_ATTR(dip-insertions-r-clear, 0x19),
417 XGENE_PMU_EVENT_ATTR(dip-insertions-force-r-set, 0x1a),
420 XGENE_PMU_EVENT_ATTR(old-replacement, 0x1d),
421 XGENE_PMU_EVENT_ATTR(young-replacement, 0x1e),
422 XGENE_PMU_EVENT_ATTR(r-set-replacement, 0x1f),
423 XGENE_PMU_EVENT_ATTR(r-clear-replacement, 0x20),
424 XGENE_PMU_EVENT_ATTR(old-r-replacement, 0x21),
425 XGENE_PMU_EVENT_ATTR(old-nr-replacement, 0x22),
426 XGENE_PMU_EVENT_ATTR(young-r-replacement, 0x23),
427 XGENE_PMU_EVENT_ATTR(young-nr-replacement, 0x24),
428 XGENE_PMU_EVENT_ATTR(bloomfilter-clearing, 0x25),
429 XGENE_PMU_EVENT_ATTR(generation-flip, 0x26),
430 XGENE_PMU_EVENT_ATTR(vcc-droop-detected, 0x27),
435 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
436 XGENE_PMU_EVENT_ATTR(pa-req-buf-alloc-all, 0x01),
437 XGENE_PMU_EVENT_ATTR(pa-req-buf-alloc-rd, 0x02),
438 XGENE_PMU_EVENT_ATTR(pa-req-buf-alloc-wr, 0x03),
439 XGENE_PMU_EVENT_ATTR(pa-all-cp-req, 0x04),
440 XGENE_PMU_EVENT_ATTR(pa-cp-blk-req, 0x05),
441 XGENE_PMU_EVENT_ATTR(pa-cp-ptl-req, 0x06),
442 XGENE_PMU_EVENT_ATTR(pa-cp-rd-req, 0x07),
443 XGENE_PMU_EVENT_ATTR(pa-cp-wr-req, 0x08),
444 XGENE_PMU_EVENT_ATTR(ba-all-req, 0x09),
445 XGENE_PMU_EVENT_ATTR(ba-rd-req, 0x0a),
446 XGENE_PMU_EVENT_ATTR(ba-wr-req, 0x0b),
447 XGENE_PMU_EVENT_ATTR(pa-rd-shared-req-issued, 0x10),
448 XGENE_PMU_EVENT_ATTR(pa-rd-exclusive-req-issued, 0x11),
449 XGENE_PMU_EVENT_ATTR(pa-wr-invalidate-req-issued-stashable, 0x12),
450 XGENE_PMU_EVENT_ATTR(pa-wr-invalidate-req-issued-nonstashable, 0x13),
451 XGENE_PMU_EVENT_ATTR(pa-wr-back-req-issued-stashable, 0x14),
452 XGENE_PMU_EVENT_ATTR(pa-wr-back-req-issued-nonstashable, 0x15),
453 XGENE_PMU_EVENT_ATTR(pa-ptl-wr-req, 0x16),
454 XGENE_PMU_EVENT_ATTR(pa-ptl-rd-req, 0x17),
455 XGENE_PMU_EVENT_ATTR(pa-wr-back-clean-data, 0x18),
456 XGENE_PMU_EVENT_ATTR(pa-wr-back-cancelled-on-SS, 0x1b),
457 XGENE_PMU_EVENT_ATTR(pa-barrier-occurrence, 0x1c),
458 XGENE_PMU_EVENT_ATTR(pa-barrier-cycles, 0x1d),
459 XGENE_PMU_EVENT_ATTR(pa-total-cp-snoops, 0x20),
460 XGENE_PMU_EVENT_ATTR(pa-rd-shared-snoop, 0x21),
461 XGENE_PMU_EVENT_ATTR(pa-rd-shared-snoop-hit, 0x22),
462 XGENE_PMU_EVENT_ATTR(pa-rd-exclusive-snoop, 0x23),
463 XGENE_PMU_EVENT_ATTR(pa-rd-exclusive-snoop-hit, 0x24),
464 XGENE_PMU_EVENT_ATTR(pa-rd-wr-invalid-snoop, 0x25),
465 XGENE_PMU_EVENT_ATTR(pa-rd-wr-invalid-snoop-hit, 0x26),
466 XGENE_PMU_EVENT_ATTR(pa-req-buffer-full, 0x28),
467 XGENE_PMU_EVENT_ATTR(cswlf-outbound-req-fifo-full, 0x29),
468 XGENE_PMU_EVENT_ATTR(cswlf-inbound-snoop-fifo-backpressure, 0x2a),
469 XGENE_PMU_EVENT_ATTR(cswlf-outbound-lack-fifo-full, 0x2b),
470 XGENE_PMU_EVENT_ATTR(cswlf-inbound-gack-fifo-backpressure, 0x2c),
471 XGENE_PMU_EVENT_ATTR(cswlf-outbound-data-fifo-full, 0x2d),
472 XGENE_PMU_EVENT_ATTR(cswlf-inbound-data-fifo-backpressure, 0x2e),
473 XGENE_PMU_EVENT_ATTR(cswlf-inbound-req-backpressure, 0x2f),
478 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
479 XGENE_PMU_EVENT_ATTR(pa-axi0-rd-req, 0x01),
480 XGENE_PMU_EVENT_ATTR(pa-axi0-wr-req, 0x02),
481 XGENE_PMU_EVENT_ATTR(pa-axi1-rd-req, 0x03),
482 XGENE_PMU_EVENT_ATTR(pa-axi1-wr-req, 0x04),
483 XGENE_PMU_EVENT_ATTR(ba-all-axi-req, 0x07),
484 XGENE_PMU_EVENT_ATTR(ba-axi-rd-req, 0x08),
485 XGENE_PMU_EVENT_ATTR(ba-axi-wr-req, 0x09),
486 XGENE_PMU_EVENT_ATTR(ba-free-list-empty, 0x10),
491 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
492 XGENE_PMU_EVENT_ATTR(req-receive, 0x01),
493 XGENE_PMU_EVENT_ATTR(rd-req-recv, 0x02),
494 XGENE_PMU_EVENT_ATTR(rd-req-recv-2, 0x03),
495 XGENE_PMU_EVENT_ATTR(wr-req-recv, 0x04),
496 XGENE_PMU_EVENT_ATTR(wr-req-recv-2, 0x05),
497 XGENE_PMU_EVENT_ATTR(rd-req-sent-to-mcu, 0x06),
498 XGENE_PMU_EVENT_ATTR(rd-req-sent-to-mcu-2, 0x07),
499 XGENE_PMU_EVENT_ATTR(rd-req-sent-to-spec-mcu, 0x08),
500 XGENE_PMU_EVENT_ATTR(rd-req-sent-to-spec-mcu-2, 0x09),
501 XGENE_PMU_EVENT_ATTR(glbl-ack-recv-for-rd-sent-to-spec-mcu, 0x0a),
502 XGENE_PMU_EVENT_ATTR(glbl-ack-go-recv-for-rd-sent-to-spec-mcu, 0x0b),
503 XGENE_PMU_EVENT_ATTR(glbl-ack-nogo-recv-for-rd-sent-to-spec-mcu, 0x0c),
504 XGENE_PMU_EVENT_ATTR(glbl-ack-go-recv-any-rd-req, 0x0d),
505 XGENE_PMU_EVENT_ATTR(glbl-ack-go-recv-any-rd-req-2, 0x0e),
506 XGENE_PMU_EVENT_ATTR(wr-req-sent-to-mcu, 0x0f),
507 XGENE_PMU_EVENT_ATTR(gack-recv, 0x10),
508 XGENE_PMU_EVENT_ATTR(rd-gack-recv, 0x11),
509 XGENE_PMU_EVENT_ATTR(wr-gack-recv, 0x12),
510 XGENE_PMU_EVENT_ATTR(cancel-rd-gack, 0x13),
511 XGENE_PMU_EVENT_ATTR(cancel-wr-gack, 0x14),
512 XGENE_PMU_EVENT_ATTR(mcb-csw-req-stall, 0x15),
513 XGENE_PMU_EVENT_ATTR(mcu-req-intf-blocked, 0x16),
514 XGENE_PMU_EVENT_ATTR(mcb-mcu-rd-intf-stall, 0x17),
515 XGENE_PMU_EVENT_ATTR(csw-rd-intf-blocked, 0x18),
516 XGENE_PMU_EVENT_ATTR(csw-local-ack-intf-blocked, 0x19),
517 XGENE_PMU_EVENT_ATTR(mcu-req-table-full, 0x1a),
518 XGENE_PMU_EVENT_ATTR(mcu-stat-table-full, 0x1b),
519 XGENE_PMU_EVENT_ATTR(mcu-wr-table-full, 0x1c),
520 XGENE_PMU_EVENT_ATTR(mcu-rdreceipt-resp, 0x1d),
521 XGENE_PMU_EVENT_ATTR(mcu-wrcomplete-resp, 0x1e),
522 XGENE_PMU_EVENT_ATTR(mcu-retryack-resp, 0x1f),
523 XGENE_PMU_EVENT_ATTR(mcu-pcrdgrant-resp, 0x20),
524 XGENE_PMU_EVENT_ATTR(mcu-req-from-lastload, 0x21),
525 XGENE_PMU_EVENT_ATTR(mcu-req-from-bypass, 0x22),
526 XGENE_PMU_EVENT_ATTR(volt-droop-detect, 0x23),
531 XGENE_PMU_EVENT_ATTR(cycle-count, 0x00),
532 XGENE_PMU_EVENT_ATTR(act-sent, 0x01),
533 XGENE_PMU_EVENT_ATTR(pre-sent, 0x02),
534 XGENE_PMU_EVENT_ATTR(rd-sent, 0x03),
535 XGENE_PMU_EVENT_ATTR(rda-sent, 0x04),
536 XGENE_PMU_EVENT_ATTR(wr-sent, 0x05),
537 XGENE_PMU_EVENT_ATTR(wra-sent, 0x06),
538 XGENE_PMU_EVENT_ATTR(pd-entry-vld, 0x07),
539 XGENE_PMU_EVENT_ATTR(sref-entry-vld, 0x08),
540 XGENE_PMU_EVENT_ATTR(prea-sent, 0x09),
541 XGENE_PMU_EVENT_ATTR(ref-sent, 0x0a),
542 XGENE_PMU_EVENT_ATTR(rd-rda-sent, 0x0b),
543 XGENE_PMU_EVENT_ATTR(wr-wra-sent, 0x0c),
544 XGENE_PMU_EVENT_ATTR(raw-hazard, 0x0d),
545 XGENE_PMU_EVENT_ATTR(war-hazard, 0x0e),
546 XGENE_PMU_EVENT_ATTR(waw-hazard, 0x0f),
547 XGENE_PMU_EVENT_ATTR(rar-hazard, 0x10),
548 XGENE_PMU_EVENT_ATTR(raw-war-waw-hazard, 0x11),
549 XGENE_PMU_EVENT_ATTR(hprd-lprd-wr-req-vld, 0x12),
550 XGENE_PMU_EVENT_ATTR(lprd-req-vld, 0x13),
551 XGENE_PMU_EVENT_ATTR(hprd-req-vld, 0x14),
552 XGENE_PMU_EVENT_ATTR(hprd-lprd-req-vld, 0x15),
553 XGENE_PMU_EVENT_ATTR(wr-req-vld, 0x16),
554 XGENE_PMU_EVENT_ATTR(partial-wr-req-vld, 0x17),
555 XGENE_PMU_EVENT_ATTR(rd-retry, 0x18),
556 XGENE_PMU_EVENT_ATTR(wr-retry, 0x19),
557 XGENE_PMU_EVENT_ATTR(retry-gnt, 0x1a),
558 XGENE_PMU_EVENT_ATTR(rank-change, 0x1b),
559 XGENE_PMU_EVENT_ATTR(dir-change, 0x1c),
560 XGENE_PMU_EVENT_ATTR(rank-dir-change, 0x1d),
561 XGENE_PMU_EVENT_ATTR(rank-active, 0x1e),
562 XGENE_PMU_EVENT_ATTR(rank-idle, 0x1f),
563 XGENE_PMU_EVENT_ATTR(rank-pd, 0x20),
564 XGENE_PMU_EVENT_ATTR(rank-sref, 0x21),
565 XGENE_PMU_EVENT_ATTR(queue-fill-gt-thresh, 0x22),
566 XGENE_PMU_EVENT_ATTR(queue-rds-gt-thresh, 0x23),
567 XGENE_PMU_EVENT_ATTR(queue-wrs-gt-thresh, 0x24),
568 XGENE_PMU_EVENT_ATTR(phy-updt-complt, 0x25),
569 XGENE_PMU_EVENT_ATTR(tz-fail, 0x26),
570 XGENE_PMU_EVENT_ATTR(dram-errc, 0x27),
571 XGENE_PMU_EVENT_ATTR(dram-errd, 0x28),
572 XGENE_PMU_EVENT_ATTR(rd-enq, 0x29),
573 XGENE_PMU_EVENT_ATTR(wr-enq, 0x2a),
574 XGENE_PMU_EVENT_ATTR(tmac-limit-reached, 0x2b),
575 XGENE_PMU_EVENT_ATTR(tmaw-tracker-full, 0x2c),
612 return cpumap_print_to_pagebuf(true, buf, &pmu_dev->parent->cpu); in xgene_pmu_cpumask_show()
699 cntr = find_first_zero_bit(pmu_dev->cntr_assign_mask, in get_next_avail_cntr()
700 pmu_dev->max_counters); in get_next_avail_cntr()
701 if (cntr == pmu_dev->max_counters) in get_next_avail_cntr()
702 return -ENOSPC; in get_next_avail_cntr()
703 set_bit(cntr, pmu_dev->cntr_assign_mask); in get_next_avail_cntr()
710 clear_bit(cntr, pmu_dev->cntr_assign_mask); in clear_avail_cntr()
715 writel(PCPPMU_INTENMASK, xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_mask_int()
720 writel(PCPPMU_V3_INTENMASK, xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_v3_mask_int()
725 writel(PCPPMU_INTCLRMASK, xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_unmask_int()
731 xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_v3_unmask_int()
737 return readl(pmu_dev->inf->csr + PMU_PMEVCNTR0 + (4 * idx)); in xgene_pmu_read_counter32()
746 * v3 has 64-bit counter registers composed by 2 32-bit registers in xgene_pmu_read_counter64()
762 writel(val, pmu_dev->inf->csr + PMU_PMEVCNTR0 + (4 * idx)); in xgene_pmu_write_counter32()
773 /* v3 has 64-bit counter registers composed by 2 32-bit registers */ in xgene_pmu_write_counter64()
781 writel(val, pmu_dev->inf->csr + PMU_PMEVTYPER0 + (4 * idx)); in xgene_pmu_write_evttype()
787 writel(val, pmu_dev->inf->csr + PMU_PMAMR0); in xgene_pmu_write_agentmsk()
796 writel(val, pmu_dev->inf->csr + PMU_PMAMR1); in xgene_pmu_write_agent1msk()
807 val = readl(pmu_dev->inf->csr + PMU_PMCNTENSET); in xgene_pmu_enable_counter()
809 writel(val, pmu_dev->inf->csr + PMU_PMCNTENSET); in xgene_pmu_enable_counter()
817 val = readl(pmu_dev->inf->csr + PMU_PMCNTENCLR); in xgene_pmu_disable_counter()
819 writel(val, pmu_dev->inf->csr + PMU_PMCNTENCLR); in xgene_pmu_disable_counter()
827 val = readl(pmu_dev->inf->csr + PMU_PMINTENSET); in xgene_pmu_enable_counter_int()
829 writel(val, pmu_dev->inf->csr + PMU_PMINTENSET); in xgene_pmu_enable_counter_int()
837 val = readl(pmu_dev->inf->csr + PMU_PMINTENCLR); in xgene_pmu_disable_counter_int()
839 writel(val, pmu_dev->inf->csr + PMU_PMINTENCLR); in xgene_pmu_disable_counter_int()
846 val = readl(pmu_dev->inf->csr + PMU_PMCR); in xgene_pmu_reset_counters()
848 writel(val, pmu_dev->inf->csr + PMU_PMCR); in xgene_pmu_reset_counters()
855 val = readl(pmu_dev->inf->csr + PMU_PMCR); in xgene_pmu_start_counters()
857 writel(val, pmu_dev->inf->csr + PMU_PMCR); in xgene_pmu_start_counters()
864 val = readl(pmu_dev->inf->csr + PMU_PMCR); in xgene_pmu_stop_counters()
866 writel(val, pmu_dev->inf->csr + PMU_PMCR); in xgene_pmu_stop_counters()
872 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_pmu_enable()
873 int enabled = bitmap_weight(pmu_dev->cntr_assign_mask, in xgene_perf_pmu_enable()
874 pmu_dev->max_counters); in xgene_perf_pmu_enable()
879 xgene_pmu->ops->start_counters(pmu_dev); in xgene_perf_pmu_enable()
885 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_pmu_disable()
887 xgene_pmu->ops->stop_counters(pmu_dev); in xgene_perf_pmu_disable()
892 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_event_init()
893 struct hw_perf_event *hw = &event->hw; in xgene_perf_event_init()
897 if (event->attr.type != event->pmu->type) in xgene_perf_event_init()
898 return -ENOENT; in xgene_perf_event_init()
902 * Therefore, it does not support per-process mode. in xgene_perf_event_init()
905 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) in xgene_perf_event_init()
906 return -EINVAL; in xgene_perf_event_init()
908 if (event->cpu < 0) in xgene_perf_event_init()
909 return -EINVAL; in xgene_perf_event_init()
914 * but can lead to issues for off-core PMUs, where each in xgene_perf_event_init()
919 event->cpu = cpumask_first(&pmu_dev->parent->cpu); in xgene_perf_event_init()
921 hw->config = event->attr.config; in xgene_perf_event_init()
928 hw->config_base = event->attr.config1; in xgene_perf_event_init()
934 if (event->group_leader->pmu != event->pmu && in xgene_perf_event_init()
935 !is_software_event(event->group_leader)) in xgene_perf_event_init()
936 return -EINVAL; in xgene_perf_event_init()
938 for_each_sibling_event(sibling, event->group_leader) { in xgene_perf_event_init()
939 if (sibling->pmu != event->pmu && in xgene_perf_event_init()
941 return -EINVAL; in xgene_perf_event_init()
949 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_enable_event()
950 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_enable_event()
952 xgene_pmu->ops->write_evttype(pmu_dev, GET_CNTR(event), in xgene_perf_enable_event()
954 xgene_pmu->ops->write_agentmsk(pmu_dev, ~((u32)GET_AGENTID(event))); in xgene_perf_enable_event()
955 if (pmu_dev->inf->type == PMU_TYPE_IOB) in xgene_perf_enable_event()
956 xgene_pmu->ops->write_agent1msk(pmu_dev, in xgene_perf_enable_event()
959 xgene_pmu->ops->enable_counter(pmu_dev, GET_CNTR(event)); in xgene_perf_enable_event()
960 xgene_pmu->ops->enable_counter_int(pmu_dev, GET_CNTR(event)); in xgene_perf_enable_event()
965 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_disable_event()
966 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_disable_event()
968 xgene_pmu->ops->disable_counter(pmu_dev, GET_CNTR(event)); in xgene_perf_disable_event()
969 xgene_pmu->ops->disable_counter_int(pmu_dev, GET_CNTR(event)); in xgene_perf_disable_event()
974 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_event_set_period()
975 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_event_set_period()
976 struct hw_perf_event *hw = &event->hw; in xgene_perf_event_set_period()
986 local64_set(&hw->prev_count, val); in xgene_perf_event_set_period()
987 xgene_pmu->ops->write_counter(pmu_dev, hw->idx, val); in xgene_perf_event_set_period()
992 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_event_update()
993 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_event_update()
994 struct hw_perf_event *hw = &event->hw; in xgene_perf_event_update()
998 prev_raw_count = local64_read(&hw->prev_count); in xgene_perf_event_update()
999 new_raw_count = xgene_pmu->ops->read_counter(pmu_dev, GET_CNTR(event)); in xgene_perf_event_update()
1001 if (local64_cmpxchg(&hw->prev_count, prev_raw_count, in xgene_perf_event_update()
1005 delta = (new_raw_count - prev_raw_count) & pmu_dev->max_period; in xgene_perf_event_update()
1007 local64_add(delta, &event->count); in xgene_perf_event_update()
1017 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_start()
1018 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_start()
1019 struct hw_perf_event *hw = &event->hw; in xgene_perf_start()
1021 if (WARN_ON_ONCE(!(hw->state & PERF_HES_STOPPED))) in xgene_perf_start()
1024 WARN_ON_ONCE(!(hw->state & PERF_HES_UPTODATE)); in xgene_perf_start()
1025 hw->state = 0; in xgene_perf_start()
1030 u64 prev_raw_count = local64_read(&hw->prev_count); in xgene_perf_start()
1032 xgene_pmu->ops->write_counter(pmu_dev, GET_CNTR(event), in xgene_perf_start()
1042 struct hw_perf_event *hw = &event->hw; in xgene_perf_stop()
1044 if (hw->state & PERF_HES_UPTODATE) in xgene_perf_stop()
1048 WARN_ON_ONCE(hw->state & PERF_HES_STOPPED); in xgene_perf_stop()
1049 hw->state |= PERF_HES_STOPPED; in xgene_perf_stop()
1051 if (hw->state & PERF_HES_UPTODATE) in xgene_perf_stop()
1055 hw->state |= PERF_HES_UPTODATE; in xgene_perf_stop()
1060 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_add()
1061 struct hw_perf_event *hw = &event->hw; in xgene_perf_add()
1063 hw->state = PERF_HES_UPTODATE | PERF_HES_STOPPED; in xgene_perf_add()
1066 hw->idx = get_next_avail_cntr(pmu_dev); in xgene_perf_add()
1067 if (hw->idx < 0) in xgene_perf_add()
1068 return -EAGAIN; in xgene_perf_add()
1071 pmu_dev->pmu_counter_event[hw->idx] = event; in xgene_perf_add()
1081 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu); in xgene_perf_del()
1082 struct hw_perf_event *hw = &event->hw; in xgene_perf_del()
1090 pmu_dev->pmu_counter_event[hw->idx] = NULL; in xgene_perf_del()
1097 if (pmu_dev->parent->version == PCP_PMU_V3) in xgene_init_perf()
1098 pmu_dev->max_period = PMU_V3_CNT_MAX_PERIOD; in xgene_init_perf()
1100 pmu_dev->max_period = PMU_CNT_MAX_PERIOD; in xgene_init_perf()
1102 xgene_pmu = pmu_dev->parent; in xgene_init_perf()
1103 if (xgene_pmu->version == PCP_PMU_V1) in xgene_init_perf()
1104 pmu_dev->max_counters = 1; in xgene_init_perf()
1106 pmu_dev->max_counters = PMU_MAX_COUNTERS; in xgene_init_perf()
1109 pmu_dev->pmu = (struct pmu) { in xgene_init_perf()
1110 .attr_groups = pmu_dev->attr_groups, in xgene_init_perf()
1124 xgene_pmu->ops->stop_counters(pmu_dev); in xgene_init_perf()
1125 xgene_pmu->ops->reset_counters(pmu_dev); in xgene_init_perf()
1127 return perf_pmu_register(&pmu_dev->pmu, name, -1); in xgene_init_perf()
1133 struct device *dev = xgene_pmu->dev; in xgene_pmu_dev_add()
1138 return -ENOMEM; in xgene_pmu_dev_add()
1139 pmu->parent = xgene_pmu; in xgene_pmu_dev_add()
1140 pmu->inf = &ctx->inf; in xgene_pmu_dev_add()
1141 ctx->pmu_dev = pmu; in xgene_pmu_dev_add()
1143 switch (pmu->inf->type) { in xgene_pmu_dev_add()
1145 if (!(xgene_pmu->l3c_active_mask & pmu->inf->enable_mask)) in xgene_pmu_dev_add()
1146 return -ENODEV; in xgene_pmu_dev_add()
1147 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1148 pmu->attr_groups = l3c_pmu_v3_attr_groups; in xgene_pmu_dev_add()
1150 pmu->attr_groups = l3c_pmu_attr_groups; in xgene_pmu_dev_add()
1153 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1154 pmu->attr_groups = iob_fast_pmu_v3_attr_groups; in xgene_pmu_dev_add()
1156 pmu->attr_groups = iob_pmu_attr_groups; in xgene_pmu_dev_add()
1159 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1160 pmu->attr_groups = iob_slow_pmu_v3_attr_groups; in xgene_pmu_dev_add()
1163 if (!(xgene_pmu->mcb_active_mask & pmu->inf->enable_mask)) in xgene_pmu_dev_add()
1164 return -ENODEV; in xgene_pmu_dev_add()
1165 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1166 pmu->attr_groups = mcb_pmu_v3_attr_groups; in xgene_pmu_dev_add()
1168 pmu->attr_groups = mcb_pmu_attr_groups; in xgene_pmu_dev_add()
1171 if (!(xgene_pmu->mc_active_mask & pmu->inf->enable_mask)) in xgene_pmu_dev_add()
1172 return -ENODEV; in xgene_pmu_dev_add()
1173 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1174 pmu->attr_groups = mc_pmu_v3_attr_groups; in xgene_pmu_dev_add()
1176 pmu->attr_groups = mc_pmu_attr_groups; in xgene_pmu_dev_add()
1179 return -EINVAL; in xgene_pmu_dev_add()
1182 if (xgene_init_perf(pmu, ctx->name)) { in xgene_pmu_dev_add()
1183 dev_err(dev, "%s PMU: Failed to init perf driver\n", ctx->name); in xgene_pmu_dev_add()
1184 return -ENODEV; in xgene_pmu_dev_add()
1187 dev_info(dev, "%s PMU registered\n", ctx->name); in xgene_pmu_dev_add()
1194 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in _xgene_pmu_isr()
1195 void __iomem *csr = pmu_dev->inf->csr; in _xgene_pmu_isr()
1199 xgene_pmu->ops->stop_counters(pmu_dev); in _xgene_pmu_isr()
1201 if (xgene_pmu->version == PCP_PMU_V3) in _xgene_pmu_isr()
1210 if (xgene_pmu->version == PCP_PMU_V1) in _xgene_pmu_isr()
1212 else if (xgene_pmu->version == PCP_PMU_V2) in _xgene_pmu_isr()
1218 struct perf_event *event = pmu_dev->pmu_counter_event[idx]; in _xgene_pmu_isr()
1229 xgene_pmu->ops->start_counters(pmu_dev); in _xgene_pmu_isr()
1240 raw_spin_lock_irqsave(&xgene_pmu->lock, flags); in xgene_pmu_isr()
1243 val = readl(xgene_pmu->pcppmu_csr + PCPPMU_INTSTATUS_REG); in xgene_pmu_isr()
1244 if (xgene_pmu->version == PCP_PMU_V3) { in xgene_pmu_isr()
1256 list_for_each_entry(ctx, &xgene_pmu->mcpmus, next) { in xgene_pmu_isr()
1257 _xgene_pmu_isr(irq, ctx->pmu_dev); in xgene_pmu_isr()
1261 list_for_each_entry(ctx, &xgene_pmu->mcbpmus, next) { in xgene_pmu_isr()
1262 _xgene_pmu_isr(irq, ctx->pmu_dev); in xgene_pmu_isr()
1266 list_for_each_entry(ctx, &xgene_pmu->l3cpmus, next) { in xgene_pmu_isr()
1267 _xgene_pmu_isr(irq, ctx->pmu_dev); in xgene_pmu_isr()
1271 list_for_each_entry(ctx, &xgene_pmu->iobpmus, next) { in xgene_pmu_isr()
1272 _xgene_pmu_isr(irq, ctx->pmu_dev); in xgene_pmu_isr()
1276 raw_spin_unlock_irqrestore(&xgene_pmu->lock, flags); in xgene_pmu_isr()
1289 dev_err(&pdev->dev, "ioremap failed for CSW CSR resource\n"); in acpi_pmu_probe_active_mcb_mcu_l3c()
1295 dev_err(&pdev->dev, "ioremap failed for MCBA CSR resource\n"); in acpi_pmu_probe_active_mcb_mcu_l3c()
1301 dev_err(&pdev->dev, "ioremap failed for MCBB CSR resource\n"); in acpi_pmu_probe_active_mcb_mcu_l3c()
1305 xgene_pmu->l3c_active_mask = 0x1; in acpi_pmu_probe_active_mcb_mcu_l3c()
1309 /* Dual MCB active */ in acpi_pmu_probe_active_mcb_mcu_l3c()
1310 xgene_pmu->mcb_active_mask = 0x3; in acpi_pmu_probe_active_mcb_mcu_l3c()
1311 /* Probe all active MC(s) */ in acpi_pmu_probe_active_mcb_mcu_l3c()
1313 xgene_pmu->mc_active_mask = in acpi_pmu_probe_active_mcb_mcu_l3c()
1316 /* Single MCB active */ in acpi_pmu_probe_active_mcb_mcu_l3c()
1317 xgene_pmu->mcb_active_mask = 0x1; in acpi_pmu_probe_active_mcb_mcu_l3c()
1318 /* Probe all active MC(s) */ in acpi_pmu_probe_active_mcb_mcu_l3c()
1320 xgene_pmu->mc_active_mask = in acpi_pmu_probe_active_mcb_mcu_l3c()
1337 dev_err(&pdev->dev, "ioremap failed for CSW CSR resource\n"); in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1345 /* Dual MCB active */ in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1346 xgene_pmu->mcb_active_mask = 0x3; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1347 /* Probe all active L3C(s), maximum is 8 */ in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1348 xgene_pmu->l3c_active_mask = 0xFF; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1349 /* Probe all active MC(s), maximum is 8 */ in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1351 xgene_pmu->mc_active_mask = 0xFF; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1353 xgene_pmu->mc_active_mask = 0x33; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1355 xgene_pmu->mc_active_mask = 0x11; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1357 /* Single MCB active */ in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1358 xgene_pmu->mcb_active_mask = 0x1; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1359 /* Probe all active L3C(s), maximum is 4 */ in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1360 xgene_pmu->l3c_active_mask = 0x0F; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1361 /* Probe all active MC(s), maximum is 4 */ in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1363 xgene_pmu->mc_active_mask = 0x0F; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1365 xgene_pmu->mc_active_mask = 0x03; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1367 xgene_pmu->mc_active_mask = 0x01; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1377 struct device_node *np = pdev->dev.of_node; in fdt_pmu_probe_active_mcb_mcu_l3c()
1380 csw_map = syscon_regmap_lookup_by_phandle(np, "regmap-csw"); in fdt_pmu_probe_active_mcb_mcu_l3c()
1382 dev_err(&pdev->dev, "unable to get syscon regmap csw\n"); in fdt_pmu_probe_active_mcb_mcu_l3c()
1386 mcba_map = syscon_regmap_lookup_by_phandle(np, "regmap-mcba"); in fdt_pmu_probe_active_mcb_mcu_l3c()
1388 dev_err(&pdev->dev, "unable to get syscon regmap mcba\n"); in fdt_pmu_probe_active_mcb_mcu_l3c()
1392 mcbb_map = syscon_regmap_lookup_by_phandle(np, "regmap-mcbb"); in fdt_pmu_probe_active_mcb_mcu_l3c()
1394 dev_err(&pdev->dev, "unable to get syscon regmap mcbb\n"); in fdt_pmu_probe_active_mcb_mcu_l3c()
1398 xgene_pmu->l3c_active_mask = 0x1; in fdt_pmu_probe_active_mcb_mcu_l3c()
1400 return -EINVAL; in fdt_pmu_probe_active_mcb_mcu_l3c()
1403 /* Dual MCB active */ in fdt_pmu_probe_active_mcb_mcu_l3c()
1404 xgene_pmu->mcb_active_mask = 0x3; in fdt_pmu_probe_active_mcb_mcu_l3c()
1405 /* Probe all active MC(s) */ in fdt_pmu_probe_active_mcb_mcu_l3c()
1408 xgene_pmu->mc_active_mask = in fdt_pmu_probe_active_mcb_mcu_l3c()
1411 /* Single MCB active */ in fdt_pmu_probe_active_mcb_mcu_l3c()
1412 xgene_pmu->mcb_active_mask = 0x1; in fdt_pmu_probe_active_mcb_mcu_l3c()
1413 /* Probe all active MC(s) */ in fdt_pmu_probe_active_mcb_mcu_l3c()
1416 xgene_pmu->mc_active_mask = in fdt_pmu_probe_active_mcb_mcu_l3c()
1426 if (has_acpi_companion(&pdev->dev)) { in xgene_pmu_probe_active_mcb_mcu_l3c()
1427 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_probe_active_mcb_mcu_l3c()
1460 struct device *dev = xgene_pmu->dev; in acpi_get_pmu_hw_inf()
1483 if (resource_type(rentry->res) == IORESOURCE_MEM) { in acpi_get_pmu_hw_inf()
1484 res = *rentry->res; in acpi_get_pmu_hw_inf()
1502 /* A PMU device node without enable-bit-index is always enabled */ in acpi_get_pmu_hw_inf()
1503 rc = acpi_dev_get_property(adev, "enable-bit-index", in acpi_get_pmu_hw_inf()
1508 enable_bit = (int) obj->integer.value; in acpi_get_pmu_hw_inf()
1510 ctx->name = xgene_pmu_dev_name(dev, type, enable_bit); in acpi_get_pmu_hw_inf()
1511 if (!ctx->name) { in acpi_get_pmu_hw_inf()
1515 inf = &ctx->inf; in acpi_get_pmu_hw_inf()
1516 inf->type = type; in acpi_get_pmu_hw_inf()
1517 inf->csr = dev_csr; in acpi_get_pmu_hw_inf()
1518 inf->enable_mask = 1 << enable_bit; in acpi_get_pmu_hw_inf()
1543 for (id = ids; id->id[0] || id->cls; id++) { in xgene_pmu_acpi_match_type()
1563 if (acpi_bus_get_status(adev) || !adev->status.present) in acpi_pmu_dev_add()
1570 ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, (u32)acpi_id->driver_data); in acpi_pmu_dev_add()
1576 devm_kfree(xgene_pmu->dev, ctx); in acpi_pmu_dev_add()
1580 switch (ctx->inf.type) { in acpi_pmu_dev_add()
1582 list_add(&ctx->next, &xgene_pmu->l3cpmus); in acpi_pmu_dev_add()
1585 list_add(&ctx->next, &xgene_pmu->iobpmus); in acpi_pmu_dev_add()
1588 list_add(&ctx->next, &xgene_pmu->iobpmus); in acpi_pmu_dev_add()
1591 list_add(&ctx->next, &xgene_pmu->mcbpmus); in acpi_pmu_dev_add()
1594 list_add(&ctx->next, &xgene_pmu->mcpmus); in acpi_pmu_dev_add()
1603 struct device *dev = xgene_pmu->dev; in acpi_pmu_probe_pmu_dev()
1609 return -EINVAL; in acpi_pmu_probe_pmu_dev()
1615 return -ENODEV; in acpi_pmu_probe_pmu_dev()
1632 struct device *dev = xgene_pmu->dev; in fdt_get_pmu_hw_inf()
1654 /* A PMU device node without enable-bit-index is always enabled */ in fdt_get_pmu_hw_inf()
1655 if (of_property_read_u32(np, "enable-bit-index", &enable_bit)) in fdt_get_pmu_hw_inf()
1658 ctx->name = xgene_pmu_dev_name(dev, type, enable_bit); in fdt_get_pmu_hw_inf()
1659 if (!ctx->name) { in fdt_get_pmu_hw_inf()
1664 inf = &ctx->inf; in fdt_get_pmu_hw_inf()
1665 inf->type = type; in fdt_get_pmu_hw_inf()
1666 inf->csr = dev_csr; in fdt_get_pmu_hw_inf()
1667 inf->enable_mask = 1 << enable_bit; in fdt_get_pmu_hw_inf()
1678 for_each_child_of_node(pdev->dev.of_node, np) { in fdt_pmu_probe_pmu_dev()
1682 if (of_device_is_compatible(np, "apm,xgene-pmu-l3c")) in fdt_pmu_probe_pmu_dev()
1684 else if (of_device_is_compatible(np, "apm,xgene-pmu-iob")) in fdt_pmu_probe_pmu_dev()
1686 else if (of_device_is_compatible(np, "apm,xgene-pmu-mcb")) in fdt_pmu_probe_pmu_dev()
1688 else if (of_device_is_compatible(np, "apm,xgene-pmu-mc")) in fdt_pmu_probe_pmu_dev()
1698 devm_kfree(xgene_pmu->dev, ctx); in fdt_pmu_probe_pmu_dev()
1702 switch (ctx->inf.type) { in fdt_pmu_probe_pmu_dev()
1704 list_add(&ctx->next, &xgene_pmu->l3cpmus); in fdt_pmu_probe_pmu_dev()
1707 list_add(&ctx->next, &xgene_pmu->iobpmus); in fdt_pmu_probe_pmu_dev()
1710 list_add(&ctx->next, &xgene_pmu->iobpmus); in fdt_pmu_probe_pmu_dev()
1713 list_add(&ctx->next, &xgene_pmu->mcbpmus); in fdt_pmu_probe_pmu_dev()
1716 list_add(&ctx->next, &xgene_pmu->mcpmus); in fdt_pmu_probe_pmu_dev()
1727 if (has_acpi_companion(&pdev->dev)) in xgene_pmu_probe_pmu_dev()
1775 { .compatible = "apm,xgene-pmu", .data = &xgene_pmu_data },
1776 { .compatible = "apm,xgene-pmu-v2", .data = &xgene_pmu_v2_data },
1795 if (cpumask_empty(&xgene_pmu->cpu)) in xgene_pmu_online_cpu()
1796 cpumask_set_cpu(cpu, &xgene_pmu->cpu); in xgene_pmu_online_cpu()
1799 WARN_ON(irq_set_affinity(xgene_pmu->irq, &xgene_pmu->cpu)); in xgene_pmu_online_cpu()
1811 if (!cpumask_test_and_clear_cpu(cpu, &xgene_pmu->cpu)) in xgene_pmu_offline_cpu()
1817 list_for_each_entry(ctx, &xgene_pmu->mcpmus, next) { in xgene_pmu_offline_cpu()
1818 perf_pmu_migrate_context(&ctx->pmu_dev->pmu, cpu, target); in xgene_pmu_offline_cpu()
1820 list_for_each_entry(ctx, &xgene_pmu->mcbpmus, next) { in xgene_pmu_offline_cpu()
1821 perf_pmu_migrate_context(&ctx->pmu_dev->pmu, cpu, target); in xgene_pmu_offline_cpu()
1823 list_for_each_entry(ctx, &xgene_pmu->l3cpmus, next) { in xgene_pmu_offline_cpu()
1824 perf_pmu_migrate_context(&ctx->pmu_dev->pmu, cpu, target); in xgene_pmu_offline_cpu()
1826 list_for_each_entry(ctx, &xgene_pmu->iobpmus, next) { in xgene_pmu_offline_cpu()
1827 perf_pmu_migrate_context(&ctx->pmu_dev->pmu, cpu, target); in xgene_pmu_offline_cpu()
1830 cpumask_set_cpu(target, &xgene_pmu->cpu); in xgene_pmu_offline_cpu()
1832 WARN_ON(irq_set_affinity(xgene_pmu->irq, &xgene_pmu->cpu)); in xgene_pmu_offline_cpu()
1854 xgene_pmu = devm_kzalloc(&pdev->dev, sizeof(*xgene_pmu), GFP_KERNEL); in xgene_pmu_probe()
1856 return -ENOMEM; in xgene_pmu_probe()
1857 xgene_pmu->dev = &pdev->dev; in xgene_pmu_probe()
1860 version = -EINVAL; in xgene_pmu_probe()
1861 of_id = of_match_device(xgene_pmu_of_match, &pdev->dev); in xgene_pmu_probe()
1863 dev_data = (const struct xgene_pmu_data *) of_id->data; in xgene_pmu_probe()
1864 version = dev_data->id; in xgene_pmu_probe()
1868 if (ACPI_COMPANION(&pdev->dev)) { in xgene_pmu_probe()
1871 acpi_id = acpi_match_device(xgene_pmu_acpi_match, &pdev->dev); in xgene_pmu_probe()
1873 version = (int) acpi_id->driver_data; in xgene_pmu_probe()
1877 return -ENODEV; in xgene_pmu_probe()
1880 xgene_pmu->ops = &xgene_pmu_v3_ops; in xgene_pmu_probe()
1882 xgene_pmu->ops = &xgene_pmu_ops; in xgene_pmu_probe()
1884 INIT_LIST_HEAD(&xgene_pmu->l3cpmus); in xgene_pmu_probe()
1885 INIT_LIST_HEAD(&xgene_pmu->iobpmus); in xgene_pmu_probe()
1886 INIT_LIST_HEAD(&xgene_pmu->mcbpmus); in xgene_pmu_probe()
1887 INIT_LIST_HEAD(&xgene_pmu->mcpmus); in xgene_pmu_probe()
1889 xgene_pmu->version = version; in xgene_pmu_probe()
1890 dev_info(&pdev->dev, "X-Gene PMU version %d\n", xgene_pmu->version); in xgene_pmu_probe()
1893 xgene_pmu->pcppmu_csr = devm_ioremap_resource(&pdev->dev, res); in xgene_pmu_probe()
1894 if (IS_ERR(xgene_pmu->pcppmu_csr)) { in xgene_pmu_probe()
1895 dev_err(&pdev->dev, "ioremap failed for PCP PMU resource\n"); in xgene_pmu_probe()
1896 return PTR_ERR(xgene_pmu->pcppmu_csr); in xgene_pmu_probe()
1901 return -EINVAL; in xgene_pmu_probe()
1903 rc = devm_request_irq(&pdev->dev, irq, xgene_pmu_isr, in xgene_pmu_probe()
1905 dev_name(&pdev->dev), xgene_pmu); in xgene_pmu_probe()
1907 dev_err(&pdev->dev, "Could not request IRQ %d\n", irq); in xgene_pmu_probe()
1911 xgene_pmu->irq = irq; in xgene_pmu_probe()
1913 raw_spin_lock_init(&xgene_pmu->lock); in xgene_pmu_probe()
1915 /* Check for active MCBs and MCUs */ in xgene_pmu_probe()
1918 dev_warn(&pdev->dev, "Unknown MCB/MCU active status\n"); in xgene_pmu_probe()
1919 xgene_pmu->mcb_active_mask = 0x1; in xgene_pmu_probe()
1920 xgene_pmu->mc_active_mask = 0x1; in xgene_pmu_probe()
1925 &xgene_pmu->node); in xgene_pmu_probe()
1927 dev_err(&pdev->dev, "Error %d registering hotplug", rc); in xgene_pmu_probe()
1934 dev_err(&pdev->dev, "No PMU perf devices found!\n"); in xgene_pmu_probe()
1939 xgene_pmu->ops->unmask_int(xgene_pmu); in xgene_pmu_probe()
1945 &xgene_pmu->node); in xgene_pmu_probe()
1955 perf_pmu_unregister(&ctx->pmu_dev->pmu); in xgene_pmu_dev_cleanup()
1961 struct xgene_pmu *xgene_pmu = dev_get_drvdata(&pdev->dev); in xgene_pmu_remove()
1963 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->l3cpmus); in xgene_pmu_remove()
1964 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->iobpmus); in xgene_pmu_remove()
1965 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->mcbpmus); in xgene_pmu_remove()
1966 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->mcpmus); in xgene_pmu_remove()
1968 &xgene_pmu->node); in xgene_pmu_remove()
1977 .name = "xgene-pmu",