Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1312224ybg; Fri, 18 Oct 2019 15:43:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVKprZArMV11j6QxAwYhG3sIgV5Rd7piluZLBNGN2q8UK/lalgVWVEebSrcqBcgQX69CwE X-Received: by 2002:a17:906:f42:: with SMTP id h2mr10990612ejj.39.1571438586695; Fri, 18 Oct 2019 15:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571438586; cv=none; d=google.com; s=arc-20160816; b=AcmoxjXzo45PDaxxDU+xqgJicC6CLmZRokMgDO28G1bHBHwOsX5L1UHBPtDfpjtlWP 05uZ87QL71hj6/8MmlT7AHdPpdJ1lNmNhTzAQDuANbClD9KX2UBlMiHs0gHH7VFNk9fS Fl0/uMjDCDQUhOzkJmxSevl2/sY9M9+4qRb/BwcGMXm2k328BuGkR/OOqlqK6suWMD5h /1g3CwJuWEkjg0bLYkqWFKwnDtFM8gCdTbYSrd3UBJNaFza8Ayqvsbj2b0fv2cEQOoOS qaZtL1NwuHBe8jvmlEeahKvIrtFX5jSlPYZkmh/51lCEHq09fyeIKWiu5DlDu1pXbkpy wuvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1L7f/uGvROZCVtz1Hvo5nsOEYV/tzFdc7Jvsq90u0ec=; b=0+pM+BO5L1+XQxaBp5v1NPkwJ+nVKMYnfTsknABH4VMpY1aHDc9raLuLuDz8uusCk8 qFA2IxX+Wt+oV7CFP00HXEg6wTd6Z1k1ap1jFuDaKIuWY8K4HZ4DonlZ0FMKY3trD6zt CuAgGrbAT7wHAXIyDaUA+fMjZq73UeWQRg4sVrV6isLGc2hd1qbNC6xt5U7cPDzSwe9X y54Bbympt9TO1DbAY7ktQzQdXQyXvJo1QqlzPjUHaFDG6b9JzydrB7MdreT29ZqoBPYL yrDQgCaVCkmkrBazenvgPH8AEJOXuHXa4Hobh2Bb1j82hWccnhss5s//JTFQ4eJLjC1B SY+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=iVxQpCnY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gh3si4477096ejb.306.2019.10.18.15.42.43; Fri, 18 Oct 2019 15:43:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=iVxQpCnY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395042AbfJRF3V (ORCPT + 99 others); Fri, 18 Oct 2019 01:29:21 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44296 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393371AbfJRF3U (ORCPT ); Fri, 18 Oct 2019 01:29:20 -0400 Received: by mail-wr1-f66.google.com with SMTP id z9so4722353wrl.11 for ; Thu, 17 Oct 2019 22:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1L7f/uGvROZCVtz1Hvo5nsOEYV/tzFdc7Jvsq90u0ec=; b=iVxQpCnYqNXc4Cij1up0Y1wu0M6UegLV1122D9YlF8s9T2CDAYVt1sC9yaAZtO+IXa 2DQxUapTjWzwHwSN/u70Xw8pbrnPcLYlice8p0PbOlMUIVXKl7eCZJxosYm8gz/41SyY qRKUtYfv9DTZHhE/hjTH3xJl6jWx3RjDZYlKHdPCy0/FJYmnmMq5YSOdultPUTvZuF+2 2l3Y9KB4MrVL3Mgp+wy3fbOPNqGQt0/UiTyJdKQYs1yNC2PbeTXLOTK59Pkgou1rtR2d tBBjbvQmRJxtcj6wp52J2zr1QHOqrbSfOua8Ivs6yTu+iYgTKsn0NUstWAz/qysDqT/G KUpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1L7f/uGvROZCVtz1Hvo5nsOEYV/tzFdc7Jvsq90u0ec=; b=U0d2D51ivrhGXO9+uyAdtEu3yoJQ2f/Wkjo7IYuGE+XlF7o48oCe/aWLd4gLBdeavM N/SCu92JwIvsvmsWq39VH4ZsWzotR2wyg4MHLo2tafnk0P/ljGVrdNc7RzYMobvF9Fkm U+7bY6noP/efmz3OAYcSxwts69756jDMYN1wHJirX8VV5tE6mCNGNZfn7o73z7erQ7vu xSlD/vkZCqciQU0PauMVWhXz5xaXqy98dyXCWnlFnc5m1GIjOEGvpJlxG+EfPMwx8lIj Wsp6pLvJ9CqxM0S8vFY4rwouBlRnQC/jkwex8sUG8cRw9JZ912w6ZxoIqPc4nYTjnjPj x+aw== X-Gm-Message-State: APjAAAUzZWihTBrEbU0XBRV+z7GzB3AaYB0S0Ymlza2qfuwlKW850Sqo fHPwOxiBkzDMTs91ZFrDdiVQRxi5JRnXD5qG5427tY6p9Bg= X-Received: by 2002:a5d:42c2:: with SMTP id t2mr5350499wrr.251.1571367672210; Thu, 17 Oct 2019 20:01:12 -0700 (PDT) MIME-Version: 1.0 References: <20191017173743.5430-1-hch@lst.de> <20191017173743.5430-11-hch@lst.de> In-Reply-To: <20191017173743.5430-11-hch@lst.de> From: Anup Patel Date: Fri, 18 Oct 2019 08:31:01 +0530 Message-ID: Subject: Re: [PATCH 10/15] riscv: read the hart ID from mhartid on boot To: Christoph Hellwig Cc: Palmer Dabbelt , Paul Walmsley , Atish Patra , Damien Le Moal , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 11:08 PM Christoph Hellwig wrote: > > From: Damien Le Moal > > 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 > Signed-off-by: Christoph Hellwig > Reviewed-by: Atish Patra > --- > arch/riscv/include/asm/csr.h | 1 + > arch/riscv/kernel/head.S | 8 ++++++++ > 2 files changed, 9 insertions(+) > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h > index 0dae5c361f29..d0b5113e1a54 100644 > --- a/arch/riscv/include/asm/csr.h > +++ b/arch/riscv/include/asm/csr.h > @@ -81,6 +81,7 @@ > #define SIE_SEIE (_AC(0x1, UL) << IRQ_S_EXT) > > /* symbolic CSR names: */ > +#define CSR_MHARTID 0xf14 > #define CSR_MSTATUS 0x300 > #define CSR_MIE 0x304 > #define CSR_MTVEC 0x305 > diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S > index 679e63d29edb..583784cb3a32 100644 > --- a/arch/riscv/kernel/head.S > +++ b/arch/riscv/kernel/head.S > @@ -50,6 +50,14 @@ _start_kernel: > csrw CSR_XIE, zero > csrw CSR_XIP, zero > > +#ifdef CONFIG_RISCV_M_MODE > + /* > + * The hartid in a0 is expected later on, and we have no firmware > + * to hand it to us. > + */ > + csrr a0, CSR_MHARTID > +#endif > + > /* Load the global pointer */ > .option push > .option norelax > -- > 2.20.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv LGTM. Reviewed-by: Anup Patel Regards, Anup