don't reinitialize mutexes/cv on resume

part of PR port-xen/55207
This commit is contained in:
jdolecek 2020-05-13 13:19:38 +00:00
parent 6b3674e40d
commit 92b2c35b56
4 changed files with 29 additions and 23 deletions

View File

@ -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 <sys/cdefs.h>
__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)
{

View File

@ -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 <sys/cdefs.h>
__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 <sys/types.h>
#include <sys/null.h>
@ -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,

View File

@ -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);

View File

@ -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 <sys/cdefs.h>
__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;