option MULTIPROCESSOR on a single CPU.
ok patrick@
-/* $OpenBSD: cpu.c,v 1.9 2017/12/29 14:45:15 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.10 2018/01/12 22:20:28 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
char cpu_model[64];
int cpu_node;
+struct cpu_info *cpu_info_list = &cpu_info_primary;
+
int cpu_match(struct device *, void *, void *);
void cpu_attach(struct device *, struct device *, void *);
}
int (*cpu_on_fn)(register_t, register_t);
+
+#ifdef MULTIPROCESSOR
+void
+cpu_boot_secondary_processors(void)
+{
+}
+#endif
-/* $OpenBSD: syscall.c,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
+/* $OpenBSD: syscall.c,v 1.2 2018/01/12 22:20:28 kettenis Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
*
frame->tf_x[1] = 1;
frame->tf_spsr &= ~PSR_C; /* carry bit */
+ KERNEL_UNLOCK();
+
mi_child_return(p);
}
-/* $OpenBSD: trap.c,v 1.13 2017/12/24 10:32:25 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.14 2018/01/12 22:20:28 kettenis Exp $ */
/*-
* Copyright (c) 2014 Andrew Turner
* All rights reserved.
/* Fault in the user page: */
if (!pmap_fault_fixup(map->pmap, va, access_type, 1)) {
+ KERNEL_LOCK();
error = uvm_fault(map, va, ftype, access_type);
+ KERNEL_UNLOCK();
}
//PROC_LOCK(p);
* kernel.
*/
if (!pmap_fault_fixup(map->pmap, va, access_type, 0)) {
+ KERNEL_LOCK();
error = uvm_fault(map, va, ftype, access_type);
+ KERNEL_UNLOCK();
}
}
}
sv.sival_ptr = (u_int64_t *)far;
+ KERNEL_LOCK();
trapsignal(p, sig, 0, code, sv);
+ KERNEL_UNLOCK();
} else {
if (curcpu()->ci_idepth == 0 &&
pcb->pcb_onfault != 0) {
case EXCP_UNKNOWN:
vfp_save();
sv.sival_ptr = (void *)frame->tf_elr;
+ KERNEL_LOCK();
trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
+ KERNEL_UNLOCK();
break;
case EXCP_FP_SIMD:
case EXCP_TRAP_FP:
case EXCP_PC_ALIGN:
vfp_save();
sv.sival_ptr = (void *)frame->tf_elr;
+ KERNEL_LOCK();
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
+ KERNEL_UNLOCK();
break;
case EXCP_SP_ALIGN:
vfp_save();
sv.sival_ptr = (void *)frame->tf_sp;
+ KERNEL_LOCK();
trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
+ KERNEL_UNLOCK();
break;
case EXCP_DATA_ABORT_L:
vfp_save();
case EXCP_BRK:
vfp_save();
sv.sival_ptr = (void *)frame->tf_elr;
+ KERNEL_LOCK();
trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv);
+ KERNEL_UNLOCK();
break;
default:
// panic("Unknown userland exception %x esr_el1 %lx\n", exception,
printf("exception %x esr_el1 %llx\n", exception, esr);
dumpregs(frame);
}
+ KERNEL_LOCK();
sigexit(p, SIGILL);
+ KERNEL_UNLOCK();
}
userret(p);
-/* $OpenBSD: agintc.c,v 1.5 2017/08/09 05:53:11 jsg Exp $ */
+/* $OpenBSD: agintc.c,v 1.6 2018/01/12 22:20:28 kettenis Exp $ */
/*
* Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn <drahn@dalerahn.com>
*
int (*ih_func)(void *); /* handler */
void *ih_arg; /* arg for handler */
int ih_ipl; /* IPL_* */
+ int ih_flags;
int ih_irq; /* IRQ number */
struct evcount ih_count;
char *ih_name;
pri = sc->sc_agintc_handler[irq].iq_irq;
s = agintc_splraise(pri);
TAILQ_FOREACH(ih, &sc->sc_agintc_handler[irq].iq_list, ih_list) {
+#ifdef MULTIPROCESSOR
+ int need_lock;
+
+ if (ih->ih_flags & IPL_MPSAFE)
+ need_lock = 0;
+ else
+ need_lock = s < IPL_SCHED;
+
+ if (need_lock)
+ KERNEL_LOCK();
+#endif
+
if (ih->ih_arg != 0)
arg = ih->ih_arg;
else
if (handled)
ih->ih_count.ec_count++;
+#ifdef MULTIPROCESSOR
+ if (need_lock)
+ KERNEL_UNLOCK();
+#endif
}
agintc_eoi(irq);
ih->ih_func = func;
ih->ih_arg = arg;
ih->ih_ipl = level;
+ ih->ih_flags = 0;
ih->ih_irq = irqno;
ih->ih_name = name;
-/* $OpenBSD: ampintc.c,v 1.10 2018/01/12 14:53:37 kettenis Exp $ */
+/* $OpenBSD: ampintc.c,v 1.11 2018/01/12 22:20:28 kettenis Exp $ */
/*
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
*
int (*ih_func)(void *); /* handler */
void *ih_arg; /* arg for handler */
int ih_ipl; /* IPL_* */
+ int ih_flags;
int ih_irq; /* IRQ number */
struct evcount ih_count;
char *ih_name;
pri = sc->sc_ampintc_handler[irq].iq_irq;
s = ampintc_splraise(pri);
TAILQ_FOREACH(ih, &sc->sc_ampintc_handler[irq].iq_list, ih_list) {
+#ifdef MULTIPROCESSOR
+ int need_lock;
+
+ if (ih->ih_flags & IPL_MPSAFE)
+ need_lock = 0;
+ else
+ need_lock = s < IPL_SCHED;
+
+ if (need_lock)
+ KERNEL_LOCK();
+#endif
+
if (ih->ih_arg != 0)
arg = ih->ih_arg;
else
if (ih->ih_func(arg))
ih->ih_count.ec_count++;
+#ifdef MULTIPROCESSOR
+ if (need_lock)
+ KERNEL_UNLOCK();
+#endif
}
ampintc_eoi(iack_val);
ih->ih_func = func;
ih->ih_arg = arg;
ih->ih_ipl = level;
+ ih->ih_flags = 0;
ih->ih_irq = irqno;
ih->ih_name = name;
-/* $OpenBSD: bcm2836_intr.c,v 1.3 2017/04/30 16:45:45 mpi Exp $ */
+/* $OpenBSD: bcm2836_intr.c,v 1.4 2018/01/12 22:20:28 kettenis Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2015 Patrick Wildt <patrick@blueri.se>
int (*ih_fun)(void *); /* handler */
void *ih_arg; /* arg for handler */
int ih_ipl; /* IPL_* */
+ int ih_flags;
int ih_irq; /* IRQ number */
- struct evcount ih_count; /* interrupt counter */
- char *ih_name; /* device name */
+ struct evcount ih_count;
+ char *ih_name;
};
struct intrsource {
pri = sc->sc_bcm_intc_handler[irq].is_irq;
s = bcm_intc_splraise(pri);
TAILQ_FOREACH(ih, &sc->sc_bcm_intc_handler[irq].is_list, ih_list) {
+#ifdef MULTIPROCESSOR
+ int need_lock;
+
+ if (ih->ih_flags & IPL_MPSAFE)
+ need_lock = 0;
+ else
+ need_lock = s < IPL_SCHED;
+
+ if (need_lock)
+ KERNEL_LOCK();
+#endif
+
if (ih->ih_arg != 0)
arg = ih->ih_arg;
else
if (ih->ih_fun(arg))
ih->ih_count.ec_count++;
+#ifdef MULTIPROCESSOR
+ if (need_lock)
+ KERNEL_UNLOCK();
+#endif
}
bcm_intc_splx(s);
ih->ih_fun = func;
ih->ih_arg = arg;
ih->ih_ipl = level;
+ ih->ih_flags = 0;
ih->ih_irq = irqno;
ih->ih_name = name;
-/* $OpenBSD: cpu.h,v 1.3 2018/01/05 17:42:35 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.4 2018/01/12 22:20:28 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
#endif
int ci_want_resched;
+#ifdef MULTIPROCESSOR
+ struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
+#endif
+
#ifdef GPROF
struct gmonparam *ci_gmon;
#endif