From patchwork Thu Sep 17 09:32:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 53782 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 4926922A0D for ; Thu, 17 Sep 2015 09:38:51 +0000 (UTC) Received: by lagj9 with SMTP id j9sf4758001lag.0 for ; Thu, 17 Sep 2015 02:38:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=mvb1+qNmI1cTR0sI8qchMU+Vf84yiFW9pS/RuydcqNk=; b=FqHbL4ph7PtxFQNUtTv4c+koOlgRuXJPNYDIzMqR30WGdxdPstqiKOouIdptfF5Fe0 deZmiT8kQRsFwdGm12TrVmYD7EA9It1nr1HM2ZOUAU0ntudV2BoEHNDkbFWwzQXo0CTC TzY7yRFRtEs0pfomAuUKL81Otb7Ip0abbKxK9bBKnl9UnAxlP4NPRjoy6jQkVdWM4L2F wTX6P1cN3T3mMB8zEcyxwFrn2LqoME7TtWkvG3lr2OFTgeFvVDoEOkjmeZ3eM7cEFiSE cIlQ0WJ7i1OwQ2mOreWCyqJQR+R+JCnFG4LooFZfmUSFK6o2XYpqnKrY2tklj8cx9ota bewA== X-Gm-Message-State: ALoCoQnSKFCXgWjanc7ogKqXgOBFWr84PxzzJLCddnZcyqCqk0PQOf9d/RSG9qcyAqSY3J+NnhRS X-Received: by 10.152.3.131 with SMTP id c3mr6402954lac.4.1442482730273; Thu, 17 Sep 2015 02:38:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.229 with SMTP id q5ls48310lae.17.gmail; Thu, 17 Sep 2015 02:38:50 -0700 (PDT) X-Received: by 10.112.162.70 with SMTP id xy6mr35515538lbb.122.1442482730124; Thu, 17 Sep 2015 02:38:50 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id rb7si1539965lbb.4.2015.09.17.02.38.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 02:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lahg1 with SMTP id g1so7631384lah.1 for ; Thu, 17 Sep 2015 02:38:50 -0700 (PDT) X-Received: by 10.152.18.130 with SMTP id w2mr25484154lad.88.1442482730011; Thu, 17 Sep 2015 02:38:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2959034lbq; Thu, 17 Sep 2015 02:38:49 -0700 (PDT) X-Received: by 10.50.6.16 with SMTP id w16mr4468337igw.74.1442482724073; Thu, 17 Sep 2015 02:38:44 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id i16si1693837ioi.211.2015.09.17.02.38.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 02:38:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcVcj-0002dK-CP; Thu, 17 Sep 2015 09:37:01 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcVch-0002bw-4n for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2015 09:36:59 +0000 Received: by wicfx3 with SMTP id fx3so19351262wic.0 for ; Thu, 17 Sep 2015 02:36:37 -0700 (PDT) X-Received: by 10.180.100.37 with SMTP id ev5mr5748632wib.15.1442482596844; Thu, 17 Sep 2015 02:36:36 -0700 (PDT) Received: from ards-macbook-pro.key.chillispot.info ([149.6.56.74]) by smtp.gmail.com with ESMTPSA id s16sm9068833wik.13.2015.09.17.02.36.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Sep 2015 02:36:35 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, mark.rutland@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com Subject: [PATCH] arm64: expose kernel page size in Image header flags Date: Thu, 17 Sep 2015 11:32:25 +0200 Message-Id: <1442482345-7679-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150917_023659_352505_EFBD8737 X-CRM114-Status: GOOD ( 15.58 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.179 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.179 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In order for a bootloader to be able to decide whether a certain arm64 kernel image is compatible with the hardware it is running on, it needs to be able to find out for which page size the kernel was built. This is necessary, since the architecture does not mandate support for all page sizes it defines, and the kernel cannot boot to a state where it can print a diagnostic if it was built for a page size that is not supported by the hardware. So assign two bits in the flags field of the Image header, and set them according to the build time page size. For backward compatibility, retain the 0b00 value as 'unspecified'. Acked-by: Catalin Marinas Signed-off-by: Ard Biesheuvel --- Documentation/arm64/booting.txt | 3 ++- arch/arm64/kernel/image.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/arm64/booting.txt b/Documentation/arm64/booting.txt index 1690350f16e7..46056e7d766e 100644 --- a/Documentation/arm64/booting.txt +++ b/Documentation/arm64/booting.txt @@ -104,7 +104,8 @@ Header notes: - The flags field (introduced in v3.17) is a little-endian 64-bit field composed as follows: Bit 0: Kernel endianness. 1 if BE, 0 if LE. - Bits 1-63: Reserved. + Bits 1-2: Kernel page size. 0=unspecified, 1=4K, 2=16K, 3=64K + Bits 3-63: Reserved. - When image_size is zero, a bootloader should attempt to keep as much memory as possible free for use by the kernel immediately after the diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h index 8fae0756e175..5def289bda84 100644 --- a/arch/arm64/kernel/image.h +++ b/arch/arm64/kernel/image.h @@ -47,7 +47,9 @@ #define __HEAD_FLAG_BE 0 #endif -#define __HEAD_FLAGS (__HEAD_FLAG_BE << 0) +#define __HEAD_FLAG_PAGE_SIZE ((PAGE_SHIFT - 10) / 2) + +#define __HEAD_FLAGS (__HEAD_FLAG_BE << 0) | (__HEAD_FLAG_PAGE_SIZE << 1) /* * These will output as part of the Image header, which should be little-endian