/linux/tools/testing/selftests/kvm/x86_64/ |
H A D | hyperv_features.c | 37 static bool is_write_only_msr(uint32_t msr) in is_write_only_msr() argument 39 return msr == HV_X64_MSR_EOI; in is_write_only_msr() 42 static void guest_msr(struct msr_data *msr) in guest_msr() argument 47 GUEST_ASSERT(msr->idx); in guest_msr() 49 if (msr->write) in guest_msr() 50 vector = wrmsr_safe(msr->idx, msr->write_val); in guest_msr() 52 if (!vector && (!msr->write || !is_write_only_msr(msr->idx))) in guest_msr() 53 vector = rdmsr_safe(msr->idx, &msr_val); in guest_msr() 55 if (msr->fault_expected) in guest_msr() 58 msr->write ? "WR" : "RD", msr->idx, vector); in guest_msr() [all …]
|
H A D | userspace_msr_exit_test.c | 80 static void deny_msr(uint8_t *bitmap, u32 msr) in deny_msr() argument 82 u32 idx = msr & (KVM_MSR_FILTER_MAX_BITMAP_SIZE - 1); in deny_msr() 145 static noinline uint64_t test_rdmsr(uint32_t msr) in test_rdmsr() argument 152 "=a"(a), "=d"(d) : "c"(msr) : "memory"); in test_rdmsr() 161 static noinline void test_wrmsr(uint32_t msr, uint64_t value) in test_wrmsr() argument 169 "a"(a), "d"(d), "c"(msr) : "memory"); in test_wrmsr() 179 static noinline uint64_t test_em_rdmsr(uint32_t msr) in test_em_rdmsr() argument 186 "=a"(a), "=d"(d) : "c"(msr) : "memory"); in test_em_rdmsr() 195 static noinline void test_em_wrmsr(uint32_t msr, uint64_t value) in test_em_wrmsr() argument 203 "a"(a), "d"(d), "c"(msr) : "memory"); in test_em_wrmsr() [all …]
|
H A D | kvm_pv_test.c | 20 #define TEST_MSR(msr) { .idx = msr, .name = #msr } argument 22 #define PR_MSR(msr) ucall(UCALL_PR_MSR, 1, msr) argument 41 static void test_msr(struct msr_data *msr) in test_msr() argument 46 PR_MSR(msr); in test_msr() 48 vector = rdmsr_safe(msr->idx, &ignored); in test_msr() 51 vector = wrmsr_safe(msr->idx, 0); in test_msr() 100 struct msr_data *msr = (struct msr_data *)uc->args[0]; in pr_msr() local 102 pr_info("testing msr: %s (%#x)\n", msr->name, msr->idx); in pr_msr()
|
/linux/arch/x86/kernel/cpu/ |
H A D | perfctr-watchdog.c | 45 static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) in nmi_perfctr_msr_to_bit() argument 51 if (msr >= MSR_F15H_PERF_CTR) in nmi_perfctr_msr_to_bit() 52 return (msr - MSR_F15H_PERF_CTR) >> 1; in nmi_perfctr_msr_to_bit() 53 return msr - MSR_K7_PERFCTR0; in nmi_perfctr_msr_to_bit() 56 return msr - MSR_ARCH_PERFMON_PERFCTR0; in nmi_perfctr_msr_to_bit() 60 return msr - MSR_P6_PERFCTR0; in nmi_perfctr_msr_to_bit() 62 return msr - MSR_KNC_PERFCTR0; in nmi_perfctr_msr_to_bit() 64 return msr - MSR_P4_BPU_PERFCTR0; in nmi_perfctr_msr_to_bit() 69 return msr - MSR_ARCH_PERFMON_PERFCTR0; in nmi_perfctr_msr_to_bit() 78 static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) in nmi_evntsel_msr_to_bit() argument [all …]
|
H A D | feat_ctl.c | 119 u64 msr; in init_ia32_feat_ctl() local 121 if (rdmsrl_safe(MSR_IA32_FEAT_CTL, &msr)) { in init_ia32_feat_ctl() 141 if (msr & FEAT_CTL_LOCKED) in init_ia32_feat_ctl() 148 msr = FEAT_CTL_LOCKED; in init_ia32_feat_ctl() 156 msr |= FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX; in init_ia32_feat_ctl() 159 msr |= FEAT_CTL_VMX_ENABLED_INSIDE_SMX; in init_ia32_feat_ctl() 163 msr |= FEAT_CTL_SGX_ENABLED; in init_ia32_feat_ctl() 165 msr |= FEAT_CTL_SGX_LC_ENABLED; in init_ia32_feat_ctl() 168 wrmsrl(MSR_IA32_FEAT_CTL, msr); in init_ia32_feat_ctl() 176 if ( (tboot && !(msr & FEAT_CTL_VMX_ENABLED_INSIDE_SMX)) || in init_ia32_feat_ctl() [all …]
|
/linux/arch/x86/include/asm/ |
H A D | msr.h | 19 struct msr reg; 20 struct msr __percpu *msrs; 66 extern void do_trace_write_msr(unsigned int msr, u64 val, int failed); 67 extern void do_trace_read_msr(unsigned int msr, u64 val, int failed); 68 extern void do_trace_rdpmc(unsigned int msr, u64 val, int failed); 70 static inline void do_trace_write_msr(unsigned int msr, u64 val, int failed) {} in do_trace_write_msr() argument 71 static inline void do_trace_read_msr(unsigned int msr, u64 val, int failed) {} in do_trace_read_msr() argument 72 static inline void do_trace_rdpmc(unsigned int msr, u64 val, int failed) {} in do_trace_rdpmc() argument 82 static __always_inline unsigned long long __rdmsr(unsigned int msr) in __rdmsr() argument 89 : EAX_EDX_RET(val, low, high) : "c" (msr)); in __rdmsr() [all …]
|
H A D | msr-trace.h | 3 #define TRACE_SYSTEM msr 6 #define TRACE_INCLUDE_FILE msr-trace 22 TP_PROTO(unsigned msr, u64 val, int failed), 23 TP_ARGS(msr, val, failed), 25 __field( unsigned, msr ) 30 __entry->msr = msr; 35 __entry->msr, 41 TP_PROTO(unsigned msr, u64 val, int failed), 42 TP_ARGS(msr, val, failed) 46 TP_PROTO(unsigned msr, u64 val, int failed), [all …]
|
/linux/arch/powerpc/kvm/ |
H A D | book3s_hv_tm.c | 19 u64 msr = vcpu->arch.shregs.msr; in emulate_tx_failure() local 23 if (MSR_TM_SUSPENDED(vcpu->arch.shregs.msr)) in emulate_tx_failure() 25 if (msr & MSR_PR) { in emulate_tx_failure() 45 u64 msr = vcpu->arch.shregs.msr; in kvmhv_p9_tm_emulation() local 74 WARN_ON_ONCE(!(MSR_TM_SUSPENDED(msr) && in kvmhv_p9_tm_emulation() 78 vcpu->arch.shregs.msr = newmsr; in kvmhv_p9_tm_emulation() 84 if ((msr & MSR_PR) && (vcpu->arch.vcore->pcr & PCR_ARCH_206)) { in kvmhv_p9_tm_emulation() 96 if ((msr & MSR_PR) && !(vcpu->arch.fscr & FSCR_EBB)) { in kvmhv_p9_tm_emulation() 105 WARN_ON_ONCE(!(MSR_TM_SUSPENDED(msr) && in kvmhv_p9_tm_emulation() 111 msr = (msr & ~MSR_TS_MASK) | MSR_TS_T; in kvmhv_p9_tm_emulation() [all …]
|
H A D | book3s_hv_tm_builtin.c | 23 u64 newmsr, msr, bescr; in kvmhv_p9_tm_emulation_early() local 45 vcpu->arch.shregs.msr = newmsr; in kvmhv_p9_tm_emulation_early() 52 msr = vcpu->arch.shregs.msr; in kvmhv_p9_tm_emulation_early() 53 if ((msr & MSR_PR) && (vcpu->arch.vcore->pcr & PCR_ARCH_206)) in kvmhv_p9_tm_emulation_early() 57 ((msr & MSR_PR) && !(mfspr(SPRN_FSCR) & FSCR_EBB))) in kvmhv_p9_tm_emulation_early() 67 msr = (msr & ~MSR_TS_MASK) | MSR_TS_T; in kvmhv_p9_tm_emulation_early() 68 vcpu->arch.shregs.msr = msr; in kvmhv_p9_tm_emulation_early() 77 msr = vcpu->arch.shregs.msr; in kvmhv_p9_tm_emulation_early() 82 newmsr = (newmsr & ~MSR_LE) | (msr & MSR_LE); in kvmhv_p9_tm_emulation_early() 84 vcpu->arch.shregs.msr = newmsr; in kvmhv_p9_tm_emulation_early() [all …]
|
/linux/arch/x86/lib/ |
H A D | msr.c | 9 struct msr __percpu *msrs_alloc(void) in msrs_alloc() 11 struct msr __percpu *msrs = NULL; in msrs_alloc() 13 msrs = alloc_percpu(struct msr); in msrs_alloc() 23 void msrs_free(struct msr __percpu *msrs) in msrs_free() 39 static int msr_read(u32 msr, struct msr *m) in msr_read() argument 44 err = rdmsrl_safe(msr, &val); in msr_read() 59 static int msr_write(u32 msr, struct msr *m) in msr_write() argument 61 return wrmsrl_safe(msr, m->q); in msr_write() 64 static inline int __flip_bit(u32 msr, u8 bit, bool set) in __flip_bit() argument 66 struct msr m, m1; in __flip_bit() [all …]
|
/linux/drivers/powercap/ |
H A D | intel_rapl_msr.c | 37 .reg_unit.msr = MSR_RAPL_POWER_UNIT, 38 .regs[RAPL_DOMAIN_PACKAGE][RAPL_DOMAIN_REG_LIMIT].msr = MSR_PKG_POWER_LIMIT, 39 .regs[RAPL_DOMAIN_PACKAGE][RAPL_DOMAIN_REG_STATUS].msr = MSR_PKG_ENERGY_STATUS, 40 .regs[RAPL_DOMAIN_PACKAGE][RAPL_DOMAIN_REG_PERF].msr = MSR_PKG_PERF_STATUS, 41 .regs[RAPL_DOMAIN_PACKAGE][RAPL_DOMAIN_REG_INFO].msr = MSR_PKG_POWER_INFO, 42 .regs[RAPL_DOMAIN_PP0][RAPL_DOMAIN_REG_LIMIT].msr = MSR_PP0_POWER_LIMIT, 43 .regs[RAPL_DOMAIN_PP0][RAPL_DOMAIN_REG_STATUS].msr = MSR_PP0_ENERGY_STATUS, 44 .regs[RAPL_DOMAIN_PP0][RAPL_DOMAIN_REG_POLICY].msr = MSR_PP0_POLICY, 45 .regs[RAPL_DOMAIN_PP1][RAPL_DOMAIN_REG_LIMIT].msr = MSR_PP1_POWER_LIMIT, 46 .regs[RAPL_DOMAIN_PP1][RAPL_DOMAIN_REG_STATUS].msr = MSR_PP1_ENERGY_STATUS, [all …]
|
/linux/arch/m68k/bvme6000/ |
H A D | config.c | 166 unsigned char msr; in bvme6000_timer_int() local 169 msr = rtc->msr & 0xc0; in bvme6000_timer_int() 170 rtc->msr = msr | 0x20; /* Ack the interrupt */ in bvme6000_timer_int() 191 unsigned char msr = rtc->msr & 0xc0; in bvme6000_sched_init() local 193 rtc->msr = 0; /* Ensure timer registers accessible */ in bvme6000_sched_init() 203 rtc->msr = 0x40; /* Access int.cntrl, etc */ in bvme6000_sched_init() 208 rtc->msr = 0; /* Access timer 1 control */ in bvme6000_sched_init() 211 rtc->msr = msr; in bvme6000_sched_init() 233 unsigned char msr, msb; in bvme6000_read_clk() local 239 msr = rtc->msr & 0xc0; in bvme6000_read_clk() [all …]
|
H A D | rtc.c | 42 unsigned char msr; in rtc_ioctl() local 52 msr = rtc->msr & 0xc0; in rtc_ioctl() 53 rtc->msr = 0x40; in rtc_ioctl() 66 rtc->msr = msr; in rtc_ioctl() 108 msr = rtc->msr & 0xc0; in rtc_ioctl() 109 rtc->msr = 0x40; in rtc_ioctl() 123 rtc->msr = msr; in rtc_ioctl()
|
/linux/arch/x86/xen/ |
H A D | pmu.c | 131 static inline bool is_amd_pmu_msr(unsigned int msr) in is_amd_pmu_msr() argument 137 if ((msr >= MSR_F15H_PERF_CTL && in is_amd_pmu_msr() 138 msr < MSR_F15H_PERF_CTR + (amd_num_counters * 2)) || in is_amd_pmu_msr() 139 (msr >= MSR_K7_EVNTSEL0 && in is_amd_pmu_msr() 140 msr < MSR_K7_PERFCTR0 + amd_num_counters)) in is_amd_pmu_msr() 197 static bool xen_intel_pmu_emulate(unsigned int msr, u64 *val, int type, in xen_intel_pmu_emulate() argument 213 switch (msr) { in xen_intel_pmu_emulate() 251 if (msr == MSR_CORE_PERF_GLOBAL_OVF_CTRL) in xen_intel_pmu_emulate() 260 static bool xen_amd_pmu_emulate(unsigned int msr, u64 *val, bool is_read) in xen_amd_pmu_emulate() argument 273 ((msr >= MSR_K7_EVNTSEL0) && (msr <= MSR_K7_PERFCTR3))) in xen_amd_pmu_emulate() [all …]
|
/linux/arch/x86/kvm/svm/ |
H A D | pmu.c | 38 static inline struct kvm_pmc *get_gp_pmc_amd(struct kvm_pmu *pmu, u32 msr, in get_gp_pmc_amd() argument 47 switch (msr) { in get_gp_pmc_amd() 55 idx = (unsigned int)((msr - MSR_F15H_PERF_CTL0) / 2); in get_gp_pmc_amd() 56 if (!(msr & 0x1) != (type == PMU_TYPE_EVNTSEL)) in get_gp_pmc_amd() 62 idx = msr - MSR_K7_EVNTSEL0; in get_gp_pmc_amd() 67 idx = msr - MSR_K7_PERFCTR0; in get_gp_pmc_amd() 93 static struct kvm_pmc *amd_msr_idx_to_pmc(struct kvm_vcpu *vcpu, u32 msr) in amd_msr_idx_to_pmc() argument 98 pmc = get_gp_pmc_amd(pmu, msr, PMU_TYPE_COUNTER); in amd_msr_idx_to_pmc() 99 pmc = pmc ? pmc : get_gp_pmc_amd(pmu, msr, PMU_TYPE_EVNTSEL); in amd_msr_idx_to_pmc() 104 static bool amd_is_valid_msr(struct kvm_vcpu *vcpu, u32 msr) in amd_is_valid_msr() argument [all …]
|
/linux/arch/microblaze/kernel/ |
H A D | process.c | 45 regs->msr, regs->ear, regs->esr, regs->fsr); in show_regs() 72 local_save_flags(childregs->msr); in copy_thread() 73 ti->cpu_context.msr = childregs->msr & ~MSR_IE; in copy_thread() 83 childregs->msr |= MSR_UMS; in copy_thread() 95 childregs->msr &= ~MSR_EIP; in copy_thread() 96 childregs->msr |= MSR_IE; in copy_thread() 97 childregs->msr &= ~MSR_VM; in copy_thread() 98 childregs->msr |= MSR_VMS; in copy_thread() 99 childregs->msr |= MSR_EE; /* exceptions will be enabled*/ in copy_thread() 101 ti->cpu_context.msr = (childregs->msr|MSR_VM); in copy_thread() [all …]
|
/linux/arch/powerpc/kernel/ |
H A D | signal_64.c | 130 unsigned long msr = regs->msr; in __unsafe_setup_sigcontext() local 147 msr |= MSR_VEC; in __unsafe_setup_sigcontext() 163 msr &= ~MSR_VSX; in __unsafe_setup_sigcontext() 176 msr |= MSR_VSX; in __unsafe_setup_sigcontext() 181 unsafe_put_user(msr, &sc->gp_regs[PT_MSR], efault_out); in __unsafe_setup_sigcontext() 210 unsigned long msr) in setup_tm_sigcontexts() argument 229 BUG_ON(!MSR_TM_ACTIVE(msr)); in setup_tm_sigcontexts() 237 msr |= tsk->thread.ckpt_regs.msr & (MSR_FP | MSR_VEC | MSR_VSX); in setup_tm_sigcontexts() 251 if (msr & MSR_VEC) in setup_tm_sigcontexts() 263 msr |= MSR_VEC; in setup_tm_sigcontexts() [all …]
|
H A D | signal_32.c | 271 unsigned long msr = regs->msr; in __unsafe_save_user_regs() local 283 msr |= MSR_VEC; in __unsafe_save_user_regs() 302 msr &= ~MSR_VSX; in __unsafe_save_user_regs() 312 msr |= MSR_VSX; in __unsafe_save_user_regs() 322 msr |= MSR_SPE; in __unsafe_save_user_regs() 331 unsafe_put_user(msr, &frame->mc_gregs[PT_MSR], failed); in __unsafe_save_user_regs() 370 struct mcontext __user *tm_frame, unsigned long msr) in save_tm_user_regs_unsafe() argument 382 unsafe_put_user((msr >> 32), &tm_frame->mc_gregs[PT_MSR], failed); in save_tm_user_regs_unsafe() 388 if (msr & MSR_VEC) in save_tm_user_regs_unsafe() 400 msr |= MSR_VEC; in save_tm_user_regs_unsafe() [all …]
|
H A D | cpu_setup_power.c | 19 u64 msr; in init_hvmode_206() local 21 msr = mfmsr(); in init_hvmode_206() 22 if (msr & MSR_HV) in init_hvmode_206() 153 u64 msr; in __restore_cpu_power7() local 155 msr = mfmsr(); in __restore_cpu_power7() 156 if (!(msr & MSR_HV)) in __restore_cpu_power7() 185 u64 msr; in __restore_cpu_power8() local 191 msr = mfmsr(); in __restore_cpu_power8() 192 if (!(msr & MSR_HV)) in __restore_cpu_power8() 225 u64 msr; in __restore_cpu_power9() local [all …]
|
/linux/arch/x86/events/ |
H A D | probe.c | 19 perf_msr_probe(struct perf_msr *msr, int cnt, bool zero, void *data) in perf_msr_probe() argument 29 if (!msr[bit].no_check) { in perf_msr_probe() 30 struct attribute_group *grp = msr[bit].grp; in perf_msr_probe() 40 if (!msr[bit].msr) in perf_msr_probe() 43 if (msr[bit].test && !msr[bit].test(bit, data)) in perf_msr_probe() 46 if (rdmsrl_safe(msr[bit].msr, &val)) in perf_msr_probe() 49 mask = msr[bit].mask; in perf_msr_probe()
|
/linux/arch/arm64/kvm/hyp/nvhe/ |
H A D | hyp-init.S | 96 msr mair_el2, x1 99 msr hcr_el2, x1 108 msr tpidr_el2, x0 118 msr tpidr_el2, x1 121 msr vttbr_el2, x1 124 msr vtcr_el2, x1 131 msr ttbr0_el2, x2 134 msr tcr_el2, x0 156 msr sctlr_el2, x0 161 msr vbar_el2, x0 [all …]
|
/linux/tools/power/x86/turbostat/ |
H A D | turbostat.c | 390 int get_msr(int cpu, off_t offset, unsigned long long *msr); 445 unsigned long long msr = 3; in slm_bclk() local 449 if (get_msr(base_cpu, MSR_FSB_FREQ, &msr)) in slm_bclk() 452 i = msr & 0xf; in slm_bclk() 1134 unsigned long long msr[NUM_RAPL_COUNTERS]; member 1152 unsigned long long msr; member 1167 .msr = MSR_PKG_ENERGY_STATUS, 1180 .msr = MSR_PKG_ENERGY_STAT, 1193 .msr = MSR_PP0_ENERGY_STATUS, 1206 .msr = MSR_DRAM_ENERGY_STATUS, [all …]
|
/linux/tools/power/x86/x86_energy_perf_policy/ |
H A D | x86_energy_perf_policy.c | 680 int get_msr(int cpu, int offset, unsigned long long *msr) in get_msr() argument 691 retval = pread(fd, msr, sizeof(*msr), offset); in get_msr() 692 if (retval != sizeof(*msr)) { in get_msr() 698 fprintf(stderr, "get_msr(cpu%d, 0x%X, 0x%llX)\n", cpu, offset, *msr); in get_msr() 779 unsigned long long msr; in read_hwp_cap() local 781 get_msr(cpu, msr_offset, &msr); in read_hwp_cap() 783 cap->highest = msr_perf_2_ratio(HWP_HIGHEST_PERF(msr)); in read_hwp_cap() 784 cap->guaranteed = msr_perf_2_ratio(HWP_GUARANTEED_PERF(msr)); in read_hwp_cap() 785 cap->efficient = msr_perf_2_ratio(HWP_MOSTEFFICIENT_PERF(msr)); in read_hwp_cap() 786 cap->lowest = msr_perf_2_ratio(HWP_LOWEST_PERF(msr)); in read_hwp_cap() [all …]
|
/linux/arch/arm64/kernel/ |
H A D | hyp-stub.S | 51 msr vbar_el2, x1 100 msr hcr_el2, x0 107 msr tpidr_el2, x0 111 msr cpacr_el1, x0 113 msr vbar_el1, x0 119 msr mdcr_el2, x0 123 msr tcr_el1, x0 125 msr ttbr0_el1, x0 127 msr ttbr1_el1, x0 129 msr mair_el1, x0 [all …]
|
/linux/arch/powerpc/kernel/ptrace/ |
H A D | ptrace-tm.c | 34 return task->thread.ckpt_regs.msr | task->thread.fpexc_mode; in get_user_ckpt_msr() 37 static int set_user_ckpt_msr(struct task_struct *task, unsigned long msr) in set_user_ckpt_msr() argument 39 task->thread.ckpt_regs.msr &= ~MSR_DEBUGCHANGE; in set_user_ckpt_msr() 40 task->thread.ckpt_regs.msr |= msr & MSR_DEBUGCHANGE; in set_user_ckpt_msr() 63 if (!MSR_TM_ACTIVE(target->thread.regs->msr)) in tm_cgpr_active() 89 struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr)); in tm_cgpr_get() 97 if (!MSR_TM_ACTIVE(target->thread.regs->msr)) in tm_cgpr_get() 144 if (!MSR_TM_ACTIVE(target->thread.regs->msr)) in tm_cgpr_set() 164 offsetof(struct pt_regs, msr) + sizeof(long)); in tm_cgpr_set() 205 if (!MSR_TM_ACTIVE(target->thread.regs->msr)) in tm_cfpr_active() [all …]
|