From patchwork Thu Dec 5 15:42:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22075 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D3F90202E0 for ; Thu, 5 Dec 2013 15:42:34 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id r5sf9978296qcx.4 for ; Thu, 05 Dec 2013 07:42:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ES90Z7Hx+bmVqXY3e1FAS0YItEQxVMm2ICSRwHXjIn0=; b=I3Fq+1r9IkVEPn714RtEYOkgxaxtlwB552MoL38M9Xt2ViXa4yBefEYaLd1o1TfAnb x71nc43AhO4lMPibu/l3/C6KwusbocIEtvPrWvULhghoRDEESoR47BbWifPAqPCWq8xZ 0goNNUWiwD+Q+n++Wwt6nw3MTPUmGJ7Eq+CjKIIKhSXcA8GcHtYUDxLJPnyB8vNpQMuu AuSDB0d2ef7mpALolpuxk9XBlJJVijuN720ypBCR1z9gCFoXsys1od8fxfp6u4lIwN6d QPt2I38vbZO8YHmXPH4CgZb+YcdQuCJtMz97FBbIdzKQgYZdorbKGJxSzj6DCaSDzj0+ rCHw== X-Gm-Message-State: ALoCoQlka0MBc1TVfoNTjqAwXllWR9+/5IEmyqbZ3uo/+B/Nr4ROJZRkcgbcBF/fFX+6UXb6L1E6 X-Received: by 10.236.180.2 with SMTP id i2mr33928578yhm.4.1386258154655; Thu, 05 Dec 2013 07:42:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.37 with SMTP id e5ls873995qer.84.gmail; Thu, 05 Dec 2013 07:42:34 -0800 (PST) X-Received: by 10.52.165.76 with SMTP id yw12mr1071144vdb.82.1386258154575; Thu, 05 Dec 2013 07:42:34 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id gs7si34845255veb.129.2013.12.05.07.42.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 07:42:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id if17so13372094vcb.11 for ; Thu, 05 Dec 2013 07:42:34 -0800 (PST) X-Received: by 10.220.95.201 with SMTP id e9mr1283466vcn.71.1386258154331; Thu, 05 Dec 2013 07:42:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp24844vcz; Thu, 5 Dec 2013 07:42:34 -0800 (PST) X-Received: by 10.194.1.139 with SMTP id 11mr51851965wjm.33.1386258153596; Thu, 05 Dec 2013 07:42:33 -0800 (PST) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by mx.google.com with ESMTPS id bj10si6987397wjc.39.2013.12.05.07.42.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 07:42:33 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.171 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.171; Received: by mail-we0-f171.google.com with SMTP id q58so16928299wes.30 for ; Thu, 05 Dec 2013 07:42:33 -0800 (PST) X-Received: by 10.180.76.204 with SMTP id m12mr12641154wiw.9.1386258153019; Thu, 05 Dec 2013 07:42:33 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id w20sm7350575wia.5.2013.12.05.07.42.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2013 07:42:31 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, time@xen.org, stefano.stabellini@citrix.com, Julien Grall Subject: [PATCH 5/8] xen/arm: p2m: Add p2m_get_entry Date: Thu, 5 Dec 2013 15:42:08 +0000 Message-Id: <1386258131-755-6-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386258131-755-1-git-send-email-julien.grall@linaro.org> References: <1386258131-755-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Reuse the code of p2m_lookup and add an argument to retrieve the p2m type. Signed-off-by: Julien Grall --- xen/arch/arm/p2m.c | 11 ++++++++++- xen/include/asm-arm/p2m.h | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 5449a35..1ae2521 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -71,11 +71,17 @@ static lpae_t *p2m_map_first(struct p2m_domain *p2m, paddr_t addr) * There are no processor functions to do a stage 2 only lookup therefore we * do a a software walk. */ -paddr_t p2m_lookup(struct domain *d, paddr_t paddr) +paddr_t p2m_get_entry(struct domain *d, paddr_t paddr, p2m_type_t *t) { struct p2m_domain *p2m = &d->arch.p2m; lpae_t pte, *first = NULL, *second = NULL, *third = NULL; paddr_t maddr = INVALID_PADDR; + p2m_type_t _t; + + /* Allow t to be NULL */ + t = t ?: &_t; + + *t = p2m_invalid; spin_lock(&p2m->lock); @@ -99,7 +105,10 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr) done: if ( pte.p2m.valid ) + { maddr = (pte.bits & PADDR_MASK & PAGE_MASK) | (paddr & ~PAGE_MASK); + *t = pte.p2m.avail; + } if (third) unmap_domain_page(third); if (second) unmap_domain_page(second); diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 1cf7d36..3de69c4 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -49,7 +49,12 @@ int p2m_alloc_table(struct domain *d); void p2m_load_VTTBR(struct domain *d); /* Look up the MFN corresponding to a domain's PFN. */ -paddr_t p2m_lookup(struct domain *d, paddr_t gpfn); +paddr_t p2m_get_entry(struct domain *d, paddr_t gpfn, p2m_type_t *t); + +static inline paddr_t p2m_lookup(struct domain *d, paddr_t gpfn) +{ + return p2m_get_entry(d, gpfn, NULL); +} /* Setup p2m RAM mapping for domain d from start-end. */ int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end);