From patchwork Thu Sep 18 00:09:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 37566 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 99DEA2057E for ; Thu, 18 Sep 2014 00:12:12 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ex7sf130895wid.0 for ; Wed, 17 Sep 2014 17:12:11 -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=0IHtp1hDNLgMVSoi5i2uMtCFKr7ravFqBpzH8Z6iW6A=; b=LYTzsJjlLffZ/aHeKQ5pJ6FlkdNpqqIm7T3BrtQB/gzkju8Kh/AtjGkBYiXGrOBfIY 3HbgZjGf6huTrOgxOWwtfQ03ca2/DhYBDYEmlB/Hte5+V3S2ARJ0VKNlkZzWQZ0//pjn PnvQNdkiUiJHtg+h8Nwleyg2z8IyZOhOQWAqCpDqGezRLCpBKnIZcBtKseRNykCePy1a qUZDZkBT8iUx1GuI/LXwFz09sm3jTWKUKaeyBCymJMBiBL7es3g+oG0Z9RrU37B5380M FDz4mX8JXIywMjklG+s3u0LT6f1lrqn5TfmDqKaby/XGLpm46dWlFuSJl/OjJsZij6/5 8bjw== X-Gm-Message-State: ALoCoQlHzqLzsvSxBI5Ju0bxDR1xuMa/TDCBUPuCD5lSF0TTNhPyj1uHcCHul8BuldGShkjAHusb X-Received: by 10.180.160.169 with SMTP id xl9mr8120860wib.7.1410999131821; Wed, 17 Sep 2014 17:12:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.71 with SMTP id t7ls171146lae.60.gmail; Wed, 17 Sep 2014 17:12:11 -0700 (PDT) X-Received: by 10.152.43.99 with SMTP id v3mr964657lal.13.1410999131366; Wed, 17 Sep 2014 17:12:11 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by mx.google.com with ESMTPS id jo8si30559009lab.25.2014.09.17.17.12.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 17:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id l4so123743lbv.33 for ; Wed, 17 Sep 2014 17:12:11 -0700 (PDT) X-Received: by 10.152.36.134 with SMTP id q6mr942796laj.35.1410999131310; Wed, 17 Sep 2014 17:12:11 -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.112.130.169 with SMTP id of9csp673246lbb; Wed, 17 Sep 2014 17:12:10 -0700 (PDT) X-Received: by 10.224.120.138 with SMTP id d10mr2007827qar.8.1410999130155; Wed, 17 Sep 2014 17:12:10 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id c7si24323423qaw.92.2014.09.17.17.12.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Sep 2014 17:12:10 -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 1XUPIm-0006iM-CL; Thu, 18 Sep 2014 00:10:24 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XUPIg-0006eg-I9 for xen-devel@lists.xen.org; Thu, 18 Sep 2014 00:10:18 +0000 Received: from [85.158.143.35:10673] by server-1.bemta-4.messagelabs.com id 58/9F-05872-9E22A145; Thu, 18 Sep 2014 00:10:17 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1410999015!14504934!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27287 invoked from network); 18 Sep 2014 00:10:17 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 18 Sep 2014 00:10:17 -0000 X-IronPort-AV: E=Sophos;i="5.04,542,1406592000"; d="scan'208";a="172653380" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Wed, 17 Sep 2014 20:09:59 -0400 Received: from drall.uk.xensource.com ([10.80.16.71]) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1XUPIM-0000t2-IS; Thu, 18 Sep 2014 01:09:59 +0100 Received: by drall.uk.xensource.com (sSMTP sendmail emulation); Thu, 18 Sep 2014 01:09:58 +0100 From: Ian Campbell To: Date: Thu, 18 Sep 2014 01:09:50 +0100 Message-ID: <1410998995-27449-4-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1410998960.1920.2.camel@citrix.com> References: <1410998960.1920.2.camel@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 v3 for-4.5 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.217.174 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 0294fa8..5cd4e99 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -411,24 +411,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 fa64aa5..a1fef0f 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1138,6 +1138,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 5bf7946..999f20a 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);