From patchwork Thu Apr 20 15:12:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 97829 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp846198qgf; Thu, 20 Apr 2017 08:14:42 -0700 (PDT) X-Received: by 10.157.10.198 with SMTP id 64mr4312816otq.107.1492701282094; Thu, 20 Apr 2017 08:14:42 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id s7si3474531ota.129.2017.04.20.08.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 08:14:42 -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 1d1DlB-00052Z-7M; Thu, 20 Apr 2017 15:12:41 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1DlA-000523-6q for xen-devel@lists.xen.org; Thu, 20 Apr 2017 15:12:40 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id 42/2E-03587-7EFC8F85; Thu, 20 Apr 2017 15:12:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTff5+R8 RBluOM1os+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmTfx1lLpgnW/Fn7XHGBsb3ol2MXBxCApsZ JVbMOMII4ZxmlFi//TJ7FyMnB5uApsSdz5+YQGwRAWmJa58vM4LYzAIOEm8+3mMBsYUF4iS6F nazdTFycLAIqEo8nQ5WzitgKbGycxIriC0hIC+xq+0imM0pYCXRcwdipBBQTd+0zUwTGLkXMD KsYlQvTi0qSy3StdRLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAj0LgMQ7GC8uyn gEKMkB5OSKK/a3B8RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4884B5QSLUtNTK9Iyc4BhBpOW 4OBREuE9DZLmLS5IzC3OTIdInWJUlBLnLQZJCIAkMkrz4NpgoX2JUVZKmJcR6BAhnoLUotzME lT5V4ziHIxKwryLQabwZOaVwE1/BbSYCWjxWT+wxSWJCCmpBsY67vYSJ3XxbM07LVXaczK+sG eE1K9bXpl9rGE9y4uTKmcFWHqVMvqL1snlfrPn7ph+eEXaZfHKUg7jZWcahYM9J2xzX/qa/+P 004rSp78m5kWV8uRkvJFlVqxTOM15W+PW3RKbMiGFdcunZS46XOlz/mKax9PLn4rcPOMDLRWf L/xoN3XnASWW4oxEQy3mouJEAGnLcD5oAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1492701158!45321922!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.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55892 invoked from network); 20 Apr 2017 15:12:38 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-27.messagelabs.com with SMTP; 20 Apr 2017 15:12:38 -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 23F561684; Thu, 20 Apr 2017 08:12:38 -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 7EA533F4FF; Thu, 20 Apr 2017 08:12:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 20 Apr 2017 16:12:25 +0100 Message-Id: <20170420151228.19158-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170420151228.19158-1-julien.grall@arm.com> References: <20170420151228.19158-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 for-4.9 2/5] xen/arm: mm: Move create_mappings function earlier in the file 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" This function will be called by other function later one. This will avoid forward declaration and keep the new function close to sibling ones. This was moved just after *_fixmap helpers as they are page table handling functions too. Signed-off-by: Julien Grall --- Changes in v2: - Patch added --- xen/arch/arm/mm.c | 68 +++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index f0a2eddaaf..bc65c0e432 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -269,6 +269,40 @@ void clear_fixmap(unsigned map) flush_xen_data_tlb_range_va(FIXMAP_ADDR(map), PAGE_SIZE); } +/* Create Xen's mappings of memory. + * Mapping_size must be either 2MB or 32MB. + * Base and virt must be mapping_size aligned. + * Size must be a multiple of mapping_size. + * second must be a contiguous set of second level page tables + * covering the region starting at virt_offset. */ +static void __init create_mappings(lpae_t *second, + unsigned long virt_offset, + unsigned long base_mfn, + unsigned long nr_mfns, + unsigned int mapping_size) +{ + unsigned long i, count; + const unsigned long granularity = mapping_size >> PAGE_SHIFT; + lpae_t pte, *p; + + ASSERT((mapping_size == MB(2)) || (mapping_size == MB(32))); + ASSERT(!((virt_offset >> PAGE_SHIFT) % granularity)); + ASSERT(!(base_mfn % granularity)); + ASSERT(!(nr_mfns % granularity)); + + count = nr_mfns / LPAE_ENTRIES; + p = second + second_linear_offset(virt_offset); + pte = mfn_to_xen_entry(base_mfn, WRITEALLOC); + if ( granularity == 16 * LPAE_ENTRIES ) + pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ + for ( i = 0; i < count; i++ ) + { + write_pte(p + i, pte); + pte.pt.base += 1 << LPAE_SHIFT; + } + flush_xen_data_tlb_local(); +} + #ifdef CONFIG_DOMAIN_PAGE void *map_domain_page_global(mfn_t mfn) { @@ -633,40 +667,6 @@ void mmu_init_secondary_cpu(void) flush_xen_text_tlb_local(); } -/* Create Xen's mappings of memory. - * Mapping_size must be either 2MB or 32MB. - * Base and virt must be mapping_size aligned. - * Size must be a multiple of mapping_size. - * second must be a contiguous set of second level page tables - * covering the region starting at virt_offset. */ -static void __init create_mappings(lpae_t *second, - unsigned long virt_offset, - unsigned long base_mfn, - unsigned long nr_mfns, - unsigned int mapping_size) -{ - unsigned long i, count; - const unsigned long granularity = mapping_size >> PAGE_SHIFT; - lpae_t pte, *p; - - ASSERT((mapping_size == MB(2)) || (mapping_size == MB(32))); - ASSERT(!((virt_offset >> PAGE_SHIFT) % granularity)); - ASSERT(!(base_mfn % granularity)); - ASSERT(!(nr_mfns % granularity)); - - count = nr_mfns / LPAE_ENTRIES; - p = second + second_linear_offset(virt_offset); - pte = mfn_to_xen_entry(base_mfn, WRITEALLOC); - if ( granularity == 16 * LPAE_ENTRIES ) - pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ - for ( i = 0; i < count; i++ ) - { - write_pte(p + i, pte); - pte.pt.base += 1 << LPAE_SHIFT; - } - flush_xen_data_tlb_local(); -} - #ifdef CONFIG_ARM_32 /* Set up the xenheap: up to 1GB of contiguous, always-mapped memory. */ void __init setup_xenheap_mappings(unsigned long base_mfn,