From patchwork Wed Sep 2 10:19:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 52960 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 0B89F22DC0 for ; Wed, 2 Sep 2015 10:19:18 +0000 (UTC) Received: by lagj9 with SMTP id j9sf2335442lag.0 for ; Wed, 02 Sep 2015 03:19:17 -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:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=g92JEOD4ZH/crii8j3RMffJsa2UwWBfoYkhVOz2cks8=; b=gb5vwSzhnq4I0ZsVq6pV+k8TSRf4TGRM5FFKc55Nk+ph/cswgaIAHwqfuC/h+Z2rHp PEBECAn5MJd2B3LqfLuYV5l25eqosaTt1ZJhSK5cktwQUpsU4+YuhzKnQV1aRZUwxFrM VeEMRZ80j760XPSpe9dndpgAOLOCEwBPQN42i+UvD0OIBQHJmC8y4gFIRK1Z2f1n+z5X ulg4GAppweNjt932H/DG7LRrWC7bMLjl8zTA902Y7MZZpH714O2RHuCY3H8N4KZ3OBM7 odcSyPU42E1oRCQuMH8gmcEM//PDkOzrCrqSMYk86+xPiEidz1Y6Cxy205WiIfYnrwqY Y+oA== X-Gm-Message-State: ALoCoQlRZ3CYbIjBWNPWB3tg2i3aHmW7Pfma5tr4vstBY7VtfWDgNYTdz1semAIPjSgYCgngsQ+7 X-Received: by 10.152.4.69 with SMTP id i5mr8909163lai.10.1441189157006; Wed, 02 Sep 2015 03:19:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls68856lau.23.gmail; Wed, 02 Sep 2015 03:19:16 -0700 (PDT) X-Received: by 10.152.36.103 with SMTP id p7mr7712411laj.90.1441189156710; Wed, 02 Sep 2015 03:19:16 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id rl10si19225249lbb.5.2015.09.02.03.19.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 03:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lamp12 with SMTP id p12so3565616lam.0 for ; Wed, 02 Sep 2015 03:19:16 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr15113869lbb.29.1441189156568; Wed, 02 Sep 2015 03:19:16 -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.164.42 with SMTP id yn10csp446681lbb; Wed, 2 Sep 2015 03:19:15 -0700 (PDT) X-Received: by 10.68.248.102 with SMTP id yl6mr54924283pbc.66.1441189155489; Wed, 02 Sep 2015 03:19:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id de10si28909848pad.66.2015.09.02.03.19.12; Wed, 02 Sep 2015 03:19:15 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752878AbbIBKTK (ORCPT + 28 others); Wed, 2 Sep 2015 06:19:10 -0400 Received: from mail-ig0-f171.google.com ([209.85.213.171]:36066 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753548AbbIBKTI (ORCPT ); Wed, 2 Sep 2015 06:19:08 -0400 Received: by igcrk20 with SMTP id rk20so21341282igc.1 for ; Wed, 02 Sep 2015 03:19:07 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.64.147 with SMTP id o19mr2516610igs.37.1441189147476; Wed, 02 Sep 2015 03:19:07 -0700 (PDT) Received: by 10.36.138.69 with HTTP; Wed, 2 Sep 2015 03:19:07 -0700 (PDT) In-Reply-To: References: <1439465645-22584-1-git-send-email-suzuki.poulose@arm.com> <1439465645-22584-13-git-send-email-suzuki.poulose@arm.com> <55CCAD73.7080702@arm.com> <20150813172946.GD4602@e104818-lin.cambridge.arm.com> Date: Wed, 2 Sep 2015 12:19:07 +0200 Message-ID: Subject: Re: [PATCH 12/14] arm64: Check for selected granule support From: Ard Biesheuvel To: Catalin Marinas Cc: "Suzuki K. Poulose" , Steve Capper , "kvm@vger.kernel.org" , Marc Zyngier , Will Deacon , "linux-kernel@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.54 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 2 September 2015 at 11:48, Ard Biesheuvel wrote: > On 13 August 2015 at 19:29, Catalin Marinas wrote: >> On Thu, Aug 13, 2015 at 03:45:07PM +0100, Suzuki K. Poulose wrote: >>> On 13/08/15 13:28, Steve Capper wrote: >>> >On 13 August 2015 at 12:34, Suzuki K. Poulose wrote: >>> >> __enable_mmu: >>> >>+ mrs x1, ID_AA64MMFR0_EL1 >>> >>+ ubfx x2, x1, #ID_AA64MMFR0_TGran_SHIFT, 4 >>> >>+ cmp x2, #ID_AA64MMFR0_TGran_ENABLED >>> >>+ b.ne __no_granule_support >>> >> ldr x5, =vectors >>> >> msr vbar_el1, x5 >>> >> msr ttbr0_el1, x25 // load TTBR0 >>> >>@@ -626,3 +643,8 @@ __enable_mmu: >>> >> isb >>> >> br x27 >>> >> ENDPROC(__enable_mmu) >>> >>+ >>> >>+__no_granule_support: >>> >>+ wfe >>> >>+ b __no_granule_support >>> >>+ENDPROC(__no_granule_support) >>> >>-- >>> >>1.7.9.5 >>> >> >>> > >>> >Is is possible to tell the user that the kernel has failed to boot due >>> >to the kernel granule being unsupported? >>> >>> We don't have anything up at this time. The "looping address" is actually a clue >>> to the (expert) user. Not sure we can do something, until we get something like DEBUG_LL(?) >> >> No. >> >>> Or we should let it continue and end in a panic(?). The current situation can boot a >>> multi-cluster system with boot cluster having the Tgran support(which doesn't make a >>> strong use case though). I will try out some options and get back to you. >> >> If the boot CPU does not support 16KB pages, in general there isn't much >> we can do since the console printing is done after we enabled the MMU. >> Even mapping the UART address requires fixmap support and the PAGE_SIZE >> is hard-coded in the kernel image. The DT is also mapped at run-time. >> >> While in theory it's possible to fall back to a 4KB page size just >> enough to load the DT and figure out the early console, I suggest we >> just live with the "looping address" clue. >> > > Couldn't we allocate some flag bits in the Image header to communicate > the page size to the bootloader? Something like this perhaps? ------------8<--------------- --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/Documentation/arm64/booting.txt b/Documentation/arm64/booting.txt index 7d9d3c2286b2..13a8aaa9a6e9 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