Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2028303ybd; Sun, 23 Jun 2019 22:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiV/l4l1QHX23IQuBY4ulOt+L7FIpGIim7FmMpaXuIJTim7IJ3vAC1bmHBmopackccUMWE X-Received: by 2002:a63:4d63:: with SMTP id n35mr31291866pgl.43.1561355280685; Sun, 23 Jun 2019 22:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561355280; cv=none; d=google.com; s=arc-20160816; b=fJWk47N+Vxqlc7f4d9lqZ0a/OGg8lSY2SrHmfHvRQNuPGqiIhEpNBDtfswJ388WFDd xR3VUrTY4rp5TEP4XncARI/NHMPzOQcDU+o7P92JY0fw2RHWQ1/QYxPUOH56iaFujHLj nQ1smqoAFtPgKn1zXUbG7fqCsennWkhWE2WF7XWsSw/162LqwyE51tWWDN0pX8VKCQ+5 GPHagPQ7FNFQ/GE+ETSaWaUocnP5d4tCtBqO4lmR5wC7IR+9BN0TaIFgqr6ZqCr7j6lI C8etKjHWgPqXSlEHNDftf65MqvEDhQL2Bdz0JV/994ifoWT5msXhQkE2Gzvws/jUsd2z glRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=43pRHKdJKqNssrr4/Vc0cDK/nlhOlcebDC3ttvLu+nk=; b=x4IyiHFqsd9j7tfG+OJsKIiK4KTz4XwPLpir4oTFY6mDVumZLOfThIailXU2GTdEZI D65ksSqQQtdRuYFHObDkdhqj5jn/cyqz3jSXl5ecHJTM7DRQT9tnQxVlJz2FAd853Q+I qrP22FIHnxsG5v/EXHrbmGuQoogFLgiH2q3t2QN4hfC7IDQdNqIZr6eepUTRRE8q8V5U eE5meLOso87+DA/Ibc7zHvO129ZvjxRVZgkWk0o1ziCsYXiOgL9XppTpgdavekw2/1dJ KvvZwl1kXLyXRyoj64wEku8c9e2qoHN11MVmyuPjMe4tyx+k32UDf9ikWp2+m0XcaLYT GW9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ox0Bj2s2; 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 a20si9394073pgw.306.2019.06.23.22.47.45; Sun, 23 Jun 2019 22:48:00 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ox0Bj2s2; 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 S1727650AbfFXFoi (ORCPT + 99 others); Mon, 24 Jun 2019 01:44:38 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37040 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbfFXFnv (ORCPT ); Mon, 24 Jun 2019 01:43:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=43pRHKdJKqNssrr4/Vc0cDK/nlhOlcebDC3ttvLu+nk=; b=Ox0Bj2s2AYtMiNqOyzVUJu1aca 4Zw5sJu947Gj5rs0jUIlbbOtlbwYiuHZ0nJ1wtQi79umOkWFdlOji03dK+QH22LmwJp2C8vJ56/Fw VBYObyjWlQcJ9h5SQj6t76j0JD5TudW+arpOJd2w7RxIDG8pwuO4dR1jb3JpSDfRzc7ZczKYWm7vh QI2c2xxg9ZuRIDvDgzexiDXDbZSYqdKgNNN3aPwHwGLG857aQEXAdzB2Nf4gvK+YbgR5Imuqbwebr zBivLC6z+ob0BD9JpbwnxUy0vPPLYKipdDiBzZ5jLr7Jy5pym/AnznE86d12FYY1jmZQrC/xeH+IC s5lNwFPQ==; Received: from 213-225-6-159.nat.highway.a1.net ([213.225.6.159] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hfHld-0006Xj-5S; Mon, 24 Jun 2019 05:43:49 +0000 From: Christoph Hellwig To: Palmer Dabbelt , Paul Walmsley Cc: Damien Le Moal , linux-riscv@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Damien Le Moal Subject: [PATCH 10/17] riscv: read the hart ID from mhartid on boot Date: Mon, 24 Jun 2019 07:43:04 +0200 Message-Id: <20190624054311.30256-11-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190624054311.30256-1-hch@lst.de> References: <20190624054311.30256-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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