Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3864035pxb; Tue, 17 Nov 2020 05:41:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzc2oh+nC8oW17Ve/BEQFyG7gF3/M19gyQ9oXhmQpsw14ZygvI7J1ip4yqbBLA24K0IuCLz X-Received: by 2002:a05:6402:12c8:: with SMTP id k8mr981156edx.192.1605620504549; Tue, 17 Nov 2020 05:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620504; cv=none; d=google.com; s=arc-20160816; b=ZCwSFXqJtf+QOZQbd2W3Xj0jT8YZ+ygX2a5vs60icib9aXs5Ixbo0MjhSQ+5jG5ECT m98MiifpBU/lZH6ltNcUu7mCw0+h0RJj5ih2jZY52KEdpdgwOXrufliYhqnlfBPTFMcm EC4xWWY1xjOs3xJhVWXPsFkNb1opDeqAORNz8KO9d3xSGW2ElhqYSb4fwAIhEU0uX9m8 ysrGV4sjf8BcdvS2/kRFG832JkrWqzLkd051EZIinFzX3AoSiVzMbt3IvhnEtqWz51lh X/9Ji9KcJLUUxtcdeKK6HBnPnJ9xejEkZEdLpEvZ/NZ1Yta1vWwt6X8+J4sv/d9xm6YA YpPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7SkeAQ5LRbWp96K2oHycL1D8pzzHOag9KLnh/QCNUsg=; b=chkA3LqXVRDGKlQc/e1LnvddOfnxcnUsqV+ABjmjZK9yRnKKMTmQyy0Yc+IJW+zYns tuziwKS/FTLYQsO3iz688lZ+KEXrR8nqaLq2UvXRACdwVq3hp2qv8trE9WNRCjF5qx9u 3zvEqklJPdrwei5B8zTYdJ0QYGoAOjCwnetnJ4b/SctGBtgSoYHG0yvLL6jtVBasJiZb 6QANcaWC+U9YynCdRbcdMckamTYTyKmFNLuRMY+EOWs33ByKHamZ/AAH983v3QqBXgY4 tFHelxkPdb3wTycH9plcIM9K/tKbQMTkX/fUPH7O1Qa0GnBxIKfGnop/Rt2VVRX7ZW68 O0hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=giW4eB5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc16si14212457edb.391.2020.11.17.05.41.21; Tue, 17 Nov 2020 05:41:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=giW4eB5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732505AbgKQNhs (ORCPT + 99 others); Tue, 17 Nov 2020 08:37:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:49020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732985AbgKQNho (ORCPT ); Tue, 17 Nov 2020 08:37:44 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3BCDE207BC; Tue, 17 Nov 2020 13:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620263; bh=KTYLfaT/c110WMmN+/ylv59n2v7cA2zK8bH4TV2ouIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=giW4eB5wE/a29947vGV1uK8WboYTkq1aKWAnpaOf8CKAZCbV2rGyjzGhmG7slppbd jNKrMpDxCN2JILorMDho2+f81uWKQT9iGhk2CHX0FwIC7M/bCSvsMzf1keJHyZjiDK 5ZJ5M8EQW61uusSc4ao5Jo2HJIbVwejEme96GkFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Anderson , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.9 121/255] riscv: Set text_offset correctly for M-Mode Date: Tue, 17 Nov 2020 14:04:21 +0100 Message-Id: <20201117122144.829558008@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Anderson [ Upstream commit 79605f1394261995c2b955c906a5a20fb27cdc84 ] 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 Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- 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 0a4e81b8dc795..5a0ae2eaf5e2f 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_M_MODE + /* Image load offset (0MB) from start of RAM for M-mode */ + .dword 0 +#else #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 #endif /* Effective size of kernel image */ .dword _end - _start -- 2.27.0