From patchwork Tue Jun 13 16:13:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105399 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp486508qgd; Tue, 13 Jun 2017 09:15:34 -0700 (PDT) X-Received: by 10.36.1.205 with SMTP id 196mr824352itk.33.1497370534664; Tue, 13 Jun 2017 09:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497370534; cv=none; d=google.com; s=arc-20160816; b=ODlzvbnBmqmuX3cSZhzJz35Ip9gsZ7zWzxcQiBSUYe2ub/x9ijO2jSrocbNH/MM6V2 LYVy80V4LPlWdhcxgU9MN0O63RRj2psoSLe6H3nbweqnM/tMt5oOTBj7TIYr2zXWSDN/ 89+Egl5Xwi6CO255hwlEgnRiRPJGxmxgbnyuQ2w9uc6d03QjwQEQQzMnu5nxzlLPNQqI gmixwe/ef4rIGGJjdzvXglmB0rDbx03P9YzqiZ+jMiLFM5N7W7yQorw/1Zf6MonaDXjf nERYgeAcyNQdj6a3ENailgyWkHPWAoZO/vLKvhYUOItzm1jyW64vQjkuTDkgDcPwxwq/ Ex4Q== 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=DjS+P8BqKsh4QrIjG/Zi1vk5WYUq/21cDI0xoSw0j/A=; b=wL1X/rD3Pdsi7bIcXltFBo9xq2TO7dFhQghZlS2f/BdLJ9CPWQHBXAFOf89qFQJhfB dQ/U0rrKQhk1lNxyX3dhF4nPumrnbEweqyScgca6wPllWItdZjy2toh3f/SdEaZRm2yj 6tJHkSCI06enC7kSnAFjn032cyrbT/Zop/yng8CcmDLoQ8XbESWLkVa0r9kNq9x9972s he/EHvcJFbpb7RZFktgIc/gJcm4Wd9F6sPrX7T1gvIONMt9B8V58r9GoSiJ8q/vIBfCv GdZb3/EvCqLih3WR8Jx/7J4VzlIO6De4yLwPc0jAnDd5S6T9yl9thfYIa+u4P8q/gPWV OY4g== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n76si372960itg.101.2017.06.13.09.15.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 09:15:34 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.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 1dKoRv-0008Ea-S4; Tue, 13 Jun 2017 16:13:47 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoRu-0008Bp-8r for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:13:46 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id D8/2B-19466-93F00495; Tue, 13 Jun 2017 16:13:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTdeS3yH SYOUrRoslHxezODB6HN39mymAMYo1My8pvyKBNePj7W7Ggu9yFZuePmJtYPwt2sXIxSEksJlR 4vKeD+wQzmlGifYjT4EcTg42AU2JO58/MYHYIgLSEtc+X2YEsZkFIiSaFuwFiwsLBEvs2/WVD cRmEVCV2LZtOiuIzStgJfH/+3+wuISAvMSutotgcU6g+KXnTWBzhAQsJZp3r2eawMi9gJFhFa NGcWpRWWqRrpGxXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGoIfrGRgYdzDuaPc 7xCjJwaQkyrvlik2kEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQleez6HSCHBotT01Iq0zBxgqMGk JTh4lER477MApXmLCxJzizPTIVKnGBWlxHn/8AIlBEASGaV5cG2w8L7EKCslzMvIwMAgxFOQW pSbWYIq/4pRnINRSZi3hQdoCk9mXgnc9FdAi5mAFl8HuZm3uCQRISXVwFh295P1Op68vDet2e oPdN7c1oqZmvRKuK1DZuJeza2B0UGGmRenhUxiOD/3x/5Qe/sjs8qt6nNvmkysniHXuMGqTmb 69n5W2+xlDq9l7+YmvPi5LoRB4gEbA1dld/mZN083/w3hfnIiVzU2xm236Kpd26uZihIZfr+5 wvOeo2FPwQ7hq9KdzEosxRmJhlrMRcWJACJragtqAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1497370424!82613440!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51348 invoked from network); 13 Jun 2017 16:13:44 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-206.messagelabs.com with SMTP; 13 Jun 2017 16:13:44 -0000 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 0E0871596; Tue, 13 Jun 2017 09:13:44 -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 4868B3F557; Tue, 13 Jun 2017 09:13:43 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:11 +0100 Message-Id: <20170613161323.25196-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613161323.25196-1-julien.grall@arm.com> References: <20170613161323.25196-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, punit.agrawal@arm.com Subject: [Xen-devel] [PATCH 12/24] xen/arm: Replace DIV_ROUND_UP(..., PAGE_SIZE) by PFN_UP(...) X-BeenThere: xen-devel@lists.xen.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.xen.org Sender: "Xen-devel" DIV_ROUND_UP(..., PAGE_SIZE) and PFN_UP(...) are equivalent. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 4 ++-- xen/arch/arm/gic-v2.c | 2 +- xen/arch/arm/gic-v3.c | 8 ++++---- xen/arch/arm/kernel.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index a04c8862db..a3243bdb5d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1008,7 +1008,7 @@ static int map_range_to_domain(const struct dt_device_node *dev, { res = map_regions_p2mt(d, _gfn(paddr_to_pfn(addr)), - DIV_ROUND_UP(len, PAGE_SIZE), + PFN_UP(len), _mfn(paddr_to_pfn(addr)), mr_data->p2mt); @@ -1545,7 +1545,7 @@ static void acpi_map_other_tables(struct domain *d) size = acpi_gbl_root_table_list.tables[i].length; res = map_regions_p2mt(d, _gfn(paddr_to_pfn(addr)), - DIV_ROUND_UP(size, PAGE_SIZE), + PFN_UP(size), _mfn(paddr_to_pfn(addr)), p2m_mmio_direct_c); if ( res ) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index f8124e5e54..0482b1fe32 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -598,7 +598,7 @@ static int gicv2_map_hwdown_extra_mappings(struct domain *d) v2m_data->spi_start, v2m_data->nr_spis); ret = map_mmio_regions(d, _gfn(paddr_to_pfn(v2m_data->addr)), - DIV_ROUND_UP(v2m_data->size, PAGE_SIZE), + PFN_UP(v2m_data->size), _mfn(paddr_to_pfn(v2m_data->addr))); if ( ret ) { diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index a559e5e260..bb845e955d 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1283,7 +1283,7 @@ static int gicv3_iomem_deny_access(const struct domain *d) unsigned long mfn, nr; mfn = dbase >> PAGE_SHIFT; - nr = DIV_ROUND_UP(SZ_64K, PAGE_SIZE); + nr = PFN_UP(SZ_64K); rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; @@ -1291,7 +1291,7 @@ static int gicv3_iomem_deny_access(const struct domain *d) for ( i = 0; i < gicv3.rdist_count; i++ ) { mfn = gicv3.rdist_regions[i].base >> PAGE_SHIFT; - nr = DIV_ROUND_UP(gicv3.rdist_regions[i].size, PAGE_SIZE); + nr = PFN_UP(gicv3.rdist_regions[i].size); rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; @@ -1300,7 +1300,7 @@ static int gicv3_iomem_deny_access(const struct domain *d) if ( cbase != INVALID_PADDR ) { mfn = cbase >> PAGE_SHIFT; - nr = DIV_ROUND_UP(csize, PAGE_SIZE); + nr = PFN_UP(csize); rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; @@ -1309,7 +1309,7 @@ static int gicv3_iomem_deny_access(const struct domain *d) if ( vbase != INVALID_PADDR ) { mfn = vbase >> PAGE_SHIFT; - nr = DIV_ROUND_UP(csize, PAGE_SIZE); + nr = PFN_UP(csize); return iomem_deny_access(d, mfn, mfn + nr); } diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index e2512c4612..0ed8b6005c 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -312,7 +312,7 @@ static __init int kernel_decompress(struct bootmodule *mod) * Need to free pages after output_size here because they won't be * freed by discard_initial_modules */ - i = DIV_ROUND_UP(output_size, PAGE_SIZE); + i = PFN_UP(output_size); for ( ; i < (1 << kernel_order_out); i++ ) free_domheap_page(pages + i);