From patchwork Thu Feb 2 10:46:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 139115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 22FA8B71B0 for ; Thu, 2 Feb 2012 21:46:30 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RsuBQ-00056b-Vx for incoming@patchwork.ozlabs.org; Thu, 02 Feb 2012 10:46:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RsuBP-00056W-Tz for fwts-devel@lists.ubuntu.com; Thu, 02 Feb 2012 10:46:27 +0000 Received: from cpc19-craw6-2-0-cust5.croy.cable.virginmedia.com ([77.102.228.6] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RsuBP-0002eY-RO for fwts-devel@lists.ubuntu.com; Thu, 02 Feb 2012 10:46:27 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] cpu: msr: GPF avoidance on BOCHs QEMU systems (LP: #925001) Date: Thu, 2 Feb 2012 10:46:26 +0000 Message-Id: <1328179586-30547-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.8.3 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Bochs firmware based QEMU systems on some configurations get General Protection Faults when running the MSR tests. Since this isn't real hardware that we care about we can just kludge around this by not allowing the MSR tests in Bochs based systems. Signed-off-by: Colin Ian King Tested-by: Chris Van Hoof Acked-by: Keng-Yu Lin --- src/cpu/msr/msr.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/cpu/msr/msr.c b/src/cpu/msr/msr.c index d6aa00e..5de27a7 100644 --- a/src/cpu/msr/msr.c +++ b/src/cpu/msr/msr.c @@ -30,6 +30,8 @@ static fwts_cpuinfo_x86 *cpuinfo; static int msr_init(fwts_framework *fw) { + char *bios_vendor; + if ((cpuinfo = fwts_cpu_get_info(0)) == NULL) { fwts_log_error(fw, "Cannot get CPU info"); return FWTS_ERROR; @@ -45,6 +47,23 @@ static int msr_init(fwts_framework *fw) fwts_log_error(fw, "Cannot detect the number of CPUs on this machine."); return FWTS_ABORTED; } + + /* + * Running MSR tests inside virtual machines such as QEMU with some kernel/kvm + * combinations have been observed to cause GPFs. We kludge around this by + * avoiding MSR tests for a Bochs BIOS based QEMU virtual machine. + */ + if ((bios_vendor = fwts_get("/sys/class/dmi/id/bios_vendor")) != NULL) { + if (strstr(bios_vendor, "Bochs")) { + fwts_log_error(fw, + "MSR test being avoiding inside a virtual machine as " + "this is known to cause General Protection Faults on " + "some configurations."); + free(bios_vendor); + return FWTS_SKIP; + } + free(bios_vendor); + } return FWTS_OK; }