From patchwork Mon Sep 11 11:16:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9947181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFA7F6024A for ; Mon, 11 Sep 2017 11:18:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0BB024B48 for ; Mon, 11 Sep 2017 11:18:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4CB928B7D; Mon, 11 Sep 2017 11:18:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3460924B48 for ; Mon, 11 Sep 2017 11:18:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drMhf-00080j-Uy; Mon, 11 Sep 2017 11:16:35 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drMhe-00080Y-EZ for xen-devel@lists.xenproject.org; Mon, 11 Sep 2017 11:16:34 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 56/40-15060-19076B95; Mon, 11 Sep 2017 11:16:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRWlGSWpSXmKPExsXitHSDve7Egm2 RBkv381t83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBm37s5gLnigVfF2jm0DY6NCFyMnh4SAv8TD 7RtYQWw2AWWJn529bCC2iICeRNOB54xdjFwczAJHmCR+9/9kBkkICxhKNJxvYwexWQRUJWasu AFm8wpYSLz9d5AVYqi8xK62i2C2kICCRMf0Y0wQNYISJ2c+YQGxmQUkJA6+eME8gZF7FpLULC SpBYxMqxg1ilOLylKLdI2M9ZKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAoOBAQh 2MP6ZH3iIUZKDSUmU993xLZFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHiX52+LFBIsSk1PrUjL zAGGJUxagoNHSYT3AEiat7ggMbc4Mx0idYpRl6Pj5t0/TEIsefl5qVLivCtAigRAijJK8+BGw GLkEqOslDAvI9BRQjwFqUW5mSWo8q8YxTkYlYR5Y0Cm8GTmlcBtegV0BBPQETyXtoAcUZKIkJ JqYFzAFBfcJqXZZ7t3k8K0x/bdLJc2654pFZljoqk4+Yb0pgJWC96NBT+kXdew66p1fvasyPa vjHnIOPPoVr5z1ee3pV3UyD3VsrMi/WvtfIPLWf/MjqtL///Jrj9/m7W/3tbOXoPVl2d9XK/U 9sS+MTr7DYub7MKtu3lPpEVarNFxV37g0hocrcRSnJFoqMVcVJwIAH8KEguMAgAA X-Env-Sender: prvs=4209e1772=wei.liu2@citrix.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1505128591!82268789!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 35415 invoked from network); 11 Sep 2017 11:16:32 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 11 Sep 2017 11:16:32 -0000 X-IronPort-AV: E=Sophos;i="5.42,377,1500940800"; d="scan'208";a="447383098" From: Wei Liu To: Xen-devel Date: Mon, 11 Sep 2017 12:16:28 +0100 Message-ID: <20170911111628.26480-1-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: Tamas K Lengyel , Wei Liu , Razvan Cojocaru , George Dunlap , Andrew Cooper , Julien Grall , Stefano Stabellini , Jan Beulich Subject: [Xen-devel] [PATCH] mem_access: switch to plain bool 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Wei Liu Acked-by: Razvan Cojocaru Reviewed-by: Stefano Stabellini --- Cc: Razvan Cojocaru Cc: Tamas K Lengyel Cc: Stefano Stabellini Cc: Julien Grall Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/arm/mem_access.c | 4 ++-- xen/arch/x86/mm/mem_access.c | 16 ++++++++-------- xen/include/asm-arm/mem_access.h | 8 ++++---- xen/include/asm-x86/mem_access.h | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c index db9ad3f3c9..0f2cbb81d3 100644 --- a/xen/arch/arm/mem_access.c +++ b/xen/arch/arm/mem_access.c @@ -219,10 +219,10 @@ err: return page; } -bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec) +bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec) { int rc; - bool_t violation; + bool violation; xenmem_access_t xma; vm_event_request_t *req; struct vcpu *v = current; diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c index 414e38f998..9211fc0abe 100644 --- a/xen/arch/x86/mm/mem_access.c +++ b/xen/arch/x86/mm/mem_access.c @@ -83,7 +83,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v, const vm_event_response_t *rsp) { xenmem_access_t access; - bool violation = 1; + bool violation = true; const struct vm_event_mem_access *data = &rsp->u.mem_access; struct domain *d = v->domain; struct p2m_domain *p2m = NULL; @@ -129,7 +129,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v, break; case XENMEM_access_rwx: - violation = 0; + violation = false; break; } } @@ -137,9 +137,9 @@ bool p2m_mem_access_emulate_check(struct vcpu *v, return violation; } -bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla, - struct npfec npfec, - vm_event_request_t **req_ptr) +bool p2m_mem_access_check(paddr_t gpa, unsigned long gla, + struct npfec npfec, + vm_event_request_t **req_ptr) { struct vcpu *v = current; unsigned long gfn = gpa >> PAGE_SHIFT; @@ -167,7 +167,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla, rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw, -1); ASSERT(rc == 0); gfn_unlock(p2m, gfn, 0); - return 1; + return true; } else if ( p2ma == p2m_access_n2rwx ) { @@ -188,7 +188,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla, "no vm_event listener VCPU %d, dom %d\n", v->vcpu_id, d->domain_id); domain_crash(v->domain); - return 0; + return false; } else { @@ -204,7 +204,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla, ASSERT(rc == 0); } gfn_unlock(p2m, gfn, 0); - return 1; + return true; } } diff --git a/xen/include/asm-arm/mem_access.h b/xen/include/asm-arm/mem_access.h index 3a155f84eb..1610635c5b 100644 --- a/xen/include/asm-arm/mem_access.h +++ b/xen/include/asm-arm/mem_access.h @@ -22,20 +22,20 @@ bool p2m_mem_access_emulate_check(struct vcpu *v, const vm_event_response_t *rsp) { /* Not supported on ARM. */ - return 0; + return false; } /* vm_event and mem_access are supported on any ARM guest */ -static inline bool_t p2m_mem_access_sanity_check(struct domain *d) +static inline bool p2m_mem_access_sanity_check(struct domain *d) { - return 1; + return true; } /* * Send mem event based on the access. Boolean return value indicates if trap * needs to be injected into guest. */ -bool_t p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec); +bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec); struct page_info* p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, diff --git a/xen/include/asm-x86/mem_access.h b/xen/include/asm-x86/mem_access.h index 9f7b409b4e..4043c9fb4d 100644 --- a/xen/include/asm-x86/mem_access.h +++ b/xen/include/asm-x86/mem_access.h @@ -34,9 +34,9 @@ * ring. Once having released get_gfn* locks caller must also xfree the * request. */ -bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla, - struct npfec npfec, - vm_event_request_t **req_ptr); +bool p2m_mem_access_check(paddr_t gpa, unsigned long gla, + struct npfec npfec, + vm_event_request_t **req_ptr); /* Check for emulation and mark vcpu for skipping one instruction * upon rescheduling if required. */ @@ -44,7 +44,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v, const vm_event_response_t *rsp); /* Sanity check for mem_access hardware support */ -static inline bool_t p2m_mem_access_sanity_check(struct domain *d) +static inline bool p2m_mem_access_sanity_check(struct domain *d) { return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d); }