linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-edac@vger.kernel.org,
	linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org,
	Tony Luck <tony.luck@intel.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>, Ard Biesheuvel <ardb@kernel.org>,
	Punit Agrawal <punit1.agrawal@toshiba.co.jp>,
	Yazen Ghannam <yazen.ghannam@amd.com>
Subject: Re: [PATCH v5] cper, apei, mce: Pass x86 CPER through the MCA handling chain
Date: Fri, 6 Nov 2020 13:09:23 +0100	[thread overview]
Message-ID: <20201106120923.GB14914@zn.tnic> (raw)
In-Reply-To: <20201103164952.5126-1-Smita.KoralahalliChannabasappa@amd.com>

On Tue, Nov 03, 2020 at 10:49:52AM -0600, Smita Koralahalli wrote:
> diff --git a/arch/x86/kernel/cpu/mce/apei.c b/arch/x86/kernel/cpu/mce/apei.c
> index af8d37962586..f56f0bc147e2 100644
> --- a/arch/x86/kernel/cpu/mce/apei.c
> +++ b/arch/x86/kernel/cpu/mce/apei.c
> @@ -51,6 +51,62 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err)
>  }
>  EXPORT_SYMBOL_GPL(apei_mce_report_mem_error);
>  
> +int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id)
> +{
> +	const u64 *i_mce = ((const u64 *) (ctx_info + 1));
> +	unsigned int cpu;
> +	struct mce m;
> +
> +	if (!boot_cpu_has(X86_FEATURE_SMCA))
> +		return -EINVAL;
> +
> +	/*
> +	 * The starting address of the Register Array extracted from BERT
> +	 * must match with the first expected register in the register
> +	 * layout of MCAX address space. In SMCA systems this address
> +	 * corresponds to banks's MCA_STATUS register.

So which is it "MCAX" or "SMCA"? They both denote the same thing but
let's stick to one to avoid unnecessary confusion. I'm guessing to
"SMCA" because it is more wide-spread in the kernel...

> +	 *
> +	 * The Register array size must be large enough to include all
> +	 * the SMCA registers which we want to extract.
> +	 *
> +	 * The number of registers in the Register Array is determined
> +	 * by Register Array Size/8 as defined in UEFI spec v2.8, sec
> +	 * N.2.4.2.2. The register layout is fixed and currently the raw
> +	 * data in the register array includes 6 SMCA registers which the
> +	 * kernel can extract.
> +	 */
> +
> +	if ((ctx_info->msr_addr & MSR_AMD64_SMCA_MC0_STATUS) !=
> +	    MSR_AMD64_SMCA_MC0_STATUS || ctx_info->reg_arr_size < 48)
> +		return -EINVAL;

Split that if in two consecutive if-statements.

Also, why the ANDing and not simply do:

	if (ctx_info->msr_addr == MSR_AMD64_SMCA_MC0_STATUS)

?

I'm guessing you wanna match *all* MCi_STATUS MSRs - not only MC0, yes?

If so, document that with in the comment above it.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  parent reply	other threads:[~2020-11-06 12:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 16:49 [PATCH v5] cper, apei, mce: Pass x86 CPER through the MCA handling chain Smita Koralahalli
2020-11-06  5:36 ` Punit Agrawal
2020-11-06 12:09   ` Borislav Petkov
2020-11-09  1:18     ` Punit Agrawal
2020-11-09 19:05       ` Smita Koralahalli Channabasappa
2020-11-11 20:37         ` Smita Koralahalli Channabasappa
2020-11-13  1:40           ` Punit Agrawal
2020-11-06 12:09 ` Borislav Petkov [this message]
2020-11-09 18:36   ` Smita Koralahalli Channabasappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201106120923.GB14914@zn.tnic \
    --to=bp@alien8.de \
    --cc=Smita.KoralahalliChannabasappa@amd.com \
    --cc=ardb@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=punit1.agrawal@toshiba.co.jp \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).