From: "Christoph Egger" Subject: Re: RFC: MCA/MCE concept Date: Thu, 21 Jun 2007 11:29:25 +0200 Message-ID: <200706211129.26086.Christoph.Egger@amd.com> References: <200705291732.46709.Christoph.Egger@amd.com> <200706061128.02752.Christoph.Egger@amd.com> <46712D90.20208@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <46712D90.20208@sun.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Gavin Maltby , Jan Beulich List-Id: xen-devel@lists.xenproject.org On Thursday 14 June 2007 13:59:12 Gavin Maltby wrote: > On 06/06/07 10:28, Christoph Egger wrote: > > On Monday 04 June 2007 18:16:56 Gavin Maltby wrote: > >> In terms of the form of the error event data, the simplest but also > >> the dumbest would be a binary structure passed from hypervisor > >> to dom0: > > > > struct mca_error_data_ver1 { > > uint8_t version; /* structure version */ > > uint64_t mc_status; > > uint64_t mc_addr; > > uint64_t mc_misc; > > uint16_t mc_chip; > > uint16_t mc_core; > > uint16_t mc_bank; > > uint16_t domid; > > uint16_t vcpu_id; > > ... > > }; > > Since there are multiple MCA detector banks, and more than > one may have logged a valid error, we need to think about > communicating all the bank error telemetry. This should > also allow for there being varying numbers of MCA banks in > different proccessor types. So something like > > struct { > uint8_t version; > uint8_t nbanks; > uint16_t flags; > uint16_t domid; > uint16_t vcpud_id; /* if meaningful? */ > uint8_t chipid; > uint8_t coreid; > uint64_t mcg_status; > struct { > mc_status; > mc_addr; > mc_misc; > } bank[1]; > }; > > The bank array is actually sized as per nbanks. > > I've added mcg_status and flags. The latter I'd like to use > for indicators such as "this error data was artificially injected" > etc. Here is my proposal for a real exensible event structure: #define MCA_TYPE_COMMON 0 #define MCA_TYPE_BANK 1 #define MCA_TYPE_ALLBANKS 2 =2E.. #define MCA_COMMON \ size_t size; /* size of this struct in bytes */ uint32_t type; /* structure type */ uint16_t domid; uint8_t chipid; uint8_t coreid; uint64_t mcg_status; /* global status */ The base structure: struct mca_event { MCA_COMMON; }; The specific structs: struct mca_event_bank { MCA_COMMON; uint16_t vcpu_id; uint16_t mc_bank; uint64_t mc_status; uint64_t mc_addr; uint64_t mc_misc; uint32_t flags; }; struct mca_event_allbanks { MCA_COMMON; uint16_t vcpud_id; uint8_t nbanks; uint32_t flags; struct { uint64_t mc_status; uint64_t mc_addr; uint64_t mc_misc; } bank[1]; }; And you can have many more structs to support future features. In the code you allocate the size of the struct you want to use: struct mca_event *mca =3D malloc(sizeof(struct mca_event_bank)); mca->size =3D sizeof(struct mca_event_bank); mca->type =3D MCA_TYPE_BANK; in this example you can cast from mca_event to mca_event_bank and back whenever you like. The generic code only needs to know struct mca_event. Christoph =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy