Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen Encapsulate pre-processing of registered (pirq, ...



details:   https://anonhg.NetBSD.org/src/rev/f1a636a240dd
branches:  trunk
changeset: 433591:f1a636a240dd
user:      cherry <cherry%NetBSD.org@localhost>
date:      Sun Sep 23 02:27:24 2018 +0000

description:
Encapsulate pre-processing of registered (pirq,evtchn) pair in
preparation for API reorg.

diffstat:

 sys/arch/xen/include/hypervisor.h |   3 ++-
 sys/arch/xen/xen/evtchn.c         |  36 ++++++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 15 deletions(-)

diffs (88 lines):

diff -r 0d111a95681b -r f1a636a240dd sys/arch/xen/include/hypervisor.h
--- a/sys/arch/xen/include/hypervisor.h Sun Sep 23 02:15:25 2018 +0000
+++ b/sys/arch/xen/include/hypervisor.h Sun Sep 23 02:27:24 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypervisor.h,v 1.44 2014/06/14 02:53:02 pgoyette Exp $ */
+/*     $NetBSD: hypervisor.h,v 1.45 2018/09/23 02:27:24 cherry Exp $   */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -130,6 +130,7 @@
 struct intrframe;
 struct cpu_info;
 void do_hypervisor_callback(struct intrframe *regs);
+void hypervisor_prime_pirq_event(int, unsigned int);
 void hypervisor_enable_event(unsigned int);
 
 extern int xen_version;
diff -r 0d111a95681b -r f1a636a240dd sys/arch/xen/xen/evtchn.c
--- a/sys/arch/xen/xen/evtchn.c Sun Sep 23 02:15:25 2018 +0000
+++ b/sys/arch/xen/xen/evtchn.c Sun Sep 23 02:27:24 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: evtchn.c,v 1.80 2018/06/24 13:35:33 jdolecek Exp $     */
+/*     $NetBSD: evtchn.c,v 1.81 2018/09/23 02:27:24 cherry Exp $       */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.80 2018/06/24 13:35:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.81 2018/09/23 02:27:24 cherry Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -737,7 +737,6 @@
     const char *intrname, const char *xname)
 {
        struct pintrhand *ih;
-       physdev_op_t physdev_op;
 
        ih = kmem_zalloc(sizeof(struct pintrhand),
            cold ? KM_NOSLEEP : KM_SLEEP);
@@ -759,17 +758,7 @@
                return NULL;
        }
 
-       physdev_op.cmd = PHYSDEVOP_IRQ_STATUS_QUERY;
-       physdev_op.u.irq_status_query.irq = pirq;
-       if (HYPERVISOR_physdev_op(&physdev_op) < 0)
-               panic("HYPERVISOR_physdev_op(PHYSDEVOP_IRQ_STATUS_QUERY)");
-       if (physdev_op.u.irq_status_query.flags &
-           PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY) {
-               pirq_needs_unmask_notify[evtch >> 5] |= (1 << (evtch & 0x1f));
-#ifdef IRQ_DEBUG
-               printf("pirq %d needs notify\n", pirq);
-#endif
-       }
+       hypervisor_prime_pirq_event(pirq, evtch);
        hypervisor_enable_event(evtch);
        return ih;
 }
@@ -1006,6 +995,25 @@
 }
 
 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;
+       if (HYPERVISOR_physdev_op(&physdev_op) < 0)
+               panic("HYPERVISOR_physdev_op(PHYSDEVOP_IRQ_STATUS_QUERY)");
+       if (physdev_op.u.irq_status_query.flags &
+           PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY) {
+               pirq_needs_unmask_notify[evtch >> 5] |= (1 << (evtch & 0x1f));
+#ifdef IRQ_DEBUG
+               printf("pirq %d needs notify\n", pirq);
+#endif
+       }
+#endif /* NPCI > 0 || NISA > 0 */
+}
+
+void
 hypervisor_enable_event(unsigned int evtch)
 {
 #ifdef IRQ_DEBUG



Home | Main Index | Thread Index | Old Index