MSR code cleanup part one
Subsystems (49)
Xin Li (Intel)
maintainerv4 cover MSR code cleanup part one
This patch set is the first part of the patch set:
MSR refactor with new MSR instructions support
@ https://lore.kernel.org/lkml/[email protected]/T/#m5a34be7d4ed55f0baca965cb65452a08e9ad7c8a
It's getting *WAY* too big, and whether to zap the pv_ops MSR APIs is still under argument. Dave Hansen suggested to focus on rename stuff first, most of which he acked.
Jürgen Groß also gave his RBs to the Xen MSR cleanup patches.
So here comes the first MSR cleanup patch set with version 4.
Changes in v4:
1) Add missing includes in a different patch (Ilpo Järvinen).
2) Add all necessary direct inclusions for msr.h (Ilpo Järvinen).
3) Remove two "else" that no longer make sense (Juergen Gross).
4) Collect RBs from Jürgen Groß and ABs from Peter Zijlstra.
Link to the previous v3 patch set:
https://lore.kernel.org/lkml/[email protected]/
This patch series is based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/msr
Xin Li (Intel) (15):
x86/msr: Add missing includes of <asm/msr.h>
x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h> x86/msr: Remove rdpmc()
x86/msr: Rename rdpmcl() to rdpmc()
x86/msr: Convert the rdpmc() macro into an always inline function x86/xen/msr: Return u64 consistently in Xen PMC read functions x86/msr: Convert __wrmsr() uses to native_wrmsr{,q}() uses x86/msr: Add the native_rdmsrq() helper
x86/msr: Convert __rdmsr() uses to native_rdmsrq() uses x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() in
pmu_msr_{read,write}() x86/xen/msr: Remove pmu_msr_{read,write}() x86/xen/msr: Remove the error pointer argument from set_seg() x86/pvops/msr: refactor pv_cpu_ops.write_msr{,_safe}() x86/msr: Replace wrmsr(msr, low, 0) with wrmsrq(msr, low) x86/msr: Change the function type of native_read_msr_safe()
arch/x86/coco/sev/core.c | 2 +- arch/x86/events/amd/brs.c | 4 +- arch/x86/events/amd/uncore.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/events/intel/core.c | 4 +- arch/x86/events/intel/ds.c | 2 +- arch/x86/events/msr.c | 3 + arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 + arch/x86/hyperv/hv_apic.c | 6 +- arch/x86/hyperv/hv_vtl.c | 4 +- arch/x86/hyperv/ivm.c | 3 +- arch/x86/include/asm/apic.h | 4 +- arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/microcode.h | 2 + arch/x86/include/asm/mshyperv.h | 3 +- arch/x86/include/asm/msr.h | 130 +++++------------- arch/x86/include/asm/paravirt.h | 57 ++++---- arch/x86/include/asm/paravirt_types.h | 10 +- arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 4 +- arch/x86/include/asm/tsc.h | 76 +++++++++- arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/common.c | 10 +- arch/x86/kernel/cpu/mce/core.c | 6 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 25 ++-- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 +- arch/x86/kernel/cpu/umwait.c | 4 +- arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/kvm.c | 2 +- arch/x86/kernel/kvmclock.c | 2 +- arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/tsc_sync.c | 1 + arch/x86/kvm/svm/svm.c | 34 ++--- arch/x86/kvm/vmx/vmx.c | 4 +- arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 5 +- arch/x86/realmode/init.c | 1 + arch/x86/xen/enlighten_pv.c | 58 ++++---- arch/x86/xen/pmu.c | 72 +++------- arch/x86/xen/xen-ops.h | 5 +- drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 3 +- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 + drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 + drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 + drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + .../intel/speed_select_if/isst_if_common.c | 1 + .../intel/speed_select_if/isst_if_mbox_msr.c | 1 + .../intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../intel/uncore-frequency/uncore-frequency.c | 1 + drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 + 74 files changed, 308 insertions(+), 295 deletions(-)
base-commit: a5447e92e169dafaf02fd653500105c7186d7128
Signature · 1 line
2.49.0
Xin Li (Intel)
maintainerPATCH v4 1/15 x86/msr: Add missing includes of <asm/msr.h>
For some reason, there are some TSC-related functions in the MSR header even though there is a tsc.h header.
To facilitate the relocation of rdtsc{,_ordered}() from <asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add <asm/msr.h> to the source files that reference definitions from <asm/msr.h>.
---
Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen). *) Add all necessary direct inclusions for msr.h (Ilpo Järvinen).
Change in v3:
* Add a problem statement to the changelog (Dave Hansen).
--- arch/x86/events/msr.c | 3 +++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++ arch/x86/hyperv/ivm.c | 1 + arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++ arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/tsc_sync.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/realmode/init.c | 1 + drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 3 ++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 + drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../thermal/intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 + 50 files changed, 63 insertions(+), 3 deletions(-)
arch/x86/events/msr.c +3 -0
@@ -3,6 +3,9 @@#include <linux/sysfs.h> #include <linux/nospec.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> +#include <asm/tsc.h> +#include "probe.h" enum perf_msr_id {
arch/x86/events/perf_event.h +1 -0
@@ -17,6 +17,7 @@#include <asm/fpu/xstate.h> #include <asm/intel_ds.h> #include <asm/cpu.h> +#include <asm/msr.h> /* To enable MSR tracing please use the generic trace points. */
arch/x86/events/probe.c +2 -0
@@ -2,6 +2,8 @@#include <linux/export.h> #include <linux/types.h> #include <linux/bits.h> + +#include <asm/msr.h> #include "probe.h" static umode_t
arch/x86/hyperv/ivm.c +1 -0
@@ -22,6 +22,7 @@#include <asm/realmode.h> #include <asm/e820/api.h> #include <asm/desc.h> +#include <asm/msr.h> #include <uapi/asm/vmx.h> #ifdef CONFIG_AMD_MEM_ENCRYPT
arch/x86/include/asm/fred.h +1 -0
@@ -9,6 +9,7 @@#include <linux/const.h> #include <asm/asm.h> +#include <asm/msr.h> #include <asm/trapnr.h> /*
arch/x86/include/asm/microcode.h +2 -0
@@ -2,6 +2,8 @@ #ifndef _ASM_X86_MICROCODE_H #define _ASM_X86_MICROCODE_H +#include <asm/msr.h> + struct cpu_signature { unsigned int sig; unsigned int pf;
arch/x86/include/asm/mshyperv.h +1 -0
@@ -8,6 +8,7 @@#include <linux/io.h> #include <asm/nospec-branch.h> #include <asm/paravirt.h> +#include <asm/msr.h> #include <hyperv/hvhdk.h> /*
arch/x86/include/asm/msr.h +1 -0
@@ -12,6 +12,7 @@#include <uapi/asm/msr.h> #include <asm/shared/msr.h> +#include <linux/types.h> #include <linux/percpu.h> struct msr_info {
arch/x86/include/asm/suspend_32.h +1 -0
@@ -9,6 +9,7 @@#include <asm/desc.h> #include <asm/fpu/api.h> +#include <asm/msr.h> /* image of the saved processor state */ struct saved_context {
arch/x86/include/asm/suspend_64.h +1 -0
@@ -9,6 +9,7 @@#include <asm/desc.h> #include <asm/fpu/api.h> +#include <asm/msr.h> /* * Image of the saved processor state, used by the low level ACPI suspend to
arch/x86/include/asm/switch_to.h +2 -0
@@ -52,6 +52,8 @@ do { \ } while (0)#ifdef CONFIG_X86_32 +#include <asm/msr.h> +static inline void refresh_sysenter_cs (struct thread_struct *thread) {/* Only happens when SEP is enabled, no need to test "SEP"arately: */
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +1 -0
@@ -25,6 +25,7 @@#include <asm/cpu_device_id.h> #include <asm/resctrl.h> #include <asm/perf_event.h> +#include <asm/msr.h> #include "../../events/perf_event.h" /* For X86_CONFIG() */ #include "internal.h"
arch/x86/kernel/fpu/xstate.h +1 -0
@@ -5,6 +5,7 @@#include <asm/cpufeature.h> #include <asm/fpu/xstate.h> #include <asm/fpu/xcr.h> +#include <asm/msr.h> #ifdef CONFIG_X86_64 DECLARE_PER_CPU (u64, xfd_state);
arch/x86/kernel/hpet.c +1 -0
@@ -12,6 +12,7 @@#include <asm/hpet.h> #include <asm/time.h> #include <asm/mwait.h> +#include <asm/msr.h> #undef pr_fmt#define pr_fmt (fmt) "hpet: " fmt
arch/x86/kernel/process_64.c +1 -0
@@ -57,6 +57,7 @@#include <asm/unistd.h> #include <asm/fsgsbase.h> #include <asm/fred.h> +#include <asm/msr.h> #ifdef CONFIG_IA32_EMULATION /* Not included via unistd.h */ #include <asm/unistd_32_ia32.h>
arch/x86/kernel/trace_clock.c +1 -1
@@ -4,7 +4,7 @@*/ #include <asm/trace_clock.h> #include <asm/barrier.h> -#include <asm/msr.h> +#include <asm/tsc.h> /* * trace_clock_x86_tsc(): A clock that is just the cycle counter.
arch/x86/kernel/tsc_sync.c +1 -0
@@ -21,6 +21,7 @@#include <linux/kernel.h> #include <linux/smp.h> #include <linux/nmi.h> +#include <asm/msr.h> #include <asm/tsc.h> struct tsc_adjust {
arch/x86/lib/kaslr.c +1 -1
@@ -8,7 +8,7 @@*/ #include <asm/asm.h> #include <asm/kaslr.h> -#include <asm/msr.h> +#include <asm/tsc.h> #include <asm/archrandom.h> #include <asm/e820/api.h> #include <asm/shared/io.h>
arch/x86/mm/mem_encrypt_identity.c +1 -0
@@ -44,6 +44,7 @@#include <asm/sections.h> #include <asm/coco.h> #include <asm/sev.h> +#include <asm/msr.h> #include "mm_internal.h"
arch/x86/realmode/init.c +1 -0
@@ -9,6 +9,7 @@#include <asm/realmode.h> #include <asm/tlbflush.h> #include <asm/crash.h> +#include <asm/msr.h> #include <asm/sev.h> struct real_mode_header *real_mode_header;
drivers/acpi/acpi_extlog.c +1 -0
@@ -15,6 +15,7 @@#include <acpi/ghes.h> #include <asm/cpu.h> #include <asm/mce.h> +#include <asm/msr.h> #include "apei/apei-internal.h" #include <ras/ras_event.h>
drivers/acpi/processor_perflib.c +1 -0
@@ -20,6 +20,7 @@#include <acpi/processor.h> #ifdef CONFIG_X86 #include <asm/cpufeature.h> +#include <asm/msr.h> #endif #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
drivers/acpi/processor_throttling.c +2 -1
@@ -18,9 +18,10 @@#include <linux/sched.h> #include <linux/cpufreq.h> #include <linux/acpi.h> +#include <linux/uaccess.h> #include <acpi/processor.h> #include <asm/io.h> -#include <linux/uaccess.h> +#include <asm/asm.h> /* ignore_tpc: * 0 -> acpi processor driver doesn't ignore _TPC values
drivers/char/agp/nvidia-agp.c +1 -0
@@ -11,6 +11,7 @@#include <linux/page-flags.h> #include <linux/mm.h> #include <linux/jiffies.h> +#include <asm/msr.h> #include "agp.h" /* NVIDIA registers */
drivers/cpufreq/amd-pstate-ut.c +2 -0
@@ -31,6 +31,8 @@#include <acpi/cppc_acpi.h> +#include <asm/msr.h> +#include "amd-pstate.h"
drivers/crypto/ccp/sev-dev.c +1 -0
@@ -33,6 +33,7 @@#include <asm/cacheflush.h> #include <asm/e820/types.h> #include <asm/sev.h> +#include <asm/msr.h> #include "psp-dev.h" #include "sev-dev.h"
drivers/edac/amd64_edac.c +1 -0
@@ -4,6 +4,7 @@#include "amd64_edac.h" #include <asm/amd_nb.h> #include <asm/amd_node.h> +#include <asm/msr.h> static struct edac_pci_ctl_info *pci_ctl;
drivers/edac/ie31200_edac.c +1 -0
@@ -52,6 +52,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <asm/mce.h> +#include <asm/msr.h> #include "edac_module.h" #define EDAC_MOD_STR "ie31200_edac"
drivers/edac/mce_amd.c +1 -0
@@ -3,6 +3,7 @@#include <linux/slab.h> #include <asm/cpu.h> +#include <asm/msr.h> #include "mce_amd.h"
drivers/hwmon/hwmon-vid.c +4 -0
@@ -15,6 +15,10 @@#include <linux/kernel.h> #include <linux/hwmon-vid.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif +/* * Common code for decoding VID pins. *
drivers/idle/intel_idle.c +1 -0
@@ -56,6 +56,7 @@#include <asm/intel-family.h> #include <asm/mwait.h> #include <asm/spec-ctrl.h> +#include <asm/msr.h> #include <asm/tsc.h> #include <asm/fpu/api.h> #include <asm/smp.h>
drivers/misc/cs5535-mfgpt.c +1 -0
@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/cs5535.h> #include <linux/slab.h> +#include <asm/msr.h> #define DRV_NAME "cs5535-mfgpt"
drivers/net/vmxnet3/vmxnet3_drv.c +4 -0
@@ -27,6 +27,10 @@#include <linux/module.h> #include <net/ip6_checksum.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif +#include "vmxnet3_int.h" #include "vmxnet3_xdp.h"
drivers/platform/x86/intel/ifs/core.c +1 -0
@@ -8,6 +8,7 @@#include <linux/slab.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/ifs/load.c +1 -0
@@ -5,6 +5,7 @@#include <linux/sizes.h> #include <asm/cpu.h> #include <asm/microcode.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/ifs/runtest.c +1 -0
@@ -7,6 +7,7 @@#include <linux/nmi.h> #include <linux/slab.h> #include <linux/stop_machine.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/pmc/cnp.c +1 -0
@@ -10,6 +10,7 @@#include <linux/smp.h> #include <linux/suspend.h> +#include <asm/msr.h> #include "core.h" /* Cannon Lake: PGD PFET Enable Ack Status Register(s) bitmap */
drivers/platform/x86/intel/speed_select_if/isst_if_common.c +1 -0
@@ -21,6 +21,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "isst_if_common.h"
drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c +1 -0
@@ -18,6 +18,7 @@#include <uapi/linux/isst_if.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "isst_if_common.h"
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +1 -0
@@ -27,6 +27,7 @@#include <linux/kernel.h> #include <linux/minmax.h> #include <linux/module.h> +#include <asm/msr.h> #include <uapi/linux/isst_if.h> #include "isst_tpmi_core.h"
drivers/platform/x86/intel/turbo_max_3.c +1 -0
@@ -17,6 +17,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #define MSR_OC_MAILBOX 0x150#define MSR_OC_MAILBOX_CMD_OFFSET 32
drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +1 -0
@@ -21,6 +21,7 @@#include <linux/suspend.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "uncore-frequency-common.h"
drivers/powercap/intel_rapl_common.c +1 -0
@@ -28,6 +28,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> #include <asm/iosf_mbi.h> +#include <asm/msr.h> /* bitmasks for RAPL MSRs, used by primitive access functions */ #define ENERGY_STATUS_MASK 0xffffffff
drivers/powercap/intel_rapl_msr.c +1 -0
@@ -24,6 +24,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> /* Local defines */ #define MSR_PLATFORM_POWER_LIMIT 0x0000065C
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +1 -0
@@ -9,6 +9,7 @@#include <linux/module.h> #include <linux/pci.h> #include <linux/thermal.h> +#include <asm/msr.h> #include "int340x_thermal_zone.h" #include "processor_thermal_device.h" #include "../intel_soc_dts_iosf.h"
drivers/thermal/intel/intel_tcc_cooling.c +1 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/thermal.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #define TCC_PROGRAMMABLE BIT(30)#define TCC_LOCKED BIT(31)
drivers/thermal/intel/x86_pkg_temp_thermal.c +1 -0
@@ -20,6 +20,7 @@#include <linux/debugfs.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "thermal_interrupt.h"
drivers/video/fbdev/geode/display_gx.c +1 -0
@@ -13,6 +13,7 @@#include <asm/io.h> #include <asm/div64.h> #include <asm/delay.h> +#include <asm/msr.h> #include <linux/cs5535.h> #include "gxfb.h"
drivers/video/fbdev/geode/gxfb_core.c +1 -0
@@ -30,6 +30,7 @@#include <linux/cs5535.h> #include <asm/olpc.h> +#include <asm/msr.h> #include "gxfb.h"
drivers/video/fbdev/geode/lxfb_ops.c +1 -0
@@ -11,6 +11,7 @@#include <linux/delay.h> #include <linux/cs5535.h> +#include <asm/msr.h> #include "lxfb.h" /* TODO
Signature · 1 line
2.49.0
Re: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
Quoted 17 lines · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR header even though there is a
tsc.hheader.To facilitate the relocation of rdtsc{,_ordered}() from <
asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add <asm/msr.h> to the source files that reference definitions from <asm/msr.h>.Signed-off-by Xin Li (Intel) <[email protected]>Acked-by Dave Hansen <[email protected]>---
Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen). *) Add all necessary direct inclusions formsr.h(Ilpo Järvinen).
Quoted 6 lines
Change in v3:
* Add a problem statement to the changelog (Dave Hansen).--- arch/x86/events/msr.c | 3 +++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++
Under arch/x86/events/ a few files seem to be missing the include?
Quoted 1 line
arch/x86/hyperv/ivm.c | 1 +
Also under hyperv/ not all files are covered but I'm a bit hesitant to suggest a change there since I'm not sure if they (hypervisors) do something special w.r.t. msr.
Quoted 7 lines
arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++
arch/x86/kernel/acpi/ ?acrh/x86/kernel/cet.c ?
...
There seem to be quite many under arch/x86/ that still don't have it, I didn't list them all as there were so many after this point.
But that's up to x86 maintainers how throughout they want you to be.
This command may be helpful to exclude the files which already have the include so you can focus on the ones that may still be missing it:
git grep -l -e rdmsr -e wrmsr | grep -v -f <(git grep -l -e 'asm/msr\.h')
Quoted 31 lines
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/tsc_sync.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/realmode/init.c | 1 + drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 3 ++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 +
Quoted 8 lines
drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../thermal/intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 +
Under drivers/ this looked pretty complete. Nice work.
I also noticed these files might not need to include msr.h:
drivers/cpufreq/elanfreq.c drivers/cpufreq/sc520_freq.c drivers/accel/habanalabs/common/habanalabs_ioctl.c
...so if you want, you may consider optionally adding a cleanup patch to remove the include from them.
drivers/video/fbdev/geode/gxfb_core.c line 33
Quoted 7 lines
drivers/video/fbdev/geode/gxfb_core.c +1
-0@@ -30,6 +30,7 @@#include <linux/cs5535.h> #include <asm/olpc.h> +#include <asm/msr.h>
In wrong order.
drivers/video/fbdev/geode/gxfb_core.c line 34
Quoted 2 lines
drivers/video/fbdev/geode/gxfb_core.c +0
-0#include "gxfb.h"
--
i.
Xin Li
maintainerRe: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
Quoted 96 lines · Ilpo Järvinen
Quoted 17 lines · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR header even though there is a
tsc.hheader.To facilitate the relocation of rdtsc{,_ordered}() from <
asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add <asm/msr.h> to the source files that reference definitions from <asm/msr.h>.Signed-off-by Xin Li (Intel) <[email protected]>Acked-by Dave Hansen <[email protected]>---
Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen). *) Add all necessary direct inclusions formsr.h(Ilpo Järvinen).Quoted 6 lines
Change in v3:
* Add a problem statement to the changelog (Dave Hansen).--- arch/x86/events/msr.c | 3 +++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++Under
arch/x86/events/a few files seem to be missing the include?Quoted 1 line
arch/x86/hyperv/ivm.c | 1 +Also under hyperv/ not all files are covered but I'm a bit hesitant to suggest a change there since I'm not sure if they (hypervisors) do something special w.r.t. msr.
Quoted 7 lines
arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++
arch/x86/kernel/acpi/?acrh/x86/kernel/cet.c?
...There seem to be quite many under
arch/x86/that still don't have it, I didn't list them all as there were so many after this point.But that's up to x86 maintainers how throughout they want you to be.
This command may be helpful to exclude the files which already have the include so you can focus on the ones that may still be missing it:
git grep -l -e rdmsr -e wrmsr | grep -v -f <(git grep -l -e 'asm/msr\.h')
Quoted 31 lines
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/tsc_sync.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/realmode/init.c | 1 + drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 3 ++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 +Quoted 8 lines
drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../thermal/intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 +
Quoted 3 lines
Under
drivers/this looked pretty complete. Nice work.
Thanks a lot!
Quoted 15 lines
I also noticed these files might not need to include
msr.h:
drivers/cpufreq/elanfreq.cdrivers/cpufreq/sc520_freq.cdrivers/accel/habanalabs/common/habanalabs_ioctl.c...so if you want, you may consider optionally adding a cleanup patch to remove the include from them.
Quoted 5 lines
drivers/video/fbdev/geode/gxfb_core.c +0
-0@@ -30,6 +30,7 @@#include <linux/cs5535.h>
Quoted 7 lines
drivers/video/fbdev/geode/gxfb_core.c line 33
Quoted 2 lines
drivers/video/fbdev/geode/gxfb_core.c +1
-0#include <asm/olpc.h> +#include <asm/msr.h> In wrong order.
Quoted 2 lines
drivers/video/fbdev/geode/gxfb_core.c +0
-0#include "gxfb.h"
I am more than happy to send v4A to address all your comments.
RE: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
In reply to Ilpo JärvinenFrom: Ilpo Järvinen <[email protected]> Sent: Tuesday, April 29, 2025 2:46 AM
Quoted 27 lines · Xin Li (Intel)
Quoted 18 lines
For some reason, there are some TSC-related functions in the MSR header even though there is a
tsc.hheader.To facilitate the relocation of rdtsc{,_ordered}() from <
asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add <asm/msr.h> to the source files that reference definitions from <asm/msr.h>.Signed-off-by Xin Li (Intel) <[email protected]>Acked-by Dave Hansen <[email protected]>---
Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen). *) Add all necessary direct inclusions formsr.h(Ilpo Järvinen).Quoted 6 lines
Change in v3:
* Add a problem statement to the changelog (Dave Hansen).--- arch/x86/events/msr.c | 3 +++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++
Quoted 7 lines
Under
arch/x86/events/a few files seem to be missing the include?Quoted 1 line
arch/x86/hyperv/ivm.c | 1 +Also under hyperv/ not all files are covered but I'm a bit hesitant to suggest a change there since I'm not sure if they (hypervisors) do something special w.r.t. msr.
I've worked on the Hyper-V code in Linux for 8 years or so, first as a Microsoft employee, and more recently as a retiree. :-) I'm not aware of anything special w.r.t. MSR access for Hyper-V guests. All the normal Linux code for accessing MSRs just works. Hyper-V *does* provide a set of synthetic MSRs that are unique to Hyper-V, but they are also accessed using normal Linux code. Of course, at runtime the access to these synthetic MSRs always traps to the hypervisor.
I'm planning to apply Xin Li's patch set and make sure nothing breaks for Hyper-V guests, and particularly when running as an SEV-SNP or TDX guest. Hopefully I can do that by early next week at the latest.
Michael
Quoted 90 lines
Quoted 8 lines
arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++
arch/x86/kernel/acpi/?acrh/x86/kernel/cet.c?
...There seem to be quite many under
arch/x86/that still don't have it, I didn't list them all as there were so many after this point.But that's up to x86 maintainers how throughout they want you to be.
This command may be helpful to exclude the files which already have the include so you can focus on the ones that may still be missing it:
git grep -l -e rdmsr -e wrmsr | grep -v -f <(git grep -l -e 'asm/msr\.h')
Quoted 31 lines
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/tsc_sync.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/realmode/init.c | 1 + drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 3 ++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 +Quoted 8 lines
drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../thermal/intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 +Under
drivers/this looked pretty complete. Nice work.I also noticed these files might not need to include
msr.h:
drivers/cpufreq/elanfreq.cdrivers/cpufreq/sc520_freq.cdrivers/accel/habanalabs/common/habanalabs_ioctl.c...so if you want, you may consider optionally adding a cleanup patch to remove the include from them.
drivers/video/fbdev/geode/gxfb_core.c line 33
Quoted 7 lines
drivers/video/fbdev/geode/gxfb_core.c +1
-0@@ -30,6 +30,7 @@#include <linux/cs5535.h> #include <asm/olpc.h> +#include <asm/msr.h> In wrong order.
drivers/video/fbdev/geode/gxfb_core.c line 34
Quoted 2 lines
drivers/video/fbdev/geode/gxfb_core.c +0
-0#include "gxfb.h" --
i.
Xin Li
maintainerRe: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
Quoted 12 lines · Michael Kelley
Quoted 3 lines
Also under hyperv/ not all files are covered but I'm a bit hesitant to suggest a change there since I'm not sure if they (hypervisors) do something special w.r.t. msr.
I've worked on the Hyper-V code in Linux for 8 years or so, first as a Microsoft employee, and more recently as a retiree. 🙂 I'm not aware of anything special w.r.t. MSR access for Hyper-V guests. All the normal Linux code for accessing MSRs just works. Hyper-V *does* provide a set of synthetic MSRs that are unique to Hyper-V, but they are also accessed using normal Linux code. Of course, at runtime the access to these synthetic MSRs always traps to the hypervisor.
Quoted 4 lines
I'm planning to apply Xin Li's patch set and make sure nothing breaks for Hyper-V guests, and particularly when running as an SEV-SNP or TDX guest. Hopefully I can do that by early next week at the latest.
Hi Michael, I appreciate it!
Xin Li
maintainerRe: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
In reply to Ilpo JärvinenQuoted 4 lines · Ilpo Järvinen
Quoted 3 lines
arch/x86/events/msr.c | 3 +++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++Under
arch/x86/events/a few files seem to be missing the include?
Most C files in arch/x86/events/ include arch/x86/events/perf_event.h, thus they don't need to include <asm/msr.h> directly once arch/x86/events/perf_event.h includes <asm/msr.h>, and this patch does that.
The following files include arch/x86/events/intel/uncore.h which includes arch/x86/events/perf_event.h, thus no change needed:
arch/x86/events/intel/uncore.c
arch/x86/events/intel/uncore_discovery.c
arch/x86/events/intel/uncore_nhmex.c
arch/x86/events/intel/uncore_snb.c
arch/x86/events/intel/uncore_snbep.c
The following 2 files don't include arch/x86/events/perf_event.h so they include <asm/msr.h> directly with this patch:
arch/x86/events/msr.c
arch/x86/events/probe.carch/x86/events/amd/uncore.c doesn't include arch/x86/events/perf_event.h but includes <asm/msr.h> already.
So we are good in this directory, but it should be a separate patch with the above explanation then.
Ilpo Järvinen
maintainerRe: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
Quoted 26 lines · Xin Li
Quoted 4 lines · Ilpo Järvinen
Quoted 3 lines
arch/x86/events/msr.c | 3 +++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++Under
arch/x86/events/a few files seem to be missing the include?Most C files in
arch/x86/events/includearch/x86/events/perf_event.h, thus they don't need to include <asm/msr.h> directly oncearch/x86/events/perf_event.hincludes <asm/msr.h>, and this patch does that.The following files include
arch/x86/events/intel/uncore.hwhich includesarch/x86/events/perf_event.h, thus no change needed:
arch/x86/events/intel/uncore.carch/x86/events/intel/uncore_discovery.carch/x86/events/intel/uncore_nhmex.carch/x86/events/intel/uncore_snb.carch/x86/events/intel/uncore_snbep.cThe following 2 files don't include
arch/x86/events/perf_event.hso they include <asm/msr.h> directly with this patch:arch/x86/events/msr.c arch/x86/events/probe.c
Quoted 6 lines
arch/x86/events/amd/uncore.cdoesn't includearch/x86/events/perf_event.hbut includes <asm/msr.h> already.So we are good in this directory, but it should be a separate patch with the above explanation then.
Hi,
While this is not my subsystem so don't have the final say here, you had to explain quite much to prove that (and reviewer would have to go through the same places to check). Wouldn't it be much simpler for all if all those .c files would just include <asm/msr.h> directly? No need to explain anything then.
Also, similar to what you're doing for some tsc related things in this series, somebody could in the future decide that hey, these static inline functions (that use .*msr.*) belong to some other file, allowing msr.h to be removed from arch/x86/events/perf_event.h. Again, we'd need to add asm/msr.h into more .c files. This is the problem with relying on indirect includes, they create hard to track dependencies for #includes done in .h files. If we actively encourage to depend on indirect #include dependencies like that, it makes it very hard to _remove_ any #include from a header file (as you have yourself discovered).
Signature · 1 line
i.
Xin Li
maintainerRe: [PATCH v4 01/15] x86/msr: Add missing includes of <asm/msr.h>
Quoted 6 lines · Ilpo Järvinen
While this is not my subsystem so don't have the final say here, you had to explain quite much to prove that (and reviewer would have to go through the same places to check). Wouldn't it be much simpler for all if all those .c files would just include <
asm/msr.h> directly? No need to explain anything then.
Quoted 9 lines
Also, similar to what you're doing for some tsc related things in this series, somebody could in the future decide that hey, these static inline functions (that use .*msr.*) belong to some other file, allowing
msr.hto be removed fromarch/x86/events/perf_event.h. Again, we'd need to addasm/msr.hinto more .c files. This is the problem with relying on indirect includes, they create hard to track dependencies for #includes done in .h files. If we actively encourage to depend on indirect #include dependencies like that, it makes it very hardto_remove_any #include from a header file (as you have yourself discovered).
You're right, it makes a lot of sense from maintenance point of view.
Xin Li (Intel)
maintainerPATCH v4 1/15 x86/msr: Add missing includes of <asm/msr.h>
In reply to Ilpo JärvinenFor some reason, there are some TSC-related functions in the MSR header even though there is a tsc.h header.
To facilitate the relocation of rdtsc{,_ordered}() from <asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add <asm/msr.h> to the source files that reference definitions from <asm/msr.h>.
---
Change in v4A:
*) Use "git grep -l -e $PATTERN | grep -v -f <(git grep -l -e 'asm/msr\.h')"
to ensure ALL required *direct* inclusion of <asm/msr.h> (Ilpo Järvinen).
Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen). *) Add all necessary direct inclusions for msr.h (Ilpo Järvinen).
Change in v3:
* Add a problem statement to the changelog (Dave Hansen).
--- arch/x86/coco/sev/core.c | 1 + arch/x86/events/amd/core.c | 1 + arch/x86/events/amd/ibs.c | 1 + arch/x86/events/amd/iommu.c | 2 ++ arch/x86/events/amd/lbr.c | 1 + arch/x86/events/amd/power.c | 1 + arch/x86/events/core.c | 1 + arch/x86/events/intel/bts.c | 1 + arch/x86/events/intel/core.c | 1 + arch/x86/events/intel/cstate.c | 1 + arch/x86/events/intel/ds.c | 1 + arch/x86/events/intel/knc.c | 1 + arch/x86/events/intel/p4.c | 1 + arch/x86/events/intel/p6.c | 1 + arch/x86/events/intel/pt.c | 1 + arch/x86/events/intel/uncore.c | 1 + arch/x86/events/intel/uncore_discovery.c | 1 + arch/x86/events/intel/uncore_nhmex.c | 1 + arch/x86/events/intel/uncore_snb.c | 1 + arch/x86/events/intel/uncore_snbep.c | 1 + arch/x86/events/msr.c | 2 ++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++ arch/x86/events/rapl.c | 1 + arch/x86/events/utils.c | 1 + arch/x86/events/zhaoxin/core.c | 1 + arch/x86/hyperv/hv_apic.c | 1 + arch/x86/hyperv/hv_init.c | 1 + arch/x86/hyperv/hv_spinlock.c | 1 + arch/x86/hyperv/hv_vtl.c | 1 + arch/x86/hyperv/ivm.c | 1 + arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/resctrl.h | 2 ++ arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++ arch/x86/kernel/acpi/sleep.c | 1 + arch/x86/kernel/amd_nb.c | 1 + arch/x86/kernel/apic/apic.c | 1 + arch/x86/kernel/apic/apic_numachip.c | 1 + arch/x86/kernel/cet.c | 1 + arch/x86/kernel/cpu/amd.c | 1 + arch/x86/kernel/cpu/aperfmperf.c | 1 + arch/x86/kernel/cpu/bus_lock.c | 1 + arch/x86/kernel/cpu/feat_ctl.c | 1 + arch/x86/kernel/cpu/hygon.c | 1 + arch/x86/kernel/cpu/mce/inject.c | 1 + arch/x86/kernel/cpu/microcode/core.c | 1 + arch/x86/kernel/cpu/mshyperv.c | 1 + arch/x86/kernel/cpu/resctrl/core.c | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 1 + arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 + arch/x86/kernel/cpu/sgx/main.c | 1 + arch/x86/kernel/cpu/topology.c | 1 + arch/x86/kernel/cpu/topology_amd.c | 1 + arch/x86/kernel/cpu/tsx.c | 1 + arch/x86/kernel/cpu/zhaoxin.c | 1 + arch/x86/kernel/fpu/core.c | 1 + arch/x86/kernel/fpu/xstate.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/fred.c | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/kvm.c | 1 + arch/x86/kernel/paravirt.c | 1 + arch/x86/kernel/process.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/traps.c | 1 + arch/x86/kernel/tsc.c | 1 + arch/x86/kernel/tsc_sync.c | 1 + arch/x86/kvm/svm/avic.c | 1 + arch/x86/kvm/svm/sev.c | 1 + arch/x86/kvm/svm/svm.c | 1 + arch/x86/kvm/vmx/nested.c | 1 + arch/x86/kvm/vmx/pmu_intel.c | 1 + arch/x86/kvm/vmx/sgx.c | 1 + arch/x86/kvm/vmx/vmx.c | 1 + arch/x86/lib/insn-eval.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/mm/tlb.c | 1 + arch/x86/pci/amd_bus.c | 1 + arch/x86/pci/mmconfig-shared.c | 3 ++- arch/x86/power/cpu.c | 1 + arch/x86/realmode/init.c | 1 + arch/x86/virt/svm/sev.c | 1 + arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/pmu.c | 1 + arch/x86/xen/suspend.c | 1 + drivers/accel/habanalabs/common/habanalabs_ioctl.c | 2 -- drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 6 +++++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/cpufreq/elanfreq.c | 1 - drivers/cpufreq/sc520_freq.c | 1 - drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + .../platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 + drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 + 127 files changed, 142 insertions(+), 8 deletions(-)
arch/x86/coco/sev/core.c +1 -0
@@ -43,6 +43,7 @@#include <asm/apic.h> #include <asm/cpuid.h> #include <asm/cmdline.h> +#include <asm/msr.h> #define DR7_RESET_VALUE 0x400
arch/x86/events/amd/core.c +1 -0
@@ -9,6 +9,7 @@#include <linux/jiffies.h> #include <asm/apicdef.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/nmi.h> #include "../perf_event.h"
arch/x86/events/amd/ibs.c +1 -0
@@ -15,6 +15,7 @@#include <linux/sched/clock.h> #include <asm/apic.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/amd/iommu.c +2 -0
@@ -16,6 +16,8 @@#include <linux/slab.h> #include <linux/amd-iommu.h> +#include <asm/msr.h> +#include "../perf_event.h" #include "iommu.h"
arch/x86/events/amd/lbr.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/perf_event.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include "../perf_event.h"
arch/x86/events/amd/power.c +1 -0
@@ -11,6 +11,7 @@#include <linux/slab.h> #include <linux/perf_event.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h" /* Event code: LSB 8 bits, passed in attr->config any other bit is reserved. */
arch/x86/events/core.c +1 -0
@@ -32,6 +32,7 @@#include <asm/apic.h> #include <asm/stacktrace.h> +#include <asm/msr.h> #include <asm/nmi.h> #include <asm/smp.h> #include <asm/alternative.h>
arch/x86/events/intel/bts.c +1 -0
@@ -17,6 +17,7 @@#include <linux/sizes.h> #include <asm/perf_event.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/core.c +1 -0
@@ -23,6 +23,7 @@#include <asm/intel_pt.h> #include <asm/apic.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/cstate.c +1 -0
@@ -111,6 +111,7 @@#include <linux/nospec.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "../perf_event.h" #include "../probe.h"
arch/x86/events/intel/ds.c +1 -0
@@ -10,6 +10,7 @@#include <asm/tlbflush.h> #include <asm/insn.h> #include <asm/io.h> +#include <asm/msr.h> #include <asm/timer.h> #include "../perf_event.h"
arch/x86/events/intel/knc.c +1 -0
@@ -5,6 +5,7 @@#include <linux/types.h> #include <asm/hardirq.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/p4.c +1 -0
@@ -13,6 +13,7 @@#include <asm/cpu_device_id.h> #include <asm/hardirq.h> #include <asm/apic.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/p6.c +1 -0
@@ -3,6 +3,7 @@#include <linux/types.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/pt.c +1 -0
@@ -24,6 +24,7 @@#include <asm/io.h> #include <asm/intel_pt.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h" #include "pt.h"
arch/x86/events/intel/uncore.c +1 -0
@@ -3,6 +3,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/intel/uncore_discovery.c +1 -0
@@ -5,6 +5,7 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/intel/uncore_nhmex.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 /* Nehalem-EX/Westmere-EX uncore support */ #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "uncore.h" /* NHM-EX event control */
arch/x86/events/intel/uncore_snb.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* Nehalem/SandBridge/Haswell/Broadwell/Skylake uncore support */ +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 /* SandyBridge-EP/IvyTown uncore support */ #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/msr.c +2 -0
@@ -3,6 +3,8 @@#include <linux/sysfs.h> #include <linux/nospec.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> +#include "probe.h" enum perf_msr_id {
arch/x86/events/perf_event.h +1 -0
@@ -17,6 +17,7 @@#include <asm/fpu/xstate.h> #include <asm/intel_ds.h> #include <asm/cpu.h> +#include <asm/msr.h> /* To enable MSR tracing please use the generic trace points. */
arch/x86/events/probe.c +2 -0
@@ -2,6 +2,8 @@#include <linux/export.h> #include <linux/types.h> #include <linux/bits.h> + +#include <asm/msr.h> #include "probe.h" static umode_t
arch/x86/events/rapl.c +1 -0
@@ -65,6 +65,7 @@#include <linux/nospec.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "perf_event.h" #include "probe.h"
arch/x86/events/utils.c +1 -0
@@ -2,6 +2,7 @@#include <asm/insn.h> #include <linux/mm.h> +#include <asm/msr.h> #include "perf_event.h" static int decode_branch_type (struct insn *insn)
arch/x86/events/zhaoxin/core.c +1 -0
@@ -15,6 +15,7 @@#include <asm/cpufeature.h> #include <asm/hardirq.h> #include <asm/apic.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/hyperv/hv_apic.c +1 -0
@@ -28,6 +28,7 @@#include <asm/hypervisor.h> #include <asm/mshyperv.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/trace/hyperv.h>
arch/x86/hyperv/hv_init.c +1 -0
@@ -21,6 +21,7 @@#include <asm/hypervisor.h> #include <hyperv/hvhdk.h> #include <asm/mshyperv.h> +#include <asm/msr.h> #include <asm/idtentry.h> #include <asm/set_memory.h> #include <linux/kexec.h>
arch/x86/hyperv/hv_spinlock.c +1 -0
@@ -15,6 +15,7 @@#include <asm/mshyperv.h> #include <asm/paravirt.h> #include <asm/apic.h> +#include <asm/msr.h> static bool hv_pvspin__initdata = true;
arch/x86/hyperv/hv_vtl.c +1 -0
@@ -11,6 +11,7 @@#include <asm/desc.h> #include <asm/i8259.h> #include <asm/mshyperv.h> +#include <asm/msr.h> #include <asm/realmode.h> #include <asm/reboot.h> #include <../kernel/smpboot.h>
arch/x86/hyperv/ivm.c +1 -0
@@ -22,6 +22,7 @@#include <asm/realmode.h> #include <asm/e820/api.h> #include <asm/desc.h> +#include <asm/msr.h> #include <uapi/asm/vmx.h> #ifdef CONFIG_AMD_MEM_ENCRYPT
arch/x86/include/asm/fred.h +1 -0
@@ -9,6 +9,7 @@#include <linux/const.h> #include <asm/asm.h> +#include <asm/msr.h> #include <asm/trapnr.h> /*
arch/x86/include/asm/kvm_host.h +1 -0
@@ -34,6 +34,7 @@#include <asm/desc.h> #include <asm/mtrr.h> #include <asm/msr-index.h> +#include <asm/msr.h> #include <asm/asm.h> #include <asm/kvm_page_track.h> #include <asm/kvm_vcpu_regs.h>
arch/x86/include/asm/microcode.h +2 -0
@@ -2,6 +2,8 @@ #ifndef _ASM_X86_MICROCODE_H #define _ASM_X86_MICROCODE_H +#include <asm/msr.h> + struct cpu_signature { unsigned int sig; unsigned int pf;
arch/x86/include/asm/mshyperv.h +1 -0
@@ -8,6 +8,7 @@#include <linux/io.h> #include <asm/nospec-branch.h> #include <asm/paravirt.h> +#include <asm/msr.h> #include <hyperv/hvhdk.h> /*
arch/x86/include/asm/msr.h +1 -0
@@ -12,6 +12,7 @@#include <uapi/asm/msr.h> #include <asm/shared/msr.h> +#include <linux/types.h> #include <linux/percpu.h> struct msr_info {
arch/x86/include/asm/resctrl.h +2 -0
@@ -9,6 +9,8 @@#include <linux/resctrl_types.h> #include <linux/sched.h> +#include <asm/msr.h> +/* * This value can never be a valid CLOSID, and is used when mapping a * (closid, rmid) pair to an index and back. On x86 only the RMID is
arch/x86/include/asm/suspend_32.h +1 -0
@@ -9,6 +9,7 @@#include <asm/desc.h> #include <asm/fpu/api.h> +#include <asm/msr.h> /* image of the saved processor state */ struct saved_context {
arch/x86/include/asm/suspend_64.h +1 -0
@@ -9,6 +9,7 @@#include <asm/desc.h> #include <asm/fpu/api.h> +#include <asm/msr.h> /* * Image of the saved processor state, used by the low level ACPI suspend to
arch/x86/include/asm/switch_to.h +2 -0
@@ -52,6 +52,8 @@ do { \ } while (0)#ifdef CONFIG_X86_32 +#include <asm/msr.h> +static inline void refresh_sysenter_cs (struct thread_struct *thread) {/* Only happens when SEP is enabled, no need to test "SEP"arately: */
arch/x86/kernel/acpi/sleep.c +1 -0
@@ -16,6 +16,7 @@#include <asm/cacheflush.h> #include <asm/realmode.h> #include <asm/hypervisor.h> +#include <asm/msr.h> #include <asm/smp.h> #include <linux/ftrace.h>
arch/x86/kernel/amd_nb.c +1 -0
@@ -14,6 +14,7 @@#include <linux/spinlock.h> #include <linux/pci_ids.h> #include <asm/amd_nb.h> +#include <asm/msr.h> static u32 *flush_words;
arch/x86/kernel/apic/apic.c +1 -0
@@ -59,6 +59,7 @@#include <asm/time.h> #include <asm/smp.h> #include <asm/mce.h> +#include <asm/msr.h> #include <asm/tsc.h> #include <asm/hypervisor.h> #include <asm/cpu_device_id.h>
arch/x86/kernel/apic/apic_numachip.c +1 -0
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/pgtable.h> +#include <asm/msr.h> #include <asm/numachip/numachip.h> #include <asm/numachip/numachip_csr.h>
arch/x86/kernel/cet.c +1 -0
@@ -2,6 +2,7 @@#include <linux/ptrace.h> #include <asm/bugs.h> +#include <asm/msr.h> #include <asm/traps.h> enum cp_error_code {
arch/x86/kernel/cpu/amd.c +1 -0
@@ -21,6 +21,7 @@#include <asm/delay.h> #include <asm/debugreg.h> #include <asm/resctrl.h> +#include <asm/msr.h> #include <asm/sev.h> #ifdef CONFIG_X86_64
arch/x86/kernel/cpu/aperfmperf.c +1 -0
@@ -20,6 +20,7 @@#include <asm/cpu.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/cpu/bus_lock.c +1 -0
@@ -10,6 +10,7 @@#include <asm/cmdline.h> #include <asm/traps.h> #include <asm/cpu.h> +#include <asm/msr.h> enum split_lock_detect_state { sld_off =0 ,
arch/x86/kernel/cpu/feat_ctl.c +1 -0
@@ -4,6 +4,7 @@#include <asm/cpu.h> #include <asm/cpufeature.h> #include <asm/msr-index.h> +#include <asm/msr.h> #include <asm/processor.h> #include <asm/vmx.h>
arch/x86/kernel/cpu/hygon.c +1 -0
@@ -15,6 +15,7 @@#include <asm/cacheinfo.h> #include <asm/spec-ctrl.h> #include <asm/delay.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/cpu/mce/inject.c +1 -0
@@ -28,6 +28,7 @@#include <asm/apic.h> #include <asm/irq_vectors.h> #include <asm/mce.h> +#include <asm/msr.h> #include <asm/nmi.h> #include <asm/smp.h>
arch/x86/kernel/cpu/microcode/core.c +1 -0
@@ -37,6 +37,7 @@#include <asm/perf_event.h> #include <asm/processor.h> #include <asm/cmdline.h> +#include <asm/msr.h> #include <asm/setup.h> #include "internal.h"
arch/x86/kernel/cpu/mshyperv.c +1 -0
@@ -30,6 +30,7 @@#include <asm/reboot.h> #include <asm/nmi.h> #include <clocksource/hyperv_timer.h> +#include <asm/msr.h> #include <asm/numa.h> #include <asm/svm.h>
arch/x86/kernel/cpu/resctrl/core.c +1 -0
@@ -22,6 +22,7 @@#include <linux/cpuhotplug.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include <asm/resctrl.h> #include "internal.h"
arch/x86/kernel/cpu/resctrl/monitor.c +1 -0
@@ -23,6 +23,7 @@#include <linux/slab.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include <asm/resctrl.h> #include "internal.h"
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +1 -0
@@ -25,6 +25,7 @@#include <asm/cpu_device_id.h> #include <asm/resctrl.h> #include <asm/perf_event.h> +#include <asm/msr.h> #include "../../events/perf_event.h" /* For X86_CONFIG() */ #include "internal.h"
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
@@ -28,6 +28,7 @@#include <uapi/linux/magic.h> +#include <asm/msr.h> #include <asm/resctrl.h> #include "internal.h"
arch/x86/kernel/cpu/sgx/main.c +1 -0
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/sysfs.h> #include <linux/vmalloc.h> +#include <asm/msr.h> #include <asm/sgx.h> #include "driver.h" #include "encl.h"
arch/x86/kernel/cpu/topology.c +1 -0
@@ -30,6 +30,7 @@#include <asm/hypervisor.h> #include <asm/io_apic.h> #include <asm/mpspec.h> +#include <asm/msr.h> #include <asm/smp.h> #include "cpu.h"
arch/x86/kernel/cpu/topology_amd.c +1 -0
@@ -3,6 +3,7 @@#include <asm/apic.h> #include <asm/memtype.h> +#include <asm/msr.h> #include <asm/processor.h> #include "cpu.h"
arch/x86/kernel/cpu/tsx.c +1 -0
@@ -12,6 +12,7 @@#include <asm/cmdline.h> #include <asm/cpu.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/cpu/zhaoxin.c +1 -0
@@ -4,6 +4,7 @@#include <asm/cpu.h> #include <asm/cpufeature.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/fpu/core.c +1 -0
@@ -11,6 +11,7 @@#include <asm/fpu/sched.h> #include <asm/fpu/signal.h> #include <asm/fpu/types.h> +#include <asm/msr.h> #include <asm/traps.h> #include <asm/irq_regs.h>
arch/x86/kernel/fpu/xstate.c +1 -0
@@ -21,6 +21,7 @@#include <asm/fpu/xcr.h> #include <asm/cpuid.h> +#include <asm/msr.h> #include <asm/tlbflush.h> #include <asm/prctl.h> #include <asm/elf.h>
arch/x86/kernel/fpu/xstate.h +1 -0
@@ -5,6 +5,7 @@#include <asm/cpufeature.h> #include <asm/fpu/xstate.h> #include <asm/fpu/xcr.h> +#include <asm/msr.h> #ifdef CONFIG_X86_64 DECLARE_PER_CPU (u64, xfd_state);
arch/x86/kernel/fred.c +1 -0
@@ -3,6 +3,7 @@#include <asm/desc.h> #include <asm/fred.h> +#include <asm/msr.h> #include <asm/tlbflush.h> #include <asm/traps.h>
arch/x86/kernel/hpet.c +1 -0
@@ -12,6 +12,7 @@#include <asm/hpet.h> #include <asm/time.h> #include <asm/mwait.h> +#include <asm/msr.h> #undef pr_fmt#define pr_fmt (fmt) "hpet: " fmt
arch/x86/kernel/kvm.c +1 -0
@@ -40,6 +40,7 @@#include <asm/mtrr.h> #include <asm/tlb.h> #include <asm/cpuidle_haltpoll.h> +#include <asm/msr.h> #include <asm/ptrace.h> #include <asm/reboot.h> #include <asm/svm.h>
arch/x86/kernel/paravirt.c +1 -0
@@ -33,6 +33,7 @@#include <asm/tlb.h> #include <asm/io_bitmap.h> #include <asm/gsseg.h> +#include <asm/msr.h> /* stub always returning 0. */ DEFINE_ASM_FUNC(paravirt_ret0, "xor %eax,%eax", .entry.text);
arch/x86/kernel/process.c +1 -0
@@ -52,6 +52,7 @@#include <asm/unwind.h> #include <asm/tdx.h> #include <asm/mmu_context.h> +#include <asm/msr.h> #include <asm/shstk.h> #include "process.h"
arch/x86/kernel/process_64.c +1 -0
@@ -57,6 +57,7 @@#include <asm/unistd.h> #include <asm/fsgsbase.h> #include <asm/fred.h> +#include <asm/msr.h> #ifdef CONFIG_IA32_EMULATION /* Not included via unistd.h */ #include <asm/unistd_32_ia32.h>
arch/x86/kernel/trace_clock.c +1 -1
@@ -4,7 +4,7 @@*/ #include <asm/trace_clock.h> #include <asm/barrier.h> -#include <asm/msr.h> +#include <asm/tsc.h> /* * trace_clock_x86_tsc(): A clock that is just the cycle counter.
arch/x86/kernel/traps.c +1 -0
@@ -68,6 +68,7 @@#include <asm/vdso.h> #include <asm/tdx.h> #include <asm/cfi.h> +#include <asm/msr.h> #ifdef CONFIG_X86_64 #include <asm/x86_init.h>
arch/x86/kernel/tsc.c +1 -0
@@ -29,6 +29,7 @@#include <asm/apic.h> #include <asm/cpu_device_id.h> #include <asm/i8259.h> +#include <asm/msr.h> #include <asm/topology.h> #include <asm/uv/uv.h> #include <asm/sev.h>
arch/x86/kernel/tsc_sync.c +1 -0
@@ -21,6 +21,7 @@#include <linux/kernel.h> #include <linux/smp.h> #include <linux/nmi.h> +#include <asm/msr.h> #include <asm/tsc.h> struct tsc_adjust {
arch/x86/kvm/svm/avic.c +1 -0
@@ -20,6 +20,7 @@#include <linux/kvm_host.h> #include <asm/irq_remapping.h> +#include <asm/msr.h> #include "trace.h" #include "lapic.h"
arch/x86/kvm/svm/sev.c +1 -0
@@ -26,6 +26,7 @@#include <asm/fpu/xcr.h> #include <asm/fpu/xstate.h> #include <asm/debugreg.h> +#include <asm/msr.h> #include <asm/sev.h> #include "mmu.h"
arch/x86/kvm/svm/svm.c +1 -0
@@ -31,6 +31,7 @@#include <linux/string_choices.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include <asm/tlbflush.h> #include <asm/desc.h>
arch/x86/kvm/vmx/nested.c +1 -0
@@ -6,6 +6,7 @@#include <asm/debugreg.h> #include <asm/mmu_context.h> +#include <asm/msr.h> #include "x86.h" #include "cpuid.h"
arch/x86/kvm/vmx/pmu_intel.c +1 -0
@@ -13,6 +13,7 @@#include <linux/types.h> #include <linux/kvm_host.h> #include <linux/perf_event.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include "x86.h" #include "cpuid.h"
arch/x86/kvm/vmx/sgx.c +1 -0
@@ -2,6 +2,7 @@/* Copyright(c) 2021 Intel Corporation. */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <asm/msr.h> #include <asm/sgx.h> #include "x86.h"
arch/x86/kvm/vmx/vmx.c +1 -0
@@ -46,6 +46,7 @@#include <asm/perf_event.h> #include <asm/mmu_context.h> #include <asm/mshyperv.h> +#include <asm/msr.h> #include <asm/mwait.h> #include <asm/spec-ctrl.h> #include <asm/vmx.h>
arch/x86/lib/insn-eval.c +1 -0
@@ -13,6 +13,7 @@#include <asm/insn.h> #include <asm/insn-eval.h> #include <asm/ldt.h> +#include <asm/msr.h> #include <asm/vm86.h> #undef pr_fmt
arch/x86/lib/kaslr.c +1 -1
@@ -8,7 +8,7 @@*/ #include <asm/asm.h> #include <asm/kaslr.h> -#include <asm/msr.h> +#include <asm/tsc.h> #include <asm/archrandom.h> #include <asm/e820/api.h> #include <asm/shared/io.h>
arch/x86/mm/mem_encrypt_identity.c +1 -0
@@ -44,6 +44,7 @@#include <asm/sections.h> #include <asm/coco.h> #include <asm/sev.h> +#include <asm/msr.h> #include "mm_internal.h"
arch/x86/mm/tlb.c +1 -0
@@ -19,6 +19,7 @@#include <asm/cache.h> #include <asm/cacheflush.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include <asm/tlb.h>
arch/x86/pci/amd_bus.c +1 -0
@@ -6,6 +6,7 @@#include <linux/range.h> #include <asm/amd_nb.h> +#include <asm/msr.h> #include <asm/pci_x86.h> #include <asm/pci-direct.h>
arch/x86/pci/mmconfig-shared.c +2 -1
@@ -22,9 +22,10 @@#include <linux/slab.h> #include <linux/mutex.h> #include <linux/rculist.h> +#include <asm/acpi.h> #include <asm/e820/api.h> +#include <asm/msr.h> #include <asm/pci_x86.h> -#include <asm/acpi.h> /* Indicate if the ECAM resources have been placed into the resource table */ static bool pci_mmcfg_running_state;
arch/x86/power/cpu.c +1 -0
@@ -27,6 +27,7 @@#include <asm/mmu_context.h> #include <asm/cpu_device_id.h> #include <asm/microcode.h> +#include <asm/msr.h> #include <asm/fred.h> #ifdef CONFIG_X86_32
arch/x86/realmode/init.c +1 -0
@@ -9,6 +9,7 @@#include <asm/realmode.h> #include <asm/tlbflush.h> #include <asm/crash.h> +#include <asm/msr.h> #include <asm/sev.h> struct real_mode_header *real_mode_header;
arch/x86/virt/svm/sev.c +1 -0
@@ -30,6 +30,7 @@#include <asm/cpuid.h> #include <asm/cmdline.h> #include <asm/iommu.h> +#include <asm/msr.h> /* * The RMP entry information as returned by the RMPREAD instruction.
arch/x86/xen/enlighten_pv.c +1 -0
@@ -61,6 +61,7 @@#include <asm/processor.h> #include <asm/proto.h> #include <asm/msr-index.h> +#include <asm/msr.h> #include <asm/traps.h> #include <asm/setup.h> #include <asm/desc.h>
arch/x86/xen/pmu.c +1 -0
@@ -2,6 +2,7 @@#include <linux/types.h> #include <linux/interrupt.h> +#include <asm/msr.h> #include <asm/xen/hypercall.h> #include <xen/xen.h> #include <xen/page.h>
arch/x86/xen/suspend.c +1 -0
@@ -13,6 +13,7 @@#include <asm/xen/hypercall.h> #include <asm/xen/page.h> #include <asm/fixmap.h> +#include <asm/msr.h> #include "xen-ops.h"
drivers/accel/habanalabs/common/habanalabs_ioctl.c +0 -2
@@ -17,8 +17,6 @@#include <linux/uaccess.h> #include <linux/vmalloc.h> -#include <asm/msr.h> -/* make sure there is space for all the signed info */ static_assert (sizeof (struct cpucp_info ) <=SEC_DEV_INFO_BUF_SZ );
drivers/acpi/acpi_extlog.c +1 -0
@@ -15,6 +15,7 @@#include <acpi/ghes.h> #include <asm/cpu.h> #include <asm/mce.h> +#include <asm/msr.h> #include "apei/apei-internal.h" #include <ras/ras_event.h>
drivers/acpi/processor_perflib.c +1 -0
@@ -20,6 +20,7 @@#include <acpi/processor.h> #ifdef CONFIG_X86 #include <asm/cpufeature.h> +#include <asm/msr.h> #endif #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
drivers/acpi/processor_throttling.c +5 -1
@@ -18,9 +18,13 @@#include <linux/sched.h> #include <linux/cpufreq.h> #include <linux/acpi.h> +#include <linux/uaccess.h> #include <acpi/processor.h> #include <asm/io.h> -#include <linux/uaccess.h> +#include <asm/asm.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif /* ignore_tpc: * 0 -> acpi processor driver doesn't ignore _TPC values
drivers/char/agp/nvidia-agp.c +1 -0
@@ -11,6 +11,7 @@#include <linux/page-flags.h> #include <linux/mm.h> #include <linux/jiffies.h> +#include <asm/msr.h> #include "agp.h" /* NVIDIA registers */
drivers/cpufreq/amd-pstate-ut.c +2 -0
@@ -31,6 +31,8 @@#include <acpi/cppc_acpi.h> +#include <asm/msr.h> +#include "amd-pstate.h"
drivers/cpufreq/elanfreq.c +0 -1
@@ -21,7 +21,6 @@#include <linux/cpufreq.h> #include <asm/cpu_device_id.h> -#include <asm/msr.h> #include <linux/timex.h> #include <linux/io.h>
drivers/cpufreq/sc520_freq.c +0 -1
@@ -21,7 +21,6 @@#include <linux/io.h> #include <asm/cpu_device_id.h> -#include <asm/msr.h> #define MMCR_BASE 0xfffef000/* The default base address */ #define OFFS_CPUCTL 0x2/* CPU Control Register */
drivers/crypto/ccp/sev-dev.c +1 -0
@@ -33,6 +33,7 @@#include <asm/cacheflush.h> #include <asm/e820/types.h> #include <asm/sev.h> +#include <asm/msr.h> #include "psp-dev.h" #include "sev-dev.h"
drivers/edac/amd64_edac.c +1 -0
@@ -4,6 +4,7 @@#include "amd64_edac.h" #include <asm/amd_nb.h> #include <asm/amd_node.h> +#include <asm/msr.h> static struct edac_pci_ctl_info *pci_ctl;
drivers/edac/ie31200_edac.c +1 -0
@@ -52,6 +52,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <asm/mce.h> +#include <asm/msr.h> #include "edac_module.h" #define EDAC_MOD_STR "ie31200_edac"
drivers/edac/mce_amd.c +1 -0
@@ -3,6 +3,7 @@#include <linux/slab.h> #include <asm/cpu.h> +#include <asm/msr.h> #include "mce_amd.h"
drivers/hwmon/hwmon-vid.c +4 -0
@@ -15,6 +15,10 @@#include <linux/kernel.h> #include <linux/hwmon-vid.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif +/* * Common code for decoding VID pins. *
drivers/idle/intel_idle.c +1 -0
@@ -56,6 +56,7 @@#include <asm/intel-family.h> #include <asm/mwait.h> #include <asm/spec-ctrl.h> +#include <asm/msr.h> #include <asm/tsc.h> #include <asm/fpu/api.h> #include <asm/smp.h>
drivers/misc/cs5535-mfgpt.c +1 -0
@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/cs5535.h> #include <linux/slab.h> +#include <asm/msr.h> #define DRV_NAME "cs5535-mfgpt"
drivers/net/vmxnet3/vmxnet3_drv.c +4 -0
@@ -27,6 +27,10 @@#include <linux/module.h> #include <net/ip6_checksum.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif +#include "vmxnet3_int.h" #include "vmxnet3_xdp.h"
drivers/platform/x86/intel/ifs/core.c +1 -0
@@ -8,6 +8,7 @@#include <linux/slab.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/ifs/load.c +1 -0
@@ -5,6 +5,7 @@#include <linux/sizes.h> #include <asm/cpu.h> #include <asm/microcode.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/ifs/runtest.c +1 -0
@@ -7,6 +7,7 @@#include <linux/nmi.h> #include <linux/slab.h> #include <linux/stop_machine.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/pmc/cnp.c +1 -0
@@ -10,6 +10,7 @@#include <linux/smp.h> #include <linux/suspend.h> +#include <asm/msr.h> #include "core.h" /* Cannon Lake: PGD PFET Enable Ack Status Register(s) bitmap */
drivers/platform/x86/intel/speed_select_if/isst_if_common.c +1 -0
@@ -21,6 +21,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "isst_if_common.h"
drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c +1 -0
@@ -18,6 +18,7 @@#include <uapi/linux/isst_if.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "isst_if_common.h"
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +1 -0
@@ -27,6 +27,7 @@#include <linux/kernel.h> #include <linux/minmax.h> #include <linux/module.h> +#include <asm/msr.h> #include <uapi/linux/isst_if.h> #include "isst_tpmi_core.h"
drivers/platform/x86/intel/turbo_max_3.c +1 -0
@@ -17,6 +17,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #define MSR_OC_MAILBOX 0x150#define MSR_OC_MAILBOX_CMD_OFFSET 32
drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +1 -0
@@ -21,6 +21,7 @@#include <linux/suspend.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "uncore-frequency-common.h"
drivers/powercap/intel_rapl_common.c +1 -0
@@ -28,6 +28,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> #include <asm/iosf_mbi.h> +#include <asm/msr.h> /* bitmasks for RAPL MSRs, used by primitive access functions */ #define ENERGY_STATUS_MASK 0xffffffff
drivers/powercap/intel_rapl_msr.c +1 -0
@@ -24,6 +24,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> /* Local defines */ #define MSR_PLATFORM_POWER_LIMIT 0x0000065C
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +1 -0
@@ -9,6 +9,7 @@#include <linux/module.h> #include <linux/pci.h> #include <linux/thermal.h> +#include <asm/msr.h> #include "int340x_thermal_zone.h" #include "processor_thermal_device.h" #include "../intel_soc_dts_iosf.h"
drivers/thermal/intel/intel_tcc_cooling.c +1 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/thermal.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #define TCC_PROGRAMMABLE BIT(30)#define TCC_LOCKED BIT(31)
drivers/thermal/intel/x86_pkg_temp_thermal.c +1 -0
@@ -20,6 +20,7 @@#include <linux/debugfs.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "thermal_interrupt.h"
drivers/video/fbdev/geode/display_gx.c +1 -0
@@ -13,6 +13,7 @@#include <asm/io.h> #include <asm/div64.h> #include <asm/delay.h> +#include <asm/msr.h> #include <linux/cs5535.h> #include "gxfb.h"
drivers/video/fbdev/geode/gxfb_core.c +1 -0
@@ -29,6 +29,7 @@#include <linux/pci.h> #include <linux/cs5535.h> +#include <asm/msr.h> #include <asm/olpc.h> #include "gxfb.h"
drivers/video/fbdev/geode/lxfb_ops.c +1 -0
@@ -11,6 +11,7 @@#include <linux/delay.h> #include <linux/cs5535.h> +#include <asm/msr.h> #include "lxfb.h" /* TODO
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Add explicit includes of <asm/msr.h>
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: efef7f184f2eaf29a1ca676712d0e6e851cd0191 Gitweb: https://git.kernel.org/tip/efef7f184f2eaf29a1ca676712d0e6e851cd0191 Author: Xin Li (Intel) <[email protected]> AuthorDate: Wed, 30 Apr 2025 22:42:41 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:23:47 +02:00
x86/msr: Add explicit includes of <asm/msr.h>
For historic reasons there are some TSC-related functions in the <asm/msr.h> header, even though there's an <asm/tsc.h> header.
To facilitate the relocation of rdtsc{,_ordered}() from <asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add an explicit <asm/msr.h> dependency to the source files that reference definitions from <asm/msr.h>.
[ mingo: Clarified the changelog. ]
--- arch/x86/coco/sev/core.c | 1 + arch/x86/events/amd/core.c | 1 + arch/x86/events/amd/ibs.c | 1 + arch/x86/events/amd/iommu.c | 2 ++ arch/x86/events/amd/lbr.c | 1 + arch/x86/events/amd/power.c | 1 + arch/x86/events/core.c | 1 + arch/x86/events/intel/bts.c | 1 + arch/x86/events/intel/core.c | 1 + arch/x86/events/intel/cstate.c | 1 + arch/x86/events/intel/ds.c | 1 + arch/x86/events/intel/knc.c | 1 + arch/x86/events/intel/p4.c | 1 + arch/x86/events/intel/p6.c | 1 + arch/x86/events/intel/pt.c | 1 + arch/x86/events/intel/uncore.c | 1 + arch/x86/events/intel/uncore_discovery.c | 1 + arch/x86/events/intel/uncore_nhmex.c | 1 + arch/x86/events/intel/uncore_snb.c | 1 + arch/x86/events/intel/uncore_snbep.c | 1 + arch/x86/events/msr.c | 2 ++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++ arch/x86/events/rapl.c | 1 + arch/x86/events/utils.c | 1 + arch/x86/events/zhaoxin/core.c | 1 + arch/x86/hyperv/hv_apic.c | 1 + arch/x86/hyperv/hv_init.c | 1 + arch/x86/hyperv/hv_spinlock.c | 1 + arch/x86/hyperv/hv_vtl.c | 1 + arch/x86/hyperv/ivm.c | 1 + arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/resctrl.h | 2 ++ arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++ arch/x86/kernel/acpi/sleep.c | 1 + arch/x86/kernel/apic/apic.c | 1 + arch/x86/kernel/apic/apic_numachip.c | 1 + arch/x86/kernel/cet.c | 1 + arch/x86/kernel/cpu/amd.c | 1 + arch/x86/kernel/cpu/aperfmperf.c | 1 + arch/x86/kernel/cpu/bus_lock.c | 1 + arch/x86/kernel/cpu/feat_ctl.c | 1 + arch/x86/kernel/cpu/hygon.c | 1 + arch/x86/kernel/cpu/mce/inject.c | 1 + arch/x86/kernel/cpu/microcode/core.c | 1 + arch/x86/kernel/cpu/mshyperv.c | 1 + arch/x86/kernel/cpu/resctrl/core.c | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 1 + arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 + arch/x86/kernel/cpu/sgx/main.c | 1 + arch/x86/kernel/cpu/topology.c | 1 + arch/x86/kernel/cpu/topology_amd.c | 1 + arch/x86/kernel/cpu/tsx.c | 1 + arch/x86/kernel/cpu/zhaoxin.c | 1 + arch/x86/kernel/fpu/core.c | 1 + arch/x86/kernel/fpu/xstate.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/fred.c | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/kvm.c | 1 + arch/x86/kernel/paravirt.c | 1 + arch/x86/kernel/process.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/traps.c | 1 + arch/x86/kernel/tsc.c | 1 + arch/x86/kernel/tsc_sync.c | 1 + arch/x86/kvm/svm/avic.c | 1 + arch/x86/kvm/svm/sev.c | 1 + arch/x86/kvm/svm/svm.c | 1 + arch/x86/kvm/vmx/nested.c | 1 + arch/x86/kvm/vmx/pmu_intel.c | 1 + arch/x86/kvm/vmx/sgx.c | 1 + arch/x86/kvm/vmx/vmx.c | 1 + arch/x86/lib/insn-eval.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/tlb.c | 1 + arch/x86/pci/mmconfig-shared.c | 3 ++- arch/x86/power/cpu.c | 1 + arch/x86/realmode/init.c | 1 + arch/x86/virt/svm/sev.c | 1 + arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/pmu.c | 1 + arch/x86/xen/suspend.c | 1 + drivers/accel/habanalabs/common/habanalabs_ioctl.c | 2 -- drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 6 +++++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/cpufreq/elanfreq.c | 1 - drivers/cpufreq/sc520_freq.c | 1 - drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 + drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 + 123 files changed, 138 insertions(+), 8 deletions(-)
arch/x86/coco/sev/core.c +1 -0
@@ -43,6 +43,7 @@#include <asm/apic.h> #include <asm/cpuid.h> #include <asm/cmdline.h> +#include <asm/msr.h> #define DR7_RESET_VALUE 0x400
arch/x86/events/amd/core.c +1 -0
@@ -9,6 +9,7 @@#include <linux/jiffies.h> #include <asm/apicdef.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/nmi.h> #include "../perf_event.h"
arch/x86/events/amd/ibs.c +1 -0
@@ -15,6 +15,7 @@#include <linux/sched/clock.h> #include <asm/apic.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/amd/iommu.c +2 -0
@@ -16,6 +16,8 @@#include <linux/slab.h> #include <linux/amd-iommu.h> +#include <asm/msr.h> +#include "../perf_event.h" #include "iommu.h"
arch/x86/events/amd/lbr.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/perf_event.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include "../perf_event.h"
arch/x86/events/amd/power.c +1 -0
@@ -11,6 +11,7 @@#include <linux/slab.h> #include <linux/perf_event.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h" /* Event code: LSB 8 bits, passed in attr->config any other bit is reserved. */
arch/x86/events/core.c +1 -0
@@ -32,6 +32,7 @@#include <asm/apic.h> #include <asm/stacktrace.h> +#include <asm/msr.h> #include <asm/nmi.h> #include <asm/smp.h> #include <asm/alternative.h>
arch/x86/events/intel/bts.c +1 -0
@@ -17,6 +17,7 @@#include <linux/sizes.h> #include <asm/perf_event.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/core.c +1 -0
@@ -23,6 +23,7 @@#include <asm/intel_pt.h> #include <asm/apic.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/cstate.c +1 -0
@@ -111,6 +111,7 @@#include <linux/nospec.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "../perf_event.h" #include "../probe.h"
arch/x86/events/intel/ds.c +1 -0
@@ -10,6 +10,7 @@#include <asm/tlbflush.h> #include <asm/insn.h> #include <asm/io.h> +#include <asm/msr.h> #include <asm/timer.h> #include "../perf_event.h"
arch/x86/events/intel/knc.c +1 -0
@@ -5,6 +5,7 @@#include <linux/types.h> #include <asm/hardirq.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/p4.c +1 -0
@@ -13,6 +13,7 @@#include <asm/cpu_device_id.h> #include <asm/hardirq.h> #include <asm/apic.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/p6.c +1 -0
@@ -3,6 +3,7 @@#include <linux/types.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/events/intel/pt.c +1 -0
@@ -24,6 +24,7 @@#include <asm/io.h> #include <asm/intel_pt.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "../perf_event.h" #include "pt.h"
arch/x86/events/intel/uncore.c +1 -0
@@ -3,6 +3,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/intel/uncore_discovery.c +1 -0
@@ -5,6 +5,7 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/intel/uncore_nhmex.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 /* Nehalem-EX/Westmere-EX uncore support */ #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "uncore.h" /* NHM-EX event control */
arch/x86/events/intel/uncore_snb.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* Nehalem/SandBridge/Haswell/Broadwell/Skylake uncore support */ +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 /* SandyBridge-EP/IvyTown uncore support */ #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "uncore.h" #include "uncore_discovery.h"
arch/x86/events/msr.c +2 -0
@@ -3,6 +3,8 @@#include <linux/sysfs.h> #include <linux/nospec.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> +#include "probe.h" enum perf_msr_id {
arch/x86/events/perf_event.h +1 -0
@@ -17,6 +17,7 @@#include <asm/fpu/xstate.h> #include <asm/intel_ds.h> #include <asm/cpu.h> +#include <asm/msr.h> /* To enable MSR tracing please use the generic trace points. */
arch/x86/events/probe.c +2 -0
@@ -2,6 +2,8 @@#include <linux/export.h> #include <linux/types.h> #include <linux/bits.h> + +#include <asm/msr.h> #include "probe.h" static umode_t
arch/x86/events/rapl.c +1 -0
@@ -65,6 +65,7 @@#include <linux/nospec.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "perf_event.h" #include "probe.h"
arch/x86/events/utils.c +1 -0
@@ -2,6 +2,7 @@#include <asm/insn.h> #include <linux/mm.h> +#include <asm/msr.h> #include "perf_event.h" static int decode_branch_type (struct insn *insn)
arch/x86/events/zhaoxin/core.c +1 -0
@@ -15,6 +15,7 @@#include <asm/cpufeature.h> #include <asm/hardirq.h> #include <asm/apic.h> +#include <asm/msr.h> #include "../perf_event.h"
arch/x86/hyperv/hv_apic.c +1 -0
@@ -28,6 +28,7 @@#include <asm/hypervisor.h> #include <asm/mshyperv.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/trace/hyperv.h>
arch/x86/hyperv/hv_init.c +1 -0
@@ -21,6 +21,7 @@#include <asm/hypervisor.h> #include <hyperv/hvhdk.h> #include <asm/mshyperv.h> +#include <asm/msr.h> #include <asm/idtentry.h> #include <asm/set_memory.h> #include <linux/kexec.h>
arch/x86/hyperv/hv_spinlock.c +1 -0
@@ -15,6 +15,7 @@#include <asm/mshyperv.h> #include <asm/paravirt.h> #include <asm/apic.h> +#include <asm/msr.h> static bool hv_pvspin__initdata = true;
arch/x86/hyperv/hv_vtl.c +1 -0
@@ -11,6 +11,7 @@#include <asm/desc.h> #include <asm/i8259.h> #include <asm/mshyperv.h> +#include <asm/msr.h> #include <asm/realmode.h> #include <asm/reboot.h> #include <../kernel/smpboot.h>
arch/x86/hyperv/ivm.c +1 -0
@@ -22,6 +22,7 @@#include <asm/realmode.h> #include <asm/e820/api.h> #include <asm/desc.h> +#include <asm/msr.h> #include <uapi/asm/vmx.h> #ifdef CONFIG_AMD_MEM_ENCRYPT
arch/x86/include/asm/fred.h +1 -0
@@ -9,6 +9,7 @@#include <linux/const.h> #include <asm/asm.h> +#include <asm/msr.h> #include <asm/trapnr.h> /*
arch/x86/include/asm/kvm_host.h +1 -0
@@ -34,6 +34,7 @@#include <asm/desc.h> #include <asm/mtrr.h> #include <asm/msr-index.h> +#include <asm/msr.h> #include <asm/asm.h> #include <asm/irq_remapping.h> #include <asm/kvm_page_track.h>
arch/x86/include/asm/microcode.h +2 -0
@@ -2,6 +2,8 @@ #ifndef _ASM_X86_MICROCODE_H #define _ASM_X86_MICROCODE_H +#include <asm/msr.h> + struct cpu_signature { unsigned int sig; unsigned int pf;
arch/x86/include/asm/mshyperv.h +1 -0
@@ -8,6 +8,7 @@#include <linux/io.h> #include <asm/nospec-branch.h> #include <asm/paravirt.h> +#include <asm/msr.h> #include <hyperv/hvhdk.h> /*
arch/x86/include/asm/msr.h +1 -0
@@ -12,6 +12,7 @@#include <uapi/asm/msr.h> #include <asm/shared/msr.h> +#include <linux/types.h> #include <linux/percpu.h> struct msr_info {
arch/x86/include/asm/resctrl.h +2 -0
@@ -9,6 +9,8 @@#include <linux/resctrl_types.h> #include <linux/sched.h> +#include <asm/msr.h> +/* * This value can never be a valid CLOSID, and is used when mapping a * (closid, rmid) pair to an index and back. On x86 only the RMID is
arch/x86/include/asm/suspend_32.h +1 -0
@@ -9,6 +9,7 @@#include <asm/desc.h> #include <asm/fpu/api.h> +#include <asm/msr.h> /* image of the saved processor state */ struct saved_context {
arch/x86/include/asm/suspend_64.h +1 -0
@@ -9,6 +9,7 @@#include <asm/desc.h> #include <asm/fpu/api.h> +#include <asm/msr.h> /* * Image of the saved processor state, used by the low level ACPI suspend to
arch/x86/include/asm/switch_to.h +2 -0
@@ -52,6 +52,8 @@ do { \ } while (0)#ifdef CONFIG_X86_32 +#include <asm/msr.h> +static inline void refresh_sysenter_cs (struct thread_struct *thread) {/* Only happens when SEP is enabled, no need to test "SEP"arately: */
arch/x86/kernel/acpi/sleep.c +1 -0
@@ -16,6 +16,7 @@#include <asm/cacheflush.h> #include <asm/realmode.h> #include <asm/hypervisor.h> +#include <asm/msr.h> #include <asm/smp.h> #include <linux/ftrace.h>
arch/x86/kernel/apic/apic.c +1 -0
@@ -59,6 +59,7 @@#include <asm/time.h> #include <asm/smp.h> #include <asm/mce.h> +#include <asm/msr.h> #include <asm/tsc.h> #include <asm/hypervisor.h> #include <asm/cpu_device_id.h>
arch/x86/kernel/apic/apic_numachip.c +1 -0
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/pgtable.h> +#include <asm/msr.h> #include <asm/numachip/numachip.h> #include <asm/numachip/numachip_csr.h>
arch/x86/kernel/cet.c +1 -0
@@ -2,6 +2,7 @@#include <linux/ptrace.h> #include <asm/bugs.h> +#include <asm/msr.h> #include <asm/traps.h> enum cp_error_code {
arch/x86/kernel/cpu/amd.c +1 -0
@@ -21,6 +21,7 @@#include <asm/delay.h> #include <asm/debugreg.h> #include <asm/resctrl.h> +#include <asm/msr.h> #include <asm/sev.h> #ifdef CONFIG_X86_64
arch/x86/kernel/cpu/aperfmperf.c +1 -0
@@ -20,6 +20,7 @@#include <asm/cpu.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/cpu/bus_lock.c +1 -0
@@ -10,6 +10,7 @@#include <asm/cmdline.h> #include <asm/traps.h> #include <asm/cpu.h> +#include <asm/msr.h> enum split_lock_detect_state { sld_off =0 ,
arch/x86/kernel/cpu/feat_ctl.c +1 -0
@@ -4,6 +4,7 @@#include <asm/cpu.h> #include <asm/cpufeature.h> #include <asm/msr-index.h> +#include <asm/msr.h> #include <asm/processor.h> #include <asm/vmx.h>
arch/x86/kernel/cpu/hygon.c +1 -0
@@ -15,6 +15,7 @@#include <asm/cacheinfo.h> #include <asm/spec-ctrl.h> #include <asm/delay.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/cpu/mce/inject.c +1 -0
@@ -28,6 +28,7 @@#include <asm/apic.h> #include <asm/irq_vectors.h> #include <asm/mce.h> +#include <asm/msr.h> #include <asm/nmi.h> #include <asm/smp.h>
arch/x86/kernel/cpu/microcode/core.c +1 -0
@@ -37,6 +37,7 @@#include <asm/perf_event.h> #include <asm/processor.h> #include <asm/cmdline.h> +#include <asm/msr.h> #include <asm/setup.h> #include "internal.h"
arch/x86/kernel/cpu/mshyperv.c +1 -0
@@ -30,6 +30,7 @@#include <asm/reboot.h> #include <asm/nmi.h> #include <clocksource/hyperv_timer.h> +#include <asm/msr.h> #include <asm/numa.h> #include <asm/svm.h>
arch/x86/kernel/cpu/resctrl/core.c +1 -0
@@ -22,6 +22,7 @@#include <linux/cpuhotplug.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include <asm/resctrl.h> #include "internal.h"
arch/x86/kernel/cpu/resctrl/monitor.c +1 -0
@@ -23,6 +23,7 @@#include <linux/slab.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include <asm/resctrl.h> #include "internal.h"
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +1 -0
@@ -25,6 +25,7 @@#include <asm/cpu_device_id.h> #include <asm/resctrl.h> #include <asm/perf_event.h> +#include <asm/msr.h> #include "../../events/perf_event.h" /* For X86_CONFIG() */ #include "internal.h"
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
@@ -28,6 +28,7 @@#include <uapi/linux/magic.h> +#include <asm/msr.h> #include <asm/resctrl.h> #include "internal.h"
arch/x86/kernel/cpu/sgx/main.c +1 -0
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/sysfs.h> #include <linux/vmalloc.h> +#include <asm/msr.h> #include <asm/sgx.h> #include "driver.h" #include "encl.h"
arch/x86/kernel/cpu/topology.c +1 -0
@@ -30,6 +30,7 @@#include <asm/hypervisor.h> #include <asm/io_apic.h> #include <asm/mpspec.h> +#include <asm/msr.h> #include <asm/smp.h> #include "cpu.h"
arch/x86/kernel/cpu/topology_amd.c +1 -0
@@ -3,6 +3,7 @@#include <asm/apic.h> #include <asm/memtype.h> +#include <asm/msr.h> #include <asm/processor.h> #include "cpu.h"
arch/x86/kernel/cpu/tsx.c +1 -0
@@ -12,6 +12,7 @@#include <asm/cmdline.h> #include <asm/cpu.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/cpu/zhaoxin.c +1 -0
@@ -4,6 +4,7 @@#include <asm/cpu.h> #include <asm/cpufeature.h> +#include <asm/msr.h> #include "cpu.h"
arch/x86/kernel/fpu/core.c +1 -0
@@ -11,6 +11,7 @@#include <asm/fpu/sched.h> #include <asm/fpu/signal.h> #include <asm/fpu/types.h> +#include <asm/msr.h> #include <asm/traps.h> #include <asm/irq_regs.h>
arch/x86/kernel/fpu/xstate.c +1 -0
@@ -21,6 +21,7 @@#include <asm/fpu/xcr.h> #include <asm/cpuid.h> +#include <asm/msr.h> #include <asm/tlbflush.h> #include <asm/prctl.h> #include <asm/elf.h>
arch/x86/kernel/fpu/xstate.h +1 -0
@@ -5,6 +5,7 @@#include <asm/cpufeature.h> #include <asm/fpu/xstate.h> #include <asm/fpu/xcr.h> +#include <asm/msr.h> #ifdef CONFIG_X86_64 DECLARE_PER_CPU (u64, xfd_state);
arch/x86/kernel/fred.c +1 -0
@@ -3,6 +3,7 @@#include <asm/desc.h> #include <asm/fred.h> +#include <asm/msr.h> #include <asm/tlbflush.h> #include <asm/traps.h>
arch/x86/kernel/hpet.c +1 -0
@@ -12,6 +12,7 @@#include <asm/hpet.h> #include <asm/time.h> #include <asm/mwait.h> +#include <asm/msr.h> #undef pr_fmt#define pr_fmt (fmt) "hpet: " fmt
arch/x86/kernel/kvm.c +1 -0
@@ -40,6 +40,7 @@#include <asm/mtrr.h> #include <asm/tlb.h> #include <asm/cpuidle_haltpoll.h> +#include <asm/msr.h> #include <asm/ptrace.h> #include <asm/reboot.h> #include <asm/svm.h>
arch/x86/kernel/paravirt.c +1 -0
@@ -33,6 +33,7 @@#include <asm/tlb.h> #include <asm/io_bitmap.h> #include <asm/gsseg.h> +#include <asm/msr.h> /* stub always returning 0. */ DEFINE_ASM_FUNC(paravirt_ret0, "xor %eax,%eax", .entry.text);
arch/x86/kernel/process.c +1 -0
@@ -52,6 +52,7 @@#include <asm/unwind.h> #include <asm/tdx.h> #include <asm/mmu_context.h> +#include <asm/msr.h> #include <asm/shstk.h> #include "process.h"
arch/x86/kernel/process_64.c +1 -0
@@ -57,6 +57,7 @@#include <asm/unistd.h> #include <asm/fsgsbase.h> #include <asm/fred.h> +#include <asm/msr.h> #ifdef CONFIG_IA32_EMULATION /* Not included via unistd.h */ #include <asm/unistd_32_ia32.h>
arch/x86/kernel/trace_clock.c +1 -1
@@ -4,7 +4,7 @@*/ #include <asm/trace_clock.h> #include <asm/barrier.h> -#include <asm/msr.h> +#include <asm/tsc.h> /* * trace_clock_x86_tsc(): A clock that is just the cycle counter.
arch/x86/kernel/traps.c +1 -0
@@ -68,6 +68,7 @@#include <asm/vdso.h> #include <asm/tdx.h> #include <asm/cfi.h> +#include <asm/msr.h> #ifdef CONFIG_X86_64 #include <asm/x86_init.h>
arch/x86/kernel/tsc.c +1 -0
@@ -29,6 +29,7 @@#include <asm/apic.h> #include <asm/cpu_device_id.h> #include <asm/i8259.h> +#include <asm/msr.h> #include <asm/topology.h> #include <asm/uv/uv.h> #include <asm/sev.h>
arch/x86/kernel/tsc_sync.c +1 -0
@@ -21,6 +21,7 @@#include <linux/kernel.h> #include <linux/smp.h> #include <linux/nmi.h> +#include <asm/msr.h> #include <asm/tsc.h> struct tsc_adjust {
arch/x86/kvm/svm/avic.c +1 -0
@@ -20,6 +20,7 @@#include <linux/kvm_host.h> #include <asm/irq_remapping.h> +#include <asm/msr.h> #include "trace.h" #include "lapic.h"
arch/x86/kvm/svm/sev.c +1 -0
@@ -26,6 +26,7 @@#include <asm/fpu/xcr.h> #include <asm/fpu/xstate.h> #include <asm/debugreg.h> +#include <asm/msr.h> #include <asm/sev.h> #include "mmu.h"
arch/x86/kvm/svm/svm.c +1 -0
@@ -31,6 +31,7 @@#include <linux/string_choices.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include <asm/tlbflush.h> #include <asm/desc.h>
arch/x86/kvm/vmx/nested.c +1 -0
@@ -6,6 +6,7 @@#include <asm/debugreg.h> #include <asm/mmu_context.h> +#include <asm/msr.h> #include "x86.h" #include "cpuid.h"
arch/x86/kvm/vmx/pmu_intel.c +1 -0
@@ -13,6 +13,7 @@#include <linux/types.h> #include <linux/kvm_host.h> #include <linux/perf_event.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include "x86.h" #include "cpuid.h"
arch/x86/kvm/vmx/sgx.c +1 -0
@@ -2,6 +2,7 @@/* Copyright(c) 2021 Intel Corporation. */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <asm/msr.h> #include <asm/sgx.h> #include "x86.h"
arch/x86/kvm/vmx/vmx.c +1 -0
@@ -46,6 +46,7 @@#include <asm/perf_event.h> #include <asm/mmu_context.h> #include <asm/mshyperv.h> +#include <asm/msr.h> #include <asm/mwait.h> #include <asm/spec-ctrl.h> #include <asm/vmx.h>
arch/x86/lib/insn-eval.c +1 -0
@@ -13,6 +13,7 @@#include <asm/insn.h> #include <asm/insn-eval.h> #include <asm/ldt.h> +#include <asm/msr.h> #include <asm/vm86.h> #undef pr_fmt
arch/x86/lib/kaslr.c +1 -1
@@ -8,7 +8,7 @@*/ #include <asm/asm.h> #include <asm/kaslr.h> -#include <asm/msr.h> +#include <asm/tsc.h> #include <asm/archrandom.h> #include <asm/e820/api.h> #include <asm/shared/io.h>
arch/x86/mm/tlb.c +1 -0
@@ -19,6 +19,7 @@#include <asm/cache.h> #include <asm/cacheflush.h> #include <asm/apic.h> +#include <asm/msr.h> #include <asm/perf_event.h> #include <asm/tlb.h>
arch/x86/pci/mmconfig-shared.c +2 -1
@@ -22,9 +22,10 @@#include <linux/slab.h> #include <linux/mutex.h> #include <linux/rculist.h> +#include <asm/acpi.h> #include <asm/e820/api.h> +#include <asm/msr.h> #include <asm/pci_x86.h> -#include <asm/acpi.h> /* Indicate if the ECAM resources have been placed into the resource table */ static bool pci_mmcfg_running_state;
arch/x86/power/cpu.c +1 -0
@@ -27,6 +27,7 @@#include <asm/mmu_context.h> #include <asm/cpu_device_id.h> #include <asm/microcode.h> +#include <asm/msr.h> #include <asm/fred.h> #ifdef CONFIG_X86_32
arch/x86/realmode/init.c +1 -0
@@ -9,6 +9,7 @@#include <asm/realmode.h> #include <asm/tlbflush.h> #include <asm/crash.h> +#include <asm/msr.h> #include <asm/sev.h> struct real_mode_header *real_mode_header;
arch/x86/virt/svm/sev.c +1 -0
@@ -30,6 +30,7 @@#include <asm/cpuid.h> #include <asm/cmdline.h> #include <asm/iommu.h> +#include <asm/msr.h> /* * The RMP entry information as returned by the RMPREAD instruction.
arch/x86/xen/enlighten_pv.c +1 -0
@@ -61,6 +61,7 @@#include <asm/processor.h> #include <asm/proto.h> #include <asm/msr-index.h> +#include <asm/msr.h> #include <asm/traps.h> #include <asm/setup.h> #include <asm/desc.h>
arch/x86/xen/pmu.c +1 -0
@@ -2,6 +2,7 @@#include <linux/types.h> #include <linux/interrupt.h> +#include <asm/msr.h> #include <asm/xen/hypercall.h> #include <xen/xen.h> #include <xen/page.h>
arch/x86/xen/suspend.c +1 -0
@@ -13,6 +13,7 @@#include <asm/xen/hypercall.h> #include <asm/xen/page.h> #include <asm/fixmap.h> +#include <asm/msr.h> #include "xen-ops.h"
drivers/accel/habanalabs/common/habanalabs_ioctl.c +0 -2
@@ -17,8 +17,6 @@#include <linux/uaccess.h> #include <linux/vmalloc.h> -#include <asm/msr.h> -/* make sure there is space for all the signed info */ static_assert (sizeof (struct cpucp_info ) <=SEC_DEV_INFO_BUF_SZ );
drivers/acpi/acpi_extlog.c +1 -0
@@ -15,6 +15,7 @@#include <acpi/ghes.h> #include <asm/cpu.h> #include <asm/mce.h> +#include <asm/msr.h> #include "apei/apei-internal.h" #include <ras/ras_event.h>
drivers/acpi/processor_perflib.c +1 -0
@@ -20,6 +20,7 @@#include <acpi/processor.h> #ifdef CONFIG_X86 #include <asm/cpufeature.h> +#include <asm/msr.h> #endif #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
drivers/acpi/processor_throttling.c +5 -1
@@ -18,9 +18,13 @@#include <linux/sched.h> #include <linux/cpufreq.h> #include <linux/acpi.h> +#include <linux/uaccess.h> #include <acpi/processor.h> #include <asm/io.h> -#include <linux/uaccess.h> +#include <asm/asm.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif /* ignore_tpc: * 0 -> acpi processor driver doesn't ignore _TPC values
drivers/char/agp/nvidia-agp.c +1 -0
@@ -11,6 +11,7 @@#include <linux/page-flags.h> #include <linux/mm.h> #include <linux/jiffies.h> +#include <asm/msr.h> #include "agp.h" /* NVIDIA registers */
drivers/cpufreq/amd-pstate-ut.c +2 -0
@@ -31,6 +31,8 @@#include <acpi/cppc_acpi.h> +#include <asm/msr.h> +#include "amd-pstate.h"
drivers/cpufreq/elanfreq.c +0 -1
@@ -21,7 +21,6 @@#include <linux/cpufreq.h> #include <asm/cpu_device_id.h> -#include <asm/msr.h> #include <linux/timex.h> #include <linux/io.h>
drivers/cpufreq/sc520_freq.c +0 -1
@@ -21,7 +21,6 @@#include <linux/io.h> #include <asm/cpu_device_id.h> -#include <asm/msr.h> #define MMCR_BASE 0xfffef000/* The default base address */ #define OFFS_CPUCTL 0x2/* CPU Control Register */
drivers/crypto/ccp/sev-dev.c +1 -0
@@ -33,6 +33,7 @@#include <asm/cacheflush.h> #include <asm/e820/types.h> #include <asm/sev.h> +#include <asm/msr.h> #include "psp-dev.h" #include "sev-dev.h"
drivers/edac/ie31200_edac.c +1 -0
@@ -52,6 +52,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <asm/mce.h> +#include <asm/msr.h> #include "edac_module.h" #define EDAC_MOD_STR "ie31200_edac"
drivers/edac/mce_amd.c +1 -0
@@ -3,6 +3,7 @@#include <linux/slab.h> #include <asm/cpu.h> +#include <asm/msr.h> #include "mce_amd.h"
drivers/hwmon/hwmon-vid.c +4 -0
@@ -15,6 +15,10 @@#include <linux/kernel.h> #include <linux/hwmon-vid.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif +/* * Common code for decoding VID pins. *
drivers/idle/intel_idle.c +1 -0
@@ -56,6 +56,7 @@#include <asm/intel-family.h> #include <asm/mwait.h> #include <asm/spec-ctrl.h> +#include <asm/msr.h> #include <asm/tsc.h> #include <asm/fpu/api.h> #include <asm/smp.h>
drivers/misc/cs5535-mfgpt.c +1 -0
@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/cs5535.h> #include <linux/slab.h> +#include <asm/msr.h> #define DRV_NAME "cs5535-mfgpt"
drivers/net/vmxnet3/vmxnet3_drv.c +4 -0
@@ -27,6 +27,10 @@#include <linux/module.h> #include <net/ip6_checksum.h> +#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif +#include "vmxnet3_int.h" #include "vmxnet3_xdp.h"
drivers/platform/x86/intel/ifs/core.c +1 -0
@@ -8,6 +8,7 @@#include <linux/slab.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/ifs/load.c +1 -0
@@ -5,6 +5,7 @@#include <linux/sizes.h> #include <asm/cpu.h> #include <asm/microcode.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/ifs/runtest.c +1 -0
@@ -7,6 +7,7 @@#include <linux/nmi.h> #include <linux/slab.h> #include <linux/stop_machine.h> +#include <asm/msr.h> #include "ifs.h"
drivers/platform/x86/intel/pmc/cnp.c +1 -0
@@ -10,6 +10,7 @@#include <linux/smp.h> #include <linux/suspend.h> +#include <asm/msr.h> #include "core.h" /* Cannon Lake: PGD PFET Enable Ack Status Register(s) bitmap */
drivers/platform/x86/intel/speed_select_if/isst_if_common.c +1 -0
@@ -21,6 +21,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "isst_if_common.h"
drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c +1 -0
@@ -18,6 +18,7 @@#include <uapi/linux/isst_if.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "isst_if_common.h"
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +1 -0
@@ -27,6 +27,7 @@#include <linux/kernel.h> #include <linux/minmax.h> #include <linux/module.h> +#include <asm/msr.h> #include <uapi/linux/isst_if.h> #include "isst_tpmi_core.h"
drivers/platform/x86/intel/turbo_max_3.c +1 -0
@@ -17,6 +17,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #define MSR_OC_MAILBOX 0x150#define MSR_OC_MAILBOX_CMD_OFFSET 32
drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +1 -0
@@ -21,6 +21,7 @@#include <linux/suspend.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> #include "uncore-frequency-common.h"
drivers/powercap/intel_rapl_common.c +1 -0
@@ -28,6 +28,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> #include <asm/iosf_mbi.h> +#include <asm/msr.h> /* bitmasks for RAPL MSRs, used by primitive access functions */ #define ENERGY_STATUS_MASK 0xffffffff
drivers/powercap/intel_rapl_msr.c +1 -0
@@ -24,6 +24,7 @@#include <asm/cpu_device_id.h> #include <asm/intel-family.h> +#include <asm/msr.h> /* Local defines */ #define MSR_PLATFORM_POWER_LIMIT 0x0000065C
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +1 -0
@@ -9,6 +9,7 @@#include <linux/module.h> #include <linux/pci.h> #include <linux/thermal.h> +#include <asm/msr.h> #include "int340x_thermal_zone.h" #include "processor_thermal_device.h" #include "../intel_soc_dts_iosf.h"
drivers/thermal/intel/intel_tcc_cooling.c +1 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/thermal.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #define TCC_PROGRAMMABLE BIT(30)#define TCC_LOCKED BIT(31)
drivers/thermal/intel/x86_pkg_temp_thermal.c +1 -0
@@ -20,6 +20,7 @@#include <linux/debugfs.h> #include <asm/cpu_device_id.h> +#include <asm/msr.h> #include "thermal_interrupt.h"
drivers/video/fbdev/geode/display_gx.c +1 -0
@@ -13,6 +13,7 @@#include <asm/io.h> #include <asm/div64.h> #include <asm/delay.h> +#include <asm/msr.h> #include <linux/cs5535.h> #include "gxfb.h"
drivers/video/fbdev/geode/gxfb_core.c +1 -0
@@ -29,6 +29,7 @@#include <linux/pci.h> #include <linux/cs5535.h> +#include <asm/msr.h> #include <asm/olpc.h> #include "gxfb.h"
drivers/video/fbdev/geode/lxfb_ops.c +1 -0
@@ -11,6 +11,7 @@#include <linux/delay.h> #include <linux/cs5535.h> +#include <asm/msr.h> #include "lxfb.h" /* TODO
Ilpo Järvinen
maintainerRe: [PATCH v4A 01/15] x86/msr: Add missing includes of <asm/msr.h>
In reply to Xin Li (Intel)Quoted 160 lines · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR header even though there is a
tsc.hheader.To facilitate the relocation of rdtsc{,_ordered}() from <
asm/msr.h> to <asm/tsc.h> and to eventually eliminate the inclusion of <asm/msr.h> in <asm/tsc.h>, add <asm/msr.h> to the source files that reference definitions from <asm/msr.h>.Signed-off-by Xin Li (Intel) <[email protected]>Acked-by Dave Hansen <[email protected]>Acked-by Ilpo Järvinen <[email protected]>---
Change in v4A:
*) Use "git grep -l -e $PATTERN | grep -v -f <(git grep -l -e 'asm/msr\.h')"
to ensure ALL required *direct* inclusion of <asm/msr.h> (Ilpo Järvinen).Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen). *) Add all necessary direct inclusions formsr.h(Ilpo Järvinen).Change in v3:
* Add a problem statement to the changelog (Dave Hansen).--- arch/x86/coco/sev/core.c | 1 + arch/x86/events/amd/core.c | 1 + arch/x86/events/amd/ibs.c | 1 + arch/x86/events/amd/iommu.c | 2 ++ arch/x86/events/amd/lbr.c | 1 + arch/x86/events/amd/power.c | 1 + arch/x86/events/core.c | 1 + arch/x86/events/intel/bts.c | 1 + arch/x86/events/intel/core.c | 1 + arch/x86/events/intel/cstate.c | 1 + arch/x86/events/intel/ds.c | 1 + arch/x86/events/intel/knc.c | 1 + arch/x86/events/intel/p4.c | 1 + arch/x86/events/intel/p6.c | 1 + arch/x86/events/intel/pt.c | 1 + arch/x86/events/intel/uncore.c | 1 + arch/x86/events/intel/uncore_discovery.c | 1 + arch/x86/events/intel/uncore_nhmex.c | 1 + arch/x86/events/intel/uncore_snb.c | 1 + arch/x86/events/intel/uncore_snbep.c | 1 + arch/x86/events/msr.c | 2 ++ arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 ++ arch/x86/events/rapl.c | 1 + arch/x86/events/utils.c | 1 + arch/x86/events/zhaoxin/core.c | 1 + arch/x86/hyperv/hv_apic.c | 1 + arch/x86/hyperv/hv_init.c | 1 + arch/x86/hyperv/hv_spinlock.c | 1 + arch/x86/hyperv/hv_vtl.c | 1 + arch/x86/hyperv/ivm.c | 1 + arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/microcode.h | 2 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/include/asm/msr.h | 1 + arch/x86/include/asm/resctrl.h | 2 ++ arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 2 ++ arch/x86/kernel/acpi/sleep.c | 1 + arch/x86/kernel/amd_nb.c | 1 + arch/x86/kernel/apic/apic.c | 1 + arch/x86/kernel/apic/apic_numachip.c | 1 + arch/x86/kernel/cet.c | 1 + arch/x86/kernel/cpu/amd.c | 1 + arch/x86/kernel/cpu/aperfmperf.c | 1 + arch/x86/kernel/cpu/bus_lock.c | 1 + arch/x86/kernel/cpu/feat_ctl.c | 1 + arch/x86/kernel/cpu/hygon.c | 1 + arch/x86/kernel/cpu/mce/inject.c | 1 + arch/x86/kernel/cpu/microcode/core.c | 1 + arch/x86/kernel/cpu/mshyperv.c | 1 + arch/x86/kernel/cpu/resctrl/core.c | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 1 + arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 + arch/x86/kernel/cpu/sgx/main.c | 1 + arch/x86/kernel/cpu/topology.c | 1 + arch/x86/kernel/cpu/topology_amd.c | 1 + arch/x86/kernel/cpu/tsx.c | 1 + arch/x86/kernel/cpu/zhaoxin.c | 1 + arch/x86/kernel/fpu/core.c | 1 + arch/x86/kernel/fpu/xstate.c | 1 + arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/fred.c | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/kvm.c | 1 + arch/x86/kernel/paravirt.c | 1 + arch/x86/kernel/process.c | 1 + arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/traps.c | 1 + arch/x86/kernel/tsc.c | 1 + arch/x86/kernel/tsc_sync.c | 1 + arch/x86/kvm/svm/avic.c | 1 + arch/x86/kvm/svm/sev.c | 1 + arch/x86/kvm/svm/svm.c | 1 + arch/x86/kvm/vmx/nested.c | 1 + arch/x86/kvm/vmx/pmu_intel.c | 1 + arch/x86/kvm/vmx/sgx.c | 1 + arch/x86/kvm/vmx/vmx.c | 1 + arch/x86/lib/insn-eval.c | 1 + arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 1 + arch/x86/mm/tlb.c | 1 + arch/x86/pci/amd_bus.c | 1 + arch/x86/pci/mmconfig-shared.c | 3 ++- arch/x86/power/cpu.c | 1 + arch/x86/realmode/init.c | 1 + arch/x86/virt/svm/sev.c | 1 + arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/pmu.c | 1 + arch/x86/xen/suspend.c | 1 + drivers/accel/habanalabs/common/habanalabs_ioctl.c | 2 -- drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 6 +++++- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 ++ drivers/cpufreq/elanfreq.c | 1 - drivers/cpufreq/sc520_freq.c | 1 - drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 ++++ drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 ++++ drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_if_common.c | 1 + .../platform/x86/intel/speed_select_if/isst_if_mbox_msr.c | 1 + drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../platform/x86/intel/uncore-frequency/uncore-frequency.c | 1 + drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../intel/int340x_thermal/processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 + 127 files changed, 142 insertions(+), 8 deletions(-)arch/x86/kernel/trace_clock.c +0
-0
arch/x86/kernel/trace_clock.c line 7
Quoted 5 lines
arch/x86/kernel/trace_clock.c +1
-1@@ -4,7 +4,7 @@*/ #include <asm/trace_clock.h> #include <asm/barrier.h> -#include <asm/msr.h> +#include <asm/tsc.h>
Does this change belong to this patch?
It might even cause a build failure until the second patch which moves the tsc related things to the other file (unless there's indirect include path to asm/msr.h).
arch/x86/lib/kaslr.c line 11
Quoted 10 lines
arch/x86/lib/kaslr.c +1
-1@@ -8,7 +8,7 @@*/ #include <asm/asm.h> #include <asm/kaslr.h> -#include <asm/msr.h> +#include <asm/tsc.h>
Same thing here.
Quoted 9 lines
arch/x86/lib/kaslr.c +0
-0#include <asm/archrandom.h> #include <asm/e820/api.h> #include <asm/shared/io.h> drivers/accel/habanalabs/common/habanalabs_ioctl.c +0
-0
drivers/accel/habanalabs/common/habanalabs_ioctl.c line 21
Quoted 5 lines
drivers/accel/habanalabs/common/habanalabs_ioctl.c +0
-2@@ -17,8 +17,6 @@#include <linux/uaccess.h> #include <linux/vmalloc.h> -#include <asm/msr.h> -
I suggested making a separate patch out of these removals. Currently you do them without any clear warning in the changelog which only talks about adding asm/msr.h.
drivers/acpi/processor_throttling.c line 24
Quoted 13 lines
drivers/acpi/processor_throttling.c +2
-1@@ -18,9 +18,13 @@#include <linux/sched.h> #include <linux/cpufreq.h> #include <linux/acpi.h> +#include <linux/uaccess.h> #include <acpi/processor.h> #include <asm/io.h> -#include <linux/uaccess.h> +#include <asm/asm.h>
???
drivers/acpi/processor_throttling.c line 27
Quoted 3 lines
drivers/acpi/processor_throttling.c +3
-0+#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif
I really appreciate you took the effort to do this change the correct way! :-)
--
i.
Xin Li
maintainerRe: [PATCH v4A 01/15] x86/msr: Add missing includes of <asm/msr.h>
Quoted 12 lines · Ilpo Järvinen
arch/x86/kernel/trace_clock.c line 7
Quoted 10 lines
arch/x86/kernel/trace_clock.c +1
-1@@ -4,7 +4,7 @@*/ #include <asm/trace_clock.h> #include <asm/barrier.h> -#include <asm/msr.h> +#include <asm/tsc.h> Does this change belong to this patch?
Quoted 3 lines
It might even cause a build failure until the second patch which moves the tsc related things to the other file (unless there's indirect include path to
asm/msr.h).
Ah, you're right as I have separated the relocation of rdtsc_ordered() into a following patch.
Quoted 24 lines
arch/x86/lib/kaslr.c line 11
Quoted 11 lines
arch/x86/lib/kaslr.c +1
-1@@ -8,7 +8,7 @@*/ #include <asm/asm.h> #include <asm/kaslr.h> -#include <asm/msr.h> +#include <asm/tsc.h> Same thing here.
Quoted 11 lines
arch/x86/lib/kaslr.c +0
-0#include <asm/archrandom.h> #include <asm/e820/api.h> #include <asm/shared/io.h> drivers/accel/habanalabs/common/habanalabs_ioctl.c +0
-0@@ -17,8 +17,6 @@#include <linux/uaccess.h> #include <linux/vmalloc.h>
Quoted 6 lines
drivers/accel/habanalabs/common/habanalabs_ioctl.c line 21
Quoted 2 lines
drivers/accel/habanalabs/common/habanalabs_ioctl.c +0
-2-#include <asm/msr.h> -I suggested making a separate patch out of these removals. Currently you do them without any clear warning in the changelog which only talks about adding
asm/msr.h.
I didn't want to add an extra patch to the v4 series, but I really should have mentioned the removal at least.
Quoted 6 lines
Quoted 6 lines
drivers/acpi/processor_throttling.c +0
-0@@ -18,9 +18,13 @@#include <linux/sched.h>
Quoted 8 lines
drivers/acpi/processor_throttling.c line 24
Quoted 7 lines
drivers/acpi/processor_throttling.c +2
-1#include <linux/cpufreq.h> #include <linux/acpi.h> +#include <linux/uaccess.h> #include <acpi/processor.h> #include <asm/io.h> -#include <linux/uaccess.h> +#include <asm/asm.h> ???
Damn me!
Not to find an excuse but I guess I got somewhat tired when doing it.
Quoted 7 lines
drivers/acpi/processor_throttling.c line 27
Quoted 4 lines
drivers/acpi/processor_throttling.c +3
-0+#ifdef CONFIG_X86 +#include <asm/msr.h> +#endif I really appreciate you took the effort to do this change the correct way! 🙂
Same here for pushing it the right direction!
Hi Ingo,
Since you *wisely* didn't remove msr.h from tsc.h, maybe you could just zap this patch and I will send an afterwards patch set to replace this patch?
Apology for the noise.
Thanks!
Xin
Xin Li (Intel)
maintainerPATCH v4 2/15 x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
In reply to Xin Li (Intel)For some reason, there are some TSC-related functions in the MSR header even though there is a tsc.h header.
Relocate rdtsc{,_ordered}() from <asm/msr.h> to <asm/tsc.h>, and subsequently remove the inclusion of <asm/msr.h> in <asm/tsc.h>.
---
Change in v4:
*) Add missing includes in a different patch (Ilpo Järvinen).
Change in v3:
* Add a problem statement to the changelog (Dave Hansen).
--- arch/x86/include/asm/msr.h | 54 --------------------------- arch/x86/include/asm/tsc.h | 76 +++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 55 deletions(-)
arch/x86/include/asm/msr.h +0 -54
@@ -170,60 +170,6 @@ native_write_msr_safe(u32 msr, u32 low, u32 high)extern int rdmsr_safe_regs (u32 regs[8 ]);extern int wrmsr_safe_regs (u32 regs[8 ]); -/** -* rdtsc() - returns the current TSC without ordering constraints -* -* rdtsc() returns the result of RDTSC as a 64-bit integer. The -* only ordering constraint it supplies is the ordering implied by -* "asm volatile": it will put the RDTSC in the place you expect. The -* CPU can and will speculatively execute that RDTSC, though, so the -* results can be non-monotonic if compared on different CPUs. -*/ -static __always_inline u64 rdtsc(void) -{ -DECLARE_ARGS (val, low, high); - - asm volatile("rdtsc" : EAX_EDX_RET(val, low, high)); - -return EAX_EDX_VAL (val, low, high); -} - -/** -* rdtsc_ordered() - read the current TSC in program order -* -* rdtsc_ordered() returns the result of RDTSC as a 64-bit integer. -* It is ordered like a load to a global in-memory counter. It should -* be impossible to observe non-monotonic rdtsc_unordered() behavior -* across multiple CPUs as long as the TSC is synced. -*/ -static __always_inline u64 rdtsc_ordered(void) -{ -DECLARE_ARGS (val, low, high); - -/* -* The RDTSC instruction is not ordered relative to memory -* access. The Intel SDM and the AMD APM are both vague on this -* point, but empirically an RDTSC instruction can be -* speculatively executed before prior loads. An RDTSC -* immediately after an appropriate barrier appears to be -* ordered as a normal load, that is, it provides the same -* ordering guarantees as reading from a global memory location -* that some other imaginary CPU is updating continuously with a -* time stamp. -* -* Thus, use the preferred barrier on the respective CPU, aiming for -* RDTSCP as the default. -*/ - asm volatile(ALTERNATIVE_2("rdtsc", - "lfence; rdtsc", X86_FEATURE_LFENCE_RDTSC, - "rdtscp", X86_FEATURE_RDTSCP) - : EAX_EDX_RET(val, low, high) - /* RDTSCP clobbers ECX with MSR_TSC_AUX. */ - :: "ecx"); - -return EAX_EDX_VAL (val, low, high); -} -static inline u64 native_read_pmc (int counter) {DECLARE_ARGS (val, low, high);
arch/x86/include/asm/tsc.h +75 -1
82 lines not on this page · raw message
Signature · 1 line
2.49.0
kernel test robot
build botRe: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
kernel test robot noticed the following build errors:
Hi Xin,
kernel test robot noticed the following build errors:
[auto build test ERROR on a5447e92e169dafaf02fd653500105c7186d7128]
url: https://github.com/intel-lab-lkp/linux/commits/Xin-Li-Intel/x86-msr-Add-missing-includes-of-asm-msr-h/20250427-212604 base: a5447e92e169dafaf02fd653500105c7186d7128 patch link: https://lore.kernel.org/r/20250427092027.1598740-3-xin%40zytor.com patch subject: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h> config: i386-randconfig-141-20250428 (https://download.01.org/0day-ci/archive/20250428/[email protected]/config) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250428/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> arch/x86/xen/suspend.c:42:3: error: call to undeclared function 'wrmsrq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
42 | wrmsrq(MSR_IA32_SPEC_CTRL, this_cpu_read(spec_ctrl));
| ^
>> arch/x86/xen/suspend.c:58:3: error: call to undeclared function 'rdmsrq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
58 | rdmsrq(MSR_IA32_SPEC_CTRL, tmp);
| ^
arch/x86/xen/suspend.c:60:3: error: call to undeclared function 'wrmsrq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
60 | wrmsrq(MSR_IA32_SPEC_CTRL, 0);
| ^3 errors generated.
vim +/wrmsrq +42 arch/x86/xen/suspend.c
0e91398f2a5d4e Jeremy Fitzhardinge 2008-05-26 38
f6eafe3665bcc3 Ian Campbell 2009-11-25 39 static void xen_vcpu_notify_restore(void *data)
f6eafe3665bcc3 Ian Campbell 2009-11-25 40 {
71c208dd54ab97 Juergen Gross 2018-02-26 41 if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL))
78255eb2397332 Ingo Molnar 2025-04-09 @42 wrmsrq(MSR_IA32_SPEC_CTRL, this_cpu_read(spec_ctrl));
71c208dd54ab97 Juergen Gross 2018-02-26 43
f6eafe3665bcc3 Ian Campbell 2009-11-25 44 /* Boot processor notified via generic timekeeping_resume() */
f6eafe3665bcc3 Ian Campbell 2009-11-25 45 if (smp_processor_id() == 0)
f6eafe3665bcc3 Ian Campbell 2009-11-25 46 return;
f6eafe3665bcc3 Ian Campbell 2009-11-25 47
f46481d0a7cb94 Thomas Gleixner 2015-03-25 48 tick_resume_local();
f6eafe3665bcc3 Ian Campbell 2009-11-25 49 }
f6eafe3665bcc3 Ian Campbell 2009-11-25 50
2b953a5e994ce2 Boris Ostrovsky 2015-04-28 51 static void xen_vcpu_notify_suspend(void *data)
2b953a5e994ce2 Boris Ostrovsky 2015-04-28 52 {
71c208dd54ab97 Juergen Gross 2018-02-26 53 u64 tmp;
71c208dd54ab97 Juergen Gross 2018-02-26 54
2b953a5e994ce2 Boris Ostrovsky 2015-04-28 55 tick_suspend_local();
71c208dd54ab97 Juergen Gross 2018-02-26 56
71c208dd54ab97 Juergen Gross 2018-02-26 57 if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) {
c435e608cf59ff Ingo Molnar 2025-04-09 @58 rdmsrq(MSR_IA32_SPEC_CTRL, tmp);
71c208dd54ab97 Juergen Gross 2018-02-26 59 this_cpu_write(spec_ctrl, tmp);
78255eb2397332 Ingo Molnar 2025-04-09 60 wrmsrq(MSR_IA32_SPEC_CTRL, 0);
71c208dd54ab97 Juergen Gross 2018-02-26 61 }
2b953a5e994ce2 Boris Ostrovsky 2015-04-28 62 }
2b953a5e994ce2 Boris Ostrovsky 2015-04-28 63 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
In reply to Xin Li (Intel)Quoted 15 lines · Xin Li (Intel)
index
94408a784c8e..13335a130edf100644arch/x86/include/asm/tsc.h +7
-1@@ -7,7 +7,81 @@#include <asm/cpufeature.h> #include <asm/processor.h> -#include <asm/msr.h> + +/* +* both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" +* constraint has different meanings. For i386, "A" means exactly +* edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead, +* it means rax *or* rdx. +*/
arch/x86/include/asm/tsc.h line 26
Quoted 10 lines
arch/x86/include/asm/tsc.h +10
-0+#ifdef CONFIG_X86_64 +/* Using 64-bit values saves one instruction clearing the high half of low */ +#define DECLARE_ARGS (val, low, high) unsigned long low, high +#define EAX_EDX_VAL (val, low, high) ((low) | (high) << 32) +#define EAX_EDX_RET (val, low, high) "=a" (low), "=d" (high) +#else +#define DECLARE_ARGS (val, low, high) u64 val +#define EAX_EDX_VAL (val, low, high) (val) +#define EAX_EDX_RET (val, low, high) "=A" (val) +#endif
Meh, this patch creates a duplicate copy of DECLARE_ARGS() et al in <asm/tsc.h> now:
arch/x86/include/asm/msr.h:#define DECLARE_ARGS(val, low, high) unsigned long low, high arch/x86/include/asm/msr.h:#define DECLARE_ARGS(val, low, high) u64 val
arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/tsc.h:#define DECLARE_ARGS(val, low, high) unsigned long low, high arch/x86/include/asm/tsc.h:#define DECLARE_ARGS(val, low, high) u64 val
arch/x86/include/asm/tsc.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/tsc.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/tsc.h:#undef DECLARE_ARGS
Which was both an undeclared change, bloats the code, causes various problems, and is totally unnecessary to boot.
Please don't do that ...
Thanks,
Ingo
Xin Li
maintainerRe: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
Quoted 43 lines · Ingo Molnar
Quoted 15 lines · Xin Li (Intel)
index
94408a784c8e..13335a130edf100644arch/x86/include/asm/tsc.h +7
-1@@ -7,7 +7,81 @@#include <asm/cpufeature.h> #include <asm/processor.h> -#include <asm/msr.h> + +/* +* both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" +* constraint has different meanings. For i386, "A" means exactly +* edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead, +* it means rax *or* rdx. +*/ arch/x86/include/asm/tsc.h line 26
Quoted 10 lines
arch/x86/include/asm/tsc.h +10
-0+#ifdef CONFIG_X86_64 +/* Using 64-bit values saves one instruction clearing the high half of low */ +#define DECLARE_ARGS (val, low, high) unsigned long low, high +#define EAX_EDX_VAL (val, low, high) ((low) | (high) << 32) +#define EAX_EDX_RET (val, low, high) "=a" (low), "=d" (high) +#else +#define DECLARE_ARGS (val, low, high) u64 val +#define EAX_EDX_VAL (val, low, high) (val) +#define EAX_EDX_RET (val, low, high) "=A" (val) +#endif Meh, this patch creates a duplicate copy of
DECLARE_ARGS()et al in <asm/tsc.h> now:arch/x86/include/asm/msr.h:#define DECLARE_ARGS(val, low, high) unsigned long low, high arch/x86/include/asm/msr.h:#define DECLARE_ARGS(val, low, high) u64 val arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/tsc.h:#define DECLARE_ARGS(val, low, high) unsigned long low, high arch/x86/include/asm/tsc.h:#define DECLARE_ARGS(val, low, high) u64 val arch/x86/include/asm/tsc.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/tsc.h: DECLARE_ARGS(val, low, high); arch/x86/include/asm/tsc.h:#undef DECLARE_ARGS
Quoted 4 lines
Which was both an undeclared change, bloats the code, causes various problems, and is totally unnecessary to boot.
Please don't do that ...
Learned!
Especially that every change needs to explicitly called out.
Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
In reply to Xin Li (Intel)Quoted 1 line · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR
^^^^^^^^^^^^^^^
Quoted 1 line
header even though there is a
tsc.hheader.
The real reason is that the rdtsc{,_ordered}() methods use the EAX_EDX_*() macros to optimize their EDX/EAX assembly accessors, which is why these methods were in <asm/msr.h>.
Your followup patch tacitly acknowledges this by silently creating duplicate copies of these facilities in both headers ...
I've cleaned it all up in tip:x86/msr via these preparatory patches:
x86/msr: Improve the comments of the DECLARE_ARGS()/EAX_EDX_VAL()/EAX_EDX_RET() facility x86/msr: Rename DECLARE_ARGS() to EAX_EDX_DECLARE_ARGS
x86/msr: Move the EAX_EDX_*() methods from <asm/msr.h> to <asm/asm.h>
Thanks,
Ingo
Xin Li
maintainerRe: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
Quoted 11 lines · Ingo Molnar
Quoted 1 line · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR
^^^^^^^^^^^^^^^
Quoted 1 line
header even though there is a
tsc.hheader.The real reason is that the rdtsc{,_ordered}() methods use the EAX_EDX_*() macros to optimize their EDX/EAX assembly accessors, which is why these methods were in <
asm/msr.h>.
Quoted 9 lines
Your followup patch tacitly acknowledges this by silently creating duplicate copies of these facilities in both headers ...
I've cleaned it all up in tip:x86/msr via these preparatory patches:
x86/msr: Improve the comments of the DECLARE_ARGS()/EAX_EDX_VAL()/EAX_EDX_RET() facility x86/msr: Rename
DECLARE_ARGS()toEAX_EDX_DECLARE_ARGS
x86/msr: Move the EAX_EDX_*() methods from <asm/msr.h> to <asm/asm.h>
Brilliant!
Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
In reply to Xin Li (Intel)Quoted 13 lines · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR header even though there is a
tsc.hheader.Relocate rdtsc{,_ordered}() from <
asm/msr.h> to <asm/tsc.h>, and subsequently remove the inclusion of <asm/msr.h> in <asm/tsc.h>.Signed-off-by Xin Li (Intel) <[email protected]>Acked-by Dave Hansen <[email protected]>
arch/x86/include/asm/tsc.h line 10
Quoted 4 lines
arch/x86/include/asm/tsc.h +0
-1@@ -7,7 +7,81 @@#include <asm/cpufeature.h> #include <asm/processor.h> -#include <asm/msr.h>
Note that in the tip:x86/msr commit I've applied today I've intentionally delayed the removal of this header dependency, to reduce the probability of breaking -next today or in the near future.
We can remove that now superfluous header dependency in a future patch.
Thanks,
Ingo
Xin Li
maintainerRe: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
Quoted 25 lines · Ingo Molnar
Quoted 13 lines · Xin Li (Intel)
For some reason, there are some TSC-related functions in the MSR header even though there is a
tsc.hheader.Relocate rdtsc{,_ordered}() from <
asm/msr.h> to <asm/tsc.h>, and subsequently remove the inclusion of <asm/msr.h> in <asm/tsc.h>.Signed-off-by Xin Li (Intel) <[email protected]>Acked-by Dave Hansen <[email protected]>arch/x86/include/asm/tsc.h line 10
Quoted 4 lines
arch/x86/include/asm/tsc.h +0
-1@@ -7,7 +7,81 @@#include <asm/cpufeature.h> #include <asm/processor.h> -#include <asm/msr.h> Note that in the tip:x86/msr commit I've applied today I've intentionally delayed the removal of this header dependency, to reduce the probability of breaking -next today or in the near future.
Quoted 2 lines
We can remove that now superfluous header dependency in a future patch.
This is truly a brilliant decision!
Especially regarding the issues Ilpo identified.
Thanks!
Xin
[tip: x86/merge] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
In reply to Xin Li (Intel)The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 288a4ff0ad29d1a9391b8a111a4b6da51da3aa85 Gitweb: https://git.kernel.org/tip/288a4ff0ad29d1a9391b8a111a4b6da51da3aa85 Author: Xin Li (Intel) <[email protected]> AuthorDate: Fri, 02 May 2025 10:20:14 +02:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:24:39 +02:00
x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
Relocate rdtsc{,_ordered}() from <asm/msr.h> to <asm/tsc.h>.
[ mingo: Do not remove the <asm/tsc.h> inclusion from <asm/msr.h>
just yet, to reduce -next breakages. We can do this later on, separately, shortly before the next -rc1. ]
--- arch/x86/include/asm/msr.h | 54 +------------------------------------ arch/x86/include/asm/tsc.h | 55 +++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 54 deletions(-)
arch/x86/include/asm/msr.h +0 -54
@@ -153,60 +153,6 @@ native_write_msr_safe(u32 msr, u32 low, u32 high)extern int rdmsr_safe_regs (u32 regs[8 ]);extern int wrmsr_safe_regs (u32 regs[8 ]); -/** -* rdtsc() - returns the current TSC without ordering constraints -* -* rdtsc() returns the result of RDTSC as a 64-bit integer. The -* only ordering constraint it supplies is the ordering implied by -* "asm volatile": it will put the RDTSC in the place you expect. The -* CPU can and will speculatively execute that RDTSC, though, so the -* results can be non-monotonic if compared on different CPUs. -*/ -static __always_inline u64 rdtsc(void) -{ -EAX_EDX_DECLARE_ARGS (val, low, high); - - asm volatile("rdtsc" : EAX_EDX_RET(val, low, high)); - -return EAX_EDX_VAL (val, low, high); -} - -/** -* rdtsc_ordered() - read the current TSC in program order -* -* rdtsc_ordered() returns the result of RDTSC as a 64-bit integer. -* It is ordered like a load to a global in-memory counter. It should -* be impossible to observe non-monotonic rdtsc_unordered() behavior -* across multiple CPUs as long as the TSC is synced. -*/ -static __always_inline u64 rdtsc_ordered(void) -{ -EAX_EDX_DECLARE_ARGS (val, low, high); - -/* -* The RDTSC instruction is not ordered relative to memory -* access. The Intel SDM and the AMD APM are both vague on this -* point, but empirically an RDTSC instruction can be -* speculatively executed before prior loads. An RDTSC -* immediately after an appropriate barrier appears to be -* ordered as a normal load, that is, it provides the same -* ordering guarantees as reading from a global memory location -* that some other imaginary CPU is updating continuously with a -* time stamp. -* -* Thus, use the preferred barrier on the respective CPU, aiming for -* RDTSCP as the default. -*/ - asm volatile(ALTERNATIVE_2("rdtsc", - "lfence; rdtsc", X86_FEATURE_LFENCE_RDTSC, - "rdtscp", X86_FEATURE_RDTSCP) - : EAX_EDX_RET(val, low, high) - /* RDTSCP clobbers ECX with MSR_TSC_AUX. */ - :: "ecx"); - -return EAX_EDX_VAL (val, low, high); -} -static inline u64 native_read_pmc (int counter) {EAX_EDX_DECLARE_ARGS (val, low, high);
arch/x86/include/asm/tsc.h +55 -0
65 lines not on this page · raw message
Xin Li (Intel)
maintainerPATCH v4 3/15 x86/msr: Remove rdpmc()
In reply to Xin Li (Intel)rdpmc() is not used anywhere, remove it.
--- arch/x86/include/asm/msr.h | 7 ------- arch/x86/include/asm/paravirt.h | 7 ------- 2 files changed, 14 deletions(-)
arch/x86/include/asm/msr.h +0 -7
@@ -234,13 +234,6 @@ static inline int rdmsrq_safe(u32 msr, u64 *p) return err; } -#define rdpmc (counter, low, high) \ -do { \ - u64 _l = native_read_pmc((counter)); \ - (low) = (u32)_l; \ - (high) = (u32)(_l >> 32); \ -} while (0) -#define rdpmcl (counter, val) ((val) = native_read_pmc(counter))#endif /* !CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/paravirt.h +0 -7
@@ -244,13 +244,6 @@ static inline u64 paravirt_read_pmc(int counter)return PVOP_CALL1 (u64, cpu.read_pmc, counter); } -#define rdpmc (counter, low, high) \ -do { \ - u64 _l = paravirt_read_pmc(counter); \ - low = (u32)_l; \ - high = _l >> 32; \ -} while (0) -#define rdpmcl (counter, val) ((val) = paravirt_read_pmc(counter))static inline void paravirt_alloc_ldt (struct desc_struct *ldt,unsigned entries)
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Remove the unused rdpmc() method
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 91882511ef905fdfb7d33be88f6ddb91012ee30f Gitweb: https://git.kernel.org/tip/91882511ef905fdfb7d33be88f6ddb91012ee30f Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:15 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:25:04 +02:00
x86/msr: Remove the unused rdpmc() method
rdpmc() is not used anywhere anymore, remove it.
--- arch/x86/include/asm/msr.h | 7 ------- arch/x86/include/asm/paravirt.h | 7 ------- 2 files changed, 14 deletions(-)
arch/x86/include/asm/msr.h +0 -7
@@ -217,13 +217,6 @@ static inline int rdmsrq_safe(u32 msr, u64 *p) return err; } -#define rdpmc (counter, low, high) \ -do { \ - u64 _l = native_read_pmc((counter)); \ - (low) = (u32)_l; \ - (high) = (u32)(_l >> 32); \ -} while (0) -#define rdpmcl (counter, val) ((val) = native_read_pmc(counter))#endif /* !CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/paravirt.h +0 -7
@@ -244,13 +244,6 @@ static inline u64 paravirt_read_pmc(int counter)return PVOP_CALL1 (u64, cpu.read_pmc, counter); } -#define rdpmc (counter, low, high) \ -do { \ - u64 _l = paravirt_read_pmc(counter); \ - low = (u32)_l; \ - high = _l >> 32; \ -} while (0) -#define rdpmcl (counter, val) ((val) = paravirt_read_pmc(counter))static inline void paravirt_alloc_ldt (struct desc_struct *ldt,unsigned entries)
Xin Li (Intel)
maintainerPATCH v4 4/15 x86/msr: Rename rdpmcl() to rdpmc()
In reply to Xin Li (Intel)Now that rdpmc() is gone, i.e. rdpmcl() is the sole PMC read helper, simply rename rdpmcl() to rdpmc().
---
Changes in v3:
*) Explain the reason of the renaming in the changelog (Dave Hansen). *) Use shorter name rdpmc() instead of rdpmcq() as the name of the
sole PMC read helper (Sean Christopherson).
--- arch/x86/events/amd/uncore.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/events/intel/core.c | 4 ++-- arch/x86/events/intel/ds.c | 2 +- arch/x86/include/asm/msr.h | 2 +- arch/x86/include/asm/paravirt.h | 2 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 12 ++++++------ 7 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/events/amd/uncore.c +1 -1
@@ -108,7 +108,7 @@ static void amd_uncore_read(struct perf_event *event)if (hwc->event_base_rdpmc <0 )rdmsrq (hwc->event_base, new);else -rdpmcl (hwc->event_base_rdpmc, new); +rdpmc (hwc->event_base_rdpmc, new);local64_set (&hwc->prev_count, new); delta = (new <<COUNTER_SHIFT ) - (prev <<COUNTER_SHIFT );
arch/x86/events/core.c +1 -1
@@ -134,7 +134,7 @@ u64 x86_perf_event_update(struct perf_event *event)*/ prev_raw_count =local64_read (&hwc->prev_count);do { -rdpmcl (hwc->event_base_rdpmc, new_raw_count); +rdpmc (hwc->event_base_rdpmc, new_raw_count); }while (!local64_try_cmpxchg (&hwc->prev_count, &prev_raw_count, new_raw_count));
arch/x86/events/intel/core.c +2 -2
@@ -2724,12 +2724,12 @@ static u64 intel_update_topdown_event(struct perf_event *event, int metric_end,if (!val) {/* read Fixed counter 3 */ -rdpmcl ((3 |INTEL_PMC_FIXED_RDPMC_BASE ), slots); +rdpmc ((3 |INTEL_PMC_FIXED_RDPMC_BASE ), slots);if (!slots)return 0 ;/* read PERF_METRICS */ -rdpmcl (INTEL_PMC_FIXED_RDPMC_METRICS , metrics); +rdpmc (INTEL_PMC_FIXED_RDPMC_METRICS , metrics); }else { slots = val[0 ]; metrics = val[1 ];
arch/x86/events/intel/ds.c +1 -1
@@ -2274,7 +2274,7 @@ intel_pmu_save_and_restart_reload(struct perf_event *event, int count)WARN_ON (this_cpu_read (cpu_hw_events.enabled)); prev_raw_count =local64_read (&hwc->prev_count); -rdpmcl (hwc->event_base_rdpmc, new_raw_count); +rdpmc (hwc->event_base_rdpmc, new_raw_count);local64_set (&hwc->prev_count, new_raw_count);/*
arch/x86/include/asm/msr.h +1 -1
@@ -234,7 +234,7 @@ static inline int rdmsrq_safe(u32 msr, u64 *p) return err; } -#define rdpmcl (counter, val) ((val) = native_read_pmc(counter)) +#define rdpmc (counter, val) ((val) = native_read_pmc(counter))#endif /* !CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/paravirt.h +1 -1
@@ -244,7 +244,7 @@ static inline u64 paravirt_read_pmc(int counter)return PVOP_CALL1 (u64, cpu.read_pmc, counter); } -#define rdpmcl (counter, val) ((val) = paravirt_read_pmc(counter)) +#define rdpmc (counter, val) ((val) = paravirt_read_pmc(counter))static inline void paravirt_alloc_ldt (struct desc_struct *ldt,unsigned entries) {
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +6 -6
@@ -1019,8 +1019,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* used in L1 cache, second to capture accurate value that does not * include cache misses incurred because of instruction loads. */ -rdpmcl (hit_pmcnum, hits_before); -rdpmcl (miss_pmcnum, miss_before); +rdpmc (hit_pmcnum, hits_before); +rdpmc (miss_pmcnum, miss_before);/* * From SDM: Performing back-to-back fast reads are not guaranteed * to be monotonic.
@@ -1028,8 +1028,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmcl (hit_pmcnum, hits_before); -rdpmcl (miss_pmcnum, miss_before); +rdpmc (hit_pmcnum, hits_before); +rdpmc (miss_pmcnum, miss_before);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
@@ -1051,8 +1051,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmcl (hit_pmcnum, hits_after); -rdpmcl (miss_pmcnum, miss_after); +rdpmc (hit_pmcnum, hits_after); +rdpmc (miss_pmcnum, miss_after);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Rename rdpmcl() to rdpmc()
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 7d9ccde56bc023f9a968db537963a029aa41d902 Gitweb: https://git.kernel.org/tip/7d9ccde56bc023f9a968db537963a029aa41d902 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:16 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:25:24 +02:00
x86/msr: Rename rdpmcl() to rdpmc()
Now that rdpmc() is gone, rdpmcl() is the sole PMC read helper, simply rename rdpmcl() to rdpmc().
--- arch/x86/events/amd/uncore.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/events/intel/core.c | 4 ++-- arch/x86/events/intel/ds.c | 2 +- arch/x86/include/asm/msr.h | 2 +- arch/x86/include/asm/paravirt.h | 2 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 12 ++++++------ 7 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/events/amd/uncore.c +1 -1
@@ -108,7 +108,7 @@ static void amd_uncore_read(struct perf_event *event)if (hwc->event_base_rdpmc <0 )rdmsrq (hwc->event_base, new);else -rdpmcl (hwc->event_base_rdpmc, new); +rdpmc (hwc->event_base_rdpmc, new);local64_set (&hwc->prev_count, new); delta = (new <<COUNTER_SHIFT ) - (prev <<COUNTER_SHIFT );
arch/x86/events/core.c +1 -1
@@ -135,7 +135,7 @@ u64 x86_perf_event_update(struct perf_event *event)*/ prev_raw_count =local64_read (&hwc->prev_count);do { -rdpmcl (hwc->event_base_rdpmc, new_raw_count); +rdpmc (hwc->event_base_rdpmc, new_raw_count); }while (!local64_try_cmpxchg (&hwc->prev_count, &prev_raw_count, new_raw_count));
arch/x86/events/intel/core.c +2 -2
@@ -2725,12 +2725,12 @@ static u64 intel_update_topdown_event(struct perf_event *event, int metric_end,if (!val) {/* read Fixed counter 3 */ -rdpmcl ((3 |INTEL_PMC_FIXED_RDPMC_BASE ), slots); +rdpmc ((3 |INTEL_PMC_FIXED_RDPMC_BASE ), slots);if (!slots)return 0 ;/* read PERF_METRICS */ -rdpmcl (INTEL_PMC_FIXED_RDPMC_METRICS , metrics); +rdpmc (INTEL_PMC_FIXED_RDPMC_METRICS , metrics); }else { slots = val[0 ]; metrics = val[1 ];
arch/x86/events/intel/ds.c +1 -1
@@ -2277,7 +2277,7 @@ intel_pmu_save_and_restart_reload(struct perf_event *event, int count)WARN_ON (this_cpu_read (cpu_hw_events.enabled)); prev_raw_count =local64_read (&hwc->prev_count); -rdpmcl (hwc->event_base_rdpmc, new_raw_count); +rdpmc (hwc->event_base_rdpmc, new_raw_count);local64_set (&hwc->prev_count, new_raw_count);/*
arch/x86/include/asm/msr.h +1 -1
@@ -217,7 +217,7 @@ static inline int rdmsrq_safe(u32 msr, u64 *p) return err; } -#define rdpmcl (counter, val) ((val) = native_read_pmc(counter)) +#define rdpmc (counter, val) ((val) = native_read_pmc(counter))#endif /* !CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/paravirt.h +1 -1
@@ -244,7 +244,7 @@ static inline u64 paravirt_read_pmc(int counter)return PVOP_CALL1 (u64, cpu.read_pmc, counter); } -#define rdpmcl (counter, val) ((val) = paravirt_read_pmc(counter)) +#define rdpmc (counter, val) ((val) = paravirt_read_pmc(counter))static inline void paravirt_alloc_ldt (struct desc_struct *ldt,unsigned entries) {
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +6 -6
@@ -1019,8 +1019,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* used in L1 cache, second to capture accurate value that does not * include cache misses incurred because of instruction loads. */ -rdpmcl (hit_pmcnum, hits_before); -rdpmcl (miss_pmcnum, miss_before); +rdpmc (hit_pmcnum, hits_before); +rdpmc (miss_pmcnum, miss_before);/* * From SDM: Performing back-to-back fast reads are not guaranteed * to be monotonic.
@@ -1028,8 +1028,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmcl (hit_pmcnum, hits_before); -rdpmcl (miss_pmcnum, miss_before); +rdpmc (hit_pmcnum, hits_before); +rdpmc (miss_pmcnum, miss_before);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
@@ -1051,8 +1051,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmcl (hit_pmcnum, hits_after); -rdpmcl (miss_pmcnum, miss_after); +rdpmc (hit_pmcnum, hits_after); +rdpmc (miss_pmcnum, miss_after);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
Xin Li (Intel)
maintainerPATCH v4 5/15 x86/msr: Convert the rdpmc() macro into an always inline function
In reply to Xin Li (Intel)Functions offer type safety and better readability compared to macros. Additionally, always inline functions can match the performance of macros. Converting the rdpmc() macro into an always inline function is simple and straightforward, so just make the change.
Moreover, the read result is now the returned value, further enhancing readability.
---
Change in v3:
*) Add a changelog even it's obvious (Dave Hansen).
--- arch/x86/events/amd/uncore.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/events/intel/core.c | 4 ++-- arch/x86/events/intel/ds.c | 2 +- arch/x86/include/asm/msr.h | 5 ++++- arch/x86/include/asm/paravirt.h | 4 +--- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 12 ++++++------ 7 files changed, 16 insertions(+), 15 deletions(-)
arch/x86/events/amd/uncore.c +1 -1
@@ -108,7 +108,7 @@ static void amd_uncore_read(struct perf_event *event)if (hwc->event_base_rdpmc <0 )rdmsrq (hwc->event_base, new);else -rdpmc (hwc->event_base_rdpmc, new); + new =rdpmc (hwc->event_base_rdpmc);local64_set (&hwc->prev_count, new); delta = (new <<COUNTER_SHIFT ) - (prev <<COUNTER_SHIFT );
arch/x86/events/core.c +1 -1
@@ -134,7 +134,7 @@ u64 x86_perf_event_update(struct perf_event *event)*/ prev_raw_count =local64_read (&hwc->prev_count);do { -rdpmc (hwc->event_base_rdpmc, new_raw_count); + new_raw_count =rdpmc (hwc->event_base_rdpmc); }while (!local64_try_cmpxchg (&hwc->prev_count, &prev_raw_count, new_raw_count));
arch/x86/events/intel/core.c +2 -2
@@ -2724,12 +2724,12 @@ static u64 intel_update_topdown_event(struct perf_event *event, int metric_end,if (!val) {/* read Fixed counter 3 */ -rdpmc ((3 |INTEL_PMC_FIXED_RDPMC_BASE ), slots); + slots =rdpmc (3 |INTEL_PMC_FIXED_RDPMC_BASE );if (!slots)return 0 ;/* read PERF_METRICS */ -rdpmc (INTEL_PMC_FIXED_RDPMC_METRICS , metrics); + metrics =rdpmc (INTEL_PMC_FIXED_RDPMC_METRICS ); }else { slots = val[0 ]; metrics = val[1 ];
arch/x86/events/intel/ds.c +1 -1
@@ -2274,7 +2274,7 @@ intel_pmu_save_and_restart_reload(struct perf_event *event, int count)WARN_ON (this_cpu_read (cpu_hw_events.enabled)); prev_raw_count =local64_read (&hwc->prev_count); -rdpmc (hwc->event_base_rdpmc, new_raw_count); + new_raw_count =rdpmc (hwc->event_base_rdpmc);local64_set (&hwc->prev_count, new_raw_count);/*
arch/x86/include/asm/msr.h +4 -1
@@ -234,7 +234,10 @@ static inline int rdmsrq_safe(u32 msr, u64 *p)return err; } -#define rdpmc (counter, val) ((val) = native_read_pmc(counter)) +static __always_inline u64 rdpmc(int counter) +{ +return native_read_pmc (counter); +}#endif /* !CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/paravirt.h +1 -3
@@ -239,13 +239,11 @@ static inline int rdmsrq_safe(unsigned msr, u64 *p)return err; } -static inline u64 paravirt_read_pmc (int counter) +static __always_inline u64 rdpmc(int counter) {return PVOP_CALL1 (u64, cpu.read_pmc, counter); } -#define rdpmc (counter, val) ((val) = paravirt_read_pmc(counter)) -static inline void paravirt_alloc_ldt (struct desc_struct *ldt,unsigned entries) {PVOP_VCALL2 (cpu.alloc_ldt, ldt, entries);
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +6 -6
@@ -1019,8 +1019,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* used in L1 cache, second to capture accurate value that does not * include cache misses incurred because of instruction loads. */ -rdpmc (hit_pmcnum, hits_before); -rdpmc (miss_pmcnum, miss_before); + hits_before =rdpmc (hit_pmcnum); + miss_before =rdpmc (miss_pmcnum);/* * From SDM: Performing back-to-back fast reads are not guaranteed * to be monotonic.
@@ -1028,8 +1028,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmc (hit_pmcnum, hits_before); -rdpmc (miss_pmcnum, miss_before); + hits_before =rdpmc (hit_pmcnum); + miss_before =rdpmc (miss_pmcnum);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
@@ -1051,8 +1051,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmc (hit_pmcnum, hits_after); -rdpmc (miss_pmcnum, miss_after); + hits_after =rdpmc (hit_pmcnum); + miss_after =rdpmc (miss_pmcnum);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Convert the rdpmc() macro to an __always_inline function
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 795ada52875fe61469f635f226d19a4cd733d1e8 Gitweb: https://git.kernel.org/tip/795ada52875fe61469f635f226d19a4cd733d1e8 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:17 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:26:56 +02:00
x86/msr: Convert the rdpmc() macro to an __always_inline function
Functions offer type safety and better readability compared to macros. Additionally, always inline functions can match the performance of macros. Converting the rdpmc() macro into an always inline function is simple and straightforward, so just make the change.
Moreover, the read result is now the returned value, further enhancing readability.
--- arch/x86/events/amd/uncore.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/events/intel/core.c | 4 ++-- arch/x86/events/intel/ds.c | 2 +- arch/x86/include/asm/msr.h | 5 ++++- arch/x86/include/asm/paravirt.h | 4 +--- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 12 ++++++------ 7 files changed, 16 insertions(+), 15 deletions(-)
arch/x86/events/amd/uncore.c +1 -1
@@ -108,7 +108,7 @@ static void amd_uncore_read(struct perf_event *event)if (hwc->event_base_rdpmc <0 )rdmsrq (hwc->event_base, new);else -rdpmc (hwc->event_base_rdpmc, new); + new =rdpmc (hwc->event_base_rdpmc);local64_set (&hwc->prev_count, new); delta = (new <<COUNTER_SHIFT ) - (prev <<COUNTER_SHIFT );
arch/x86/events/core.c +1 -1
@@ -135,7 +135,7 @@ u64 x86_perf_event_update(struct perf_event *event)*/ prev_raw_count =local64_read (&hwc->prev_count);do { -rdpmc (hwc->event_base_rdpmc, new_raw_count); + new_raw_count =rdpmc (hwc->event_base_rdpmc); }while (!local64_try_cmpxchg (&hwc->prev_count, &prev_raw_count, new_raw_count));
arch/x86/events/intel/core.c +2 -2
@@ -2725,12 +2725,12 @@ static u64 intel_update_topdown_event(struct perf_event *event, int metric_end,if (!val) {/* read Fixed counter 3 */ -rdpmc ((3 |INTEL_PMC_FIXED_RDPMC_BASE ), slots); + slots =rdpmc (3 |INTEL_PMC_FIXED_RDPMC_BASE );if (!slots)return 0 ;/* read PERF_METRICS */ -rdpmc (INTEL_PMC_FIXED_RDPMC_METRICS , metrics); + metrics =rdpmc (INTEL_PMC_FIXED_RDPMC_METRICS ); }else { slots = val[0 ]; metrics = val[1 ];
arch/x86/events/intel/ds.c +1 -1
@@ -2277,7 +2277,7 @@ intel_pmu_save_and_restart_reload(struct perf_event *event, int count)WARN_ON (this_cpu_read (cpu_hw_events.enabled)); prev_raw_count =local64_read (&hwc->prev_count); -rdpmc (hwc->event_base_rdpmc, new_raw_count); + new_raw_count =rdpmc (hwc->event_base_rdpmc);local64_set (&hwc->prev_count, new_raw_count);/*
arch/x86/include/asm/msr.h +4 -1
@@ -217,7 +217,10 @@ static inline int rdmsrq_safe(u32 msr, u64 *p)return err; } -#define rdpmc (counter, val) ((val) = native_read_pmc(counter)) +static __always_inline u64 rdpmc(int counter) +{ +return native_read_pmc (counter); +}#endif /* !CONFIG_PARAVIRT_XXL */
arch/x86/include/asm/paravirt.h +1 -3
@@ -239,13 +239,11 @@ static inline int rdmsrq_safe(unsigned msr, u64 *p)return err; } -static inline u64 paravirt_read_pmc (int counter) +static __always_inline u64 rdpmc(int counter) {return PVOP_CALL1 (u64, cpu.read_pmc, counter); } -#define rdpmc (counter, val) ((val) = paravirt_read_pmc(counter)) -static inline void paravirt_alloc_ldt (struct desc_struct *ldt,unsigned entries) {PVOP_VCALL2 (cpu.alloc_ldt, ldt, entries);
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +6 -6
@@ -1019,8 +1019,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* used in L1 cache, second to capture accurate value that does not * include cache misses incurred because of instruction loads. */ -rdpmc (hit_pmcnum, hits_before); -rdpmc (miss_pmcnum, miss_before); + hits_before =rdpmc (hit_pmcnum); + miss_before =rdpmc (miss_pmcnum);/* * From SDM: Performing back-to-back fast reads are not guaranteed * to be monotonic.
@@ -1028,8 +1028,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmc (hit_pmcnum, hits_before); -rdpmc (miss_pmcnum, miss_before); + hits_before =rdpmc (hit_pmcnum); + miss_before =rdpmc (miss_pmcnum);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
@@ -1051,8 +1051,8 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* before proceeding. */ rmb (); -rdpmc (hit_pmcnum, hits_after); -rdpmc (miss_pmcnum, miss_after); + hits_after =rdpmc (hit_pmcnum); + miss_after =rdpmc (miss_pmcnum);/* * Use LFENCE to ensure all previous instructions are retired * before proceeding.
Xin Li (Intel)
maintainerPATCH v4 6/15 x86/xen/msr: Return u64 consistently in Xen PMC read functions
In reply to Xin Li (Intel)The pv_ops PMC read API is defined as:
u64 (*read_pmc)(int counter);
But Xen PMC read functions return unsigned long long, make them return u64 consistently.
--- arch/x86/xen/pmu.c | 6 +++--- arch/x86/xen/xen-ops.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/xen/pmu.c +3 -3
@@ -346,7 +346,7 @@ bool pmu_msr_write(unsigned int msr, uint32_t low, uint32_t high, int *err)return true; } -static unsigned long long xen_amd_read_pmc (int counter) +static u64 xen_amd_read_pmc (int counter) {struct xen_pmu_amd_ctxt *ctxt;uint64_t *counter_regs;
@@ -366,7 +366,7 @@ static unsigned long long xen_amd_read_pmc(int counter)return counter_regs[counter]; } -static unsigned long long xen_intel_read_pmc (int counter) +static u64 xen_intel_read_pmc (int counter) {struct xen_pmu_intel_ctxt *ctxt;uint64_t *fixed_counters;
@@ -396,7 +396,7 @@ static unsigned long long xen_intel_read_pmc(int counter)return arch_cntr_pair[counter].counter; } -unsigned long long xen_read_pmc (int counter) +u64 xen_read_pmc (int counter) {if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return xen_amd_read_pmc (counter);
arch/x86/xen/xen-ops.h +1 -1
@@ -277,7 +277,7 @@ static inline void xen_pmu_finish(int cpu) {}bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err);bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err);int pmu_apic_update (uint32_t reg); -unsigned long long xen_read_pmc (int counter); +u64 xen_read_pmc (int counter);#ifdef CONFIG_SMP
Signature · 1 line
2.49.0
[tip: x86/merge] x86/xen/msr: Return u64 consistently in Xen PMC xen_*_read functions
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 5afa4cf54518b26e18d7b7ce2e9d9724f9cb9324 Gitweb: https://git.kernel.org/tip/5afa4cf54518b26e18d7b7ce2e9d9724f9cb9324 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:18 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:27:22 +02:00
x86/xen/msr: Return u64 consistently in Xen PMC xen_*_read functions
The pv_ops PMC read API is defined as:
u64 (*read_pmc)(int counter);
But Xen PMC read functions return 'unsigned long long', make them return u64 consistently.
--- arch/x86/xen/pmu.c | 6 +++--- arch/x86/xen/xen-ops.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/xen/pmu.c +3 -3
@@ -347,7 +347,7 @@ bool pmu_msr_write(unsigned int msr, uint32_t low, uint32_t high, int *err)return true; } -static unsigned long long xen_amd_read_pmc (int counter) +static u64 xen_amd_read_pmc (int counter) {struct xen_pmu_amd_ctxt *ctxt;uint64_t *counter_regs;
@@ -367,7 +367,7 @@ static unsigned long long xen_amd_read_pmc(int counter)return counter_regs[counter]; } -static unsigned long long xen_intel_read_pmc (int counter) +static u64 xen_intel_read_pmc (int counter) {struct xen_pmu_intel_ctxt *ctxt;uint64_t *fixed_counters;
@@ -397,7 +397,7 @@ static unsigned long long xen_intel_read_pmc(int counter)return arch_cntr_pair[counter].counter; } -unsigned long long xen_read_pmc (int counter) +u64 xen_read_pmc (int counter) {if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return xen_amd_read_pmc (counter);
arch/x86/xen/xen-ops.h +1 -1
@@ -274,7 +274,7 @@ static inline void xen_pmu_finish(int cpu) {}bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err);bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err);int pmu_apic_update (uint32_t reg); -unsigned long long xen_read_pmc (int counter); +u64 xen_read_pmc (int counter);#ifdef CONFIG_SMP
Xin Li (Intel)
maintainerPATCH v4 7/15 x86/msr: Convert __wrmsr() uses to native_wrmsr{,q}() uses
In reply to Xin Li (Intel)__wrmsr() is the lowest level MSR write API, with native_wrmsr() and native_wrmsrq() serving as higher-level wrappers around it:
#define native_wrmsr(msr, low, high) \
__wrmsr(msr, low, high)
#define native_wrmsrl(msr, val) \
__wrmsr((msr), (u32)((u64)(val)), \
(u32)((u64)(val) >> 32))However, __wrmsr() continues to be utilized in various locations.
MSR APIs are designed for different scenarios, such as native or pvops, with or without trace, and safe or non-safe. Unfortunately, the current MSR API names do not adequately reflect these factors, making it challenging to select the most appropriate API for various situations.
To pave the way for improving MSR API names, convert __wrmsr() uses to native_wrmsr{,q}() to ensure consistent usage. Later, these APIs can be renamed to better reflect their implications, such as native or pvops, with or without trace, and safe or non-safe.
No functional change intended.
---
Change in v2:
* Use native_wrmsr() where natural [rmid_p, closid_p] high/lo parameters can be used, without the shift-uglification (Ingo).
--- arch/x86/events/amd/brs.c | 2 +- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/msr.h | 6 ++++-- arch/x86/kernel/cpu/mce/core.c | 2 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 6 +++--- 5 files changed, 10 insertions(+), 8 deletions(-)
arch/x86/events/amd/brs.c +1 -1
@@ -44,7 +44,7 @@ static inline unsigned int brs_to(int idx) static __always_inline void set_debug_extn_cfg(u64 val) {/* bits[4:3] must always be set to 11b */ -__wrmsr (MSR_AMD_DBG_EXTN_CFG , val |3ULL <<3 , val >>32 ); +native_wrmsrq (MSR_AMD_DBG_EXTN_CFG , val |3ULL <<3 ); } static __always_inline u64 get_debug_extn_cfg(void)
arch/x86/include/asm/apic.h +1 -1
@@ -214,7 +214,7 @@ static inline void native_apic_msr_write(u32 reg, u32 v)static inline void native_apic_msr_eoi (void ) { -__wrmsr (APIC_BASE_MSR + (APIC_EOI >>4 ),APIC_EOI_ACK ,0 ); +native_wrmsrq (APIC_BASE_MSR + (APIC_EOI >>4 ),APIC_EOI_ACK ); }static inline u32 native_apic_msr_read (u32 reg)
arch/x86/include/asm/msr.h +4 -2
@@ -144,10 +144,12 @@ static inline u64 native_read_msr_safe(u32 msr, int *err) static inline void notracenative_write_msr (u32 msr,u32 low,u32 high) { -__wrmsr (msr, low, high); +u64 val = (u64 )high <<32 | low; + +native_wrmsrq (msr, val);if (tracepoint_enabled (write_msr)) -do_trace_write_msr (msr, ((u64 )high <<32 | low),0 ); +do_trace_write_msr (msr, val,0 ); }/* Can be uninlined because referenced by paravirt */
arch/x86/kernel/cpu/mce/core.c +1 -1
@@ -1306,7 +1306,7 @@ static noinstr bool mce_check_crashing_cpu(void) }if (mcgstatus &MCG_STATUS_RIPV ) { -__wrmsr (MSR_IA32_MCG_STATUS ,0 ,0 ); +native_wrmsrq (MSR_IA32_MCG_STATUS ,0 );return true; } }
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +3 -3
@@ -483,7 +483,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* cache. */ saved_msr =__rdmsr (MSR_MISC_FEATURE_CONTROL ); -__wrmsr (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits,0x0 ); +native_wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits); closid_p =this_cpu_read (pqr_state.cur_closid); rmid_p =this_cpu_read (pqr_state.cur_rmid); mem_r = plr->kmem;
@@ -495,7 +495,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* pseudo-locked followed by reading of kernel memory to load it * into the cache. */ -__wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, plr->closid); +native_wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, plr->closid);/* * Cache was flushed earlier. Now access kernel memory to read it
@@ -532,7 +532,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* Critical section end: restore closid with capacity bitmask that * does not overlap with pseudo-locked region. */ -__wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, closid_p); +native_wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, closid_p);/* Re-enable the hardware prefetcher(s) */ wrmsrq (MSR_MISC_FEATURE_CONTROL , saved_msr);
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Convert __wrmsr() uses to native_wrmsr{,q}() uses
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 519be7da37b955164c59aacaee6d6ac89f4bbe15 Gitweb: https://git.kernel.org/tip/519be7da37b955164c59aacaee6d6ac89f4bbe15 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:19 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:27:49 +02:00
x86/msr: Convert __wrmsr() uses to native_wrmsr{,q}() uses
__wrmsr() is the lowest level MSR write API, with native_wrmsr() and native_wrmsrq() serving as higher-level wrappers around it:
#define native_wrmsr(msr, low, high) \
__wrmsr(msr, low, high)
#define native_wrmsrl(msr, val) \
__wrmsr((msr), (u32)((u64)(val)), \
(u32)((u64)(val) >> 32))However, __wrmsr() continues to be utilized in various locations.
MSR APIs are designed for different scenarios, such as native or pvops, with or without trace, and safe or non-safe. Unfortunately, the current MSR API names do not adequately reflect these factors, making it challenging to select the most appropriate API for various situations.
To pave the way for improving MSR API names, convert __wrmsr() uses to native_wrmsr{,q}() to ensure consistent usage. Later, these APIs can be renamed to better reflect their implications, such as native or pvops, with or without trace, and safe or non-safe.
No functional change intended.
--- arch/x86/events/amd/brs.c | 2 +- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/msr.h | 6 ++++-- arch/x86/kernel/cpu/mce/core.c | 2 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 6 +++--- 5 files changed, 10 insertions(+), 8 deletions(-)
arch/x86/events/amd/brs.c +1 -1
@@ -44,7 +44,7 @@ static inline unsigned int brs_to(int idx) static __always_inline void set_debug_extn_cfg(u64 val) {/* bits[4:3] must always be set to 11b */ -__wrmsr (MSR_AMD_DBG_EXTN_CFG , val |3ULL <<3 , val >>32 ); +native_wrmsrq (MSR_AMD_DBG_EXTN_CFG , val |3ULL <<3 ); } static __always_inline u64 get_debug_extn_cfg(void)
arch/x86/include/asm/apic.h +1 -1
@@ -214,7 +214,7 @@ static inline void native_apic_msr_write(u32 reg, u32 v)static inline void native_apic_msr_eoi (void ) { -__wrmsr (APIC_BASE_MSR + (APIC_EOI >>4 ),APIC_EOI_ACK ,0 ); +native_wrmsrq (APIC_BASE_MSR + (APIC_EOI >>4 ),APIC_EOI_ACK ); }static inline u32 native_apic_msr_read (u32 reg)
arch/x86/include/asm/msr.h +4 -2
@@ -127,10 +127,12 @@ static inline u64 native_read_msr_safe(u32 msr, int *err) static inline void notracenative_write_msr (u32 msr,u32 low,u32 high) { -__wrmsr (msr, low, high); +u64 val = (u64 )high <<32 | low; + +native_wrmsrq (msr, val);if (tracepoint_enabled (write_msr)) -do_trace_write_msr (msr, ((u64 )high <<32 | low),0 ); +do_trace_write_msr (msr, val,0 ); }/* Can be uninlined because referenced by paravirt */
arch/x86/kernel/cpu/mce/core.c +1 -1
@@ -1306,7 +1306,7 @@ static noinstr bool mce_check_crashing_cpu(void) }if (mcgstatus &MCG_STATUS_RIPV ) { -__wrmsr (MSR_IA32_MCG_STATUS ,0 ,0 ); +native_wrmsrq (MSR_IA32_MCG_STATUS ,0 );return true; } }
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +3 -3
@@ -483,7 +483,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* cache. */ saved_msr =__rdmsr (MSR_MISC_FEATURE_CONTROL ); -__wrmsr (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits,0x0 ); +native_wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits); closid_p =this_cpu_read (pqr_state.cur_closid); rmid_p =this_cpu_read (pqr_state.cur_rmid); mem_r = plr->kmem;
@@ -495,7 +495,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* pseudo-locked followed by reading of kernel memory to load it * into the cache. */ -__wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, plr->closid); +native_wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, plr->closid);/* * Cache was flushed earlier. Now access kernel memory to read it
@@ -532,7 +532,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* Critical section end: restore closid with capacity bitmask that * does not overlap with pseudo-locked region. */ -__wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, closid_p); +native_wrmsr (MSR_IA32_PQR_ASSOC , rmid_p, closid_p);/* Re-enable the hardware prefetcher(s) */ wrmsrq (MSR_MISC_FEATURE_CONTROL , saved_msr);
Xin Li (Intel)
maintainerPATCH v4 8/15 x86/msr: Add the native_rdmsrq() helper
In reply to Xin Li (Intel)__rdmsr() is the lowest-level primitive MSR read API, implemented in assembly code and returning an MSR value in a u64 integer, on top of which a convenience wrapper native_rdmsr() is defined to return an MSR value in two u32 integers. For some reason, native_rdmsrq() is not defined and __rdmsr() is directly used when it needs to return an MSR value in a u64 integer.
Add the native_rdmsrq() helper, which is simply an alias of __rdmsr(), to make native_rdmsr() and native_rdmsrq() a pair of MSR read APIs.
---
Change in v2:
* Split into two changes and add the native_rdmsrl() helper in the first one with a proper explanation (Ingo).
--- arch/x86/include/asm/msr.h | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/include/asm/msr.h +5 -0
@@ -107,6 +107,11 @@ do { \ (void )((val2) = (u32)(__val >>32 )); \ }while (0 ) +static __always_inline u64 native_rdmsrq(u32 msr) +{ +return __rdmsr (msr); +} +#define native_wrmsr (msr, low, high) \ __wrmsr(msr, low, high)
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Add the native_rdmsrq() helper
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: ed56a309f7e1b05c15702ea1275172d507a606f4 Gitweb: https://git.kernel.org/tip/ed56a309f7e1b05c15702ea1275172d507a606f4 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:20 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:35 +02:00
x86/msr: Add the native_rdmsrq() helper
__rdmsr() is the lowest-level primitive MSR read API, implemented in assembly code and returning an MSR value in a u64 integer, on top of which a convenience wrapper native_rdmsr() is defined to return an MSR value in two u32 integers. For some reason, native_rdmsrq() is not defined and __rdmsr() is directly used when it needs to return an MSR value in a u64 integer.
Add the native_rdmsrq() helper, which is simply an alias of __rdmsr(), to make native_rdmsr() and native_rdmsrq() a pair of MSR read APIs.
--- arch/x86/include/asm/msr.h | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/include/asm/msr.h +5 -0
@@ -90,6 +90,11 @@ do { \ (void )((val2) = (u32)(__val >>32 )); \ }while (0 ) +static __always_inline u64 native_rdmsrq(u32 msr) +{ +return __rdmsr (msr); +} +#define native_wrmsr (msr, low, high) \ __wrmsr(msr, low, high)
Xin Li (Intel)
maintainerPATCH v4 9/15 x86/msr: Convert __rdmsr() uses to native_rdmsrq() uses
In reply to Xin Li (Intel)__rdmsr() is the lowest level MSR write API, with native_rdmsr() and native_rdmsrq() serving as higher-level wrappers around it.
#define native_rdmsr(msr, val1, val2) \
do { \
u64 __val = __rdmsr((msr)); \
(void)((val1) = (u32)__val); \
(void)((val2) = (u32)(__val >> 32)); \} while (0)
static __always_inline u64 native_rdmsrq(u32 msr)
{
return __rdmsr(msr);
}However, __rdmsr() continues to be utilized in various locations.
MSR APIs are designed for different scenarios, such as native or pvops, with or without trace, and safe or non-safe. Unfortunately, the current MSR API names do not adequately reflect these factors, making it challenging to select the most appropriate API for various situations.
To pave the way for improving MSR API names, convert __rdmsr() uses to native_rdmsrq() to ensure consistent usage. Later, these APIs can be renamed to better reflect their implications, such as native or pvops, with or without trace, and safe or non-safe.
No functional change intended.
--- arch/x86/coco/sev/core.c | 2 +- arch/x86/events/amd/brs.c | 2 +- arch/x86/hyperv/hv_vtl.c | 4 ++-- arch/x86/hyperv/ivm.c | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/mce/core.c | 4 ++-- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 2 +- arch/x86/kvm/vmx/vmx.c | 4 ++-- arch/x86/mm/mem_encrypt_identity.c | 4 ++-- 10 files changed, 14 insertions(+), 14 deletions(-)
arch/x86/coco/sev/core.c +1 -1
@@ -276,7 +276,7 @@ static noinstr struct ghcb *__sev_get_ghcb(struct ghcb_state *state)static inline u64 sev_es_rd_ghcb_msr (void ) { -return __rdmsr (MSR_AMD64_SEV_ES_GHCB ); +return native_rdmsrq (MSR_AMD64_SEV_ES_GHCB ); } static __always_inline void sev_es_wr_ghcb_msr(u64 val)
arch/x86/events/amd/brs.c +1 -1
@@ -49,7 +49,7 @@ static __always_inline void set_debug_extn_cfg(u64 val) static __always_inline u64 get_debug_extn_cfg(void) { -return __rdmsr (MSR_AMD_DBG_EXTN_CFG ); +return native_rdmsrq (MSR_AMD_DBG_EXTN_CFG ); }static bool __init amd_brs_detect (void )
arch/x86/hyperv/hv_vtl.c +2 -2
@@ -149,11 +149,11 @@ static int hv_vtl_bringup_vcpu(u32 target_vp_index, int cpu, u64 eip_ignored) input->vp_context.rip = rip; input->vp_context.rsp = rsp; input->vp_context.rflags =0x0000000000000002 ; - input->vp_context.efer =__rdmsr (MSR_EFER ); + input->vp_context.efer =native_rdmsrq (MSR_EFER ); input->vp_context.cr0 =native_read_cr0 (); input->vp_context.cr3 =__native_read_cr3 (); input->vp_context.cr4 =native_read_cr4 (); - input->vp_context.msr_cr_pat =__rdmsr (MSR_IA32_CR_PAT ); + input->vp_context.msr_cr_pat =native_rdmsrq (MSR_IA32_CR_PAT ); input->vp_context.idtr.limit = idt_ptr.size; input->vp_context.idtr.base = idt_ptr.address; input->vp_context.gdtr.limit = gdt_ptr.size;
arch/x86/hyperv/ivm.c +1 -1
@@ -111,7 +111,7 @@ u64 hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_size)static inline u64 rd_ghcb_msr (void ) { -return __rdmsr (MSR_AMD64_SEV_ES_GHCB ); +return native_rdmsrq (MSR_AMD64_SEV_ES_GHCB ); }static inline void wr_ghcb_msr (u64 val)
arch/x86/include/asm/mshyperv.h +1 -1
@@ -305,7 +305,7 @@ void hv_set_non_nested_msr(unsigned int reg, u64 value); static __always_inline u64 hv_raw_get_msr(unsigned int reg) { -return __rdmsr (reg); +return native_rdmsrq (reg); }#else /* CONFIG_HYPERV */
arch/x86/kernel/cpu/common.c +1 -1
@@ -164,7 +164,7 @@ static void ppin_init(struct cpuinfo_x86 *c)/* Is the enable bit set? */ if (val &2UL ) { - c->ppin =__rdmsr (info->msr_ppin); + c->ppin =native_rdmsrq (info->msr_ppin);set_cpu_cap (c, info->feature);return ; }
arch/x86/kernel/cpu/mce/core.c +2 -2
@@ -121,7 +121,7 @@ void mce_prep_record_common(struct mce *m) { m->cpuid =cpuid_eax (1 ); m->cpuvendor = boot_cpu_data.x86_vendor; - m->mcgcap =__rdmsr (MSR_IA32_MCG_CAP ); + m->mcgcap =native_rdmsrq (MSR_IA32_MCG_CAP );/* need the internal __ version to avoid deadlocks */ m->time =__ktime_get_real_seconds (); }
@@ -1298,7 +1298,7 @@ static noinstr bool mce_check_crashing_cpu(void) (crashing_cpu != -1 && crashing_cpu != cpu)) {u64 mcgstatus; - mcgstatus =__rdmsr (MSR_IA32_MCG_STATUS ); + mcgstatus =native_rdmsrq (MSR_IA32_MCG_STATUS );if (boot_cpu_data.x86_vendor ==X86_VENDOR_ZHAOXIN ) {if (mcgstatus &MCG_STATUS_LMCES )
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +1 -1
@@ -482,7 +482,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* the buffer and evict pseudo-locked memory read earlier from the * cache. */ - saved_msr =__rdmsr (MSR_MISC_FEATURE_CONTROL ); + saved_msr =native_rdmsrq (MSR_MISC_FEATURE_CONTROL );native_wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits); closid_p =this_cpu_read (pqr_state.cur_closid); rmid_p =this_cpu_read (pqr_state.cur_rmid);
arch/x86/kvm/vmx/vmx.c +2 -2
@@ -380,7 +380,7 @@ static __always_inline void vmx_disable_fb_clear(struct vcpu_vmx *vmx)if (!vmx->disable_fb_clear)return ; - msr =__rdmsr (MSR_IA32_MCU_OPT_CTRL ); + msr =native_rdmsrq (MSR_IA32_MCU_OPT_CTRL ); msr |=FB_CLEAR_DIS ;native_wrmsrq (MSR_IA32_MCU_OPT_CTRL , msr);/* Cache the MSR value to avoid reading it later */
@@ -7307,7 +7307,7 @@ void noinstr vmx_spec_ctrl_restore_host(struct vcpu_vmx *vmx,return ;if (flags &VMX_RUN_SAVE_SPEC_CTRL ) - vmx->spec_ctrl =__rdmsr (MSR_IA32_SPEC_CTRL ); + vmx->spec_ctrl =native_rdmsrq (MSR_IA32_SPEC_CTRL );/* * If the guest/host SPEC_CTRL values differ, restore the host value.
arch/x86/mm/mem_encrypt_identity.c +2 -2
@@ -527,7 +527,7 @@ void __head sme_enable(struct boot_params *bp) me_mask =1UL << (ebx &0x3f );/* Check the SEV MSR whether SEV or SME is enabled */ -RIP_REL_REF (sev_status) = msr =__rdmsr (MSR_AMD64_SEV ); +RIP_REL_REF (sev_status) = msr =native_rdmsrq (MSR_AMD64_SEV ); feature_mask = (msr &MSR_AMD64_SEV_ENABLED ) ?AMD_SEV_BIT :AMD_SME_BIT ;/*
@@ -558,7 +558,7 @@ void __head sme_enable(struct boot_params *bp)return ;/* For SME, check the SYSCFG MSR */ - msr =__rdmsr (MSR_AMD64_SYSCFG ); + msr =native_rdmsrq (MSR_AMD64_SYSCFG );if (!(msr &MSR_AMD64_SYSCFG_MEM_ENCRYPT ))return ; }
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Convert __rdmsr() uses to native_rdmsrq() uses
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 3204877d05ca17162270890e3f28552741a1b1a2 Gitweb: https://git.kernel.org/tip/3204877d05ca17162270890e3f28552741a1b1a2 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:21 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:35 +02:00
x86/msr: Convert __rdmsr() uses to native_rdmsrq() uses
__rdmsr() is the lowest level MSR write API, with native_rdmsr() and native_rdmsrq() serving as higher-level wrappers around it.
#define native_rdmsr(msr, val1, val2) \
do { \
u64 __val = __rdmsr((msr)); \
(void)((val1) = (u32)__val); \
(void)((val2) = (u32)(__val >> 32)); \} while (0)
static __always_inline u64 native_rdmsrq(u32 msr)
{
return __rdmsr(msr);
}However, __rdmsr() continues to be utilized in various locations.
MSR APIs are designed for different scenarios, such as native or pvops, with or without trace, and safe or non-safe. Unfortunately, the current MSR API names do not adequately reflect these factors, making it challenging to select the most appropriate API for various situations.
To pave the way for improving MSR API names, convert __rdmsr() uses to native_rdmsrq() to ensure consistent usage. Later, these APIs can be renamed to better reflect their implications, such as native or pvops, with or without trace, and safe or non-safe.
No functional change intended.
--- arch/x86/coco/sev/core.c | 2 +- arch/x86/events/amd/brs.c | 2 +- arch/x86/hyperv/hv_vtl.c | 4 ++-- arch/x86/hyperv/ivm.c | 2 +- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/mce/core.c | 4 ++-- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 2 +- arch/x86/kvm/vmx/vmx.c | 4 ++-- arch/x86/mm/mem_encrypt_identity.c | 4 ++-- 10 files changed, 14 insertions(+), 14 deletions(-)
arch/x86/coco/sev/core.c +1 -1
@@ -277,7 +277,7 @@ static noinstr struct ghcb *__sev_get_ghcb(struct ghcb_state *state)static inline u64 sev_es_rd_ghcb_msr (void ) { -return __rdmsr (MSR_AMD64_SEV_ES_GHCB ); +return native_rdmsrq (MSR_AMD64_SEV_ES_GHCB ); } static __always_inline void sev_es_wr_ghcb_msr(u64 val)
arch/x86/events/amd/brs.c +1 -1
@@ -49,7 +49,7 @@ static __always_inline void set_debug_extn_cfg(u64 val) static __always_inline u64 get_debug_extn_cfg(void) { -return __rdmsr (MSR_AMD_DBG_EXTN_CFG ); +return native_rdmsrq (MSR_AMD_DBG_EXTN_CFG ); }static bool __init amd_brs_detect (void )
arch/x86/hyperv/hv_vtl.c +2 -2
@@ -150,11 +150,11 @@ static int hv_vtl_bringup_vcpu(u32 target_vp_index, int cpu, u64 eip_ignored) input->vp_context.rip = rip; input->vp_context.rsp = rsp; input->vp_context.rflags =0x0000000000000002 ; - input->vp_context.efer =__rdmsr (MSR_EFER ); + input->vp_context.efer =native_rdmsrq (MSR_EFER ); input->vp_context.cr0 =native_read_cr0 (); input->vp_context.cr3 =__native_read_cr3 (); input->vp_context.cr4 =native_read_cr4 (); - input->vp_context.msr_cr_pat =__rdmsr (MSR_IA32_CR_PAT ); + input->vp_context.msr_cr_pat =native_rdmsrq (MSR_IA32_CR_PAT ); input->vp_context.idtr.limit = idt_ptr.size; input->vp_context.idtr.base = idt_ptr.address; input->vp_context.gdtr.limit = gdt_ptr.size;
arch/x86/hyperv/ivm.c +1 -1
@@ -111,7 +111,7 @@ u64 hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_size)static inline u64 rd_ghcb_msr (void ) { -return __rdmsr (MSR_AMD64_SEV_ES_GHCB ); +return native_rdmsrq (MSR_AMD64_SEV_ES_GHCB ); }static inline void wr_ghcb_msr (u64 val)
arch/x86/include/asm/mshyperv.h +1 -1
@@ -305,7 +305,7 @@ void hv_set_non_nested_msr(unsigned int reg, u64 value); static __always_inline u64 hv_raw_get_msr(unsigned int reg) { -return __rdmsr (reg); +return native_rdmsrq (reg); }#else /* CONFIG_HYPERV */
arch/x86/kernel/cpu/common.c +1 -1
@@ -164,7 +164,7 @@ static void ppin_init(struct cpuinfo_x86 *c)/* Is the enable bit set? */ if (val &2UL ) { - c->ppin =__rdmsr (info->msr_ppin); + c->ppin =native_rdmsrq (info->msr_ppin);set_cpu_cap (c, info->feature);return ; }
arch/x86/kernel/cpu/mce/core.c +2 -2
@@ -121,7 +121,7 @@ void mce_prep_record_common(struct mce *m) { m->cpuid =cpuid_eax (1 ); m->cpuvendor = boot_cpu_data.x86_vendor; - m->mcgcap =__rdmsr (MSR_IA32_MCG_CAP ); + m->mcgcap =native_rdmsrq (MSR_IA32_MCG_CAP );/* need the internal __ version to avoid deadlocks */ m->time =__ktime_get_real_seconds (); }
@@ -1298,7 +1298,7 @@ static noinstr bool mce_check_crashing_cpu(void) (crashing_cpu != -1 && crashing_cpu != cpu)) {u64 mcgstatus; - mcgstatus =__rdmsr (MSR_IA32_MCG_STATUS ); + mcgstatus =native_rdmsrq (MSR_IA32_MCG_STATUS );if (boot_cpu_data.x86_vendor ==X86_VENDOR_ZHAOXIN ) {if (mcgstatus &MCG_STATUS_LMCES )
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +1 -1
@@ -482,7 +482,7 @@ int resctrl_arch_pseudo_lock_fn(void *_plr)* the buffer and evict pseudo-locked memory read earlier from the * cache. */ - saved_msr =__rdmsr (MSR_MISC_FEATURE_CONTROL ); + saved_msr =native_rdmsrq (MSR_MISC_FEATURE_CONTROL );native_wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits); closid_p =this_cpu_read (pqr_state.cur_closid); rmid_p =this_cpu_read (pqr_state.cur_rmid);
arch/x86/kvm/vmx/vmx.c +2 -2
@@ -381,7 +381,7 @@ static __always_inline void vmx_disable_fb_clear(struct vcpu_vmx *vmx)if (!vmx->disable_fb_clear)return ; - msr =__rdmsr (MSR_IA32_MCU_OPT_CTRL ); + msr =native_rdmsrq (MSR_IA32_MCU_OPT_CTRL ); msr |=FB_CLEAR_DIS ;native_wrmsrq (MSR_IA32_MCU_OPT_CTRL , msr);/* Cache the MSR value to avoid reading it later */
@@ -7308,7 +7308,7 @@ void noinstr vmx_spec_ctrl_restore_host(struct vcpu_vmx *vmx,return ;if (flags &VMX_RUN_SAVE_SPEC_CTRL ) - vmx->spec_ctrl =__rdmsr (MSR_IA32_SPEC_CTRL ); + vmx->spec_ctrl =native_rdmsrq (MSR_IA32_SPEC_CTRL );/* * If the guest/host SPEC_CTRL values differ, restore the host value.
arch/x86/mm/mem_encrypt_identity.c +2 -2
@@ -526,7 +526,7 @@ void __head sme_enable(struct boot_params *bp) me_mask =1UL << (ebx &0x3f );/* Check the SEV MSR whether SEV or SME is enabled */ -RIP_REL_REF (sev_status) = msr =__rdmsr (MSR_AMD64_SEV ); +RIP_REL_REF (sev_status) = msr =native_rdmsrq (MSR_AMD64_SEV ); feature_mask = (msr &MSR_AMD64_SEV_ENABLED ) ?AMD_SEV_BIT :AMD_SME_BIT ;/*
@@ -557,7 +557,7 @@ void __head sme_enable(struct boot_params *bp)return ;/* For SME, check the SYSCFG MSR */ - msr =__rdmsr (MSR_AMD64_SYSCFG ); + msr =native_rdmsrq (MSR_AMD64_SYSCFG );if (!(msr &MSR_AMD64_SYSCFG_MEM_ENCRYPT ))return ; }
Xin Li (Intel)
maintainerPATCH v4 10/15 x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() in pmu_msr_{read,write}()
In reply to Xin Li (Intel)hpa found that pmu_msr_write() is actually a completely pointless function [1]: all it does is shuffle some arguments, then calls pmu_msr_chk_emulated() and if it returns true AND the emulated flag is clear then does *exactly the same thing* that the calling code would have done if pmu_msr_write() itself had returned true. And pmu_msr_read() does the equivalent stupidity.
Remove the calls to native_{read,write}_msr{,_safe}() within pmu_msr_{read,write}(). Instead reuse the existing calling code that decides whether to call native_{read,write}_msr{,_safe}() based on the return value from pmu_msr_{read,write}(). Consequently, eliminate the need to pass an error pointer to pmu_msr_{read,write}().
While at it, refactor pmu_msr_write() to take the MSR value as a u64 argument, replacing the current dual u32 arguments, because the dual u32 arguments were only used to call native_write_msr{,_safe}(), which has now been removed.
[1]: https://lore.kernel.org/lkml/[email protected]/
---
Change in v3:
*) Rename pmu_msr_{read,write}() to pmu_msr_{read,write}_emulated()
(Dapeng Mi).
*) Fix a pmu_msr_read() callsite with wrong arguments (Dapeng Mi).
--- arch/x86/xen/enlighten_pv.c | 8 ++++++-- arch/x86/xen/pmu.c | 27 ++++----------------------- arch/x86/xen/xen-ops.h | 4 ++-- 3 files changed, 12 insertions(+), 27 deletions(-)
arch/x86/xen/enlighten_pv.c +6 -2
@@ -1090,7 +1090,7 @@ static u64 xen_do_read_msr(unsigned int msr, int *err) {u64 val =0 ;/* Avoid uninitialized value for safe variant. */ -if (pmu_msr_read (msr, &val, err)) +if (pmu_msr_read_emulated (msr, &val))return val;if (err)
@@ -1132,6 +1132,8 @@ static void set_seg(unsigned int which, unsigned int low, unsigned int high,static void xen_do_write_msr (unsigned int msr,unsigned int low,unsigned int high,int *err) { +u64 val; +switch (msr) {case MSR_FS_BASE :set_seg (SEGBASE_FS , low, high, err);
@@ -1158,7 +1160,9 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,break ;default : -if (!pmu_msr_write (msr, low, high, err)) { + val = (u64 )high <<32 | low; + +if (!pmu_msr_write_emulated (msr, val)) {if (err) *err =native_write_msr_safe (msr, low, high);else
arch/x86/xen/pmu.c +4 -23
@@ -313,37 +313,18 @@ static bool pmu_msr_chk_emulated(unsigned int msr, uint64_t *val, bool is_read,return true; } -bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err) +bool pmu_msr_read_emulated (u32 msr,u64 *val) {bool emulated; -if (!pmu_msr_chk_emulated (msr, val, true, &emulated)) -return false; - -if (!emulated) { - *val = err ?native_read_msr_safe (msr, err) - :native_read_msr (msr); - } - -return true; +return pmu_msr_chk_emulated (msr, val, true, &emulated) && emulated; } -bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err) +bool pmu_msr_write_emulated (u32 msr,u64 val) { -uint64_t val = ((uint64_t )high <<32 ) | low;bool emulated; -if (!pmu_msr_chk_emulated (msr, &val, false, &emulated)) -return false; - -if (!emulated) { -if (err) - *err =native_write_msr_safe (msr, low, high); -else -native_write_msr (msr, low, high); - } - -return true; +return pmu_msr_chk_emulated (msr, &val, false, &emulated) && emulated; }static u64 xen_amd_read_pmc (int counter)
arch/x86/xen/xen-ops.h +2 -2
@@ -274,8 +274,8 @@ void xen_pmu_finish(int cpu);static inline void xen_pmu_init (int cpu) {}static inline void xen_pmu_finish (int cpu) {}#endif -bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err); -bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err); +bool pmu_msr_read_emulated (u32 msr,u64 *val); +bool pmu_msr_write_emulated (u32 msr,u64 val);int pmu_apic_update (uint32_t reg);u64 xen_read_pmc (int counter);
Signature · 1 line
2.49.0
Re: [PATCH v4 10/15] x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() in pmu_msr_{read,write}()
Quoted 18 lines · Xin Li (Intel)
hpa found that
pmu_msr_write()is actually a completely pointless function [1]: all it does is shuffle some arguments, then callspmu_msr_chk_emulated()and if it returns true AND the emulated flag is clear then does *exactly the same thing* that the calling code would have done ifpmu_msr_write()itself had returned true. Andpmu_msr_read()does the equivalent stupidity.Remove the calls to native_{read,write}_msr{,_safe}() within pmu_msr_{read,write}(). Instead reuse the existing calling code that decides whether to call native_{read,write}_msr{,_safe}() based on the return value from pmu_msr_{read,write}(). Consequently, eliminate the need to pass an error pointer to pmu_msr_{read,write}().
While at it, refactor
pmu_msr_write()to take the MSR value as a u64 argument, replacing the current dual u32 arguments, because the dual u32 arguments were only used to call native_write_msr{,_safe}(), which has now been removed.
Quoted 4 lines
[1]: https://lore.kernel.org/lkml/[email protected]/
Suggested-by H. Peter Anvin (Intel) <[email protected]>Sign-off-by Xin Li (Intel) <[email protected]>
'Sign-off-by' is not a proper SOB tag, I've changed it to Signed-off-by.
Thanks,
Ingo
[tip: x86/merge] x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() in pmu_msr_{read,write}()
In reply to Xin Li (Intel)The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 0cb6f4128a7d8dca9c9bb45f9ecbddcd5cf377aa Gitweb: https://git.kernel.org/tip/0cb6f4128a7d8dca9c9bb45f9ecbddcd5cf377aa Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:22 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:35 +02:00
x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() in pmu_msr_{read,write}()
hpa found that pmu_msr_write() is actually a completely pointless function:
https://lore.kernel.org/lkml/[email protected]/
all it does is shuffle some arguments, then calls pmu_msr_chk_emulated() and if it returns true AND the emulated flag is clear then does *exactly the same thing* that the calling code would have done if pmu_msr_write() itself had returned true.
And pmu_msr_read() does the equivalent stupidity.
Remove the calls to native_{read,write}_msr{,_safe}() within pmu_msr_{read,write}(). Instead reuse the existing calling code that decides whether to call native_{read,write}_msr{,_safe}() based on the return value from pmu_msr_{read,write}(). Consequently, eliminate the need to pass an error pointer to pmu_msr_{read,write}().
While at it, refactor pmu_msr_write() to take the MSR value as a u64 argument, replacing the current dual u32 arguments, because the dual u32 arguments were only used to call native_write_msr{,_safe}(), which has now been removed.
--- arch/x86/xen/enlighten_pv.c | 8 ++++++-- arch/x86/xen/pmu.c | 27 ++++----------------------- arch/x86/xen/xen-ops.h | 4 ++-- 3 files changed, 12 insertions(+), 27 deletions(-)
arch/x86/xen/enlighten_pv.c +6 -2
@@ -1091,7 +1091,7 @@ static u64 xen_do_read_msr(unsigned int msr, int *err) {u64 val =0 ;/* Avoid uninitialized value for safe variant. */ -if (pmu_msr_read (msr, &val, err)) +if (pmu_msr_read_emulated (msr, &val))return val;if (err)
@@ -1133,6 +1133,8 @@ static void set_seg(unsigned int which, unsigned int low, unsigned int high,static void xen_do_write_msr (unsigned int msr,unsigned int low,unsigned int high,int *err) { +u64 val; +switch (msr) {case MSR_FS_BASE :set_seg (SEGBASE_FS , low, high, err);
@@ -1159,7 +1161,9 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,break ;default : -if (!pmu_msr_write (msr, low, high, err)) { + val = (u64 )high <<32 | low; + +if (!pmu_msr_write_emulated (msr, val)) {if (err) *err =native_write_msr_safe (msr, low, high);else
arch/x86/xen/pmu.c +4 -23
@@ -314,37 +314,18 @@ static bool pmu_msr_chk_emulated(unsigned int msr, uint64_t *val, bool is_read,return true; } -bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err) +bool pmu_msr_read_emulated (u32 msr,u64 *val) {bool emulated; -if (!pmu_msr_chk_emulated (msr, val, true, &emulated)) -return false; - -if (!emulated) { - *val = err ?native_read_msr_safe (msr, err) - :native_read_msr (msr); - } - -return true; +return pmu_msr_chk_emulated (msr, val, true, &emulated) && emulated; } -bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err) +bool pmu_msr_write_emulated (u32 msr,u64 val) { -uint64_t val = ((uint64_t )high <<32 ) | low;bool emulated; -if (!pmu_msr_chk_emulated (msr, &val, false, &emulated)) -return false; - -if (!emulated) { -if (err) - *err =native_write_msr_safe (msr, low, high); -else -native_write_msr (msr, low, high); - } - -return true; +return pmu_msr_chk_emulated (msr, &val, false, &emulated) && emulated; }static u64 xen_amd_read_pmc (int counter)
arch/x86/xen/xen-ops.h +2 -2
@@ -271,8 +271,8 @@ void xen_pmu_finish(int cpu);static inline void xen_pmu_init (int cpu) {}static inline void xen_pmu_finish (int cpu) {}#endif -bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err); -bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err); +bool pmu_msr_read_emulated (u32 msr,u64 *val); +bool pmu_msr_write_emulated (u32 msr,u64 val);int pmu_apic_update (uint32_t reg);u64 xen_read_pmc (int counter);
Xin Li (Intel)
maintainerPATCH v4 11/15 x86/xen/msr: Remove pmu_msr_{read,write}()
In reply to Xin Li (Intel)As pmu_msr_{read,write}() are now wrappers of pmu_msr_chk_emulated(), remove them and use pmu_msr_chk_emulated() directly.
As pmu_msr_chk_emulated() could easily return false in the cases where it would set *emul to false, remove the "emul" argument and use the return value instead.
While at it, convert the data type of MSR index to u32 in functions called in pmu_msr_chk_emulated().
---
Change in v4:
*) Remove two "else" that no longer make sense (Juergen Gross).
Change in v3:
*) Remove the "emul" argument of pmu_msr_chk_emulated() (Juergen Gross).
--- arch/x86/xen/enlighten_pv.c | 15 ++++++++------- arch/x86/xen/pmu.c | 33 ++++++++------------------------- arch/x86/xen/xen-ops.h | 3 +-- 3 files changed, 17 insertions(+), 34 deletions(-)
arch/x86/xen/enlighten_pv.c +8 -7
@@ -1090,7 +1090,7 @@ static u64 xen_do_read_msr(unsigned int msr, int *err) {u64 val =0 ;/* Avoid uninitialized value for safe variant. */ -if (pmu_msr_read_emulated (msr, &val)) +if (pmu_msr_chk_emulated (msr, &val, true))return val;if (err)
@@ -1162,12 +1162,13 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,default : val = (u64 )high <<32 | low; -if (!pmu_msr_write_emulated (msr, val)) { -if (err) - *err =native_write_msr_safe (msr, low, high); -else -native_write_msr (msr, low, high); - } +if (pmu_msr_chk_emulated (msr, &val, false)) +return ; + +if (err) + *err =native_write_msr_safe (msr, low, high); +else +native_write_msr (msr, low, high); } }
arch/x86/xen/pmu.c +8 -25
@@ -128,7 +128,7 @@ static inline uint32_t get_fam15h_addr(u32 addr)return addr; } -static inline bool is_amd_pmu_msr (unsigned int msr) +static bool is_amd_pmu_msr (u32 msr) {if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD && boot_cpu_data.x86_vendor !=X86_VENDOR_HYGON )
@@ -194,8 +194,7 @@ static bool is_intel_pmu_msr(u32 msr_index, int *type, int *index) } } -static bool xen_intel_pmu_emulate (unsigned int msr,u64 *val,int type, -int index,bool is_read) +static bool xen_intel_pmu_emulate (u32 msr,u64 *val,int type,int index,bool is_read) {uint64_t *reg =NULL ;struct xen_pmu_intel_ctxt *ctxt;
@@ -257,7 +256,7 @@ static bool xen_intel_pmu_emulate(unsigned int msr, u64 *val, int type,return false; } -static bool xen_amd_pmu_emulate (unsigned int msr,u64 *val,bool is_read) +static bool xen_amd_pmu_emulate (u32 msr,u64 *val,bool is_read) {uint64_t *reg =NULL ;int i, off =0 ;
@@ -298,33 +297,17 @@ static bool xen_amd_pmu_emulate(unsigned int msr, u64 *val, bool is_read)return false; } -static bool pmu_msr_chk_emulated (unsigned int msr,uint64_t *val,bool is_read, -bool *emul) +bool pmu_msr_chk_emulated (u32 msr,u64 *val,bool is_read) {int type, index =0 ;if (is_amd_pmu_msr (msr)) - *emul =xen_amd_pmu_emulate (msr, val, is_read); -else if (is_intel_pmu_msr (msr, &type, &index)) - *emul =xen_intel_pmu_emulate (msr, val, type, index, is_read); -else -return false; - -return true; -} - -bool pmu_msr_read_emulated (u32 msr,u64 *val) -{ -bool emulated; +return xen_amd_pmu_emulate (msr, val, is_read); -return pmu_msr_chk_emulated (msr, val, true, &emulated) && emulated; -} +if (is_intel_pmu_msr (msr, &type, &index)) +return xen_intel_pmu_emulate (msr, val, type, index, is_read); -bool pmu_msr_write_emulated (u32 msr,u64 val) -{ -bool emulated; - -return pmu_msr_chk_emulated (msr, &val, false, &emulated) && emulated; +return false; }static u64 xen_amd_read_pmc (int counter)
arch/x86/xen/xen-ops.h +1 -2
@@ -274,8 +274,7 @@ void xen_pmu_finish(int cpu);static inline void xen_pmu_init (int cpu) {}static inline void xen_pmu_finish (int cpu) {}#endif -bool pmu_msr_read_emulated (u32 msr,u64 *val); -bool pmu_msr_write_emulated (u32 msr,u64 val); +bool pmu_msr_chk_emulated (u32 msr,u64 *val,bool is_read);int pmu_apic_update (uint32_t reg);u64 xen_read_pmc (int counter);
Signature · 1 line
2.49.0
[tip: x86/merge] x86/xen/msr: Remove pmu_msr_{read,write}()
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: f7998621db691b6fad4d84ad7d8ecc1a0a9b703f Gitweb: https://git.kernel.org/tip/f7998621db691b6fad4d84ad7d8ecc1a0a9b703f Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:23 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:35 +02:00
x86/xen/msr: Remove pmu_msr_{read,write}()
As pmu_msr_{read,write}() are now wrappers of pmu_msr_chk_emulated(), remove them and use pmu_msr_chk_emulated() directly.
As pmu_msr_chk_emulated() could easily return false in the cases where it would set *emul to false, remove the "emul" argument and use the return value instead.
While at it, convert the data type of MSR index to u32 in functions called in pmu_msr_chk_emulated().
--- arch/x86/xen/enlighten_pv.c | 15 ++++++++------- arch/x86/xen/pmu.c | 33 ++++++++------------------------- arch/x86/xen/xen-ops.h | 3 +-- 3 files changed, 17 insertions(+), 34 deletions(-)
arch/x86/xen/enlighten_pv.c +8 -7
@@ -1091,7 +1091,7 @@ static u64 xen_do_read_msr(unsigned int msr, int *err) {u64 val =0 ;/* Avoid uninitialized value for safe variant. */ -if (pmu_msr_read_emulated (msr, &val)) +if (pmu_msr_chk_emulated (msr, &val, true))return val;if (err)
@@ -1163,12 +1163,13 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,default : val = (u64 )high <<32 | low; -if (!pmu_msr_write_emulated (msr, val)) { -if (err) - *err =native_write_msr_safe (msr, low, high); -else -native_write_msr (msr, low, high); - } +if (pmu_msr_chk_emulated (msr, &val, false)) +return ; + +if (err) + *err =native_write_msr_safe (msr, low, high); +else +native_write_msr (msr, low, high); } }
arch/x86/xen/pmu.c +8 -25
@@ -129,7 +129,7 @@ static inline uint32_t get_fam15h_addr(u32 addr)return addr; } -static inline bool is_amd_pmu_msr (unsigned int msr) +static bool is_amd_pmu_msr (u32 msr) {if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD && boot_cpu_data.x86_vendor !=X86_VENDOR_HYGON )
@@ -195,8 +195,7 @@ static bool is_intel_pmu_msr(u32 msr_index, int *type, int *index) } } -static bool xen_intel_pmu_emulate (unsigned int msr,u64 *val,int type, -int index,bool is_read) +static bool xen_intel_pmu_emulate (u32 msr,u64 *val,int type,int index,bool is_read) {uint64_t *reg =NULL ;struct xen_pmu_intel_ctxt *ctxt;
@@ -258,7 +257,7 @@ static bool xen_intel_pmu_emulate(unsigned int msr, u64 *val, int type,return false; } -static bool xen_amd_pmu_emulate (unsigned int msr,u64 *val,bool is_read) +static bool xen_amd_pmu_emulate (u32 msr,u64 *val,bool is_read) {uint64_t *reg =NULL ;int i, off =0 ;
@@ -299,33 +298,17 @@ static bool xen_amd_pmu_emulate(unsigned int msr, u64 *val, bool is_read)return false; } -static bool pmu_msr_chk_emulated (unsigned int msr,uint64_t *val,bool is_read, -bool *emul) +bool pmu_msr_chk_emulated (u32 msr,u64 *val,bool is_read) {int type, index =0 ;if (is_amd_pmu_msr (msr)) - *emul =xen_amd_pmu_emulate (msr, val, is_read); -else if (is_intel_pmu_msr (msr, &type, &index)) - *emul =xen_intel_pmu_emulate (msr, val, type, index, is_read); -else -return false; - -return true; -} - -bool pmu_msr_read_emulated (u32 msr,u64 *val) -{ -bool emulated; +return xen_amd_pmu_emulate (msr, val, is_read); -return pmu_msr_chk_emulated (msr, val, true, &emulated) && emulated; -} +if (is_intel_pmu_msr (msr, &type, &index)) +return xen_intel_pmu_emulate (msr, val, type, index, is_read); -bool pmu_msr_write_emulated (u32 msr,u64 val) -{ -bool emulated; - -return pmu_msr_chk_emulated (msr, &val, false, &emulated) && emulated; +return false; }static u64 xen_amd_read_pmc (int counter)
arch/x86/xen/xen-ops.h +1 -2
@@ -271,8 +271,7 @@ void xen_pmu_finish(int cpu);static inline void xen_pmu_init (int cpu) {}static inline void xen_pmu_finish (int cpu) {}#endif -bool pmu_msr_read_emulated (u32 msr,u64 *val); -bool pmu_msr_write_emulated (u32 msr,u64 val); +bool pmu_msr_chk_emulated (u32 msr,u64 *val,bool is_read);int pmu_apic_update (uint32_t reg);u64 xen_read_pmc (int counter);
Xin Li (Intel)
maintainerPATCH v4 12/15 x86/xen/msr: Remove the error pointer argument from set_seg()
In reply to Xin Li (Intel)set_seg() is used to write the following MSRs on Xen:
MSR_FS_BASE
MSR_KERNEL_GS_BASE
MSR_GS_BASE
But none of these MSRs are written using any MSR write safe API. Therefore there is no need to pass an error pointer argument to set_seg() for returning an error code to be used in MSR safe APIs.
Remove the error pointer argument.
---
Change in v3:
*) Fix a typo: set_reg() => set_seg() (Juergen Gross).
--- arch/x86/xen/enlighten_pv.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
arch/x86/xen/enlighten_pv.c +5 -11
@@ -1110,17 +1110,11 @@ static u64 xen_do_read_msr(unsigned int msr, int *err)return val; } -static void set_seg (unsigned int which,unsigned int low,unsigned int high, -int *err) +static void set_seg (u32 which,u32 low,u32 high) {u64 base = ((u64 )high <<32 ) | low; -if (HYPERVISOR_set_segment_base (which, base) ==0 ) -return ; - -if (err) - *err = -EIO ; -else +if (HYPERVISOR_set_segment_base (which, base))WARN (1 ,"Xen set_segment_base(%u, %llx) failed\n" , which, base); }
@@ -1136,15 +1130,15 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,switch (msr) {case MSR_FS_BASE : -set_seg (SEGBASE_FS , low, high, err); +set_seg (SEGBASE_FS , low, high);break ;case MSR_KERNEL_GS_BASE : -set_seg (SEGBASE_GS_USER , low, high, err); +set_seg (SEGBASE_GS_USER , low, high);break ;case MSR_GS_BASE : -set_seg (SEGBASE_GS_KERNEL , low, high, err); +set_seg (SEGBASE_GS_KERNEL , low, high);break ;case MSR_STAR :
Signature · 1 line
2.49.0
[tip: x86/merge] x86/xen/msr: Remove the error pointer argument from set_seg()
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 2b7e25301c5418059b013c14af9022d892466398 Gitweb: https://git.kernel.org/tip/2b7e25301c5418059b013c14af9022d892466398 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:24 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:36 +02:00
x86/xen/msr: Remove the error pointer argument from set_seg()
set_seg() is used to write the following MSRs on Xen:
MSR_FS_BASE
MSR_KERNEL_GS_BASE
MSR_GS_BASE
But none of these MSRs are written using any MSR write safe API. Therefore there is no need to pass an error pointer argument to set_seg() for returning an error code to be used in MSR safe APIs.
Remove the error pointer argument.
--- arch/x86/xen/enlighten_pv.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
arch/x86/xen/enlighten_pv.c +5 -11
@@ -1111,17 +1111,11 @@ static u64 xen_do_read_msr(unsigned int msr, int *err)return val; } -static void set_seg (unsigned int which,unsigned int low,unsigned int high, -int *err) +static void set_seg (u32 which,u32 low,u32 high) {u64 base = ((u64 )high <<32 ) | low; -if (HYPERVISOR_set_segment_base (which, base) ==0 ) -return ; - -if (err) - *err = -EIO ; -else +if (HYPERVISOR_set_segment_base (which, base))WARN (1 ,"Xen set_segment_base(%u, %llx) failed\n" , which, base); }
@@ -1137,15 +1131,15 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,switch (msr) {case MSR_FS_BASE : -set_seg (SEGBASE_FS , low, high, err); +set_seg (SEGBASE_FS , low, high);break ;case MSR_KERNEL_GS_BASE : -set_seg (SEGBASE_GS_USER , low, high, err); +set_seg (SEGBASE_GS_USER , low, high);break ;case MSR_GS_BASE : -set_seg (SEGBASE_GS_KERNEL , low, high, err); +set_seg (SEGBASE_GS_KERNEL , low, high);break ;case MSR_STAR :
Xin Li (Intel)
maintainerPATCH v4 13/15 x86/pvops/msr: refactor pv_cpu_ops.write_msr{,_safe}()
In reply to Xin Li (Intel)An MSR value is represented as a 64-bit unsigned integer, with existing MSR instructions storing it in EDX:EAX as two 32-bit segments.
The new immediate form MSR instructions, however, utilize a 64-bit general-purpose register to store the MSR value. To unify the usage of all MSR instructions, let the default MSR access APIs accept an MSR value as a single 64-bit argument instead of two 32-bit segments.
The dual 32-bit APIs are still available as convenient wrappers over the APIs that handle an MSR value as a single 64-bit argument.
The following illustrates the updated derivation of the MSR write APIs:
__wrmsrq(u32 msr, u64 val)
/ \
/ \
native_wrmsrq(msr, val) native_wrmsr(msr, low, high)
|
|
native_write_msr(msr, val)
/ \
/ \
wrmsrq(msr, val) wrmsr(msr, low, high)When CONFIG_PARAVIRT is enabled, wrmsrq() and wrmsr() are defined on top of paravirt_write_msr():
paravirt_write_msr(u32 msr, u64 val)
/ \
/ \
wrmsrq(msr, val) wrmsr(msr, low, high)
paravirt_write_msr() invokes cpu.write_msr(msr, val), an indirect layer of pv_ops MSR write call:
If on native:
cpu.write_msr = native_write_msr
If on Xen:
cpu.write_msr = xen_write_msr
Therefore, refactor pv_cpu_ops.write_msr{_safe}() to accept an MSR value in a single u64 argument, replacing the current dual u32 arguments.
No functional change intended.
---
Change in v2:
* Spell out the reason why use a single u64 argument to pass the MSR value in the lowest level APIs (Andrew Cooper).
--- arch/x86/include/asm/msr.h | 35 ++++++++++++--------------- arch/x86/include/asm/paravirt.h | 27 +++++++++++---------- arch/x86/include/asm/paravirt_types.h | 4 +-- arch/x86/kernel/kvmclock.c | 2 +- arch/x86/kvm/svm/svm.c | 15 +++--------- arch/x86/xen/enlighten_pv.c | 30 +++++++++-------------- 6 files changed, 46 insertions(+), 67 deletions(-)
arch/x86/include/asm/msr.h +15 -20
@@ -92,12 +92,12 @@ static __always_inline u64 __rdmsr(u32 msr)return EAX_EDX_VAL (val, low, high); } -static __always_inline void __wrmsr(u32 msr, u32 low, u32 high) +static __always_inline void __wrmsrq(u32 msr, u64 val) { asm volatile("1: wrmsr\n" "2:\n" _ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_WRMSR) - : : "c" (msr), "a"(low), "d" (high) : "memory"); + : : "c" (msr), "a" ((u32)val), "d" ((u32)(val >> 32)) : "memory"); }#define native_rdmsr (msr, val1, val2) \
@@ -113,11 +113,10 @@ static __always_inline u64 native_rdmsrq(u32 msr) }#define native_wrmsr (msr, low, high) \ - __wrmsr(msr, low, high) + __wrmsrq((msr), (u64)(high) << 32 | (low))#define native_wrmsrq (msr, val) \ - __wrmsr((msr), (u32)((u64)(val)), \ - (u32)((u64)(val) >> 32)) + __wrmsrq((msr), (val))static inline u64 native_read_msr (u32 msr) {
@@ -146,11 +145,8 @@ static inline u64 native_read_msr_safe(u32 msr, int *err) }/* Can be uninlined because referenced by paravirt */ -static inline void notrace -native_write_msr (u32 msr,u32 low,u32 high) +static inline void notrace native_write_msr(u32 msr, u64 val) { -u64 val = (u64 )high <<32 | low; -native_wrmsrq (msr, val);if (tracepoint_enabled (write_msr))
@@ -158,8 +154,7 @@ native_write_msr(u32 msr, u32 low, u32 high) }/* Can be uninlined because referenced by paravirt */ -static inline int notrace -native_write_msr_safe (u32 msr,u32 low,u32 high) +static inline int notrace native_write_msr_safe(u32 msr, u64 val) {int err;
@@ -167,10 +162,10 @@ native_write_msr_safe(u32 msr, u32 low, u32 high)"2:\n\t" _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_WRMSR_SAFE, %[err]) : [err] "=a" (err) - : "c" (msr), "0" (low), "d" (high) + : "c" (msr), "0" ((u32)val), "d" ((u32)(val >> 32)) : "memory"); if (tracepoint_enabled(write_msr)) -do_trace_write_msr (msr, ((u64 )high <<32 | low), err); +do_trace_write_msr (msr, val, err);return err; }
@@ -206,7 +201,7 @@ do { \static inline void wrmsr (u32 msr,u32 low,u32 high) { -native_write_msr (msr, low, high); +native_write_msr (msr, (u64 )high <<32 | low); }#define rdmsrq (msr, val) \
@@ -214,13 +209,13 @@ static inline void wrmsr(u32 msr, u32 low, u32 high)static inline void wrmsrq (u32 msr,u64 val) { -native_write_msr (msr, (u32)(val &0xffffffffULL ), (u32)(val >>32 )); +native_write_msr (msr, val); }/* wrmsr with exception handling */ -static inline int wrmsr_safe (u32 msr,u32 low,u32 high) +static inline int wrmsrq_safe (u32 msr,u64 val) { -return native_write_msr_safe (msr, low, high); +return native_write_msr_safe (msr, val); }/* rdmsr with exception handling */
@@ -264,11 +259,11 @@ static __always_inline void wrmsrns(u32 msr, u64 val) }/* -* 64-bit version of wrmsr_safe(): +* Dual u32 version of wrmsrq_safe(): */ -static inline int wrmsrq_safe (u32 msr,u64 val) +static inline int wrmsr_safe (u32 msr,u32 low,u32 high) { -return wrmsr_safe (msr, (u32 )val, (u32)(val >>32 )); +return wrmsrq_safe (msr, (u64 )high <<32 | low); }struct msr __percpu *msrs_alloc (void );
arch/x86/include/asm/paravirt.h +14 -13
@@ -180,10 +180,9 @@ static inline u64 paravirt_read_msr(unsigned msr)return PVOP_CALL1 (u64, cpu.read_msr, msr); } -static inline void paravirt_write_msr (unsigned msr, -unsigned low,unsigned high) +static inline void paravirt_write_msr (u32 msr,u64 val) { -PVOP_VCALL3 (cpu.write_msr, msr, low, high); +PVOP_VCALL2 (cpu.write_msr, msr, val); }static inline u64 paravirt_read_msr_safe (unsigned msr,int *err)
@@ -191,10 +190,9 @@ static inline u64 paravirt_read_msr_safe(unsigned msr, int *err)return PVOP_CALL2 (u64, cpu.read_msr_safe, msr, err); } -static inline int paravirt_write_msr_safe (unsigned msr, -unsigned low,unsigned high) +static inline int paravirt_write_msr_safe (u32 msr,u64 val) { -return PVOP_CALL3 (int, cpu.write_msr_safe, msr, low, high); +return PVOP_CALL2 (int, cpu.write_msr_safe, msr, val); }#define rdmsr (msr, val1, val2) \
@@ -204,22 +202,25 @@ do { \ val2 = _l >>32 ; \ }while (0 ) -#define wrmsr (msr, val1, val2) \ -do { \ - paravirt_write_msr(msr, val1, val2); \ -} while (0) +static __always_inline void wrmsr(u32 msr, u32 low, u32 high) +{ +paravirt_write_msr (msr, (u64 )high <<32 | low); +}#define rdmsrq (msr, val) \ do { \ val = paravirt_read_msr(msr); \ } while (0) -static inline void wrmsrq (unsigned msr,u64 val) +static inline void wrmsrq (u32 msr,u64 val) { -wrmsr (msr, (u32 )val, (u32)(val>>32 )); +paravirt_write_msr (msr, val); } -#define wrmsr_safe (msr, a, b) paravirt_write_msr_safe(msr, a, b) +static inline int wrmsrq_safe (u32 msr,u64 val) +{ +return paravirt_write_msr_safe (msr, val); +}/* rdmsr with exception handling */ #define rdmsr_safe (msr, a, b) \
arch/x86/include/asm/paravirt_types.h +2 -2
@@ -92,14 +92,14 @@ struct pv_cpu_ops {/* Unsafe MSR operations. These will warn or panic on failure. */ u64 (*read_msr)(unsigned int msr); -void (*write_msr)(unsigned int msr,unsigned low,unsigned high); +void (*write_msr)(u32 msr,u64 val);/* * Safe MSR operations. * read sets err to 0 or -EIO. write returns 0 or -EIO. */ u64 (*read_msr_safe)(unsigned int msr,int *err); -int (*write_msr_safe)(unsigned int msr,unsigned low,unsigned high); +int (*write_msr_safe)(u32 msr,u64 val);u64 (*read_pmc)(int counter);
arch/x86/kernel/kvmclock.c +1 -1
@@ -196,7 +196,7 @@ static void kvm_setup_secondary_clock(void)void kvmclock_disable (void ) {if (msr_kvm_system_time) -native_write_msr (msr_kvm_system_time,0 ,0 ); +native_write_msr (msr_kvm_system_time,0 ); }static void __init kvmclock_init_mem (void )
arch/x86/kvm/svm/svm.c +3 -12
@@ -475,7 +475,6 @@ static void svm_inject_exception(struct kvm_vcpu *vcpu)static void svm_init_erratum_383 (void ) { -u32 low, high;int err;u64 val;
@@ -489,10 +488,7 @@ static void svm_init_erratum_383(void) val |= (1ULL <<47 ); - low =lower_32_bits (val); - high =upper_32_bits (val); - -native_write_msr_safe (MSR_AMD64_DC_CFG , low, high); +native_write_msr_safe (MSR_AMD64_DC_CFG , val); erratum_383_found = true; }
@@ -2167,17 +2163,12 @@ static bool is_erratum_383(void)/* Clear MCi_STATUS registers */ for (i =0 ; i <6 ; ++i) -native_write_msr_safe (MSR_IA32_MCx_STATUS (i),0 ,0 ); +native_write_msr_safe (MSR_IA32_MCx_STATUS (i),0 ); value =native_read_msr_safe (MSR_IA32_MCG_STATUS , &err);if (!err) { -u32 low, high; - value &= ~(1ULL <<2 ); - low =lower_32_bits (value); - high =upper_32_bits (value); - -native_write_msr_safe (MSR_IA32_MCG_STATUS , low, high); +native_write_msr_safe (MSR_IA32_MCG_STATUS , value); }/* Flush tlb to evict multi-match entries */
arch/x86/xen/enlighten_pv.c +11 -19
@@ -1110,10 +1110,8 @@ static u64 xen_do_read_msr(unsigned int msr, int *err)return val; } -static void set_seg (u32 which,u32 low,u32 high) +static void set_seg (u32 which,u64 base) { -u64 base = ((u64 )high <<32 ) | low; -if (HYPERVISOR_set_segment_base (which, base))WARN (1 ,"Xen set_segment_base(%u, %llx) failed\n" , which, base); }
@@ -1123,22 +1121,19 @@ static void set_seg(u32 which, u32 low, u32 high)* With err == NULL write_msr() semantics are selected. * Supplying an err pointer requires err to be pre-initialized with 0. */ -static void xen_do_write_msr (unsigned int msr,unsigned int low, -unsigned int high,int *err) +static void xen_do_write_msr (u32 msr,u64 val,int *err) { -u64 val; -switch (msr) {case MSR_FS_BASE : -set_seg (SEGBASE_FS , low, high); +set_seg (SEGBASE_FS , val);break ;case MSR_KERNEL_GS_BASE : -set_seg (SEGBASE_GS_USER , low, high); +set_seg (SEGBASE_GS_USER , val);break ;case MSR_GS_BASE : -set_seg (SEGBASE_GS_KERNEL , low, high); +set_seg (SEGBASE_GS_KERNEL , val);break ;case MSR_STAR :
@@ -1154,15 +1149,13 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,break ;default : - val = (u64 )high <<32 | low; -if (pmu_msr_chk_emulated (msr, &val, false))return ;if (err) - *err =native_write_msr_safe (msr, low, high); + *err =native_write_msr_safe (msr, val);else -native_write_msr (msr, low, high); +native_write_msr (msr, val); } }
@@ -1171,12 +1164,11 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err)return xen_do_read_msr (msr, err); } -static int xen_write_msr_safe (unsigned int msr,unsigned int low, -unsigned int high) +static int xen_write_msr_safe (u32 msr,u64 val) {int err =0 ; -xen_do_write_msr (msr, low, high, &err); +xen_do_write_msr (msr, val, &err);return err; }
@@ -1188,11 +1180,11 @@ static u64 xen_read_msr(unsigned int msr)return xen_do_read_msr (msr, xen_msr_safe ? &err :NULL ); } -static void xen_write_msr (unsigned int msr,unsigned low,unsigned high) +static void xen_write_msr (u32 msr,u64 val) {int err; -xen_do_write_msr (msr, low, high, xen_msr_safe ? &err :NULL ); +xen_do_write_msr (msr, val, xen_msr_safe ? &err :NULL ); }/* This is called once we have the cpu_possible_mask */
Signature · 1 line
2.49.0
[tip: x86/merge] x86/pvops/msr: Refactor pv_cpu_ops.write_msr{,_safe}()
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 0c2678efed6c6a2908dfe14af1e93a6bebc78e79 Gitweb: https://git.kernel.org/tip/0c2678efed6c6a2908dfe14af1e93a6bebc78e79 Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:25 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:36 +02:00
x86/pvops/msr: Refactor pv_cpu_ops.write_msr{,_safe}()
An MSR value is represented as a 64-bit unsigned integer, with existing MSR instructions storing it in EDX:EAX as two 32-bit segments.
The new immediate form MSR instructions, however, utilize a 64-bit general-purpose register to store the MSR value. To unify the usage of all MSR instructions, let the default MSR access APIs accept an MSR value as a single 64-bit argument instead of two 32-bit segments.
The dual 32-bit APIs are still available as convenient wrappers over the APIs that handle an MSR value as a single 64-bit argument.
The following illustrates the updated derivation of the MSR write APIs:
__wrmsrq(u32 msr, u64 val)
/ \
/ \
native_wrmsrq(msr, val) native_wrmsr(msr, low, high)
|
|
native_write_msr(msr, val)
/ \
/ \
wrmsrq(msr, val) wrmsr(msr, low, high)When CONFIG_PARAVIRT is enabled, wrmsrq() and wrmsr() are defined on top of paravirt_write_msr():
paravirt_write_msr(u32 msr, u64 val)
/ \
/ \
wrmsrq(msr, val) wrmsr(msr, low, high)
paravirt_write_msr() invokes cpu.write_msr(msr, val), an indirect layer of pv_ops MSR write call:
If on native:
cpu.write_msr = native_write_msr
If on Xen:
cpu.write_msr = xen_write_msr
Therefore, refactor pv_cpu_ops.write_msr{_safe}() to accept an MSR value in a single u64 argument, replacing the current dual u32 arguments.
No functional change intended.
--- arch/x86/include/asm/msr.h | 35 +++++++++++--------------- arch/x86/include/asm/paravirt.h | 27 ++++++++++---------- arch/x86/include/asm/paravirt_types.h | 4 +-- arch/x86/kernel/kvmclock.c | 2 +- arch/x86/kvm/svm/svm.c | 15 ++--------- arch/x86/xen/enlighten_pv.c | 30 ++++++++-------------- 6 files changed, 46 insertions(+), 67 deletions(-)
arch/x86/include/asm/msr.h +15 -20
@@ -75,12 +75,12 @@ static __always_inline u64 __rdmsr(u32 msr)return EAX_EDX_VAL (val, low, high); } -static __always_inline void __wrmsr(u32 msr, u32 low, u32 high) +static __always_inline void __wrmsrq(u32 msr, u64 val) { asm volatile("1: wrmsr\n" "2:\n" _ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_WRMSR) - : : "c" (msr), "a"(low), "d" (high) : "memory"); + : : "c" (msr), "a" ((u32)val), "d" ((u32)(val >> 32)) : "memory"); }#define native_rdmsr (msr, val1, val2) \
@@ -96,11 +96,10 @@ static __always_inline u64 native_rdmsrq(u32 msr) }#define native_wrmsr (msr, low, high) \ - __wrmsr(msr, low, high) + __wrmsrq((msr), (u64)(high) << 32 | (low))#define native_wrmsrq (msr, val) \ - __wrmsr((msr), (u32)((u64)(val)), \ - (u32)((u64)(val) >> 32)) + __wrmsrq((msr), (val))static inline u64 native_read_msr (u32 msr) {
@@ -129,11 +128,8 @@ static inline u64 native_read_msr_safe(u32 msr, int *err) }/* Can be uninlined because referenced by paravirt */ -static inline void notrace -native_write_msr (u32 msr,u32 low,u32 high) +static inline void notrace native_write_msr(u32 msr, u64 val) { -u64 val = (u64 )high <<32 | low; -native_wrmsrq (msr, val);if (tracepoint_enabled (write_msr))
@@ -141,8 +137,7 @@ native_write_msr(u32 msr, u32 low, u32 high) }/* Can be uninlined because referenced by paravirt */ -static inline int notrace -native_write_msr_safe (u32 msr,u32 low,u32 high) +static inline int notrace native_write_msr_safe(u32 msr, u64 val) {int err;
@@ -150,10 +145,10 @@ native_write_msr_safe(u32 msr, u32 low, u32 high)"2:\n\t" _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_WRMSR_SAFE, %[err]) : [err] "=a" (err) - : "c" (msr), "0" (low), "d" (high) + : "c" (msr), "0" ((u32)val), "d" ((u32)(val >> 32)) : "memory"); if (tracepoint_enabled(write_msr)) -do_trace_write_msr (msr, ((u64 )high <<32 | low), err); +do_trace_write_msr (msr, val, err);return err; }
@@ -189,7 +184,7 @@ do { \static inline void wrmsr (u32 msr,u32 low,u32 high) { -native_write_msr (msr, low, high); +native_write_msr (msr, (u64 )high <<32 | low); }#define rdmsrq (msr, val) \
@@ -197,13 +192,13 @@ static inline void wrmsr(u32 msr, u32 low, u32 high)static inline void wrmsrq (u32 msr,u64 val) { -native_write_msr (msr, (u32)(val &0xffffffffULL ), (u32)(val >>32 )); +native_write_msr (msr, val); }/* wrmsr with exception handling */ -static inline int wrmsr_safe (u32 msr,u32 low,u32 high) +static inline int wrmsrq_safe (u32 msr,u64 val) { -return native_write_msr_safe (msr, low, high); +return native_write_msr_safe (msr, val); }/* rdmsr with exception handling */
@@ -247,11 +242,11 @@ static __always_inline void wrmsrns(u32 msr, u64 val) }/* -* 64-bit version of wrmsr_safe(): +* Dual u32 version of wrmsrq_safe(): */ -static inline int wrmsrq_safe (u32 msr,u64 val) +static inline int wrmsr_safe (u32 msr,u32 low,u32 high) { -return wrmsr_safe (msr, (u32 )val, (u32)(val >>32 )); +return wrmsrq_safe (msr, (u64 )high <<32 | low); }struct msr __percpu *msrs_alloc (void );
arch/x86/include/asm/paravirt.h +14 -13
@@ -180,10 +180,9 @@ static inline u64 paravirt_read_msr(unsigned msr)return PVOP_CALL1 (u64, cpu.read_msr, msr); } -static inline void paravirt_write_msr (unsigned msr, -unsigned low,unsigned high) +static inline void paravirt_write_msr (u32 msr,u64 val) { -PVOP_VCALL3 (cpu.write_msr, msr, low, high); +PVOP_VCALL2 (cpu.write_msr, msr, val); }static inline u64 paravirt_read_msr_safe (unsigned msr,int *err)
@@ -191,10 +190,9 @@ static inline u64 paravirt_read_msr_safe(unsigned msr, int *err)return PVOP_CALL2 (u64, cpu.read_msr_safe, msr, err); } -static inline int paravirt_write_msr_safe (unsigned msr, -unsigned low,unsigned high) +static inline int paravirt_write_msr_safe (u32 msr,u64 val) { -return PVOP_CALL3 (int, cpu.write_msr_safe, msr, low, high); +return PVOP_CALL2 (int, cpu.write_msr_safe, msr, val); }#define rdmsr (msr, val1, val2) \
@@ -204,22 +202,25 @@ do { \ val2 = _l >>32 ; \ }while (0 ) -#define wrmsr (msr, val1, val2) \ -do { \ - paravirt_write_msr(msr, val1, val2); \ -} while (0) +static __always_inline void wrmsr(u32 msr, u32 low, u32 high) +{ +paravirt_write_msr (msr, (u64 )high <<32 | low); +}#define rdmsrq (msr, val) \ do { \ val = paravirt_read_msr(msr); \ } while (0) -static inline void wrmsrq (unsigned msr,u64 val) +static inline void wrmsrq (u32 msr,u64 val) { -wrmsr (msr, (u32 )val, (u32)(val>>32 )); +paravirt_write_msr (msr, val); } -#define wrmsr_safe (msr, a, b) paravirt_write_msr_safe(msr, a, b) +static inline int wrmsrq_safe (u32 msr,u64 val) +{ +return paravirt_write_msr_safe (msr, val); +}/* rdmsr with exception handling */ #define rdmsr_safe (msr, a, b) \
arch/x86/include/asm/paravirt_types.h +2 -2
@@ -92,14 +92,14 @@ struct pv_cpu_ops {/* Unsafe MSR operations. These will warn or panic on failure. */ u64 (*read_msr)(unsigned int msr); -void (*write_msr)(unsigned int msr,unsigned low,unsigned high); +void (*write_msr)(u32 msr,u64 val);/* * Safe MSR operations. * read sets err to 0 or -EIO. write returns 0 or -EIO. */ u64 (*read_msr_safe)(unsigned int msr,int *err); -int (*write_msr_safe)(unsigned int msr,unsigned low,unsigned high); +int (*write_msr_safe)(u32 msr,u64 val);u64 (*read_pmc)(int counter);
arch/x86/kernel/kvmclock.c +1 -1
@@ -196,7 +196,7 @@ static void kvm_setup_secondary_clock(void)void kvmclock_disable (void ) {if (msr_kvm_system_time) -native_write_msr (msr_kvm_system_time,0 ,0 ); +native_write_msr (msr_kvm_system_time,0 ); }static void __init kvmclock_init_mem (void )
arch/x86/kvm/svm/svm.c +3 -12
@@ -476,7 +476,6 @@ static void svm_inject_exception(struct kvm_vcpu *vcpu)static void svm_init_erratum_383 (void ) { -u32 low, high;int err;u64 val;
@@ -490,10 +489,7 @@ static void svm_init_erratum_383(void) val |= (1ULL <<47 ); - low =lower_32_bits (val); - high =upper_32_bits (val); - -native_write_msr_safe (MSR_AMD64_DC_CFG , low, high); +native_write_msr_safe (MSR_AMD64_DC_CFG , val); erratum_383_found = true; }
@@ -2168,17 +2164,12 @@ static bool is_erratum_383(void)/* Clear MCi_STATUS registers */ for (i =0 ; i <6 ; ++i) -native_write_msr_safe (MSR_IA32_MCx_STATUS (i),0 ,0 ); +native_write_msr_safe (MSR_IA32_MCx_STATUS (i),0 ); value =native_read_msr_safe (MSR_IA32_MCG_STATUS , &err);if (!err) { -u32 low, high; - value &= ~(1ULL <<2 ); - low =lower_32_bits (value); - high =upper_32_bits (value); - -native_write_msr_safe (MSR_IA32_MCG_STATUS , low, high); +native_write_msr_safe (MSR_IA32_MCG_STATUS , value); }/* Flush tlb to evict multi-match entries */
arch/x86/xen/enlighten_pv.c +11 -19
@@ -1111,10 +1111,8 @@ static u64 xen_do_read_msr(unsigned int msr, int *err)return val; } -static void set_seg (u32 which,u32 low,u32 high) +static void set_seg (u32 which,u64 base) { -u64 base = ((u64 )high <<32 ) | low; -if (HYPERVISOR_set_segment_base (which, base))WARN (1 ,"Xen set_segment_base(%u, %llx) failed\n" , which, base); }
@@ -1124,22 +1122,19 @@ static void set_seg(u32 which, u32 low, u32 high)* With err == NULL write_msr() semantics are selected. * Supplying an err pointer requires err to be pre-initialized with 0. */ -static void xen_do_write_msr (unsigned int msr,unsigned int low, -unsigned int high,int *err) +static void xen_do_write_msr (u32 msr,u64 val,int *err) { -u64 val; -switch (msr) {case MSR_FS_BASE : -set_seg (SEGBASE_FS , low, high); +set_seg (SEGBASE_FS , val);break ;case MSR_KERNEL_GS_BASE : -set_seg (SEGBASE_GS_USER , low, high); +set_seg (SEGBASE_GS_USER , val);break ;case MSR_GS_BASE : -set_seg (SEGBASE_GS_KERNEL , low, high); +set_seg (SEGBASE_GS_KERNEL , val);break ;case MSR_STAR :
@@ -1155,15 +1150,13 @@ static void xen_do_write_msr(unsigned int msr, unsigned int low,break ;default : - val = (u64 )high <<32 | low; -if (pmu_msr_chk_emulated (msr, &val, false))return ;if (err) - *err =native_write_msr_safe (msr, low, high); + *err =native_write_msr_safe (msr, val);else -native_write_msr (msr, low, high); +native_write_msr (msr, val); } }
@@ -1172,12 +1165,11 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err)return xen_do_read_msr (msr, err); } -static int xen_write_msr_safe (unsigned int msr,unsigned int low, -unsigned int high) +static int xen_write_msr_safe (u32 msr,u64 val) {int err =0 ; -xen_do_write_msr (msr, low, high, &err); +xen_do_write_msr (msr, val, &err);return err; }
@@ -1189,11 +1181,11 @@ static u64 xen_read_msr(unsigned int msr)return xen_do_read_msr (msr, xen_msr_safe ? &err :NULL ); } -static void xen_write_msr (unsigned int msr,unsigned low,unsigned high) +static void xen_write_msr (u32 msr,u64 val) {int err; -xen_do_write_msr (msr, low, high, xen_msr_safe ? &err :NULL ); +xen_do_write_msr (msr, val, xen_msr_safe ? &err :NULL ); }/* This is called once we have the cpu_possible_mask */
Xin Li (Intel)
maintainerPATCH v4 14/15 x86/msr: Replace wrmsr(msr, low, 0) with wrmsrq(msr, low)
In reply to Xin Li (Intel)The third argument in wrmsr(msr, low, 0) is unnecessary. Instead, use wrmsrq(msr, low), which automatically sets the higher 32 bits of the MSR value to 0.
--- arch/x86/hyperv/hv_apic.c | 6 +++--- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/switch_to.h | 2 +- arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/common.c | 8 ++++---- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++-- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 +- arch/x86/kernel/cpu/umwait.c | 4 ++-- arch/x86/kernel/kvm.c | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-)
arch/x86/hyperv/hv_apic.c +3 -3
@@ -75,10 +75,10 @@ static void hv_apic_write(u32 reg, u32 val) {switch (reg) {case APIC_EOI : -wrmsr (HV_X64_MSR_EOI , val,0 ); +wrmsrq (HV_X64_MSR_EOI , val);break ;case APIC_TASKPRI : -wrmsr (HV_X64_MSR_TPR , val,0 ); +wrmsrq (HV_X64_MSR_TPR , val);break ;default :native_apic_mem_write (reg, val);
@@ -92,7 +92,7 @@ static void hv_apic_eoi_write(void)if (hvp && (xchg (&hvp->apic_assist,0 ) &0x1 ))return ; -wrmsr (HV_X64_MSR_EOI ,APIC_EOI_ACK ,0 ); +wrmsrq (HV_X64_MSR_EOI ,APIC_EOI_ACK ); }static bool cpu_is_self (int cpu)
arch/x86/include/asm/apic.h +1 -1
@@ -209,7 +209,7 @@ static inline void native_apic_msr_write(u32 reg, u32 v) reg == APIC_LVR)return ; -wrmsr (APIC_BASE_MSR + (reg >>4 ), v,0 ); +wrmsrq (APIC_BASE_MSR + (reg >>4 ), v); }static inline void native_apic_msr_eoi (void )
arch/x86/include/asm/switch_to.h +1 -1
@@ -61,7 +61,7 @@ static inline void refresh_sysenter_cs(struct thread_struct *thread)return ;this_cpu_write (cpu_tss_rw.x86_tss.ss1, thread->sysenter_cs); - wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); + wrmsrq(MSR_IA32_SYSENTER_CS, thread->sysenter_cs); }#endif
arch/x86/kernel/cpu/amd.c +1 -1
@@ -1200,7 +1200,7 @@ void amd_set_dr_addr_mask(unsigned long mask, unsigned int dr)if (per_cpu (amd_dr_addr_mask, cpu)[dr] == mask)return ; -wrmsr (amd_msr_dr_addr_masks[dr], mask,0 ); +wrmsrq (amd_msr_dr_addr_masks[dr], mask);per_cpu (amd_dr_addr_mask, cpu)[dr] = mask; }
arch/x86/kernel/cpu/common.c +4 -4
@@ -1982,9 +1982,9 @@ void enable_sep_cpu(void)*/ tss->x86_tss.ss1 = __KERNEL_CS; -wrmsr (MSR_IA32_SYSENTER_CS , tss->x86_tss.ss1,0 ); -wrmsr (MSR_IA32_SYSENTER_ESP , (unsigned long )(cpu_entry_stack (cpu) +1 ),0 ); -wrmsr (MSR_IA32_SYSENTER_EIP , (unsigned long )entry_SYSENTER_32,0 ); +wrmsrq (MSR_IA32_SYSENTER_CS , tss->x86_tss.ss1); +wrmsrq (MSR_IA32_SYSENTER_ESP , (unsigned long )(cpu_entry_stack (cpu) +1 )); +wrmsrq (MSR_IA32_SYSENTER_EIP , (unsigned long )entry_SYSENTER_32);put_cpu (); }
@@ -2198,7 +2198,7 @@ static inline void setup_getcpu(int cpu)struct desc_struct d = { };if (boot_cpu_has (X86_FEATURE_RDTSCP ) ||boot_cpu_has (X86_FEATURE_RDPID )) -wrmsr (MSR_TSC_AUX , cpudata,0 ); +wrmsrq (MSR_TSC_AUX , cpudata);/* Store CPU and node number in limit. */ d.limit0 = cpudata;
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +2 -2
@@ -905,7 +905,7 @@ int resctrl_arch_measure_cycles_lat_fn(void *_plr)* Disable hardware prefetchers. */ rdmsr (MSR_MISC_FEATURE_CONTROL , saved_low, saved_high); -wrmsr (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits,0x0 ); +wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits); mem_r =READ_ONCE (plr->kmem);/* * Dummy execute of the time measurement to load the needed
@@ -1001,7 +1001,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* Disable hardware prefetchers. */ rdmsr (MSR_MISC_FEATURE_CONTROL , saved_low, saved_high); -wrmsr (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits,0x0 ); +wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits);/* Initialize rest of local variables */ /*
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -1
@@ -1707,7 +1707,7 @@ void resctrl_arch_mon_event_config_write(void *_config_info)pr_warn_once ("Invalid event id %d\n" , config_info->evtid);return ; } -wrmsr (MSR_IA32_EVT_CFG_BASE + index, config_info->mon_config,0 ); +wrmsrq (MSR_IA32_EVT_CFG_BASE + index, config_info->mon_config); } static void mbm_config_write_domain(struct rdt_resource *r,
arch/x86/kernel/cpu/umwait.c +2 -2
@@ -33,7 +33,7 @@ static DEFINE_MUTEX(umwait_lock);static void umwait_update_control_msr (void * unused) {lockdep_assert_irqs_disabled (); -wrmsr (MSR_IA32_UMWAIT_CONTROL ,READ_ONCE (umwait_control_cached),0 ); +wrmsrq (MSR_IA32_UMWAIT_CONTROL ,READ_ONCE (umwait_control_cached)); }/*
@@ -71,7 +71,7 @@ static int umwait_cpu_offline(unsigned int cpu)* the original control MSR value in umwait_init(). So there * is no race condition here. */ -wrmsr (MSR_IA32_UMWAIT_CONTROL , orig_umwait_control_cached,0 ); +wrmsrq (MSR_IA32_UMWAIT_CONTROL , orig_umwait_control_cached);return 0 ; }
arch/x86/kernel/kvm.c +1 -1
@@ -399,7 +399,7 @@ static void kvm_disable_steal_time(void)if (!has_steal_clock)return ; -wrmsr (MSR_KVM_STEAL_TIME ,0 ,0 ); +wrmsrq (MSR_KVM_STEAL_TIME ,0 ); }static u64 kvm_steal_clock (int cpu)
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Replace wrmsr(msr, low, 0) with wrmsrq(msr, low)
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 444b46a128ccd0883f83ffa2e6b4a1f64ea4ca1c Gitweb: https://git.kernel.org/tip/444b46a128ccd0883f83ffa2e6b4a1f64ea4ca1c Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:26 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:36 +02:00
x86/msr: Replace wrmsr(msr, low, 0) with wrmsrq(msr, low)
The third argument in wrmsr(msr, low, 0) is unnecessary. Instead, use wrmsrq(msr, low), which automatically sets the higher 32 bits of the MSR value to 0.
--- arch/x86/hyperv/hv_apic.c | 6 +++--- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/switch_to.h | 2 +- arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/common.c | 8 ++++---- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++-- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 +- arch/x86/kernel/cpu/umwait.c | 4 ++-- arch/x86/kernel/kvm.c | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-)
arch/x86/hyperv/hv_apic.c +3 -3
@@ -76,10 +76,10 @@ static void hv_apic_write(u32 reg, u32 val) {switch (reg) {case APIC_EOI : -wrmsr (HV_X64_MSR_EOI , val,0 ); +wrmsrq (HV_X64_MSR_EOI , val);break ;case APIC_TASKPRI : -wrmsr (HV_X64_MSR_TPR , val,0 ); +wrmsrq (HV_X64_MSR_TPR , val);break ;default :native_apic_mem_write (reg, val);
@@ -93,7 +93,7 @@ static void hv_apic_eoi_write(void)if (hvp && (xchg (&hvp->apic_assist,0 ) &0x1 ))return ; -wrmsr (HV_X64_MSR_EOI ,APIC_EOI_ACK ,0 ); +wrmsrq (HV_X64_MSR_EOI ,APIC_EOI_ACK ); }static bool cpu_is_self (int cpu)
arch/x86/include/asm/apic.h +1 -1
@@ -209,7 +209,7 @@ static inline void native_apic_msr_write(u32 reg, u32 v) reg == APIC_LVR)return ; -wrmsr (APIC_BASE_MSR + (reg >>4 ), v,0 ); +wrmsrq (APIC_BASE_MSR + (reg >>4 ), v); }static inline void native_apic_msr_eoi (void )
arch/x86/include/asm/switch_to.h +1 -1
@@ -61,7 +61,7 @@ static inline void refresh_sysenter_cs(struct thread_struct *thread)return ;this_cpu_write (cpu_tss_rw.x86_tss.ss1, thread->sysenter_cs); - wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); + wrmsrq(MSR_IA32_SYSENTER_CS, thread->sysenter_cs); }#endif
arch/x86/kernel/cpu/amd.c +1 -1
@@ -1207,7 +1207,7 @@ void amd_set_dr_addr_mask(unsigned long mask, unsigned int dr)if (per_cpu (amd_dr_addr_mask, cpu)[dr] == mask)return ; -wrmsr (amd_msr_dr_addr_masks[dr], mask,0 ); +wrmsrq (amd_msr_dr_addr_masks[dr], mask);per_cpu (amd_dr_addr_mask, cpu)[dr] = mask; }
arch/x86/kernel/cpu/common.c +4 -4
@@ -1982,9 +1982,9 @@ void enable_sep_cpu(void)*/ tss->x86_tss.ss1 = __KERNEL_CS; -wrmsr (MSR_IA32_SYSENTER_CS , tss->x86_tss.ss1,0 ); -wrmsr (MSR_IA32_SYSENTER_ESP , (unsigned long )(cpu_entry_stack (cpu) +1 ),0 ); -wrmsr (MSR_IA32_SYSENTER_EIP , (unsigned long )entry_SYSENTER_32,0 ); +wrmsrq (MSR_IA32_SYSENTER_CS , tss->x86_tss.ss1); +wrmsrq (MSR_IA32_SYSENTER_ESP , (unsigned long )(cpu_entry_stack (cpu) +1 )); +wrmsrq (MSR_IA32_SYSENTER_EIP , (unsigned long )entry_SYSENTER_32);put_cpu (); }
@@ -2198,7 +2198,7 @@ static inline void setup_getcpu(int cpu)struct desc_struct d = { };if (boot_cpu_has (X86_FEATURE_RDTSCP ) ||boot_cpu_has (X86_FEATURE_RDPID )) -wrmsr (MSR_TSC_AUX , cpudata,0 ); +wrmsrq (MSR_TSC_AUX , cpudata);/* Store CPU and node number in limit. */ d.limit0 = cpudata;
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +2 -2
@@ -905,7 +905,7 @@ int resctrl_arch_measure_cycles_lat_fn(void *_plr)* Disable hardware prefetchers. */ rdmsr (MSR_MISC_FEATURE_CONTROL , saved_low, saved_high); -wrmsr (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits,0x0 ); +wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits); mem_r =READ_ONCE (plr->kmem);/* * Dummy execute of the time measurement to load the needed
@@ -1001,7 +1001,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr,* Disable hardware prefetchers. */ rdmsr (MSR_MISC_FEATURE_CONTROL , saved_low, saved_high); -wrmsr (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits,0x0 ); +wrmsrq (MSR_MISC_FEATURE_CONTROL , prefetch_disable_bits);/* Initialize rest of local variables */ /*
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -1
@@ -1708,7 +1708,7 @@ void resctrl_arch_mon_event_config_write(void *_config_info)pr_warn_once ("Invalid event id %d\n" , config_info->evtid);return ; } -wrmsr (MSR_IA32_EVT_CFG_BASE + index, config_info->mon_config,0 ); +wrmsrq (MSR_IA32_EVT_CFG_BASE + index, config_info->mon_config); } static void mbm_config_write_domain(struct rdt_resource *r,
arch/x86/kernel/cpu/umwait.c +2 -2
@@ -33,7 +33,7 @@ static DEFINE_MUTEX(umwait_lock);static void umwait_update_control_msr (void * unused) {lockdep_assert_irqs_disabled (); -wrmsr (MSR_IA32_UMWAIT_CONTROL ,READ_ONCE (umwait_control_cached),0 ); +wrmsrq (MSR_IA32_UMWAIT_CONTROL ,READ_ONCE (umwait_control_cached)); }/*
@@ -71,7 +71,7 @@ static int umwait_cpu_offline(unsigned int cpu)* the original control MSR value in umwait_init(). So there * is no race condition here. */ -wrmsr (MSR_IA32_UMWAIT_CONTROL , orig_umwait_control_cached,0 ); +wrmsrq (MSR_IA32_UMWAIT_CONTROL , orig_umwait_control_cached);return 0 ; }
arch/x86/kernel/kvm.c +1 -1
@@ -400,7 +400,7 @@ static void kvm_disable_steal_time(void)if (!has_steal_clock)return ; -wrmsr (MSR_KVM_STEAL_TIME ,0 ,0 ); +wrmsrq (MSR_KVM_STEAL_TIME ,0 ); }static u64 kvm_steal_clock (int cpu)
Xin Li (Intel)
maintainerPATCH v4 15/15 x86/msr: Change the function type of native_read_msr_safe()
In reply to Xin Li (Intel)Modify the function type of native_read_msr_safe() to:
int native_read_msr_safe(u32 msr, u64 *val)
This change makes the function return an error code instead of the MSR value, aligning it with the type of native_write_msr_safe(). Consequently, their callers can check the results in the same way.
While at it, convert leftover MSR data type "unsigned int" to u32.
--- arch/x86/include/asm/msr.h | 21 +++++++++++---------- arch/x86/include/asm/paravirt.h | 19 ++++++++----------- arch/x86/include/asm/paravirt_types.h | 6 +++--- arch/x86/kvm/svm/svm.c | 19 +++++++------------ arch/x86/xen/enlighten_pv.c | 13 ++++++++----- arch/x86/xen/pmu.c | 14 ++++++++------ 6 files changed, 45 insertions(+), 47 deletions(-)
arch/x86/include/asm/msr.h +11 -10
@@ -130,18 +130,22 @@ static inline u64 native_read_msr(u32 msr)return val; } -static inline u64 native_read_msr_safe (u32 msr,int *err) +static inline int native_read_msr_safe (u32 msr,u64 *p) { +int err;DECLARE_ARGS (val, low, high); asmvolatile ("1: rdmsr ; xor %[err],%[err]\n" "2:\n\t" _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_RDMSR_SAFE, %[err]) - : [err] "=r" (*err), EAX_EDX_RET(val, low, high) + : [err] "=r" (err), EAX_EDX_RET(val, low, high) : "c" (msr)); if (tracepoint_enabled(read_msr)) -do_trace_read_msr (msr,EAX_EDX_VAL (val, low, high), *err); -return EAX_EDX_VAL (val, low, high); +do_trace_read_msr (msr,EAX_EDX_VAL (val, low, high), err); + + *p =EAX_EDX_VAL (val, low, high); + +return err; }/* Can be uninlined because referenced by paravirt */
@@ -221,8 +225,8 @@ static inline int wrmsrq_safe(u32 msr, u64 val)/* rdmsr with exception handling */ #define rdmsr_safe (msr, low, high) \ ({ \ - int __err; \ - u64 __val = native_read_msr_safe((msr), &__err); \ + u64 __val; \ + int __err = native_read_msr_safe((msr), &__val); \ (*low) = (u32)__val; \ (*high) = (u32)(__val >> 32); \ __err; \
@@ -230,10 +234,7 @@ static inline int wrmsrq_safe(u32 msr, u64 val)static inline int rdmsrq_safe (u32 msr,u64 *p) { -int err; - - *p =native_read_msr_safe (msr, &err); -return err; +return native_read_msr_safe (msr, p); } static __always_inline u64 rdpmc(int counter)
arch/x86/include/asm/paravirt.h +8 -11
@@ -175,7 +175,7 @@ static inline void __write_cr4(unsigned long x)PVOP_VCALL1 (cpu.write_cr4, x); } -static inline u64 paravirt_read_msr (unsigned msr) +static inline u64 paravirt_read_msr (u32 msr) {return PVOP_CALL1 (u64, cpu.read_msr, msr); }
@@ -185,9 +185,9 @@ static inline void paravirt_write_msr(u32 msr, u64 val)PVOP_VCALL2 (cpu.write_msr, msr, val); } -static inline u64 paravirt_read_msr_safe (unsigned msr,int *err) +static inline int paravirt_read_msr_safe (u32 msr,u64 *val) { -return PVOP_CALL2 (u64, cpu.read_msr_safe, msr, err); +return PVOP_CALL2 (int, cpu.read_msr_safe, msr, val); }static inline int paravirt_write_msr_safe (u32 msr,u64 val)
@@ -225,19 +225,16 @@ static inline int wrmsrq_safe(u32 msr, u64 val)/* rdmsr with exception handling */ #define rdmsr_safe (msr, a, b) \ ({ \ - int _err; \ - u64 _l = paravirt_read_msr_safe(msr, &_err); \ + u64 _l; \ + int _err = paravirt_read_msr_safe((msr), &_l); \ (*a) = (u32)_l; \ - (*b) = _l >> 32; \ + (*b) = (u32)(_l >> 32); \ _err; \ }) -static inline int rdmsrq_safe (unsigned msr,u64 *p) +static __always_inline int rdmsrq_safe(u32 msr, u64 *p) { -int err; - - *p =paravirt_read_msr_safe (msr, &err); -return err; +return paravirt_read_msr_safe (msr, p); } static __always_inline u64 rdpmc(int counter)
arch/x86/include/asm/paravirt_types.h +3 -3
@@ -91,14 +91,14 @@ struct pv_cpu_ops { unsigned int *ecx, unsigned int *edx);/* Unsafe MSR operations. These will warn or panic on failure. */ -u64 (*read_msr)(unsigned int msr); +u64 (*read_msr)(u32 msr);void (*write_msr)(u32 msr,u64 val);/* * Safe MSR operations. -* read sets err to 0 or -EIO. write returns 0 or -EIO. +* Returns 0 or -EIO. */ -u64 (*read_msr_safe)(unsigned int msr,int *err); +int (*read_msr_safe)(u32 msr,u64 *val);int (*write_msr_safe)(u32 msr,u64 val);u64 (*read_pmc)(int counter);
arch/x86/kvm/svm/svm.c +7 -12
@@ -475,15 +475,13 @@ static void svm_inject_exception(struct kvm_vcpu *vcpu)static void svm_init_erratum_383 (void ) { -int err;u64 val;if (!static_cpu_has_bug (X86_BUG_AMD_TLB_MMATCH ))return ;/* Use _safe variants to not break nested virtualization */ - val =native_read_msr_safe (MSR_AMD64_DC_CFG , &err); -if (err) +if (native_read_msr_safe (MSR_AMD64_DC_CFG , &val))return ; val |= (1ULL <<47 );
@@ -648,13 +646,12 @@ static int svm_enable_virtualization_cpu(void)* erratum is present everywhere). */ if (cpu_has (&boot_cpu_data,X86_FEATURE_OSVW )) { -uint64_t len, status =0 ; +u64 len, status =0 ;int err; - len =native_read_msr_safe (MSR_AMD64_OSVW_ID_LENGTH , &err); + err =native_read_msr_safe (MSR_AMD64_OSVW_ID_LENGTH , &len);if (!err) - status =native_read_msr_safe (MSR_AMD64_OSVW_STATUS , - &err); + err =native_read_msr_safe (MSR_AMD64_OSVW_STATUS , &status);if (err) osvw_status = osvw_len =0 ;
@@ -2145,14 +2142,13 @@ static int ac_interception(struct kvm_vcpu *vcpu)static bool is_erratum_383 (void ) { -int err, i; +int i;u64 value;if (!erratum_383_found)return false; - value =native_read_msr_safe (MSR_IA32_MC0_STATUS , &err); -if (err) +if (native_read_msr_safe (MSR_IA32_MC0_STATUS , &value))return false;/* Bit 62 may or may not be set for this mce */
@@ -2165,8 +2161,7 @@ static bool is_erratum_383(void)for (i =0 ; i <6 ; ++i)native_write_msr_safe (MSR_IA32_MCx_STATUS (i),0 ); - value =native_read_msr_safe (MSR_IA32_MCG_STATUS , &err); -if (!err) { +if (!native_read_msr_safe (MSR_IA32_MCG_STATUS , &value)) { value &= ~(1ULL <<2 );native_write_msr_safe (MSR_IA32_MCG_STATUS , value); }
arch/x86/xen/enlighten_pv.c +8 -5
@@ -1086,7 +1086,7 @@ static void xen_write_cr4(unsigned long cr4)native_write_cr4 (cr4); } -static u64 xen_do_read_msr (unsigned int msr,int *err) +static u64 xen_do_read_msr (u32 msr,int *err) {u64 val =0 ;/* Avoid uninitialized value for safe variant. */
@@ -1094,7 +1094,7 @@ static u64 xen_do_read_msr(unsigned int msr, int *err)return val;if (err) - val =native_read_msr_safe (msr, err); + *err =native_read_msr_safe (msr, &val);else val =native_read_msr (msr);
@@ -1159,9 +1159,12 @@ static void xen_do_write_msr(u32 msr, u64 val, int *err) } } -static u64 xen_read_msr_safe (unsigned int msr,int *err) +static int xen_read_msr_safe (u32 msr,u64 *val) { -return xen_do_read_msr (msr, err); +int err; + + *val =xen_do_read_msr (msr, &err); +return err; }static int xen_write_msr_safe (u32 msr,u64 val)
@@ -1173,7 +1176,7 @@ static int xen_write_msr_safe(u32 msr, u64 val)return err; } -static u64 xen_read_msr (unsigned int msr) +static u64 xen_read_msr (u32 msr) {int err;
arch/x86/xen/pmu.c +8 -6
@@ -318,11 +318,12 @@ static u64 xen_amd_read_pmc(int counter)uint8_t xenpmu_flags =get_xenpmu_flags ();if (!xenpmu_data || !(xenpmu_flags &XENPMU_IRQ_PROCESSING )) { -uint32_t msr; -int err; +u32 msr; +u64 val; msr = amd_counters_base + (counter * amd_msr_step); -return native_read_msr_safe (msr, &err); +native_read_msr_safe (msr, &val); +return val; } ctxt = &xenpmu_data->pmu.c.amd;
@@ -339,15 +340,16 @@ static u64 xen_intel_read_pmc(int counter)uint8_t xenpmu_flags =get_xenpmu_flags ();if (!xenpmu_data || !(xenpmu_flags &XENPMU_IRQ_PROCESSING )) { -uint32_t msr; -int err; +u32 msr; +u64 val;if (counter & (1 <<INTEL_PMC_TYPE_SHIFT )) msr =MSR_CORE_PERF_FIXED_CTR0 + (counter &0xffff );else msr =MSR_IA32_PERFCTR0 + counter; -return native_read_msr_safe (msr, &err); +native_read_msr_safe (msr, &val); +return val; } ctxt = &xenpmu_data->pmu.c.intel;
Signature · 1 line
2.49.0
[tip: x86/merge] x86/msr: Change the function type of native_read_msr_safe()
The following commit has been merged into the x86/merge branch of tip:
The following commit has been merged into the x86/merge branch of tip:
Commit-ID: 502ad6e5a6196840976c4c84b2ea2f9769942fbe Gitweb: https://git.kernel.org/tip/502ad6e5a6196840976c4c84b2ea2f9769942fbe Author: Xin Li (Intel) <[email protected]> AuthorDate: Sun, 27 Apr 2025 02:20:27 -07:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 02 May 2025 10:36:36 +02:00
x86/msr: Change the function type of native_read_msr_safe()
Modify the function type of native_read_msr_safe() to:
int native_read_msr_safe(u32 msr, u64 *val)
This change makes the function return an error code instead of the MSR value, aligning it with the type of native_write_msr_safe(). Consequently, their callers can check the results in the same way.
While at it, convert leftover MSR data type "unsigned int" to u32.
--- arch/x86/include/asm/msr.h | 21 +++++++++++---------- arch/x86/include/asm/paravirt.h | 19 ++++++++----------- arch/x86/include/asm/paravirt_types.h | 6 +++--- arch/x86/kvm/svm/svm.c | 19 +++++++------------ arch/x86/xen/enlighten_pv.c | 13 ++++++++----- arch/x86/xen/pmu.c | 14 ++++++++------ 6 files changed, 45 insertions(+), 47 deletions(-)
arch/x86/include/asm/msr.h +11 -10
@@ -113,18 +113,22 @@ static inline u64 native_read_msr(u32 msr)return val; } -static inline u64 native_read_msr_safe (u32 msr,int *err) +static inline int native_read_msr_safe (u32 msr,u64 *p) { +int err;EAX_EDX_DECLARE_ARGS (val, low, high); asmvolatile ("1: rdmsr ; xor %[err],%[err]\n" "2:\n\t" _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_RDMSR_SAFE, %[err]) - : [err] "=r" (*err), EAX_EDX_RET(val, low, high) + : [err] "=r" (err), EAX_EDX_RET(val, low, high) : "c" (msr)); if (tracepoint_enabled(read_msr)) -do_trace_read_msr (msr,EAX_EDX_VAL (val, low, high), *err); -return EAX_EDX_VAL (val, low, high); +do_trace_read_msr (msr,EAX_EDX_VAL (val, low, high), err); + + *p =EAX_EDX_VAL (val, low, high); + +return err; }/* Can be uninlined because referenced by paravirt */
@@ -204,8 +208,8 @@ static inline int wrmsrq_safe(u32 msr, u64 val)/* rdmsr with exception handling */ #define rdmsr_safe (msr, low, high) \ ({ \ - int __err; \ - u64 __val = native_read_msr_safe((msr), &__err); \ + u64 __val; \ + int __err = native_read_msr_safe((msr), &__val); \ (*low) = (u32)__val; \ (*high) = (u32)(__val >> 32); \ __err; \
@@ -213,10 +217,7 @@ static inline int wrmsrq_safe(u32 msr, u64 val)static inline int rdmsrq_safe (u32 msr,u64 *p) { -int err; - - *p =native_read_msr_safe (msr, &err); -return err; +return native_read_msr_safe (msr, p); } static __always_inline u64 rdpmc(int counter)
arch/x86/include/asm/paravirt.h +8 -11
@@ -175,7 +175,7 @@ static inline void __write_cr4(unsigned long x)PVOP_VCALL1 (cpu.write_cr4, x); } -static inline u64 paravirt_read_msr (unsigned msr) +static inline u64 paravirt_read_msr (u32 msr) {return PVOP_CALL1 (u64, cpu.read_msr, msr); }
@@ -185,9 +185,9 @@ static inline void paravirt_write_msr(u32 msr, u64 val)PVOP_VCALL2 (cpu.write_msr, msr, val); } -static inline u64 paravirt_read_msr_safe (unsigned msr,int *err) +static inline int paravirt_read_msr_safe (u32 msr,u64 *val) { -return PVOP_CALL2 (u64, cpu.read_msr_safe, msr, err); +return PVOP_CALL2 (int, cpu.read_msr_safe, msr, val); }static inline int paravirt_write_msr_safe (u32 msr,u64 val)
@@ -225,19 +225,16 @@ static inline int wrmsrq_safe(u32 msr, u64 val)/* rdmsr with exception handling */ #define rdmsr_safe (msr, a, b) \ ({ \ - int _err; \ - u64 _l = paravirt_read_msr_safe(msr, &_err); \ + u64 _l; \ + int _err = paravirt_read_msr_safe((msr), &_l); \ (*a) = (u32)_l; \ - (*b) = _l >> 32; \ + (*b) = (u32)(_l >> 32); \ _err; \ }) -static inline int rdmsrq_safe (unsigned msr,u64 *p) +static __always_inline int rdmsrq_safe(u32 msr, u64 *p) { -int err; - - *p =paravirt_read_msr_safe (msr, &err); -return err; +return paravirt_read_msr_safe (msr, p); } static __always_inline u64 rdpmc(int counter)
arch/x86/include/asm/paravirt_types.h +3 -3
@@ -91,14 +91,14 @@ struct pv_cpu_ops { unsigned int *ecx, unsigned int *edx);/* Unsafe MSR operations. These will warn or panic on failure. */ -u64 (*read_msr)(unsigned int msr); +u64 (*read_msr)(u32 msr);void (*write_msr)(u32 msr,u64 val);/* * Safe MSR operations. -* read sets err to 0 or -EIO. write returns 0 or -EIO. +* Returns 0 or -EIO. */ -u64 (*read_msr_safe)(unsigned int msr,int *err); +int (*read_msr_safe)(u32 msr,u64 *val);int (*write_msr_safe)(u32 msr,u64 val);u64 (*read_pmc)(int counter);
arch/x86/kvm/svm/svm.c +7 -12
@@ -476,15 +476,13 @@ static void svm_inject_exception(struct kvm_vcpu *vcpu)static void svm_init_erratum_383 (void ) { -int err;u64 val;if (!static_cpu_has_bug (X86_BUG_AMD_TLB_MMATCH ))return ;/* Use _safe variants to not break nested virtualization */ - val =native_read_msr_safe (MSR_AMD64_DC_CFG , &err); -if (err) +if (native_read_msr_safe (MSR_AMD64_DC_CFG , &val))return ; val |= (1ULL <<47 );
@@ -649,13 +647,12 @@ static int svm_enable_virtualization_cpu(void)* erratum is present everywhere). */ if (cpu_has (&boot_cpu_data,X86_FEATURE_OSVW )) { -uint64_t len, status =0 ; +u64 len, status =0 ;int err; - len =native_read_msr_safe (MSR_AMD64_OSVW_ID_LENGTH , &err); + err =native_read_msr_safe (MSR_AMD64_OSVW_ID_LENGTH , &len);if (!err) - status =native_read_msr_safe (MSR_AMD64_OSVW_STATUS , - &err); + err =native_read_msr_safe (MSR_AMD64_OSVW_STATUS , &status);if (err) osvw_status = osvw_len =0 ;
@@ -2146,14 +2143,13 @@ static int ac_interception(struct kvm_vcpu *vcpu)static bool is_erratum_383 (void ) { -int err, i; +int i;u64 value;if (!erratum_383_found)return false; - value =native_read_msr_safe (MSR_IA32_MC0_STATUS , &err); -if (err) +if (native_read_msr_safe (MSR_IA32_MC0_STATUS , &value))return false;/* Bit 62 may or may not be set for this mce */
@@ -2166,8 +2162,7 @@ static bool is_erratum_383(void)for (i =0 ; i <6 ; ++i)native_write_msr_safe (MSR_IA32_MCx_STATUS (i),0 ); - value =native_read_msr_safe (MSR_IA32_MCG_STATUS , &err); -if (!err) { +if (!native_read_msr_safe (MSR_IA32_MCG_STATUS , &value)) { value &= ~(1ULL <<2 );native_write_msr_safe (MSR_IA32_MCG_STATUS , value); }
arch/x86/xen/enlighten_pv.c +8 -5
@@ -1087,7 +1087,7 @@ static void xen_write_cr4(unsigned long cr4)native_write_cr4 (cr4); } -static u64 xen_do_read_msr (unsigned int msr,int *err) +static u64 xen_do_read_msr (u32 msr,int *err) {u64 val =0 ;/* Avoid uninitialized value for safe variant. */
@@ -1095,7 +1095,7 @@ static u64 xen_do_read_msr(unsigned int msr, int *err)return val;if (err) - val =native_read_msr_safe (msr, err); + *err =native_read_msr_safe (msr, &val);else val =native_read_msr (msr);
@@ -1160,9 +1160,12 @@ static void xen_do_write_msr(u32 msr, u64 val, int *err) } } -static u64 xen_read_msr_safe (unsigned int msr,int *err) +static int xen_read_msr_safe (u32 msr,u64 *val) { -return xen_do_read_msr (msr, err); +int err; + + *val =xen_do_read_msr (msr, &err); +return err; }static int xen_write_msr_safe (u32 msr,u64 val)
@@ -1174,7 +1177,7 @@ static int xen_write_msr_safe(u32 msr, u64 val)return err; } -static u64 xen_read_msr (unsigned int msr) +static u64 xen_read_msr (u32 msr) {int err;
arch/x86/xen/pmu.c +8 -6
@@ -319,11 +319,12 @@ static u64 xen_amd_read_pmc(int counter)uint8_t xenpmu_flags =get_xenpmu_flags ();if (!xenpmu_data || !(xenpmu_flags &XENPMU_IRQ_PROCESSING )) { -uint32_t msr; -int err; +u32 msr; +u64 val; msr = amd_counters_base + (counter * amd_msr_step); -return native_read_msr_safe (msr, &err); +native_read_msr_safe (msr, &val); +return val; } ctxt = &xenpmu_data->pmu.c.amd;
@@ -340,15 +341,16 @@ static u64 xen_intel_read_pmc(int counter)uint8_t xenpmu_flags =get_xenpmu_flags ();if (!xenpmu_data || !(xenpmu_flags &XENPMU_IRQ_PROCESSING )) { -uint32_t msr; -int err; +u32 msr; +u64 val;if (counter & (1 <<INTEL_PMC_TYPE_SHIFT )) msr =MSR_CORE_PERF_FIXED_CTR0 + (counter &0xffff );else msr =MSR_IA32_PERFCTR0 + counter; -return native_read_msr_safe (msr, &err); +native_read_msr_safe (msr, &val); +return val; } ctxt = &xenpmu_data->pmu.c.intel;
From: Xin Li (Intel) <[email protected]> Sent: Sunday, April 27, 2025 2:20 AM
Quoted 23 lines
This patch set is the first part of the patch set:
MSR refactor with new MSR instructions support
@ https://lore.kernel.org/lkml/[email protected]/
It's getting *WAY* too big, and whether to zap the
pv_opsMSR APIs is still under argument. Dave Hansen suggested to focus on rename stuff first, most of which he acked.Jürgen Groß also gave his RBs to the Xen MSR cleanup patches.
So here comes the first MSR cleanup patch set with version 4.
Changes in v4:
1) Add missing includes in a different patch (Ilpo Järvinen).
2) Add all necessary direct inclusions formsr.h(Ilpo Järvinen).
3) Remove two "else" that no longer make sense (Juergen Gross).
4) Collect RBs from Jürgen Groß and ABs from Peter Zijlstra.
Quoted 7 lines
Link to the previous v3 patch set:
https://lore.kernel.org/lkml/[email protected]/This patch series is based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitx86/msr
Tested this patch set (plus the v4A version of Patch 1) in VMs on Hyper-V. Tested a normal VM, a TDX VM (with paravisor) and a SEV-SNP VM (with paravisor). No issues found. Since this patch set is just a rename, the risk should be low. But I wanted to make sure there's nothing unexpected happening with Hyper-V and the synthetic MSRs that it presents to guest VMs, as well as with the paravisor configurations.
Quoted 101 lines
Xin Li (Intel) (15):
x86/msr: Add missing includes of <asm/msr.h>
x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h> x86/msr: Removerdpmc()
x86/msr: Renamerdpmcl()tordpmc()
x86/msr: Convert therdpmc()macro into an always inline function x86/xen/msr: Return u64 consistently in Xen PMC read functions x86/msr: Convert__wrmsr()uses to native_wrmsr{,q}() uses x86/msr: Add thenative_rdmsrq()helper
x86/msr: Convert__rdmsr()uses tonative_rdmsrq()uses x86/xen/msr: Remove calling native_{read,write}_msr{,_safe}() inpmu_msr_{read,write}()x86/xen/msr: Remove pmu_msr_{read,write}() x86/xen/msr: Remove the error pointer argument from
set_seg()x86/pvops/msr: refactor pv_cpu_ops.write_msr{,_safe}() x86/msr: Replacewrmsr(msr, low, 0)withwrmsrq(msr, low)x86/msr: Change the function type ofnative_read_msr_safe()arch/x86/coco/sev/core.c | 2 +- arch/x86/events/amd/brs.c | 4 +- arch/x86/events/amd/uncore.c | 2 +- arch/x86/events/core.c | 2 +- arch/x86/events/intel/core.c | 4 +- arch/x86/events/intel/ds.c | 2 +- arch/x86/events/msr.c | 3 + arch/x86/events/perf_event.h | 1 + arch/x86/events/probe.c | 2 + arch/x86/hyperv/hv_apic.c | 6 +- arch/x86/hyperv/hv_vtl.c | 4 +- arch/x86/hyperv/ivm.c | 3 +- arch/x86/include/asm/apic.h | 4 +- arch/x86/include/asm/fred.h | 1 + arch/x86/include/asm/microcode.h | 2 + arch/x86/include/asm/mshyperv.h | 3 +- arch/x86/include/asm/msr.h | 130 +++++------------- arch/x86/include/asm/paravirt.h | 57 ++++---- arch/x86/include/asm/paravirt_types.h | 10 +- arch/x86/include/asm/suspend_32.h | 1 + arch/x86/include/asm/suspend_64.h | 1 + arch/x86/include/asm/switch_to.h | 4 +- arch/x86/include/asm/tsc.h | 76 +++++++++- arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/common.c | 10 +- arch/x86/kernel/cpu/mce/core.c | 6 +- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 25 ++-- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 +- arch/x86/kernel/cpu/umwait.c | 4 +- arch/x86/kernel/fpu/xstate.h | 1 + arch/x86/kernel/hpet.c | 1 + arch/x86/kernel/kvm.c | 2 +- arch/x86/kernel/kvmclock.c | 2 +- arch/x86/kernel/process_64.c | 1 + arch/x86/kernel/trace_clock.c | 2 +- arch/x86/kernel/tsc_sync.c | 1 + arch/x86/kvm/svm/svm.c | 34 ++--- arch/x86/kvm/vmx/vmx.c | 4 +- arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/mem_encrypt_identity.c | 5 +- arch/x86/realmode/init.c | 1 + arch/x86/xen/enlighten_pv.c | 58 ++++---- arch/x86/xen/pmu.c | 72 +++------- arch/x86/xen/xen-ops.h | 5 +- drivers/acpi/acpi_extlog.c | 1 + drivers/acpi/processor_perflib.c | 1 + drivers/acpi/processor_throttling.c | 3 +- drivers/char/agp/nvidia-agp.c | 1 + drivers/cpufreq/amd-pstate-ut.c | 2 + drivers/crypto/ccp/sev-dev.c | 1 + drivers/edac/amd64_edac.c | 1 + drivers/edac/ie31200_edac.c | 1 + drivers/edac/mce_amd.c | 1 + drivers/hwmon/hwmon-vid.c | 4 + drivers/idle/intel_idle.c | 1 + drivers/misc/cs5535-mfgpt.c | 1 + drivers/net/vmxnet3/vmxnet3_drv.c | 4 + drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 1 + drivers/platform/x86/intel/ifs/runtest.c | 1 + drivers/platform/x86/intel/pmc/cnp.c | 1 + .../intel/speed_select_if/isst_if_common.c | 1 + .../intel/speed_select_if/isst_if_mbox_msr.c | 1 + .../intel/speed_select_if/isst_tpmi_core.c | 1 + drivers/platform/x86/intel/turbo_max_3.c | 1 + .../intel/uncore-frequency/uncore-frequency.c | 1 + drivers/powercap/intel_rapl_common.c | 1 + drivers/powercap/intel_rapl_msr.c | 1 + .../processor_thermal_device.c | 1 + drivers/thermal/intel/intel_tcc_cooling.c | 1 + drivers/thermal/intel/x86_pkg_temp_thermal.c | 1 + drivers/video/fbdev/geode/display_gx.c | 1 + drivers/video/fbdev/geode/gxfb_core.c | 1 + drivers/video/fbdev/geode/lxfb_ops.c | 1 + 74 files changed, 308 insertions(+), 295 deletions(-)base-commit:
a5447e92e169dafaf02fd653500105c7186d7128--
2.49.0