From patchwork Fri Jul 18 16:12:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 33879 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F3CA20CA0 for ; Fri, 18 Jul 2014 16:15:11 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hu12sf10623381vcb.9 for ; Fri, 18 Jul 2014 09:15:08 -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=VDxZuk8yBHLqO5NploPgcFPpqFhvfQ71X+zYibEbCQA=; b=fPEDrPWpobwkUjCjteqDh5bylfJiUkEn7PhsTXGy6iYMnooRFyVmtfJP+CK5tTse0k IfIqjOEAzR65+kfbFM/1QB7V4cBYpaVF8C6uuYHnQlwJvwG/iTT2CZkgnAwl4jy4wpcT fMTE5kgm8tPQlMH6dksquykhe0t68ggc32CGhhrvXTePqqTSGJUlyzA/R9BbE6NqdT1H rCCwc1w3dIH1KG6Q/BQyTbBDRrGnsdS5U9B0zzlcymPpVRmgB23PgTAhISWh20Pbz76+ cG1ndmJzcZECipiMcI3CD70OK/AIhZdrhslIn59FRSJPRtUXtuVFJGCy7lNW7IgAPQty DXlg== X-Gm-Message-State: ALoCoQmYWhU1BT+iixhPxzI0CygBNQhZrKE9ociNMyaDhWRCn9vImNfLA29wH47Cgqr1OrwoBh0g X-Received: by 10.236.92.69 with SMTP id i45mr2509179yhf.20.1405700108582; Fri, 18 Jul 2014 09:15:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.134 with SMTP id e6ls1041203qgf.34.gmail; Fri, 18 Jul 2014 09:15:08 -0700 (PDT) X-Received: by 10.220.59.65 with SMTP id k1mr7412340vch.22.1405700108505; Fri, 18 Jul 2014 09:15:08 -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 w6si6244557vco.104.2014.07.18.09.15.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 09:15:08 -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 hq11so6238530vcb.16 for ; Fri, 18 Jul 2014 09:15:08 -0700 (PDT) X-Received: by 10.52.120.38 with SMTP id kz6mr6114427vdb.86.1405700108279; Fri, 18 Jul 2014 09:15:08 -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 tc5csp24001vcb; Fri, 18 Jul 2014 09:15:07 -0700 (PDT) X-Received: by 10.50.79.232 with SMTP id m8mr40606712igx.33.1405700107721; Fri, 18 Jul 2014 09:15:07 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id qf5si6205819igb.24.2014.07.18.09.15.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jul 2014 09:15:07 -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 1X8AmW-00068w-Mw; Fri, 18 Jul 2014 16:13:12 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X8AmV-000688-0z for xen-devel@lists.xen.org; Fri, 18 Jul 2014 16:13:11 +0000 Received: from [85.158.137.68:11929] by server-4.bemta-3.messagelabs.com id 4C/89-18709-69749C35; Fri, 18 Jul 2014 16:13:10 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1405699988!13030870!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 30494 invoked from network); 18 Jul 2014 16:13:09 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2014 16:13:09 -0000 X-IronPort-AV: E=Sophos;i="5.01,686,1400025600"; d="scan'208";a="153731660" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 18 Jul 2014 16:13:00 +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; Fri, 18 Jul 2014 12:12: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 1X8AmI-0004Uw-G6; Fri, 18 Jul 2014 17:12:59 +0100 Received: by drall.uk.xensource.com (sSMTP sendmail emulation); Fri, 18 Jul 2014 17:12:58 +0100 From: Ian Campbell To: Date: Fri, 18 Jul 2014 17:12:55 +0100 Message-ID: <1405699976-9260-3-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1405699976-9260-1-git-send-email-ian.campbell@citrix.com> References: <1405699899.6419.7.camel@kazak.uk.xensource.com> <1405699976-9260-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v2 3/4] 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.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: 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 5d7b2b5..6ba9d94 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, #0x1ff /* 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);