public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Tony Luck <tony.luck@intel.com>, Yazen Ghannam <Yazen.Ghannam@amd.com>
Cc: linux-edac <linux-edac@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/4] x86/mce/mce-inject: Preset the MCE injection struct
Date: Tue,  6 Jun 2017 11:32:50 +0200	[thread overview]
Message-ID: <20170606093250.28071-5-bp@alien8.de> (raw)
In-Reply-To: <20170606093250.28071-1-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

Populate the MCE injection struct before doing initial injection so that
values which don't change have sane defaults.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce-inject.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index 2f2312bcf936..1893249c1971 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -103,6 +103,13 @@ DEFINE_SIMPLE_ATTRIBUTE(misc_fops, inj_misc_get, inj_misc_set, "%llx\n");
 DEFINE_SIMPLE_ATTRIBUTE(addr_fops, inj_addr_get, inj_addr_set, "%llx\n");
 DEFINE_SIMPLE_ATTRIBUTE(synd_fops, inj_synd_get, inj_synd_set, "%llx\n");
 
+static void setup_inj_struct(struct mce *m)
+{
+	memset(m, 0, sizeof(struct mce));
+
+	m->cpuvendor = boot_cpu_data.x86_vendor;
+}
+
 /* Update fake mce registers on current CPU. */
 static void inject_mce(struct mce *m)
 {
@@ -700,6 +707,8 @@ static int inject_init(void)
 	register_nmi_handler(NMI_LOCAL, mce_raise_notify, 0, "mce_notify");
 	mce_register_injector_chain(&inject_nb);
 
+	setup_inj_struct(&i_mce);
+
 	pr_info("Machine check injector initialized\n");
 
 	return 0;
-- 
2.13.0

  parent reply	other threads:[~2017-06-06  9:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  9:32 [PATCH 0/4] RAS: Merge mce_amd_inj into mce-inject Borislav Petkov
2017-06-06  9:32 ` [PATCH 1/4] x86/mce: " Borislav Petkov
2017-06-06  9:32 ` [PATCH 2/4] x86/mce: Get rid of register_mce_write_callback() Borislav Petkov
2017-06-06  9:32 ` [PATCH 3/4] x86/mce: Cleanup include files Borislav Petkov
2017-06-06  9:32 ` Borislav Petkov [this message]
2017-06-06 13:36 ` [PATCH 0/4] RAS: Merge mce_amd_inj into mce-inject Ghannam, Yazen
2017-06-06 13:39   ` Borislav Petkov

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=20170606093250.28071-5-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=Yazen.Ghannam@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.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