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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 1 Jul 2019 21:15:51 +0000
From:   Atish Patra <Atish.Patra@....com>
To:     "hch@....de" <hch@....de>,
        "paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
        "palmer@...ive.com" <palmer@...ive.com>
CC:     "linux-mm@...ck.org" <linux-mm@...ck.org>,
        Damien Le Moal <Damien.LeMoal@....com>,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 10/17] riscv: read the hart ID from mhartid on boot

On Mon, 2019-06-24 at 07:43 +0200, Christoph Hellwig wrote:
> From: Damien Le Moal <Damien.LeMoal@....com>
> 
> When in M-Mode, we can use the mhartid CSR to get the ID of the
> running
> HART. Doing so, direct M-Mode boot without firmware is possible.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@....com>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
>  arch/riscv/kernel/head.S | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index e5fa5481aa99..a4c170e41a34 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -18,6 +18,14 @@ ENTRY(_start)
>  	csrw CSR_XIE, zero
>  	csrw CSR_XIP, zero
>  
> +#ifdef CONFIG_M_MODE
> +	/*
> +	 * The hartid in a0 is expected later on, and we have no
> firmware
> +	 * to hand it to us.
> +	 */
> +	csrr a0, mhartid

I think you should add SR_MHARTID and use that instead of direct csr
name.
The following patch replaced all occurrence of csr name usage from
kernel with CSR numbers.

https://patchwork.kernel.org/patch/10916293/

With that change, 

Reviewed-by: Atish Patra <atish.patra@....com>

> +#endif
> +
>  	/* Load the global pointer */
>  .option push
>  .option norelax

-- 
Regards,
Atish

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ