From patchwork Mon Nov 14 11:58:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13042199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E39E0C4332F for ; Mon, 14 Nov 2022 11:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=5uX8qak9oVZm52srAJaTc8eQIsfh9XMxzAed4fOU36Y=; b=RYzIpZOOEYZDsW Cobel8WZ9826b16fY+KDlXOPDbI8MHidpw+pL4dNd4jEz48QAJ/WLnsq12V7P3XSTD8HENjYvUejS 75CqQBhraM5d08BLEvsADuU6VQ9jJL59zg5RTqKvYJsAZLNdTvtKFvMsSGhNYkgGfbZaz4bBOC/Zr b/JBuShPcEuT6JrniEbse24ooq1MW4SmoNQSxwXuJ3bXFkEclxz28Zu0cJr6cNrBLpUWiUAgdG5TH 7k3ChFColIycZ47vugBMvTn3YOXpYVfqoHb3Zgf8NJpvAkH5rOcvkJF5lgsdbF/9dW5eXP6WK69dt kDrGJwbsswjv8LotSMxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouY6W-000cWp-Rm; Mon, 14 Nov 2022 11:58:21 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouY6S-000cUt-FG for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2022 11:58:17 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C91416108E; Mon, 14 Nov 2022 11:58:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5AD6C433D6; Mon, 14 Nov 2022 11:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668427095; bh=uoc7w/5MmjUFYu98w5E6m8q+67nn+HRyF5UjvVtnMKk=; h=From:To:Cc:Subject:Date:From; b=XCPqYP6idlv+fUz6xkyClhH/zim5sTEhkMYZNtVVHDC3Lu30XLGTUPZQEcji28Oii gK4WNrVZN1xw6ZjMi2xCLze6MrxzJF0oP8qiBO9pXk4ZU4SvvMz1/WxDtBXNvc/ij5 1B4accxZ22IuUmlJVdaV1tXUx1eyndr6DqEG68bXSMO4u6NKT+yWrU2HVle5GfAhz8 Sfzh8/+/97p3cGDBJdsv04FxW8xSYvs3l2M73mDH1BUglJUGyrDydjjfSCPi9aV8OC eZ1Qrzk9KmrthShp38Nb6T8JBaTGBd1W6RqLw8eYmV29zYe+N5/EHgXY2J/YHmCOn2 EnCGkwYxLNiTg== From: Ard Biesheuvel To: catalin.marinas@arm.com, will@kernel.org Cc: maz@kernel.org, anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, Ard Biesheuvel Subject: [PATCH] arm64: booting: Require placement within 48-bit addressable memory Date: Mon, 14 Nov 2022 12:58:10 +0100 Message-Id: <20221114115810.1369005-1-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1900; i=ardb@kernel.org; h=from:subject; bh=uoc7w/5MmjUFYu98w5E6m8q+67nn+HRyF5UjvVtnMKk=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjci1R4VDBPxlQbr76absIG2LHc7s70hlz+Iq20QE2 JwJfLp+JAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3ItUQAKCRDDTyI5ktmPJI5pC/ 9kQeRnshsY48geOBkTfbpmxIK2xVnt4SkX57xi1SAsqs6t5IS1EvOSEcWAyKCx/+ciPwSIGXoQqF1M Wg3tIj1KI3rbzK+gBNCrf5EIuY34h3eiG943sbmE5hTX9PaFF/7mB8RL7URzvKIw4fAVzXI4U6bfY8 OdY0eCyuOl9pn1MCZgm+gL326WV+oqm3gqTvcf5wWp9pMVwit7/c8HSL0KOtV2NpFkKet8NQDlYh98 Z0sbaEOsWUVvzQ7zpJakkc7W31aroGrMpBbhdfv2lmWHMRhjJYEW2r2GCL0P6tohYp+/I7OMFH2t0R HUACJRyWpqsPIPkoobB3aRG85eRGXpAHA8MPk2lVbMHlzzKDm1bgegaixIcIKbqed6MQTqHRtxh1qK d3MLtIPLGX3WRE28ZnB/suIwZO9nW1mZbOjrFAXYOym1Vf5rzzzLDGozPtHWhfpHz7zypMKtdg+bpp GjbXEczaBCVr/PSXRXsbA91Q9Avv2VjR5nVhEkMBiFQ/k= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221114_035816_616262_9E7F907D X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some configurations (i.e., 64k + LVA/LPA) can tolerate a physical placement of the kernel image outside of the 48-bit addressable region, but given that the loader has no way of knowing whether or not the image in question supports LVA/LPA, it currently has no choice but to place it below the 48-bit mark. Once we add support for LPA2, which allows 52-bit physical and virtual addressing when using 4k or 16k pages, but in way that relies on increasing the number of paging levels, there will be more variety in the configurations that may or may not support this. So repaint bit #3 in the Image header as 'must be placed within 48-bit addressable memory', as this is the current de facto meaning, and add bits that we may set later to allow placement outside of that. Signed-off-by: Ard Biesheuvel --- Documentation/arm64/booting.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/arm64/booting.rst b/Documentation/arm64/booting.rst index 8c324ad638de2b27..9919e1a107add655 100644 --- a/Documentation/arm64/booting.rst +++ b/Documentation/arm64/booting.rst @@ -114,16 +114,21 @@ Header notes: * 1 - 4K * 2 - 16K * 3 - 64K - Bit 3 Kernel physical placement + Bit 3-4 Kernel physical placement 0 2MB aligned base should be as close as possible to the base of DRAM, since memory below it is not accessible via the linear mapping 1 + 2MB aligned base such that base plus image_size is + entirely within the 48-bit addressable range + 2 + Reserved + 3 2MB aligned base may be anywhere in physical memory - Bits 4-63 Reserved. + Bits 5-63 Reserved. ============= =============================================================== - When image_size is zero, a bootloader should attempt to keep as much