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: 7110791 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A38B0BEEC1 for ; Wed, 2 Sep 2015 10:19:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7E7F2063C for ; Wed, 2 Sep 2015 10:19:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6598520636 for ; Wed, 2 Sep 2015 10:19:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754361AbbIBKTK (ORCPT ); Wed, 2 Sep 2015 06:19:10 -0400 Received: from mail-ig0-f177.google.com ([209.85.213.177]:33295 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753758AbbIBKTI (ORCPT ); Wed, 2 Sep 2015 06:19:08 -0400 Received: by igbkq10 with SMTP id kq10so21700339igb.0 for ; Wed, 02 Sep 2015 03:19:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=8HHFjMzmbaxDHj3MAbVgrFpgvLNuAJZMrIriAe2MFzU=; b=mKnc7VLl0VhMiybU8bnZROB/DzxCekSKfyXlxbdgnC4NzLYcwiqw+FsQSHIhxUJEwK QTuOr1d6L8ruL3/h5vjusuwRednW2EcGtCGjs2g7mymrTO20ZOFtynrjZeHs3ygpKuRs e3Omi6CWn0XNhFg1OSaTVTtVk0E5b+B5lZGLtbaeNGx9LcuYBlbPKPLwVnzvxHSk2LSM bIo9LRpU19TUYxip0a7aJ7MKPixuk8JFUsixIH5nQM7A4kVlfsDbrZFEsX9gloxfpI+D /kSOO7q/IlfHVk8yA0mWCrBtAKWkYpWrFH8WyvtvrynO1gNGfyw2OTtwRS3lhmsNGgXt QvPw== X-Gm-Message-State: ALoCoQkrXFK+PzpmL1EQcrbc/Ob6tddvFazQiz9xn5LKeRDsgFQznbd+OvWHRrsUjcNk4slW+0ns 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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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