|
Packit Service |
8a4b7a |
/*
|
|
Packit Service |
8a4b7a |
* BSD LICENSE
|
|
Packit Service |
8a4b7a |
*
|
|
Packit Service |
8a4b7a |
* Copyright(c) 2014-2020 Intel Corporation. All rights reserved.
|
|
Packit Service |
8a4b7a |
* All rights reserved.
|
|
Packit Service |
8a4b7a |
*
|
|
Packit Service |
8a4b7a |
* Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
8a4b7a |
* modification, are permitted provided that the following conditions
|
|
Packit Service |
8a4b7a |
* are met:
|
|
Packit Service |
8a4b7a |
*
|
|
Packit Service |
8a4b7a |
* * Redistributions of source code must retain the above copyright
|
|
Packit Service |
8a4b7a |
* notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
8a4b7a |
* * Redistributions in binary form must reproduce the above copyright
|
|
Packit Service |
8a4b7a |
* notice, this list of conditions and the following disclaimer in
|
|
Packit Service |
8a4b7a |
* the documentation and/or other materials provided with the
|
|
Packit Service |
8a4b7a |
* distribution.
|
|
Packit Service |
8a4b7a |
* * Neither the name of Intel Corporation nor the names of its
|
|
Packit Service |
8a4b7a |
* contributors may be used to endorse or promote products derived
|
|
Packit Service |
8a4b7a |
* from this software without specific prior written permission.
|
|
Packit Service |
8a4b7a |
*
|
|
Packit Service |
8a4b7a |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit Service |
8a4b7a |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit Service |
8a4b7a |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit Service |
8a4b7a |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit Service |
8a4b7a |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit Service |
8a4b7a |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit Service |
8a4b7a |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit Service |
8a4b7a |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit Service |
8a4b7a |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit Service |
8a4b7a |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit Service |
8a4b7a |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit Service |
8a4b7a |
*
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* @brief Internal defines and data structure definition
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#ifndef __CPU_REGISTERS_H__
|
|
Packit Service |
8a4b7a |
#define __CPU_REGISTERS_H__
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#ifdef __cplusplus
|
|
Packit Service |
8a4b7a |
extern "C" {
|
|
Packit Service |
8a4b7a |
#endif
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* Allocation & Monitoring association MSR register
|
|
Packit Service |
8a4b7a |
* - bits [63..32] QE COS
|
|
Packit Service |
8a4b7a |
* - bits [31..10] Reserved
|
|
Packit Service |
8a4b7a |
* - bits [9..0] RMID
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_ASSOC 0xC8F
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_ASSOC_QECOS_SHIFT 32
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_ASSOC_QECOS_MASK 0xffffffff00000000ULL
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_ASSOC_RMID_MASK ((1ULL << 10) - 1ULL)
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* Allocation class of service (COS) MSR registers
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L3CA_MASK_START 0xC90
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L3CA_MASK_END 0xD0F
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L3CA_MASK_NUMOF \
|
|
Packit Service |
8a4b7a |
(PQOS_MSR_L3CA_MASK_END - PQOS_MSR_L3CA_MASK_START + 1)
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L2CA_MASK_START 0xD10
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MBA_MASK_START 0xD50
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* MBA Allocation class of service (COS) MSR register for AMD
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MBA_MASK_START_AMD 0xC0000200
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L3_QOS_CFG 0xC81 /**< L3 CAT config register */
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L3_QOS_CFG_CDP_EN 1ULL /**< L3 CDP enable bit */
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L2_QOS_CFG 0xC82 /**< L2 CAT config register */
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_L2_QOS_CFG_CDP_EN 1ULL /**< L2 CDP enable bit */
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MBA_CFG 0xC84 /**< MBA config register */
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* MBA linear max value
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MBA_LINEAR_MAX 100
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* MBA max value for AMD
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MBA_MAX_AMD 0x800
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* Available types of allocation resource ID's.
|
|
Packit Service |
8a4b7a |
* (matches CPUID enumeration)
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_RES_ID_L3_ALLOCATION 1 /**< L3 cache allocation */
|
|
Packit Service |
8a4b7a |
#define PQOS_RES_ID_L2_ALLOCATION 2 /**< L2 cache allocation */
|
|
Packit Service |
8a4b7a |
#define PQOS_RES_ID_MB_ALLOCATION 3 /**< Memory BW allocation */
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#define PQOS_CPUID_CAT_CDP_BIT 2 /**< CDP supported bit */
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* Monitoring data read MSR register
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_QMC 0xC8E
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_QMC_DATA_MASK ((1ULL << 62) - 1ULL)
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_QMC_ERROR (1ULL << 63)
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_QMC_UNAVAILABLE (1ULL << 62)
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* Monitoring event selection MSR register
|
|
Packit Service |
8a4b7a |
* - bits [63..42] Reserved
|
|
Packit Service |
8a4b7a |
* - bits [41..32] RMID
|
|
Packit Service |
8a4b7a |
* - bits [31..8] Reserved
|
|
Packit Service |
8a4b7a |
* - bits [7..0] Event ID
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_EVTSEL 0xC8D
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_EVTSEL_RMID_SHIFT 32
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_EVTSEL_RMID_MASK ((1ULL << 10) - 1ULL)
|
|
Packit Service |
8a4b7a |
#define PQOS_MSR_MON_EVTSEL_EVTID_MASK ((1ULL << 8) - 1ULL)
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
/**
|
|
Packit Service |
8a4b7a |
* MSR's to read instructions retired, unhalted cycles,
|
|
Packit Service |
8a4b7a |
* LLC references and LLC misses.
|
|
Packit Service |
8a4b7a |
* These MSR's are needed to calculate IPC (instructions per clock) and
|
|
Packit Service |
8a4b7a |
* LLC miss ratio.
|
|
Packit Service |
8a4b7a |
*/
|
|
Packit Service |
8a4b7a |
#define IA32_MSR_INST_RETIRED_ANY 0x309
|
|
Packit Service |
8a4b7a |
#define IA32_MSR_CPU_UNHALTED_THREAD 0x30A
|
|
Packit Service |
8a4b7a |
#define IA32_MSR_FIXED_CTR_CTRL 0x38D
|
|
Packit Service |
8a4b7a |
#define IA32_MSR_PERF_GLOBAL_CTRL 0x38F
|
|
Packit Service |
8a4b7a |
#define IA32_MSR_PMC0 0x0C1
|
|
Packit Service |
8a4b7a |
#define IA32_MSR_PERFEVTSEL0 0x186
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#define IA32_EVENT_LLC_MISS_MASK 0x2EULL
|
|
Packit Service |
8a4b7a |
#define IA32_EVENT_LLC_MISS_UMASK 0x41ULL
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#ifdef __cplusplus
|
|
Packit Service |
8a4b7a |
}
|
|
Packit Service |
8a4b7a |
#endif
|
|
Packit Service |
8a4b7a |
|
|
Packit Service |
8a4b7a |
#endif /* __CPU_REGISTERS_H__ */
|