linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Juergen Gross <jgross@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] xen/mcelog: drop __MC_MSR_MCGCAP
Date: Mon, 11 Nov 2019 15:45:42 +0100	[thread overview]
Message-ID: <ce1a10f7-ecd1-e4ee-72c3-bc29d914c0e0@suse.com> (raw)
In-Reply-To: <a83f42ad-c380-c07f-7d22-7f19107db5d5@suse.com>

It has never been part of Xen's public interface, and there's therefore
no guarantee for MCG_CAP's value to always be present in array entry 0.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/drivers/xen/mcelog.c
+++ b/drivers/xen/mcelog.c
@@ -222,7 +222,7 @@ static int convert_log(struct mc_info *m
 	struct mcinfo_global *mc_global;
 	struct mcinfo_bank *mc_bank;
 	struct xen_mce m;
-	uint32_t i;
+	unsigned int i, j;
 
 	mic = NULL;
 	x86_mcinfo_lookup(&mic, mi, MC_TYPE_GLOBAL);
@@ -248,7 +248,12 @@ static int convert_log(struct mc_info *m
 	m.socketid = g_physinfo[i].mc_chipid;
 	m.cpu = m.extcpu = g_physinfo[i].mc_cpunr;
 	m.cpuvendor = (__u8)g_physinfo[i].mc_vendor;
-	m.mcgcap = g_physinfo[i].mc_msrvalues[__MC_MSR_MCGCAP].value;
+	for (j = 0; j < g_physinfo[i].mc_nmsrvals; ++j)
+		switch (g_physinfo[i].mc_msrvalues[j].reg) {
+		case MSR_IA32_MCG_CAP:
+			m.mcgcap = g_physinfo[i].mc_msrvalues[j].value;
+			break;
+		}
 
 	mic = NULL;
 	x86_mcinfo_lookup(&mic, mi, MC_TYPE_BANK);
--- a/include/xen/interface/xen-mca.h
+++ b/include/xen/interface/xen-mca.h
@@ -183,7 +183,6 @@ struct mc_info {
 DEFINE_GUEST_HANDLE_STRUCT(mc_info);
 
 #define __MC_MSR_ARRAYSIZE 8
-#define __MC_MSR_MCGCAP 0
 #define __MC_NMSRS 1
 #define MC_NCAPS 7
 struct mcinfo_logical_cpu {


  reply	other threads:[~2019-11-11 14:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 14:43 [PATCH 0/3] xen/mcelog: assorted adjustments Jan Beulich
2019-11-11 14:45 ` Jan Beulich [this message]
2019-11-12 23:55   ` [PATCH 1/3] xen/mcelog: drop __MC_MSR_MCGCAP Boris Ostrovsky
2019-11-11 14:46 ` [PATCH 2/3] xen/mcelog: add PPIN to record when available Jan Beulich
2019-11-13  0:11   ` Boris Ostrovsky
2019-11-13 13:44     ` [Xen-devel] " Jan Beulich
2019-11-13 16:34       ` Boris Ostrovsky
2019-11-11 14:46 ` [PATCH 3/3] xen/mcelog: also allow building for 32-bit kernels Jan Beulich
2019-11-13  0:15   ` Boris Ostrovsky
2019-11-13 13:47     ` [Xen-devel] " Jan Beulich
2019-11-13 14:06       ` Jürgen Groß
2019-11-14  7:54       ` Jürgen Groß
2019-11-14 13:05 ` [PATCH 0/3] xen/mcelog: assorted adjustments Jürgen Groß

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=ce1a10f7-ecd1-e4ee-72c3-bc29d914c0e0@suse.com \
    --to=jbeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).