lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY4PR04MB3751474F3EC95CE50CC05AF9E7450@CY4PR04MB3751.namprd04.prod.outlook.com>
Date:   Tue, 11 Aug 2020 07:44:51 +0000
From:   Damien Le Moal <Damien.LeMoal@....com>
To:     邱文博 <qiuwenbo@...tium.com.cn>
CC:     Palmer Dabbelt <palmer@...belt.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
        Albert Ou <aou@...s.berkeley.edu>,
        Atish Patra <Atish.Patra@....com>,
        Anup Patel <anup@...infault.org>,
        Guo Ren <guoren@...ux.alibaba.com>,
        Zong Li <zong.li@...ive.com>,
        Greentime Hu <greentime.hu@...ive.com>,
        Vincent Chen <vincent.chen@...ive.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] riscv: Setup exception vector for K210 properly

On 2020/08/11 16:06, 邱文博 wrote:
> 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@...0000: 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

Interesting. Never saw that happening... Thanks !

> 
> 
> 
> &gt; -----原始邮件-----
> &gt; 发件人: "Damien Le Moal" <damien.lemoal@....com>
> &gt; 发送时间: 2020-08-11 14:42:15 (星期二)
> &gt; 收件人: "Qiu Wenbo" <qiuwenbo@...tium.com.cn>, "Palmer Dabbelt" <palmer@...belt.com>, "Paul Walmsley" <paul.walmsley@...ive.com>, "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>
> &gt; 抄送: "Albert Ou" <aou@...s.berkeley.edu>, "Atish Patra" <atish.patra@....com>, "Anup
> &gt;  Patel" <anup@...infault.org>, "Guo Ren" <guoren@...ux.alibaba.com>, "Zong Li" <zong.li@...ive.com>, "Greentime Hu" <greentime.hu@...ive.com>, "Vincent Chen" <vincent.chen@...ive.com>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
> &gt; 主题: Re: [PATCH] riscv: Setup exception vector for K210 properly
> &gt; 
> &gt; On 2020/08/11 15:38, Qiu Wenbo wrote:
> &gt; &gt; Exception vector is missing on nommu platform and it is a big issue.
> &gt; &gt; This patch is tested in Sipeed MAIX Bit Dev Board.
> &gt; &gt; 
> &gt; &gt; Fixes: 79b1feba5455 ("RISC-V: Setup exception vector early")
> &gt; &gt; Signed-off-by: Qiu Wenbo <qiuwenbo@...tium.com.cn>
> &gt; &gt; ---
> &gt; &gt;  arch/riscv/kernel/smpboot.c |  1 +
> &gt; &gt;  arch/riscv/kernel/traps.c   | 11 ++++++++++-
> &gt; &gt;  2 files changed, 11 insertions(+), 1 deletion(-)
> &gt; &gt; 
> &gt; &gt; diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
> &gt; &gt; index 356825a57551..23cde0ceb39d 100644
> &gt; &gt; --- a/arch/riscv/kernel/smpboot.c
> &gt; &gt; +++ b/arch/riscv/kernel/smpboot.c
> &gt; &gt; @@ -154,6 +154,7 @@ asmlinkage __visible void smp_callin(void)
> &gt; &gt;  	mmgrab(mm);
> &gt; &gt;  	current-&gt;active_mm = mm;
> &gt; &gt;  
> &gt; &gt; +	trap_init();
> &gt; &gt;  	notify_cpu_starting(curr_cpuid);
> &gt; &gt;  	update_siblings_masks(curr_cpuid);
> &gt; &gt;  	set_cpu_online(curr_cpuid, 1);
> &gt; &gt; diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
> &gt; &gt; index ad14f4466d92..a390239818ae 100644
> &gt; &gt; --- a/arch/riscv/kernel/traps.c
> &gt; &gt; +++ b/arch/riscv/kernel/traps.c
> &gt; &gt; @@ -174,7 +174,16 @@ int is_valid_bugaddr(unsigned long pc)
> &gt; &gt;  }
> &gt; &gt;  #endif /* CONFIG_GENERIC_BUG */
> &gt; &gt;  
> &gt; &gt; -/* stvec &amp; scratch is already set from head.S */
> &gt; &gt; +/* stvec &amp; scratch is already set from head.S when mmu is enabled */
> &gt; &gt;  void trap_init(void)
> &gt; &gt;  {
> &gt; &gt; +#ifndef CONFIG_MMU
> &gt; &gt; +	/*
> &gt; &gt; +	 * Set sup0 scratch register to 0, indicating to exception vector
> &gt; &gt; +	 * that we are presently executing in the kernel
> &gt; &gt; +	 */
> &gt; &gt; +	csr_write(CSR_SCRATCH, 0);
> &gt; &gt; +	/* Set the exception vector address */
> &gt; &gt; +	csr_write(CSR_TVEC, &amp;handle_exception);
> &gt; &gt; +#endif
> &gt; &gt;  }
> &gt; &gt; 
> &gt; 
> &gt; Looks OK to me. But out of curiosity, how did you trigger a problem ? I never
> &gt; got any weird exceptions with my busybox userspace.
> &gt; 
> &gt; -- 
> &gt; Damien Le Moal
> &gt; Western Digital Research
> </qiuwenbo@...tium.com.cn></linux-kernel@...r.kernel.org></vincent.chen@...ive.com></greentime.hu@...ive.com></zong.li@...ive.com></guoren@...ux.alibaba.com></anup@...infault.org></atish.patra@....com></aou@...s.berkeley.edu></linux-riscv@...ts.infradead.org></paul.walmsley@...ive.com></palmer@...belt.com></qiuwenbo@...tium.com.cn></damien.lemoal@....com>
> 
> 
> 
> 
> 


-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ