Re: [PATCH 06/20] x86/msr: Standardize on 'u32' MSR indices in

Xin Li
2025-04-09T21:57:02Z

On 4/9/2025 1:28 PM, Ingo Molnar wrote:
> @@ -79,7 +79,7 @@ static inline void do_trace_rdpmc(u32 msr, u64 val, int failed) {}
> * think of extending them - you will be slapped with a stinking trout or a frozen
> * shark will reach you, wherever you are! You've been warned.
> */
> -static __always_inline u64 __rdmsr(unsigned int msr)
> +static __always_inline u64 __rdmsr(u32 msr)
> {
> DECLARE_ARGS(val, low, high);
>
> @@ -91,7 +91,7 @@ static __always_inline u64 __rdmsr(unsigned int msr)
> return EAX_EDX_VAL(val, low, high);
> }
>
> -static __always_inline void __wrmsr(unsigned int msr, u32 low, u32 high)
> +static __always_inline void __wrmsr(u32 msr, u32 low, u32 high)
> {
> asm volatile("1: wrmsr\n"
> "2:\n"

It looks to me that we don't use the "const" qualifier in the code a
lot. However since the MSR index is usually not expected to change
inside the MSR API implementations, would it be nicer to add the "const"
qualifier?

The same to the MSR value of MSR write APIs.

Thanks!
Xin