From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5828EC433E7 for ; Wed, 2 Sep 2020 11:37:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F5DB20767 for ; Wed, 2 Sep 2020 11:37:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tXR5YnlE"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="bYhlvxcl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F5DB20767 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HmuqP1BWEvtGrvbytHw2gOFkCmk+B56SUYtngGlIRdc=; b=tXR5YnlEs/7duj/9jc6dqFVb0 idgMtNktqIkCShUQ5BCT7ybspiYRcFb8zt5UUAUtZxTnQHajcSo2vfYO3HNdzFam1+HU3pJoZaf4s 8VjF8gOHDt0IufCTJFPaG9aTVa9pwwx+odNeNqAkXsaKOSIuDKFpESjoGRdsTi13dh2Jz5NqooRQt TbKILL6vnxzrvfzD+Ou8+HUXNMi8JOUomnpgdst8gMrZ6u8xLgSNI6MpZ0itz83idbC5WzsBBGda4 gRUKxqrt8lUS0ZWABhoG0FKLhoRY4dV3GAlviBoTf31BNPpiJr1eR/Q01OzUc9xH4dNqxbxCChVcK 0zm4sk4uQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDR3b-0004qD-Eo; Wed, 02 Sep 2020 11:36:03 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDR3Y-0004pk-RZ for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2020 11:36:01 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 04DC820767; Wed, 2 Sep 2020 11:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599046560; bh=/etCU3YViUEtzQ0JISoSQugRycUsAudfDbC7jReJags=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bYhlvxcl0QbskbrCkaKRoxD+rU16GQ7n2hk+Ufz/kkOLqyfDpAD9qoYNJdLnqp+b5 D7W9u30uJBPULXYEsjRw1gM7+W4yTJu0+MbKzFnKC6Sd31z4/uS9JD4NbfeH6lQtL1 6qcOjrxfl7o91qqyG5QKpuwo6kT7eFkNF3zSXhdM= Date: Wed, 2 Sep 2020 12:35:56 +0100 From: Will Deacon To: Alexandru Elisei Subject: Re: [PATCH v3 04/21] KVM: arm64: Use generic allocator for hyp stage-1 page-tables Message-ID: <20200902113555.GB5838@willie-the-truck> References: <20200825093953.26493-1-will@kernel.org> <20200825093953.26493-5-will@kernel.org> <35435dcb-e821-3769-ac0f-e75b1ede237f@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <35435dcb-e821-3769-ac0f-e75b1ede237f@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200902_073600_965833_37ECFB75 X-CRM114-Status: GOOD ( 19.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Catalin Marinas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 28, 2020 at 05:32:16PM +0100, Alexandru Elisei wrote: > On 8/25/20 10:39 AM, Will Deacon wrote: > > Now that we have a shiny new page-table allocator, replace the hyp > > page-table code with calls into the new API. This also allows us to > > remove the extended idmap code, as we can now simply ensure that the > > VA size is large enough to map everything we need. > > > > Cc: Marc Zyngier > > Cc: Quentin Perret > > Signed-off-by: Will Deacon > > --- > > arch/arm64/include/asm/kvm_mmu.h | 78 +---- > > arch/arm64/include/asm/kvm_pgtable.h | 5 + > > arch/arm64/include/asm/pgtable-hwdef.h | 6 - > > arch/arm64/include/asm/pgtable-prot.h | 6 - > > arch/arm64/kvm/mmu.c | 414 +++---------------------- > > 5 files changed, 45 insertions(+), 464 deletions(-) > > > > [..] > > @@ -2356,6 +2028,7 @@ static int kvm_map_idmap_text(pgd_t *pgd) > > int kvm_mmu_init(void) > > { > > int err; > > + u32 hyp_va_bits; > > > > hyp_idmap_start = __pa_symbol(__hyp_idmap_text_start); > > hyp_idmap_start = ALIGN_DOWN(hyp_idmap_start, PAGE_SIZE); > > @@ -2369,6 +2042,8 @@ int kvm_mmu_init(void) > > */ > > BUG_ON((hyp_idmap_start ^ (hyp_idmap_end - 1)) & PAGE_MASK); > > > > + hyp_va_bits = 64 - ((idmap_t0sz & TCR_T0SZ_MASK) >> TCR_T0SZ_OFFSET); > > idmap_t0sz is defined in mm/mmu.c as: TCR_T0SZ(VA_BITS) = (UL(64) - VA_BITS) << > TCR_T0SZ_OFFSET. Looks to me like hyp_va_bits == VA_BITS. Careful! It can get rewritten in head.S if we determine that physical memory is in an awkward place and not covered by VA_BITS in an identity mapping. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel