18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_MSR_INDEX_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_MSR_INDEX_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/bits.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*
88c2ecf20Sopenharmony_ci * CPU model specific register (MSR) numbers.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Do not add new entries to this file unless the definitions are shared
118c2ecf20Sopenharmony_ci * between multiple compilation units.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* x86-64 specific MSRs */
158c2ecf20Sopenharmony_ci#define MSR_EFER		0xc0000080 /* extended feature register */
168c2ecf20Sopenharmony_ci#define MSR_STAR		0xc0000081 /* legacy mode SYSCALL target */
178c2ecf20Sopenharmony_ci#define MSR_LSTAR		0xc0000082 /* long mode SYSCALL target */
188c2ecf20Sopenharmony_ci#define MSR_CSTAR		0xc0000083 /* compat mode SYSCALL target */
198c2ecf20Sopenharmony_ci#define MSR_SYSCALL_MASK	0xc0000084 /* EFLAGS mask for syscall */
208c2ecf20Sopenharmony_ci#define MSR_FS_BASE		0xc0000100 /* 64bit FS base */
218c2ecf20Sopenharmony_ci#define MSR_GS_BASE		0xc0000101 /* 64bit GS base */
228c2ecf20Sopenharmony_ci#define MSR_KERNEL_GS_BASE	0xc0000102 /* SwapGS GS shadow */
238c2ecf20Sopenharmony_ci#define MSR_TSC_AUX		0xc0000103 /* Auxiliary TSC */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* EFER bits: */
268c2ecf20Sopenharmony_ci#define _EFER_SCE		0  /* SYSCALL/SYSRET */
278c2ecf20Sopenharmony_ci#define _EFER_LME		8  /* Long mode enable */
288c2ecf20Sopenharmony_ci#define _EFER_LMA		10 /* Long mode active (read-only) */
298c2ecf20Sopenharmony_ci#define _EFER_NX		11 /* No execute enable */
308c2ecf20Sopenharmony_ci#define _EFER_SVME		12 /* Enable virtualization */
318c2ecf20Sopenharmony_ci#define _EFER_LMSLE		13 /* Long Mode Segment Limit Enable */
328c2ecf20Sopenharmony_ci#define _EFER_FFXSR		14 /* Enable Fast FXSAVE/FXRSTOR */
338c2ecf20Sopenharmony_ci#define _EFER_AUTOIBRS		21 /* Enable Automatic IBRS */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define EFER_SCE		(1<<_EFER_SCE)
368c2ecf20Sopenharmony_ci#define EFER_LME		(1<<_EFER_LME)
378c2ecf20Sopenharmony_ci#define EFER_LMA		(1<<_EFER_LMA)
388c2ecf20Sopenharmony_ci#define EFER_NX			(1<<_EFER_NX)
398c2ecf20Sopenharmony_ci#define EFER_SVME		(1<<_EFER_SVME)
408c2ecf20Sopenharmony_ci#define EFER_LMSLE		(1<<_EFER_LMSLE)
418c2ecf20Sopenharmony_ci#define EFER_FFXSR		(1<<_EFER_FFXSR)
428c2ecf20Sopenharmony_ci#define EFER_AUTOIBRS		(1<<_EFER_AUTOIBRS)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Intel MSRs. Some also available on other CPUs */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define MSR_TEST_CTRL				0x00000033
478c2ecf20Sopenharmony_ci#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT	29
488c2ecf20Sopenharmony_ci#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT		BIT(MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define MSR_IA32_SPEC_CTRL		0x00000048 /* Speculation Control */
518c2ecf20Sopenharmony_ci#define SPEC_CTRL_IBRS			BIT(0)	   /* Indirect Branch Restricted Speculation */
528c2ecf20Sopenharmony_ci#define SPEC_CTRL_STIBP_SHIFT		1	   /* Single Thread Indirect Branch Predictor (STIBP) bit */
538c2ecf20Sopenharmony_ci#define SPEC_CTRL_STIBP			BIT(SPEC_CTRL_STIBP_SHIFT)	/* STIBP mask */
548c2ecf20Sopenharmony_ci#define SPEC_CTRL_SSBD_SHIFT		2	   /* Speculative Store Bypass Disable bit */
558c2ecf20Sopenharmony_ci#define SPEC_CTRL_SSBD			BIT(SPEC_CTRL_SSBD_SHIFT)	/* Speculative Store Bypass Disable */
568c2ecf20Sopenharmony_ci#define SPEC_CTRL_RRSBA_DIS_S_SHIFT	6	   /* Disable RRSBA behavior */
578c2ecf20Sopenharmony_ci#define SPEC_CTRL_RRSBA_DIS_S		BIT(SPEC_CTRL_RRSBA_DIS_S_SHIFT)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* A mask for bits which the kernel toggles when controlling mitigations */
608c2ecf20Sopenharmony_ci#define SPEC_CTRL_MITIGATIONS_MASK	(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_SSBD \
618c2ecf20Sopenharmony_ci							| SPEC_CTRL_RRSBA_DIS_S)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define MSR_IA32_PRED_CMD		0x00000049 /* Prediction Command */
648c2ecf20Sopenharmony_ci#define PRED_CMD_IBPB			BIT(0)	   /* Indirect Branch Prediction Barrier */
658c2ecf20Sopenharmony_ci#define PRED_CMD_SBPB			BIT(7)	   /* Selective Branch Prediction Barrier */
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define MSR_PPIN_CTL			0x0000004e
688c2ecf20Sopenharmony_ci#define MSR_PPIN			0x0000004f
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define MSR_IA32_PERFCTR0		0x000000c1
718c2ecf20Sopenharmony_ci#define MSR_IA32_PERFCTR1		0x000000c2
728c2ecf20Sopenharmony_ci#define MSR_FSB_FREQ			0x000000cd
738c2ecf20Sopenharmony_ci#define MSR_PLATFORM_INFO		0x000000ce
748c2ecf20Sopenharmony_ci#define MSR_PLATFORM_INFO_CPUID_FAULT_BIT	31
758c2ecf20Sopenharmony_ci#define MSR_PLATFORM_INFO_CPUID_FAULT		BIT_ULL(MSR_PLATFORM_INFO_CPUID_FAULT_BIT)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define MSR_IA32_UMWAIT_CONTROL			0xe1
788c2ecf20Sopenharmony_ci#define MSR_IA32_UMWAIT_CONTROL_C02_DISABLE	BIT(0)
798c2ecf20Sopenharmony_ci#define MSR_IA32_UMWAIT_CONTROL_RESERVED	BIT(1)
808c2ecf20Sopenharmony_ci/*
818c2ecf20Sopenharmony_ci * The time field is bit[31:2], but representing a 32bit value with
828c2ecf20Sopenharmony_ci * bit[1:0] zero.
838c2ecf20Sopenharmony_ci */
848c2ecf20Sopenharmony_ci#define MSR_IA32_UMWAIT_CONTROL_TIME_MASK	(~0x03U)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* Abbreviated from Intel SDM name IA32_CORE_CAPABILITIES */
878c2ecf20Sopenharmony_ci#define MSR_IA32_CORE_CAPS			  0x000000cf
888c2ecf20Sopenharmony_ci#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT  5
898c2ecf20Sopenharmony_ci#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT	  BIT(MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define MSR_PKG_CST_CONFIG_CONTROL	0x000000e2
928c2ecf20Sopenharmony_ci#define NHM_C3_AUTO_DEMOTE		(1UL << 25)
938c2ecf20Sopenharmony_ci#define NHM_C1_AUTO_DEMOTE		(1UL << 26)
948c2ecf20Sopenharmony_ci#define ATM_LNC_C6_AUTO_DEMOTE		(1UL << 25)
958c2ecf20Sopenharmony_ci#define SNB_C3_AUTO_UNDEMOTE		(1UL << 27)
968c2ecf20Sopenharmony_ci#define SNB_C1_AUTO_UNDEMOTE		(1UL << 28)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define MSR_MTRRcap			0x000000fe
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define MSR_IA32_ARCH_CAPABILITIES	0x0000010a
1018c2ecf20Sopenharmony_ci#define ARCH_CAP_RDCL_NO		BIT(0)	/* Not susceptible to Meltdown */
1028c2ecf20Sopenharmony_ci#define ARCH_CAP_IBRS_ALL		BIT(1)	/* Enhanced IBRS support */
1038c2ecf20Sopenharmony_ci#define ARCH_CAP_RSBA			BIT(2)	/* RET may use alternative branch predictors */
1048c2ecf20Sopenharmony_ci#define ARCH_CAP_SKIP_VMENTRY_L1DFLUSH	BIT(3)	/* Skip L1D flush on vmentry */
1058c2ecf20Sopenharmony_ci#define ARCH_CAP_SSB_NO			BIT(4)	/*
1068c2ecf20Sopenharmony_ci						 * Not susceptible to Speculative Store Bypass
1078c2ecf20Sopenharmony_ci						 * attack, so no Speculative Store Bypass
1088c2ecf20Sopenharmony_ci						 * control required.
1098c2ecf20Sopenharmony_ci						 */
1108c2ecf20Sopenharmony_ci#define ARCH_CAP_MDS_NO			BIT(5)   /*
1118c2ecf20Sopenharmony_ci						  * Not susceptible to
1128c2ecf20Sopenharmony_ci						  * Microarchitectural Data
1138c2ecf20Sopenharmony_ci						  * Sampling (MDS) vulnerabilities.
1148c2ecf20Sopenharmony_ci						  */
1158c2ecf20Sopenharmony_ci#define ARCH_CAP_PSCHANGE_MC_NO		BIT(6)	 /*
1168c2ecf20Sopenharmony_ci						  * The processor is not susceptible to a
1178c2ecf20Sopenharmony_ci						  * machine check error due to modifying the
1188c2ecf20Sopenharmony_ci						  * code page size along with either the
1198c2ecf20Sopenharmony_ci						  * physical address or cache type
1208c2ecf20Sopenharmony_ci						  * without TLB invalidation.
1218c2ecf20Sopenharmony_ci						  */
1228c2ecf20Sopenharmony_ci#define ARCH_CAP_TSX_CTRL_MSR		BIT(7)	/* MSR for TSX control is available. */
1238c2ecf20Sopenharmony_ci#define ARCH_CAP_TAA_NO			BIT(8)	/*
1248c2ecf20Sopenharmony_ci						 * Not susceptible to
1258c2ecf20Sopenharmony_ci						 * TSX Async Abort (TAA) vulnerabilities.
1268c2ecf20Sopenharmony_ci						 */
1278c2ecf20Sopenharmony_ci#define ARCH_CAP_SBDR_SSDP_NO		BIT(13)	/*
1288c2ecf20Sopenharmony_ci						 * Not susceptible to SBDR and SSDP
1298c2ecf20Sopenharmony_ci						 * variants of Processor MMIO stale data
1308c2ecf20Sopenharmony_ci						 * vulnerabilities.
1318c2ecf20Sopenharmony_ci						 */
1328c2ecf20Sopenharmony_ci#define ARCH_CAP_FBSDP_NO		BIT(14)	/*
1338c2ecf20Sopenharmony_ci						 * Not susceptible to FBSDP variant of
1348c2ecf20Sopenharmony_ci						 * Processor MMIO stale data
1358c2ecf20Sopenharmony_ci						 * vulnerabilities.
1368c2ecf20Sopenharmony_ci						 */
1378c2ecf20Sopenharmony_ci#define ARCH_CAP_PSDP_NO		BIT(15)	/*
1388c2ecf20Sopenharmony_ci						 * Not susceptible to PSDP variant of
1398c2ecf20Sopenharmony_ci						 * Processor MMIO stale data
1408c2ecf20Sopenharmony_ci						 * vulnerabilities.
1418c2ecf20Sopenharmony_ci						 */
1428c2ecf20Sopenharmony_ci#define ARCH_CAP_FB_CLEAR		BIT(17)	/*
1438c2ecf20Sopenharmony_ci						 * VERW clears CPU fill buffer
1448c2ecf20Sopenharmony_ci						 * even on MDS_NO CPUs.
1458c2ecf20Sopenharmony_ci						 */
1468c2ecf20Sopenharmony_ci#define ARCH_CAP_FB_CLEAR_CTRL		BIT(18)	/*
1478c2ecf20Sopenharmony_ci						 * MSR_IA32_MCU_OPT_CTRL[FB_CLEAR_DIS]
1488c2ecf20Sopenharmony_ci						 * bit available to control VERW
1498c2ecf20Sopenharmony_ci						 * behavior.
1508c2ecf20Sopenharmony_ci						 */
1518c2ecf20Sopenharmony_ci#define ARCH_CAP_RRSBA			BIT(19)	/*
1528c2ecf20Sopenharmony_ci						 * Indicates RET may use predictors
1538c2ecf20Sopenharmony_ci						 * other than the RSB. With eIBRS
1548c2ecf20Sopenharmony_ci						 * enabled predictions in kernel mode
1558c2ecf20Sopenharmony_ci						 * are restricted to targets in
1568c2ecf20Sopenharmony_ci						 * kernel.
1578c2ecf20Sopenharmony_ci						 */
1588c2ecf20Sopenharmony_ci#define ARCH_CAP_PBRSB_NO		BIT(24)	/*
1598c2ecf20Sopenharmony_ci						 * Not susceptible to Post-Barrier
1608c2ecf20Sopenharmony_ci						 * Return Stack Buffer Predictions.
1618c2ecf20Sopenharmony_ci						 */
1628c2ecf20Sopenharmony_ci#define ARCH_CAP_GDS_CTRL		BIT(25)	/*
1638c2ecf20Sopenharmony_ci						 * CPU is vulnerable to Gather
1648c2ecf20Sopenharmony_ci						 * Data Sampling (GDS) and
1658c2ecf20Sopenharmony_ci						 * has controls for mitigation.
1668c2ecf20Sopenharmony_ci						 */
1678c2ecf20Sopenharmony_ci#define ARCH_CAP_GDS_NO			BIT(26)	/*
1688c2ecf20Sopenharmony_ci						 * CPU is not vulnerable to Gather
1698c2ecf20Sopenharmony_ci						 * Data Sampling (GDS).
1708c2ecf20Sopenharmony_ci						 */
1718c2ecf20Sopenharmony_ci#define ARCH_CAP_RFDS_NO		BIT(27)	/*
1728c2ecf20Sopenharmony_ci						 * Not susceptible to Register
1738c2ecf20Sopenharmony_ci						 * File Data Sampling.
1748c2ecf20Sopenharmony_ci						 */
1758c2ecf20Sopenharmony_ci#define ARCH_CAP_RFDS_CLEAR		BIT(28)	/*
1768c2ecf20Sopenharmony_ci						 * VERW clears CPU Register
1778c2ecf20Sopenharmony_ci						 * File.
1788c2ecf20Sopenharmony_ci						 */
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci#define MSR_IA32_FLUSH_CMD		0x0000010b
1818c2ecf20Sopenharmony_ci#define L1D_FLUSH			BIT(0)	/*
1828c2ecf20Sopenharmony_ci						 * Writeback and invalidate the
1838c2ecf20Sopenharmony_ci						 * L1 data cache.
1848c2ecf20Sopenharmony_ci						 */
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#define MSR_IA32_BBL_CR_CTL		0x00000119
1878c2ecf20Sopenharmony_ci#define MSR_IA32_BBL_CR_CTL3		0x0000011e
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci#define MSR_IA32_TSX_CTRL		0x00000122
1908c2ecf20Sopenharmony_ci#define TSX_CTRL_RTM_DISABLE		BIT(0)	/* Disable RTM feature */
1918c2ecf20Sopenharmony_ci#define TSX_CTRL_CPUID_CLEAR		BIT(1)	/* Disable TSX enumeration */
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/* SRBDS support */
1948c2ecf20Sopenharmony_ci#define MSR_IA32_MCU_OPT_CTRL		0x00000123
1958c2ecf20Sopenharmony_ci#define RNGDS_MITG_DIS			BIT(0)
1968c2ecf20Sopenharmony_ci#define FB_CLEAR_DIS			BIT(3)	/* CPU Fill buffer clear disable */
1978c2ecf20Sopenharmony_ci#define GDS_MITG_DIS			BIT(4)	/* Disable GDS mitigation */
1988c2ecf20Sopenharmony_ci#define GDS_MITG_LOCKED			BIT(5)	/* GDS mitigation locked */
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define MSR_IA32_SYSENTER_CS		0x00000174
2018c2ecf20Sopenharmony_ci#define MSR_IA32_SYSENTER_ESP		0x00000175
2028c2ecf20Sopenharmony_ci#define MSR_IA32_SYSENTER_EIP		0x00000176
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_CAP		0x00000179
2058c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_STATUS		0x0000017a
2068c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_CTL		0x0000017b
2078c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EXT_CTL		0x000004d0
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define MSR_OFFCORE_RSP_0		0x000001a6
2108c2ecf20Sopenharmony_ci#define MSR_OFFCORE_RSP_1		0x000001a7
2118c2ecf20Sopenharmony_ci#define MSR_TURBO_RATIO_LIMIT		0x000001ad
2128c2ecf20Sopenharmony_ci#define MSR_TURBO_RATIO_LIMIT1		0x000001ae
2138c2ecf20Sopenharmony_ci#define MSR_TURBO_RATIO_LIMIT2		0x000001af
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci#define MSR_LBR_SELECT			0x000001c8
2168c2ecf20Sopenharmony_ci#define MSR_LBR_TOS			0x000001c9
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci#define MSR_IA32_POWER_CTL		0x000001fc
2198c2ecf20Sopenharmony_ci#define MSR_IA32_POWER_CTL_BIT_EE	19
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci#define MSR_LBR_NHM_FROM		0x00000680
2228c2ecf20Sopenharmony_ci#define MSR_LBR_NHM_TO			0x000006c0
2238c2ecf20Sopenharmony_ci#define MSR_LBR_CORE_FROM		0x00000040
2248c2ecf20Sopenharmony_ci#define MSR_LBR_CORE_TO			0x00000060
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci#define MSR_LBR_INFO_0			0x00000dc0 /* ... 0xddf for _31 */
2278c2ecf20Sopenharmony_ci#define LBR_INFO_MISPRED		BIT_ULL(63)
2288c2ecf20Sopenharmony_ci#define LBR_INFO_IN_TX			BIT_ULL(62)
2298c2ecf20Sopenharmony_ci#define LBR_INFO_ABORT			BIT_ULL(61)
2308c2ecf20Sopenharmony_ci#define LBR_INFO_CYC_CNT_VALID		BIT_ULL(60)
2318c2ecf20Sopenharmony_ci#define LBR_INFO_CYCLES			0xffff
2328c2ecf20Sopenharmony_ci#define LBR_INFO_BR_TYPE_OFFSET		56
2338c2ecf20Sopenharmony_ci#define LBR_INFO_BR_TYPE		(0xfull << LBR_INFO_BR_TYPE_OFFSET)
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci#define MSR_ARCH_LBR_CTL		0x000014ce
2368c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_LBREN		BIT(0)
2378c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_CPL_OFFSET		1
2388c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_CPL		(0x3ull << ARCH_LBR_CTL_CPL_OFFSET)
2398c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_STACK_OFFSET	3
2408c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_STACK		(0x1ull << ARCH_LBR_CTL_STACK_OFFSET)
2418c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_FILTER_OFFSET	16
2428c2ecf20Sopenharmony_ci#define ARCH_LBR_CTL_FILTER		(0x7full << ARCH_LBR_CTL_FILTER_OFFSET)
2438c2ecf20Sopenharmony_ci#define MSR_ARCH_LBR_DEPTH		0x000014cf
2448c2ecf20Sopenharmony_ci#define MSR_ARCH_LBR_FROM_0		0x00001500
2458c2ecf20Sopenharmony_ci#define MSR_ARCH_LBR_TO_0		0x00001600
2468c2ecf20Sopenharmony_ci#define MSR_ARCH_LBR_INFO_0		0x00001200
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci#define MSR_IA32_PEBS_ENABLE		0x000003f1
2498c2ecf20Sopenharmony_ci#define MSR_PEBS_DATA_CFG		0x000003f2
2508c2ecf20Sopenharmony_ci#define MSR_IA32_DS_AREA		0x00000600
2518c2ecf20Sopenharmony_ci#define MSR_IA32_PERF_CAPABILITIES	0x00000345
2528c2ecf20Sopenharmony_ci#define MSR_PEBS_LD_LAT_THRESHOLD	0x000003f6
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_CTL		0x00000570
2558c2ecf20Sopenharmony_ci#define RTIT_CTL_TRACEEN		BIT(0)
2568c2ecf20Sopenharmony_ci#define RTIT_CTL_CYCLEACC		BIT(1)
2578c2ecf20Sopenharmony_ci#define RTIT_CTL_OS			BIT(2)
2588c2ecf20Sopenharmony_ci#define RTIT_CTL_USR			BIT(3)
2598c2ecf20Sopenharmony_ci#define RTIT_CTL_PWR_EVT_EN		BIT(4)
2608c2ecf20Sopenharmony_ci#define RTIT_CTL_FUP_ON_PTW		BIT(5)
2618c2ecf20Sopenharmony_ci#define RTIT_CTL_FABRIC_EN		BIT(6)
2628c2ecf20Sopenharmony_ci#define RTIT_CTL_CR3EN			BIT(7)
2638c2ecf20Sopenharmony_ci#define RTIT_CTL_TOPA			BIT(8)
2648c2ecf20Sopenharmony_ci#define RTIT_CTL_MTC_EN			BIT(9)
2658c2ecf20Sopenharmony_ci#define RTIT_CTL_TSC_EN			BIT(10)
2668c2ecf20Sopenharmony_ci#define RTIT_CTL_DISRETC		BIT(11)
2678c2ecf20Sopenharmony_ci#define RTIT_CTL_PTW_EN			BIT(12)
2688c2ecf20Sopenharmony_ci#define RTIT_CTL_BRANCH_EN		BIT(13)
2698c2ecf20Sopenharmony_ci#define RTIT_CTL_MTC_RANGE_OFFSET	14
2708c2ecf20Sopenharmony_ci#define RTIT_CTL_MTC_RANGE		(0x0full << RTIT_CTL_MTC_RANGE_OFFSET)
2718c2ecf20Sopenharmony_ci#define RTIT_CTL_CYC_THRESH_OFFSET	19
2728c2ecf20Sopenharmony_ci#define RTIT_CTL_CYC_THRESH		(0x0full << RTIT_CTL_CYC_THRESH_OFFSET)
2738c2ecf20Sopenharmony_ci#define RTIT_CTL_PSB_FREQ_OFFSET	24
2748c2ecf20Sopenharmony_ci#define RTIT_CTL_PSB_FREQ		(0x0full << RTIT_CTL_PSB_FREQ_OFFSET)
2758c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR0_OFFSET		32
2768c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR0			(0x0full << RTIT_CTL_ADDR0_OFFSET)
2778c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR1_OFFSET		36
2788c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR1			(0x0full << RTIT_CTL_ADDR1_OFFSET)
2798c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR2_OFFSET		40
2808c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR2			(0x0full << RTIT_CTL_ADDR2_OFFSET)
2818c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR3_OFFSET		44
2828c2ecf20Sopenharmony_ci#define RTIT_CTL_ADDR3			(0x0full << RTIT_CTL_ADDR3_OFFSET)
2838c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_STATUS		0x00000571
2848c2ecf20Sopenharmony_ci#define RTIT_STATUS_FILTEREN		BIT(0)
2858c2ecf20Sopenharmony_ci#define RTIT_STATUS_CONTEXTEN		BIT(1)
2868c2ecf20Sopenharmony_ci#define RTIT_STATUS_TRIGGEREN		BIT(2)
2878c2ecf20Sopenharmony_ci#define RTIT_STATUS_BUFFOVF		BIT(3)
2888c2ecf20Sopenharmony_ci#define RTIT_STATUS_ERROR		BIT(4)
2898c2ecf20Sopenharmony_ci#define RTIT_STATUS_STOPPED		BIT(5)
2908c2ecf20Sopenharmony_ci#define RTIT_STATUS_BYTECNT_OFFSET	32
2918c2ecf20Sopenharmony_ci#define RTIT_STATUS_BYTECNT		(0x1ffffull << RTIT_STATUS_BYTECNT_OFFSET)
2928c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR0_A		0x00000580
2938c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR0_B		0x00000581
2948c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR1_A		0x00000582
2958c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR1_B		0x00000583
2968c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR2_A		0x00000584
2978c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR2_B		0x00000585
2988c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR3_A		0x00000586
2998c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_ADDR3_B		0x00000587
3008c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_CR3_MATCH		0x00000572
3018c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_OUTPUT_BASE	0x00000560
3028c2ecf20Sopenharmony_ci#define MSR_IA32_RTIT_OUTPUT_MASK	0x00000561
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci#define MSR_MTRRfix64K_00000		0x00000250
3058c2ecf20Sopenharmony_ci#define MSR_MTRRfix16K_80000		0x00000258
3068c2ecf20Sopenharmony_ci#define MSR_MTRRfix16K_A0000		0x00000259
3078c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_C0000		0x00000268
3088c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_C8000		0x00000269
3098c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_D0000		0x0000026a
3108c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_D8000		0x0000026b
3118c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_E0000		0x0000026c
3128c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_E8000		0x0000026d
3138c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_F0000		0x0000026e
3148c2ecf20Sopenharmony_ci#define MSR_MTRRfix4K_F8000		0x0000026f
3158c2ecf20Sopenharmony_ci#define MSR_MTRRdefType			0x000002ff
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci#define MSR_IA32_CR_PAT			0x00000277
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#define MSR_IA32_DEBUGCTLMSR		0x000001d9
3208c2ecf20Sopenharmony_ci#define MSR_IA32_LASTBRANCHFROMIP	0x000001db
3218c2ecf20Sopenharmony_ci#define MSR_IA32_LASTBRANCHTOIP		0x000001dc
3228c2ecf20Sopenharmony_ci#define MSR_IA32_LASTINTFROMIP		0x000001dd
3238c2ecf20Sopenharmony_ci#define MSR_IA32_LASTINTTOIP		0x000001de
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci#define MSR_IA32_PASID			0x00000d93
3268c2ecf20Sopenharmony_ci#define MSR_IA32_PASID_VALID		BIT_ULL(31)
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci/* DEBUGCTLMSR bits (others vary by model): */
3298c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_LBR			(1UL <<  0) /* last branch recording */
3308c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_BTF_SHIFT		1
3318c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_BTF			(1UL <<  1) /* single-step on branches */
3328c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_TR			(1UL <<  6)
3338c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_BTS			(1UL <<  7)
3348c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_BTINT		(1UL <<  8)
3358c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_BTS_OFF_OS		(1UL <<  9)
3368c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_BTS_OFF_USR		(1UL << 10)
3378c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI	(1UL << 11)
3388c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI	(1UL << 12)
3398c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_FREEZE_IN_SMM_BIT	14
3408c2ecf20Sopenharmony_ci#define DEBUGCTLMSR_FREEZE_IN_SMM	(1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT)
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci#define MSR_PEBS_FRONTEND		0x000003f7
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci#define MSR_IA32_MC0_CTL		0x00000400
3458c2ecf20Sopenharmony_ci#define MSR_IA32_MC0_STATUS		0x00000401
3468c2ecf20Sopenharmony_ci#define MSR_IA32_MC0_ADDR		0x00000402
3478c2ecf20Sopenharmony_ci#define MSR_IA32_MC0_MISC		0x00000403
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci/* C-state Residency Counters */
3508c2ecf20Sopenharmony_ci#define MSR_PKG_C3_RESIDENCY		0x000003f8
3518c2ecf20Sopenharmony_ci#define MSR_PKG_C6_RESIDENCY		0x000003f9
3528c2ecf20Sopenharmony_ci#define MSR_ATOM_PKG_C6_RESIDENCY	0x000003fa
3538c2ecf20Sopenharmony_ci#define MSR_PKG_C7_RESIDENCY		0x000003fa
3548c2ecf20Sopenharmony_ci#define MSR_CORE_C3_RESIDENCY		0x000003fc
3558c2ecf20Sopenharmony_ci#define MSR_CORE_C6_RESIDENCY		0x000003fd
3568c2ecf20Sopenharmony_ci#define MSR_CORE_C7_RESIDENCY		0x000003fe
3578c2ecf20Sopenharmony_ci#define MSR_KNL_CORE_C6_RESIDENCY	0x000003ff
3588c2ecf20Sopenharmony_ci#define MSR_PKG_C2_RESIDENCY		0x0000060d
3598c2ecf20Sopenharmony_ci#define MSR_PKG_C8_RESIDENCY		0x00000630
3608c2ecf20Sopenharmony_ci#define MSR_PKG_C9_RESIDENCY		0x00000631
3618c2ecf20Sopenharmony_ci#define MSR_PKG_C10_RESIDENCY		0x00000632
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci/* Interrupt Response Limit */
3648c2ecf20Sopenharmony_ci#define MSR_PKGC3_IRTL			0x0000060a
3658c2ecf20Sopenharmony_ci#define MSR_PKGC6_IRTL			0x0000060b
3668c2ecf20Sopenharmony_ci#define MSR_PKGC7_IRTL			0x0000060c
3678c2ecf20Sopenharmony_ci#define MSR_PKGC8_IRTL			0x00000633
3688c2ecf20Sopenharmony_ci#define MSR_PKGC9_IRTL			0x00000634
3698c2ecf20Sopenharmony_ci#define MSR_PKGC10_IRTL			0x00000635
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/* Run Time Average Power Limiting (RAPL) Interface */
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci#define MSR_RAPL_POWER_UNIT		0x00000606
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci#define MSR_PKG_POWER_LIMIT		0x00000610
3768c2ecf20Sopenharmony_ci#define MSR_PKG_ENERGY_STATUS		0x00000611
3778c2ecf20Sopenharmony_ci#define MSR_PKG_PERF_STATUS		0x00000613
3788c2ecf20Sopenharmony_ci#define MSR_PKG_POWER_INFO		0x00000614
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define MSR_DRAM_POWER_LIMIT		0x00000618
3818c2ecf20Sopenharmony_ci#define MSR_DRAM_ENERGY_STATUS		0x00000619
3828c2ecf20Sopenharmony_ci#define MSR_DRAM_PERF_STATUS		0x0000061b
3838c2ecf20Sopenharmony_ci#define MSR_DRAM_POWER_INFO		0x0000061c
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci#define MSR_PP0_POWER_LIMIT		0x00000638
3868c2ecf20Sopenharmony_ci#define MSR_PP0_ENERGY_STATUS		0x00000639
3878c2ecf20Sopenharmony_ci#define MSR_PP0_POLICY			0x0000063a
3888c2ecf20Sopenharmony_ci#define MSR_PP0_PERF_STATUS		0x0000063b
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci#define MSR_PP1_POWER_LIMIT		0x00000640
3918c2ecf20Sopenharmony_ci#define MSR_PP1_ENERGY_STATUS		0x00000641
3928c2ecf20Sopenharmony_ci#define MSR_PP1_POLICY			0x00000642
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
3958c2ecf20Sopenharmony_ci#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/* Config TDP MSRs */
3988c2ecf20Sopenharmony_ci#define MSR_CONFIG_TDP_NOMINAL		0x00000648
3998c2ecf20Sopenharmony_ci#define MSR_CONFIG_TDP_LEVEL_1		0x00000649
4008c2ecf20Sopenharmony_ci#define MSR_CONFIG_TDP_LEVEL_2		0x0000064A
4018c2ecf20Sopenharmony_ci#define MSR_CONFIG_TDP_CONTROL		0x0000064B
4028c2ecf20Sopenharmony_ci#define MSR_TURBO_ACTIVATION_RATIO	0x0000064C
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci#define MSR_PLATFORM_ENERGY_STATUS	0x0000064D
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci#define MSR_PKG_WEIGHTED_CORE_C0_RES	0x00000658
4078c2ecf20Sopenharmony_ci#define MSR_PKG_ANY_CORE_C0_RES		0x00000659
4088c2ecf20Sopenharmony_ci#define MSR_PKG_ANY_GFXE_C0_RES		0x0000065A
4098c2ecf20Sopenharmony_ci#define MSR_PKG_BOTH_CORE_GFXE_C0_RES	0x0000065B
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci#define MSR_CORE_C1_RES			0x00000660
4128c2ecf20Sopenharmony_ci#define MSR_MODULE_C6_RES_MS		0x00000664
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci#define MSR_CC6_DEMOTION_POLICY_CONFIG	0x00000668
4158c2ecf20Sopenharmony_ci#define MSR_MC6_DEMOTION_POLICY_CONFIG	0x00000669
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci#define MSR_ATOM_CORE_RATIOS		0x0000066a
4188c2ecf20Sopenharmony_ci#define MSR_ATOM_CORE_VIDS		0x0000066b
4198c2ecf20Sopenharmony_ci#define MSR_ATOM_CORE_TURBO_RATIOS	0x0000066c
4208c2ecf20Sopenharmony_ci#define MSR_ATOM_CORE_TURBO_VIDS	0x0000066d
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_LIMIT_REASONS	0x00000690
4248c2ecf20Sopenharmony_ci#define MSR_GFX_PERF_LIMIT_REASONS	0x000006B0
4258c2ecf20Sopenharmony_ci#define MSR_RING_PERF_LIMIT_REASONS	0x000006B1
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci/* Hardware P state interface */
4288c2ecf20Sopenharmony_ci#define MSR_PPERF			0x0000064e
4298c2ecf20Sopenharmony_ci#define MSR_PERF_LIMIT_REASONS		0x0000064f
4308c2ecf20Sopenharmony_ci#define MSR_PM_ENABLE			0x00000770
4318c2ecf20Sopenharmony_ci#define MSR_HWP_CAPABILITIES		0x00000771
4328c2ecf20Sopenharmony_ci#define MSR_HWP_REQUEST_PKG		0x00000772
4338c2ecf20Sopenharmony_ci#define MSR_HWP_INTERRUPT		0x00000773
4348c2ecf20Sopenharmony_ci#define MSR_HWP_REQUEST 		0x00000774
4358c2ecf20Sopenharmony_ci#define MSR_HWP_STATUS			0x00000777
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci/* CPUID.6.EAX */
4388c2ecf20Sopenharmony_ci#define HWP_BASE_BIT			(1<<7)
4398c2ecf20Sopenharmony_ci#define HWP_NOTIFICATIONS_BIT		(1<<8)
4408c2ecf20Sopenharmony_ci#define HWP_ACTIVITY_WINDOW_BIT		(1<<9)
4418c2ecf20Sopenharmony_ci#define HWP_ENERGY_PERF_PREFERENCE_BIT	(1<<10)
4428c2ecf20Sopenharmony_ci#define HWP_PACKAGE_LEVEL_REQUEST_BIT	(1<<11)
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci/* IA32_HWP_CAPABILITIES */
4458c2ecf20Sopenharmony_ci#define HWP_HIGHEST_PERF(x)		(((x) >> 0) & 0xff)
4468c2ecf20Sopenharmony_ci#define HWP_GUARANTEED_PERF(x)		(((x) >> 8) & 0xff)
4478c2ecf20Sopenharmony_ci#define HWP_MOSTEFFICIENT_PERF(x)	(((x) >> 16) & 0xff)
4488c2ecf20Sopenharmony_ci#define HWP_LOWEST_PERF(x)		(((x) >> 24) & 0xff)
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci/* IA32_HWP_REQUEST */
4518c2ecf20Sopenharmony_ci#define HWP_MIN_PERF(x) 		(x & 0xff)
4528c2ecf20Sopenharmony_ci#define HWP_MAX_PERF(x) 		((x & 0xff) << 8)
4538c2ecf20Sopenharmony_ci#define HWP_DESIRED_PERF(x)		((x & 0xff) << 16)
4548c2ecf20Sopenharmony_ci#define HWP_ENERGY_PERF_PREFERENCE(x)	(((unsigned long long) x & 0xff) << 24)
4558c2ecf20Sopenharmony_ci#define HWP_EPP_PERFORMANCE		0x00
4568c2ecf20Sopenharmony_ci#define HWP_EPP_BALANCE_PERFORMANCE	0x80
4578c2ecf20Sopenharmony_ci#define HWP_EPP_BALANCE_POWERSAVE	0xC0
4588c2ecf20Sopenharmony_ci#define HWP_EPP_POWERSAVE		0xFF
4598c2ecf20Sopenharmony_ci#define HWP_ACTIVITY_WINDOW(x)		((unsigned long long)(x & 0xff3) << 32)
4608c2ecf20Sopenharmony_ci#define HWP_PACKAGE_CONTROL(x)		((unsigned long long)(x & 0x1) << 42)
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci/* IA32_HWP_STATUS */
4638c2ecf20Sopenharmony_ci#define HWP_GUARANTEED_CHANGE(x)	(x & 0x1)
4648c2ecf20Sopenharmony_ci#define HWP_EXCURSION_TO_MINIMUM(x)	(x & 0x4)
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci/* IA32_HWP_INTERRUPT */
4678c2ecf20Sopenharmony_ci#define HWP_CHANGE_TO_GUARANTEED_INT(x)	(x & 0x1)
4688c2ecf20Sopenharmony_ci#define HWP_EXCURSION_TO_MINIMUM_INT(x)	(x & 0x2)
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci#define MSR_AMD64_MC0_MASK		0xc0010044
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci#define MSR_IA32_MCx_CTL(x)		(MSR_IA32_MC0_CTL + 4*(x))
4738c2ecf20Sopenharmony_ci#define MSR_IA32_MCx_STATUS(x)		(MSR_IA32_MC0_STATUS + 4*(x))
4748c2ecf20Sopenharmony_ci#define MSR_IA32_MCx_ADDR(x)		(MSR_IA32_MC0_ADDR + 4*(x))
4758c2ecf20Sopenharmony_ci#define MSR_IA32_MCx_MISC(x)		(MSR_IA32_MC0_MISC + 4*(x))
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci#define MSR_AMD64_MCx_MASK(x)		(MSR_AMD64_MC0_MASK + (x))
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci/* These are consecutive and not in the normal 4er MCE bank block */
4808c2ecf20Sopenharmony_ci#define MSR_IA32_MC0_CTL2		0x00000280
4818c2ecf20Sopenharmony_ci#define MSR_IA32_MCx_CTL2(x)		(MSR_IA32_MC0_CTL2 + (x))
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci#define MSR_P6_PERFCTR0			0x000000c1
4848c2ecf20Sopenharmony_ci#define MSR_P6_PERFCTR1			0x000000c2
4858c2ecf20Sopenharmony_ci#define MSR_P6_EVNTSEL0			0x00000186
4868c2ecf20Sopenharmony_ci#define MSR_P6_EVNTSEL1			0x00000187
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ci#define MSR_KNC_PERFCTR0               0x00000020
4898c2ecf20Sopenharmony_ci#define MSR_KNC_PERFCTR1               0x00000021
4908c2ecf20Sopenharmony_ci#define MSR_KNC_EVNTSEL0               0x00000028
4918c2ecf20Sopenharmony_ci#define MSR_KNC_EVNTSEL1               0x00000029
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci/* Alternative perfctr range with full access. */
4948c2ecf20Sopenharmony_ci#define MSR_IA32_PMC0			0x000004c1
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/* Auto-reload via MSR instead of DS area */
4978c2ecf20Sopenharmony_ci#define MSR_RELOAD_PMC0			0x000014c1
4988c2ecf20Sopenharmony_ci#define MSR_RELOAD_FIXED_CTR0		0x00001309
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ci/*
5018c2ecf20Sopenharmony_ci * AMD64 MSRs. Not complete. See the architecture manual for a more
5028c2ecf20Sopenharmony_ci * complete list.
5038c2ecf20Sopenharmony_ci */
5048c2ecf20Sopenharmony_ci#define MSR_AMD64_PATCH_LEVEL		0x0000008b
5058c2ecf20Sopenharmony_ci#define MSR_AMD64_TSC_RATIO		0xc0000104
5068c2ecf20Sopenharmony_ci#define MSR_AMD64_NB_CFG		0xc001001f
5078c2ecf20Sopenharmony_ci#define MSR_AMD64_PATCH_LOADER		0xc0010020
5088c2ecf20Sopenharmony_ci#define MSR_AMD_PERF_CTL		0xc0010062
5098c2ecf20Sopenharmony_ci#define MSR_AMD_PERF_STATUS		0xc0010063
5108c2ecf20Sopenharmony_ci#define MSR_AMD_PSTATE_DEF_BASE		0xc0010064
5118c2ecf20Sopenharmony_ci#define MSR_AMD64_OSVW_ID_LENGTH	0xc0010140
5128c2ecf20Sopenharmony_ci#define MSR_AMD64_OSVW_STATUS		0xc0010141
5138c2ecf20Sopenharmony_ci#define MSR_AMD_PPIN_CTL		0xc00102f0
5148c2ecf20Sopenharmony_ci#define MSR_AMD_PPIN			0xc00102f1
5158c2ecf20Sopenharmony_ci#define MSR_AMD64_CPUID_FN_1		0xc0011004
5168c2ecf20Sopenharmony_ci#define MSR_AMD64_LS_CFG		0xc0011020
5178c2ecf20Sopenharmony_ci#define MSR_AMD64_DC_CFG		0xc0011022
5188c2ecf20Sopenharmony_ci#define MSR_AMD64_TW_CFG		0xc0011023
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci#define MSR_AMD64_DE_CFG		0xc0011029
5218c2ecf20Sopenharmony_ci#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT	 1
5228c2ecf20Sopenharmony_ci#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE	BIT_ULL(MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT)
5238c2ecf20Sopenharmony_ci#define MSR_AMD64_DE_CFG_ZEN2_FP_BACKUP_FIX_BIT 9
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci#define MSR_AMD64_BU_CFG2		0xc001102a
5268c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSFETCHCTL		0xc0011030
5278c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSFETCHLINAD		0xc0011031
5288c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSFETCHPHYSAD	0xc0011032
5298c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSFETCH_REG_COUNT	3
5308c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSFETCH_REG_MASK	((1UL<<MSR_AMD64_IBSFETCH_REG_COUNT)-1)
5318c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOPCTL		0xc0011033
5328c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOPRIP		0xc0011034
5338c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOPDATA		0xc0011035
5348c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOPDATA2		0xc0011036
5358c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOPDATA3		0xc0011037
5368c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSDCLINAD		0xc0011038
5378c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSDCPHYSAD		0xc0011039
5388c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOP_REG_COUNT	7
5398c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOP_REG_MASK	((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
5408c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSCTL		0xc001103a
5418c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSBRTARGET		0xc001103b
5428c2ecf20Sopenharmony_ci#define MSR_AMD64_ICIBSEXTDCTL		0xc001103c
5438c2ecf20Sopenharmony_ci#define MSR_AMD64_IBSOPDATA4		0xc001103d
5448c2ecf20Sopenharmony_ci#define MSR_AMD64_IBS_REG_COUNT_MAX	8 /* includes MSR_AMD64_IBSBRTARGET */
5458c2ecf20Sopenharmony_ci#define MSR_AMD64_VM_PAGE_FLUSH		0xc001011e
5468c2ecf20Sopenharmony_ci#define MSR_AMD64_SEV_ES_GHCB		0xc0010130
5478c2ecf20Sopenharmony_ci#define MSR_AMD64_SEV			0xc0010131
5488c2ecf20Sopenharmony_ci#define MSR_AMD64_SEV_ENABLED_BIT	0
5498c2ecf20Sopenharmony_ci#define MSR_AMD64_SEV_ES_ENABLED_BIT	1
5508c2ecf20Sopenharmony_ci#define MSR_AMD64_SEV_ENABLED		BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT)
5518c2ecf20Sopenharmony_ci#define MSR_AMD64_SEV_ES_ENABLED	BIT_ULL(MSR_AMD64_SEV_ES_ENABLED_BIT)
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci#define MSR_AMD64_VIRT_SPEC_CTRL	0xc001011f
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci/* Zen4 */
5568c2ecf20Sopenharmony_ci#define MSR_ZEN4_BP_CFG			0xc001102e
5578c2ecf20Sopenharmony_ci#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci/* Zen 2 */
5608c2ecf20Sopenharmony_ci#define MSR_ZEN2_SPECTRAL_CHICKEN	0xc00110e3
5618c2ecf20Sopenharmony_ci#define MSR_ZEN2_SPECTRAL_CHICKEN_BIT	BIT_ULL(1)
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci/* Fam 17h MSRs */
5648c2ecf20Sopenharmony_ci#define MSR_F17H_IRPERF			0xc00000e9
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci/* Fam 16h MSRs */
5678c2ecf20Sopenharmony_ci#define MSR_F16H_L2I_PERF_CTL		0xc0010230
5688c2ecf20Sopenharmony_ci#define MSR_F16H_L2I_PERF_CTR		0xc0010231
5698c2ecf20Sopenharmony_ci#define MSR_F16H_DR1_ADDR_MASK		0xc0011019
5708c2ecf20Sopenharmony_ci#define MSR_F16H_DR2_ADDR_MASK		0xc001101a
5718c2ecf20Sopenharmony_ci#define MSR_F16H_DR3_ADDR_MASK		0xc001101b
5728c2ecf20Sopenharmony_ci#define MSR_F16H_DR0_ADDR_MASK		0xc0011027
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci/* Fam 15h MSRs */
5758c2ecf20Sopenharmony_ci#define MSR_F15H_CU_PWR_ACCUMULATOR     0xc001007a
5768c2ecf20Sopenharmony_ci#define MSR_F15H_CU_MAX_PWR_ACCUMULATOR 0xc001007b
5778c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL		0xc0010200
5788c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL0		MSR_F15H_PERF_CTL
5798c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL1		(MSR_F15H_PERF_CTL + 2)
5808c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL2		(MSR_F15H_PERF_CTL + 4)
5818c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL3		(MSR_F15H_PERF_CTL + 6)
5828c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL4		(MSR_F15H_PERF_CTL + 8)
5838c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTL5		(MSR_F15H_PERF_CTL + 10)
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR		0xc0010201
5868c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR0		MSR_F15H_PERF_CTR
5878c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR1		(MSR_F15H_PERF_CTR + 2)
5888c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR2		(MSR_F15H_PERF_CTR + 4)
5898c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR3		(MSR_F15H_PERF_CTR + 6)
5908c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR4		(MSR_F15H_PERF_CTR + 8)
5918c2ecf20Sopenharmony_ci#define MSR_F15H_PERF_CTR5		(MSR_F15H_PERF_CTR + 10)
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci#define MSR_F15H_NB_PERF_CTL		0xc0010240
5948c2ecf20Sopenharmony_ci#define MSR_F15H_NB_PERF_CTR		0xc0010241
5958c2ecf20Sopenharmony_ci#define MSR_F15H_PTSC			0xc0010280
5968c2ecf20Sopenharmony_ci#define MSR_F15H_IC_CFG			0xc0011021
5978c2ecf20Sopenharmony_ci#define MSR_F15H_EX_CFG			0xc001102c
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci/* Fam 10h MSRs */
6008c2ecf20Sopenharmony_ci#define MSR_FAM10H_MMIO_CONF_BASE	0xc0010058
6018c2ecf20Sopenharmony_ci#define FAM10H_MMIO_CONF_ENABLE		(1<<0)
6028c2ecf20Sopenharmony_ci#define FAM10H_MMIO_CONF_BUSRANGE_MASK	0xf
6038c2ecf20Sopenharmony_ci#define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2
6048c2ecf20Sopenharmony_ci#define FAM10H_MMIO_CONF_BASE_MASK	0xfffffffULL
6058c2ecf20Sopenharmony_ci#define FAM10H_MMIO_CONF_BASE_SHIFT	20
6068c2ecf20Sopenharmony_ci#define MSR_FAM10H_NODE_ID		0xc001100c
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci/* K8 MSRs */
6098c2ecf20Sopenharmony_ci#define MSR_K8_TOP_MEM1			0xc001001a
6108c2ecf20Sopenharmony_ci#define MSR_K8_TOP_MEM2			0xc001001d
6118c2ecf20Sopenharmony_ci#define MSR_K8_SYSCFG			0xc0010010
6128c2ecf20Sopenharmony_ci#define MSR_K8_SYSCFG_MEM_ENCRYPT_BIT	23
6138c2ecf20Sopenharmony_ci#define MSR_K8_SYSCFG_MEM_ENCRYPT	BIT_ULL(MSR_K8_SYSCFG_MEM_ENCRYPT_BIT)
6148c2ecf20Sopenharmony_ci#define MSR_K8_INT_PENDING_MSG		0xc0010055
6158c2ecf20Sopenharmony_ci/* C1E active bits in int pending message */
6168c2ecf20Sopenharmony_ci#define K8_INTP_C1E_ACTIVE_MASK		0x18000000
6178c2ecf20Sopenharmony_ci#define MSR_K8_TSEG_ADDR		0xc0010112
6188c2ecf20Sopenharmony_ci#define MSR_K8_TSEG_MASK		0xc0010113
6198c2ecf20Sopenharmony_ci#define K8_MTRRFIXRANGE_DRAM_ENABLE	0x00040000 /* MtrrFixDramEn bit    */
6208c2ecf20Sopenharmony_ci#define K8_MTRRFIXRANGE_DRAM_MODIFY	0x00080000 /* MtrrFixDramModEn bit */
6218c2ecf20Sopenharmony_ci#define K8_MTRR_RDMEM_WRMEM_MASK	0x18181818 /* Mask: RdMem|WrMem    */
6228c2ecf20Sopenharmony_ci
6238c2ecf20Sopenharmony_ci/* K7 MSRs */
6248c2ecf20Sopenharmony_ci#define MSR_K7_EVNTSEL0			0xc0010000
6258c2ecf20Sopenharmony_ci#define MSR_K7_PERFCTR0			0xc0010004
6268c2ecf20Sopenharmony_ci#define MSR_K7_EVNTSEL1			0xc0010001
6278c2ecf20Sopenharmony_ci#define MSR_K7_PERFCTR1			0xc0010005
6288c2ecf20Sopenharmony_ci#define MSR_K7_EVNTSEL2			0xc0010002
6298c2ecf20Sopenharmony_ci#define MSR_K7_PERFCTR2			0xc0010006
6308c2ecf20Sopenharmony_ci#define MSR_K7_EVNTSEL3			0xc0010003
6318c2ecf20Sopenharmony_ci#define MSR_K7_PERFCTR3			0xc0010007
6328c2ecf20Sopenharmony_ci#define MSR_K7_CLK_CTL			0xc001001b
6338c2ecf20Sopenharmony_ci#define MSR_K7_HWCR			0xc0010015
6348c2ecf20Sopenharmony_ci#define MSR_K7_HWCR_SMMLOCK_BIT		0
6358c2ecf20Sopenharmony_ci#define MSR_K7_HWCR_SMMLOCK		BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
6368c2ecf20Sopenharmony_ci#define MSR_K7_HWCR_IRPERF_EN_BIT	30
6378c2ecf20Sopenharmony_ci#define MSR_K7_HWCR_IRPERF_EN		BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
6388c2ecf20Sopenharmony_ci#define MSR_K7_FID_VID_CTL		0xc0010041
6398c2ecf20Sopenharmony_ci#define MSR_K7_FID_VID_STATUS		0xc0010042
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci/* K6 MSRs */
6428c2ecf20Sopenharmony_ci#define MSR_K6_WHCR			0xc0000082
6438c2ecf20Sopenharmony_ci#define MSR_K6_UWCCR			0xc0000085
6448c2ecf20Sopenharmony_ci#define MSR_K6_EPMR			0xc0000086
6458c2ecf20Sopenharmony_ci#define MSR_K6_PSOR			0xc0000087
6468c2ecf20Sopenharmony_ci#define MSR_K6_PFIR			0xc0000088
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci/* Centaur-Hauls/IDT defined MSRs. */
6498c2ecf20Sopenharmony_ci#define MSR_IDT_FCR1			0x00000107
6508c2ecf20Sopenharmony_ci#define MSR_IDT_FCR2			0x00000108
6518c2ecf20Sopenharmony_ci#define MSR_IDT_FCR3			0x00000109
6528c2ecf20Sopenharmony_ci#define MSR_IDT_FCR4			0x0000010a
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci#define MSR_IDT_MCR0			0x00000110
6558c2ecf20Sopenharmony_ci#define MSR_IDT_MCR1			0x00000111
6568c2ecf20Sopenharmony_ci#define MSR_IDT_MCR2			0x00000112
6578c2ecf20Sopenharmony_ci#define MSR_IDT_MCR3			0x00000113
6588c2ecf20Sopenharmony_ci#define MSR_IDT_MCR4			0x00000114
6598c2ecf20Sopenharmony_ci#define MSR_IDT_MCR5			0x00000115
6608c2ecf20Sopenharmony_ci#define MSR_IDT_MCR6			0x00000116
6618c2ecf20Sopenharmony_ci#define MSR_IDT_MCR7			0x00000117
6628c2ecf20Sopenharmony_ci#define MSR_IDT_MCR_CTRL		0x00000120
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci/* VIA Cyrix defined MSRs*/
6658c2ecf20Sopenharmony_ci#define MSR_VIA_FCR			0x00001107
6668c2ecf20Sopenharmony_ci#define MSR_VIA_LONGHAUL		0x0000110a
6678c2ecf20Sopenharmony_ci#define MSR_VIA_RNG			0x0000110b
6688c2ecf20Sopenharmony_ci#define MSR_VIA_BCR2			0x00001147
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci/* Transmeta defined MSRs */
6718c2ecf20Sopenharmony_ci#define MSR_TMTA_LONGRUN_CTRL		0x80868010
6728c2ecf20Sopenharmony_ci#define MSR_TMTA_LONGRUN_FLAGS		0x80868011
6738c2ecf20Sopenharmony_ci#define MSR_TMTA_LRTI_READOUT		0x80868018
6748c2ecf20Sopenharmony_ci#define MSR_TMTA_LRTI_VOLT_MHZ		0x8086801a
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci/* Intel defined MSRs. */
6778c2ecf20Sopenharmony_ci#define MSR_IA32_P5_MC_ADDR		0x00000000
6788c2ecf20Sopenharmony_ci#define MSR_IA32_P5_MC_TYPE		0x00000001
6798c2ecf20Sopenharmony_ci#define MSR_IA32_TSC			0x00000010
6808c2ecf20Sopenharmony_ci#define MSR_IA32_PLATFORM_ID		0x00000017
6818c2ecf20Sopenharmony_ci#define MSR_IA32_EBL_CR_POWERON		0x0000002a
6828c2ecf20Sopenharmony_ci#define MSR_EBC_FREQUENCY_ID		0x0000002c
6838c2ecf20Sopenharmony_ci#define MSR_SMI_COUNT			0x00000034
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_ci/* Referred to as IA32_FEATURE_CONTROL in Intel's SDM. */
6868c2ecf20Sopenharmony_ci#define MSR_IA32_FEAT_CTL		0x0000003a
6878c2ecf20Sopenharmony_ci#define FEAT_CTL_LOCKED				BIT(0)
6888c2ecf20Sopenharmony_ci#define FEAT_CTL_VMX_ENABLED_INSIDE_SMX		BIT(1)
6898c2ecf20Sopenharmony_ci#define FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX	BIT(2)
6908c2ecf20Sopenharmony_ci#define FEAT_CTL_LMCE_ENABLED			BIT(20)
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_ci#define MSR_IA32_TSC_ADJUST             0x0000003b
6938c2ecf20Sopenharmony_ci#define MSR_IA32_BNDCFGS		0x00000d90
6948c2ecf20Sopenharmony_ci
6958c2ecf20Sopenharmony_ci#define MSR_IA32_BNDCFGS_RSVD		0x00000ffc
6968c2ecf20Sopenharmony_ci
6978c2ecf20Sopenharmony_ci#define MSR_IA32_XSS			0x00000da0
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_ci#define MSR_IA32_APICBASE		0x0000001b
7008c2ecf20Sopenharmony_ci#define MSR_IA32_APICBASE_BSP		(1<<8)
7018c2ecf20Sopenharmony_ci#define MSR_IA32_APICBASE_ENABLE	(1<<11)
7028c2ecf20Sopenharmony_ci#define MSR_IA32_APICBASE_BASE		(0xfffff<<12)
7038c2ecf20Sopenharmony_ci
7048c2ecf20Sopenharmony_ci#define MSR_IA32_TSCDEADLINE		0x000006e0
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci#define MSR_IA32_UCODE_WRITE		0x00000079
7078c2ecf20Sopenharmony_ci#define MSR_IA32_UCODE_REV		0x0000008b
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci#define MSR_IA32_SMM_MONITOR_CTL	0x0000009b
7108c2ecf20Sopenharmony_ci#define MSR_IA32_SMBASE			0x0000009e
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_ci#define MSR_IA32_PERF_STATUS		0x00000198
7138c2ecf20Sopenharmony_ci#define MSR_IA32_PERF_CTL		0x00000199
7148c2ecf20Sopenharmony_ci#define INTEL_PERF_CTL_MASK		0xffff
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci#define MSR_IA32_MPERF			0x000000e7
7178c2ecf20Sopenharmony_ci#define MSR_IA32_APERF			0x000000e8
7188c2ecf20Sopenharmony_ci
7198c2ecf20Sopenharmony_ci#define MSR_IA32_THERM_CONTROL		0x0000019a
7208c2ecf20Sopenharmony_ci#define MSR_IA32_THERM_INTERRUPT	0x0000019b
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci#define THERM_INT_HIGH_ENABLE		(1 << 0)
7238c2ecf20Sopenharmony_ci#define THERM_INT_LOW_ENABLE		(1 << 1)
7248c2ecf20Sopenharmony_ci#define THERM_INT_PLN_ENABLE		(1 << 24)
7258c2ecf20Sopenharmony_ci
7268c2ecf20Sopenharmony_ci#define MSR_IA32_THERM_STATUS		0x0000019c
7278c2ecf20Sopenharmony_ci
7288c2ecf20Sopenharmony_ci#define THERM_STATUS_PROCHOT		(1 << 0)
7298c2ecf20Sopenharmony_ci#define THERM_STATUS_POWER_LIMIT	(1 << 10)
7308c2ecf20Sopenharmony_ci
7318c2ecf20Sopenharmony_ci#define MSR_THERM2_CTL			0x0000019d
7328c2ecf20Sopenharmony_ci
7338c2ecf20Sopenharmony_ci#define MSR_THERM2_CTL_TM_SELECT	(1ULL << 16)
7348c2ecf20Sopenharmony_ci
7358c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE		0x000001a0
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci#define MSR_IA32_TEMPERATURE_TARGET	0x000001a2
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci#define MSR_MISC_FEATURE_CONTROL	0x000001a4
7408c2ecf20Sopenharmony_ci#define MSR_MISC_PWR_MGMT		0x000001aa
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_ci#define MSR_IA32_ENERGY_PERF_BIAS	0x000001b0
7438c2ecf20Sopenharmony_ci#define ENERGY_PERF_BIAS_PERFORMANCE		0
7448c2ecf20Sopenharmony_ci#define ENERGY_PERF_BIAS_BALANCE_PERFORMANCE	4
7458c2ecf20Sopenharmony_ci#define ENERGY_PERF_BIAS_NORMAL			6
7468c2ecf20Sopenharmony_ci#define ENERGY_PERF_BIAS_BALANCE_POWERSAVE	8
7478c2ecf20Sopenharmony_ci#define ENERGY_PERF_BIAS_POWERSAVE		15
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci#define MSR_IA32_PACKAGE_THERM_STATUS		0x000001b1
7508c2ecf20Sopenharmony_ci
7518c2ecf20Sopenharmony_ci#define PACKAGE_THERM_STATUS_PROCHOT		(1 << 0)
7528c2ecf20Sopenharmony_ci#define PACKAGE_THERM_STATUS_POWER_LIMIT	(1 << 10)
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_ci#define MSR_IA32_PACKAGE_THERM_INTERRUPT	0x000001b2
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_ci#define PACKAGE_THERM_INT_HIGH_ENABLE		(1 << 0)
7578c2ecf20Sopenharmony_ci#define PACKAGE_THERM_INT_LOW_ENABLE		(1 << 1)
7588c2ecf20Sopenharmony_ci#define PACKAGE_THERM_INT_PLN_ENABLE		(1 << 24)
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci/* Thermal Thresholds Support */
7618c2ecf20Sopenharmony_ci#define THERM_INT_THRESHOLD0_ENABLE    (1 << 15)
7628c2ecf20Sopenharmony_ci#define THERM_SHIFT_THRESHOLD0        8
7638c2ecf20Sopenharmony_ci#define THERM_MASK_THRESHOLD0          (0x7f << THERM_SHIFT_THRESHOLD0)
7648c2ecf20Sopenharmony_ci#define THERM_INT_THRESHOLD1_ENABLE    (1 << 23)
7658c2ecf20Sopenharmony_ci#define THERM_SHIFT_THRESHOLD1        16
7668c2ecf20Sopenharmony_ci#define THERM_MASK_THRESHOLD1          (0x7f << THERM_SHIFT_THRESHOLD1)
7678c2ecf20Sopenharmony_ci#define THERM_STATUS_THRESHOLD0        (1 << 6)
7688c2ecf20Sopenharmony_ci#define THERM_LOG_THRESHOLD0           (1 << 7)
7698c2ecf20Sopenharmony_ci#define THERM_STATUS_THRESHOLD1        (1 << 8)
7708c2ecf20Sopenharmony_ci#define THERM_LOG_THRESHOLD1           (1 << 9)
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci/* MISC_ENABLE bits: architectural */
7738c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_FAST_STRING_BIT		0
7748c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_FAST_STRING		(1ULL << MSR_IA32_MISC_ENABLE_FAST_STRING_BIT)
7758c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TCC_BIT			1
7768c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TCC			(1ULL << MSR_IA32_MISC_ENABLE_TCC_BIT)
7778c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_EMON_BIT			7
7788c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_EMON			(1ULL << MSR_IA32_MISC_ENABLE_EMON_BIT)
7798c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL_BIT		11
7808c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL		(1ULL << MSR_IA32_MISC_ENABLE_BTS_UNAVAIL_BIT)
7818c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL_BIT		12
7828c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL		(1ULL << MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL_BIT)
7838c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP_BIT	16
7848c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP		(1ULL << MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP_BIT)
7858c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_MWAIT_BIT			18
7868c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_MWAIT			(1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
7878c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT		22
7888c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID		(1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT)
7898c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT		23
7908c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT)
7918c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT		34
7928c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_XD_DISABLE			(1ULL << MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT)
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ci/* MISC_ENABLE bits: model-specific, meaning may vary from core to core */
7958c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_X87_COMPAT_BIT		2
7968c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_X87_COMPAT			(1ULL << MSR_IA32_MISC_ENABLE_X87_COMPAT_BIT)
7978c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TM1_BIT			3
7988c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TM1			(1ULL << MSR_IA32_MISC_ENABLE_TM1_BIT)
7998c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE_BIT	4
8008c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE_BIT)
8018c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE_BIT	6
8028c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE_BIT)
8038c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK_BIT		8
8048c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK		(1ULL << MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK_BIT)
8058c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT	9
8068c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT)
8078c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_FERR_BIT			10
8088c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_FERR			(1ULL << MSR_IA32_MISC_ENABLE_FERR_BIT)
8098c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX_BIT		10
8108c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX		(1ULL << MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX_BIT)
8118c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TM2_BIT			13
8128c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TM2			(1ULL << MSR_IA32_MISC_ENABLE_TM2_BIT)
8138c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE_BIT	19
8148c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE_BIT)
8158c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK_BIT		20
8168c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK		(1ULL << MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK_BIT)
8178c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT_BIT		24
8188c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT		(1ULL << MSR_IA32_MISC_ENABLE_L1D_CONTEXT_BIT)
8198c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE_BIT	37
8208c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE_BIT)
8218c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE_BIT		38
8228c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_TURBO_DISABLE_BIT)
8238c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT	39
8248c2ecf20Sopenharmony_ci#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT)
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_ci/* MISC_FEATURES_ENABLES non-architectural features */
8278c2ecf20Sopenharmony_ci#define MSR_MISC_FEATURES_ENABLES	0x00000140
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci#define MSR_MISC_FEATURES_ENABLES_CPUID_FAULT_BIT	0
8308c2ecf20Sopenharmony_ci#define MSR_MISC_FEATURES_ENABLES_CPUID_FAULT		BIT_ULL(MSR_MISC_FEATURES_ENABLES_CPUID_FAULT_BIT)
8318c2ecf20Sopenharmony_ci#define MSR_MISC_FEATURES_ENABLES_RING3MWAIT_BIT	1
8328c2ecf20Sopenharmony_ci
8338c2ecf20Sopenharmony_ci#define MSR_IA32_TSC_DEADLINE		0x000006E0
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci
8368c2ecf20Sopenharmony_ci#define MSR_TSX_FORCE_ABORT		0x0000010F
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_ci#define MSR_TFA_RTM_FORCE_ABORT_BIT	0
8398c2ecf20Sopenharmony_ci#define MSR_TFA_RTM_FORCE_ABORT		BIT_ULL(MSR_TFA_RTM_FORCE_ABORT_BIT)
8408c2ecf20Sopenharmony_ci
8418c2ecf20Sopenharmony_ci/* P4/Xeon+ specific */
8428c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EAX		0x00000180
8438c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EBX		0x00000181
8448c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_ECX		0x00000182
8458c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EDX		0x00000183
8468c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_ESI		0x00000184
8478c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EDI		0x00000185
8488c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EBP		0x00000186
8498c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_ESP		0x00000187
8508c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EFLAGS		0x00000188
8518c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_EIP		0x00000189
8528c2ecf20Sopenharmony_ci#define MSR_IA32_MCG_RESERVED		0x0000018a
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_ci/* Pentium IV performance counter MSRs */
8558c2ecf20Sopenharmony_ci#define MSR_P4_BPU_PERFCTR0		0x00000300
8568c2ecf20Sopenharmony_ci#define MSR_P4_BPU_PERFCTR1		0x00000301
8578c2ecf20Sopenharmony_ci#define MSR_P4_BPU_PERFCTR2		0x00000302
8588c2ecf20Sopenharmony_ci#define MSR_P4_BPU_PERFCTR3		0x00000303
8598c2ecf20Sopenharmony_ci#define MSR_P4_MS_PERFCTR0		0x00000304
8608c2ecf20Sopenharmony_ci#define MSR_P4_MS_PERFCTR1		0x00000305
8618c2ecf20Sopenharmony_ci#define MSR_P4_MS_PERFCTR2		0x00000306
8628c2ecf20Sopenharmony_ci#define MSR_P4_MS_PERFCTR3		0x00000307
8638c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_PERFCTR0		0x00000308
8648c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_PERFCTR1		0x00000309
8658c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_PERFCTR2		0x0000030a
8668c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_PERFCTR3		0x0000030b
8678c2ecf20Sopenharmony_ci#define MSR_P4_IQ_PERFCTR0		0x0000030c
8688c2ecf20Sopenharmony_ci#define MSR_P4_IQ_PERFCTR1		0x0000030d
8698c2ecf20Sopenharmony_ci#define MSR_P4_IQ_PERFCTR2		0x0000030e
8708c2ecf20Sopenharmony_ci#define MSR_P4_IQ_PERFCTR3		0x0000030f
8718c2ecf20Sopenharmony_ci#define MSR_P4_IQ_PERFCTR4		0x00000310
8728c2ecf20Sopenharmony_ci#define MSR_P4_IQ_PERFCTR5		0x00000311
8738c2ecf20Sopenharmony_ci#define MSR_P4_BPU_CCCR0		0x00000360
8748c2ecf20Sopenharmony_ci#define MSR_P4_BPU_CCCR1		0x00000361
8758c2ecf20Sopenharmony_ci#define MSR_P4_BPU_CCCR2		0x00000362
8768c2ecf20Sopenharmony_ci#define MSR_P4_BPU_CCCR3		0x00000363
8778c2ecf20Sopenharmony_ci#define MSR_P4_MS_CCCR0			0x00000364
8788c2ecf20Sopenharmony_ci#define MSR_P4_MS_CCCR1			0x00000365
8798c2ecf20Sopenharmony_ci#define MSR_P4_MS_CCCR2			0x00000366
8808c2ecf20Sopenharmony_ci#define MSR_P4_MS_CCCR3			0x00000367
8818c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_CCCR0		0x00000368
8828c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_CCCR1		0x00000369
8838c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_CCCR2		0x0000036a
8848c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_CCCR3		0x0000036b
8858c2ecf20Sopenharmony_ci#define MSR_P4_IQ_CCCR0			0x0000036c
8868c2ecf20Sopenharmony_ci#define MSR_P4_IQ_CCCR1			0x0000036d
8878c2ecf20Sopenharmony_ci#define MSR_P4_IQ_CCCR2			0x0000036e
8888c2ecf20Sopenharmony_ci#define MSR_P4_IQ_CCCR3			0x0000036f
8898c2ecf20Sopenharmony_ci#define MSR_P4_IQ_CCCR4			0x00000370
8908c2ecf20Sopenharmony_ci#define MSR_P4_IQ_CCCR5			0x00000371
8918c2ecf20Sopenharmony_ci#define MSR_P4_ALF_ESCR0		0x000003ca
8928c2ecf20Sopenharmony_ci#define MSR_P4_ALF_ESCR1		0x000003cb
8938c2ecf20Sopenharmony_ci#define MSR_P4_BPU_ESCR0		0x000003b2
8948c2ecf20Sopenharmony_ci#define MSR_P4_BPU_ESCR1		0x000003b3
8958c2ecf20Sopenharmony_ci#define MSR_P4_BSU_ESCR0		0x000003a0
8968c2ecf20Sopenharmony_ci#define MSR_P4_BSU_ESCR1		0x000003a1
8978c2ecf20Sopenharmony_ci#define MSR_P4_CRU_ESCR0		0x000003b8
8988c2ecf20Sopenharmony_ci#define MSR_P4_CRU_ESCR1		0x000003b9
8998c2ecf20Sopenharmony_ci#define MSR_P4_CRU_ESCR2		0x000003cc
9008c2ecf20Sopenharmony_ci#define MSR_P4_CRU_ESCR3		0x000003cd
9018c2ecf20Sopenharmony_ci#define MSR_P4_CRU_ESCR4		0x000003e0
9028c2ecf20Sopenharmony_ci#define MSR_P4_CRU_ESCR5		0x000003e1
9038c2ecf20Sopenharmony_ci#define MSR_P4_DAC_ESCR0		0x000003a8
9048c2ecf20Sopenharmony_ci#define MSR_P4_DAC_ESCR1		0x000003a9
9058c2ecf20Sopenharmony_ci#define MSR_P4_FIRM_ESCR0		0x000003a4
9068c2ecf20Sopenharmony_ci#define MSR_P4_FIRM_ESCR1		0x000003a5
9078c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_ESCR0		0x000003a6
9088c2ecf20Sopenharmony_ci#define MSR_P4_FLAME_ESCR1		0x000003a7
9098c2ecf20Sopenharmony_ci#define MSR_P4_FSB_ESCR0		0x000003a2
9108c2ecf20Sopenharmony_ci#define MSR_P4_FSB_ESCR1		0x000003a3
9118c2ecf20Sopenharmony_ci#define MSR_P4_IQ_ESCR0			0x000003ba
9128c2ecf20Sopenharmony_ci#define MSR_P4_IQ_ESCR1			0x000003bb
9138c2ecf20Sopenharmony_ci#define MSR_P4_IS_ESCR0			0x000003b4
9148c2ecf20Sopenharmony_ci#define MSR_P4_IS_ESCR1			0x000003b5
9158c2ecf20Sopenharmony_ci#define MSR_P4_ITLB_ESCR0		0x000003b6
9168c2ecf20Sopenharmony_ci#define MSR_P4_ITLB_ESCR1		0x000003b7
9178c2ecf20Sopenharmony_ci#define MSR_P4_IX_ESCR0			0x000003c8
9188c2ecf20Sopenharmony_ci#define MSR_P4_IX_ESCR1			0x000003c9
9198c2ecf20Sopenharmony_ci#define MSR_P4_MOB_ESCR0		0x000003aa
9208c2ecf20Sopenharmony_ci#define MSR_P4_MOB_ESCR1		0x000003ab
9218c2ecf20Sopenharmony_ci#define MSR_P4_MS_ESCR0			0x000003c0
9228c2ecf20Sopenharmony_ci#define MSR_P4_MS_ESCR1			0x000003c1
9238c2ecf20Sopenharmony_ci#define MSR_P4_PMH_ESCR0		0x000003ac
9248c2ecf20Sopenharmony_ci#define MSR_P4_PMH_ESCR1		0x000003ad
9258c2ecf20Sopenharmony_ci#define MSR_P4_RAT_ESCR0		0x000003bc
9268c2ecf20Sopenharmony_ci#define MSR_P4_RAT_ESCR1		0x000003bd
9278c2ecf20Sopenharmony_ci#define MSR_P4_SAAT_ESCR0		0x000003ae
9288c2ecf20Sopenharmony_ci#define MSR_P4_SAAT_ESCR1		0x000003af
9298c2ecf20Sopenharmony_ci#define MSR_P4_SSU_ESCR0		0x000003be
9308c2ecf20Sopenharmony_ci#define MSR_P4_SSU_ESCR1		0x000003bf /* guess: not in manual */
9318c2ecf20Sopenharmony_ci
9328c2ecf20Sopenharmony_ci#define MSR_P4_TBPU_ESCR0		0x000003c2
9338c2ecf20Sopenharmony_ci#define MSR_P4_TBPU_ESCR1		0x000003c3
9348c2ecf20Sopenharmony_ci#define MSR_P4_TC_ESCR0			0x000003c4
9358c2ecf20Sopenharmony_ci#define MSR_P4_TC_ESCR1			0x000003c5
9368c2ecf20Sopenharmony_ci#define MSR_P4_U2L_ESCR0		0x000003b0
9378c2ecf20Sopenharmony_ci#define MSR_P4_U2L_ESCR1		0x000003b1
9388c2ecf20Sopenharmony_ci
9398c2ecf20Sopenharmony_ci#define MSR_P4_PEBS_MATRIX_VERT		0x000003f2
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_ci/* Intel Core-based CPU performance counters */
9428c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_FIXED_CTR0	0x00000309
9438c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_FIXED_CTR1	0x0000030a
9448c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_FIXED_CTR2	0x0000030b
9458c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_FIXED_CTR3	0x0000030c
9468c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_FIXED_CTR_CTRL	0x0000038d
9478c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_STATUS	0x0000038e
9488c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_CTRL	0x0000038f
9498c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL	0x00000390
9508c2ecf20Sopenharmony_ci
9518c2ecf20Sopenharmony_ci#define MSR_PERF_METRICS		0x00000329
9528c2ecf20Sopenharmony_ci
9538c2ecf20Sopenharmony_ci/* PERF_GLOBAL_OVF_CTL bits */
9548c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT	55
9558c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI		(1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT)
9568c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF_BIT		62
9578c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF			(1ULL <<  MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF_BIT)
9588c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD_BIT		63
9598c2ecf20Sopenharmony_ci#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD			(1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD_BIT)
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_ci/* Geode defined MSRs */
9628c2ecf20Sopenharmony_ci#define MSR_GEODE_BUSCONT_CONF0		0x00001900
9638c2ecf20Sopenharmony_ci
9648c2ecf20Sopenharmony_ci/* Intel VT MSRs */
9658c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_BASIC              0x00000480
9668c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_PINBASED_CTLS      0x00000481
9678c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_PROCBASED_CTLS     0x00000482
9688c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_EXIT_CTLS          0x00000483
9698c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_ENTRY_CTLS         0x00000484
9708c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_MISC               0x00000485
9718c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_CR0_FIXED0         0x00000486
9728c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_CR0_FIXED1         0x00000487
9738c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_CR4_FIXED0         0x00000488
9748c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_CR4_FIXED1         0x00000489
9758c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_VMCS_ENUM          0x0000048a
9768c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_PROCBASED_CTLS2    0x0000048b
9778c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_EPT_VPID_CAP       0x0000048c
9788c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_TRUE_PINBASED_CTLS  0x0000048d
9798c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x0000048e
9808c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_TRUE_EXIT_CTLS      0x0000048f
9818c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_TRUE_ENTRY_CTLS     0x00000490
9828c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_VMFUNC             0x00000491
9838c2ecf20Sopenharmony_ci
9848c2ecf20Sopenharmony_ci/* VMX_BASIC bits and bitmasks */
9858c2ecf20Sopenharmony_ci#define VMX_BASIC_VMCS_SIZE_SHIFT	32
9868c2ecf20Sopenharmony_ci#define VMX_BASIC_TRUE_CTLS		(1ULL << 55)
9878c2ecf20Sopenharmony_ci#define VMX_BASIC_64		0x0001000000000000LLU
9888c2ecf20Sopenharmony_ci#define VMX_BASIC_MEM_TYPE_SHIFT	50
9898c2ecf20Sopenharmony_ci#define VMX_BASIC_MEM_TYPE_MASK	0x003c000000000000LLU
9908c2ecf20Sopenharmony_ci#define VMX_BASIC_MEM_TYPE_WB	6LLU
9918c2ecf20Sopenharmony_ci#define VMX_BASIC_INOUT		0x0040000000000000LLU
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci/* MSR_IA32_VMX_MISC bits */
9948c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_MISC_INTEL_PT                 (1ULL << 14)
9958c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
9968c2ecf20Sopenharmony_ci#define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE   0x1F
9978c2ecf20Sopenharmony_ci/* AMD-V MSRs */
9988c2ecf20Sopenharmony_ci
9998c2ecf20Sopenharmony_ci#define MSR_VM_CR                       0xc0010114
10008c2ecf20Sopenharmony_ci#define MSR_VM_IGNNE                    0xc0010115
10018c2ecf20Sopenharmony_ci#define MSR_VM_HSAVE_PA                 0xc0010117
10028c2ecf20Sopenharmony_ci
10038c2ecf20Sopenharmony_ci#endif /* _ASM_X86_MSR_INDEX_H */
1004