Lines Matching full:msr

1 /* msr tests */
6 #include "msr.h"
12 * 2. Custom: by providing command line arguments it is possible to test any MSR and value
14 * 1. msr index as a base 16 number
30 #define MSR_TEST(msr, val, ro) \ argument
31 { .index = msr, .name = #msr, .value = val, .is_64bit_only = false, .keep = ro }
32 #define MSR_TEST_ONLY64(msr, val, ro) \ argument
33 { .index = msr, .name = #msr, .value = val, .is_64bit_only = true, .keep = ro }
55 static void __test_msr_rw(u32 msr, const char *name, unsigned long long val, in __test_msr_rw() argument
60 orig = rdmsr(msr); in __test_msr_rw()
66 if (msr == MSR_EFER) in __test_msr_rw()
71 wrmsr(msr, val); in __test_msr_rw()
72 r = rdmsr(msr); in __test_msr_rw()
73 wrmsr(msr, orig); in __test_msr_rw()
83 static void test_msr_rw(u32 msr, const char *name, unsigned long long val) in test_msr_rw() argument
85 __test_msr_rw(msr, name, val, 0); in test_msr_rw()
88 static void test_wrmsr(u32 msr, const char *name, unsigned long long val) in test_wrmsr() argument
90 unsigned char vector = wrmsr_safe(msr, val); in test_wrmsr()
97 static void test_wrmsr_fault(u32 msr, const char *name, unsigned long long val) in test_wrmsr_fault() argument
99 unsigned char vector = wrmsr_safe(msr, val); in test_wrmsr_fault()
106 static void test_rdmsr_fault(u32 msr, const char *name) in test_rdmsr_fault() argument
109 unsigned char vector = rdmsr_safe(msr, &ignored); in test_rdmsr_fault()
115 static void test_wrmsr_fep_fault(u32 msr, const char *name, in test_wrmsr_fep_fault() argument
118 unsigned char vector = wrmsr_fep_safe(msr, val); in test_wrmsr_fep_fault()
125 static void test_msr(struct msr_info *msr, bool is_64bit_host) in test_msr() argument
127 if (is_64bit_host || !msr->is_64bit_only) { in test_msr()
128 __test_msr_rw(msr->index, msr->name, msr->value, msr->keep); in test_msr()
134 if (msr->is_64bit_only && in test_msr()
135 msr->value == addr_64) in test_msr()
136 test_wrmsr_fault(msr->index, msr->name, NONCANONICAL); in test_msr()
138 test_wrmsr_fault(msr->index, msr->name, msr->value); in test_msr()
139 test_rdmsr_fault(msr->index, msr->name); in test_msr()
148 snprintf(msr_name, sizeof(msr_name), "MSR:0x%x", index); in test_custom_msr()
150 struct msr_info msr = { in test_custom_msr() local
155 test_msr(&msr, is_64bit_host); in test_custom_msr()
184 * STATUS MSRs can only be written with '0' (to clear the MSR), in test_mce_msrs()
213 * without jumping to a new base address), as the last unclaimed MSR is in test_mce_msrs()
244 snprintf(msr_name, sizeof(msr_name), "x2APIC MSR 0x%x", index); in __test_x2apic_msrs()
353 * If the user provided an MSR+value, test exactly that and skip all in main()