From patchwork Mon Jul 21 12:59:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 33957 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D462E23961 for ; Mon, 21 Jul 2014 13:02:19 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id mc6sf5102162lab.1 for ; Mon, 21 Jul 2014 06:02:17 -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=dNMU0apcFM8vlTO/I6ixbZowTUJvJj1Cv+eozcFXKcU=; b=Z9wYue7GQXTj+fFJ6C7msf7MDP1zP57PLahZqMmTtQAQNIFrD1+RV59ctIKGT/1AEF z/86Ib81HdSLTILk0+587vUdl5UnANNHLsIXWNR1MDa8DzkkiNMjVDcFF5hhcRw3/2N4 0Ug7KU3i0i1u28zhKtXe0qqjoLO6xLumF2uLGDIATcVJtv8IzBoGKBSU7v1T56vM/Dz3 qwW/nHoSBKJbw7CI/bbG11wmitbbjKiX9xXkmLV/V77shLBT6oYWh+APZ80R7FAwY+Vu 6NnvxofMESzuk7a7UuXJC26qo4amjVj3Mxq2c//N/5bPeSkQ/AvlRMoioleYt3oKI6sh vnRA== X-Gm-Message-State: ALoCoQnSKfLJhY790GeQkYLFTBrD4WgKjHkITX/WN6uWOinDTVNYeVe4HwQOEUCws+EYMB6vSjdW X-Received: by 10.112.60.36 with SMTP id e4mr2000579lbr.9.1405947737810; Mon, 21 Jul 2014 06:02:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.213 with SMTP id n79ls1959006qgd.29.gmail; Mon, 21 Jul 2014 06:02:17 -0700 (PDT) X-Received: by 10.221.24.135 with SMTP id re7mr9663123vcb.53.1405947737560; Mon, 21 Jul 2014 06:02:17 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id ur3si11252622vcb.43.2014.07.21.06.02.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 06:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id la4so12025487vcb.33 for ; Mon, 21 Jul 2014 06:02:16 -0700 (PDT) X-Received: by 10.52.248.146 with SMTP id ym18mr24623579vdc.8.1405947736576; Mon, 21 Jul 2014 06:02:16 -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.37.5 with SMTP id tc5csp110275vcb; Mon, 21 Jul 2014 06:02:16 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr11251316vcq.50.1405947735759; Mon, 21 Jul 2014 06:02:15 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gy3si11220811vdb.99.2014.07.21.06.02.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jul 2014 06:02:15 -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 1X9DCN-0001MS-VI; Mon, 21 Jul 2014 13:00:12 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X9DCL-0001KD-TF for xen-devel@lists.xen.org; Mon, 21 Jul 2014 13:00:10 +0000 Received: from [85.158.137.68:18629] by server-17.bemta-3.messagelabs.com id 50/95-27015-9DE0DC35; Mon, 21 Jul 2014 13:00:09 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1405947604!17070693!1 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 6035 invoked from network); 21 Jul 2014 13:00:05 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 21 Jul 2014 13:00:05 -0000 X-IronPort-AV: E=Sophos;i="5.01,701,1400025600"; d="scan'208";a="154656206" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 21 Jul 2014 13:00:03 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 21 Jul 2014 09:00:03 -0400 Received: from drall.uk.xensource.com ([10.80.16.71]) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1X9DCE-0004OY-Bn; Mon, 21 Jul 2014 14:00:03 +0100 Received: by drall.uk.xensource.com (sSMTP sendmail emulation); Mon, 21 Jul 2014 14:00:02 +0100 From: Ian Campbell To: Date: Mon, 21 Jul 2014 13:59:57 +0100 Message-ID: <1405947600-26047-3-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1405947600-26047-1-git-send-email-ian.campbell@citrix.com> References: <1405947513.25022.59.camel@kazak.uk.xensource.com> <1405947600-26047-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v3 3/6] xen: arm: Do not use level 0 section mappings in boot page tables. 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.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: Level 0 does not support superpage mappings, meaning that systems on where Xen is loaded above 512GB (I'm not aware of any such systems) the 1:1 mapping on the boot page tables is invalid. In order to avoid this issue we need an additional first level page table mapped by the appropriate L0 slot and containing a 1:1 superpage mapping. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- v2: Fixed stray hard tab --- xen/arch/arm/arm64/head.S | 21 ++++++++++++++++++--- xen/arch/arm/mm.c | 3 +++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 7c04e5b..2412fe8 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -267,13 +267,28 @@ skip_bss: orr x2, x1, x3 /* + rights for linear PT */ str x2, [x4, #0] /* Map it in slot 0 */ - /* ... map of paddr(start) in boot_pgtable */ + /* ... map of paddr(start) in boot_pgtable+boot_first_id */ lsr x1, x19, #ZEROETH_SHIFT/* Offset of base paddr in boot_pgtable */ cbz x1, 1f /* It's in slot 0, map in boot_first * or boot_second later on */ - lsl x2, x1, #ZEROETH_SHIFT /* Base address for 512GB mapping */ - mov x3, #PT_MEM /* x2 := Section mapping */ + /* Level zero does not support superpage mappings, so we have + * to use an extra first level page in which we create a 1GB mapping. + */ + ldr x2, =boot_first_id + add x2, x2, x20 /* x2 := paddr (boot_first_id) */ + + mov x3, #PT_PT /* x2 := table map of boot_first_id */ + orr x2, x2, x3 /* + rights for linear PT */ + lsl x1, x1, #3 /* x1 := Slot offset */ + str x2, [x4, x1] + + ldr x4, =boot_first_id /* Next level into boot_first_id */ + add x4, x4, x20 /* x4 := paddr(boot_first_id) */ + + lsr x1, x19, #FIRST_SHIFT /* x1 := Offset of base paddr in boot_first_id */ + lsl x2, x1, #FIRST_SHIFT /* x2 := Base address for 1GB mapping */ + mov x3, #PT_MEM /* x2 := Section map */ orr x2, x2, x3 and x1, x1, #LPAE_ENTRY_MASK /* x1 := Slot offset */ lsl x1, x1, #3 diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index fdc7c98..0a243b0 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -68,6 +68,7 @@ struct domain *dom_xen, *dom_io, *dom_cow; lpae_t boot_pgtable[LPAE_ENTRIES] __attribute__((__aligned__(4096))); #ifdef CONFIG_ARM_64 lpae_t boot_first[LPAE_ENTRIES] __attribute__((__aligned__(4096))); +lpae_t boot_first_id[LPAE_ENTRIES] __attribute__((__aligned__(4096))); #endif lpae_t boot_second[LPAE_ENTRIES] __attribute__((__aligned__(4096))); lpae_t boot_third[LPAE_ENTRIES] __attribute__((__aligned__(4096))); @@ -491,6 +492,8 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) #ifdef CONFIG_ARM_64 memset(boot_first, 0x0, PAGE_SIZE); clean_and_invalidate_xen_dcache(boot_first); + memset(boot_first_id, 0x0, PAGE_SIZE); + clean_and_invalidate_xen_dcache(boot_first_id); #endif memset(boot_second, 0x0, PAGE_SIZE); clean_and_invalidate_xen_dcache(boot_second);