Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen Decompose hypervisor_enable_event() into functi...
details: https://anonhg.NetBSD.org/src/rev/8a2110fdf026
branches: trunk
changeset: 836593:8a2110fdf026
user: cherry <cherry%NetBSD.org@localhost>
date: Fri Oct 26 05:33:21 2018 +0000
description:
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.
diffstat:
sys/arch/xen/include/hypervisor.h | 9 ++++++---
sys/arch/xen/x86/hypervisor_machdep.c | 11 ++++++++---
sys/arch/xen/x86/xen_ipi.c | 8 ++++----
sys/arch/xen/xen/clock.c | 6 +++---
sys/arch/xen/xen/evtchn.c | 35 +++++++++++++++++++++--------------
sys/arch/xen/xen/if_xennet_xenbus.c | 6 +++---
sys/arch/xen/xen/pciback.c | 6 +++---
sys/arch/xen/xen/xbd_xenbus.c | 9 ++++-----
sys/arch/xen/xen/xbdback_xenbus.c | 6 +++---
sys/arch/xen/xen/xencons.c | 6 +++---
sys/arch/xen/xen/xennetback_xenbus.c | 6 +++---
sys/arch/xen/xenbus/xenbus_comms.c | 6 +++---
12 files changed, 64 insertions(+), 50 deletions(-)
diffs (truncated from 437 to 300 lines):
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/include/hypervisor.h
--- a/sys/arch/xen/include/hypervisor.h Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/include/hypervisor.h Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
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)
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/x86/hypervisor_machdep.c
--- a/sys/arch/xen/x86/hypervisor_machdep.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/x86/hypervisor_machdep.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
#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 @@
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
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/x86/xen_ipi.c
--- a/sys/arch/xen/x86/xen_ipi.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/x86/xen_ipi.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
/* NOTREACHED */
}
- hypervisor_enable_event(evtchn);
+ hypervisor_unmask_event(evtchn);
}
#ifdef DIAGNOSTIC
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/xen/clock.c
--- a/sys/arch/xen/xen/clock.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/xen/clock.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
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);
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/xen/evtchn.c
--- a/sys/arch/xen/xen/evtchn.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/xen/evtchn.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
*/
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 @@
*/
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
#endif
(void)HYPERVISOR_physdev_op(&physdev_op_notify);
}
+}
#endif /* NPCI > 0 || NISA > 0 */
-}
int
xen_debug_handler(void *arg)
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
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);
}
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/xen/pciback.c
--- a/sys/arch/xen/xen/pciback.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/xen/pciback.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 @@
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;
diff -r 05954397e37c -r 8a2110fdf026 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c Fri Oct 26 01:57:59 2018 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c Fri Oct 26 05:33:21 2018 +0000
@@ -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 $ */
/*
Home |
Main Index |
Thread Index |
Old Index