diff --git a/sys/arch/xen/xen/evtchn.c b/sys/arch/xen/xen/evtchn.c index f1355b1a050c..f1711d8566b7 100644 --- a/sys/arch/xen/xen/evtchn.c +++ b/sys/arch/xen/xen/evtchn.c @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.94 2020/05/07 19:48:57 bouyer Exp $ */ +/* $NetBSD: evtchn.c,v 1.95 2020/05/13 13:19:38 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.94 2020/05/07 19:48:57 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.95 2020/05/13 13:19:38 jdolecek Exp $"); #include "opt_xen.h" #include "isa.h" @@ -254,6 +254,13 @@ void events_init(void) { mutex_init(&evtchn_lock, MUTEX_DEFAULT, IPL_NONE); + + (void)events_resume(); +} + +bool +events_resume(void) +{ #ifdef XENPV debug_port = bind_virq_to_evtch(VIRQ_DEBUG); @@ -271,6 +278,8 @@ events_init(void) hypervisor_unmask_event(debug_port); #endif /* XENPV */ x86_enable_intr(); /* at long last... */ + + return true; } bool @@ -294,15 +303,6 @@ events_suspend(void) return true; } -bool -events_resume (void) -{ - events_init(); - - return true; -} - - unsigned int evtchn_do_event(int evtch, struct intrframe *regs) { diff --git a/sys/arch/xen/xenbus/xenbus_comms.c b/sys/arch/xen/xenbus/xenbus_comms.c index 44a30ed7a069..c10338ba02aa 100644 --- a/sys/arch/xen/xenbus/xenbus_comms.c +++ b/sys/arch/xen/xenbus/xenbus_comms.c @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_comms.c,v 1.23 2020/05/06 16:50:13 bouyer Exp $ */ +/* $NetBSD: xenbus_comms.c,v 1.24 2020/05/13 13:19:38 jdolecek Exp $ */ /****************************************************************************** * xenbus_comms.c * @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.23 2020/05/06 16:50:13 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.24 2020/05/13 13:19:38 jdolecek Exp $"); #include #include @@ -219,11 +219,17 @@ xb_read(void *data, unsigned len) int xb_init_comms(device_t dev) { - int evtchn; - mutex_init(&xenstore_lock, MUTEX_DEFAULT, IPL_TTY); cv_init(&xenstore_cv, "xsio"); + return xb_resume_comms(dev); +} + +int +xb_resume_comms(device_t dev) +{ + int evtchn; + evtchn = xen_start_info.store_evtchn; ih = xen_intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_TTY, diff --git a/sys/arch/xen/xenbus/xenbus_comms.h b/sys/arch/xen/xenbus/xenbus_comms.h index 85614b73e9d2..8a4573c9c10f 100644 --- a/sys/arch/xen/xenbus/xenbus_comms.h +++ b/sys/arch/xen/xenbus/xenbus_comms.h @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_comms.h,v 1.7 2020/05/06 16:50:13 bouyer Exp $ */ +/* $NetBSD: xenbus_comms.h,v 1.8 2020/05/13 13:19:38 jdolecek Exp $ */ /* * Private include for xenbus communications. * @@ -30,10 +30,10 @@ #define _XENBUS_COMMS_H void xenbus_kernfs_init(void); -int xs_init(device_t dev); -int xb_init_comms(device_t dev); -void xb_suspend_comms(device_t dev); -void xb_resume_comms(device_t dev); +int xs_init(device_t); +int xb_init_comms(device_t); +void xb_suspend_comms(device_t); +int xb_resume_comms(device_t); void xb_xenstored_make_ready(void); diff --git a/sys/arch/xen/xenbus/xenbus_probe.c b/sys/arch/xen/xenbus/xenbus_probe.c index 54722de23d9c..8202b82640dc 100644 --- a/sys/arch/xen/xenbus/xenbus_probe.c +++ b/sys/arch/xen/xenbus/xenbus_probe.c @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_probe.c,v 1.52 2020/05/06 16:50:13 bouyer Exp $ */ +/* $NetBSD: xenbus_probe.c,v 1.53 2020/05/13 13:19:38 jdolecek Exp $ */ /****************************************************************************** * Talks to Xen Store to figure out what devices we have. * @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.52 2020/05/06 16:50:13 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.53 2020/05/13 13:19:38 jdolecek Exp $"); #if 0 #define DPRINTK(fmt, args...) \ @@ -131,7 +131,7 @@ xenbus_suspend(device_t dev, const pmf_qual_t *qual) static bool xenbus_resume(device_t dev, const pmf_qual_t *qual) { - xb_init_comms(dev); + xb_resume_comms(dev); xs_resume(); return true;