Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B, System Programming Guide Part 2

Table Of Contents
Vol. 3 18-47
DEBUGGING AND PERFORMANCE MONITORING
Software Developer’s Manual, Volume 2A). If the version identifier is greater than
zero, architectural performance monitoring capability is supported. Software queries
the CPUID.0AH for the version identifier first; it then analyzes the value returned in
CPUID.0AH.EAX, CPUID.0AH.EBX to determine the facilities available.
In the initial implementation of architectural performance monitoring; software can
determine how many IA32_PERFEVTSELx/ IA32_PMCx MSR pairs are supported per
core, the bit-width of PMC, and the number of architectural performance monitoring
events available.
18.13.1.1 Architectural Performance Monitoring Version 1 Facilities
Architectural performance monitoring facilities include a set of performance moni-
toring counters and performance event select registers. These MSRs have the
following properties:
IA32_PMCx MSRs start at address 0C1H and occupy a contiguous block of MSR
address space; the number of MSRs per logical processor is reported using
CPUID.0AH:eax[15:8].
IA32_PERFEVTSELx MSRs start at address 186H and occupy a contiguous block
of MSR address space. Each performance event select register is paired with a
corresponding performance counter in the 0C1H address block.
The bit width of an IA32_PMCx MSR is reported using the
CPUID.0AH:eax[23:16]. Bits beyond the width of the programmable counter are
undefined, and are ignored when written to. In the initial implementation, the bit
width for read operations is reported using CPUID; write operations are limited to
the low 32 bits of registers.
Bit field layout of IA32_PERFEVTSELx MSRs is defined architecturally.
See Figure 18-13 for the bit field layout of IA32_PERFEVTSELx MSRs. The bit fields
are:
Event select field (bits 0 through 7) — Selects the event logic unit used to
detect microarchitectural conditions (see Table 18-10, for a list of architectural
events and their 8-bit codes). The set of values for this field is defined architec-
turally; each value corresponds to an event logic unit for use with an architectural
performance event. The number of architectural events is queried using
CPUID.0AH:EAX. A processor may support only a subset of pre-defined values.