summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2020-07-14 15:34:16 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2020-07-14 15:34:16 +0000
commit0840bd11f40b2d645fadc2aad753fe79916db7da (patch)
treec082ba40314b4d68f122ef8da846e643054706a6 /sys
parent3af178079cbe2efbfa4a5c1c6b27dd6296e47c08 (diff)
Extend the interrupt API on arm64 and armv7 to be able to pass around
a struct cpu_info *. From a driver point of view the fdt_intr_establish_* API now also exist same functions with a *_cpu suffix. Internally the "old" functions now call their *_cpu counterparts, passing NULL as ci. NULL will be interpreted as primary CPU in the interrupt controller code. The internal framework for interrupt controllers has been changed so that the establish methods provided by an interrupt controller function always takes a struct cpu_info *. Some drivers, like imxgpio(4) and rkgpio(4), only have a single interrupt line for multiple pins. On those we simply disallow trying to establish an interrupt on a non-primary CPU, returning NULL. Since we do not have MP yet on armv7, all armv7 interrupt controllers do return NULL if an attempt is made to establish an interrupt on a different CPU. That said, so far there's no way this can happen. If we ever gain MP support, this is a reminder that the interrupt controller drivers have to be adjusted. Prompted by dlg@ ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm/cortex/ampintc.c37
-rw-r--r--sys/arch/arm/cortex/amptimer.c9
-rw-r--r--sys/arch/arm/include/fdt.h6
-rw-r--r--sys/arch/arm64/arm64/acpi_machdep.c4
-rw-r--r--sys/arch/arm64/arm64/intr.c56
-rw-r--r--sys/arch/arm64/dev/acpipci.c4
-rw-r--r--sys/arch/arm64/dev/agintc.c36
-rw-r--r--sys/arch/arm64/dev/ampintc.c31
-rw-r--r--sys/arch/arm64/dev/bcm2836_intr.c30
-rw-r--r--sys/arch/arm64/include/fdt.h6
-rw-r--r--sys/arch/arm64/include/intr.h20
-rw-r--r--sys/arch/armv7/armv7/intr.c70
-rw-r--r--sys/arch/armv7/broadcom/bcm2836_intr.c32
-rw-r--r--sys/arch/armv7/include/intr.h32
-rw-r--r--sys/arch/armv7/marvell/mvmpic.c9
-rw-r--r--sys/arch/armv7/omap/intc.c20
-rw-r--r--sys/arch/armv7/omap/intc.h6
-rw-r--r--sys/arch/armv7/sunxi/sxiintc.c19
-rw-r--r--sys/arch/armv7/sunxi/sxiintc.h5
-rw-r--r--sys/dev/fdt/bcm2835_aux.c10
-rw-r--r--sys/dev/fdt/imxgpio.c11
-rw-r--r--sys/dev/fdt/mvgicp.c8
-rw-r--r--sys/dev/fdt/mvicu.c10
-rw-r--r--sys/dev/fdt/mvkpcie.c9
-rw-r--r--sys/dev/fdt/rkgpio.c11
25 files changed, 318 insertions, 173 deletions
diff --git a/sys/arch/arm/cortex/ampintc.c b/sys/arch/arm/cortex/ampintc.c
index 8ee33b0546d..bafc6771455 100644
--- a/sys/arch/arm/cortex/ampintc.c
+++ b/sys/arch/arm/cortex/ampintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ampintc.c,v 1.27 2019/09/29 10:36:52 kettenis Exp $ */
+/* $OpenBSD: ampintc.c,v 1.28 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
*
@@ -177,12 +177,12 @@ void ampintc_splx(int);
int ampintc_splraise(int);
void ampintc_setipl(int);
void ampintc_calc_mask(void);
-void *ampintc_intr_establish(int, int, int, int (*)(void *),
- void *, char *);
-void *ampintc_intr_establish_ext(int, int, int (*)(void *),
- void *, char *);
-void *ampintc_intr_establish_fdt(void *, int *, int,
+void *ampintc_intr_establish(int, int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
+void *ampintc_intr_establish_ext(int, int, struct cpu_info *,
int (*)(void *), void *, char *);
+void *ampintc_intr_establish_fdt(void *, int *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void ampintc_intr_disestablish(void *);
void ampintc_irq_handler(void *);
const char *ampintc_intr_string(void *);
@@ -691,16 +691,16 @@ ampintc_irq_handler(void *frame)
}
void *
-ampintc_intr_establish_ext(int irqno, int level, int (*func)(void *),
- void *arg, char *name)
+ampintc_intr_establish_ext(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
return ampintc_intr_establish(irqno+32, IST_LEVEL_HIGH, level,
- func, arg, name);
+ ci, func, arg, name);
}
void *
ampintc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct ampintc_softc *sc = (struct ampintc_softc *)cookie;
int irq;
@@ -723,12 +723,12 @@ ampintc_intr_establish_fdt(void *cookie, int *cell, int level,
else
type = IST_LEVEL_HIGH;
- return ampintc_intr_establish(irq, type, level, func, arg, name);
+ return ampintc_intr_establish(irq, type, level, ci, func, arg, name);
}
void *
-ampintc_intr_establish(int irqno, int type, int level, int (*func)(void *),
- void *arg, char *name)
+ampintc_intr_establish(int irqno, int type, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
struct ampintc_softc *sc = ampintc;
struct intrhand *ih;
@@ -738,6 +738,11 @@ ampintc_intr_establish(int irqno, int type, int level, int (*func)(void *),
panic("ampintc_intr_establish: bogus irqnumber %d: %s",
irqno, name);
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+ else if (!CPU_IS_PRIMARY(ci))
+ return NULL;
+
if (irqno < 16) {
/* SGI are only EDGE */
type = IST_EDGE_RISING;
@@ -818,7 +823,7 @@ ampintc_intr_string(void *cookie)
int ampintc_msi_match(struct device *, void *, void *);
void ampintc_msi_attach(struct device *, struct device *, void *);
void *ampintc_intr_establish_msi(void *, uint64_t *, uint64_t *,
- int , int (*)(void *), void *, char *);
+ int , struct cpu_info *, int (*)(void *), void *, char *);
void ampintc_intr_disestablish_msi(void *);
struct ampintc_msi_softc {
@@ -889,7 +894,7 @@ ampintc_msi_attach(struct device *parent, struct device *self, void *aux)
void *
ampintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
- int level, int (*func)(void *), void *arg, char *name)
+ int level, struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct ampintc_msi_softc *sc = (struct ampintc_msi_softc *)self;
void *cookie;
@@ -900,7 +905,7 @@ ampintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
continue;
cookie = ampintc_intr_establish(sc->sc_bspi + i,
- IST_EDGE_RISING, level, func, arg, name);
+ IST_EDGE_RISING, level, ci, func, arg, name);
if (cookie == NULL)
return NULL;
diff --git a/sys/arch/arm/cortex/amptimer.c b/sys/arch/arm/cortex/amptimer.c
index 5f247b685b5..546196c5473 100644
--- a/sys/arch/arm/cortex/amptimer.c
+++ b/sys/arch/arm/cortex/amptimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amptimer.c,v 1.8 2020/07/12 20:36:37 naddy Exp $ */
+/* $OpenBSD: amptimer.c,v 1.9 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
@@ -113,7 +113,8 @@ void amptimer_startclock(void);
* interface because it uses an 'internal' interrupt
* not a peripheral interrupt.
*/
-void *ampintc_intr_establish(int, int, int, int (*)(void *), void *, char *);
+void *ampintc_intr_establish(int, int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
@@ -361,10 +362,10 @@ amptimer_cpu_initclocks()
/* XXX - irq */
#if defined(USE_GTIMER_CMP)
ampintc_intr_establish(27, IST_EDGE_RISING, IPL_CLOCK,
- amptimer_intr, NULL, "tick");
+ NULL, amptimer_intr, NULL, "tick");
#else
ampintc_intr_establish(29, IST_EDGE_RISING, IPL_CLOCK,
- amptimer_intr, NULL, "tick");
+ NULL, amptimer_intr, NULL, "tick");
#endif
next = amptimer_readcnt64(sc) + sc->sc_ticks_per_intr;
diff --git a/sys/arch/arm/include/fdt.h b/sys/arch/arm/include/fdt.h
index 8269c3f4d5e..abb73df86e6 100644
--- a/sys/arch/arm/include/fdt.h
+++ b/sys/arch/arm/include/fdt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdt.h,v 1.9 2018/08/08 11:06:33 patrick Exp $ */
+/* $OpenBSD: fdt.h,v 1.10 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
@@ -42,9 +42,13 @@ void *fdt_find_cons(const char *);
#define fdt_intr_enable arm_intr_enable
#define fdt_intr_establish arm_intr_establish_fdt
+#define fdt_intr_establish_cpu arm_intr_establish_fdt_cpu
#define fdt_intr_establish_idx arm_intr_establish_fdt_idx
+#define fdt_intr_establish_idx_cpu arm_intr_establish_fdt_idx_cpu
#define fdt_intr_establish_imap arm_intr_establish_fdt_imap
+#define fdt_intr_establish_imap_cpu arm_intr_establish_fdt_imap_cpu
#define fdt_intr_establish_msi arm_intr_establish_fdt_msi
+#define fdt_intr_establish_msi_cpu arm_intr_establish_fdt_msi_cpu
#define fdt_intr_disable arm_intr_disable
#define fdt_intr_disestablish arm_intr_disestablish_fdt
#define fdt_intr_get_parent arm_intr_get_parent
diff --git a/sys/arch/arm64/arm64/acpi_machdep.c b/sys/arch/arm64/arm64/acpi_machdep.c
index 77871e18d9a..cc53a607d28 100644
--- a/sys/arch/arm64/arm64/acpi_machdep.c
+++ b/sys/arch/arm64/arm64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.4 2020/04/12 09:21:19 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.5 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis
*
@@ -152,7 +152,7 @@ acpi_intr_establish(int irq, int flags, int level,
interrupt[1] = irq - 32;
interrupt[2] = 0x4;
- return ic->ic_establish(ic->ic_cookie, interrupt, level,
+ return ic->ic_establish(ic->ic_cookie, interrupt, level, NULL,
func, arg, (char *)name);
}
diff --git a/sys/arch/arm64/arm64/intr.c b/sys/arch/arm64/arm64/intr.c
index 1cc0f9bba97..a5c8db1417e 100644
--- a/sys/arch/arm64/arm64/intr.c
+++ b/sys/arch/arm64/arm64/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.15 2020/04/26 10:35:05 kettenis Exp $ */
+/* $OpenBSD: intr.c,v 1.16 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
@@ -29,8 +29,8 @@
uint32_t arm_intr_get_parent(int);
uint32_t arm_intr_map_msi(int, uint64_t *);
-void *arm_intr_prereg_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *arm_intr_prereg_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void arm_intr_prereg_disestablish_fdt(void *);
int arm_dflt_splraise(int);
@@ -170,6 +170,7 @@ struct intr_prereg {
uint32_t ip_cell[MAX_INTERRUPT_CELLS];
int ip_level;
+ struct cpu_info *ip_ci;
int (*ip_func)(void *);
void *ip_arg;
char *ip_name;
@@ -183,7 +184,7 @@ LIST_HEAD(, intr_prereg) prereg_interrupts =
void *
arm_intr_prereg_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct interrupt_controller *ic = cookie;
struct intr_prereg *ip;
@@ -194,6 +195,7 @@ arm_intr_prereg_establish_fdt(void *cookie, int *cell, int level,
for (i = 0; i < ic->ic_cells; i++)
ip->ip_cell[i] = cell[i];
ip->ip_level = level;
+ ip->ip_ci = ci;
ip->ip_func = func;
ip->ip_arg = arg;
ip->ip_name = name;
@@ -268,7 +270,8 @@ arm_intr_register_fdt(struct interrupt_controller *ic)
ip->ip_ic = ic;
ip->ip_ih = ic->ic_establish(ic->ic_cookie, ip->ip_cell,
- ip->ip_level, ip->ip_func, ip->ip_arg, ip->ip_name);
+ ip->ip_level, ip->ip_ci, ip->ip_func, ip->ip_arg,
+ ip->ip_name);
if (ip->ip_ih == NULL)
printf("can't establish interrupt %s\n", ip->ip_name);
@@ -289,9 +292,25 @@ arm_intr_establish_fdt(int node, int level, int (*func)(void *),
}
void *
+arm_intr_establish_fdt_cpu(int node, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name)
+{
+ return arm_intr_establish_fdt_idx_cpu(node, 0, level, ci, func,
+ cookie, name);
+}
+
+void *
arm_intr_establish_fdt_idx(int node, int idx, int level, int (*func)(void *),
void *cookie, char *name)
{
+ return arm_intr_establish_fdt_idx_cpu(node, idx, level, NULL, func,
+ cookie, name);
+}
+
+void *
+arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name)
+{
struct interrupt_controller *ic;
int i, len, ncells, extended = 1;
uint32_t *cell, *cells, phandle;
@@ -343,7 +362,7 @@ arm_intr_establish_fdt_idx(int node, int idx, int level, int (*func)(void *),
if (i == idx && ncells >= ic->ic_cells && ic->ic_establish) {
val = ic->ic_establish(ic->ic_cookie, cell, level,
- func, cookie, name);
+ ci, func, cookie, name);
break;
}
@@ -367,6 +386,14 @@ void *
arm_intr_establish_fdt_imap(int node, int *reg, int nreg, int level,
int (*func)(void *), void *cookie, char *name)
{
+ return arm_intr_establish_fdt_imap_cpu(node, reg, nreg, level, NULL,
+ func, cookie, name);
+}
+
+void *
+arm_intr_establish_fdt_imap_cpu(int node, int *reg, int nreg, int level,
+ struct cpu_info *ci, int (*func)(void *), void *cookie, char *name)
+{
struct interrupt_controller *ic;
struct arm_intr_handle *ih;
uint32_t *cell;
@@ -407,7 +434,7 @@ arm_intr_establish_fdt_imap(int node, int *reg, int nreg, int level,
(reg[3] & map_mask[3]) == cell[3] &&
ic->ic_establish) {
val = ic->ic_establish(ic->ic_cookie, &cell[5 + acells],
- level, func, cookie, name);
+ level, ci, func, cookie, name);
break;
}
@@ -432,6 +459,15 @@ void *
arm_intr_establish_fdt_msi(int node, uint64_t *addr, uint64_t *data,
int level, int (*func)(void *), void *cookie, char *name)
{
+ return arm_intr_establish_fdt_msi_cpu(node, addr, data, level, NULL,
+ func, cookie, name);
+}
+
+void *
+arm_intr_establish_fdt_msi_cpu(int node, uint64_t *addr, uint64_t *data,
+ int level, struct cpu_info *ci, int (*func)(void *), void *cookie,
+ char *name)
+{
struct interrupt_controller *ic;
struct arm_intr_handle *ih;
uint32_t phandle;
@@ -447,7 +483,7 @@ arm_intr_establish_fdt_msi(int node, uint64_t *addr, uint64_t *data,
return NULL;
val = ic->ic_establish_msi(ic->ic_cookie, addr, data,
- level, func, cookie, name);
+ level, ci, func, cookie, name);
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
ih->ih_ic = ic;
@@ -493,7 +529,7 @@ arm_intr_disable(void *cookie)
*/
void *
arm_intr_parent_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct interrupt_controller *ic = cookie;
struct arm_intr_handle *ih;
@@ -508,7 +544,7 @@ arm_intr_parent_establish_fdt(void *cookie, int *cell, int level,
if (ic == NULL)
return NULL;
- val = ic->ic_establish(ic->ic_cookie, cell, level, func, arg, name);
+ val = ic->ic_establish(ic->ic_cookie, cell, level, ci, func, arg, name);
if (val == NULL)
return NULL;
diff --git a/sys/arch/arm64/dev/acpipci.c b/sys/arch/arm64/dev/acpipci.c
index 355db6ea43e..f7f556e822d 100644
--- a/sys/arch/arm64/dev/acpipci.c
+++ b/sys/arch/arm64/dev/acpipci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpipci.c,v 1.15 2020/06/11 18:13:53 kettenis Exp $ */
+/* $OpenBSD: acpipci.c,v 1.16 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis
*
@@ -454,7 +454,7 @@ acpipci_intr_establish(void *v, pci_intr_handle_t ih, int level,
/* Map Requester ID through IORT to get sideband data. */
data = acpipci_iort_map_msi(ih.ih_pc, ih.ih_tag);
cookie = ic->ic_establish_msi(ic->ic_cookie, &addr,
- &data, level, func, arg, name);
+ &data, level, NULL, func, arg, name);
if (cookie == NULL)
return NULL;
diff --git a/sys/arch/arm64/dev/agintc.c b/sys/arch/arm64/dev/agintc.c
index 956c10ae315..3477b635c9f 100644
--- a/sys/arch/arm64/dev/agintc.c
+++ b/sys/arch/arm64/dev/agintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agintc.c,v 1.22 2019/08/02 10:04:59 kettenis Exp $ */
+/* $OpenBSD: agintc.c,v 1.23 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn <drahn@dalerahn.com>
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
@@ -204,11 +204,11 @@ void agintc_splx(int);
int agintc_splraise(int);
void agintc_setipl(int);
void agintc_calc_mask(void);
-void agintc_calc_irq(struct agintc_softc *sc, int irq);
-void *agintc_intr_establish(int, int, int (*)(void *), void *,
- char *);
+void agintc_calc_irq(struct agintc_softc *sc, int irq);
+void *agintc_intr_establish(int, int, struct cpu_info *ci,
+ int (*)(void *), void *, char *);
void *agintc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name);
+ struct cpu_info *, int (*func)(void *), void *arg, char *name);
void agintc_intr_disestablish(void *);
void agintc_irq_handler(void *);
uint32_t agintc_iack(void);
@@ -553,16 +553,16 @@ agintc_attach(struct device *parent, struct device *self, void *aux)
switch (nipi) {
case 1:
sc->sc_ipi_irq[0] = agintc_intr_establish(ipiirq[0],
- IPL_IPI|IPL_MPSAFE, agintc_ipi_combined, sc, "ipi");
+ IPL_IPI|IPL_MPSAFE, NULL, agintc_ipi_combined, sc, "ipi");
sc->sc_ipi_num[ARM_IPI_NOP] = ipiirq[0];
sc->sc_ipi_num[ARM_IPI_DDB] = ipiirq[0];
break;
case 2:
sc->sc_ipi_irq[0] = agintc_intr_establish(ipiirq[0],
- IPL_IPI|IPL_MPSAFE, agintc_ipi_nop, sc, "ipinop");
+ IPL_IPI|IPL_MPSAFE, NULL, agintc_ipi_nop, sc, "ipinop");
sc->sc_ipi_num[ARM_IPI_NOP] = ipiirq[0];
sc->sc_ipi_irq[1] = agintc_intr_establish(ipiirq[1],
- IPL_IPI|IPL_MPSAFE, agintc_ipi_ddb, sc, "ipiddb");
+ IPL_IPI|IPL_MPSAFE, NULL, agintc_ipi_ddb, sc, "ipiddb");
sc->sc_ipi_num[ARM_IPI_DDB] = ipiirq[1];
break;
default:
@@ -967,7 +967,7 @@ agintc_irq_handler(void *frame)
void *
agintc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct agintc_softc *sc = agintc_sc;
int irq;
@@ -983,12 +983,12 @@ agintc_intr_establish_fdt(void *cookie, int *cell, int level,
else
panic("%s: bogus interrupt type", sc->sc_sbus.sc_dev.dv_xname);
- return agintc_intr_establish(irq, level, func, arg, name);
+ return agintc_intr_establish(irq, level, ci, func, arg, name);
}
void *
-agintc_intr_establish(int irqno, int level, int (*func)(void *),
- void *arg, char *name)
+agintc_intr_establish(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
struct agintc_softc *sc = agintc_sc;
struct intrhand *ih;
@@ -999,6 +999,9 @@ agintc_intr_establish(int irqno, int level, int (*func)(void *),
panic("agintc_intr_establish: bogus irqnumber %d: %s",
irqno, name);
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+
ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
ih->ih_func = func;
ih->ih_arg = arg;
@@ -1215,7 +1218,7 @@ struct agintc_msi_device {
int agintc_msi_match(struct device *, void *, void *);
void agintc_msi_attach(struct device *, struct device *, void *);
void *agintc_intr_establish_msi(void *, uint64_t *, uint64_t *,
- int , int (*)(void *), void *, char *);
+ int , struct cpu_info *, int (*)(void *), void *, char *);
void agintc_intr_disestablish_msi(void *);
struct agintc_msi_softc {
@@ -1483,7 +1486,7 @@ agintc_msi_find_device(struct agintc_msi_softc *sc, uint32_t deviceid)
void *
agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
- int level, int (*func)(void *), void *arg, char *name)
+ int level, struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct agintc_msi_softc *sc = (struct agintc_msi_softc *)self;
struct agintc_msi_device *md;
@@ -1493,6 +1496,9 @@ agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
void *cookie;
int i;
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+
md = agintc_msi_find_device(sc, deviceid);
if (md == NULL)
return NULL;
@@ -1506,7 +1512,7 @@ agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
continue;
cookie = agintc_intr_establish(LPI_BASE + i,
- level, func, arg, name);
+ level, ci, func, arg, name);
if (cookie == NULL)
return NULL;
diff --git a/sys/arch/arm64/dev/ampintc.c b/sys/arch/arm64/dev/ampintc.c
index de7b0572a14..a372e0fa96f 100644
--- a/sys/arch/arm64/dev/ampintc.c
+++ b/sys/arch/arm64/dev/ampintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ampintc.c,v 1.16 2019/09/22 15:05:37 kettenis Exp $ */
+/* $OpenBSD: ampintc.c,v 1.17 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
*
@@ -174,10 +174,10 @@ void ampintc_splx(int);
int ampintc_splraise(int);
void ampintc_setipl(int);
void ampintc_calc_mask(void);
-void *ampintc_intr_establish(int, int, int, int (*)(void *),
- void *, char *);
-void *ampintc_intr_establish_fdt(void *, int *, int,
+void *ampintc_intr_establish(int, int, int, struct cpu_info *,
int (*)(void *), void *, char *);
+void *ampintc_intr_establish_fdt(void *, int *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void ampintc_intr_disestablish(void *);
void ampintc_irq_handler(void *);
const char *ampintc_intr_string(void *);
@@ -341,16 +341,16 @@ ampintc_attach(struct device *parent, struct device *self, void *aux)
switch (nipi) {
case 1:
ampintc_intr_establish(ipiirq[0], IST_EDGE_RISING,
- IPL_IPI|IPL_MPSAFE, ampintc_ipi_combined, sc, "ipi");
+ IPL_IPI|IPL_MPSAFE, NULL, ampintc_ipi_combined, sc, "ipi");
sc->sc_ipi_num[ARM_IPI_NOP] = ipiirq[0];
sc->sc_ipi_num[ARM_IPI_DDB] = ipiirq[0];
break;
case 2:
ampintc_intr_establish(ipiirq[0], IST_EDGE_RISING,
- IPL_IPI|IPL_MPSAFE, ampintc_ipi_nop, sc, "ipinop");
+ IPL_IPI|IPL_MPSAFE, NULL, ampintc_ipi_nop, sc, "ipinop");
sc->sc_ipi_num[ARM_IPI_NOP] = ipiirq[0];
ampintc_intr_establish(ipiirq[1], IST_EDGE_RISING,
- IPL_IPI|IPL_MPSAFE, ampintc_ipi_ddb, sc, "ipiddb");
+ IPL_IPI|IPL_MPSAFE, NULL, ampintc_ipi_ddb, sc, "ipiddb");
sc->sc_ipi_num[ARM_IPI_DDB] = ipiirq[1];
break;
default:
@@ -686,7 +686,7 @@ ampintc_irq_handler(void *frame)
void *
ampintc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct ampintc_softc *sc = (struct ampintc_softc *)cookie;
int irq;
@@ -709,12 +709,12 @@ ampintc_intr_establish_fdt(void *cookie, int *cell, int level,
else
type = IST_LEVEL_HIGH;
- return ampintc_intr_establish(irq, type, level, func, arg, name);
+ return ampintc_intr_establish(irq, type, level, ci, func, arg, name);
}
void *
-ampintc_intr_establish(int irqno, int type, int level, int (*func)(void *),
- void *arg, char *name)
+ampintc_intr_establish(int irqno, int type, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
struct ampintc_softc *sc = ampintc;
struct intrhand *ih;
@@ -724,6 +724,9 @@ ampintc_intr_establish(int irqno, int type, int level, int (*func)(void *),
panic("ampintc_intr_establish: bogus irqnumber %d: %s",
irqno, name);
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+
if (irqno < 16) {
/* SGI are only EDGE */
type = IST_EDGE_RISING;
@@ -804,7 +807,7 @@ ampintc_intr_string(void *cookie)
int ampintc_msi_match(struct device *, void *, void *);
void ampintc_msi_attach(struct device *, struct device *, void *);
void *ampintc_intr_establish_msi(void *, uint64_t *, uint64_t *,
- int , int (*)(void *), void *, char *);
+ int , struct cpu_info *, int (*)(void *), void *, char *);
void ampintc_intr_disestablish_msi(void *);
struct ampintc_msi_softc {
@@ -875,7 +878,7 @@ ampintc_msi_attach(struct device *parent, struct device *self, void *aux)
void *
ampintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
- int level, int (*func)(void *), void *arg, char *name)
+ int level, struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct ampintc_msi_softc *sc = (struct ampintc_msi_softc *)self;
void *cookie;
@@ -886,7 +889,7 @@ ampintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
continue;
cookie = ampintc_intr_establish(sc->sc_bspi + i,
- IST_EDGE_RISING, level, func, arg, name);
+ IST_EDGE_RISING, level, ci, func, arg, name);
if (cookie == NULL)
return NULL;
diff --git a/sys/arch/arm64/dev/bcm2836_intr.c b/sys/arch/arm64/dev/bcm2836_intr.c
index 5a2beef6f02..ed7295ae8ee 100644
--- a/sys/arch/arm64/dev/bcm2836_intr.c
+++ b/sys/arch/arm64/dev/bcm2836_intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcm2836_intr.c,v 1.8 2018/02/24 12:46:45 jsg Exp $ */
+/* $OpenBSD: bcm2836_intr.c,v 1.9 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2015 Patrick Wildt <patrick@blueri.se>
@@ -114,12 +114,12 @@ int bcm_intc_spllower(int new);
int bcm_intc_splraise(int new);
void bcm_intc_setipl(int new);
void bcm_intc_calc_mask(void);
-void *bcm_intc_intr_establish(int, int, int (*)(void *),
- void *, char *);
-void *bcm_intc_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
-void *l1_intc_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *bcm_intc_intr_establish(int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
+void *bcm_intc_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
+void *l1_intc_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void bcm_intc_intr_disestablish(void *);
void bcm_intc_irq_handler(void *);
void bcm_intc_intr_route(void *, int , struct cpu_info *);
@@ -517,7 +517,7 @@ bcm_intc_irq_handler(void *frame)
void *
bcm_intc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct bcm_intc_softc *sc = (struct bcm_intc_softc *)cookie;
int irq;
@@ -534,22 +534,22 @@ bcm_intc_intr_establish_fdt(void *cookie, int *cell, int level,
else
panic("%s: bogus interrupt type", sc->sc_dev.dv_xname);
- return bcm_intc_intr_establish(irq, level, func, arg, name);
+ return bcm_intc_intr_establish(irq, level, ci, func, arg, name);
}
void *
l1_intc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
int irq;
irq = cell[0] + LOCAL_START;
- return bcm_intc_intr_establish(irq, level, func, arg, name);
+ return bcm_intc_intr_establish(irq, level, ci, func, arg, name);
}
void *
-bcm_intc_intr_establish(int irqno, int level, int (*func)(void *),
- void *arg, char *name)
+bcm_intc_intr_establish(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
struct bcm_intc_softc *sc = bcm_intc;
struct intrhand *ih;
@@ -558,6 +558,10 @@ bcm_intc_intr_establish(int irqno, int level, int (*func)(void *),
if (irqno < 0 || irqno >= INTC_NIRQ)
panic("bcm_intc_intr_establish: bogus irqnumber %d: %s",
irqno, name);
+
+ if (ci != NULL && !CPU_IS_PRIMARY(ci))
+ return NULL;
+
psw = disable_interrupts();
ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
diff --git a/sys/arch/arm64/include/fdt.h b/sys/arch/arm64/include/fdt.h
index 86df93d8b92..af2721fdada 100644
--- a/sys/arch/arm64/include/fdt.h
+++ b/sys/arch/arm64/include/fdt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdt.h,v 1.6 2018/08/08 11:06:33 patrick Exp $ */
+/* $OpenBSD: fdt.h,v 1.7 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
@@ -42,9 +42,13 @@ void *fdt_find_cons(const char *);
#define fdt_intr_enable arm_intr_enable
#define fdt_intr_establish arm_intr_establish_fdt
+#define fdt_intr_establish_cpu arm_intr_establish_fdt_cpu
#define fdt_intr_establish_idx arm_intr_establish_fdt_idx
+#define fdt_intr_establish_idx_cpu arm_intr_establish_fdt_idx_cpu
#define fdt_intr_establish_imap arm_intr_establish_fdt_imap
+#define fdt_intr_establish_imap_cpu arm_intr_establish_fdt_imap_cpu
#define fdt_intr_establish_msi arm_intr_establish_fdt_msi
+#define fdt_intr_establish_msi_cpu arm_intr_establish_fdt_msi_cpu
#define fdt_intr_disable arm_intr_disable
#define fdt_intr_disestablish arm_intr_disestablish_fdt
#define fdt_intr_get_parent arm_intr_get_parent
diff --git a/sys/arch/arm64/include/intr.h b/sys/arch/arm64/include/intr.h
index 58bee831742..212c388da0a 100644
--- a/sys/arch/arm64/include/intr.h
+++ b/sys/arch/arm64/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.12 2018/08/20 15:02:07 visa Exp $ */
+/* $OpenBSD: intr.h,v 1.13 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -136,10 +136,10 @@ struct cpu_info;
struct interrupt_controller {
int ic_node;
void *ic_cookie;
- void *(*ic_establish)(void *, int *, int, int (*)(void *),
- void *, char *);
- void *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int,
+ void *(*ic_establish)(void *, int *, int, struct cpu_info *,
int (*)(void *), void *, char *);
+ void *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void (*ic_disestablish)(void *);
void (*ic_enable)(void *);
void (*ic_disable)(void *);
@@ -155,19 +155,27 @@ void arm_intr_init_fdt(void);
void arm_intr_register_fdt(struct interrupt_controller *);
void *arm_intr_establish_fdt(int, int, int (*)(void *),
void *, char *);
+void *arm_intr_establish_fdt_cpu(int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void *arm_intr_establish_fdt_idx(int, int, int, int (*)(void *),
void *, char *);
+void *arm_intr_establish_fdt_idx_cpu(int, int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void *arm_intr_establish_fdt_imap(int, int *, int, int, int (*)(void *),
void *, char *);
-void *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int ,
+void *arm_intr_establish_fdt_imap_cpu(int, int *, int, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
+void *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int,
int (*)(void *), void *, char *);
+void *arm_intr_establish_fdt_msi_cpu(int, uint64_t *, uint64_t *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void arm_intr_disestablish_fdt(void *);
void arm_intr_enable(void *);
void arm_intr_disable(void *);
void arm_intr_route(void *, int, struct cpu_info *);
void arm_intr_cpu_enable(void);
void *arm_intr_parent_establish_fdt(void *, int *, int,
- int (*)(void *), void *, char *);
+ struct cpu_info *ci, int (*)(void *), void *, char *);
void arm_intr_parent_disestablish_fdt(void *);
void arm_send_ipi(struct cpu_info *, int);
diff --git a/sys/arch/armv7/armv7/intr.c b/sys/arch/armv7/armv7/intr.c
index 68b6c7bf525..97ec595c7d8 100644
--- a/sys/arch/armv7/armv7/intr.c
+++ b/sys/arch/armv7/armv7/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.17 2020/04/27 13:02:50 kettenis Exp $ */
+/* $OpenBSD: intr.c,v 1.18 2020/07/14 15:34:14 patrick Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
@@ -28,16 +28,16 @@
uint32_t arm_intr_get_parent(int);
uint32_t arm_intr_map_msi(int, uint64_t *);
-void *arm_intr_prereg_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *arm_intr_prereg_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void arm_intr_prereg_disestablish_fdt(void *);
int arm_dflt_splraise(int);
int arm_dflt_spllower(int);
void arm_dflt_splx(int);
void arm_dflt_setipl(int);
-void *arm_dflt_intr_establish(int irqno, int level, int (*func)(void *),
- void *cookie, char *name);
+void *arm_dflt_intr_establish(int irqno, int level, struct cpu_info *,
+ int (*func)(void *), void *cookie, char *name);
void arm_dflt_intr_disestablish(void *cookie);
const char *arm_dflt_intr_string(void *cookie);
@@ -75,7 +75,7 @@ arm_dflt_intr(void *frame)
void *arm_intr_establish(int irqno, int level, int (*func)(void *),
void *cookie, char *name)
{
- return arm_intr_func.intr_establish(irqno, level, func, cookie, name);
+ return arm_intr_func.intr_establish(irqno, level, NULL, func, cookie, name);
}
void arm_intr_disestablish(void *cookie)
{
@@ -188,6 +188,7 @@ struct intr_prereg {
uint32_t ip_cell[MAX_INTERRUPT_CELLS];
int ip_level;
+ struct cpu_info *ip_ci;
int (*ip_func)(void *);
void *ip_arg;
char *ip_name;
@@ -201,7 +202,7 @@ LIST_HEAD(, intr_prereg) prereg_interrupts =
void *
arm_intr_prereg_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct interrupt_controller *ic = cookie;
struct intr_prereg *ip;
@@ -212,6 +213,7 @@ arm_intr_prereg_establish_fdt(void *cookie, int *cell, int level,
for (i = 0; i < ic->ic_cells; i++)
ip->ip_cell[i] = cell[i];
ip->ip_level = level;
+ ip->ip_ci = ci;
ip->ip_func = func;
ip->ip_arg = arg;
ip->ip_name = name;
@@ -286,7 +288,8 @@ arm_intr_register_fdt(struct interrupt_controller *ic)
ip->ip_ic = ic;
ip->ip_ih = ic->ic_establish(ic->ic_cookie, ip->ip_cell,
- ip->ip_level, ip->ip_func, ip->ip_arg, ip->ip_name);
+ ip->ip_level, ip->ip_ci, ip->ip_func, ip->ip_arg,
+ ip->ip_name);
if (ip->ip_ih == NULL)
printf("can't establish interrupt %s\n", ip->ip_name);
@@ -307,9 +310,25 @@ arm_intr_establish_fdt(int node, int level, int (*func)(void *),
}
void *
+arm_intr_establish_fdt_cpu(int node, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name)
+{
+ return arm_intr_establish_fdt_idx_cpu(node, 0, level, ci, func,
+ cookie, name);
+}
+
+void *
arm_intr_establish_fdt_idx(int node, int idx, int level, int (*func)(void *),
void *cookie, char *name)
{
+ return arm_intr_establish_fdt_idx_cpu(node, idx, level, NULL, func,
+ cookie, name);
+}
+
+void *
+arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name)
+{
struct interrupt_controller *ic;
int i, len, ncells, extended = 1;
uint32_t *cell, *cells, phandle;
@@ -361,7 +380,7 @@ arm_intr_establish_fdt_idx(int node, int idx, int level, int (*func)(void *),
if (i == idx && ncells >= ic->ic_cells && ic->ic_establish) {
val = ic->ic_establish(ic->ic_cookie, cell, level,
- func, cookie, name);
+ ci, func, cookie, name);
break;
}
@@ -385,6 +404,14 @@ void *
arm_intr_establish_fdt_imap(int node, int *reg, int nreg, int level,
int (*func)(void *), void *cookie, char *name)
{
+ return arm_intr_establish_fdt_imap_cpu(node, reg, nreg, level, NULL,
+ func, cookie, name);
+}
+
+void *
+arm_intr_establish_fdt_imap_cpu(int node, int *reg, int nreg, int level,
+ struct cpu_info *ci, int (*func)(void *), void *cookie, char *name)
+{
struct interrupt_controller *ic;
struct arm_intr_handle *ih;
uint32_t *cell;
@@ -425,7 +452,7 @@ arm_intr_establish_fdt_imap(int node, int *reg, int nreg, int level,
(reg[3] & map_mask[3]) == cell[3] &&
ic->ic_establish) {
val = ic->ic_establish(ic->ic_cookie, &cell[5 + acells],
- level, func, cookie, name);
+ level, ci, func, cookie, name);
break;
}
@@ -450,6 +477,15 @@ void *
arm_intr_establish_fdt_msi(int node, uint64_t *addr, uint64_t *data,
int level, int (*func)(void *), void *cookie, char *name)
{
+ return arm_intr_establish_fdt_msi_cpu(node, addr, data, level, NULL,
+ func, cookie, name);
+}
+
+void *
+arm_intr_establish_fdt_msi_cpu(int node, uint64_t *addr, uint64_t *data,
+ int level, struct cpu_info *ci, int (*func)(void *), void *cookie,
+ char *name)
+{
struct interrupt_controller *ic;
struct arm_intr_handle *ih;
uint32_t phandle;
@@ -465,7 +501,7 @@ arm_intr_establish_fdt_msi(int node, uint64_t *addr, uint64_t *data,
return NULL;
val = ic->ic_establish_msi(ic->ic_cookie, addr, data,
- level, func, cookie, name);
+ level, ci, func, cookie, name);
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
ih->ih_ic = ic;
@@ -511,7 +547,7 @@ arm_intr_disable(void *cookie)
*/
void *
arm_intr_parent_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct interrupt_controller *ic = cookie;
struct arm_intr_handle *ih;
@@ -526,7 +562,7 @@ arm_intr_parent_establish_fdt(void *cookie, int *cell, int level,
if (ic == NULL)
return NULL;
- val = ic->ic_establish(ic->ic_cookie, cell, level, func, arg, name);
+ val = ic->ic_establish(ic->ic_cookie, cell, level, ci, func, arg, name);
if (val == NULL)
return NULL;
@@ -614,8 +650,8 @@ arm_dflt_setipl(int newcpl)
ci->ci_cpl = newcpl;
}
-void *arm_dflt_intr_establish(int irqno, int level, int (*func)(void *),
- void *cookie, char *name)
+void *arm_dflt_intr_establish(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name)
{
panic("arm_dflt_intr_establish called");
}
@@ -680,8 +716,8 @@ arm_do_pending_intr(int pcpl)
void arm_set_intr_handler(int (*raise)(int), int (*lower)(int),
void (*x)(int), void (*setipl)(int),
- void *(*intr_establish)(int irqno, int level, int (*func)(void *),
- void *cookie, char *name),
+ void *(*intr_establish)(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name),
void (*intr_disestablish)(void *cookie),
const char *(intr_string)(void *cookie),
void (*intr_handle)(void *))
diff --git a/sys/arch/armv7/broadcom/bcm2836_intr.c b/sys/arch/armv7/broadcom/bcm2836_intr.c
index f2bba3dc626..ec55af43f9a 100644
--- a/sys/arch/armv7/broadcom/bcm2836_intr.c
+++ b/sys/arch/armv7/broadcom/bcm2836_intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcm2836_intr.c,v 1.4 2019/10/05 15:44:57 kettenis Exp $ */
+/* $OpenBSD: bcm2836_intr.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2015 Patrick Wildt <patrick@blueri.se>
@@ -110,12 +110,12 @@ int bcm_intc_spllower(int new);
int bcm_intc_splraise(int new);
void bcm_intc_setipl(int new);
void bcm_intc_calc_mask(void);
-void *bcm_intc_intr_establish(int, int, int (*)(void *),
- void *, char *);
-void *bcm_intc_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
-void *l1_intc_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *bcm_intc_intr_establish(int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
+void *bcm_intc_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
+void *l1_intc_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void bcm_intc_intr_disestablish(void *);
const char *bcm_intc_intr_string(void *);
void bcm_intc_irq_handler(void *);
@@ -479,7 +479,7 @@ bcm_intc_irq_handler(void *frame)
void *
bcm_intc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct bcm_intc_softc *sc = (struct bcm_intc_softc *)cookie;
int irq;
@@ -496,22 +496,22 @@ bcm_intc_intr_establish_fdt(void *cookie, int *cell, int level,
else
panic("%s: bogus interrupt type", sc->sc_dev.dv_xname);
- return bcm_intc_intr_establish(irq, level, func, arg, name);
+ return bcm_intc_intr_establish(irq, level, ci, func, arg, name);
}
void *
l1_intc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
int irq;
irq = cell[0] + LOCAL_START;
- return bcm_intc_intr_establish(irq, level, func, arg, name);
+ return bcm_intc_intr_establish(irq, level, ci, func, arg, name);
}
void *
-bcm_intc_intr_establish(int irqno, int level, int (*func)(void *),
- void *arg, char *name)
+bcm_intc_intr_establish(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
struct bcm_intc_softc *sc = bcm_intc;
struct intrhand *ih;
@@ -520,6 +520,12 @@ bcm_intc_intr_establish(int irqno, int level, int (*func)(void *),
if (irqno < 0 || irqno >= INTC_NIRQ)
panic("bcm_intc_intr_establish: bogus irqnumber %d: %s",
irqno, name);
+
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+ else if (!CPU_IS_PRIMARY(ci))
+ return NULL;
+
psw = disable_interrupts(PSR_I);
ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
diff --git a/sys/arch/armv7/include/intr.h b/sys/arch/armv7/include/intr.h
index e08b4942927..f61eff62f66 100644
--- a/sys/arch/armv7/include/intr.h
+++ b/sys/arch/armv7/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.12 2019/09/29 10:36:52 kettenis Exp $ */
+/* $OpenBSD: intr.h,v 1.13 2020/07/14 15:34:15 patrick Exp $ */
/* $NetBSD: intr.h,v 1.12 2003/06/16 20:00:59 thorpej Exp $ */
/*
@@ -81,6 +81,8 @@
#include <sys/device.h>
#include <sys/queue.h>
+struct cpu_info;
+
int splraise(int);
int spllower(int);
void splx(int);
@@ -88,8 +90,8 @@ void splx(int);
void arm_do_pending_intr(int);
void arm_set_intr_handler(int (*raise)(int), int (*lower)(int),
void (*x)(int), void (*setipl)(int),
- void *(*intr_establish)(int irqno, int level, int (*func)(void *),
- void *cookie, char *name),
+ void *(*intr_establish)(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name),
void (*intr_disestablish)(void *cookie),
const char *(*intr_string)(void *cookie),
void (*intr_handle)(void *));
@@ -99,8 +101,8 @@ struct arm_intr_func {
int (*lower)(int);
void (*x)(int);
void (*setipl)(int);
- void *(*intr_establish)(int irqno, int level, int (*func)(void *),
- void *cookie, char *name);
+ void *(*intr_establish)(int irqno, int level, struct cpu_info *,
+ int (*func)(void *), void *cookie, char *name);
void (*intr_disestablish)(void *cookie);
const char *(*intr_string)(void *cookie);
};
@@ -147,15 +149,13 @@ const char *arm_intr_string(void *cookie);
void arm_clock_register(void (*)(void), void (*)(u_int), void (*)(int),
void (*)(void));
-struct cpu_info;
-
struct interrupt_controller {
int ic_node;
void *ic_cookie;
- void *(*ic_establish)(void *, int *, int, int (*)(void *),
- void *, char *);
- void *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int,
+ void *(*ic_establish)(void *, int *, int, struct cpu_info *,
int (*)(void *), void *, char *);
+ void *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void (*ic_disestablish)(void *);
void (*ic_enable)(void *);
void (*ic_disable)(void *);
@@ -171,12 +171,20 @@ void arm_intr_init_fdt(void);
void arm_intr_register_fdt(struct interrupt_controller *);
void *arm_intr_establish_fdt(int, int, int (*)(void *),
void *, char *);
+void *arm_intr_establish_fdt_cpu(int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void *arm_intr_establish_fdt_idx(int, int, int, int (*)(void *),
void *, char *);
+void *arm_intr_establish_fdt_idx_cpu(int, int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void *arm_intr_establish_fdt_imap(int, int *, int, int, int (*)(void *),
void *, char *);
-void *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int ,
+void *arm_intr_establish_fdt_imap_cpu(int, int *, int, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
+void *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int,
int (*)(void *), void *, char *);
+void *arm_intr_establish_fdt_msi_cpu(int, uint64_t *, uint64_t *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void arm_intr_disestablish_fdt(void *);
void arm_intr_enable(void *);
void arm_intr_disable(void *);
@@ -184,7 +192,7 @@ void arm_intr_route(void *, int, struct cpu_info *);
void arm_intr_cpu_enable(void);
void *arm_intr_parent_establish_fdt(void *, int *, int,
- int (*)(void *), void *, char *);
+ struct cpu_info *ci, int (*)(void *), void *, char *);
void arm_intr_parent_disestablish_fdt(void *);
void arm_send_ipi(struct cpu_info *, int);
diff --git a/sys/arch/armv7/marvell/mvmpic.c b/sys/arch/armv7/marvell/mvmpic.c
index 42f9712e6b3..477bd2851cf 100644
--- a/sys/arch/armv7/marvell/mvmpic.c
+++ b/sys/arch/armv7/marvell/mvmpic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mvmpic.c,v 1.3 2018/12/07 21:33:28 patrick Exp $ */
+/* $OpenBSD: mvmpic.c,v 1.4 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2015 Patrick Wildt <patrick@blueri.se>
@@ -73,7 +73,7 @@ struct intrhand {
int mpic_match(struct device *, void *, void *);
void mpic_attach(struct device *, struct device *, void *);
void mpic_calc_mask(struct mpic_softc *);
-void *mpic_intr_establish(void *, int *, int,
+void *mpic_intr_establish(void *, int *, int, struct cpu_info *,
int (*)(void *), void *, char *);
void mpic_intr_disestablish(void *);
int mpic_intr(void *);
@@ -236,7 +236,7 @@ mpic_intr(void *cookie)
void *
mpic_intr_establish(void *cookie, int *cells, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct mpic_softc *sc = cookie;
struct intrhand *ih;
@@ -251,6 +251,9 @@ mpic_intr_establish(void *cookie, int *cells, int level,
panic("%s: irq %d already registered" , __func__,
irqno);
+ if (ci != NULL && !CPU_IS_PRIMARY(ci))
+ return NULL;
+
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
ih->ih_func = func;
ih->ih_arg = arg;
diff --git a/sys/arch/armv7/omap/intc.c b/sys/arch/armv7/omap/intc.c
index 6ac04281d12..f937ae1cad1 100644
--- a/sys/arch/armv7/omap/intc.c
+++ b/sys/arch/armv7/omap/intc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intc.c,v 1.9 2019/10/05 15:44:57 kettenis Exp $ */
+/* $OpenBSD: intc.c,v 1.10 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -108,8 +108,8 @@ int intc_spllower(int new);
int intc_splraise(int new);
void intc_setipl(int new);
void intc_calc_mask(void);
-void *intc_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *intc_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
struct cfattach intc_ca = {
sizeof (struct device), intc_match, intc_attach
@@ -353,8 +353,8 @@ intc_irq_handler(void *frame)
}
void *
-intc_intr_establish(int irqno, int level, int (*func)(void *),
- void *arg, char *name)
+intc_intr_establish(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
int psw;
struct intrhand *ih;
@@ -362,6 +362,12 @@ intc_intr_establish(int irqno, int level, int (*func)(void *),
if (irqno < 0 || irqno >= INTC_NUM_IRQ)
panic("intc_intr_establish: bogus irqnumber %d: %s",
irqno, name);
+
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+ else if (!CPU_IS_PRIMARY(ci))
+ return NULL;
+
psw = disable_interrupts(PSR_I);
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
@@ -388,9 +394,9 @@ intc_intr_establish(int irqno, int level, int (*func)(void *),
void *
intc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
- return intc_intr_establish(cell[0], level, func, arg, name);
+ return intc_intr_establish(cell[0], level, ci, func, arg, name);
}
void
diff --git a/sys/arch/armv7/omap/intc.h b/sys/arch/armv7/omap/intc.h
index c4c7f691354..04b9f12016a 100644
--- a/sys/arch/armv7/omap/intc.h
+++ b/sys/arch/armv7/omap/intc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intc.h,v 1.3 2019/05/06 03:45:58 mlarkin Exp $ */
+/* $OpenBSD: intc.h,v 1.4 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -63,8 +63,8 @@ find_first_bit( uint32_t bits )
void intc_intr_bootstrap(vaddr_t);
void intc_irq_handler(void *);
-void *intc_intr_establish(int irqno, int level, int (*func)(void *),
- void *cookie, char *name);
+void *intc_intr_establish(int irqno, int level, struct cpu_info *ci,
+ int (*func)(void *), void *cookie, char *name);
void intc_intr_disestablish(void *cookie);
const char *intc_intr_string(void *cookie);
diff --git a/sys/arch/armv7/sunxi/sxiintc.c b/sys/arch/armv7/sunxi/sxiintc.c
index 07363154104..0832958f400 100644
--- a/sys/arch/armv7/sunxi/sxiintc.c
+++ b/sys/arch/armv7/sunxi/sxiintc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxiintc.c,v 1.6 2019/10/05 15:44:57 kettenis Exp $ */
+/* $OpenBSD: sxiintc.c,v 1.7 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Artturi Alm
@@ -149,8 +149,8 @@ int sxiintc_spllower(int);
int sxiintc_splraise(int);
void sxiintc_setipl(int);
void sxiintc_calc_masks(void);
-void *sxiintc_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *sxiintc_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
struct cfattach sxiintc_ca = {
sizeof (struct device), sxiintc_match, sxiintc_attach
@@ -372,8 +372,8 @@ sxiintc_irq_handler(void *frame)
}
void *
-sxiintc_intr_establish(int irq, int level, int (*func)(void *),
- void *arg, char *name)
+sxiintc_intr_establish(int irq, int level, struct cpu_info *ci,
+ int (*func)(void *), void *arg, char *name)
{
int psw;
struct intrhand *ih;
@@ -382,6 +382,11 @@ sxiintc_intr_establish(int irq, int level, int (*func)(void *),
if (irq <= 0 || irq >= NIRQ)
panic("intr_establish: bogus irq %d %s\n", irq, name);
+ if (ci == NULL)
+ ci = &cpu_info_primary;
+ else if (!CPU_IS_PRIMARY(ci))
+ return NULL;
+
DPRINTF(("intr_establish: irq %d level %d [%s]\n", irq, level,
name != NULL ? name : "NULL"));
@@ -413,9 +418,9 @@ sxiintc_intr_establish(int irq, int level, int (*func)(void *),
void *
sxiintc_intr_establish_fdt(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
- return sxiintc_intr_establish(cell[0], level, func, arg, name);
+ return sxiintc_intr_establish(cell[0], level, ci, func, arg, name);
}
void
diff --git a/sys/arch/armv7/sunxi/sxiintc.h b/sys/arch/armv7/sunxi/sxiintc.h
index 849594d02f8..cec533d6597 100644
--- a/sys/arch/armv7/sunxi/sxiintc.h
+++ b/sys/arch/armv7/sunxi/sxiintc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxiintc.h,v 1.1 2016/08/05 20:38:17 kettenis Exp $ */
+/* $OpenBSD: sxiintc.h,v 1.2 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -37,7 +37,8 @@ int sxiintc_spllower(int);
void sxiintc_setsoftintr(int);
void sxiintc_irq_handler(void *);
-void *sxiintc_intr_establish(int, int, int (*)(void *), void *, char *);
+void *sxiintc_intr_establish(int, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void sxiintc_intr_disestablish(void *);
const char *sxiintc_intr_string(void *);
diff --git a/sys/dev/fdt/bcm2835_aux.c b/sys/dev/fdt/bcm2835_aux.c
index 6ed7dc6990b..47bc8e492dd 100644
--- a/sys/dev/fdt/bcm2835_aux.c
+++ b/sys/dev/fdt/bcm2835_aux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcm2835_aux.c,v 1.4 2019/08/29 11:51:48 kettenis Exp $ */
+/* $OpenBSD: bcm2835_aux.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
*
@@ -57,8 +57,8 @@ struct cfdriver bcmaux_cd = {
};
uint32_t bcm_aux_get_frequency(void *, uint32_t *);
-void *bcm_aux_intr_establish_fdt(void *, int *, int, int (*)(void *),
- void *, char *);
+void *bcm_aux_intr_establish_fdt(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
int
bcmaux_match(struct device *parent, void *match, void *aux)
@@ -115,7 +115,7 @@ bcm_aux_get_frequency(void *cookie, uint32_t *cells)
void *
bcm_aux_intr_establish_fdt(void *cookie, int *cells, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct interrupt_controller *ic = cookie;
uint32_t idx = cells[0];
@@ -124,5 +124,5 @@ bcm_aux_intr_establish_fdt(void *cookie, int *cells, int level,
if (idx != BCMAUX_UART)
return NULL;
- return fdt_intr_establish(ic->ic_node, level, func, arg, name);
+ return fdt_intr_establish_cpu(ic->ic_node, level, ci, func, arg, name);
}
diff --git a/sys/dev/fdt/imxgpio.c b/sys/dev/fdt/imxgpio.c
index 4a108c212ca..a1dab03217a 100644
--- a/sys/dev/fdt/imxgpio.c
+++ b/sys/dev/fdt/imxgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxgpio.c,v 1.3 2018/08/08 11:06:47 patrick Exp $ */
+/* $OpenBSD: imxgpio.c,v 1.4 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
@@ -78,8 +78,8 @@ int imxgpio_get_pin(void *, uint32_t *);
void imxgpio_set_pin(void *, uint32_t *, int);
int imxgpio_intr(void *);
-void *imxgpio_intr_establish(void *, int *, int, int (*)(void *),
- void *, char *);
+void *imxgpio_intr_establish(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void imxgpio_intr_disestablish(void *);
void imxgpio_recalc_ipl(struct imxgpio_softc *);
void imxgpio_intr_enable(void *);
@@ -231,7 +231,7 @@ imxgpio_intr(void *cookie)
void *
imxgpio_intr_establish(void *cookie, int *cells, int ipl,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct imxgpio_softc *sc = (struct imxgpio_softc *)cookie;
struct intrhand *ih;
@@ -247,6 +247,9 @@ imxgpio_intr_establish(void *cookie, int *cells, int ipl,
panic("%s: irqnumber %d reused: %s", __func__,
irqno, name);
+ if (ci != NULL && !CPU_IS_PRIMARY(ci))
+ return NULL;
+
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
ih->ih_func = func;
ih->ih_arg = arg;
diff --git a/sys/dev/fdt/mvgicp.c b/sys/dev/fdt/mvgicp.c
index 42bd7f98e70..e333dad97c0 100644
--- a/sys/dev/fdt/mvgicp.c
+++ b/sys/dev/fdt/mvgicp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mvgicp.c,v 1.1 2019/02/03 14:03:36 patrick Exp $ */
+/* $OpenBSD: mvgicp.c,v 1.2 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2019 Patrick Wildt <patrick@blueri.se>
*
@@ -48,7 +48,7 @@ int mvgicp_match(struct device *, void *, void *);
void mvgicp_attach(struct device *, struct device *, void *);
void * mvgicp_intr_establish(void *, uint64_t *, uint64_t *,
- int, int (*)(void *), void *, char *);
+ int, struct cpu_info *, int (*)(void *), void *, char *);
void mvgicp_intr_disestablish(void *);
struct cfattach mvgicp_ca = {
@@ -119,7 +119,7 @@ mvgicp_attach(struct device *parent, struct device *self, void *aux)
void *
mvgicp_intr_establish(void *self, uint64_t *addr, uint64_t *data,
- int level, int (*func)(void *), void *arg, char *name)
+ int level, struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct mvgicp_softc *sc = (struct mvgicp_softc *)self;
struct interrupt_controller *ic = sc->sc_parent_ic;
@@ -160,7 +160,7 @@ mvgicp_intr_establish(void *self, uint64_t *addr, uint64_t *data,
interrupt[1] = spi - 32;
interrupt[2] = flags;
cookie = ic->ic_establish(ic->ic_cookie, interrupt, level,
- func, arg, name);
+ ci, func, arg, name);
if (cookie == NULL)
return NULL;
diff --git a/sys/dev/fdt/mvicu.c b/sys/dev/fdt/mvicu.c
index f4b6b3bfb8f..0659c81a158 100644
--- a/sys/dev/fdt/mvicu.c
+++ b/sys/dev/fdt/mvicu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mvicu.c,v 1.4 2019/02/03 14:03:36 patrick Exp $ */
+/* $OpenBSD: mvicu.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
@@ -93,8 +93,8 @@ struct cfdriver mvicu_cd = {
};
void mvicu_register(struct mvicu_softc *, int, int);
-void *mvicu_intr_establish(void *, int *, int, int (*)(void *),
- void *, char *);
+void *mvicu_intr_establish(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void mvicu_intr_disestablish(void *);
int
@@ -193,7 +193,7 @@ mvicu_register(struct mvicu_softc *sc, int node, int idx)
void *
mvicu_intr_establish(void *cookie, int *cell, int level,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct mvicu_subnode *sn = cookie;
struct mvicu_softc *sc = sn->sn_sc;
@@ -222,7 +222,7 @@ mvicu_intr_establish(void *cookie, int *cell, int level,
data = flags;
cookie = ic->ic_establish_msi(ic->ic_cookie, &addr, &data,
- level, func, arg, name);
+ level, ci, func, arg, name);
if (cookie == NULL)
return NULL;
diff --git a/sys/dev/fdt/mvkpcie.c b/sys/dev/fdt/mvkpcie.c
index 33795eaf646..67a294d7b47 100644
--- a/sys/dev/fdt/mvkpcie.c
+++ b/sys/dev/fdt/mvkpcie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mvkpcie.c,v 1.4 2020/05/22 21:40:20 kettenis Exp $ */
+/* $OpenBSD: mvkpcie.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2020 Patrick Wildt <patrick@blueri.se>
@@ -246,7 +246,7 @@ int mvkpcie_bs_memmap(bus_space_tag_t, bus_addr_t, bus_size_t, int,
int mvkpcie_intc_intr(void *);
void *mvkpcie_intc_intr_establish_msi(void *, uint64_t *, uint64_t *,
- int , int (*)(void *), void *, char *);
+ int , struct cpu_info *, int (*)(void *), void *, char *);
void mvkpcie_intc_intr_disestablish_msi(void *);
void mvkpcie_intc_recalc_ipl(struct mvkpcie_softc *);
@@ -861,12 +861,15 @@ mvkpcie_intc_intr(void *cookie)
void *
mvkpcie_intc_intr_establish_msi(void *cookie, uint64_t *addr, uint64_t *data,
- int level, int (*func)(void *), void *arg, char *name)
+ int level, struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct mvkpcie_softc *sc = (struct mvkpcie_softc *)cookie;
struct intrhand *ih;
int i, s;
+ if (ci != NULL && !CPU_IS_PRIMARY(ci))
+ return NULL;
+
for (i = 0; i < nitems(sc->sc_msi_handlers); i++) {
if (sc->sc_msi_handlers[i] == NULL)
break;
diff --git a/sys/dev/fdt/rkgpio.c b/sys/dev/fdt/rkgpio.c
index 24d02327fba..e45d533f1c2 100644
--- a/sys/dev/fdt/rkgpio.c
+++ b/sys/dev/fdt/rkgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rkgpio.c,v 1.4 2020/04/25 10:41:20 kettenis Exp $ */
+/* $OpenBSD: rkgpio.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2019 Patrick Wildt <patrick@blueri.se>
@@ -96,8 +96,8 @@ int rkgpio_get_pin(void *, uint32_t *);
void rkgpio_set_pin(void *, uint32_t *, int);
int rkgpio_intr(void *);
-void *rkgpio_intr_establish(void *, int *, int, int (*)(void *),
- void *, char *);
+void *rkgpio_intr_establish(void *, int *, int, struct cpu_info *,
+ int (*)(void *), void *, char *);
void rkgpio_intr_disestablish(void *);
void rkgpio_recalc_ipl(struct rkgpio_softc *);
void rkgpio_intr_enable(void *);
@@ -236,7 +236,7 @@ rkgpio_intr(void *cookie)
void *
rkgpio_intr_establish(void *cookie, int *cells, int ipl,
- int (*func)(void *), void *arg, char *name)
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct rkgpio_softc *sc = (struct rkgpio_softc *)cookie;
struct intrhand *ih;
@@ -252,6 +252,9 @@ rkgpio_intr_establish(void *cookie, int *cells, int ipl,
panic("%s: irqnumber %d reused: %s", __func__,
irqno, name);
+ if (ci != NULL && !CPU_IS_PRIMARY(ci))
+ return NULL;
+
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
ih->ih_func = func;
ih->ih_arg = arg;