From patchwork Sun Aug 26 04:24:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 1374511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5E997DF280 for ; Sun, 26 Aug 2012 04:33:06 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T5URM-000616-CA; Sun, 26 Aug 2012 04:27:12 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T5URI-00060s-5a for linux-arm-kernel@lists.infradead.org; Sun, 26 Aug 2012 04:27:08 +0000 Received: by qafk1 with SMTP id k1so1194498qaf.15 for ; Sat, 25 Aug 2012 21:27:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=/O3I4fbgioEfVhCW+wxKEIZpgnOEvpFkksRbxDpJQWw=; b=J6EQb9PIqTptabyu2+W6+/hIzClrM24m1D7UJgrnSR1FEnH7p/YwbTKb+bPQH/Febm C4ql0YKVlXJ8BReRLgkBdxatk22vIMgI+b/Zv0Xm8LKqAmBNZEFWegaXcP1P0pAFjquH 5pO75tKt5y17WoTeFOuYbhHsOP4BETPu430UlL8rh8XNNHhxV62C8vgoGL3ropMm5+dY AJnYM0rDT1vslnEgT4FaKoeksQK7hBarg3KmrUy/DHgOQ9i7zvGOp1DUWt/YKxuUlke1 rijZ+4hMSc1/D7AMj0P9AaLVwzd8N5efbx7qsn3ilvrQQ9ShHCCrsiTAxtz0d5VnGRtj X3mQ== Received: by 10.229.106.84 with SMTP id w20mr5065799qco.1.1345955225748; Sat, 25 Aug 2012 21:27:05 -0700 (PDT) Received: from localhost (ip-64-134-230-8.public.wayport.net. [64.134.230.8]) by mx.google.com with ESMTPS id y4sm7046368qan.7.2012.08.25.21.27.03 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 25 Aug 2012 21:27:04 -0700 (PDT) Date: Sat, 25 Aug 2012 21:24:40 -0700 From: Anton Vorontsov To: Russell King , Catalin Marinas Subject: Re: [PATCH 0/9] Get rid of FIQ_START/enable/disable_fiq() + some FIQ cleanups Message-ID: <20120826042437.GA26164@lizard> References: <20120805230238.GA1663@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120805230238.GA1663@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnqDoh7R7UY8khkhYsx4fbH5FizwtZG22PA1vLyVJd4TDlaqY1XAFi2kU2s+ySKHdP8bG5a X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-kernel@lists.linaro.org, Sascha Hauer , patches@linaro.org, Tony Lindgren , Mark Brown , linux-kernel@vger.kernel.org, Kukjin Kim , John Stultz , Ben Dooks , kernel-team@android.com, Liam Girdwood , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hello Russell, On Sun, Aug 05, 2012 at 04:02:38PM -0700, Anton Vorontsov wrote: > During KDB FIQ patches review you mentioned that I should not introduce > another FIQ_START. It seems that in v3.6-rc the FIQ_START issue was > somewhat band-aided, i.e. machines don't necessary need to define this > stuff any longer, but I also read the background of the issue, and you > once said that you don't want the FIQ subsystem to mess with genirq. Just wonder if you had a chance to look into this patch set... Plus, I also realized that maybe it's a good time to get rid of init_FIQ() altogether? Maybe there are some not so obvious reasons for its existence, but if not, does the following patch on top of this series makes sense? (Also, I noticed that we save no_fiq_insn w/o bothering about !CONFIG_CPU_USE_DOMAINS case, but set_fiq_handler() has a special handling for this. I wonder, was that on purpose, e.g. it does not matter for init_FIQ(), or it was just overlooked? In latter case, the patch fixes the issue.) - - - - [PATCH] ARM: FIQ: Get rid of init_FIQ() The function only saves initial arch-specific "no FIQ" instruction, by placing the code into set_fiq_handler() we can: - Have less code and logic in the platform-specific files; - Have the code that manages FIQ vector overwriting in one place, i.e. not spread the logic around (both code placement wise and execution time wise). Signed-off-by: Anton Vorontsov --- arch/arm/include/asm/mach/irq.h | 2 -- arch/arm/kernel/fiq.c | 17 ++++++++--------- arch/arm/mach-rpc/irq.c | 2 -- arch/arm/plat-mxc/avic.c | 3 --- arch/arm/plat-mxc/tzic.c | 3 --- arch/arm/plat-s3c24xx/irq.c | 2 -- 6 files changed, 8 insertions(+), 21 deletions(-) diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h index 8be5ba9..6e70ae3 100644 --- a/arch/arm/include/asm/mach/irq.h +++ b/arch/arm/include/asm/mach/irq.h @@ -18,10 +18,8 @@ struct seq_file; * This is internal. Do not use it. */ #ifdef CONFIG_FIQ -extern void init_FIQ(void); extern void show_fiq_list(struct seq_file *, int); #else -static inline void init_FIQ(void) {} static inline void show_fiq_list(struct seq_file *p, int prec) {} #endif diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c index 9bf3a60..3602df6 100644 --- a/arch/arm/kernel/fiq.c +++ b/arch/arm/kernel/fiq.c @@ -49,6 +49,7 @@ #include static unsigned long no_fiq_insn; +static int got_no_fiq_insn; /* Default reacquire function * - we always relinquish FIQ control @@ -78,11 +79,14 @@ void show_fiq_list(struct seq_file *p, int prec) void set_fiq_handler(void *start, unsigned int length) { -#if defined(CONFIG_CPU_USE_DOMAINS) - memcpy((void *)0xffff001c, start, length); -#else - memcpy(vectors_page + 0x1c, start, length); + unsigned long *addr = (void *)0xffff001c; + +#ifndef CONFIG_CPU_USE_DOMAINS + addr = vectors_page + 0x1c; #endif + if (!cmpxchg(&got_no_fiq_insn, 0, 1)) + no_fiq_insn = *addr; + memcpy(addr, start, length); flush_icache_range(0xffff001c, 0xffff001c + length); if (!vectors_high()) flush_icache_range(0x1c, 0x1c + length); @@ -126,8 +130,3 @@ EXPORT_SYMBOL(__set_fiq_regs); /* defined in fiqasm.S */ EXPORT_SYMBOL(__get_fiq_regs); /* defined in fiqasm.S */ EXPORT_SYMBOL(claim_fiq); EXPORT_SYMBOL(release_fiq); - -void __init init_FIQ(void) -{ - no_fiq_insn = *(unsigned long *)0xffff001c; -} diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c index 07770c8..2d915ba 100644 --- a/arch/arm/mach-rpc/irq.c +++ b/arch/arm/mach-rpc/irq.c @@ -151,7 +151,5 @@ void __init rpc_init_irq(void) break; } } - - init_FIQ(); } diff --git a/arch/arm/plat-mxc/avic.c b/arch/arm/plat-mxc/avic.c index 426980c..b173dc6 100644 --- a/arch/arm/plat-mxc/avic.c +++ b/arch/arm/plat-mxc/avic.c @@ -216,8 +216,5 @@ void __init mxc_init_irq(void __iomem *irqbase) for (i = 0; i < 8; i++) __raw_writel(0, avic_base + AVIC_NIPRIORITY(i)); - /* Initialize FIQ */ - init_FIQ(); - printk(KERN_INFO "MXC IRQ initialized\n"); } diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index 8a5a633..889267c 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c @@ -191,9 +191,6 @@ void __init tzic_init_irq(void __iomem *irqbase) for (i = 0; i < 4; i++, irq_base += 32) tzic_init_gc(i, irq_base); - /* Initialize FIQ */ - init_FIQ(); - pr_info("TrustZone Interrupt Controller (TZIC) initialized\n"); } diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c index 531d6a4..66b8856 100644 --- a/arch/arm/plat-s3c24xx/irq.c +++ b/arch/arm/plat-s3c24xx/irq.c @@ -532,8 +532,6 @@ void __init s3c24xx_init_irq(void) int irqno; int i; - init_FIQ(); - irqdbf("s3c2410_init_irq: clearing interrupt status flags\n"); /* first, clear all interrupts pending... */