aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2020-07-21 22:47:02 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2020-07-21 22:47:02 +0000
commitdc4250904956c3e438186dbb78254e0c9bf1b734 (patch)
tree2806630689fcde16076bb7b9b6160a391275e566 /sys/kern
parente1c05fd290f050f46142f663113e0464e2e89cca (diff)
downloadsrc-dc4250904956c3e438186dbb78254e0c9bf1b734.tar.gz
src-dc4250904956c3e438186dbb78254e0c9bf1b734.zip
INTRNG: only shuffle for !EARLY_AP_STARTUP
During device attachment, all interrupt sources will bind to the BSP, as it is the only processor online. This means interrupts must be redistributed ("shuffled") later, during SI_SUB_SMP. For the EARLY_AP_STARTUP case, this is no longer true. SI_SUB_SMP will execute much earlier, meaning APs will be online and available before devices begin attachment, and there will therefore be nothing to shuffle. All PIC-conforming interrupt controllers will handle this early distribution properly, except for RISC-V's PLIC. Make the necessary tweak to the PLIC driver. While here, convert irq_assign_cpu from a boolean_t to a bool. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25693
Notes
Notes: svn path=/head/; revision=363404
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_intr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
index eda100164711..791a73957af5 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -128,7 +128,11 @@ static struct intr_irqsrc *irq_sources[NIRQ];
u_int irq_next_free;
#ifdef SMP
-static boolean_t irq_assign_cpu = FALSE;
+#ifdef EARLY_AP_STARTUP
+static bool irq_assign_cpu = true;
+#else
+static bool irq_assign_cpu = false;
+#endif
#endif
/*
@@ -1191,6 +1195,7 @@ intr_irq_next_cpu(u_int last_cpu, cpuset_t *cpumask)
return (last_cpu);
}
+#ifndef EARLY_AP_STARTUP
/*
* Distribute all the interrupt sources among the available
* CPUs once the AP's have been launched.
@@ -1205,7 +1210,7 @@ intr_irq_shuffle(void *arg __unused)
return;
mtx_lock(&isrc_table_lock);
- irq_assign_cpu = TRUE;
+ irq_assign_cpu = true;
for (i = 0; i < NIRQ; i++) {
isrc = irq_sources[i];
if (isrc == NULL || isrc->isrc_handlers == 0 ||
@@ -1231,6 +1236,7 @@ intr_irq_shuffle(void *arg __unused)
mtx_unlock(&isrc_table_lock);
}
SYSINIT(intr_irq_shuffle, SI_SUB_SMP, SI_ORDER_SECOND, intr_irq_shuffle, NULL);
+#endif /* !EARLY_AP_STARTUP */
#else
u_int
@@ -1239,7 +1245,7 @@ intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask)
return (PCPU_GET(cpuid));
}
-#endif
+#endif /* SMP */
/*
* Allocate memory for new intr_map_data structure.