From patchwork Fri Aug 25 20:27:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 806017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I+N9s/+2"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xfCR439VDz9sNv for ; Sat, 26 Aug 2017 06:28:13 +1000 (AEST) 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=DtdMmQ/X9UUfuXYnql2CE8G+Nfb7lCM+RqvjZBBGKOM=; b=I+N 9s/+2xnpJr4KphRzeYz6hilwK3yw+KyTx6gG3iDF7oGhMyoDigkxQc+QbUjaPZXDVPVF4Kr9g0Lxp p1ddLLUvsfcVy0ar9J8B+m0L3rjimHmj8y02JfysjGCPMQAW44bQeo1zFpZZijLD28pQjNbpXcgS6 12/mM6uQDFOSxc2pfnEeSQPzjkd+y+AcEDi3hcn24LqU8obeGQuq/yFxmEtVuG+gK+NAYOthKVkEL 1iCc3rF/CoXG7wLGgi6FwPvOVNxYXC9ybAJZCEE8auWSA+7lmd1IZhrAeT6RrrX5KqNAKVMCfUjCR hyyRuPs9kkMTtveY9lU02yRDNGxhSHA==; 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 1dlLD9-0005ZL-8H; Fri, 25 Aug 2017 20:28:11 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dlLD5-0005Go-5a for linux-snps-arc@lists.infradead.org; Fri, 25 Aug 2017 20:28:09 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id ECB4E24E0A35; Fri, 25 Aug 2017 13:27:43 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id D794F437; Fri, 25 Aug 2017 13:27:43 -0700 (PDT) Received: from abrodkin-7440l.internal.synopsys.com (unknown [10.225.15.124]) by mailhost.synopsys.com (Postfix) with ESMTP id 4A4643FB; Fri, 25 Aug 2017 13:27:42 -0700 (PDT) From: Alexey Brodkin To: linux-snps-arc@lists.infradead.org Subject: [PATCH] arc: arcv2: Mask only private-per-core IRQ lines on boot Date: Fri, 25 Aug 2017 23:27:39 +0300 Message-Id: <1503692859-11187-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.7.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170825_132807_337592_107BA42B X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.47.9 listed in wl.mailspike.net] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , Alexey Brodkin , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This fixes a8ec3ee861b6 "arc: Mask individual IRQ lines during core INTC init". Above commit breaks interrupt handling on ARCv2 SMP systems because slave cores are left with common interrupts (those coming form IDU) disabled. And given by default IDU distributes incoming IRQs to all cores following round-robin routine 3 out of 4 interrupts from a particular peripheral won't be served. Solution here is simple but 2-folded: 1. Unconditionally enable all "common" interrupt lines expecting IDU to only route interrupts expectedly (i.e. not before a corresponding handler was installed). 2. All privete-per-core interrupt lines are not covered by IDU so we have to manage them right in the ARC's INTC and so we do now (hwirq < FIRST_EXT_IRQ). Signed-off-by: Alexey Brodkin --- arch/arc/kernel/intc-arcv2.c | 5 +++-- arch/arc/kernel/mcip.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c index cf90714a676d..2db639874849 100644 --- a/arch/arc/kernel/intc-arcv2.c +++ b/arch/arc/kernel/intc-arcv2.c @@ -75,13 +75,14 @@ void arc_init_IRQ(void) * Set a default priority for all available interrupts to prevent * switching of register banks if Fast IRQ and multiple register banks * are supported by CPU. - * Also disable all IRQ lines so faulty external hardware won't + * Also disable private-per-core IRQ lines so faulty external HW won't * trigger interrupt that kernel is not ready to handle. */ for (i = NR_EXCEPTIONS; i < irq_bcr.irqs + NR_EXCEPTIONS; i++) { write_aux_reg(AUX_IRQ_SELECT, i); write_aux_reg(AUX_IRQ_PRIORITY, ARCV2_IRQ_DEF_PRIO); - write_aux_reg(AUX_IRQ_ENABLE, 0); + if (i < FIRST_EXT_IRQ) + write_aux_reg(AUX_IRQ_ENABLE, 0); } /* setup status32, don't enable intr yet as kernel doesn't want */ diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index f61a52b01625..6a889828db4f 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c @@ -303,6 +303,21 @@ idu_of_init(struct device_node *intc, struct device_node *parent) virq = irq_create_mapping(NULL, i + FIRST_EXT_IRQ); BUG_ON(!virq); irq_set_chained_handler_and_data(virq, idu_cascade_isr, domain); + /* + * irq_set_chained_handler_and_data() silently executes + * idu_irq_enable() which leaves us with all common interrupts + * enabled right on start which allows faulty HW to generate + * an interrupt which we are not ready to support yet. + * So explicitly mask freshly set IRQ. + * Note we have to do all that magic because IDU is not a real + * cascaded INTC with N inputs and one upstream output. + * What IDU really does it just mirrors its N inputs to + * N*core_num outputs so we either need to selectively disable + * or enable IRQ lines on upstream INTCs of ARC cores (and do + * it for each and every ARC core in the cluster) or simply mask + * inputs of the IDU just in one place here. + */ + idu_irq_mask_raw(i); } __mcip_cmd(CMD_IDU_ENABLE, 0);