From patchwork Wed Jan 20 14:07:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8072281 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E95139F1CC for ; Wed, 20 Jan 2016 14:09:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A445204AF for ; Wed, 20 Jan 2016 14:09:17 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24410204A9 for ; Wed, 20 Jan 2016 14:09:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLtPl-0004Sm-Oy; Wed, 20 Jan 2016 14:07:13 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLtPj-0004SQ-Md for xen-devel@lists.xenproject.org; Wed, 20 Jan 2016 14:07:11 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id F5/C0-17089-E849F965; Wed, 20 Jan 2016 14:07:10 +0000 X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1453298826!17037367!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 41110 invoked from network); 20 Jan 2016 14:07:07 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-12.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Jan 2016 14:07:07 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Wed, 20 Jan 2016 07:07:06 -0700 Message-Id: <569FA29702000078000C91EE@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Wed, 20 Jan 2016 07:07:03 -0700 From: "Jan Beulich" To: "xen-devel" References: <569FA12902000078000C91C7@prv-mh.provo.novell.com> In-Reply-To: <569FA12902000078000C91C7@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper , Keir Fraser Subject: [Xen-devel] [PATCH 3/3] x86/paging: invlpg() hook returns boolean X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ... so make its return type reflect this. Signed-off-by: Jan Beulich x86/paging: invlpg() hook returns boolean ... so make its return type reflect this. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -680,7 +680,7 @@ static int hap_page_fault(struct vcpu *v * HAP guests can handle invlpg without needing any action from Xen, so * should not be intercepting it. */ -static int hap_invlpg(struct vcpu *v, unsigned long va) +static bool_t hap_invlpg(struct vcpu *v, unsigned long va) { if (nestedhvm_enabled(v->domain)) { /* Emulate INVLPGA: --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -3510,11 +3510,12 @@ propagate: } -static int -sh_invlpg(struct vcpu *v, unsigned long va) -/* Called when the guest requests an invlpg. Returns 1 if the invlpg +/* + * Called when the guest requests an invlpg. Returns 1 if the invlpg * instruction should be issued on the hardware, or 0 if it's safe not - * to do so. */ + * to do so. + */ +static bool_t sh_invlpg(struct vcpu *v, unsigned long va) { mfn_t sl1mfn; shadow_l2e_t sl2e; --- a/xen/arch/x86/mm/shadow/none.c +++ b/xen/arch/x86/mm/shadow/none.c @@ -32,10 +32,10 @@ static int _page_fault(struct vcpu *v, u return 0; } -static int _invlpg(struct vcpu *v, unsigned long va) +static bool_t _invlpg(struct vcpu *v, unsigned long va) { ASSERT_UNREACHABLE(); - return -EOPNOTSUPP; + return 1; } static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m, --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4392,8 +4392,7 @@ static int __do_update_va_mapping( switch ( (bmap_ptr = flags & ~UVMF_FLUSHTYPE_MASK) ) { case UVMF_LOCAL: - if ( !paging_mode_enabled(d) || - (paging_invlpg(v, va) != 0) ) + if ( !paging_mode_enabled(d) || paging_invlpg(v, va) ) flush_tlb_one_local(va); break; case UVMF_ALL: --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -104,7 +104,7 @@ struct shadow_paging_mode { struct paging_mode { int (*page_fault )(struct vcpu *v, unsigned long va, struct cpu_user_regs *regs); - int (*invlpg )(struct vcpu *v, unsigned long va); + bool_t (*invlpg )(struct vcpu *v, unsigned long va); unsigned long (*gva_to_gfn )(struct vcpu *v, struct p2m_domain *p2m, unsigned long va, @@ -243,7 +243,7 @@ paging_fault(unsigned long va, struct cp /* Handle invlpg requests on vcpus. * Returns 1 if the invlpg instruction should be issued on the hardware, * or 0 if it's safe not to do so. */ -static inline int paging_invlpg(struct vcpu *v, unsigned long va) +static inline bool_t paging_invlpg(struct vcpu *v, unsigned long va) { return (paging_mode_external(v->domain) ? is_canonical_address(va) : __addr_ok(va)) && Reviewed-by: Andrew Cooper , although this Acked-by: Tim Deegan Acked-by: George Dunlap --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -680,7 +680,7 @@ static int hap_page_fault(struct vcpu *v * HAP guests can handle invlpg without needing any action from Xen, so * should not be intercepting it. */ -static int hap_invlpg(struct vcpu *v, unsigned long va) +static bool_t hap_invlpg(struct vcpu *v, unsigned long va) { if (nestedhvm_enabled(v->domain)) { /* Emulate INVLPGA: --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -3510,11 +3510,12 @@ propagate: } -static int -sh_invlpg(struct vcpu *v, unsigned long va) -/* Called when the guest requests an invlpg. Returns 1 if the invlpg +/* + * Called when the guest requests an invlpg. Returns 1 if the invlpg * instruction should be issued on the hardware, or 0 if it's safe not - * to do so. */ + * to do so. + */ +static bool_t sh_invlpg(struct vcpu *v, unsigned long va) { mfn_t sl1mfn; shadow_l2e_t sl2e; --- a/xen/arch/x86/mm/shadow/none.c +++ b/xen/arch/x86/mm/shadow/none.c @@ -32,10 +32,10 @@ static int _page_fault(struct vcpu *v, u return 0; } -static int _invlpg(struct vcpu *v, unsigned long va) +static bool_t _invlpg(struct vcpu *v, unsigned long va) { ASSERT_UNREACHABLE(); - return -EOPNOTSUPP; + return 1; } static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m, --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4392,8 +4392,7 @@ static int __do_update_va_mapping( switch ( (bmap_ptr = flags & ~UVMF_FLUSHTYPE_MASK) ) { case UVMF_LOCAL: - if ( !paging_mode_enabled(d) || - (paging_invlpg(v, va) != 0) ) + if ( !paging_mode_enabled(d) || paging_invlpg(v, va) ) flush_tlb_one_local(va); break; case UVMF_ALL: --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -104,7 +104,7 @@ struct shadow_paging_mode { struct paging_mode { int (*page_fault )(struct vcpu *v, unsigned long va, struct cpu_user_regs *regs); - int (*invlpg )(struct vcpu *v, unsigned long va); + bool_t (*invlpg )(struct vcpu *v, unsigned long va); unsigned long (*gva_to_gfn )(struct vcpu *v, struct p2m_domain *p2m, unsigned long va, @@ -243,7 +243,7 @@ paging_fault(unsigned long va, struct cp /* Handle invlpg requests on vcpus. * Returns 1 if the invlpg instruction should be issued on the hardware, * or 0 if it's safe not to do so. */ -static inline int paging_invlpg(struct vcpu *v, unsigned long va) +static inline bool_t paging_invlpg(struct vcpu *v, unsigned long va) { return (paging_mode_external(v->domain) ? is_canonical_address(va) : __addr_ok(va)) &&