From patchwork Sat Oct 17 18:28:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 11842925 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56AE815E6 for ; Sat, 17 Oct 2020 18:29:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F15532073A for ; Sat, 17 Oct 2020 18:29:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mmJY1gug"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="osrLlI5r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F15532073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=T3Vhj4HX0twGvdBEEkhPHu7VlHsL/gBDzZBYLtbIiMc=; b=mmJY1gugxMG1iuVzMp3uPxdgdV +LIFaJepcrhFwin1jx3yxSOHKLcA3vvlKdq3jAFUW/EcfG41dUWb1y9qcOJxtkRc7d8vV3/FuCilJ ndbvVEBdkhm+RrDPDz6i3IV9vZxuEXWeRfP2eRJ2BHlEVt8uSp6YkqkKmNY1NTo87WO6ma9Bvip5U DFKWZcdN3RUYShQYoKvO+E3MPiUIAstodzYwVqWaMisnwTDjdgcuxuykF7tyxeToIjcShsBo/JpDV Ch3NRcEebBqpt/hXmjojX9gwHjG0NDltx5/P4mWJvFiVDZ6AjyezQqiR61kA5y/P40VcmA4K0Q5sP e6GmqPxA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kTqx4-0003Q4-1o; Sat, 17 Oct 2020 18:29:10 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kTqx1-0003PB-2e for linux-riscv@lists.infradead.org; Sat, 17 Oct 2020 18:29:07 +0000 Received: by mail-io1-xd41.google.com with SMTP id d20so8017062iop.10 for ; Sat, 17 Oct 2020 11:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MPK73qqTZ8bhrzLLptM5yHUD7zjEZlg71+uh4SKHXVs=; b=osrLlI5rxR8LLCheVZPP1PMgmnrNxxBrXmdipqLVOOUz75AC6OhJrW8s9c6YmsvQxB CAWv6DVK4ENHFZXg/l8OS4A4aSAf1ftllQZmv0VS6zn4EVlXgxWPFR1N+1qgIxGG5cOg 4GE9eYkRq3Z0D9/2N5jj/m/DSzfsiAPOmi4Mo8lswKqhGQeyreLAHuWRwlpQK6PCpOEs CX/CGp1rEfFG4DE0wy0GatQaT8ziMZfoCz8yhbzQ+RHcDejN8QOWsnuSgzXSLYUmtZYn 7tkfQ9nEu1E/9rbMcnHBJUilJZql+k0WzZwFRw3KBCWOkD959GlLj9ONn+pR4fAIO/OT 5oPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MPK73qqTZ8bhrzLLptM5yHUD7zjEZlg71+uh4SKHXVs=; b=hcn0ELAE1Osg7Rb6rwuoQ0GkJ/52ZNDb0+9PVngIkY/L8tKYOA3MIc3cUum57VuMRB AlDhyYNKHkjeSPgnta2tu6wv6T0KRMGIoSX50IvT7CEXyeT5kO049Mdy86bZ9AkqAsEu uuU/nhXzPZruvrWi3EKTJmYLDQBsoF+RwGcIRFqirGl+RlNkReX+U+OYRe9wwMSpwEcS W0nOMlXZoSctMO22J1YKAs2MBwgTGsdVZne/1hYEQUb4WtNNdHsaQ12p2ucTBXOVZK+W L4BqAI2sE2aQ1klgdcBUJEe2dOY7fprypZO5/puxuBWaxBRAGW6KSoFTxQ4QdOE6tLd5 kWFA== X-Gm-Message-State: AOAM533kOaL/fsxjbK6sLJnslJyPC8SPN/0+ZVcoA7RzkdxZTU0puPwY G/Rs9QR0Aye5bLtFlShgcJaN17ZaujWKalaO X-Google-Smtp-Source: ABdhPJyVsxzw8vH+NK9fUl0FRNYuVwDIIXaY+4PqtXtkVJn32PiFp5G+U8+LdpC9xPqUd4D3SFaCrA== X-Received: by 2002:a05:6602:2c41:: with SMTP id x1mr6251233iov.58.1602959343574; Sat, 17 Oct 2020 11:29:03 -0700 (PDT) Received: from godwin.fios-router.home (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.gmail.com with ESMTPSA id e204sm5374395iof.16.2020.10.17.11.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2020 11:29:03 -0700 (PDT) From: Sean Anderson To: linux-riscv@lists.infradead.org Subject: [PATCH] riscv: Set text_offset correctly for M-Mode Date: Sat, 17 Oct 2020 14:28:48 -0400 Message-Id: <20201017182848.125139-1-seanga2@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201017_142907_217053_8AA075F7 X-CRM114-Status: GOOD ( 10.25 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:d41 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [seanga2[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [seanga2[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Albert Ou , Anup Patel , Sean Anderson , Atish Patra , Palmer Dabbelt , Paul Walmsley Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org M-Mode Linux is loaded at the start of RAM, not 2MB later. Perhaps this should be calculated based on PAGE_OFFSET somehow? Even better would be to deprecate text_offset and instead introduce something absolute. Signed-off-by: Sean Anderson --- arch/riscv/kernel/head.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index 0a4e81b8dc79..74679f338c65 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -27,12 +27,17 @@ ENTRY(_start) /* reserved */ .word 0 .balign 8 +#ifdef CONFIG_RISCV_S_MODE #if __riscv_xlen == 64 /* Image load offset(2MB) from start of RAM */ .dword 0x200000 #else /* Image load offset(4MB) from start of RAM */ .dword 0x400000 +#endif +#else + /* Image load offset (0MB) from start of RAM for M-mode */ + .dword 0 #endif /* Effective size of kernel image */ .dword _end - _start