Skip to content

Commit a0a6eb4

Browse files
binbinwu1Eddie Dong
authored andcommitted
hv: msr: use UL since ia32_misc_enable is 64bit
Merge two parts of different definitions for MSR_IA32_MISC_ENABLE fields. - use the prefix "MSR_IA32_" to align with others - Change MSR_IA32_MISC_ENABLE_XD to MSR_IA32_MISC_ENABLE_XD_DISABLE to align the meaning of the filed since it is "XD bit disable" Use UL instead of U as the filed bit mask because MSR_IA32_MISC_ENABLE is 64-bit. Tracked-On: #2834 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 7494ed2 commit a0a6eb4

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

hypervisor/arch/x86/cpu_caps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ bool has_monitor_cap(void)
7777
static inline bool is_fast_string_erms_supported_and_enabled(void)
7878
{
7979
bool ret = false;
80-
uint32_t misc_enable = (uint32_t)msr_read(MSR_IA32_MISC_ENABLE);
80+
uint64_t misc_enable = msr_read(MSR_IA32_MISC_ENABLE);
8181

82-
if ((misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) == 0U) {
82+
if ((misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) == 0UL) {
8383
pr_fatal("%s, fast string is not enabled\n", __func__);
8484
} else {
8585
if (!pcpu_has_cap(X86_FEATURE_ERMS)) {

hypervisor/include/arch/x86/msr.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,17 @@
551551
#define PAT_MEM_TYPE_UCM 0x07UL /* uncached minus */
552552

553553
/* MISC_ENABLE bits: architectural */
554-
#define MSR_IA32_MISC_ENABLE_FAST_STRING (1U << 0U)
554+
#define MSR_IA32_MISC_ENABLE_FAST_STRING (1UL << 0U)
555+
#define MSR_IA32_MISC_ENABLE_TCC (1UL << 3U)
556+
#define MSR_IA32_MISC_ENABLE_PMA (1UL << 7U)
557+
#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1UL << 11U)
558+
#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1UL << 12U)
559+
#define MSR_IA32_MISC_ENABLE_TM2_ENABLE (1UL << 13U)
560+
#define MSR_IA32_MISC_ENABLE_EITS (1UL << 16U)
561+
#define MSR_IA32_MISC_ENABLE_MONITOR_ENA (1UL << 18U)
562+
#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1UL << 22U)
563+
#define MSR_IA32_MISC_ENABLE_xTPR (1UL << 23U)
564+
#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1UL << 34U)
555565

556566
#ifndef ASSEMBLER
557567
static inline bool pat_mem_type_invalid(uint64_t x)
@@ -624,17 +634,4 @@ void update_msr_bitmap_x2apic_passthru(const struct acrn_vcpu *vcpu);
624634
/* Flush L1 D-cache */
625635
#define IA32_L1D_FLUSH (1UL << 0U)
626636

627-
/* MSR_IA32_MISC_ENABLE */
628-
#define MISC_ENABLE_FAST_STRING (1U << 0U)
629-
#define MISC_ENABLE_TCC (1U << 3U)
630-
#define MISC_ENABLE_PMA (1U << 7U)
631-
#define MISC_ENABLE_BTS_UNAVAIL (1U << 11U)
632-
#define MISC_ENABLE_PEBS_UNAVAIL (1U << 12U)
633-
#define MISC_ENABLE_TM2_ENABLE (1U << 13U)
634-
#define MISC_ENABLE_EITS (1U << 16U)
635-
#define MISC_ENABLE_MONITOR_ENA (1U << 18U)
636-
#define MISC_ENABLE_LIMIT_CPUID (1U << 22U)
637-
#define MISC_ENABLE_xTPR (1U << 23U)
638-
#define MISC_ENABLE_XD (1U << 34U)
639-
640637
#endif /* MSR_H */

0 commit comments

Comments
 (0)