From patchwork Thu Sep 4 16:14:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 36741 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE9BA202E4 for ; Thu, 4 Sep 2014 16:16:54 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id eb12sf53128332oac.5 for ; Thu, 04 Sep 2014 09:16:50 -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=3y290Ri9fvEGoJVAqu7bXRkXOMUnMiYnBHy4G3Q4jE0=; b=a4S4zV2YJxCF3tIsktj3p5SM1HWglDAXyGYf+eTA33/J7HPZwAUYo2hW2EiaZYOg+n D1eZ8Uw9uXuKuspKDQPKP7T90b7FN2HDHRnhZp18z4uhetolRUVPttTmHa0DDhW3WL0j vyZgoy+/KeDPVzNlR0NjZ2/SFcAM0n1gwNE2aXjM6tqgrdppzmXO7WMykpwOlypaQjCm WN8kmJFIwRUcRGxEz3L3+PTS/K9LTi5B19i27PEc9N4j7Ubo7D1CeaNLI2VPbpPUldJl 3Ck8MTNjHiq/xEGgPIwqh/bAPkm0zeptVZni1RNma/9GFqp2hq2+BkgR+p4SYeyvM/XI bo8Q== X-Gm-Message-State: ALoCoQkExu2mWIMOLZJx+0ZGYjb+lK2sgPMiT2i5SwSCEIsROpow7HDq/kjzzQJKgNsv5hl5y4cX X-Received: by 10.182.29.65 with SMTP id i1mr2733978obh.30.1409847410262; Thu, 04 Sep 2014 09:16:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.225 with SMTP id s88ls365852qga.59.gmail; Thu, 04 Sep 2014 09:16:50 -0700 (PDT) X-Received: by 10.220.167.9 with SMTP id o9mr5292129vcy.8.1409847410009; Thu, 04 Sep 2014 09:16:50 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id gx1si6037988vcb.61.2014.09.04.09.16.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 09:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ij19so10899238vcb.31 for ; Thu, 04 Sep 2014 09:16:49 -0700 (PDT) X-Received: by 10.220.175.17 with SMTP id v17mr5309080vcz.0.1409847409910; Thu, 04 Sep 2014 09:16:49 -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 uj3csp863272vcb; Thu, 4 Sep 2014 09:16:49 -0700 (PDT) X-Received: by 10.220.86.193 with SMTP id t1mr5222071vcl.22.1409847409479; Thu, 04 Sep 2014 09:16:49 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ir4si6052434vcb.19.2014.09.04.09.16.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 09:16:45 -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 1XPZg5-0001T4-Ra; Thu, 04 Sep 2014 16:14:29 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XPZg4-0001ST-0x for xen-devel@lists.xen.org; Thu, 04 Sep 2014 16:14:28 +0000 Received: from [85.158.143.35:35102] by server-2.bemta-4.messagelabs.com id 4E/D5-04525-3EF88045; Thu, 04 Sep 2014 16:14:27 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1409847265!13627072!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 21461 invoked from network); 4 Sep 2014 16:14:26 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 4 Sep 2014 16:14:26 -0000 X-IronPort-AV: E=Sophos;i="5.04,467,1406592000"; d="scan'208";a="168408637" 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:18 -0400 Received: from drall.uk.xensource.com ([10.80.16.71]) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1XPZft-0004Pt-Ny; Thu, 04 Sep 2014 17:14:18 +0100 Received: by drall.uk.xensource.com (sSMTP sendmail emulation); Thu, 04 Sep 2014 17:14:17 +0100 From: Ian Campbell To: Date: Thu, 4 Sep 2014 17:14:09 +0100 Message-ID: <4427aba8dad3155fca151a0b63bfdf78e3a91033.1409847257.git.ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1409847227.10156.35.camel@kazak.uk.xensource.com> References: <1409847227.10156.35.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@linaro.org, Ian Campbell , vijay.kilari@gmail.com, stefano.stabellini@eu.citrix.com, Vijaya Kumar K , Ian Campbell , tim@xen.org Subject: [Xen-devel] [PATCH v2 1/9] xen: arm: rename p2m->first_level to p2m->root. 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.172 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: From: Ian Campbell This was previously part of Vigaya's "xen/arm: Add 4-level page table for stage 2 translation" but is split out here to make that patch easier to read. I went with ->root rather than ->root_level as the original did. Signed-off-by: Ian Campbell Cc: Vijaya Kumar K Reviewed-by: Julien Grall --- v2: Clarified commit log --- xen/arch/arm/p2m.c | 24 ++++++++++++------------ xen/drivers/passthrough/arm/smmu.c | 2 +- xen/include/asm-arm/p2m.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index fc8c0dd..ec3b451 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -12,8 +12,8 @@ #include /* First level P2M is 2 consecutive pages */ -#define P2M_FIRST_ORDER 1 -#define P2M_FIRST_ENTRIES (LPAE_ENTRIES<first_level, page_to_mfn(p2m->first_level)); + p2m->root, page_to_mfn(p2m->root)); - first = __map_domain_page(p2m->first_level); + first = __map_domain_page(p2m->root); dump_pt_walk(first, addr); unmap_domain_page(first); } @@ -141,10 +141,10 @@ static lpae_t *p2m_map_first(struct p2m_domain *p2m, paddr_t addr) { struct page_info *page; - if ( first_linear_offset(addr) >= P2M_FIRST_ENTRIES ) + if ( first_linear_offset(addr) >= P2M_ROOT_ENTRIES ) return NULL; - page = p2m->first_level + p2m_first_level_index(addr); + page = p2m->root + p2m_first_level_index(addr); return __map_domain_page(page); } @@ -932,7 +932,7 @@ int p2m_alloc_table(struct domain *d) struct p2m_domain *p2m = &d->arch.p2m; struct page_info *page; - page = alloc_domheap_pages(NULL, P2M_FIRST_ORDER, 0); + page = alloc_domheap_pages(NULL, P2M_ROOT_ORDER, 0); if ( page == NULL ) return -ENOMEM; @@ -942,9 +942,9 @@ int p2m_alloc_table(struct domain *d) clear_and_clean_page(page); clear_and_clean_page(page + 1); - p2m->first_level = page; + p2m->root = page; - d->arch.vttbr = page_to_maddr(p2m->first_level) + d->arch.vttbr = page_to_maddr(p2m->root) | ((uint64_t)p2m->vmid&0xff)<<48; /* Make sure that all TLBs corresponding to the new VMID are flushed @@ -1021,9 +1021,9 @@ void p2m_teardown(struct domain *d) while ( (pg = page_list_remove_head(&p2m->pages)) ) free_domheap_page(pg); - free_domheap_pages(p2m->first_level, P2M_FIRST_ORDER); + free_domheap_pages(p2m->root, P2M_ROOT_ORDER); - p2m->first_level = NULL; + p2m->root = NULL; p2m_free_vmid(d); @@ -1047,7 +1047,7 @@ int p2m_init(struct domain *d) d->arch.vttbr = 0; - p2m->first_level = NULL; + p2m->root = NULL; p2m->max_mapped_gfn = 0; p2m->lowest_mapped_gfn = ULONG_MAX; diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index f4eb2a2..42bde75 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -937,7 +937,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain_cfg *cfg) paddr_t p2maddr; ASSERT(cfg->domain != NULL); - p2maddr = page_to_maddr(cfg->domain->arch.p2m.first_level); + p2maddr = page_to_maddr(cfg->domain->arch.p2m.root); gr1_base = SMMU_GR1(smmu); cb_base = SMMU_CB_BASE(smmu) + SMMU_CB(smmu, cfg->cbndx); diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 08ce07b..3648568 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -20,7 +20,7 @@ struct p2m_domain { struct page_list_head pages; /* Root of p2m page tables, 2 contiguous pages */ - struct page_info *first_level; + struct page_info *root; /* Current VMID in use */ uint8_t vmid;