From patchwork Tue Dec 5 19:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 10093635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 14CEB60348 for ; Tue, 5 Dec 2017 19:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0554528657 for ; Tue, 5 Dec 2017 19:03:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE599289DD; Tue, 5 Dec 2017 19:03:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06EF52886F for ; Tue, 5 Dec 2017 19:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=s/8EPikTy5WD0PSc2QtYP9T24G12g+4vr0XMUFpEXEg=; b=GgY Njvv7WK7HcIzo6LXoeOPEL/W6SXAS3mkzWFU65Oc9yOL+ZNL7i6agmy68/rX1sq1z+0ngzGLbcusO V5QYO5RLfQFPAlqM3kMRUVmMAzxTup6tMd/V2AvV1iPygW88PEkyB7lWsxGmeLg3BvGOzQJPnnoKV hPJ54d4TjQKPvU1V2hM6cg1JhooA5viqP2or/YnlCzykqJEcJsKH7joNwGNIKedGqtYsHFO7uCv1u pA86Hn9bL5AJAj+c4bs5ZEjIVp8qHIFGAl6VWBto5BCTsTg+pJ2iwRWQ/LcymvH5KIFONKqB2ETrz ZT95PWhLYfSaVBZLZUAqSFCRWEj9CsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMIVX-0007xl-Av; Tue, 05 Dec 2017 19:03:55 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMIVT-0007va-FD for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2017 19:03:53 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B62016034D; Tue, 5 Dec 2017 19:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1512500610; bh=b9PCvOf8mjWtuwO5NlIZ59+9TNtPwoxIl+iMx/QD0XI=; h=From:To:Cc:Subject:Date:From; b=TrMKdC/ZzSXxxVAT4M3A+mM5XJEx/Su56iatQtgPKeIcZkjgQvf6fTIxAddj2EtAC okojbIctz3WA3LwwA68IU06EbjYHyx4HbJwsOCo1ZgvGNREHe3aAtukeCUwkVBJGla f2h4uaqVZesIegN80NoWOw1eTU5JwSKETOIqLboQ= Received: from shankerd-ubuntu.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: shankerd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5A6186034D; Tue, 5 Dec 2017 19:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1512500610; bh=b9PCvOf8mjWtuwO5NlIZ59+9TNtPwoxIl+iMx/QD0XI=; h=From:To:Cc:Subject:Date:From; b=TrMKdC/ZzSXxxVAT4M3A+mM5XJEx/Su56iatQtgPKeIcZkjgQvf6fTIxAddj2EtAC okojbIctz3WA3LwwA68IU06EbjYHyx4HbJwsOCo1ZgvGNREHe3aAtukeCUwkVBJGla f2h4uaqVZesIegN80NoWOw1eTU5JwSKETOIqLboQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5A6186034D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=shankerd@codeaurora.org From: Shanker Donthineni To: Marc Zyngier , linux-kernel , linux-arm-kernel Subject: [PATCH v2] irqchip/gic-v3: Fix the driver probe() fail due to disabled GICC entry Date: Tue, 5 Dec 2017 13:03:27 -0600 Message-Id: <1512500607-20160-1-git-send-email-shankerd@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171205_110351_552952_E6FC4D7A X-CRM114-Status: GOOD ( 16.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Gleixner , Jason Cooper , Shanker Donthineni MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The ACPI specification says OS shouldn't attempt to use GICC configuration parameters if the flag ACPI_MADT_ENABLED is cleared. The ARM64-SMP code skips the disabled GICC entries but not causing any issue. However the current GICv3 driver probe bails out causing kernel panic() instead of skipping the disabled GICC interfaces. This issues on happens on systems where redistributor regions are not in the always-on power domain and one of GICC interface marked with ACPI_MADT_ENABLED=0. This patch does the two things to fix the panic. - Don't return an error in gic_acpi_match_gicc() for disabled GICC entry. - No need to keep GICR region information for disabled GICC entry. Observed kernel crash on QDF2400 platform GICC entry is disabled. Kernel crash traces: Kernel panic - not syncing: No interrupt controller found. CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.13.5 #26 [] dump_backtrace+0x0/0x218 [] show_stack+0x14/0x20 [] dump_stack+0x98/0xb8 [] panic+0x118/0x26c [] init_IRQ+0x24/0x2c [] start_kernel+0x230/0x394 [] __primary_switched+0x64/0x6c ---[ end Kernel panic - not syncing: No interrupt controller found. Signed-off-by: Shanker Donthineni --- changes since v1: Added a new "if condition" to skip disabled GICC entry and edited commit. drivers/irqchip/irq-gic-v3.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index b56c3e2..606d4d2 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1331,6 +1331,10 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare u32 size = reg == GIC_PIDR2_ARCH_GICv4 ? SZ_64K * 4 : SZ_64K * 2; void __iomem *redist_base; + /* GICC entry which has !ACPI_MADT_ENABLED is not unusable so skip */ + if (!(gicc->flags & ACPI_MADT_ENABLED)) + return 0; + redist_base = ioremap(gicc->gicr_base_address, size); if (!redist_base) return -ENOMEM; @@ -1380,6 +1384,13 @@ static int __init gic_acpi_match_gicc(struct acpi_subtable_header *header, if ((gicc->flags & ACPI_MADT_ENABLED) && gicc->gicr_base_address) return 0; + /* + * It's perfectly valid firmware can pass disabled GICC entry, driver + * should treat an errors, skip the entry. + */ + if (!(gicc->flags & ACPI_MADT_ENABLED)) + return 0; + return -ENODEV; }