From patchwork Sun Dec 3 23:21:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 10089471 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 2428260595 for ; Sun, 3 Dec 2017 23:21:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10359286F3 for ; Sun, 3 Dec 2017 23:21:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D66B028A4A; Sun, 3 Dec 2017 23:21:54 +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 7848028AC5 for ; Sun, 3 Dec 2017 23:21:41 +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=7tOwEdFCY1nvoseSMB/ehK6sk4RVpHiU9er/G4x96ac=; b=aD9 jaGXpb1oq2I/NE5hTDPLAZp9K9cDfAZ9q0Tj4wtL5lcjjvH0KSKgg+GmA6MuUksGkIpa0159a6I8R aOSvZyUBdlaUyuo+jUNFAOyxuA2wp2O6UK1N9FScp/6ZOzabV/SXscTeSgqTPolRxZlYWWlV2e2bg 2Fa9EmEyX6hGX7uOEvxGVRWoLwmGFHdfnjoouMxfmqJ/q/kD/c/tLC4Q799t8kCDCVyx+lUsGC07x xWlzXZcRQdefCA+MsfYufXUyFC4ADCBC6sySaqQ+F7iJ0dIotAI3VNXodjTJdClCWSFHHeJHKGAJI 3XhCdb0wXpEGqBYk/ZefWuQ9xx+kxyw==; 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 1eLdZq-0007HT-JF; Sun, 03 Dec 2017 23:21:38 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLdZm-0007Eq-IM for linux-arm-kernel@lists.infradead.org; Sun, 03 Dec 2017 23:21:36 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D1CB4607F7; Sun, 3 Dec 2017 23:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1512343273; bh=72uYwerSWGHWgglU0vVnVEtP6bGeTUXLpWBQVsQv8NI=; h=From:To:Cc:Subject:Date:From; b=ikKbThb+ARWZY6S8SRrBlENBIA2FlGQDCLOOkr1A1d5/VVLIyW6PdbDrDVcd0EbzF OeeEkJslEHScWM6a3wE+OP0NKPTcDlDJhfjsELEMYnOmS2vCz7wAGZFitQmh4et9uN oIL6OSH8csUPatnykGCHbAIfA1xkNsRtnQ9JAzBE= 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 6984E60314; Sun, 3 Dec 2017 23:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1512343273; bh=72uYwerSWGHWgglU0vVnVEtP6bGeTUXLpWBQVsQv8NI=; h=From:To:Cc:Subject:Date:From; b=ikKbThb+ARWZY6S8SRrBlENBIA2FlGQDCLOOkr1A1d5/VVLIyW6PdbDrDVcd0EbzF OeeEkJslEHScWM6a3wE+OP0NKPTcDlDJhfjsELEMYnOmS2vCz7wAGZFitQmh4et9uN oIL6OSH8csUPatnykGCHbAIfA1xkNsRtnQ9JAzBE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6984E60314 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] irqchip/gic-v3: Fix the driver probe() fail due to disabled GICC entry Date: Sun, 3 Dec 2017 17:21:09 -0600 Message-Id: <1512343269-19327-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-20171203_152134_701145_4F0A29FA X-CRM114-Status: GOOD ( 15.92 ) 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 As per MADT specification, it's perfectly valid firmware can pass MADT table to OS with disabled GICC entries. ARM64-SMP code skips those cpu cores to bring online. However the current GICv3 driver probe bails out in this case on systems where redistributor regions are not in the always-on power domain. This patch does the two things to fix the panic. - Don't return an error in gic_acpi_match_gicc() for disabled GICC. - No need to keep GICR region information for disabled GICC. 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. Disabled GICC subtable example: Subtable Type : 0B [Generic Interrupt Controller] Length : 50 Reserved : 0000 CPU Interface Number : 0000003D Processor UID : 0000003D Flags (decoded below) : 00000000 Processor Enabled : 0 Performance Interrupt Trig Mode : 0 Virtual GIC Interrupt Trig Mode : 0 Parking Protocol Version : 00000000 Performance Interrupt : 00000017 Parked Address : 0000000000000000 Base Address : 0000000000000000 Virtual GIC Base Address : 0000000000000000 Hypervisor GIC Base Address : 0000000000000000 Virtual GIC Interrupt : 00000019 Redistributor Base Address : 0000FFFF88F40000 ARM MPIDR : 000000000000000D Efficiency Class : 00 Reserved : 000000 Signed-off-by: Shanker Donthineni --- drivers/irqchip/irq-gic-v3.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index b56c3e2..a30fbac 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; @@ -1374,13 +1378,13 @@ static int __init gic_acpi_match_gicc(struct acpi_subtable_header *header, (struct acpi_madt_generic_interrupt *)header; /* - * If GICC is enabled and has valid gicr base address, then it means - * GICR base is presented via GICC + * If GICC is enabled and has not valid gicr base address, then it means + * GICR base is not presented via GICC */ - if ((gicc->flags & ACPI_MADT_ENABLED) && gicc->gicr_base_address) - return 0; + if ((gicc->flags & ACPI_MADT_ENABLED) && (!gicc->gicr_base_address)) + return -ENODEV; - return -ENODEV; + return 0; } static int __init gic_acpi_count_gicr_regions(void)