linux-mips
[Top] [All Lists]

Re: Problem About Vectored interrupt

To: linux-mips@linux-mips.org
Subject: Re: Problem About Vectored interrupt
From: "Dennis.Yxun" <dennis.yxun@gmail.com>
Date: Sat, 19 Mar 2011 08:42:17 +0800
Cc: "Anoop P.A." <Anoop_P.A@pmc-sierra.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=08Iz9/7CG2hcJktu2V2xD7HVCp6CR5kBHZ/qNydUV30=; b=kylfr2EGjIZ6rRBvn+NUGs3Zx3trx5gp+KYO2grZeCg6+b2cFLZpQOnA4eeShqiWrt vzzuklxVyQSK/SsxuQi7oUR6kzko9xHinAlHbyBCxXPZMnpzY9U8l+zsxg+GsI4jPlmj BqYmmSgHdPXKFIqJqgKBvEYpZSbKMcwfmDL6c=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=JT3Nwl//ARaWruPHjggskE0rafkoHyeJCdgPspvgR3iTB6DfRiorJWrtHZu3tzMb0V ZCw1sBGXwvedEf3gJWLcQDU29l08E3yCm/W9QHQ1YDF1jv8ps//fscsXoYXb7z2i9Fux h4EU5YOaNAavem7/WiEWVOuodGLZKRxHHRtrw=
In-reply-to: <AANLkTikWUehOmyD6Nk3Abz=u7FEb8NMtX2-N4r5HHuY9@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <AANLkTinhM4PUmLbWeAyavf-JPM1Xpu9pJVkXDq4c-f0C@mail.gmail.com> <AANLkTinsQrZJsXt0SKRfe3S0cNGT+uuW-t3Jo4Ob4=B4@mail.gmail.com> <A7DEA48C84FD0B48AAAE33F328C02014033DADEC@BBY1EXM11.pmc_nt.nt.pmc-sierra.bc.ca> <AANLkTikWUehOmyD6Nk3Abz=u7FEb8NMtX2-N4r5HHuY9@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
HI ALL:
  Again, found that when come to set vect irq 7, do additional data flush fix my problem, here is the patch

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index e971043..850ce58 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1451,6 +1451,9 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
                *w = (*w & 0xffff0000) | (((u32)handler >> 16) & 0xffff);
                w = (u32 *)(b + ori_offset);
                *w = (*w & 0xffff0000) | ((u32)handler & 0xffff);
+               /* FIXME: need flash data cache, for timer irq */
+               if (n == 7)
+                       flush_data_cache_page((unsigned int)b);
                local_flush_icache_range((unsigned long)b,
                                         (unsigned long)(b+handler_len));
        }



Dennis

On Mon, Dec 27, 2010 at 11:56 PM, Dennis.Yxun <dennis.yxun@gmail.com> wrote:
HI Annop:
  Thanks for your reply.
  Actually, I think I've already done those two point
you mentioned here.
  I checked my .config file, it include
  CONFIG_CEVT_R4K_LIB=y
  CONFIG_CEVT_R4K=y
  CONFIG_CSRC_R4K_LIB=y
  CONFIG_CSRC_R4K=y

for the get_c0_compare_int
I've already implemented, see my attached time.c

unsigned int __cpuinit get_c0_compare_int(void)
{
        if (cpu_has_vint)
                set_vi_handler(cp0_compare_irq, mips_timer_dispatch0);

        mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;

        return mips_cpu_timer_irq;
}

c0_compare_irq = 7
and MIPS_CPU_IRQ_BASE = 0
so mips_cpu_timer_irq = 7

should be the same as your mail

Dennis


On Mon, Dec 27, 2010 at 11:20 PM, Anoop P.A. <Anoop_P.A@pmc-sierra.com> wrote:
Hi Dennis,

You may not have to do this ugly hack. Since your cpu is 24kc you should be able to re-use r4k timer library. Select r4k timer from your Kconfig
[code]
       select CEVT_R4K
       select CSRC_R4K

To point your timer interrupt you can add get_c0_compare_int function to your platform init code

[code]

unsigned int __cpuinit get_c0_compare_int(void)
{
return 7;
}

Thanks
Anoop


________________________________

From: linux-mips-bounce@linux-mips.org on behalf of Dennis.Yxun
Sent: Mon 12/27/2010 7:30 PM
To: linux-mips@linux-mips.org
Subject: Re: Problem About Vectored interrupt


HI:
  Here is my patch which hacked set_vi_srs_handler, with this I could successfully bring timer(compare/counter),
  But I still not reach the root problem,
Could someone shine some lights on me.
  Thanks

Dennis


On Mon, Dec 27, 2010 at 4:40 PM, Dennis.Yxun <dennis.yxun@gmail.com> wrote:


       HI ALL:
           I'm try to porting kernel-2.6.36 to one mips24kc board, seems it can't bind vectored irq 7 to timer interrupt.
       The hardware wired IP7 to timer interrupt (CP0 compare/counter interrupt)
           I implemented my own time.c, use set_vi_handler to map cp0_compare_irq(value: 7) to mips_timer_dispatch,
        but weird problem, it didn't successfully map to mips_timer_dispatch, but print out "Caught unexpected vectored interrupt."
       which means it still use " static asmlinkage void do_default_vi(void)"  [1]

          My question is : why first call to "set_vi_srs_handler" successfully mapped to vectored irq7 [2]
       but later is fail[3], see my attached file, bad_kernel.txt

       Dennis


       [1] arch/mips/kernel/traps.c 1339
       [2] arch/mips/kernel/traps.c  1436, when addr == NULL
       [3] my attached file time.c get_c0_compare_int






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