diff mbox

[v4,10/27] x86/traps: move set_guest_{machine, nmi}_trapbounce

Message ID 20170608171203.20416-11-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu June 8, 2017, 5:11 p.m. UTC
Take the opportunity to change their return type to bool. And rename
"v" to "curr".

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/pv/traps.c | 27 +++++++++++++++++++++++++++
 xen/arch/x86/traps.c    | 27 ---------------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

Comments

Andrew Cooper June 23, 2017, 11:05 a.m. UTC | #1
On 08/06/17 18:11, Wei Liu wrote:
> Take the opportunity to change their return type to bool. And rename
> "v" to "curr".
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
>  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 */

As we are fixing style, newline.

> +    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;

newline.

> +    pv_inject_hw_exception(TRAP_nmi, X86_EVENT_NO_EC);
> +    tb->flags &= ~TBF_EXCEPTION; /* not needed for NMI delivery path */

and newline.

Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

> +    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;
diff mbox

Patch

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;