linux-mips
[Top] [All Lists]

[PATCH 2/3] MIPS: Loongson: Oprofile: add a new do_perfcnt_IRQ()

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 2/3] MIPS: Loongson: Oprofile: add a new do_perfcnt_IRQ()
From: Wu Zhangjin <wuzhangjin@gmail.com>
Date: Sat, 24 Jul 2010 09:22:14 +0800
Cc: linux-mips@linux-mips.org, Wu Zhangjin <wuzhangjin@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:in-reply-to:references; bh=SMkINm7oc3XoinQ+9LSwvtpaSlM2WwLIYQ4l51GtpzE=; b=mUrQbwbQ80J8z48f1dvVh9POs1Xb1j7QT6nX1/Kc0VDi5W1vKSkRCk5tCI6O2VC/uR 6ImU0sCw1Ar9GR4Z3GjllFB4VtGDVU5OBwziqtt6SH00hKcOCt7GHnyKku42FgvLudLR 6dy82m2D3A6GqKLzMly4DPqDDuzIFaViwH9t8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=HonQ3tJiFz6gfGP2sTsZdHblYxDlUSVPbfz92BEewomNjtUHK1wLdzNt1z3E67ufOx dSlQlWIdG6bBWZ3FqAZpX71dcpY+TOR+3AJAZO121WN+oOd6FUohJaO2AJF/gBICpEDF OwY5zJ6qumQNyZT5xHyxnN6mAQoM8uwUpe6k4=
In-reply-to: <881c93ee3de32e7809f5ac05d0086bc525af57a9.1279934355.git.wuzhangjin@gmail.com>
In-reply-to: <cover.1279934355.git.wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <881c93ee3de32e7809f5ac05d0086bc525af57a9.1279934355.git.wuzhangjin@gmail.com>
References: <cover.1279934355.git.wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
From: Wu Zhangjin <wuzhangjin@gmail.com>

On FuLoong-2F platform, the IP6 is shared by the performance counter
overflow interrupt and the bonito northbridge interrupt, we only enable
the calling to do_IRQ() when the oprofile is enabled(Y|M) to reduce
overhead.

This patch adds an inline function do_perfcnt_IRQ() to hide the #if's ,
which can be shared by the other Loongson machines, i.e. gdium.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/include/asm/mach-loongson/loongson.h |    8 ++++++++
 arch/mips/loongson/fuloong-2e/irq.c            |    2 +-
 arch/mips/loongson/lemote-2f/irq.c             |    4 +---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson/loongson.h 
b/arch/mips/include/asm/mach-loongson/loongson.h
index ef81d9c..0781e1a 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -68,6 +68,14 @@ extern int mach_i8259_irq(void);
 #define LOONGSON_IRQ_BASE      32
 #define LOONGSON2_PERFCNT_IRQ  (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
 
+#include <linux/interrupt.h>
+static inline void do_perfcnt_IRQ(void)
+{
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
+       do_IRQ(LOONGSON2_PERFCNT_IRQ);
+#endif
+}
+
 #define LOONGSON_FLASH_BASE    0x1c000000
 #define LOONGSON_FLASH_SIZE    0x02000000      /* 32M */
 #define LOONGSON_FLASH_TOP     (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
diff --git a/arch/mips/loongson/fuloong-2e/irq.c 
b/arch/mips/loongson/fuloong-2e/irq.c
index 99e08c3..d61a042 100644
--- a/arch/mips/loongson/fuloong-2e/irq.c
+++ b/arch/mips/loongson/fuloong-2e/irq.c
@@ -30,7 +30,7 @@ asmlinkage void mach_irq_dispatch(unsigned int pending)
        if (pending & CAUSEF_IP7)
                do_IRQ(MIPS_CPU_IRQ_BASE + 7);
        else if (pending & CAUSEF_IP6) /* perf counter loverflow */
-               do_IRQ(LOONGSON2_PERFCNT_IRQ);
+               do_perfcnt_IRQ();
        else if (pending & CAUSEF_IP5)
                i8259_irqdispatch();
        else if (pending & CAUSEF_IP2)
diff --git a/arch/mips/loongson/lemote-2f/irq.c 
b/arch/mips/loongson/lemote-2f/irq.c
index c6db7e7..71347d7 100644
--- a/arch/mips/loongson/lemote-2f/irq.c
+++ b/arch/mips/loongson/lemote-2f/irq.c
@@ -79,9 +79,7 @@ void mach_irq_dispatch(unsigned int pending)
        if (pending & CAUSEF_IP7)
                do_IRQ(LOONGSON_TIMER_IRQ);
        else if (pending & CAUSEF_IP6) {        /* North Bridge, Perf counter */
-#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
-               do_IRQ(LOONGSON2_PERFCNT_IRQ);
-#endif
+               do_perfcnt_IRQ();
                bonito_irqdispatch();
        } else if (pending & CAUSEF_IP3)        /* CPU UART */
                do_IRQ(LOONGSON_UART_IRQ);
-- 
1.7.0.4


<Prev in Thread] Current Thread [Next in Thread>