lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUgSd6Sl/bFaGydO@agluck-desk2.amr.corp.intel.com>
Date:   Sun, 19 Sep 2021 21:47:51 -0700
From:   "Luck, Tony" <tony.luck@...el.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Yazen Ghannam <Yazen.Ghannam@....com>, X86 ML <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ