From patchwork Tue Feb 26 19:48:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Asselstine X-Patchwork-Id: 223381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D2EA82C0084 for ; Wed, 27 Feb 2013 06:48:44 +1100 (EST) Received: from localhost ([::1]:52054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAQW3-0003xq-36 for incoming@patchwork.ozlabs.org; Tue, 26 Feb 2013 14:48:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAQVs-0003wy-NT for qemu-devel@nongnu.org; Tue, 26 Feb 2013 14:48:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAQVo-00076s-Ad for qemu-devel@nongnu.org; Tue, 26 Feb 2013 14:48:32 -0500 Received: from mail1.windriver.com ([147.11.146.13]:45977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAQVo-000752-2T for qemu-devel@nongnu.org; Tue, 26 Feb 2013 14:48:28 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.14.5/8.14.3) with ESMTP id r1QJmORG021249 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Tue, 26 Feb 2013 11:48:25 -0800 (PST) Received: from yow-masselst-d1.wrs.com (128.224.146.23) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.2.328.9; Tue, 26 Feb 2013 11:48:23 -0800 From: Mark Asselstine To: Date: Tue, 26 Feb 2013 14:48:32 -0500 Message-ID: <1361908112-30634-1-git-send-email-mark.asselstine@windriver.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-Originating-IP: [128.224.146.23] X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 147.11.146.13 Cc: mark.asselstine@windriver.com Subject: [Qemu-devel] [PATCH] apic: fixup fallthrough to PIC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC interrupts through the local APIC if the local APIC config says so.] missed a check to ensure the local APIC is enabled. Since if the local APIC is disabled it doesn't matter what the local APIC config says. If this check isn't done and the guest has disabled the local APIC the guest will receive a general protection fault, similar to what is seen here: https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html The GPF is caused by an attempt to service interrupt 0xffffffff. This comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() (with the local APIC disabled apic_get_interrupt() returns -1). apic_accept_pic_intr() returns 0 and thus the interrupt number which is returned from cpu_get_pic_interrupt(), and which is attempted to be serviced, is -1. Signed-off-by: Mark Asselstine --- The GPF only happens on occasion when you shutdown a linux guest using 'poweroff -f' but I am able to get it to reproduce nearly 100% of the time by attaching gdb to the Qemu backend, breaking at 'lapic_shutdown' and stepping through the remainder of the shutdown. Mark hw/apic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/apic.c b/hw/apic.c index fd14b73..051bd3e 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -591,6 +591,8 @@ int apic_accept_pic_intr(DeviceState *d) if (!s) return -1; + if (!(s->spurious_vec & APIC_SV_ENABLE)) + return -1; lvt0 = s->lvt[APIC_LVT_LINT0];