From patchwork Mon Jul 16 17:27:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 142075 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2677677ljj; Mon, 16 Jul 2018 10:29:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpes2bwQoEWu+ygRkBjNKx5w8jfWtLAzW5srMSpNZkoyNwvBamn/VFqZ2RfA6AhiWxjmeO8R X-Received: by 2002:a24:b715:: with SMTP id h21-v6mr14138501itf.32.1531762179939; Mon, 16 Jul 2018 10:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531762179; cv=none; d=google.com; s=arc-20160816; b=szde36ijSxRyWRzCsBvD4MiGlLrtC2KntZ88Ym+HjIOjtNlQiKZx2uQpQTrdxyW3pB cLMq8SO5RQ8L2yDsmYqjUNJAYS0PEfljUpcRKKJ7ziMh9zt3ntMP7ilifHCXuVNDwfWx ApXUueLaPQJwBLUHsGtv6rqVYjzmTY9vhgJk+RXFJ2i9liDZgWMWkxMkSebFl7nD3mRS fgz8yN2eJ6Vs5VO7tXHl+o6n2XosGyKEcwBxnNucoED2Hc9enaDJC1uK00E25mcgaBDc j7C8YFyJtnBUJjTYF+6n8GYbZowIwQru6PUuKL9MUJ3nOt0eQ3XaLTCLe7MK1I5/iyOc DFAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=/JFp3D0uWWOI147H4mzZbrGA8WMyeuF3Zt/Lsh/J/sg=; b=rxZBvTTYTSDkuGIXDAYtX06MkFQKr4SLMsM2DINZmxOhynDaJPzhSyKH5kn3+81I9+ plHtI9kbG9yOrE5fEAAA2LHKuHZtCenaew+14Bu9HH1MxsA5WwPxmAoGt2oWaEdVjI6M hBOe27sUNU5Cm2KuSlO81Uk/0aXbt+m7ZDKGOgWjpNhpeCME+urljjxHctAVoRLWlKU0 f5WBaq1EDaOj41MGz/NNNXhsaPPrt4XAwuCWfLHgI7tj6Is/OqU9/tTAkGiVi2Sbo2Wb ec9bocKkNtUOcxt6ryoK/so1G99hgPJbzp2RmTH7kkbaIrDCxlk0QR40v3eMozakkGf4 BDsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k9-v6si16766918iop.135.2018.07.16.10.29.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 10:29:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ff7HX-0006Ul-7a; Mon, 16 Jul 2018 17:27:31 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ff7HV-0006SY-8b for xen-devel@lists.xenproject.org; Mon, 16 Jul 2018 17:27:29 +0000 X-Inumbo-ID: 77568929-891d-11e8-a8a5-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 77568929-891d-11e8-a8a5-bc764e045a96; Mon, 16 Jul 2018 19:27:08 +0200 (CEST) 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 B7B0715AD; Mon, 16 Jul 2018 10:27:27 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F128C3F5B1; Mon, 16 Jul 2018 10:27:26 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jul 2018 18:27:05 +0100 Message-Id: <20180716172712.20294-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180716172712.20294-1-julien.grall@arm.com> References: <20180716172712.20294-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 08/15] xen/arm: Rename lpae_valid to lpae_is_valid X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This will help to keep the naming consistent accross all lpae helpers. No functional change intended. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/guest_walk.c | 2 +- xen/arch/arm/mm.c | 6 +++--- xen/arch/arm/p2m.c | 20 ++++++++++---------- xen/include/asm-arm/lpae.h | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c index 4d1ea0cdc1..a7c7e05603 100644 --- a/xen/arch/arm/guest_walk.c +++ b/xen/arch/arm/guest_walk.c @@ -546,7 +546,7 @@ static int guest_walk_ld(const struct vcpu *v, * - The PTE is not valid. * - If (level < 3) and the PTE is valid, we found a block descriptor. */ - if ( level == 3 || !lpae_valid(pte) || lpae_is_superpage(pte, level) ) + if ( level == 3 || !lpae_is_valid(pte) || lpae_is_superpage(pte, level) ) break; /* diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b7f2dabd05..de9b965d2f 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1005,7 +1005,7 @@ static int create_xen_entries(enum xenmap_operation op, } } - BUG_ON(!lpae_valid(*entry)); + BUG_ON(!lpae_is_valid(*entry)); third = __mfn_to_virt(entry->pt.base); entry = &third[third_table_offset(addr)]; @@ -1013,7 +1013,7 @@ static int create_xen_entries(enum xenmap_operation op, switch ( op ) { case INSERT: case RESERVE: - if ( lpae_valid(*entry) ) + if ( lpae_is_valid(*entry) ) { printk("%s: trying to replace an existing mapping addr=%lx mfn=%"PRI_mfn"\n", __func__, addr, mfn_x(mfn)); @@ -1030,7 +1030,7 @@ static int create_xen_entries(enum xenmap_operation op, break; case MODIFY: case REMOVE: - if ( !lpae_valid(*entry) ) + if ( !lpae_is_valid(*entry) ) { printk("%s: trying to %s a non-existing mapping addr=%lx\n", __func__, op == REMOVE ? "remove" : "modify", addr); diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 72a84a33fd..a80ac301c5 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -250,7 +250,7 @@ static int p2m_next_level(struct p2m_domain *p2m, bool read_only, entry = *table + offset; - if ( !lpae_valid(*entry) ) + if ( !lpae_is_valid(*entry) ) { if ( read_only ) return GUEST_TABLE_MAP_FAILED; @@ -342,7 +342,7 @@ mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, entry = table[offsets[level]]; - if ( lpae_valid(entry) ) + if ( lpae_is_valid(entry) ) { *t = entry.p2m.type; @@ -546,7 +546,7 @@ static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry) lpae_t *p; lpae_t pte; - ASSERT(!lpae_valid(*entry)); + ASSERT(!lpae_is_valid(*entry)); page = alloc_domheap_page(NULL, 0); if ( page == NULL ) @@ -610,7 +610,7 @@ static int p2m_mem_access_radix_set(struct p2m_domain *p2m, gfn_t gfn, */ static void p2m_put_l3_page(const lpae_t pte) { - ASSERT(lpae_valid(pte)); + ASSERT(lpae_is_valid(pte)); /* * TODO: Handle other p2m types @@ -638,7 +638,7 @@ static void p2m_free_entry(struct p2m_domain *p2m, struct page_info *pg; /* Nothing to do if the entry is invalid. */ - if ( !lpae_valid(entry) ) + if ( !lpae_is_valid(entry) ) return; /* Nothing to do but updating the stats if the entry is a super-page. */ @@ -908,12 +908,12 @@ static int __p2m_set_entry(struct p2m_domain *p2m, * sequence when updating the translation table (D4.7.1 in ARM DDI * 0487A.j). */ - if ( lpae_valid(orig_pte) ) + if ( lpae_is_valid(orig_pte) ) p2m_remove_pte(entry, p2m->clean_pte); if ( mfn_eq(smfn, INVALID_MFN) ) /* Flush can be deferred if the entry is removed */ - p2m->need_flush |= !!lpae_valid(orig_pte); + p2m->need_flush |= !!lpae_is_valid(orig_pte); else { lpae_t pte = mfn_to_p2m_entry(smfn, t, a); @@ -928,7 +928,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m, * Although, it could be defered when only the permissions are * changed (e.g in case of memaccess). */ - if ( lpae_valid(orig_pte) ) + if ( lpae_is_valid(orig_pte) ) { if ( likely(!p2m->mem_access_enabled) || P2M_CLEAR_PERM(pte) != P2M_CLEAR_PERM(orig_pte) ) @@ -950,11 +950,11 @@ static int __p2m_set_entry(struct p2m_domain *p2m, * Free the entry only if the original pte was valid and the base * is different (to avoid freeing when permission is changed). */ - if ( lpae_valid(orig_pte) && entry->p2m.base != orig_pte.p2m.base ) + if ( lpae_is_valid(orig_pte) && entry->p2m.base != orig_pte.p2m.base ) p2m_free_entry(p2m, orig_pte, level); if ( need_iommu(p2m->domain) && - (lpae_valid(orig_pte) || lpae_valid(*entry)) ) + (lpae_is_valid(orig_pte) || lpae_is_valid(*entry)) ) rc = iommu_iotlb_flush(p2m->domain, gfn_x(sgfn), 1UL << page_order); else rc = 0; diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index c803569c2d..1d86020d07 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -128,19 +128,19 @@ typedef union { lpae_walk_t walk; } lpae_t; -static inline bool lpae_valid(lpae_t pte) +static inline bool lpae_is_valid(lpae_t pte) { return pte.walk.valid; } static inline bool lpae_is_table(lpae_t pte, unsigned int level) { - return (level < 3) && lpae_valid(pte) && pte.walk.table; + return (level < 3) && lpae_is_valid(pte) && pte.walk.table; } static inline bool lpae_is_mapping(lpae_t pte, unsigned int level) { - if ( !lpae_valid(pte) ) + if ( !lpae_is_valid(pte) ) return false; else if ( level == 3 ) return pte.walk.table; @@ -155,7 +155,7 @@ static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) static inline bool lpae_is_page(lpae_t pte, unsigned int level) { - return (level == 3) && lpae_valid(pte) && pte.walk.table; + return (level == 3) && lpae_is_valid(pte) && pte.walk.table; } /*