Decompose hypervisor_enable_event() into functional steps.
The hypervisor_unmask_event() step is relevant for any event. The pirq related step is only relevant for pirq bound events. Prune blanket usage of this, so that usage is semantically appropriate.
This commit is contained in:
parent
0f10d4ce0d
commit
1fe45bdd64
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hypervisor.h,v 1.45 2018/09/23 02:27:24 cherry Exp $ */
|
||||
/* $NetBSD: hypervisor.h,v 1.46 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -55,7 +55,8 @@
|
||||
#define _XEN_HYPERVISOR_H_
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
|
||||
struct hypervisor_attach_args {
|
||||
const char *haa_busname;
|
||||
@ -130,8 +131,10 @@ extern volatile shared_info_t *HYPERVISOR_shared_info;
|
||||
struct intrframe;
|
||||
struct cpu_info;
|
||||
void do_hypervisor_callback(struct intrframe *regs);
|
||||
#if NPCI > 0 || NISA > 0
|
||||
void hypervisor_prime_pirq_event(int, unsigned int);
|
||||
void hypervisor_enable_event(unsigned int);
|
||||
void hypervisor_ack_pirq_event(unsigned int);
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
|
||||
extern int xen_version;
|
||||
#define XEN_MAJOR(x) (((x) & 0xffff0000) >> 16)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hypervisor_machdep.c,v 1.28 2014/09/21 12:46:15 bouyer Exp $ */
|
||||
/* $NetBSD: hypervisor_machdep.c,v 1.29 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.28 2014/09/21 12:46:15 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.29 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -71,6 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.28 2014/09/21 12:46:15 bouy
|
||||
#include <xen/xenpmap.h>
|
||||
|
||||
#include "opt_xen.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
|
||||
/*
|
||||
* arch-dependent p2m frame lists list (L3 and L2)
|
||||
@ -392,7 +394,10 @@ evt_enable_event(unsigned int port, unsigned int l1i,
|
||||
unsigned int l2i, void *args)
|
||||
{
|
||||
KASSERT(args == NULL);
|
||||
hypervisor_enable_event(port);
|
||||
hypervisor_unmask_event(port);
|
||||
#if NPCI > 0 || NISA > 0
|
||||
hypervisor_ack_pirq_event(port);
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xen_ipi.c,v 1.27 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: xen_ipi.c,v 1.28 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
@ -33,10 +33,10 @@
|
||||
|
||||
/*
|
||||
* Based on: x86/ipi.c
|
||||
* __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.27 2018/10/24 03:59:33 cherry Exp $");
|
||||
* __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.28 2018/10/26 05:33:21 cherry Exp $");
|
||||
*/
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.27 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.28 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -143,7 +143,7 @@ xen_ipi_init(void)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
hypervisor_enable_event(evtchn);
|
||||
hypervisor_unmask_event(evtchn);
|
||||
}
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: clock.c,v 1.71 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.72 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.71 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.72 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -769,7 +769,7 @@ xen_resumeclocks(struct cpu_info *ci)
|
||||
if (ci->ci_xen_timer_intrhand == NULL)
|
||||
panic("failed to establish timer interrupt handler");
|
||||
|
||||
hypervisor_enable_event(evtch);
|
||||
hypervisor_unmask_event(evtch);
|
||||
|
||||
aprint_verbose("Xen %s: using event channel %d\n", intr_xname, evtch);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: evtchn.c,v 1.81 2018/09/23 02:27:24 cherry Exp $ */
|
||||
/* $NetBSD: evtchn.c,v 1.82 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.81 2018/09/23 02:27:24 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.82 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
#include "isa.h"
|
||||
@ -269,8 +269,10 @@ events_init(void)
|
||||
*/
|
||||
evtsource[debug_port] = (void *)-1;
|
||||
xen_atomic_set_bit(&curcpu()->ci_evtmask[0], debug_port);
|
||||
hypervisor_enable_event(debug_port);
|
||||
|
||||
hypervisor_unmask_event(debug_port);
|
||||
#if NPCI > 0 || NISA > 0
|
||||
hypervisor_ack_pirq_event(debug_port);
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
x86_enable_intr(); /* at long last... */
|
||||
}
|
||||
|
||||
@ -331,7 +333,10 @@ evtchn_do_event(int evtch, struct intrframe *regs)
|
||||
*/
|
||||
if (__predict_false(evtch == debug_port)) {
|
||||
xen_debug_handler(NULL);
|
||||
hypervisor_enable_event(evtch);
|
||||
hypervisor_unmask_event(debug_port);
|
||||
#if NPCI > 0 || NISA > 0
|
||||
hypervisor_ack_pirq_event(debug_port);
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -391,7 +396,11 @@ evtchn_do_event(int evtch, struct intrframe *regs)
|
||||
}
|
||||
mutex_spin_exit(&evtlock[evtch]);
|
||||
cli();
|
||||
hypervisor_enable_event(evtch);
|
||||
hypervisor_unmask_event(evtch);
|
||||
#if NPCI > 0 || NISA > 0
|
||||
hypervisor_ack_pirq_event(evtch);
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
|
||||
splx:
|
||||
/*
|
||||
* C version of spllower(). ASTs will be checked when
|
||||
@ -759,7 +768,8 @@ pirq_establish(int pirq, int evtch, int (*func)(void *), void *arg, int level,
|
||||
}
|
||||
|
||||
hypervisor_prime_pirq_event(pirq, evtch);
|
||||
hypervisor_enable_event(evtch);
|
||||
hypervisor_unmask_event(evtch);
|
||||
hypervisor_ack_pirq_event(evtch);
|
||||
return ih;
|
||||
}
|
||||
|
||||
@ -994,10 +1004,10 @@ event_remove_handler(int evtch, int (*func)(void *), void *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if NPCI > 0 || NISA > 0
|
||||
void
|
||||
hypervisor_prime_pirq_event(int pirq, unsigned int evtch)
|
||||
{
|
||||
#if NPCI > 0 || NISA > 0
|
||||
physdev_op_t physdev_op;
|
||||
physdev_op.cmd = PHYSDEVOP_IRQ_STATUS_QUERY;
|
||||
physdev_op.u.irq_status_query.irq = pirq;
|
||||
@ -1010,19 +1020,16 @@ hypervisor_prime_pirq_event(int pirq, unsigned int evtch)
|
||||
printf("pirq %d needs notify\n", pirq);
|
||||
#endif
|
||||
}
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
}
|
||||
|
||||
void
|
||||
hypervisor_enable_event(unsigned int evtch)
|
||||
hypervisor_ack_pirq_event(unsigned int evtch)
|
||||
{
|
||||
#ifdef IRQ_DEBUG
|
||||
if (evtch == IRQ_DEBUG)
|
||||
printf("hypervisor_enable_evtch: evtch %d\n", evtch);
|
||||
printf("%s: evtch %d\n", __func__, evtch);
|
||||
#endif
|
||||
|
||||
hypervisor_unmask_event(evtch);
|
||||
#if NPCI > 0 || NISA > 0
|
||||
if (pirq_needs_unmask_notify[evtch >> 5] & (1 << (evtch & 0x1f))) {
|
||||
#ifdef IRQ_DEBUG
|
||||
if (evtch == IRQ_DEBUG)
|
||||
@ -1030,8 +1037,8 @@ hypervisor_enable_event(unsigned int evtch)
|
||||
#endif
|
||||
(void)HYPERVISOR_physdev_op(&physdev_op_notify);
|
||||
}
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
}
|
||||
#endif /* NPCI > 0 || NISA > 0 */
|
||||
|
||||
int
|
||||
xen_debug_handler(void *arg)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_xennet_xenbus.c,v 1.80 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: if_xennet_xenbus.c,v 1.81 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -84,7 +84,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.80 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.81 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
#include "opt_nfs_boot.h"
|
||||
@ -1386,7 +1386,7 @@ xennet_init(struct ifnet *ifp)
|
||||
if ((ifp->if_flags & IFF_RUNNING) == 0) {
|
||||
sc->sc_rx_ring.sring->rsp_event =
|
||||
sc->sc_rx_ring.rsp_cons + 1;
|
||||
hypervisor_enable_event(sc->sc_evtchn);
|
||||
hypervisor_unmask_event(sc->sc_evtchn);
|
||||
hypervisor_notify_via_evtchn(sc->sc_evtchn);
|
||||
xennet_reset(sc);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pciback.c,v 1.16 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: pciback.c,v 1.17 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Manuel Bouyer.
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.16 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.17 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
@ -622,7 +622,7 @@ pciback_xenbus_frontend_changed(void *arg, XenbusState new_state)
|
||||
pbxi->pbx_ih = intr_establish_xname(-1, &xen_pic, pbxi->pbx_evtchn, IST_LEVEL, IPL_BIO,
|
||||
pciback_xenbus_evthandler, pbxi, true, "pciback");
|
||||
KASSERT(pbxi->pbx_ih != NULL);
|
||||
hypervisor_enable_event(pbxi->pbx_evtchn);
|
||||
hypervisor_unmask_event(pbxi->pbx_evtchn);
|
||||
hypervisor_notify_via_evtchn(pbxi->pbx_evtchn);
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xbd_xenbus.c,v 1.89 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: xbd_xenbus.c,v 1.90 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.89 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.90 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
@ -509,7 +509,7 @@ again:
|
||||
*/
|
||||
sc->sc_backend_status = BLKIF_STATE_CONNECTED;
|
||||
xenbus_device_resume(sc->sc_xbusd);
|
||||
hypervisor_enable_event(sc->sc_evtchn);
|
||||
hypervisor_unmask_event(sc->sc_evtchn);
|
||||
xenbus_switch_state(sc->sc_xbusd, NULL, XenbusStateConnected);
|
||||
}
|
||||
|
||||
@ -568,8 +568,7 @@ xbd_backend_changed(void *arg, XenbusState new_state)
|
||||
|
||||
xbd_connect(sc);
|
||||
sc->sc_shutdown = BLKIF_SHUTDOWN_RUN;
|
||||
hypervisor_enable_event(sc->sc_evtchn);
|
||||
|
||||
hypervisor_unmask_event(sc->sc_evtchn);
|
||||
sc->sc_xbdsize =
|
||||
sc->sc_sectors * (uint64_t)sc->sc_secsize / DEV_BSIZE;
|
||||
dg = &sc->sc_dksc.sc_dkdev.dk_geom;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xbdback_xenbus.c,v 1.68 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: xbdback_xenbus.c,v 1.69 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.68 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.69 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include <sys/atomic.h>
|
||||
#include <sys/buf.h>
|
||||
@ -654,7 +654,7 @@ xbdback_connect(struct xbdback_instance *xbdi)
|
||||
|
||||
/* enable the xbdback event handler machinery */
|
||||
xbdi->xbdi_status = WAITING;
|
||||
hypervisor_enable_event(xbdi->xbdi_evtchn);
|
||||
hypervisor_unmask_event(xbdi->xbdi_evtchn);
|
||||
hypervisor_notify_via_evtchn(xbdi->xbdi_evtchn);
|
||||
|
||||
if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xencons.c,v 1.45 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: xencons.c,v 1.46 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -53,7 +53,7 @@
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.45 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.46 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
@ -249,7 +249,7 @@ xencons_resume(device_t dev, const pmf_qual_t *qual) {
|
||||
|
||||
if (evtch != -1) {
|
||||
aprint_verbose_dev(dev, "using event channel %d\n", evtch);
|
||||
hypervisor_enable_event(evtch);
|
||||
hypervisor_unmask_event(evtch);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xennetback_xenbus.c,v 1.70 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: xennetback_xenbus.c,v 1.71 2018/10/26 05:33:21 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.70 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.71 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
@ -561,7 +561,7 @@ xennetback_connect(struct xnetback_instance *xneti)
|
||||
xneti->xni_if.if_xname);
|
||||
KASSERT(xneti->xni_ih != NULL);
|
||||
xennetback_ifinit(&xneti->xni_if);
|
||||
hypervisor_enable_event(xneti->xni_evtchn);
|
||||
hypervisor_unmask_event(xneti->xni_evtchn);
|
||||
hypervisor_notify_via_evtchn(xneti->xni_evtchn);
|
||||
return 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xenbus_comms.c,v 1.19 2018/10/24 03:59:33 cherry Exp $ */
|
||||
/* $NetBSD: xenbus_comms.c,v 1.20 2018/10/26 05:33:21 cherry Exp $ */
|
||||
/******************************************************************************
|
||||
* xenbus_comms.c
|
||||
*
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.19 2018/10/24 03:59:33 cherry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.20 2018/10/26 05:33:21 cherry Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/null.h>
|
||||
@ -224,7 +224,7 @@ xb_init_comms(device_t dev)
|
||||
ih = intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_TTY,
|
||||
wake_waiting, NULL, false, device_xname(dev));
|
||||
|
||||
hypervisor_enable_event(evtchn);
|
||||
hypervisor_unmask_event(evtchn);
|
||||
aprint_verbose_dev(dev, "using event channel %d\n", evtchn);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user