From 14037d51a0451bc59a37c1d1de3254dbe5214fe0 Mon Sep 17 00:00:00 2001 From: cherry Date: Wed, 13 Feb 2019 06:52:43 +0000 Subject: [PATCH] Further restrict the scope of XENPV to relevant parts. --- sys/arch/xen/include/xenpmap.h | 5 ++++- sys/arch/xen/xen/evtchn.c | 8 ++++++-- sys/arch/xen/xen/hypervisor.c | 10 ++++++---- sys/arch/xen/xen/xen_machdep.c | 6 ++++-- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/sys/arch/xen/include/xenpmap.h b/sys/arch/xen/include/xenpmap.h index 449a11a39122..c860d458801f 100644 --- a/sys/arch/xen/include/xenpmap.h +++ b/sys/arch/xen/include/xenpmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: xenpmap.h,v 1.40 2018/07/26 17:20:08 maxv Exp $ */ +/* $NetBSD: xenpmap.h,v 1.41 2019/02/13 06:52:43 cherry Exp $ */ /* * @@ -72,6 +72,7 @@ void xen_kpm_sync(struct pmap *, int); #define xpq_queue_pin_l4_table(pa) \ xpq_queue_pin_table(pa, MMUEXT_PIN_L4_TABLE) +#ifdef XENPV extern unsigned long *xpmap_phys_to_machine_mapping; static __inline paddr_t @@ -121,6 +122,8 @@ xpmap_ptom_isvalid(paddr_t ppa) != INVALID_P2M_ENTRY); } +#endif /* XENPV */ + static inline void MULTI_update_va_mapping( multicall_entry_t *mcl, vaddr_t va, diff --git a/sys/arch/xen/xen/evtchn.c b/sys/arch/xen/xen/evtchn.c index 86149bb8d6a9..01f926b612e1 100644 --- a/sys/arch/xen/xen/evtchn.c +++ b/sys/arch/xen/xen/evtchn.c @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.84 2019/02/13 05:01:58 cherry Exp $ */ +/* $NetBSD: evtchn.c,v 1.85 2019/02/13 06:52:43 cherry Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.84 2019/02/13 05:01:58 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.85 2019/02/13 06:52:43 cherry Exp $"); #include "opt_xen.h" #include "isa.h" @@ -256,6 +256,7 @@ void events_init(void) { mutex_init(&evtchn_lock, MUTEX_DEFAULT, IPL_NONE); +#ifdef XENPV debug_port = bind_virq_to_evtch(VIRQ_DEBUG); KASSERT(debug_port != -1); @@ -273,6 +274,7 @@ events_init(void) #if NPCI > 0 || NISA > 0 hypervisor_ack_pirq_event(debug_port); #endif /* NPCI > 0 || NISA > 0 */ +#endif /* XENPV */ x86_enable_intr(); /* at long last... */ } @@ -1080,6 +1082,7 @@ xen_debug_handler(void *arg) return 0; } +#ifdef XENPV static struct evtsource * event_get_handler(const char *intrid) { @@ -1207,3 +1210,4 @@ interrupt_construct_intrids(const kcpuset_t *cpuset) return ii_handler; } +#endif /* XENPV */ diff --git a/sys/arch/xen/xen/hypervisor.c b/sys/arch/xen/xen/hypervisor.c index 90235233bfb1..ec2cfddf5b5e 100644 --- a/sys/arch/xen/xen/hypervisor.c +++ b/sys/arch/xen/xen/hypervisor.c @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.70 2019/02/02 12:32:55 cherry Exp $ */ +/* $NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.70 2019/02/02 12:32:55 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $"); #include #include @@ -373,20 +373,22 @@ hypervisor_attach(device_t parent, device_t self, void *aux) static bool hypervisor_suspend(device_t dev, const pmf_qual_t *qual) { +#ifdef XENPV events_suspend(); xengnt_suspend(); - +#endif return true; } static bool hypervisor_resume(device_t dev, const pmf_qual_t *qual) { +#ifdef XENPV hypervisor_machdep_resume(); xengnt_resume(); events_resume(); - +#endif return true; } diff --git a/sys/arch/xen/xen/xen_machdep.c b/sys/arch/xen/xen/xen_machdep.c index 1e70756dd57b..a51648817f4c 100644 --- a/sys/arch/xen/xen/xen_machdep.c +++ b/sys/arch/xen/xen/xen_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: xen_machdep.c,v 1.20 2019/02/02 12:32:55 cherry Exp $ */ +/* $NetBSD: xen_machdep.c,v 1.21 2019/02/13 06:52:43 cherry Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.20 2019/02/02 12:32:55 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.21 2019/02/13 06:52:43 cherry Exp $"); #include "opt_xen.h" @@ -80,6 +80,7 @@ u_int tsc_get_timecount(struct timecounter *); bool xen_suspend_allow; +#ifdef XENPV extern uint64_t tsc_freq; /* XXX */ static int sysctl_xen_suspend(SYSCTLFN_ARGS); @@ -419,6 +420,7 @@ xen_suspend_domain(void) aprint_verbose("domain resumed\n"); } +#endif /* XENPV */ #define PRINTK_BUFSIZE 1024 void