From patchwork Wed Feb 21 14:02:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 129066 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp662477ljc; Wed, 21 Feb 2018 06:05:55 -0800 (PST) X-Google-Smtp-Source: AH8x224F3oum8HypuBP37rXS3mPNpQPb52NGVCNkcq/FO7SqjMs7Y3Y7MPHdwsFly2t/PIcgWKQP X-Received: by 10.31.59.139 with SMTP id i133mr2432437vka.4.1519221955216; Wed, 21 Feb 2018 06:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221955; cv=none; d=google.com; s=arc-20160816; b=emNcyOBSvCuJ/xc5k1U929FCXijUXh3U7G2g2UNzIrHo+LZPuxgndFGNCawDqzAqnR xQFyNx3q1+102iKjnW52ana9RXYFHrgnsxk8ge8Y0tkN+OL86TPimOD3hElIzbGZarDU vuGmt3asdn8EWb0g0hZ8VE/aNQCUi4HCb0fHUSv4ME95Vof0ui1rQfvsofbB2PpAQEpO wdH5F8ZeKFXPHzXcDT0pVyYeFCIXWq9ESr25vTDauWsD2hi0uJHBp99nE+RRT8Lk2B6l +rnfL6tD+spVr1WCPC3YPi/qnq/KwUFCJuh5G7FWMu3l2SuNoxk+JwWsDm1FvIRlkrw5 IEFA== 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=8rDuQb8ETX8XzxtSJeCCxqXPGpd5F2irJUB7TTL4tA8=; b=U/RzGPOcGiquvY02gKNiYIm3zcBkhF6cX2mLiUyqtQ9Io5AKPoy4cJD0NswMlp7X7e tG9p2S+YExQvEjbAckfHQ201ZODkVi+cesZSF5Z39Y1E8rXKYT+ps5QytMrBiMTrZcuc wUqCe7A3+Uh2ouvH4z2gpJhoBpndbDWxhFQNXBUrVmgP+wzlYm3rFxytObuWSyH0Hnyv SvewEpYHdPrc4tL/FtDwdy9mbeaL/jOFjT3v7Ym4Mrq+yAlKH+i2TL+HdSyLgdQcFtQa I2R3d52ziBWEaRqR+1SYZmNDlBZ/ZQb7jf7GGV2gu+HPRQ/6nWLTPL1m+qOXEeTVi+u9 /6gg== 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 a129si3036950vkh.370.2018.02.21.06.05.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 06:05:55 -0800 (PST) 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 1eoUzZ-0004T8-Tf; Wed, 21 Feb 2018 14:03:29 +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 1eoUzY-0004PI-TT for xen-devel@lists.xen.org; Wed, 21 Feb 2018 14:03:28 +0000 X-Inumbo-ID: 33c5041f-1710-11e8-b9b1-635ca7ef6cff Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 33c5041f-1710-11e8-b9b1-635ca7ef6cff; Wed, 21 Feb 2018 14:04:59 +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 8633815AB; Wed, 21 Feb 2018 06:03:22 -0800 (PST) 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 B94E23F318; Wed, 21 Feb 2018 06:03:20 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 21 Feb 2018 14:02:51 +0000 Message-Id: <20180221140259.29360-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180221140259.29360-1-julien.grall@arm.com> References: <20180221140259.29360-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 v4 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" 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_MFN to make clear the MFN is invalid. Signed-off-by: Julien Grall Signed-off-by: Wei Liu --- 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 The move from 0 to INVALID_MFN will work on Arm. I am not entirely sure for the x86 version. 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 eba1afaa31..ecbfc95ae2 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5012,10 +5012,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);