From: Wei Liu Date: Mon, 26 Jun 2017 14:20:35 +0000 (+0100) Subject: xen: move do_nmi_op and make it x86 only X-Git-Tag: 4.10.0-rc1~805 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0e97a5b6f932f4dab3a8cedaf651fe62f6cd533d;p=people%2Fdariof%2Fxen.git xen: move do_nmi_op and make it x86 only Since ARM doesn't need {compat,do}_nmi_op, move the hypercall handlers from common/kernel.c to pv/callback.c. Drop the stubs in ARM. Delete the common and ARM nmi.h and adjust header inclusions in various files. Signed-off-by: Wei Liu Reviewed-by: Andrew Cooper Acked-by: Stefano Stabellini --- diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index 410cfa1f94..ced61fd17e 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c index 13534d4914..126f7a8d9f 100644 --- a/xen/arch/x86/oprofile/nmi_int.c +++ b/xen/arch/x86/oprofile/nmi_int.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include "op_counter.h" #include "op_x86_model.h" diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index b9dd39bf0e..5317ae8f05 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -411,6 +412,54 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps) return rc; } +long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +{ + struct xennmi_callback cb; + long rc = 0; + + switch ( cmd ) + { + case XENNMI_register_callback: + rc = -EFAULT; + if ( copy_from_guest(&cb, arg, 1) ) + break; + rc = register_guest_nmi_callback(cb.handler_address); + break; + case XENNMI_unregister_callback: + rc = unregister_guest_nmi_callback(); + break; + default: + rc = -ENOSYS; + break; + } + + return rc; +} + +int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +{ + struct compat_nmi_callback cb; + int rc = 0; + + switch ( cmd ) + { + case XENNMI_register_callback: + rc = -EFAULT; + if ( copy_from_guest(&cb, arg, 1) ) + break; + rc = register_guest_nmi_callback(cb.handler_address); + break; + case XENNMI_unregister_callback: + rc = unregister_guest_nmi_callback(); + break; + default: + rc = -ENOSYS; + break; + } + + return rc; +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 69e1f4bc9a..0b7cf68c4d 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -64,6 +63,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c index a15231ca0c..41ec78f8fc 100644 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/common/compat/kernel.c b/xen/common/compat/kernel.c index df93fdd89c..64232669d2 100644 --- a/xen/common/compat/kernel.c +++ b/xen/common/compat/kernel.c @@ -9,11 +9,9 @@ asm(".file \"" __FILE__ "\""); #include #include #include -#include #include #include #include -#include #include extern xen_commandline_t saved_cmdline; @@ -39,9 +37,6 @@ CHECK_TYPE(capabilities_info); CHECK_TYPE(domain_handle); -#define xennmi_callback compat_nmi_callback -#define xennmi_callback_t compat_nmi_callback_t - #ifdef COMPAT_VM_ASSIST_VALID #undef VM_ASSIST_VALID #define VM_ASSIST_VALID COMPAT_VM_ASSIST_VALID diff --git a/xen/common/kernel.c b/xen/common/kernel.c index e1ebb0b412..ce7cb8adb5 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -10,12 +10,10 @@ #include #include #include -#include #include #include #include #include -#include #include #ifndef COMPAT @@ -431,30 +429,6 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) return -ENOSYS; } -DO(nmi_op)(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) -{ - struct xennmi_callback cb; - long rc = 0; - - switch ( cmd ) - { - case XENNMI_register_callback: - rc = -EFAULT; - if ( copy_from_guest(&cb, arg, 1) ) - break; - rc = register_guest_nmi_callback(cb.handler_address); - break; - case XENNMI_unregister_callback: - rc = unregister_guest_nmi_callback(); - break; - default: - rc = -ENOSYS; - break; - } - - return rc; -} - #ifdef VM_ASSIST_VALID DO(vm_assist)(unsigned int cmd, unsigned int type) { diff --git a/xen/include/asm-arm/nmi.h b/xen/include/asm-arm/nmi.h deleted file mode 100644 index a60587e7d1..0000000000 --- a/xen/include/asm-arm/nmi.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ASM_NMI_H -#define ASM_NMI_H - -#define register_guest_nmi_callback(a) (-ENOSYS) -#define unregister_guest_nmi_callback() (-ENOSYS) - -#endif /* ASM_NMI_H */ -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/xen/nmi.h b/xen/include/xen/nmi.h deleted file mode 100644 index e526b6ab6f..0000000000 --- a/xen/include/xen/nmi.h +++ /dev/null @@ -1,14 +0,0 @@ -/****************************************************************************** - * nmi.h - * - * Register and unregister NMI callbacks. - * - * Copyright (c) 2006, Ian Campbell - */ - -#ifndef __XEN_NMI_H__ -#define __XEN_NMI_H__ - -#include - -#endif /* __XEN_NMI_H__ */