From 15bff09749b2ecca521245d6ee6d12aa46615c05 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 28 Jul 2018 07:54:21 +0000 Subject: [PATCH] Only support INTRNG in the SMP code on arm. We already require INTRNG on anything that could be multicore on arm. --- sys/arm/arm/mp_machdep.c | 140 --------------------------------------- sys/arm/include/smp.h | 18 ----- sys/conf/options.arm | 2 - 3 files changed, 160 deletions(-) diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c index b0eb678394c8..869e60149c20 100644 --- a/sys/arm/arm/mp_machdep.c +++ b/sys/arm/arm/mp_machdep.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ #include "opt_ddb.h" -#include "opt_smp.h" #include __FBSDID("$FreeBSD$"); @@ -75,9 +74,6 @@ volatile int mp_naps; /* Set to 1 once we're ready to let the APs out of the pen. */ volatile int aps_ready = 0; -#ifndef INTRNG -static int ipi_handler(void *arg); -#endif void set_stackptrs(int cpu); /* Temporary variables for init_secondary() */ @@ -153,9 +149,6 @@ init_secondary(int cpu) { struct pcpu *pc; uint32_t loop_counter; -#ifndef INTRNG - int start = 0, end = 0; -#endif pmap_set_tex(); cpuinfo_reinit_mmu(pmap_kern_ttb); @@ -215,20 +208,6 @@ init_secondary(int cpu) mtx_unlock_spin(&ap_boot_mtx); -#ifndef INTRNG - /* Enable ipi */ -#ifdef IPI_IRQ_START - start = IPI_IRQ_START; -#ifdef IPI_IRQ_END - end = IPI_IRQ_END; -#else - end = IPI_IRQ_START; -#endif -#endif - - for (int i = start; i <= end; i++) - arm_unmask_irq(i); -#endif /* INTRNG */ enable_interrupts(PSR_I); loop_counter = 0; @@ -250,7 +229,6 @@ init_secondary(int cpu) /* NOTREACHED */ } -#ifdef INTRNG static void ipi_rendezvous(void *dummy __unused) { @@ -347,126 +325,20 @@ ipi_hardclock(void *arg) critical_exit(); } -#else -static int -ipi_handler(void *arg) -{ - u_int cpu, ipi; - - cpu = PCPU_GET(cpuid); - - ipi = pic_ipi_read((int)arg); - - while ((ipi != 0x3ff)) { - switch (ipi) { - case IPI_RENDEZVOUS: - CTR0(KTR_SMP, "IPI_RENDEZVOUS"); - smp_rendezvous_action(); - break; - - case IPI_AST: - CTR0(KTR_SMP, "IPI_AST"); - break; - - case IPI_STOP: - /* - * IPI_STOP_HARD is mapped to IPI_STOP so it is not - * necessary to add it in the switch. - */ - CTR0(KTR_SMP, "IPI_STOP or IPI_STOP_HARD"); - - savectx(&stoppcbs[cpu]); - - /* - * CPUs are stopped when entering the debugger and at - * system shutdown, both events which can precede a - * panic dump. For the dump to be correct, all caches - * must be flushed and invalidated, but on ARM there's - * no way to broadcast a wbinv_all to other cores. - * Instead, we have each core do the local wbinv_all as - * part of stopping the core. The core requesting the - * stop will do the l2 cache flush after all other cores - * have done their l1 flushes and stopped. - */ - dcache_wbinv_poc_all(); - - /* Indicate we are stopped */ - CPU_SET_ATOMIC(cpu, &stopped_cpus); - - /* Wait for restart */ - while (!CPU_ISSET(cpu, &started_cpus)) - cpu_spinwait(); - - CPU_CLR_ATOMIC(cpu, &started_cpus); - CPU_CLR_ATOMIC(cpu, &stopped_cpus); -#ifdef DDB - dbg_resume_dbreg(); -#endif - CTR0(KTR_SMP, "IPI_STOP (restart)"); - break; - case IPI_PREEMPT: - CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__); - sched_preempt(curthread); - break; - case IPI_HARDCLOCK: - CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__); - hardclockintr(); - break; - default: - panic("Unknown IPI 0x%0x on cpu %d", ipi, curcpu); - } - - pic_ipi_clear(ipi); - ipi = pic_ipi_read(-1); - } - - return (FILTER_HANDLED); -} -#endif - static void release_aps(void *dummy __unused) { uint32_t loop_counter; -#ifndef INTRNG - int start = 0, end = 0; -#endif if (mp_ncpus == 1) return; -#ifdef INTRNG intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL); intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL); intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL); intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL); intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL); -#else -#ifdef IPI_IRQ_START - start = IPI_IRQ_START; -#ifdef IPI_IRQ_END - end = IPI_IRQ_END; -#else - end = IPI_IRQ_START; -#endif -#endif - for (int i = start; i <= end; i++) { - /* - * IPI handler - */ - /* - * Use 0xdeadbeef as the argument value for irq 0, - * if we used 0, the intr code will give the trap frame - * pointer instead. - */ - arm_setup_irqhandler("ipi", ipi_handler, NULL, (void *)i, i, - INTR_TYPE_MISC | INTR_EXCL, NULL); - - /* Enable ipi */ - arm_unmask_irq(i); - } -#endif atomic_store_rel_int(&aps_ready, 1); /* Wake the other threads up */ dsb(); @@ -507,11 +379,7 @@ ipi_all_but_self(u_int ipi) other_cpus = all_cpus; CPU_CLR(PCPU_GET(cpuid), &other_cpus); CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); -#ifdef INTRNG intr_ipi_send(other_cpus, ipi); -#else - pic_ipi_send(other_cpus, ipi); -#endif } void @@ -523,11 +391,7 @@ ipi_cpu(int cpu, u_int ipi) CPU_SET(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d, ipi: %x", __func__, cpu, ipi); -#ifdef INTRNG intr_ipi_send(cpus, ipi); -#else - pic_ipi_send(cpus, ipi); -#endif } void @@ -535,9 +399,5 @@ ipi_selected(cpuset_t cpus, u_int ipi) { CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); -#ifdef INTRNG intr_ipi_send(cpus, ipi); -#else - pic_ipi_send(cpus, ipi); -#endif } diff --git a/sys/arm/include/smp.h b/sys/arm/include/smp.h index 704fffa961a5..4f1545872a4e 100644 --- a/sys/arm/include/smp.h +++ b/sys/arm/include/smp.h @@ -6,7 +6,6 @@ #include #include -#ifdef INTRNG enum { IPI_AST, IPI_PREEMPT, @@ -18,16 +17,6 @@ enum { IPI_CACHE, /* Not used now, but keep it reserved. */ INTR_IPI_COUNT }; -#else -#define IPI_AST 0 -#define IPI_PREEMPT 2 -#define IPI_RENDEZVOUS 3 -#define IPI_STOP 4 -#define IPI_STOP_HARD 4 -#define IPI_HARDCLOCK 6 -#define IPI_TLB 7 /* Not used now, but keep it reserved. */ -#define IPI_CACHE 8 /* Not used now, but keep it reserved. */ -#endif /* INTRNG */ void init_secondary(int cpu); void mpentry(void); @@ -36,13 +25,6 @@ void ipi_all_but_self(u_int ipi); void ipi_cpu(int cpu, u_int ipi); void ipi_selected(cpuset_t cpus, u_int ipi); -/* PIC interface */ -#ifndef INTRNG -void pic_ipi_send(cpuset_t cpus, u_int ipi); -void pic_ipi_clear(int ipi); -int pic_ipi_read(int arg); -#endif - /* Platform interface */ void platform_mp_setmaxid(void); void platform_mp_start_ap(void); diff --git a/sys/conf/options.arm b/sys/conf/options.arm index 24419ea5680b..b09d5094be86 100644 --- a/sys/conf/options.arm +++ b/sys/conf/options.arm @@ -23,8 +23,6 @@ EFI opt_platform.h FLASHADDR opt_global.h GIC_DEFAULT_ICFGR_INIT opt_global.h INTRNG opt_global.h -IPI_IRQ_START opt_smp.h -IPI_IRQ_END opt_smp.h FREEBSD_BOOT_LOADER opt_global.h KERNBASE opt_global.h KERNVIRTADDR opt_global.h