From patchwork Wed Mar 14 18:20:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 131716 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp157198ljb; Wed, 14 Mar 2018 11:22:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELvwqh/ylZ3Z4YSql3uUbBQR4knNr5YjAbHNcA5G4EgcmBnEEI30CU2nsgk6+5BEVC3TXL7A X-Received: by 10.107.44.83 with SMTP id s80mr6074266ios.49.1521051764925; Wed, 14 Mar 2018 11:22:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521051764; cv=none; d=google.com; s=arc-20160816; b=oZJ/UuRiIlzt0xi0ERRIWC91/+Ba84E4QQYvlBAMZzFhiVm3JhOILE7Fd18kG7jVsb YEzEa0cVE6u0FsQiW6NYXblp0AhBX0P3go5bpsMq9NSkXluW0Pm90OuLe024h5xwarZq 6XVKEnWK0la/6zULDZspP+3SjQyMl9Nz8Y47uxFhcMOnYrdu/NqaCBAksoQC3m7kmRgs BMIL2XbPmEm/XarsiUtnqjmS/Jx1Oc3ffjSlAy18ngc+dG1py12oPX+Qfu1+hqs3FAV8 dNU+aAKrvB7MdxtCf7sI2JCDVh38R26A1+Fd8tzRxPs5V0rglZgIlpydO/xAXaBXWKY0 upNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=FwVAcl7Kl8oDqg4XMm2M2wnIExQIaO1ZbJofx1Rh+O8=; b=D/BdKPHpkA5KKueuR8CYGeGXrOPpTIj81ytHhrRSNCJtPp67WFEoMSb4sopPXm5zoH LGZxX0KvIYoBH5jl/T28yU/tgEaV0ZjmfzBRBaF4B5oTVvF4BTpL5j1YqEoTx8Hq+dph //t7mLnAncNNFfLOhxZqrXg4cecO5ZsPHeHRcQVRn2o+DbjlXMvdz+fJMoPy5ToyoH80 RnwX121GYgr0HagYSEavBBvmSN13rvdWEvcn2WvttqQPPBiqzhQ6aLwUjTVNrTiM0rYJ tOEWFuPN9J/TEyQDtqO5F/aZ3LdWlV58NwVeFS5Ttlc0D+BV/YAZPrlpfVjS4MWbGLz6 Kmzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id o67-v6si1181098ith.66.2018.03.14.11.22.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 11:22:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ewB0s-0006va-W6; Wed, 14 Mar 2018 18:20:34 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ewB0r-0006pk-T9 for xen-devel@lists.xen.org; Wed, 14 Mar 2018 18:20:33 +0000 X-Inumbo-ID: 6333423f-27b4-11e8-8248-2fda3a446a53 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 6333423f-27b4-11e8-8248-2fda3a446a53; Wed, 14 Mar 2018 18:20:34 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B18880D; Wed, 14 Mar 2018 11:20:27 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9FAE63F53D; Wed, 14 Mar 2018 11:20:25 -0700 (PDT) From: julien.grall@arm.com To: xen-devel@lists.xen.org Date: Wed, 14 Mar 2018 18:20:01 +0000 Message-Id: <20180314182009.14274-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180314182009.14274-1-julien.grall@arm.com> References: <20180314182009.14274-1-julien.grall@arm.com> Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v5 08/16] xen/mm: Drop the parameter mfn from populate_pt_range X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Julien Grall The function populate_pt_range is used to populate in advance the page-table but it will not do the actual mapping. So passing the MFN in parameter is pointless. Note that the only caller pass 0... At the same time replace 0 by INVALID_MFNs. While this does not matter as the entry will marked as not valid and populated, INVALID_MFN helps the reader to know the MFN is invalid. Signed-off-by: Julien Grall Acked-by: Andrew Cooper Reviewed-by: Wei Liu Reviewed-by: George Dunlap --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu Changes in v5: - Update the commit message to explain why 0 -> INVALID_MFN. Changes in v4: - Patch added. --- xen/arch/arm/mm.c | 5 ++--- xen/arch/x86/mm.c | 5 ++--- xen/common/vmap.c | 2 +- xen/include/xen/mm.h | 3 +-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 9b77ab5f33..97dcdd5d50 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1072,10 +1072,9 @@ int map_pages_to_xen(unsigned long virt, return create_xen_entries(INSERT, virt, _mfn(mfn), nr_mfns, flags); } -int populate_pt_range(unsigned long virt, unsigned long mfn, - unsigned long nr_mfns) +int populate_pt_range(unsigned long virt, unsigned long nr_mfns) { - return create_xen_entries(RESERVE, virt, _mfn(mfn), nr_mfns, 0); + return create_xen_entries(RESERVE, virt, INVALID_MFN, nr_mfns, 0); } int destroy_xen_mappings(unsigned long v, unsigned long e) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index ab10f552ea..5e3e870260 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5013,10 +5013,9 @@ int map_pages_to_xen( return 0; } -int populate_pt_range(unsigned long virt, unsigned long mfn, - unsigned long nr_mfns) +int populate_pt_range(unsigned long virt, unsigned long nr_mfns) { - return map_pages_to_xen(virt, mfn, nr_mfns, MAP_SMALL_PAGES); + return map_pages_to_xen(virt, mfn_x(INVALID_MFN), nr_mfns, MAP_SMALL_PAGES); } /* diff --git a/xen/common/vmap.c b/xen/common/vmap.c index 0b23f8fb97..11785ffb0a 100644 --- a/xen/common/vmap.c +++ b/xen/common/vmap.c @@ -42,7 +42,7 @@ void __init vm_init_type(enum vmap_region type, void *start, void *end) bitmap_fill(vm_bitmap(type), vm_low[type]); /* Populate page tables for the bitmap if necessary. */ - populate_pt_range(va, 0, vm_low[type] - nr); + populate_pt_range(va, vm_low[type] - nr); } static void *vm_alloc(unsigned int nr, unsigned int align, diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 0e0e5112c6..f2c6738ad2 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -175,8 +175,7 @@ int destroy_xen_mappings(unsigned long v, unsigned long e); * Create only non-leaf page table entries for the * page range in Xen virtual address space. */ -int populate_pt_range(unsigned long virt, unsigned long mfn, - unsigned long nr_mfns); +int populate_pt_range(unsigned long virt, unsigned long nr_mfns); /* Claim handling */ unsigned long domain_adjust_tot_pages(struct domain *d, long pages); int domain_set_outstanding_pages(struct domain *d, unsigned long pages);