[Midnightbsd-cvs] src [8904] trunk/sys: suspend pics and pseudo-pics in reverse order

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 26 18:39:44 EDT 2016


Revision: 8904
          http://svnweb.midnightbsd.org/src/?rev=8904
Author:   laffer1
Date:     2016-09-26 18:39:44 -0400 (Mon, 26 Sep 2016)
Log Message:
-----------
suspend pics and pseudo-pics in reverse order

Modified Paths:
--------------
    trunk/sys/amd64/include/intr_machdep.h
    trunk/sys/i386/include/intr_machdep.h
    trunk/sys/x86/x86/intr_machdep.c
    trunk/sys/x86/x86/local_apic.c

Modified: trunk/sys/amd64/include/intr_machdep.h
===================================================================
--- trunk/sys/amd64/include/intr_machdep.h	2016-09-26 22:39:09 UTC (rev 8903)
+++ trunk/sys/amd64/include/intr_machdep.h	2016-09-26 22:39:44 UTC (rev 8904)
@@ -94,7 +94,7 @@
 	int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
 	    enum intr_polarity);
 	int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
-	STAILQ_ENTRY(pic) pics;
+	TAILQ_ENTRY(pic) pics;
 };
 
 /* Flags for pic_disable_source() */

Modified: trunk/sys/i386/include/intr_machdep.h
===================================================================
--- trunk/sys/i386/include/intr_machdep.h	2016-09-26 22:39:09 UTC (rev 8903)
+++ trunk/sys/i386/include/intr_machdep.h	2016-09-26 22:39:44 UTC (rev 8904)
@@ -94,7 +94,7 @@
 	int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
 	    enum intr_polarity);
 	int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
-	STAILQ_ENTRY(pic) pics;
+	TAILQ_ENTRY(pic) pics;
 };
 
 /* Flags for pic_disable_source() */

Modified: trunk/sys/x86/x86/intr_machdep.c
===================================================================
--- trunk/sys/x86/x86/intr_machdep.c	2016-09-26 22:39:09 UTC (rev 8903)
+++ trunk/sys/x86/x86/intr_machdep.c	2016-09-26 22:39:44 UTC (rev 8904)
@@ -78,7 +78,7 @@
 static struct intsrc *interrupt_sources[NUM_IO_INTS];
 static struct mtx intr_table_lock;
 static struct mtx intrcnt_lock;
-static STAILQ_HEAD(, pic) pics;
+static TAILQ_HEAD(pics_head, pic) pics;
 
 #ifdef SMP
 static int assign_cpu;
@@ -102,7 +102,7 @@
 {
 	struct pic *p;
 
-	STAILQ_FOREACH(p, &pics, pics) {
+	TAILQ_FOREACH(p, &pics, pics) {
 		if (p == pic)
 			return (1);
 	}
@@ -124,7 +124,7 @@
 	if (intr_pic_registered(pic))
 		error = EBUSY;
 	else {
-		STAILQ_INSERT_TAIL(&pics, pic, pics);
+		TAILQ_INSERT_TAIL(&pics, pic, pics);
 		error = 0;
 	}
 	mtx_unlock(&intr_table_lock);
@@ -287,7 +287,7 @@
 	atpic_reset();
 #endif
 	mtx_lock(&intr_table_lock);
-	STAILQ_FOREACH(pic, &pics, pics) {
+	TAILQ_FOREACH(pic, &pics, pics) {
 		if (pic->pic_resume != NULL)
 			pic->pic_resume(pic);
 	}
@@ -300,7 +300,7 @@
 	struct pic *pic;
 
 	mtx_lock(&intr_table_lock);
-	STAILQ_FOREACH(pic, &pics, pics) {
+	TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) {
 		if (pic->pic_suspend != NULL)
 			pic->pic_suspend(pic);
 	}
@@ -381,7 +381,7 @@
 
 	intrcnt_setname("???", 0);
 	intrcnt_index = 1;
-	STAILQ_INIT(&pics);
+	TAILQ_INIT(&pics);
 	mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF);
 	mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN);
 }

Modified: trunk/sys/x86/x86/local_apic.c
===================================================================
--- trunk/sys/x86/x86/local_apic.c	2016-09-26 22:39:09 UTC (rev 8903)
+++ trunk/sys/x86/x86/local_apic.c	2016-09-26 22:39:44 UTC (rev 8904)
@@ -1346,11 +1346,19 @@
 
 	if (best_enum == NULL)
 		return;
+
+	/*
+	 * Local APIC must be registered before other PICs and pseudo PICs
+	 * for proper suspend/resume order.
+	 */
+#ifndef XEN
+	intr_register_pic(&lapic_pic);
+#endif
+
 	retval = best_enum->apic_setup_io();
 	if (retval != 0)
 		printf("%s: Failed to setup I/O APICs: returned %d\n",
 		    best_enum->apic_name, retval);
-
 #ifdef XEN
 	return;
 #endif
@@ -1359,7 +1367,6 @@
 	 * properly program the LINT pins.
 	 */
 	lapic_setup(1);
-	intr_register_pic(&lapic_pic);
 	if (bootverbose)
 		lapic_dump("BSP");
 



More information about the Midnightbsd-cvs mailing list