lkml.org 
[lkml]   [2021]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] x86/mce: Get rid of msr_ops
On Fri, Sep 17, 2021 at 12:53:54PM +0200, Borislav Petkov wrote:
> + switch (reg) {
> + case MCA_CTL:
> + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_CTL(bank)
> + : MSR_IA32_MCx_CTL(bank);
>
> -static inline u32 smca_ctl_reg(int bank)
> -{
> - return MSR_AMD64_SMCA_MCx_CTL(bank);
> -}
> + case MCA_STATUS:
> + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_STATUS(bank)
> + : MSR_IA32_MCx_STATUS(bank);
>
> -static inline u32 smca_status_reg(int bank)
> -{
> - return MSR_AMD64_SMCA_MCx_STATUS(bank);
> -}
> + case MCA_ADDR:
> + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_ADDR(bank)
> + : MSR_IA32_MCx_ADDR(bank);
>
> -static inline u32 smca_addr_reg(int bank)
> -{
> - return MSR_AMD64_SMCA_MCx_ADDR(bank);
> -}
> + case MCA_MISC:
> + return mce_flags.smca ? MSR_AMD64_SMCA_MCx_MISC(bank)
> + : MSR_IA32_MCx_MISC(bank);
> + default: break;
> + }

I think this would be easier on the eyeballs with
a couple of helper functions:

if (mce_flags.smca)
return smca_msr_number(bank, reg);
else
return msr_number(bank, reg);

with the switch (reg) in each of those helper functions.

-Tony

\
 
 \ /
  Last update: 2021-09-20 06:48    [W:0.653 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site