From patchwork Thu Sep 4 16:14:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 36736 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D1BA9202E4 for ; Thu, 4 Sep 2014 16:16:02 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id q200sf31920727ykb.5 for ; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=+JZfCQt52JDHZEqP/jM0pSM/qM/BvRFKZW+VcwaXxtg=; b=Luu7mNckygzQHbYjQrcakUVXYMoyHUxdPxXu+v75r1xP8QLK8ROOicdv5zm5u2bpDU YXeXT1fR1+r4V/FvHo+B4TM44qxSCcMCTDS3y9ZCLyS/tCyMAoqigCXeKsy1zsO6t0ht 2CcfcFB8DbiNeWCO4AtdrArbXda8GztNwN1sGJb0UNjHfrqjpQCYBAy1ymhWVoPOzGvU XnewX6/NS9slrJ0CGWv8x/LV/EMG1GVOlGnohapqjqiZwOEBu9Fki2orjG14161eWIHA bNcGy+3kPxa1IZduLf+tMMhDLmfMAl6pgBy0RY8jC8goxbi4IWzo5hIO9uEqkTR8Ajke Hdcw== X-Gm-Message-State: ALoCoQmaMzO2GkZPNXuTPEHsZv35mz6ufaOssY/jaxwhzLrSbeOb6VtcXzgpZgD+peqs121MHY7y X-Received: by 10.52.170.204 with SMTP id ao12mr2999864vdc.2.1409847362667; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.28.9 with SMTP id 9ls336105qgy.52.gmail; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) X-Received: by 10.220.182.1 with SMTP id ca1mr5141831vcb.21.1409847362552; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id v8si6029280vcx.74.2014.09.04.09.16.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 09:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so10900703vcb.16 for ; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr4293830vdb.27.1409847362447; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp863136vcb; Thu, 4 Sep 2014 09:16:02 -0700 (PDT) X-Received: by 10.220.168.210 with SMTP id v18mr5124752vcy.3.1409847362069; Thu, 04 Sep 2014 09:16:02 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id rx9si3287409vdc.64.2014.09.04.09.16.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 09:16:02 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XPZgq-0001mk-6F; Thu, 04 Sep 2014 16:15:16 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XPZgh-0001ja-EP for xen-devel@lists.xen.org; Thu, 04 Sep 2014 16:15:09 +0000 Received: from [193.109.254.147:25259] by server-16.bemta-14.messagelabs.com id 95/D9-16990-A0098045; Thu, 04 Sep 2014 16:15:06 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1409847304!13546273!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29415 invoked from network); 4 Sep 2014 16:15:06 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 4 Sep 2014 16:15:06 -0000 X-IronPort-AV: E=Sophos;i="5.04,467,1406592000"; d="scan'208";a="169157082" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Thu, 4 Sep 2014 12:14:22 -0400 Received: from drall.uk.xensource.com ([10.80.16.71]) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1XPZfw-0004QV-Rj; Thu, 04 Sep 2014 17:14:21 +0100 Received: by drall.uk.xensource.com (sSMTP sendmail emulation); Thu, 04 Sep 2014 17:14:20 +0100 From: Ian Campbell To: Date: Thu, 4 Sep 2014 17:14:12 +0100 Message-ID: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <4427aba8dad3155fca151a0b63bfdf78e3a91033.1409847257.git.ian.campbell@citrix.com> References: <4427aba8dad3155fca151a0b63bfdf78e3a91033.1409847257.git.ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , vijay.kilari@gmail.com, stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v2 4/9] xen: arm: move setup_virt_paging to p2m.[ch] from mm.[ch] X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: This file is where most of the P2M logic lives and this function will eventually need to poke at some internals, so move it. This is pure code motion. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- v2: also move from mm.h to p2m.h --- xen/arch/arm/mm.c | 18 ------------------ xen/arch/arm/p2m.c | 18 ++++++++++++++++++ xen/include/asm-arm/mm.h | 2 -- xen/include/asm-arm/p2m.h | 3 +++ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index da4522c..6d9eb67 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -410,24 +410,6 @@ void __init arch_init_memory(void) BUG_ON(IS_ERR(dom_cow)); } -void __cpuinit setup_virt_paging(void) -{ - /* Setup Stage 2 address translation */ - /* SH0=11 (Inner-shareable) - * ORGN0=IRGN0=01 (Normal memory, Write-Back Write-Allocate Cacheable) - * SL0=01 (Level-1) - * ARVv7: T0SZ=(1)1000 = -8 (32-(-8) = 40 bit physical addresses) - * ARMv8: T0SZ=01 1000 = 24 (64-24 = 40 bit physical addresses) - * PS=010 == 40 bits - */ -#ifdef CONFIG_ARM_32 - WRITE_SYSREG32(0x80003558, VTCR_EL2); -#else - WRITE_SYSREG32(0x80023558, VTCR_EL2); -#endif - isb(); -} - static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 62547f2..6cd13c2 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1112,6 +1112,24 @@ err: return page; } +void __cpuinit setup_virt_paging(void) +{ + /* Setup Stage 2 address translation */ + /* SH0=11 (Inner-shareable) + * ORGN0=IRGN0=01 (Normal memory, Write-Back Write-Allocate Cacheable) + * SL0=01 (Level-1) + * ARVv7: T0SZ=(1)1000 = -8 (32-(-8) = 40 bit physical addresses) + * ARMv8: T0SZ=01 1000 = 24 (64-24 = 40 bit physical addresses) + * PS=010 == 40 bits + */ +#ifdef CONFIG_ARM_32 + WRITE_SYSREG32(0x80003558, VTCR_EL2); +#else + WRITE_SYSREG32(0x80023558, VTCR_EL2); +#endif + isb(); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 9fa80a4..840a805 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -155,8 +155,6 @@ extern void remove_early_mappings(void); extern int __cpuinit init_secondary_pagetables(int cpu); /* Switch secondary CPUS to its own pagetables and finalise MMU setup */ extern void __cpuinit mmu_init_secondary_cpu(void); -/* Second stage paging setup, to be called on all CPUs */ -extern void __cpuinit setup_virt_paging(void); /* Set up the xenheap: up to 1GB of contiguous, always-mapped memory. * Base must be 32MB aligned and size a multiple of 32MB. */ extern void setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns); diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 3648568..53aa0fc 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -72,6 +72,9 @@ typedef enum { /* Initialise vmid allocator */ void p2m_vmid_allocator_init(void); +/* Second stage paging setup, to be called on all CPUs */ +void __cpuinit setup_virt_paging(void); + /* Init the datastructures for later use by the p2m code */ int p2m_init(struct domain *d);