From patchwork Thu Jun 8 17:11:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9776125 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 DC7CC603B4 for ; Thu, 8 Jun 2017 17:18:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C12EB2841C for ; Thu, 8 Jun 2017 17:18:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5C1B28508; Thu, 8 Jun 2017 17:18:49 +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 4040628438 for ; Thu, 8 Jun 2017 17:18:49 +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 1dJ12r-00065T-N4; Thu, 08 Jun 2017 17:16:29 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJ12r-00061s-BN for xen-devel@lists.xenproject.org; Thu, 08 Jun 2017 17:16:29 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id 1D/22-03613-D6689395; Thu, 08 Jun 2017 17:16:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeJIrShJLcpLzFFi42JxWrohUjenzTL S4OxcXYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePsxT7Ggl2iFff/HmVtYHwu2MXIySEh4C9x +sZXdhCbTUBZ4mdnLxuILSKgJ9F04DkjiM0skCfR+fEjWI2wgI/E5Sk9YDaLgIrE1/YLYDavg KXEqxf3WCBmykvsarvICmJzAsWXfJ7O3MXIwSEkYCHRuzMBJCwkoCDRMf0YE0SroMTJmU9YIF ZJSBx88YJ5AiPvLCSpWUhSCxiZVjGqF6cWlaUW6RrqJRVlpmeU5CZm5ugaGpjp5aYWFyemp+Y kJhXrJefnbmIEBg4DEOxg3Pnc6RCjJAeTkiivYqtlpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ Xm+QnGBRanpqRVpmDjCEYdISHDxKIrxrG4DSvMUFibnFmekQqVOMilLivDtB+gRAEhmleXBts Li5xCgrJczLCHSIEE9BalFuZgmq/CtGcQ5GJWFeUZApPJl5JXDTXwEtZgJavOSdBcjikkSElF QDo5zu3GfzVur+eLtrjsaGGdzGjyef+vUm7v/XM+5Lmq9Mu9jnG/W8hW2x0ER21pNyCrKlF7t tew/fPHTnFHOQ7Ppr19m5XPY+XeWUbKmg+0zHR8zw149NgXuWPgh6LXl/QuEue+f8pGuXX/an 1uZVRx1q6bpdY3yqsmsb002deUwbG+3N563YEanEUpyRaKjFXFScCADUwcV7lgIAAA== X-Env-Sender: prvs=3259bf657=wei.liu2@citrix.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1496942180!106940754!4 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26233 invoked from network); 8 Jun 2017 17:16:28 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-6.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 8 Jun 2017 17:16:28 -0000 X-IronPort-AV: E=Sophos;i="5.39,315,1493683200"; d="scan'208";a="427129650" From: Wei Liu To: Xen-devel Date: Thu, 8 Jun 2017 18:11:46 +0100 Message-ID: <20170608171203.20416-11-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608171203.20416-1-wei.liu2@citrix.com> References: <20170608171203.20416-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH v4 10/27] x86/traps: move set_guest_{machine, nmi}_trapbounce 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 Take the opportunity to change their return type to bool. And rename "v" to "curr". Signed-off-by: Wei Liu --- xen/arch/x86/pv/traps.c | 27 +++++++++++++++++++++++++++ xen/arch/x86/traps.c | 27 --------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c index ec7ff1040b..e374cd73b4 100644 --- a/xen/arch/x86/pv/traps.c +++ b/xen/arch/x86/pv/traps.c @@ -156,6 +156,33 @@ void pv_inject_event(const struct x86_event *event) } } +/* + * Called from asm to set up the MCE trapbounce info. + * Returns false no callback is set up, else true. + */ +bool set_guest_machinecheck_trapbounce(void) +{ + struct vcpu *curr = current; + struct trap_bounce *tb = &curr->arch.pv_vcpu.trap_bounce; + + pv_inject_hw_exception(TRAP_machine_check, X86_EVENT_NO_EC); + tb->flags &= ~TBF_EXCEPTION; /* not needed for MCE delivery path */ + return !null_trap_bounce(curr, tb); +} + +/* + * Called from asm to set up the NMI trapbounce info. + * Returns false if no callback is set up, else true. + */ +bool set_guest_nmi_trapbounce(void) +{ + struct vcpu *curr = current; + struct trap_bounce *tb = &curr->arch.pv_vcpu.trap_bounce; + pv_inject_hw_exception(TRAP_nmi, X86_EVENT_NO_EC); + tb->flags &= ~TBF_EXCEPTION; /* not needed for NMI delivery path */ + return !null_trap_bounce(curr, tb); +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 6abfb62c0c..013de702ad 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -626,33 +626,6 @@ void fatal_trap(const struct cpu_user_regs *regs, bool_t show_remote) (regs->eflags & X86_EFLAGS_IF) ? "" : ", IN INTERRUPT CONTEXT"); } -/* - * Called from asm to set up the MCE trapbounce info. - * Returns 0 if no callback is set up, else 1. - */ -int set_guest_machinecheck_trapbounce(void) -{ - struct vcpu *v = current; - struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce; - - pv_inject_hw_exception(TRAP_machine_check, X86_EVENT_NO_EC); - tb->flags &= ~TBF_EXCEPTION; /* not needed for MCE delivery path */ - return !null_trap_bounce(v, tb); -} - -/* - * Called from asm to set up the NMI trapbounce info. - * Returns 0 if no callback is set up, else 1. - */ -int set_guest_nmi_trapbounce(void) -{ - struct vcpu *v = current; - struct trap_bounce *tb = &v->arch.pv_vcpu.trap_bounce; - pv_inject_hw_exception(TRAP_nmi, X86_EVENT_NO_EC); - tb->flags &= ~TBF_EXCEPTION; /* not needed for NMI delivery path */ - return !null_trap_bounce(v, tb); -} - void do_reserved_trap(struct cpu_user_regs *regs) { unsigned int trapnr = regs->entry_vector;