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=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 C513DC433E2 for ; Thu, 10 Sep 2020 12:38:32 +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 709D820C09 for ; Thu, 10 Sep 2020 12:38:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dL3bNRCJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="yGE4pFuE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 709D820C09 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=/C9wgtxLCLWywnNW7BqtnOem65HXc65vvMS1QHkFm50=; b=dL3bNRCJLQ3/m2K5qPnOCkYcR h+AjBgQUJiqtLJhTdvs18FEPnpq/QF2Dn6Qb16Lhw96d2DF52WeZ1RDJ8d7tazJZ26lCivOJMwqRT i9sOzq2UAySwa5gkTjcVgHmCUv/mn1BJWDIrKmDOq/zS/GUcQxqDjJI2yuSTj2kLBu7wC4+8LCN48 /B+FALilyvzqE3P/N8vJqavXnYdj3kbReZ+zRZ0qZ75jRqAUNFhLKPpIahYI8paT7JRngR5hw7qzc SRpFoyq53xY4zB/RV/xVJwDI7htSR2ojKGcRwXa6W6xzzmUeZMSAuan0YCD47kyGqyGBgF4ZnijER 70mPzve1A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGLpJ-0005JC-MH; Thu, 10 Sep 2020 12:37:21 +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 1kGLpH-0005Hs-24 for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 12:37:19 +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 69CA5208FE; Thu, 10 Sep 2020 12:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599741438; bh=FGth1o3am16uP55EdKwFtATWQdN/7+WK6TzP56kkx+k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yGE4pFuEHg699m/skrZByTfKE9pun1HDxnxC3pdrxDV/uyySMADeeyXVqPrPg6sZz 9R4wDEEK3/Lv5Tm446Nq3WB7+SALOrl4lkFAxGYLBBZ2WawixNGLT6CIzgf1YUZB2I c9p4mDXRuZrdvpvvz7v9v41Id8ezbVCA3XYnFto8= Date: Thu, 10 Sep 2020 13:37:13 +0100 From: Will Deacon To: Alexandru Elisei Subject: Re: [PATCH v4 02/21] KVM: arm64: Add stand-alone page-table walker infrastructure Message-ID: <20200910123712.GB18100@willie-the-truck> References: <20200907152344.12978-1-will@kernel.org> <20200907152344.12978-3-will@kernel.org> <4ef01cff-71ac-7f3c-2404-af184f5a5cb4@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4ef01cff-71ac-7f3c-2404-af184f5a5cb4@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-20200910_083719_189273_103D3D66 X-CRM114-Status: GOOD ( 14.66 ) 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: Gavin Shan , Suzuki Poulose , Marc Zyngier , Quentin Perret , James Morse , Catalin Marinas , kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 Wed, Sep 09, 2020 at 04:29:26PM +0100, Alexandru Elisei wrote: > On 9/7/20 4:23 PM, Will Deacon wrote: > > [..] > > + > > +int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size, > > + struct kvm_pgtable_walker *walker) > > +{ > > + struct kvm_pgtable_walk_data walk_data = { > > + .pgt = pgt, > > + .addr = ALIGN_DOWN(addr, PAGE_SIZE), > > + .end = PAGE_ALIGN(walk_data.addr + size), > > + .walker = walker, > > + }; > > If the caller wants to walk [0x500, 0x1500), for PAGE_SIZE = 0x1000 (4K), the > function walks the range [0x0, 0x1000). Is that intentional? Yes, although the caller specifies a base and a *size*, rather than an end address. As a concrete example, much of the hypervisor stage-1 mapping is created using PAGE_SIZE mappings of random ELF symbols, which correspond to arbitrary addresses. In these cases, we really do want to round-down the address and perform a PAGE_SIZE mapping. The alternative would be to return an error if the size is not page-aligned, but I don't think that's really necessary, especially since we accept an unaligned base. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel