From patchwork Tue Feb 26 21:22:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Asselstine X-Patchwork-Id: 223432 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 E93A82C0080 for ; Wed, 27 Feb 2013 11:08:10 +1100 (EST) Received: from localhost ([::1]:37600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAUZ6-00043h-EW for incoming@patchwork.ozlabs.org; Tue, 26 Feb 2013 19:08:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAUYv-00043c-Fu for qemu-devel@nongnu.org; Tue, 26 Feb 2013 19:08:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAUYr-0005tl-HA for qemu-devel@nongnu.org; Tue, 26 Feb 2013 19:07:57 -0500 Received: from mail.windriver.com ([147.11.1.11]:56990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAUYr-0005rm-3n for qemu-devel@nongnu.org; Tue, 26 Feb 2013 19:07:53 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail.windriver.com (8.14.5/8.14.3) with ESMTP id r1QLMbat024354 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 26 Feb 2013 13:22:37 -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 13:22:37 -0800 From: Mark Asselstine To: Date: Tue, 26 Feb 2013 16:22:42 -0500 Message-ID: <1361913762-22777-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: Windows NT kernel [generic] [fuzzy] X-Received-From: 147.11.1.11 Cc: mark.asselstine@windriver.com, jan.kiszka@web.de Subject: [Qemu-devel] [PATCH v2] 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 --- *v2* moved the checks to a single line hw/apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/apic.c b/hw/apic.c index fd14b73..c2dac72 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -589,7 +589,7 @@ int apic_accept_pic_intr(DeviceState *d) APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d); uint32_t lvt0; - if (!s) + if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) return -1; lvt0 = s->lvt[APIC_LVT_LINT0];