lkml.org 
[lkml]   [2019]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 10/17] riscv: read the hart ID from mhartid on boot
    Date
    From: Damien Le Moal <Damien.LeMoal@wdc.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@wdc.com>
    Signed-off-by: Christoph Hellwig <hch@lst.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
    +#endif
    +
    /* Load the global pointer */
    .option push
    .option norelax
    --
    2.20.1
    \
     
     \ /
      Last update: 2019-06-24 07:45    [W:2.779 / U:0.800 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site