From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH 3/4] xen/arm: p2m: Introduce an helper to remove an entry in the page table Date: Wed, 18 Nov 2015 15:49:21 +0000 Message-ID: <1447861762-20994-4-git-send-email-julien.grall@citrix.com> References: <1447861762-20994-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zz50c-0006k5-8L for xen-devel@lists.xenproject.org; Wed, 18 Nov 2015 15:50:58 +0000 In-Reply-To: <1447861762-20994-1-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Julien Grall , ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Factorize the code to remove an entry in p2m_remove_pte so we can re-use it later. Signed-off-by: Julien Grall --- xen/arch/arm/p2m.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index f28ae3f..ae0acf0 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -367,6 +367,14 @@ static inline void p2m_write_pte(lpae_t *p, lpae_t pte, bool_t flush_cache) clean_dcache(*p); } +static inline void p2m_remove_pte(lpae_t *p, bool_t flush_cache) +{ + lpae_t pte; + + memset(&pte, 0x00, sizeof(pte)); + p2m_write_pte(p, pte, flush_cache); +} + /* * Allocate a new page table page and hook it in via the given entry. * apply_one_level relies on this returning 0 on success @@ -839,8 +847,7 @@ static int apply_one_level(struct domain *d, *flush = true; - memset(&pte, 0x00, sizeof(pte)); - p2m_write_pte(entry, pte, flush_cache); + p2m_remove_pte(entry, flush_cache); p2m_mem_access_radix_set(p2m, paddr_to_pfn(*addr), p2m_access_rwx); *addr += level_size; -- 2.1.4