Add a machine-check architecture extension header that provides VMM-wide access to the extension. From: Philip Soltero --- palacios/include/extensions/ext_mcheck.h | 95 ++++++++++++++++++++++++++++++ palacios/src/extensions/ext_mcheck.c | 53 ----------------- 2 files changed, 96 insertions(+), 52 deletions(-) create mode 100644 palacios/include/extensions/ext_mcheck.h diff --git a/palacios/include/extensions/ext_mcheck.h b/palacios/include/extensions/ext_mcheck.h new file mode 100644 index 0000000..02a4ca2 --- /dev/null +++ b/palacios/include/extensions/ext_mcheck.h @@ -0,0 +1,95 @@ +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Copyright (c) 2008, Philip Soltero + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Philip Soltero + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ + +/** + * @file Virtualized machine-check architecture. + * + * @author Philip Soltero + */ + +#ifndef EXT_MCHECK_H_ +#define EXT_MCHECK_H_ + +#include +#include + +/** + * MCA status low and high registers, MC4_STAT, MSR0000_0411. + */ +struct mc4_stat_msr { + union { + uint64_t value; + struct { + uint_t syndrome : 8; + uint_t reserved : 3; + uint_t error_code_ext : 5; + uint_t error_code : 16; + uint_t err_cpu : 4; + uint_t ltd_link : 4; + uint_t scrub : 1; + uint_t sublink : 1; + uint_t mca_stat_sub_cache : 2; + uint_t reserved_01 : 1; + uint_t uecc : 1; + uint_t cecc : 1; + uint_t syndrome2 : 8; + uint_t reserved_02 : 1; + uint_t err_cpu_val : 1; + uint_t pcc : 1; + uint_t addr_v : 1; + uint_t misc_v : 1; + uint_t en : 1; + uint_t uc : 1; + uint_t over : 1; + uint_t val : 1; + }__attribute__((packed)); + }__attribute__((packed)); +} __attribute__((packed)); + +/** + * MCA address low and high registers, MC4_ADDR, MSR0000_0412. + */ +struct mc4_addr_msr { + union { + uint64_t value; + + struct { + uint64_t addr32 : 36; + uint32_t reserved : 28; + } __attribute__((packed)); + + uint64_t addr64; + } __attribute__((packed)); +} __attribute__((packed)); + +/** + * Inject a northbridge machine-check exception on the specified core. + * + * @param stat The contents of the northbridge STAT MSR. + * @param addr The contents of the northbridge ADDR MSR. + */ +int v3_mcheck_inject_nb_mce(struct v3_vm_info * const vm, const uint32_t cpu, + const struct mc4_stat_msr stat, + const struct mc4_addr_msr addr); + + +#endif /* EXT_MCHECK_H_ */ diff --git a/palacios/src/extensions/ext_mcheck.c b/palacios/src/extensions/ext_mcheck.c index 51605ae..1909fac 100644 --- a/palacios/src/extensions/ext_mcheck.c +++ b/palacios/src/extensions/ext_mcheck.c @@ -29,6 +29,7 @@ // TODO: CPUID field add failure. // IF adding CPUID fields fails on the second hook there is no way to back out of the first add. +#include #include #include #include @@ -96,58 +97,6 @@ static const uint32_t ia32_mci_bases[] = { 0x0400, 0x0404, 0x0408, 0x040c, #define MCi_ADDR 0x02 #define MCi_MISC 0x03 - - - -/** - * MCA status low and high registers, MC4_STAT, MSR0000_0411. - */ -struct mc4_stat_msr { - union { - uint64_t value; - struct { - uint_t syndrome : 8; - uint_t reserved : 3; - uint_t error_code_ext : 5; - uint_t error_code : 16; - uint_t err_cpu : 4; - uint_t ltd_link : 4; - uint_t scrub : 1; - uint_t sublink : 1; - uint_t mca_stat_sub_cache : 2; - uint_t reserved_01 : 1; - uint_t uecc : 1; - uint_t cecc : 1; - uint_t syndrome2 : 8; - uint_t reserved_02 : 1; - uint_t err_cpu_val : 1; - uint_t pcc : 1; - uint_t addr_v : 1; - uint_t misc_v : 1; - uint_t en : 1; - uint_t uc : 1; - uint_t over : 1; - uint_t val : 1; - }__attribute__((packed)); - }__attribute__((packed)); -} __attribute__((packed)); - -/** - * MCA address low and high registers, MC4_ADDR, MSR0000_0412. - */ -struct mc4_addr_msr { - union { - uint64_t value; - - struct { - uint64_t addr32 : 36; - uint32_t reserved : 28; - } __attribute__((packed)); - - uint64_t addr64; - } __attribute__((packed)); -} __attribute__((packed)); - /** * Global machine-check capabilities register, MCG_CAP. */