From patchwork Thu Apr 6 12:48:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96949 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp714121qgd; Thu, 6 Apr 2017 05:49:13 -0700 (PDT) X-Received: by 10.84.177.36 with SMTP id w33mr43297291plb.105.1491482953059; Thu, 06 Apr 2017 05:49:13 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 124si1800045pgg.14.2017.04.06.05.49.12; Thu, 06 Apr 2017 05:49:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846AbdDFMtM (ORCPT + 6 others); Thu, 6 Apr 2017 08:49:12 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:32851 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756471AbdDFMtL (ORCPT ); Thu, 6 Apr 2017 08:49:11 -0400 Received: by mail-pg0-f49.google.com with SMTP id x125so35557477pgb.0 for ; Thu, 06 Apr 2017 05:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4rJBob+GPYFpJvmGHphbfLug5L8LzlwWwaFBFgk5NRI=; b=eFT631Z3vhkNm6NcSlb7GTp//lcfuN41Fd2kjm1331Y2W8nCJWtZJeD3bojWN7jx+d d94zDWFA6r43URLLgUixakXPDLpJ8vulTFof+nBeXfJ9iVCgM48BeQgWfTtmmxPBY2fr zCKAN5YV4p+20/Af8uWt7Jqv130IFnR2aIjZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4rJBob+GPYFpJvmGHphbfLug5L8LzlwWwaFBFgk5NRI=; b=YWmausAJ3xGI10oEkxNsqtxDGDPlBRx8UJg9fF8XFuYsJr8njmE1NeCooDY+yrchPi MFTiXrPFgnS7GtVEpwApjEPkXR9OC2U4vM+i3Ps06D3OEd63gWJgX1YYAK1oaGDCHANa uaC330kIcHnBf7FA8u3+/tO9GDAG+4xY8pCQs9lMqyGpzmr19nMZV21uCpv0YmCJuc4Q Cx6rF3bdtOKIxjIO5/y7IxCoLx2QeWCo1MveQuDFoqZQjFc4ollyHavaXW37ucR9luK1 f40eqHTWmv7tAqQ7+opomnF88SFBHQ/aFFrat+qJ/kVTI72WZ1P2fuD3LXsV3wzUlRfT r2Zw== X-Gm-Message-State: AFeK/H1HLBeevyZamsq7lgzfbt3/sBCsJRBoHx5HMnfd56S9WKWK2xhm+hjwwS3R0UWZE305 X-Received: by 10.98.102.88 with SMTP id a85mr36390080pfc.33.1491482950163; Thu, 06 Apr 2017 05:49:10 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id n7sm3892564pfn.0.2017.04.06.05.49.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 05:49:09 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, james.hogan@imgtec.com, Matt Redfearn , Thomas Gleixner , Paolo Bonzini , Chris Metcalf , Petr Mladek , Paul Burton , Aaron Tomlin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Ralf Baechle Subject: [PATCH for-4.4 1/7] MIPS: Introduce irq_stack Date: Thu, 6 Apr 2017 18:18:54 +0530 Message-Id: <1491482940-1163-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> References: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matt Redfearn Allocate a per-cpu irq stack for use within interrupt handlers. Also add a utility function on_irq_stack to determine if a given stack pointer is within the irq stack for that cpu. Signed-off-by: Matt Redfearn Acked-by: Jason A. Donenfeld Cc: Thomas Gleixner Cc: Paolo Bonzini Cc: Chris Metcalf Cc: Petr Mladek Cc: James Hogan Cc: Paul Burton Cc: Aaron Tomlin Cc: Andrew Morton Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14740/ Signed-off-by: Ralf Baechle (cherry picked from commit fe8bd18ffea5327344d4ec2bf11f47951212abd0) Signed-off-by: Amit Pundir --- arch/mips/include/asm/irq.h | 12 ++++++++++++ arch/mips/kernel/asm-offsets.c | 1 + arch/mips/kernel/irq.c | 11 +++++++++++ 3 files changed, 24 insertions(+) -- 2.7.4 diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 15e0fec..ebb9efb 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h @@ -17,6 +17,18 @@ #include +#define IRQ_STACK_SIZE THREAD_SIZE + +extern void *irq_stack[NR_CPUS]; + +static inline bool on_irq_stack(int cpu, unsigned long sp) +{ + unsigned long low = (unsigned long)irq_stack[cpu]; + unsigned long high = low + IRQ_STACK_SIZE; + + return (low <= sp && sp <= high); +} + #ifdef CONFIG_I8259 static inline int irq_canonicalize(int irq) { diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c index 154e203..ec053ce 100644 --- a/arch/mips/kernel/asm-offsets.c +++ b/arch/mips/kernel/asm-offsets.c @@ -101,6 +101,7 @@ void output_thread_info_defines(void) OFFSET(TI_REGS, thread_info, regs); DEFINE(_THREAD_SIZE, THREAD_SIZE); DEFINE(_THREAD_MASK, THREAD_MASK); + DEFINE(_IRQ_STACK_SIZE, IRQ_STACK_SIZE); BLANK(); } diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index 8eb5af8..dc1180a 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c @@ -25,6 +25,8 @@ #include #include +void *irq_stack[NR_CPUS]; + /* * 'what should we do if we get a hw irq event on an illegal vector'. * each architecture has to answer this themselves. @@ -55,6 +57,15 @@ void __init init_IRQ(void) irq_set_noprobe(i); arch_init_irq(); + + for_each_possible_cpu(i) { + int irq_pages = IRQ_STACK_SIZE / PAGE_SIZE; + void *s = (void *)__get_free_pages(GFP_KERNEL, irq_pages); + + irq_stack[i] = s; + pr_debug("CPU%d IRQ stack at 0x%p - 0x%p\n", i, + irq_stack[i], irq_stack[i] + IRQ_STACK_SIZE); + } } #ifdef CONFIG_DEBUG_STACKOVERFLOW From patchwork Thu Apr 6 12:48:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96950 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp714176qgd; Thu, 6 Apr 2017 05:49:22 -0700 (PDT) X-Received: by 10.84.216.24 with SMTP id m24mr43037127pli.96.1491482962040; Thu, 06 Apr 2017 05:49:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 124si1800045pgg.14.2017.04.06.05.49.21; Thu, 06 Apr 2017 05:49:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756991AbdDFMtU (ORCPT + 6 others); Thu, 6 Apr 2017 08:49:20 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:36688 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756857AbdDFMtQ (ORCPT ); Thu, 6 Apr 2017 08:49:16 -0400 Received: by mail-pg0-f49.google.com with SMTP id g2so34895030pge.3 for ; Thu, 06 Apr 2017 05:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oIM6W3JWgwhacxm915ljVSVBeQBEhShLWURkpWncr7Q=; b=eK5F7a48xMm7ycNVEwk8obW88k3UY0jLg6SyeGNaca5f5/zJ0mQyXGf1CLUrLM3Kd7 di+XFSo2pCtplShTpoPlun9eBfUVe/rTe8qRroDDAomAYdeWDpiZazJqUA3TB55z+Qu6 ryrXxsaj4eDOakDAyWnBmvNY6XVIX3gdqXdE4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oIM6W3JWgwhacxm915ljVSVBeQBEhShLWURkpWncr7Q=; b=n1ng5SKwTBwnS4FQJ5eicrEbqPqkNynILJCcjtXNKwLizF0x0NWjbgEbkYhLJQl0FS 4tGZWvFpAW1LaCiOsxtWdiCw0ytrDH19l6chR5/TF1VCe/aaXfln3bqEVfhMIxt3Ld65 Sp5Y81RYHSaB5+nHQmHNVy7o7X8p2JuaGS4veQueYsNZQYO8iaGyYu0WjbnYIXLfiX3r GwfYgu1r1PbBkKzRspLgQ5qhfa5nV5TJU/lKVye1t+vl5LJ1/I3VmnJs3M5HbkJ4KMDq PlHyDgqCTnrsyPOPihAU199HSMmUkqp54n+6m9P3MuRsOUScXU+eH5n61XIFVDzk6qO0 phlA== X-Gm-Message-State: AFeK/H2Lo+ysFiVazm4/MD12LKt8+Iai4/Qc1nuEwWxy1Kk1W/Ajj6mh68XDwUjiMjLFszmd X-Received: by 10.99.176.5 with SMTP id h5mr36291190pgf.179.1491482954679; Thu, 06 Apr 2017 05:49:14 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id n7sm3892564pfn.0.2017.04.06.05.49.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 05:49:14 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, james.hogan@imgtec.com, Matt Redfearn , Thomas Gleixner , Adam Buchbinder , "Maciej W . Rozycki" , Marcin Nowakowski , Chris Metcalf , Paul Burton , Jiri Slaby , Andrew Morton , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Ralf Baechle Subject: [PATCH for-4.4 2/7] MIPS: Stack unwinding while on IRQ stack Date: Thu, 6 Apr 2017 18:18:55 +0530 Message-Id: <1491482940-1163-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> References: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matt Redfearn Within unwind stack, check if the stack pointer being unwound is within the CPU's irq_stack and if so use that page rather than the task's stack page. Signed-off-by: Matt Redfearn Acked-by: Jason A. Donenfeld Cc: Thomas Gleixner Cc: Adam Buchbinder Cc: Maciej W. Rozycki Cc: Marcin Nowakowski Cc: Chris Metcalf Cc: James Hogan Cc: Paul Burton Cc: Jiri Slaby Cc: Andrew Morton Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/14741/ Signed-off-by: Ralf Baechle (cherry picked from commit d42d8d106b0275b027c1e8992c42aecf933436ea) Signed-off-by: Amit Pundir --- arch/mips/kernel/process.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index fc537d1..8c26eca 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -552,7 +553,19 @@ EXPORT_SYMBOL(unwind_stack_by_address); unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, unsigned long pc, unsigned long *ra) { - unsigned long stack_page = (unsigned long)task_stack_page(task); + unsigned long stack_page = 0; + int cpu; + + for_each_possible_cpu(cpu) { + if (on_irq_stack(cpu, *sp)) { + stack_page = (unsigned long)irq_stack[cpu]; + break; + } + } + + if (!stack_page) + stack_page = (unsigned long)task_stack_page(task); + return unwind_stack_by_address(stack_page, sp, pc, ra); } #endif From patchwork Thu Apr 6 12:48:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96954 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp714348qgd; Thu, 6 Apr 2017 05:49:52 -0700 (PDT) X-Received: by 10.84.254.1 with SMTP id b1mr32765547plm.130.1491482991926; Thu, 06 Apr 2017 05:49:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si1781387pgc.281.2017.04.06.05.49.51; Thu, 06 Apr 2017 05:49:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757251AbdDFMtu (ORCPT + 6 others); Thu, 6 Apr 2017 08:49:50 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:34059 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754986AbdDFMtZ (ORCPT ); Thu, 6 Apr 2017 08:49:25 -0400 Received: by mail-pg0-f48.google.com with SMTP id 21so35597989pgg.1 for ; Thu, 06 Apr 2017 05:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e03TW3BP961XJONVeVWf/niRaGgsgHEGaj12azHxk40=; b=b5xCCUcz0qgxQMkybBkakyWPXnRoNzYsOVkuM0Wv8bF4fK+HRotn+DCQhUShmjCZlJ j9FrwyO/DtrIrOda140yyfiBIzuh+2qbpQuzw5o5snGEccwjC3UaJ3CdbgrDAL9dXpdU zM9AprpqHyoUacj57kwu/fNjdbs+/2ImbgtTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e03TW3BP961XJONVeVWf/niRaGgsgHEGaj12azHxk40=; b=KRdEt7WmQpGegWlN2SunBO3frc0gu78Dp3+d7Y0FpoK/ud8DRhRwWBWOmUX3L8wZHJ FITJaroSh9K6nPu3LDLdC+J9enXPmFDGvMjAXFcsIA8EGcXYL68Frj8xKYxtp5J923if iaPjqchFElCU3Fw1wduq+BJFWtdx4yW6mqKS36OyNbkGGHYXDyUHut36i8WwxTSOr0xp 5LOhMgp0MaEWBEAlNx4mc8YSrHXTQvD2JT1KYEQXZJF/uTPM32nwrN+5VaMv5u6EPBwF pBVhXtgf70b+QUZie+1dHbf16MwZrQyT9GcyhqG6nREtS2Po1RqpO0rGF7JBoN0Yy3sp Uuxw== X-Gm-Message-State: AFeK/H0ItwaKLVVZsFbbXHCmEqJMF23o5+IMqplZvXasIvfRuZeF5MKt1/a4a/UnteOVQm16 X-Received: by 10.99.101.135 with SMTP id z129mr23193663pgb.164.1491482964400; Thu, 06 Apr 2017 05:49:24 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id n7sm3892564pfn.0.2017.04.06.05.49.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 05:49:23 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, james.hogan@imgtec.com, Matt Redfearn , Thomas Gleixner , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Ralf Baechle Subject: [PATCH for-4.4 5/7] MIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK Date: Thu, 6 Apr 2017 18:18:58 +0530 Message-Id: <1491482940-1163-6-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> References: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matt Redfearn Since do_IRQ is now invoked on a separate IRQ stack, we select HAVE_IRQ_EXIT_ON_IRQ_STACK so that softirq's may be invoked directly from irq_exit(), rather than requiring do_softirq_own_stack. Signed-off-by: Matt Redfearn Acked-by: Jason A. Donenfeld Cc: Thomas Gleixner Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/14744/ Signed-off-by: Ralf Baechle (cherry picked from commit 3cc3434fd6307d06b53b98ce83e76bf9807689b9) Signed-off-by: Amit Pundir --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index db45961..49c276c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -9,6 +9,7 @@ config MIPS select HAVE_CONTEXT_TRACKING select HAVE_GENERIC_DMA_COHERENT select HAVE_IDE + select HAVE_IRQ_EXIT_ON_IRQ_STACK select HAVE_OPROFILE select HAVE_PERF_EVENTS select PERF_USE_VMALLOC From patchwork Thu Apr 6 12:48:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96953 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp714316qgd; Thu, 6 Apr 2017 05:49:46 -0700 (PDT) X-Received: by 10.99.94.66 with SMTP id s63mr34092264pgb.34.1491482986173; Thu, 06 Apr 2017 05:49:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si1781387pgc.281.2017.04.06.05.49.45; Thu, 06 Apr 2017 05:49:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757218AbdDFMto (ORCPT + 6 others); Thu, 6 Apr 2017 08:49:44 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:36783 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757069AbdDFMtd (ORCPT ); Thu, 6 Apr 2017 08:49:33 -0400 Received: by mail-pg0-f48.google.com with SMTP id g2so34899967pge.3 for ; Thu, 06 Apr 2017 05:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M+Wr0/kRCYW9Om41/J32EQp75b0fi0lar4DBSBzLHkA=; b=NlW9hbLvIaH0v+XTCNJ5GVOkkhOn4/NC3CtTSNwP1OcXmxop7ddKz3yu3DHKHqVKTB JJsNBDmnjV9mnzGpwthrc9q2H9/lN2tPVc9n8QlWmk4ztD0F0Tg/m2Z9G5HeoGGkFEma L/sInwYDRqDSE225bexbhnTxMv+/DQEr9kNtI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M+Wr0/kRCYW9Om41/J32EQp75b0fi0lar4DBSBzLHkA=; b=gzWm68ueZqZy9L1D3SQ05lf2BJvW/LLKYB6U4SUPWoTGVJC5XH9KFJPyHfyT7mfvms mMvnyd7ldCJsXS+JG+O87XxZw8z1d+MqJ9OgKo25JgNcjrjXzE40xrIGYiljWhAKw6d4 ck7NNd+MU8oc67aFbNhqgwDkHdwitpq4WfpY8dvtqaMW9LfuO1YTpqoasIPUJho7k6md G2GaylGEFgVpL/3zz6DAqEG1J/cZwiwFKNyI+qhJTXiDsbguFoOmKrEXAR56T69m1gyZ QL1+3488S/UzUgszPk88enMVcbw4xD6vlDAJ9oVPitAWgfucQviBGyYlPClx4w1a7HDH 3Asg== X-Gm-Message-State: AFeK/H1FhcZUYGbjKvOVcZobOPJxQdwgA406eFwII3am+SalG2IHLfIX87h5+SI21kwzG9Jf X-Received: by 10.99.185.1 with SMTP id z1mr36339195pge.165.1491482967439; Thu, 06 Apr 2017 05:49:27 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id n7sm3892564pfn.0.2017.04.06.05.49.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 05:49:26 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, james.hogan@imgtec.com, Matt Redfearn , Ralf Baechle , Paul Burton , linux-mips@linux-mips.org Subject: [PATCH for-4.4 6/7] MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch Date: Thu, 6 Apr 2017 18:18:59 +0530 Message-Id: <1491482940-1163-7-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> References: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matt Redfearn Commit dda45f701c9d ("MIPS: Switch to the irq_stack in interrupts") changed both the normal and vectored interrupt handlers. Unfortunately the vectored version, "except_vec_vi_handler", was incorrectly modified to unconditionally jal to plat_irq_dispatch, rather than doing a jalr to the vectored handler that has been set up. This is ok for many platforms which set the vectored handler to plat_irq_dispatch anyway, but will cause problems with platforms that use other handlers. Fixes: dda45f701c9d ("MIPS: Switch to the irq_stack in interrupts") Signed-off-by: Matt Redfearn Cc: Ralf Baechle Cc: Paul Burton Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/15110/ Signed-off-by: James Hogan (cherry picked from commit c25f8064c1d5731a2ce5664def890140dcdd3e5c) Signed-off-by: Amit Pundir --- arch/mips/kernel/genex.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index 2c7cd62..619e30e 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S @@ -330,7 +330,7 @@ NESTED(except_vec_vi_handler, 0, sp) PTR_ADD sp, t0, t1 2: - jal plat_irq_dispatch + jalr v0 /* Restore sp */ move sp, s1 From patchwork Thu Apr 6 12:49:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 96952 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp714313qgd; Thu, 6 Apr 2017 05:49:45 -0700 (PDT) X-Received: by 10.98.32.10 with SMTP id g10mr35217952pfg.37.1491482985547; Thu, 06 Apr 2017 05:49:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si1781387pgc.281.2017.04.06.05.49.45; Thu, 06 Apr 2017 05:49:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757215AbdDFMtm (ORCPT + 6 others); Thu, 6 Apr 2017 08:49:42 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:35085 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757177AbdDFMtf (ORCPT ); Thu, 6 Apr 2017 08:49:35 -0400 Received: by mail-pg0-f46.google.com with SMTP id 81so35574200pgh.2 for ; Thu, 06 Apr 2017 05:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SgcbcNIVf6PVs7VkdNYhv13Y71rJlBahQc+9Wap4k2A=; b=j7hQQXh0NBncW3bfJ1d7vjzathp91X6bwwDEWIlCSDVH+QyWXQBPkDYmxdP6F3qWaH 8g77lZS4f0dVofToMTSxXdP49wy8gesHD5NxVAko/Ov4vNE+OupPqBokidjqJtqf7hRS DBCg3rMuPf9LZQBpseA+2BjqlezKZZ6Ve/KHc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SgcbcNIVf6PVs7VkdNYhv13Y71rJlBahQc+9Wap4k2A=; b=lPYo2yMksIe/xXKh48iSthflmlB7OMXJIyEvbU2tIpGEvG/+/1x3+vPVBdf2S0bBt3 yTc71oPRNKnMna8mv/dgeLOiQSKWJV0InLU2W1CmvOk1buQTBJpU0w2l/SKU4heuzfxV lAsYpiwXt5knjZop0k5miojXqyTrcdtO/h98S2zyg14Igy/YIO9a3xBplZM/kmDybMMK Sc1AfPRyNjxdIz3FORQ8kZo3AVd85F06C/9oiEJD6nHuniZUu2tWlpes2393J98zCEWy yD4+O/DThUpCpYzFegEGsgIECY9LtiwCuPmNsqkAKfVZ6HHjbCTyqdCjT98M/T8+EkXl 54UQ== X-Gm-Message-State: AFeK/H3Nemk94560KFX87DT51CNk6q2o37FLEQfFWvzn06xBANNZdU4vHaQ4SXE09fBP+cSe X-Received: by 10.98.71.149 with SMTP id p21mr35780219pfi.94.1491482969863; Thu, 06 Apr 2017 05:49:29 -0700 (PDT) Received: from localhost.localdomain ([106.51.240.246]) by smtp.gmail.com with ESMTPSA id n7sm3892564pfn.0.2017.04.06.05.49.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 05:49:29 -0700 (PDT) From: Amit Pundir To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, james.hogan@imgtec.com, Felix Fietkau , linux-mips@linux-mips.org Subject: [PATCH for-4.4 7/7] MIPS: Lantiq: Fix cascaded IRQ setup Date: Thu, 6 Apr 2017 18:19:00 +0530 Message-Id: <1491482940-1163-8-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> References: <1491482940-1163-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Felix Fietkau With the IRQ stack changes integrated, the XRX200 devices started emitting a constant stream of kernel messages like this: [ 565.415310] Spurious IRQ: CAUSE=0x1100c300 This is caused by IP0 getting handled by plat_irq_dispatch() rather than its vectored interrupt handler, which is fixed by commit de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch"). Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ for all MIPS CPU interrupts. Signed-off-by: Felix Fietkau Acked-by: John Crispin Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/15077/ [james.hogan@imgtec.com: tweaked commit message] Signed-off-by: James Hogan (cherry picked from commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd) Signed-off-by: Amit Pundir --- arch/mips/lantiq/irq.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) -- 2.7.4 diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c index 2e7f60c..51cdc46 100644 --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c @@ -269,6 +269,11 @@ static void ltq_hw5_irqdispatch(void) DEFINE_HWx_IRQDISPATCH(5) #endif +static void ltq_hw_irq_handler(struct irq_desc *desc) +{ + ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); +} + #ifdef CONFIG_MIPS_MT_SMP void __init arch_init_ipiirq(int irq, struct irqaction *action) { @@ -313,23 +318,19 @@ static struct irqaction irq_call = { asmlinkage void plat_irq_dispatch(void) { unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; - unsigned int i; - - if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) { - do_IRQ(MIPS_CPU_TIMER_IRQ); - goto out; - } else { - for (i = 0; i < MAX_IM; i++) { - if (pending & (CAUSEF_IP2 << i)) { - ltq_hw_irqdispatch(i); - goto out; - } - } + int irq; + + if (!pending) { + spurious_interrupt(); + return; } - pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status()); -out: - 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) @@ -354,11 +355,6 @@ static const struct irq_domain_ops irq_domain_ops = { .map = icu_map, }; -static struct irqaction cascade = { - .handler = no_action, - .name = "cascade", -}; - int __init icu_of_init(struct device_node *node, struct device_node *parent) { struct device_node *eiu_node; @@ -390,7 +386,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) mips_cpu_irq_init(); for (i = 0; i < MAX_IM; i++) - setup_irq(i + 2, &cascade); + irq_set_chained_handler(i + 2, ltq_hw_irq_handler); if (cpu_has_vint) { pr_info("Setting up vectored interrupts\n");