From: 邱文博 <qiuwenbo@phytium.com.cn>
To: "Damien Le Moal" <Damien.LeMoal@wdc.com>
Cc: "Palmer Dabbelt" <palmer@dabbelt.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Atish Patra" <Atish.Patra@wdc.com>,
"Anup Patel" <anup@brainfault.org>,
"Guo Ren" <guoren@linux.alibaba.com>,
"Zong Li" <zong.li@sifive.com>,
"Greentime Hu" <greentime.hu@sifive.com>,
"Vincent Chen" <vincent.chen@sifive.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH] riscv: Setup exception vector for K210 properly
Date: Tue, 11 Aug 2020 15:05:46 +0800 (GMT+08:00) [thread overview]
Message-ID: <1ff8e8cb.a4c6.173dc56db41.Coremail.qiuwenbo@phytium.com.cn> (raw)
In-Reply-To: <CY4PR04MB375124E6D2AD38BF1D71C1D5E7450@CY4PR04MB3751.namprd04.prod.outlook.com>
The serial port did not print anything after early console.
[ 0.000000] Sorting __ex_table...
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 6480K/8192K available (1024K kernel code, 111K rwdata, 170K rodata, 101K init, 97K bss, 1712K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] random: get_random_bytes called from 0x00000000800019a4 with crng_init=0
[ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000015] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008254] Console: colour dummy device 80x25
> -----原始邮件-----
> 发件人: "Damien Le Moal" <damien.lemoal@wdc.com>
> 发送时间: 2020-08-11 14:42:15 (星期二)
> 收件人: "Qiu Wenbo" <qiuwenbo@phytium.com.cn>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Paul Walmsley" <paul.walmsley@sifive.com>, "linux-riscv@lists.infradead.org" <linux-riscv@lists.infradead.org>
> 抄送: "Albert Ou" <aou@eecs.berkeley.edu>, "Atish Patra" <atish.patra@wdc.com>, "Anup
> Patel" <anup@brainfault.org>, "Guo Ren" <guoren@linux.alibaba.com>, "Zong Li" <zong.li@sifive.com>, "Greentime Hu" <greentime.hu@sifive.com>, "Vincent Chen" <vincent.chen@sifive.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
> 主题: Re: [PATCH] riscv: Setup exception vector for K210 properly
>
> On 2020/08/11 15:38, Qiu Wenbo wrote:
> > Exception vector is missing on nommu platform and it is a big issue.
> > This patch is tested in Sipeed MAIX Bit Dev Board.
> >
> > Fixes: 79b1feba5455 ("RISC-V: Setup exception vector early")
> > Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
> > ---
> > arch/riscv/kernel/smpboot.c | 1 +
> > arch/riscv/kernel/traps.c | 11 ++++++++++-
> > 2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
> > index 356825a57551..23cde0ceb39d 100644
> > --- a/arch/riscv/kernel/smpboot.c
> > +++ b/arch/riscv/kernel/smpboot.c
> > @@ -154,6 +154,7 @@ asmlinkage __visible void smp_callin(void)
> > mmgrab(mm);
> > current->active_mm = mm;
> >
> > + trap_init();
> > notify_cpu_starting(curr_cpuid);
> > update_siblings_masks(curr_cpuid);
> > set_cpu_online(curr_cpuid, 1);
> > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
> > index ad14f4466d92..a390239818ae 100644
> > --- a/arch/riscv/kernel/traps.c
> > +++ b/arch/riscv/kernel/traps.c
> > @@ -174,7 +174,16 @@ int is_valid_bugaddr(unsigned long pc)
> > }
> > #endif /* CONFIG_GENERIC_BUG */
> >
> > -/* stvec & scratch is already set from head.S */
> > +/* stvec & scratch is already set from head.S when mmu is enabled */
> > void trap_init(void)
> > {
> > +#ifndef CONFIG_MMU
> > + /*
> > + * Set sup0 scratch register to 0, indicating to exception vector
> > + * that we are presently executing in the kernel
> > + */
> > + csr_write(CSR_SCRATCH, 0);
> > + /* Set the exception vector address */
> > + csr_write(CSR_TVEC, &handle_exception);
> > +#endif
> > }
> >
>
> Looks OK to me. But out of curiosity, how did you trigger a problem ? I never
> got any weird exceptions with my busybox userspace.
>
> --
> Damien Le Moal
> Western Digital Research
</qiuwenbo@phytium.com.cn></linux-kernel@vger.kernel.org></vincent.chen@sifive.com></greentime.hu@sifive.com></zong.li@sifive.com></guoren@linux.alibaba.com></anup@brainfault.org></atish.patra@wdc.com></aou@eecs.berkeley.edu></linux-riscv@lists.infradead.org></paul.walmsley@sifive.com></palmer@dabbelt.com></qiuwenbo@phytium.com.cn></damien.lemoal@wdc.com>
next prev parent reply other threads:[~2020-08-11 7:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 6:36 Qiu Wenbo
2020-08-11 6:42 ` Damien Le Moal
2020-08-11 7:05 ` 邱文博 [this message]
2020-08-11 7:44 ` Damien Le Moal
2020-08-11 6:43 ` Damien Le Moal
2020-08-11 8:40 ` Anup Patel
2020-08-11 18:45 ` Atish Patra
2020-08-12 1:09 ` Qiu Wenbo
2020-08-12 1:57 ` Anup Patel
2020-08-12 7:41 ` Atish Patra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ff8e8cb.a4c6.173dc56db41.Coremail.qiuwenbo@phytium.com.cn \
--to=qiuwenbo@phytium.com.cn \
--cc=Atish.Patra@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=greentime.hu@sifive.com \
--cc=guoren@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=vincent.chen@sifive.com \
--cc=zong.li@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®