Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6282122imu; Mon, 21 Jan 2019 06:20:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN4qeg0hcNH+Hytpdl64JfniXFdbKa4H1qeo+ulmsMjYJAHP3zS9jh+mJ2zoGF5cs1uoJ66K X-Received: by 2002:a17:902:4124:: with SMTP id e33mr30198508pld.236.1548080407355; Mon, 21 Jan 2019 06:20:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548080407; cv=none; d=google.com; s=arc-20160816; b=uncqOFy397/7HB8OCnlpTRfAVxWnCZZ1HDhVsVX/RvqJB7VDn89UZBJrlXdt99MgvF 6FEGJSGUT/9vLVguW29YJcdbYg81R4xypF8yC1yJjEAOT+xR70bGViysiXH9C2tJ+u+e UrHX5Qtw5iLp+FdWxVbzjrEeJtavlbeDIeXf7QnxG6RQvreChZiYyL1oWaBtH1LCDVy6 eWkyfPlGzt9vThp2BglbL0iyRFNmCratGDatkEgwaUdnYCGhShQWr70NKUHrIQslkYB/ AL3GmD3rlx9fQ/vovPIBv8zUMjOIJ41nFjl4rutqpTIyMsr3n0CZXgjpvqE2/KHHItO8 Rx5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=itmlpqxgBFFQI5esf9QySdIWpYhV8ldnqJxArdcz4/0=; b=QxuJHoG4eDAfsHa/e0bxpc3KDCnLf2gBwjrIWxzfa0CKfEI7qMbLAnEfMqpiRC97CP On6AChUqGB5F4Q1yLvVEUzKwIfcg5WhRo3JBHT6ITh2Bs+1oKwXmxqA/HSGB0BIGusXX I8l6h3b+nZJ8Cxm2l3F95B6VDSddgKKvlz/L3VBNdFfwQraXL9FjYTZwqLDVvyUe2/o/ O5hQdxv2aY3/+KlIgxopiv/qIbIg1QiLNsDb0S4fq3I4f8b0jkWqB8axBTxTi+w5D1Yq pmURtWBtJldI1YrcRcHOWtUfBvApuNWw7Nr8SFjvp3mZEKIlw2D2h5igqYGScMUB5OSD 19zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPdLLdf9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si9622891ple.216.2019.01.21.06.19.48; Mon, 21 Jan 2019 06:20:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPdLLdf9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730438AbfAUNuB (ORCPT + 99 others); Mon, 21 Jan 2019 08:50:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:60714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728918AbfAUNt5 (ORCPT ); Mon, 21 Jan 2019 08:49:57 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B16BB2063F; Mon, 21 Jan 2019 13:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078596; bh=7EYbgfDd7A9XWWIr0i7xh0ydL3UIAFIs/d2GEenepvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wPdLLdf9Ddja9XWYs40RTKgr+aVg+SJKQGlAohx02Cn2FqTAXrWyz/wn5nDsNipob FK3b4LxYQuRoi3eF8iXS0nVaEphpj65Ob25pOzM7eUkzXJXoaNi/DGqW1EdZdU61TB skXggBhbpUfIPaT4/1X3tr7DBIJMikQd6Ju15reo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , Paul Burton , jhogan@kernel.org, ralf@linux-mips.org, john@phrozen.org, linux-mips@linux-mips.org, linux-mips@vger.kernel.org, stable@kernel.org Subject: [PATCH 4.20 050/111] MIPS: lantiq: Fix IPI interrupt handling Date: Mon, 21 Jan 2019 14:42:44 +0100 Message-Id: <20190121122501.451681137@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hauke Mehrtens commit 2b4dba55b04b212a7fd1f0395b41d79ee3a9801b upstream. This makes SMP on the vrx200 work again, by removing all the MIPS CPU interrupt specific code and making it fully use the generic MIPS CPU interrupt controller. The mti,cpu-interrupt-controller from irq-mips-cpu.c now handles the CPU interrupts and also the IPI interrupts which are used to communication between the CPUs in a SMP system. The generic interrupt code was already used before but the interrupt vectors were overwritten again when we called set_vi_handler() in the lantiq interrupt driver and we also provided our own plat_irq_dispatch() function which overwrote the weak generic implementation. Now the code uses the generic handler for the MIPS CPU interrupts including the IPI interrupts and registers a handler for the CPU interrupts which are handled by the lantiq ICU with irq_set_chained_handler() which was already called before. Calling the set_c0_status() function is also not needed any more because the generic MIPS CPU interrupt already activates the needed bits. Fixes: 1eed40043579 ("MIPS: smp-mt: Use CPU interrupt controller IPI IRQ domain support") Cc: stable@kernel.org # v4.12 Signed-off-by: Hauke Mehrtens Signed-off-by: Paul Burton Cc: jhogan@kernel.org Cc: ralf@linux-mips.org Cc: john@phrozen.org Cc: linux-mips@linux-mips.org Cc: linux-mips@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/mips/lantiq/irq.c | 68 +++---------------------------------------------- 1 file changed, 5 insertions(+), 63 deletions(-) --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c @@ -224,9 +224,11 @@ static struct irq_chip ltq_eiu_type = { .irq_set_type = ltq_eiu_settype, }; -static void ltq_hw_irqdispatch(int module) +static void ltq_hw_irq_handler(struct irq_desc *desc) { + int module = irq_desc_get_irq(desc) - 2; u32 irq; + int hwirq; irq = ltq_icu_r32(module, LTQ_ICU_IM0_IOSR); if (irq == 0) @@ -237,7 +239,8 @@ static void ltq_hw_irqdispatch(int modul * other bits might be bogus */ irq = __fls(irq); - do_IRQ((int)irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module)); + hwirq = irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module); + generic_handle_irq(irq_linear_revmap(ltq_domain, hwirq)); /* if this is a EBU irq, we need to ack it or get a deadlock */ if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) @@ -245,49 +248,6 @@ static void ltq_hw_irqdispatch(int modul LTQ_EBU_PCC_ISTAT); } -#define DEFINE_HWx_IRQDISPATCH(x) \ - static void ltq_hw ## x ## _irqdispatch(void) \ - { \ - ltq_hw_irqdispatch(x); \ - } -DEFINE_HWx_IRQDISPATCH(0) -DEFINE_HWx_IRQDISPATCH(1) -DEFINE_HWx_IRQDISPATCH(2) -DEFINE_HWx_IRQDISPATCH(3) -DEFINE_HWx_IRQDISPATCH(4) - -#if MIPS_CPU_TIMER_IRQ == 7 -static void ltq_hw5_irqdispatch(void) -{ - do_IRQ(MIPS_CPU_TIMER_IRQ); -} -#else -DEFINE_HWx_IRQDISPATCH(5) -#endif - -static void ltq_hw_irq_handler(struct irq_desc *desc) -{ - ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); -} - -asmlinkage void plat_irq_dispatch(void) -{ - unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; - int irq; - - if (!pending) { - spurious_interrupt(); - return; - } - - pending >>= CAUSEB_IP; - while (pending) { - irq = fls(pending) - 1; - do_IRQ(MIPS_CPU_IRQ_BASE + irq); - pending &= ~BIT(irq); - } -} - static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { struct irq_chip *chip = <q_irq_type; @@ -343,28 +303,10 @@ int __init icu_of_init(struct device_nod for (i = 0; i < MAX_IM; i++) irq_set_chained_handler(i + 2, ltq_hw_irq_handler); - if (cpu_has_vint) { - pr_info("Setting up vectored interrupts\n"); - set_vi_handler(2, ltq_hw0_irqdispatch); - set_vi_handler(3, ltq_hw1_irqdispatch); - set_vi_handler(4, ltq_hw2_irqdispatch); - set_vi_handler(5, ltq_hw3_irqdispatch); - set_vi_handler(6, ltq_hw4_irqdispatch); - set_vi_handler(7, ltq_hw5_irqdispatch); - } - ltq_domain = irq_domain_add_linear(node, (MAX_IM * INT_NUM_IM_OFFSET) + MIPS_CPU_IRQ_CASCADE, &irq_domain_ops, 0); -#ifndef CONFIG_MIPS_MT_SMP - set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | - IE_IRQ3 | IE_IRQ4 | IE_IRQ5); -#else - set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ0 | IE_IRQ1 | - IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); -#endif - /* tell oprofile which irq to use */ ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ);