From patchwork Thu Sep 15 11:28:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 76284 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2387317qgf; Thu, 15 Sep 2016 04:30:57 -0700 (PDT) X-Received: by 10.107.154.135 with SMTP id c129mr11015318ioe.184.1473939057769; Thu, 15 Sep 2016 04:30:57 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g189si4956876ioa.137.2016.09.15.04.30.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 04:30:57 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkUr2-0005GI-24; Thu, 15 Sep 2016 11:29:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkUr1-0005DF-0V for xen-devel@lists.xen.org; Thu, 15 Sep 2016 11:29:19 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id D7/6C-21406-E068AD75; Thu, 15 Sep 2016 11:29:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTZe37Va 4QUebjsWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmnGs7yp7wTKJigUXVjE2MB4V6WLk4hAS2MQo 0Xl9EiuEc5pR4t2JSSxdjJwcbAKaEnc+f2ICsUUEpCWufb7MCFLELNDOKLG2v5e5i5GDQ1jAS +LPVBGQGhYBVYm3H9vB6nkFXCUOPb3ABmJLCMhJnDw2mRWknBMovuS5KEhYSMBF4tiJnWwTGL kXMDKsYtQoTi0qSy3SNTTXSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQI9C8DEOx gvL0x4BCjJAeTkiivW9qtcCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvPtagHKCRanpqRVpmTnA QINJS3DwKInw/gBJ8xYXJOYWZ6ZDpE4xKkqJQ/QJgCQySvPg2mDBfYlRVkqYlxHoECGegtSi3 MwSVPlXjOIcjErCvKytQFN4MvNK4Ka/AlrMBLR4y5rrIItLEhFSUg2MHOlVFwyPNF2wdee/2/ k55kFl1J/N+ybumfnw1b2wlf8E1ycZsm9YfdBm5cbC3efa5ZuSzrm2BJ5f+OvGKta7f6f/m8O 7t9Lg7roci0Xl7Ebfd+5pv5m5rbXo6tzKPZ1nJh3yjnyrxj/l+7rW7dtiX/asePzyt3a3ac3W fs/vXB/euTdUnTgubafEUpyRaKjFXFScCAC7q2DGaQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1473938957!59479161!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65110 invoked from network); 15 Sep 2016 11:29:17 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-27.messagelabs.com with SMTP; 15 Sep 2016 11:29:17 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 07EF2C1D; Thu, 15 Sep 2016 04:29:17 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F204A3F251; Thu, 15 Sep 2016 04:29:15 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 15 Sep 2016 12:28:39 +0100 Message-Id: <1473938919-31976-24-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473938919-31976-1-git-send-email-julien.grall@arm.com> References: <1473938919-31976-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [for-4.8][PATCH v2 23/23] xen/arm: p2m: Export p2m_*_lock helpers X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Earlier patches exported the p2m interface (p2m_get_entry and p2m_set_entry) to allow splitting xen/arch/arm/p2m.c. Those functions require the callers to lock the p2m, so we need to export p2m_*_lock helpers. All helpers but p2m_write_unlock but p2m_write_unlock are moved in xen/include/asm-arm/p2m.h to allow inlining. The helpers p2m_write_unlock is kept in p2m.c because it depends on a static function. Signed-off-by: Julien Grall --- Changes in v2: - Patch added --- xen/arch/arm/p2m.c | 28 ++-------------------------- xen/include/asm-arm/p2m.h | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index c1dac09..fa08e06 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -60,11 +60,6 @@ static inline bool p2m_is_superpage(lpae_t pte, unsigned int level) return (level < 3) && p2m_mapping(pte); } -static inline void p2m_write_lock(struct p2m_domain *p2m) -{ - write_lock(&p2m->lock); -} - /* * Return the start of the next mapping based on the order of the * current one. @@ -83,7 +78,8 @@ static inline gfn_t gfn_next_boundary(gfn_t gfn, unsigned int order) static void p2m_flush_tlb(struct p2m_domain *p2m); -static inline void p2m_write_unlock(struct p2m_domain *p2m) +/* Unlock the flush and do a P2M TLB flush if necessary */ +void p2m_write_unlock(struct p2m_domain *p2m) { if ( p2m->need_flush ) { @@ -99,26 +95,6 @@ static inline void p2m_write_unlock(struct p2m_domain *p2m) write_unlock(&p2m->lock); } -static inline void p2m_read_lock(struct p2m_domain *p2m) -{ - read_lock(&p2m->lock); -} - -static inline void p2m_read_unlock(struct p2m_domain *p2m) -{ - read_unlock(&p2m->lock); -} - -static inline int p2m_is_locked(struct p2m_domain *p2m) -{ - return rw_is_locked(&p2m->lock); -} - -static inline int p2m_is_write_locked(struct p2m_domain *p2m) -{ - return rw_is_write_locked(&p2m->lock); -} - void p2m_dump_info(struct domain *d) { struct p2m_domain *p2m = &d->arch.p2m; diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index cca86ef..1480c5b 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -176,6 +176,33 @@ void p2m_restore_state(struct vcpu *n); /* Print debugging/statistial info about a domain's p2m */ void p2m_dump_info(struct domain *d); +static inline void p2m_write_lock(struct p2m_domain *p2m) +{ + write_lock(&p2m->lock); +} + +void p2m_write_unlock(struct p2m_domain *p2m); + +static inline void p2m_read_lock(struct p2m_domain *p2m) +{ + read_lock(&p2m->lock); +} + +static inline void p2m_read_unlock(struct p2m_domain *p2m) +{ + read_unlock(&p2m->lock); +} + +static inline int p2m_is_locked(struct p2m_domain *p2m) +{ + return rw_is_locked(&p2m->lock); +} + +static inline int p2m_is_write_locked(struct p2m_domain *p2m) +{ + return rw_is_write_locked(&p2m->lock); +} + /* Look up the MFN corresponding to a domain's GFN. */ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t);