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=unavailable 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 A9BCCC433E7 for ; Wed, 2 Sep 2020 10:07:41 +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 726F820658 for ; Wed, 2 Sep 2020 10:07:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JYPXDGsU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="1XDSYl56" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 726F820658 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=WV9ohQAx4A1Jj2KbLsHdFMnuz4GfP0eAVVTlcPpsZV8=; b=JYPXDGsUersRWoTxXwYGhHUNc CwLAjhSHu1elkjteoNlu1NzCjW4F3S2fXZbmdm3k6bF40w/pFfRtBHxkjTe0J1ktzub/4SNaMO+bO MhSuVyXNVTc3RvRVCcRUfjV36MMidcO154+sffT7DalLuF0whkkHsbeqTepCH55PDsjYk17PWX4HS 0QQlQm/VF8QZObQ37fVKJWaeesrndhjWurBDQ+IgpUv/MKGsBAa70tdfcFs7g+h5dw0KGN2Eq7zRW ZS5xQG3xmyfUc3gO+xvIkEDl4pxjG6zM/SxuyC0MXvKxkSPbMiJCKBnakZsvF/9O7ia7315KlV6LX zFUPNiJtA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDPez-0003s1-UM; Wed, 02 Sep 2020 10:06:33 +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 1kDPex-0003rM-Gx for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2020 10:06:32 +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 8D92920658; Wed, 2 Sep 2020 10:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599041190; bh=sT4E6AnMCVQaoeKJAZtiZS9ZtiA6X40Ljf9mTG8VKz0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1XDSYl56YmAI1O/WYqCWbc7w4l9MbZVbKzdkjaF4umjkh/IqUW1QiP5Yz8/grBE9N i0XaquQGbm9P9ZafnoiPf5l6d4AVE/yEnEw6F+KHrrOwdhqn2HHzTXcTB1vdSHO0Et Ehq54beFgj+97ckiZSapqIRAoX5+9vw5McGnDSr0= Date: Wed, 2 Sep 2020 11:06:26 +0100 From: Will Deacon To: Alexandru Elisei Subject: Re: [PATCH v3 03/21] KVM: arm64: Add support for creating kernel-agnostic stage-1 page tables Message-ID: <20200902100625.GB5567@willie-the-truck> References: <20200825093953.26493-1-will@kernel.org> <20200825093953.26493-4-will@kernel.org> <57e40fa8-f6e3-d442-3bd4-412f04d88a4b@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <57e40fa8-f6e3-d442-3bd4-412f04d88a4b@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_060631_646779_70040AC6 X-CRM114-Status: GOOD ( 22.81 ) 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 Hi Alex, On Fri, Aug 28, 2020 at 04:35:24PM +0100, Alexandru Elisei wrote: > On 8/25/20 10:39 AM, Will Deacon wrote: > > The generic page-table walker is pretty useless as it stands, because it > > doesn't understand enough to allocate anything. Teach it about stage-1 > > page-tables, and hook up an API for allocating these for the hypervisor > > at EL2. > > > > Cc: Marc Zyngier > > Cc: Quentin Perret > > Signed-off-by: Will Deacon > > --- > > arch/arm64/include/asm/kvm_pgtable.h | 34 +++++++ > > arch/arm64/kvm/hyp/pgtable.c | 131 +++++++++++++++++++++++++++ > > 2 files changed, 165 insertions(+) [...] > > +/** > > + * kvm_pgtable_hyp_map() - Install a mapping in a hypervisor stage-1 page-table. > > + * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init(). > > + * @addr: Virtual address at which to place the mapping. > > + * @size: Size of the mapping. > > + * @phys: Physical address of the memory to map. > > + * @prot: Permissions and attributes for the mapping. > > + * > > + * If device attributes are not explicitly requested in @prot, then the > > + * mapping will be normal, cacheable. > > + * > > + * Return: 0 on success, negative error code on failure. > > From my understanding of the code, when the caller replaces an existing leaf entry > or a table with a different one, KVM will print a warning instead of using > break-before-make (if necessary). It might be worth pointing out that it is > expected from the callers not to do that, because it's not immediately obvious. For hypervisor stage-1 mappings, we WARN() and ignore the mapping request if we run into an existing valid leaf entry for a different mapping. That shouldn't happen, as hyp mappings are typically static and performed only for the .hyp.* sections and the GICv2 memory-mapped bits. We don't even provide an unmap interface. But yes, I can mention this in the comment: | Attempts to install a mapping for a virtual address that is already | mapped will be rejected with an error and a WARN(). Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel