[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 09/18] x86/traps: move {un, }register_guest_nmi_callback
No functional change. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/pv/traps.c | 37 +++++++++++++++++++++++++++++++++++++ xen/arch/x86/traps.c | 36 ------------------------------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c index e96123c71f..54d77922c5 100644 --- a/xen/arch/x86/pv/traps.c +++ b/xen/arch/x86/pv/traps.c @@ -28,6 +28,7 @@ #include <asm/apic.h> #include <asm/debugreg.h> +#include <asm/nmi.h> #include <asm/shared.h> #include <asm/traps.h> @@ -218,6 +219,42 @@ int set_guest_nmi_trapbounce(void) return !null_trap_bounce(v, tb); } +long register_guest_nmi_callback(unsigned long address) +{ + struct vcpu *v = current; + struct domain *d = v->domain; + struct trap_info *t = &v->arch.pv_vcpu.trap_ctxt[TRAP_nmi]; + + if ( !is_canonical_address(address) ) + return -EINVAL; + + t->vector = TRAP_nmi; + t->flags = 0; + t->cs = (is_pv_32bit_domain(d) ? + FLAT_COMPAT_KERNEL_CS : FLAT_KERNEL_CS); + t->address = address; + TI_SET_IF(t, 1); + + /* + * If no handler was registered we can 'lose the NMI edge'. Re-assert it + * now. + */ + if ( (v->vcpu_id == 0) && (arch_get_nmi_reason(d) != 0) ) + v->nmi_pending = 1; + + return 0; +} + +long unregister_guest_nmi_callback(void) +{ + struct vcpu *v = current; + struct trap_info *t = &v->arch.pv_vcpu.trap_ctxt[TRAP_nmi]; + + memset(t, 0, sizeof(*t)); + + return 0; +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e711810388..24343f46dc 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1905,42 +1905,6 @@ void __init trap_init(void) open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq); } -long register_guest_nmi_callback(unsigned long address) -{ - struct vcpu *v = current; - struct domain *d = v->domain; - struct trap_info *t = &v->arch.pv_vcpu.trap_ctxt[TRAP_nmi]; - - if ( !is_canonical_address(address) ) - return -EINVAL; - - t->vector = TRAP_nmi; - t->flags = 0; - t->cs = (is_pv_32bit_domain(d) ? - FLAT_COMPAT_KERNEL_CS : FLAT_KERNEL_CS); - t->address = address; - TI_SET_IF(t, 1); - - /* - * If no handler was registered we can 'lose the NMI edge'. Re-assert it - * now. - */ - if ( (v->vcpu_id == 0) && (arch_get_nmi_reason(d) != 0) ) - v->nmi_pending = 1; - - return 0; -} - -long unregister_guest_nmi_callback(void) -{ - struct vcpu *v = current; - struct trap_info *t = &v->arch.pv_vcpu.trap_ctxt[TRAP_nmi]; - - memset(t, 0, sizeof(*t)); - - return 0; -} - int guest_has_trap_callback(struct domain *d, uint16_t vcpuid, unsigned int trap_nr) { struct vcpu *v; -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |