From patchwork Mon Oct 15 21:51:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 12248 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 30ABB23EFB for ; Mon, 15 Oct 2012 21:55:08 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id D37BDA18395 for ; Mon, 15 Oct 2012 21:55:07 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so8462174iej.11 for ; Mon, 15 Oct 2012 14:55:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=0czAjkZgqbd3xoKzQUQ68v5wc3s4DaqsJhbMqm+ts10=; b=FpgugU+8HJbR9MukiiAkNHwqvaE5pzubP+C49lrcXGLo28HQMdHLImkixMAoPNdram /lJzrw/ctnWO93+ne06wu3LOfuhZBrPig7cd1ORns0jkglt8xryiyhvHkERUYkzipz0y waKhPsalNzhxacm+4LvCJ/RHZxP3nbMK83z9BaYCPnW/C2R3ZSqX04hLdmgaMnLtDA4a g7hEeiEmB9rPtZ+RLdzZJRFYkrjdKQQih8gvhsiPwcXDJAJ7gWT9lV9mnnvx54P2ci7n 37vXmlhJw75KrvXn1Z7aXgixTn6XGt2k+xojLYpWsjZNyPry5jGF/jhfn9+hghhOhCIQ vhZQ== Received: by 10.50.168.37 with SMTP id zt5mr10006613igb.57.1350338107632; Mon, 15 Oct 2012 14:55:07 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp641673igt; Mon, 15 Oct 2012 14:55:07 -0700 (PDT) Received: by 10.66.81.103 with SMTP id z7mr36268106pax.57.1350338106938; Mon, 15 Oct 2012 14:55:06 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id iv8si24102935pbc.337.2012.10.15.14.55.06 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 14:55:06 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md4so5917726pbc.37 for ; Mon, 15 Oct 2012 14:55:06 -0700 (PDT) Received: by 10.68.136.138 with SMTP id qa10mr41321579pbb.142.1350338106625; Mon, 15 Oct 2012 14:55:06 -0700 (PDT) Received: from localhost (ip-64-134-230-8.public.wayport.net. [64.134.230.8]) by mx.google.com with ESMTPS id pv9sm9618908pbb.67.2012.10.15.14.55.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 14:55:06 -0700 (PDT) From: Anton Vorontsov To: Russell King Cc: John Stultz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com, Ben Dooks , Kukjin Kim , Sascha Hauer , Tony Lindgren , Mark Brown , Liam Girdwood Subject: [PATCH 10/10] ARM: FIQ: Get rid of init_FIQ() Date: Mon, 15 Oct 2012 14:51:34 -0700 Message-Id: <1350337894-9744-10-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.12.3 In-Reply-To: <20121015214954.GA3352@lizard> References: <20121015214954.GA3352@lizard> X-Gm-Message-State: ALoCoQkvEeUVob93F48Vruzz3xSkmRV8hTvgroiqJ/92JQKZzjRzsiED0vgoVZC5QealM6Q8XD+s 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. don't spread the logic around. p.s. Also, I noticed that we saved no_fiq_insn w/o bothering about !CONFIG_CPU_USE_DOMAINS case, but set_fiq_handler() handles this case specifically. I wonder, was that on purpose, e.g. it does not matter for init_FIQ(), or it was just overlooked? In the latter case, the patch fixes the issue. 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... */