From patchwork Thu Apr 4 15:43:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Asselstine X-Patchwork-Id: 233864 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 96B452C00A5 for ; Fri, 5 Apr 2013 02:43:50 +1100 (EST) Received: from localhost ([::1]:51811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNmKK-0003cO-SU for incoming@patchwork.ozlabs.org; Thu, 04 Apr 2013 11:43:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNmJo-0003ZD-LY for qemu-devel@nongnu.org; Thu, 04 Apr 2013 11:43:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNmJf-0005o7-LT for qemu-devel@nongnu.org; Thu, 04 Apr 2013 11:43:16 -0400 Received: from mail.windriver.com ([147.11.1.11]:50640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNmJf-0005nH-B9 for qemu-devel@nongnu.org; Thu, 04 Apr 2013 11:43:07 -0400 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 r34Fh3Xb003163 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 4 Apr 2013 08:43:03 -0700 (PDT) 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.342.3; Thu, 4 Apr 2013 08:43:03 -0700 From: Mark Asselstine To: Date: Thu, 4 Apr 2013 11:43:05 -0400 Message-ID: <1365090185-26920-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][resend] 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 Resending since I would like to get this into the tree. hw/apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/apic.c b/hw/apic.c index d2395f0..e5e3435 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -590,7 +590,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];