Blame src/perfctr-2.6.x/usr.lib/event_set_ppc.c

Packit 577717
/* $Id: event_set_ppc.c,v 1.2.2.1 2004/08/02 22:26:42 mikpe Exp $
Packit 577717
 * Descriptions of the events available for different processor types.
Packit 577717
 *
Packit 577717
 * Copyright (C) 2004  Mikael Pettersson
Packit 577717
 */
Packit 577717
#include <stddef.h>	/* for NULL */
Packit 577717
#include "libperfctr.h"
Packit 577717
#include "event_set.h"
Packit 577717
Packit 577717
/*
Packit 577717
 * XXX: a few events use the TBSEL and THRESHOLD fields in MMCR0.
Packit 577717
 * They should have unit mask descriptors.
Packit 577717
 */
Packit 577717
Packit 577717
/*
Packit 577717
 * PowerPC common events for PMC1-PMC4, introduced in 604.
Packit 577717
 */
Packit 577717
Packit 577717
static const struct perfctr_event ppc_common_events[] = {
Packit 577717
    { 0x00, 0x0F, NULL, "NOTHING",
Packit 577717
      "Nothing. Register counter holds current value" },
Packit 577717
    { 0x01, 0x0F, NULL, "PROCESSOR_CYCLES",
Packit 577717
      "Processor cycles. Count every cycle" },
Packit 577717
    { 0x02, 0x0F, NULL, "INSTRUCTIONS_COMPLETED",
Packit 577717
      "Number of instructions completed. Does not include folded branches" },
Packit 577717
    { 0x03, 0x0F, NULL, "TBL_BIT_TRANSITIONS", /* XXX: depends on MMCR0[TBSEL] */
Packit 577717
      "Time-base (lower) bit transition" },
Packit 577717
    { 0x04, 0x0F, NULL, "INSTRUCTIONS_DISPATCHED",
Packit 577717
      "Number of instructions dispatched" },
Packit 577717
};
Packit 577717
Packit 577717
static const struct perfctr_event_set ppc_common_event_set = {
Packit 577717
    .cpu_type = PERFCTR_PPC_604,
Packit 577717
    .event_prefix = "PPC604_",
Packit 577717
    .include = NULL,
Packit 577717
    .nevents = ARRAY_SIZE(ppc_common_events),
Packit 577717
    .events = ppc_common_events,
Packit 577717
};
Packit 577717
Packit 577717
/*
Packit 577717
 * PowerPC 604 events.
Packit 577717
 */
Packit 577717
Packit 577717
static const struct perfctr_event ppc604_events[] = {
Packit 577717
    /*
Packit 577717
     * PMC1 events.
Packit 577717
     */
Packit 577717
    { 0x05, 0x01, NULL, "ICACHE_MISSES",
Packit 577717
      "Instruction cache misses" },
Packit 577717
    { 0x06, 0x01, NULL, "DTLB_MISSES",
Packit 577717
      "Data TLB misses (in order)" },
Packit 577717
    { 0x07, 0x01, NULL, "BRANCH_MISPREDICT_CORRECTION",
Packit 577717
      "Branch misprediction correction from execute stage" },
Packit 577717
    { 0x08, 0x01, NULL, "RESERVATIONS_REQUESTED",
Packit 577717
      "Number of reservations requested. The lwarx instruction is ready "
Packit 577717
      "for execution in the LSU" },
Packit 577717
    { 0x09, 0x01, NULL, "DCACHE_LOAD_MISSES_LATERAL", /* XXX: depends on threshold value */
Packit 577717
      "Number of data cache load misses exceeding the threshold value "
Packit 577717
      "with lateral L2 cache intervention" },
Packit 577717
    { 0x0A, 0x01, NULL, "DCACHE_STORE_MISSES_LATERAL", /* XXX: depends on threshold value */
Packit 577717
      "Number of data cache store misses exceeding the threshold value "
Packit 577717
      "with lateral L2 cache intervention" },
Packit 577717
    { 0x0B, 0x01, NULL, "MTSPR_DISPATCHED",
Packit 577717
      "Number of mtspr instructions dispatched" },
Packit 577717
    { 0x0C, 0x01, NULL, "SYNC_COMPLETED",
Packit 577717
      "Number of sync instructions completed" },
Packit 577717
    { 0x0D, 0x01, NULL, "EIEIO_COMPLETED",
Packit 577717
      "Number of eieio instructions completed" },
Packit 577717
    { 0x0E, 0x01, NULL, "INTEGER_INSTRUCTIONS_COMPLETED",
Packit 577717
      "Number of integer instructions completed every cycle "
Packit 577717
      "(no loads or stores)" },
Packit 577717
    { 0x0F, 0x01, NULL, "FP_INSTRUCTIONS_COMPLETED",
Packit 577717
      "Number of floating-point instructions completed every cycle "
Packit 577717
      "(no loads or stores)" },
Packit 577717
    { 0x10, 0x01, NULL, "LSU_RESULT",
Packit 577717
      "LSU produced result" },
Packit 577717
    { 0x11, 0x01, NULL, "SCIU1_RESULT",
Packit 577717
      "SCIU1 produced result for an add, subtract, compare, rotate, "
Packit 577717
      "shift, or logical instruction" },
Packit 577717
    { 0x12, 0x01, NULL, "FPU_RESULT",
Packit 577717
      "FPU produced result" },
Packit 577717
    { 0x13, 0x01, NULL, "INSTRUCTIONS_DISPATCHED_LSU",
Packit 577717
      "Number of instructions dispatched to the LSU" },
Packit 577717
    { 0x14, 0x01, NULL, "INSTRUCTIONS_DISPATCHED_SCIU1",
Packit 577717
      "Number of instructions dispatched to the SCIU1" },
Packit 577717
    { 0x15, 0x01, NULL, "INSTRUCTIONS_DISPATCHED_FPU",
Packit 577717
      "Number of instructions dispatched to the FPU" },
Packit 577717
    { 0x16, 0x01, NULL, "SNOOPS_RECEIVED",
Packit 577717
      "Valid snoop requests received from outside the 604e. "
Packit 577717
      "Does not distinguish hits or misses" },
Packit 577717
    { 0x17, 0x01, NULL, "DCACHE_LOAD_MISSES", /* XXX: depends on threshold value */
Packit 577717
      "Number of data cache load misses exceeeding the threshold value "
Packit 577717
      "without lateral L2 intervention" },
Packit 577717
    { 0x18, 0x01, NULL, "DCACHE_STORE_MISSES", /* XXX: depends on threshold value */
Packit 577717
      "Number of data cache store misses exceeding the threshold value "
Packit 577717
      "without lateral L2 intervention" },
Packit 577717
    { 0x19, 0x01, NULL, "BRANCH_UNIT_IDLE",
Packit 577717
      "Number of cycles the branch unit is idle" },
Packit 577717
    { 0x1A, 0x01, NULL, "MCIU0_IDLE",
Packit 577717
      "Number of cycles MCIU0 is idle" },
Packit 577717
    { 0x1B, 0x01, NULL, "LSU_IDLE",
Packit 577717
      "Number of cycles the LSU is idle. No new instructions are executing; "
Packit 577717
      "however, active loads or stores may be in the queues" },
Packit 577717
    { 0x1C, 0x01, NULL, "L2_INT_ASSERTED",
Packit 577717
      "Number of times the L2_INT is asserted (regardless of TA state)" },
Packit 577717
    { 0x1D, 0x01, NULL, "UNALIGNED_LOADS",
Packit 577717
      "Number of unaligned loads" },
Packit 577717
    { 0x1E, 0x01, NULL, "LOAD_QUEUE_ENTRIES",
Packit 577717
      "Number of entries in the load queue each cycle (maximum of five). "
Packit 577717
      "Although the load queue has four entries, a load miss latch may "
Packit 577717
      "hold a load waiting for data from memory" },
Packit 577717
    { 0x1F, 0x01, NULL, "INSTRUCTION_BREAKPOINT_HITS",
Packit 577717
      "Number of instruction breakpoint hits" },
Packit 577717
    /*
Packit 577717
     * PMC2 events.
Packit 577717
     */
Packit 577717
    { 0x05, 0x02, NULL, "LOAD_MISS_CYCLES",
Packit 577717
      "Number of cycles a load miss takes" },
Packit 577717
    { 0x06, 0x02, NULL, "DATA_CACHE_MISSES",
Packit 577717
      "Data cache misses (in order)" },
Packit 577717
    { 0x07, 0x02, NULL, "ITLB_MISSES",
Packit 577717
      "Number of instruction TLB misses" },
Packit 577717
    { 0x08, 0x02, NULL, "BRANCHES_COMPLETED",
Packit 577717
      "Number of branches completed. Indicates the number of branch "
Packit 577717
      "instructions being completed every cycle (00 = none, 10 = one, "
Packit 577717
      "11 = two, 01 is an illegal value)" },
Packit 577717
    { 0x09, 0x02, NULL, "RESERVATIONS_OBTAINED",
Packit 577717
      "Number of reservations successfully obtained (stwcx. operation "
Packit 577717
      "completed successfully)" },
Packit 577717
    { 0x0A, 0x02, NULL, "MFSPR_DISPATCHED",
Packit 577717
      "Number of mfspr instructions dispatched (in order)" },
Packit 577717
    { 0x0B, 0x02, NULL, "ICBI_INSTRUCTIONS",
Packit 577717
      "Number of icbi instructions. It may not hit in the cache" },
Packit 577717
    { 0x0C, 0x02, NULL, "PIPELINE_FLUSH_INSTRUCTIONS",
Packit 577717
      "Number of pipeline flushing instructions (sc, isync, mtspr(XER), "
Packit 577717
      "mcrcr, floating-point operation with divide by 0 or invalid operand "
Packit 577717
      "and MSR[FE0,FE1] = 00, branch with MSR[BE] = 1, load string "
Packit 577717
      "indexed with XER = 0, and SO bit getting set)" },
Packit 577717
    { 0x0D, 0x02, NULL, "BPU_RESULT",
Packit 577717
      "BPU produced result" },
Packit 577717
    { 0x0E, 0x02, NULL, "SCIU0_RESULT",
Packit 577717
      "SCIU0 produced result (of an add, subtract, compare, rotate, "
Packit 577717
      "shift, or logical instruction" },
Packit 577717
    { 0x0F, 0x02, NULL, "MCIU_RESULT",
Packit 577717
      "MCIU poduced result (of a multiply/divide or SPR instruction)" },
Packit 577717
    { 0x10, 0x02, NULL, "INSTRUCTIONS_DISPATCHED_BRANCH",
Packit 577717
      "Number of instructions dispatched to the branch unit" },
Packit 577717
    { 0x11, 0x02, NULL, "INSTRUCTIONS_DISPATCHED_SCIU0",
Packit 577717
      "Number of instructions dispatched to the SCIU0" },
Packit 577717
    { 0x12, 0x02, NULL, "LOADS_COMPLETED",
Packit 577717
      "Number of loads completed. These include all cache operations "
Packit 577717
      "and tlbie, tlbsync, sync, eieio, and icbi instructions" },
Packit 577717
    { 0x13, 0x02, NULL, "INSTRUCTIONS_DISPATCHED_MCIU",
Packit 577717
      "Number of instructions dispatched to the MCIU" },
Packit 577717
    { 0x14, 0x02, NULL, "SNOOP_HITS",
Packit 577717
      "Number of snoop hits occurred" },
Packit 577717
    { 0x15, 0x02, NULL, "INTERRUPTS_MASKED",
Packit 577717
      "Number of cycles during which the MSR[EE] bit is cleared" },
Packit 577717
    { 0x16, 0x02, NULL, "MCIU_IDLE",
Packit 577717
      "Number of cycles the MCIU is idle" },
Packit 577717
    { 0x17, 0x02, NULL, "SCIU1_IDLE",
Packit 577717
      "Number of cycles SCIU1 is idle" },
Packit 577717
    { 0x18, 0x02, NULL, "FPU_IDLE",
Packit 577717
      "Number of cycles the FPU is idle" },
Packit 577717
    { 0x19, 0x02, NULL, "L2_INT_ACTIVE",
Packit 577717
      "Number of cycles the L2_INT signal is active (regardless of TA state)" },
Packit 577717
    { 0x1A, 0x02, NULL, "DISPATCHED_4_INSTRUCTIONS",
Packit 577717
      "Number of times four instructions were dispatched" },
Packit 577717
    { 0x1B, 0x02, NULL, "DISPATCHED_3_INSTRUCTIONS",
Packit 577717
      "Number of times three instructions were dispatched" },
Packit 577717
    { 0x1C, 0x02, NULL, "DISPATCHED_2_INSTRUCTIONS",
Packit 577717
      "Number of times two instructions were dispatched" },
Packit 577717
    { 0x1D, 0x02, NULL, "DISPATCHED_1_INSTRUCTION",
Packit 577717
      "Number of times one instruction was dispatched" },
Packit 577717
    { 0x1E, 0x02, NULL, "UNALIGNED_STORES",
Packit 577717
      "Number of unaligned stores" },
Packit 577717
    { 0x1F, 0x02, NULL, "STORE_QUEUE_ENTRIES",
Packit 577717
      "Number of entries in the store queue each cycle (maximum of six)" },
Packit 577717
};
Packit 577717
Packit 577717
const struct perfctr_event_set perfctr_ppc604_event_set = {
Packit 577717
    .cpu_type = PERFCTR_PPC_604,
Packit 577717
    .event_prefix = "PPC604_",
Packit 577717
    .include = &ppc_common_event_set,
Packit 577717
    .nevents = ARRAY_SIZE(ppc604_events),
Packit 577717
    .events = ppc604_events,
Packit 577717
};
Packit 577717
Packit 577717
/*
Packit 577717
 * PowerPC 604e events.
Packit 577717
 * Extends PPC604 with two new counters and corresponding events.
Packit 577717
 */
Packit 577717
Packit 577717
static const struct perfctr_event ppc604e_events[] = {
Packit 577717
    /*
Packit 577717
     * PMC3 events
Packit 577717
     */
Packit 577717
    { 0x05, 0x04, NULL, "LSU_STALL_BIU",
Packit 577717
      "Number of cycles the LSU stalls due to BIU or cache busy. "
Packit 577717
      "Counts cycles between when a load or store request is made and "
Packit 577717
      "a response was expected. For example, when a store is retried, "
Packit 577717
      "there are four cycles before the same instruction is presented "
Packit 577717
      "to the cache again. Cycles in between are not counted" },
Packit 577717
    { 0x06, 0x04, NULL, "LSU_STALL_STORE_QUEUE",
Packit 577717
      "Number of cycles the LSU stalls due to a full store queue" },
Packit 577717
    { 0x07, 0x04, NULL, "LSU_STALL_OPERANDS",
Packit 577717
      "Number of cycles the LSU stalls due to operands not available "
Packit 577717
      "in the reservation station" },
Packit 577717
    { 0x08, 0x04, NULL, "LOAD_QUEUE_INSTRUCTIONS",
Packit 577717
      "Number of instructions written into the load queue. Misaligned "
Packit 577717
      "loads are split into two transactions with the first part always "
Packit 577717
      "written into the load queue. If both parts are cache hits, data "
Packit 577717
      "is returned to the rename registers and the first part is flushed "
Packit 577717
      "from the load queue. To count the instructions that enter the "
Packit 577717
      "load queue to stay, the misaligned load hits must be subtracted. "
Packit 577717
      "See event 8 for PMC4" },
Packit 577717
    { 0x09, 0x04, NULL, "STORE_COMPLETION_STALLS",
Packit 577717
      "Number of cycles that completion stalls for a store instruction" },
Packit 577717
    { 0x0A, 0x04, NULL, "UNFINISHED_COMPLETION_STALLS",
Packit 577717
      "Number of cycles the completion stalls for an unfinished "
Packit 577717
      "instruction. This event is a superset of PMC3 event 9 and "
Packit 577717
      "PMC4 event 10" },
Packit 577717
    { 0x0B, 0x04, NULL, "SYSTEM_CALLS",
Packit 577717
      "Number of system calls" },
Packit 577717
    { 0x0C, 0x04, NULL, "BPU_STALL",
Packit 577717
      "Number of cycles the BPU stalled as branch waits for its operand" },
Packit 577717
    { 0x0D, 0x04, NULL, "FETCH_CORRECTIONS_DISPATCH",
Packit 577717
      "Number of fetch corrections made at the dispatch stage. "
Packit 577717
      "Prioritized behind the execute stage" },
Packit 577717
    { 0x0E, 0x04, NULL, "DISPATCH_STALL_NO_INSTRUCTIONS",
Packit 577717
      "Number of cycles the dispatch stalls waiting for instructions" },
Packit 577717
    { 0x0F, 0x04, NULL, "DISPATCH_STALL_NO_ROB",
Packit 577717
      "Number of cycles the dispatch unit stalls due to unavailability "
Packit 577717
      "of reorder buffer (ROB) entry. No ROB entry was available for "
Packit 577717
      "the first nondispatched instruction" },
Packit 577717
    { 0x10, 0x04, NULL, "DISPATCH_STALL_NO_FPR",
Packit 577717
      "Number of cycles the dispatch unit stalls due to no FPR rename "
Packit 577717
      "buffer available. First nondispatched instruction required a "
Packit 577717
      "floating-point reorder buffer and none was available" },
Packit 577717
    { 0x11, 0x04, NULL, "INSTRUCTION_TABLE_SEARCH_COUNT",
Packit 577717
      "Number of instruction table search operations" },
Packit 577717
    { 0x12, 0x04, NULL, "DATA_TABLE_SEARCH_COUNT",
Packit 577717
      "Number of data table search operations. Completion could "
Packit 577717
      "result from a page fault or a PTE match" },
Packit 577717
    { 0x13, 0x04, NULL, "FPU_STALL",
Packit 577717
      "Number of cycles the FPU stalled" },
Packit 577717
    { 0x14, 0x04, NULL, "SCIU1_STALL",
Packit 577717
      "Number of cycles the SCIU1 stalled" },
Packit 577717
    { 0x15, 0x04, NULL, "BIU_FORWARDS",
Packit 577717
      "Number of times the BIU forwards noncritical data from the "
Packit 577717
      "line-fill buffer" },
Packit 577717
    { 0x16, 0x04, NULL, "DATA_BUS_TRANSACTIONS_NO_QUEUE",
Packit 577717
      "Number of data bus transactions completed with pipelining one "
Packit 577717
      "deep with no additional bus transactions queued behind it " },
Packit 577717
    { 0x17, 0x04, NULL, "DATA_BUS_TRANSACTIONS_TWO_QUEUED",
Packit 577717
      "Number of data bus transactions completed with two data bus "
Packit 577717
      "transactions queued behind" },
Packit 577717
    { 0x18, 0x04, NULL, "BURST_READS",
Packit 577717
      "Counts pairs of back-to-back burst reads streamed without a "
Packit 577717
      "dead cycle between them in data streaming mode" },
Packit 577717
    { 0x19, 0x04, NULL, "WRITE_HIT_ON_SHARED",
Packit 577717
      "Counts non-ARTRYd processor kill transactions caused by a "
Packit 577717
      "write-hit-on-shared condition" },
Packit 577717
    { 0x1A, 0x04, NULL, "WRITE_WITH_KILL",
Packit 577717
      "This event counts non-ARTRYd write-with-kill address operations "
Packit 577717
      "that originate from the three castout buffers. These include "
Packit 577717
      "high-priority write-with-kill transactions caused by a snoop hit "
Packit 577717
      "on modified data in one of the BIU's three copy-back buffers. "
Packit 577717
      "When the cache block on a data cache miss is modified, it is "
Packit 577717
      "queued in one of the three copy-back buffers. The miss is serviced "
Packit 577717
      "before the copy-back buffer is written back to memory as a "
Packit 577717
      "write-with-kill transaction" },
Packit 577717
    { 0x1B, 0x04, NULL, "TWO_CASTOUT_BUFFERS_OCCUPIED",
Packit 577717
      "Number of cycles when exactly two castout buffers are occupied" },
Packit 577717
    { 0x1C, 0x04, NULL, "DATA_CACHE_RETRIES",
Packit 577717
      "Number of data cache accesses retried due to occupied castout buffers" },
Packit 577717
    { 0x1D, 0x04, NULL, "SHARED_LOADS",
Packit 577717
      "Number of read transactions from load misses brought into the "
Packit 577717
      "cache in a shared state" },
Packit 577717
    { 0x1E, 0x04, NULL, "CR_LOGICAL_FINISHED",
Packit 577717
      "CRU indicates that a CR logical instruction is being finished" },
Packit 577717
    /*
Packit 577717
     * PMC4 events
Packit 577717
     */
Packit 577717
    { 0x05, 0x08, NULL, "LSU_STALL_MMU",
Packit 577717
      "Number of cycles the LSU stalls due to busy MMU" },
Packit 577717
    { 0x06, 0x08, NULL, "LSU_STALL_LOAD_QUEUE",
Packit 577717
      "Number of cycles the LSU stalls due to the load queue full" },
Packit 577717
    { 0x07, 0x08, NULL, "LSU_STALL_ADDRESS",
Packit 577717
      "Number of cycles the LSU stalls due to address collision" },
Packit 577717
    { 0x08, 0x08, NULL, "MISALIGNED_LOAD_HITS",
Packit 577717
      "Number of misaligned loads that are cache hits for both the "
Packit 577717
      "first and second accesses. Related to event 8 in PMC3" },
Packit 577717
    { 0x09, 0x08, NULL, "STORE_QUEUE_INSTRUCTIONS",
Packit 577717
      "Number of instructions written into the store queue" },
Packit 577717
    { 0x0A, 0x08, NULL, "LOAD_COMPLETION_STALLS",
Packit 577717
      "Number of cycles that completion stalls for a load instruction" },
Packit 577717
    { 0x0B, 0x08, NULL, "BTAC_HITS",
Packit 577717
      "Number of hits in the BTAC. Warning--if decode buffers cannot "
Packit 577717
      "accept new instructions, the processor refetches the same "
Packit 577717
      "address multiple times" },
Packit 577717
    { 0x0C, 0x08, NULL, "COMPLETION_USED_FOUR_BLOCKS",
Packit 577717
      "Number of times the four basic blocks in the completion buffer "
Packit 577717
      "from which instructions can be retired were used" },
Packit 577717
    { 0x0D, 0x08, NULL, "FETCH_CORRECTIONS_DECODE",
Packit 577717
      "Number of fetch corrections made at decode stage" },
Packit 577717
    { 0x0E, 0x08, NULL, "DISPATCH_STALL_NO_UNIT",
Packit 577717
      "Number of cycles the dispatch unit stalls due to no unit available. "
Packit 577717
      "First nondispatched instruction requires an execution unit that is "
Packit 577717
      "either full or a previous instruction is being dispatched to that unit" },
Packit 577717
    { 0x0F, 0x08, NULL, "DISPATCH_STALL_GPR",
Packit 577717
      "Number of cycles the dispatch unit stalls due to unavailability of "
Packit 577717
      "GPR rename buffer. First nondispatched instruction requires a GPR "
Packit 577717
      "reorder buffer and none are available" },
Packit 577717
    { 0x10, 0x08, NULL, "DISPATCH_STALL_CR",
Packit 577717
      "Number of cycles the dispatch unit stalls due to no CR rename "
Packit 577717
      "buffer available. First nondispatched instruction requires a "
Packit 577717
      "CR rename buffer and none is available" },
Packit 577717
    { 0x11, 0x08, NULL, "DISPATCH_STALL_CTR_LR",
Packit 577717
      "Number of cycles the dispatch unit stalls due to CTR/LR interlock. "
Packit 577717
      "First nondispatched instruction could not dispatch due to "
Packit 577717
      "CTR/LR/mtcrf interlock" },
Packit 577717
    { 0x12, 0x08, NULL, "INSTRUCTION_TABLE_SEARCH_CYCLES",
Packit 577717
      "Number of cycles spent doing instruction table search operations" },
Packit 577717
    { 0x13, 0x08, NULL, "DATA_TABLE_SEARCH_CYCLES",
Packit 577717
      "Number of cycles spent doing data table search operations" },
Packit 577717
    { 0x14, 0x08, NULL, "SCIU0_STALL",
Packit 577717
      "Number of cycles SCIU0 was stalled" },
Packit 577717
    { 0x15, 0x08, NULL, "MCIU_STALL",
Packit 577717
      "Number of cycles MCIU was stalled" },
Packit 577717
    { 0x16, 0x08, NULL, "BUS_REQUEST_NO_QUALIFIED_GRANT",
Packit 577717
      "Number of bus cycles after an internal bus request without "
Packit 577717
      "a qualified bus grant" },
Packit 577717
    { 0x17, 0x08, NULL, "DATA_BUS_TRANSACTIONS_ONE_QUEUED",
Packit 577717
      "Number of data bus transactions completed with one data bus "
Packit 577717
      "transaction queued behind" },
Packit 577717
    { 0x18, 0x08, NULL, "REORDERED_WRITES",
Packit 577717
      "Number of write data transactions that have been reordered before "
Packit 577717
      "a previous read data transaction using the DBWO feature" },
Packit 577717
    { 0x19, 0x08, NULL, "ARTRYd_ADDRESS_TRANSACTIONS",
Packit 577717
      "Number of ARTRYd processor address bus transactions" },
Packit 577717
    { 0x1A, 0x08, NULL, "HIGH_PRIORITY_SNOOP_PUSHES",
Packit 577717
      "Number of high-priority snoop pushes. Snoop transactions, except "
Packit 577717
      "for write-with-kill, that hit modified data in the data cache cause "
Packit 577717
      "a high-priority write (snoop push) of that modified cache block to "
Packit 577717
      "memory. This operation has a transaction type of write-with-kill. "
Packit 577717
      "This events counts the number of non-ARTRYd processor write-with-kill "
Packit 577717
      "transactions that were caused by a snoop hit on modified data in the "
Packit 577717
      "data cache. It does not count high-priority write-with-kill "
Packit 577717
      "transactions caused by snoop hits on modified data in one of the "
Packit 577717
      "BIU's three copy-back buffers" },
Packit 577717
    { 0x1B, 0x08, NULL, "ONE_CASTOUT_BUFFER_OCCUPIED",
Packit 577717
      "Number of cycles for which exactly one castout buffer is occupied" },
Packit 577717
    { 0x1C, 0x08, NULL, "THREE_CASTOUT_BUFFERS_OCCUPIED",
Packit 577717
      "Number of cycles for which exactly three castout buffers are occupied" },
Packit 577717
    { 0x1D, 0x08, NULL, "EXCLUSIVE_LOADS",
Packit 577717
      "Number of read transactions from load misses brought into the "
Packit 577717
      "cache in an exclusive (E) state" },
Packit 577717
    { 0x1E, 0x08, NULL, "UNDISPATCHED_INSTRUCTIONS",
Packit 577717
      "Number of undispatched instructions beyond branch" },
Packit 577717
};
Packit 577717
Packit 577717
const struct perfctr_event_set perfctr_ppc604e_event_set = {
Packit 577717
    .cpu_type = PERFCTR_PPC_604e,
Packit 577717
    .event_prefix = "PPC604e_",
Packit 577717
    .include = &perfctr_ppc604_event_set,
Packit 577717
    .nevents = ARRAY_SIZE(ppc604e_events),
Packit 577717
    .events = ppc604e_events,
Packit 577717
};
Packit 577717
Packit 577717
/*
Packit 577717
 * PowerPC 750 events. (MPC750, PPC750, PPC750CX, PPC750FX, PPC750GX)
Packit 577717
 * Unrelated to PPC604/PPC604e, except for the common events 0-4.
Packit 577717
 */
Packit 577717
Packit 577717
static const struct perfctr_event ppc750_events[] = {
Packit 577717
    /*
Packit 577717
     * PMC1 events
Packit 577717
     */
Packit 577717
    { 0x05, 0x01, NULL, "EIEIO_INSTRUCTIONS",
Packit 577717
      "Number of eieio instructions completed" },
Packit 577717
    { 0x06, 0x01, NULL, "ITLB_TABLE_SEARCH_CYCLES",
Packit 577717
      "Number of cycles spent performing table search operations for the ITLB" },
Packit 577717
    { 0x07, 0x01, NULL, "L2_ACCESSES",
Packit 577717
      "Number of accesses that hit the L2. This event includes cache ops "
Packit 577717
      "(i.e., dcbz)" },
Packit 577717
    { 0x08, 0x01, NULL, "EAS_DELIVERED",
Packit 577717
      "Number of valid instruction EAs delivered to the memory subsystem" },
Packit 577717
    { 0x09, 0x01, NULL, "IABR_MATCHES",
Packit 577717
      "Number of times the address of an instruction being completed "
Packit 577717
      "matches the address in the IABR" },
Packit 577717
    { 0x0A, 0x01, NULL, "L1_LOAD_MISSES", /* XXX: depends on threshold value */
Packit 577717
      "Number of loads that miss the L1 with latencies that exceed "
Packit 577717
      "the threshold value" },
Packit 577717
    { 0x0B, 0x01, NULL, "UNRESOLVED_BRANCHES",
Packit 577717
      "Number of branches that are unresolved when processed" },
Packit 577717
    { 0x0C, 0x01, NULL, "SECOND_UNRESOLVED_BRANCH_STALLS",
Packit 577717
      "Number of cycles the dispatcher stalls due to a second unresolved "
Packit 577717
      "branch in the instruction stream" },
Packit 577717
    /* XXX: PPC750 defined PMC1 event 0x0D as L1_ICACHE_MISSES, but that
Packit 577717
       was probably an error. L1_ICACHE_MISSES is PMC2 event 0x05, and
Packit 577717
       MPC750/PPC750CX/PPC750FX/750GX don't define PMC1 event 0x0D at all. */
Packit 577717
    /*
Packit 577717
     * PMC2 events
Packit 577717
     */
Packit 577717
    { 0x05, 0x02, NULL, "L1_ICACHE_MISSES",
Packit 577717
      "Counts L1 instruction cache misses" },
Packit 577717
    { 0x06, 0x02, NULL, "ITLB_MISSES",
Packit 577717
      "Counts ITLB misses" },
Packit 577717
    { 0x07, 0x02, NULL, "L2_I_MISSES",
Packit 577717
      /* XXX: The L2 was L1 in IBM 7xx_um. Clearly a typo. */
Packit 577717
      "Counts L2 instruction misses" },
Packit 577717
    { 0x08, 0x02, NULL, "BRANCHES_NOT_TAKEN",
Packit 577717
      "Counts branches predicted or resolved not taken" },
Packit 577717
    { 0x09, 0x02, NULL, "PRIVILEGED_USER_SWITCHES",
Packit 577717
      "Counts MSR[PR] bit toggles" },
Packit 577717
    { 0x0A, 0x02, NULL, "RESERVED_LOADS",
Packit 577717
      "Counts times a reserved load operations completes" },
Packit 577717
    { 0x0B, 0x02, NULL, "LOADS_AND_STORES",
Packit 577717
      "Counts completed load and store instructions" },
Packit 577717
    { 0x0C, 0x02, NULL, "SNOOPS",
Packit 577717
      "Counts snoops to the L1 and the L2" },
Packit 577717
    { 0x0D, 0x02, NULL, "L1_CASTOUTS_TO_L2",
Packit 577717
      "Counts L1 cast-outs to the L2" },
Packit 577717
    { 0x0E, 0x02, NULL, "SYSTEM_UNIT_INSTRUCTIONS",
Packit 577717
      "Counts completed system unit instructions" },
Packit 577717
    { 0x0F, 0x02, NULL, "INSTRUCTION_FETCH_MISSES",
Packit 577717
      /* XXX: IBM 7xx_um describes this as counting cycles not occurrences */
Packit 577717
      "Counts instruction fetch misses in the L1" },
Packit 577717
    { 0x10, 0x02, NULL, "SPECULATIVE_BRANCHES",
Packit 577717
      "Counts branches allowing out-of-order execution that resolved correctly" },
Packit 577717
    /*
Packit 577717
     * PMC3 events
Packit 577717
     */
Packit 577717
    { 0x05, 0x04, NULL, "L1_DCACHE_MISSES",
Packit 577717
      "Number of L1 data cache misses. Does not include cache ops" },
Packit 577717
    { 0x06, 0x04, NULL, "DTLB_MISSES",
Packit 577717
      "Number of DTLB misses" },
Packit 577717
    { 0x07, 0x04, NULL, "L2_DATA_MISSES",
Packit 577717
      "Number of L2 data misses" },
Packit 577717
    { 0x08, 0x04, NULL, "TAKEN_BRANCHES",
Packit 577717
      /* XXX: PPC750/PPC750CX/PPC750FX/PPC750GX describe this as predicted & taken branches */
Packit 577717
      "Number of taken branches, including predicted branches" },
Packit 577717
    { 0x09, 0x04, NULL, "USER_MARKED_UNMARKED_TRANSITIONS",
Packit 577717
      /* XXX: PPC750 adds a "RESERVED" after the event description.
Packit 577717
	 PPC750CX/PPC750FX/PPC750GX mark event 0x9 as reserved. */
Packit 577717
      "Number of transitions between marked and unmarked processes while in "
Packit 577717
      "user mode. That is, the number of MSR[PM] bit toggles while the "
Packit 577717
      "processor is in user mode" },
Packit 577717
    { 0x0A, 0x04, NULL, "STORE_CONDITIONAL_INSTRUCTIONS",
Packit 577717
      "Number of store conditional instructions completed" },
Packit 577717
    { 0x0B, 0x04, NULL, "FPU_INSTRUCTIONS",
Packit 577717
      "Number of instructions completed from the FPU" },
Packit 577717
    { 0x0C, 0x04, NULL, "L2_CASTOUTS_MODIFIED_SNOOPS",
Packit 577717
      "Number of L2 castouts caused by snoops to modified lines" },
Packit 577717
    { 0x0D, 0x04, NULL, "L2_HITS",
Packit 577717
      "Number of cache operations that hit in the L2 cache" },
Packit 577717
    /* 0x0E: reserved */
Packit 577717
    { 0x0F, 0x04, NULL, "L1_LOAD_MISS_CYCLES",
Packit 577717
      "Number of cycles generated by L1 load misses" },
Packit 577717
    { 0x10, 0x04, NULL, "SECOND_STREAM_RESOLVED_BRANCHES",
Packit 577717
      "Number of branches in the second speculative stream that "
Packit 577717
      "resolve correctly" },
Packit 577717
    { 0x11, 0x04, NULL, "BPU_LR_CR_STALL_CYCLES",
Packit 577717
      "Number of cycles the BPU stalls due to LR or CR unresolved dependencies" },
Packit 577717
    /*
Packit 577717
     * PMC4 events
Packit 577717
     */
Packit 577717
    { 0x05, 0x08, NULL, "L2_CASTOUTS",
Packit 577717
      "Number of L2 castouts" },
Packit 577717
    { 0x06, 0x08, NULL, "DTLB_TABLE_SEARCH_CYCLES",
Packit 577717
      "Number of cycles spent performing table searches for DTLB accesses" },
Packit 577717
    /* 0x07: reserved */
Packit 577717
    { 0x08, 0x08, NULL, "MISPREDICTED_BRANCHES",
Packit 577717
      /* XXX: PPC750/PPC750CX/PPC750FX/PPC750GX add "RESERVED" after the event description */
Packit 577717
      "Number of mispredicted branches" },
Packit 577717
    { 0x09, 0x08, NULL, "SUPERVISOR_MARKED_UNMARKED_TRANSITIONS",
Packit 577717
      /* XXX: In MPC750UM first "supervisor" is "user", presumably a typo.
Packit 577717
	 PPC750/PPC750CX/PPC750FX/PPC750GX mark event 0x09 as reserved. */
Packit 577717
      "Number of transitions between marked and unmarked processes while in "
Packit 577717
      "supervisor mode. That is, the number of MSR[PM] bit toggles while the "
Packit 577717
      "processor is in supervisor mode" },
Packit 577717
    { 0x0A, 0x08, NULL, "STORE_CONDITIONAL_INSTRUCTIONS_RESERVATON_INTACT",
Packit 577717
      "Number of store conditional instructions completed with reservation "
Packit 577717
      "intact" },
Packit 577717
    { 0x0B, 0x08, NULL, "SYNC_INSTRUCTIONS",
Packit 577717
      "Number of completed sync instructions" },
Packit 577717
    { 0x0C, 0x08, NULL, "SNOOP_RETRIES",
Packit 577717
      "Number of snoop request retries" },
Packit 577717
    { 0x0D, 0x08, NULL, "INTEGER_OPERATIONS",
Packit 577717
      "Number of completed integer operations" },
Packit 577717
    { 0x0E, 0x08, NULL, "BPU_BLOCKED_CYCLES",
Packit 577717
      "Number of cycles the BPU cannot process new branches due to "
Packit 577717
      "having two unresolved branches" },
Packit 577717
    /* XXX: PPC750 defined PMC4 event 0x1F as L1_DCACHE_MISSES, but that
Packit 577717
       was probably an error. L1_DCACHE_MISSES is PMC3 event 0x05, and
Packit 577717
       MPC750/PPC750CX/PPC750FX/PPC750GX don't define PMC4 event 0x1F at all. */
Packit 577717
};
Packit 577717
Packit 577717
const struct perfctr_event_set perfctr_ppc750_event_set = {
Packit 577717
    .cpu_type = PERFCTR_PPC_750,
Packit 577717
    .event_prefix = "PPC750_",
Packit 577717
    .include = &ppc_common_event_set,
Packit 577717
    .nevents = ARRAY_SIZE(ppc750_events),
Packit 577717
    .events = ppc750_events,
Packit 577717
};
Packit 577717
Packit 577717
/*
Packit 577717
 * Helper function to translate a cpu_type code to an event_set pointer.
Packit 577717
 */
Packit 577717
Packit 577717
static const struct perfctr_event_set * const cpu_event_set[] = {
Packit 577717
    [PERFCTR_PPC_604] = &perfctr_ppc604_event_set,
Packit 577717
    [PERFCTR_PPC_604e] = &perfctr_ppc604e_event_set,
Packit 577717
    [PERFCTR_PPC_750] = &perfctr_ppc750_event_set,
Packit 577717
};
Packit 577717
Packit 577717
const struct perfctr_event_set *perfctr_cpu_event_set(unsigned cpu_type)
Packit 577717
{
Packit 577717
    if( cpu_type >= ARRAY_SIZE(cpu_event_set) )
Packit 577717
	return 0;
Packit 577717
    return cpu_event_set[cpu_type];
Packit 577717
}