All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Egger" <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Cc: Gavin.Maltby@sun.com, Keir Fraser <keir@xensource.com>
Subject: [PATCH] 2/3: MCA/MCE correctable error handling
Date: Tue, 21 Aug 2007 15:31:38 +0200	[thread overview]
Message-ID: <200708211531.38706.Christoph.Egger@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]


This is patch 2/3.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>


-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: mca_diff2_headers.diff --]
[-- Type: text/x-diff, Size: 5196 bytes --]

diff -r b5fc70fadacc -r a5209d79d241 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h	Fri Aug 17 09:06:44 2007 +0200
+++ b/xen/include/public/arch-x86/xen.h	Fri Aug 17 13:21:40 2007 +0200
@@ -81,6 +81,104 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 32
 
 #ifndef __ASSEMBLY__
+
+/*
+ * Machine Check Architecure:
+ * structs are read-only and used to report all kinds of
+ * correctable and uncorrectable errors detected by the HW.
+ * Dom0 and DomU: register a handler to get notified.
+ * Dom0 only: Correctable errors are reported via VIRQ_MCA
+ * Dom0 and DomU: Uncorrectable errors are reported via nmi handlers
+ */
+#define MC_TYPE_GLOBAL 0
+#define MC_TYPE_BANK   1
+
+struct mcinfo_common {
+    uint16_t type;     /* structure type */
+    uint16_t size;     /* size of this struct in bytes */
+} __attribute__((packed));
+
+
+#define MC_FLAG_CORRECTABLE    (1 << 0)
+#define MC_FLAG_UNCORRECTABLE  (1 << 1)
+/* contains global x86 mc information */
+struct mcinfo_global {
+    struct mcinfo_common common;
+
+    uint16_t mc_domid; 
+    uint16_t mc_socketid;
+    uint16_t mc_coreid;
+    uint16_t mc_vcpu_id;
+    uint64_t mc_gstatus; /* global status */
+    uint32_t mc_flags;
+} __attribute__((packed));
+
+/* contains bank local x86 mc information */
+struct mcinfo_bank {
+    struct mcinfo_common common;
+
+    uint16_t mc_bank; /* bank nr */
+    uint64_t mc_status; /* bank status */
+    uint64_t mc_addr;
+    uint64_t mc_misc;
+} __attribute__((packed));
+
+
+/* sizeof(struct mcinfo_global) + 6 * sizeof(struct mcinfo_bank) == 200.
+ * This is enough space to store mc information of up to six banks.
+ */
+#define MCINFO_MAXSIZE (204 - sizeof(uint32_t))
+
+struct arch_mc_info {
+    /* Number of mcainfo_* entries in mi_data */
+    uint32_t mi_nentries;
+
+    uint8_t mi_data[MCINFO_MAXSIZE];
+};
+typedef struct arch_mc_info arch_mc_info_t;
+
+
+
+/* 
+ * OS's should use these instead of writing their own helper functions
+ * each with its own bugs and drawbacks.
+ */
+/* Prototype:
+ *    uint32_t x86_mcinfo_nentries(struct shared_info *si);
+ */
+#define x86_mcinfo_nentries(_si)    \
+    (_si)->arch.mc_info.mi_nentries
+/* Prototype:
+ *    struct mcinfo_common *x86_mcinfo_first(struct shared_info *si);
+ */
+#define x86_mcinfo_first(_si)       \
+    (struct mcinfo_common *)((_si)->arch.mc_info.mi_data)
+/* Prototype:
+ *    struct mcinfo_common *x86_mcinfo_next(struct mcinfo_common *mic);
+ */
+#define x86_mcinfo_next(_mic)       \
+   (struct mcinfo_common *)((uint8_t *)(_mic) + (_mic)->size)
+
+/* Prototype:
+ *    void x86_mcinfo_lookup(void *ret, struct shared_info *si, uint16_t type);
+ */
+#define x86_mcinfo_lookup(_ret, _si, _type)    \
+    do {                                                        \
+        uint32_t found, i;                                      \
+        struct mcinfo_common *_mic;                             \
+                                                                \
+        _mic = x86_mcinfo_first(_si);                           \
+        found = 0;                                              \
+        for (i = 0; i < x86_mcinfo_nentries(_si); i++) {        \
+            if (_mic->type == (_type))                          \
+                found = 1;                                      \
+            else                                                \
+                _mic = x86_mcinfo_next(_mic);                   \
+        }                                                       \
+        (_ret) = found ? _mic : NULL;                           \
+    } while (0)
+
+
 
 typedef unsigned long xen_ulong_t;
 
@@ -173,6 +271,7 @@ struct arch_shared_info {
     /* Frame containing list of mfns containing list of mfns containing p2m. */
     xen_pfn_t     pfn_to_mfn_frame_list_list;
     unsigned long nmi_reason;
+    struct arch_mc_info mc_info; /* machine check information */
     uint64_t pad[32];
 };
 typedef struct arch_shared_info arch_shared_info_t;
diff -r b5fc70fadacc -r a5209d79d241 xen/include/public/foreign/reference.size
--- a/xen/include/public/foreign/reference.size	Fri Aug 17 09:06:44 2007 +0200
+++ b/xen/include/public/foreign/reference.size	Fri Aug 17 13:21:40 2007 +0200
@@ -13,6 +13,7 @@ arch_vcpu_info            |      24     
 arch_vcpu_info            |      24      16       0
 vcpu_time_info            |      32      32      32
 vcpu_info                 |      64      64      48
-arch_shared_info          |     268     280     272
-shared_info               |    2584    3368    4384
+arch_mc_info              |     204     204       -
+arch_shared_info          |     472     488     272
+shared_info               |    2788    3576    4384
 
diff -r b5fc70fadacc -r a5209d79d241 xen/include/public/foreign/structs.py
--- a/xen/include/public/foreign/structs.py	Fri Aug 17 09:06:44 2007 +0200
+++ b/xen/include/public/foreign/structs.py	Fri Aug 17 13:21:40 2007 +0200
@@ -15,6 +15,7 @@ structs = [ "start_info",
             "arch_vcpu_info",
             "vcpu_time_info",
             "vcpu_info",
+            "arch_mc_info",
             "arch_shared_info",
             "shared_info" ];
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2007-08-21 13:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 13:31 Christoph Egger [this message]
2007-08-21 15:53 ` [PATCH] 2/3: MCA/MCE correctable error handling Jan Beulich
2007-08-22  8:47   ` Christoph Egger
2007-08-22 10:01     ` Jan Beulich
2007-08-22 15:47       ` Christoph Egger
2007-08-22 16:13         ` Keir Fraser
2007-08-23  7:07           ` Christoph Egger
2007-08-23  9:23             ` [PATCH] resend " Christoph Egger
2007-08-23 14:12             ` [PATCH] " Keir Fraser

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=200708211531.38706.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=Gavin.Maltby@sun.com \
    --cc=keir@xensource.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.