diff options
author | 2020-07-17 08:07:33 +0000 | |
---|---|---|
committer | 2020-07-17 08:07:33 +0000 | |
commit | 452daaedc6a44247dc76c56f4c33bc4131b7c50c (patch) | |
tree | 482245802e7d6304dfe90d749f5b8e7edac4f384 /sys/dev/fdt/mvicu.c | |
parent | Add powerpc64 support; straight copy from octeon. (diff) | |
download | wireguard-openbsd-452daaedc6a44247dc76c56f4c33bc4131b7c50c.tar.xz wireguard-openbsd-452daaedc6a44247dc76c56f4c33bc4131b7c50c.zip |
Re-work intr_barrier(9) on arm64 to remove layer violation. So far we
have stored the struct cpu_info * in the wrapper around the interrupt
handler cookie, but since we can have a few layers inbetween, this does
not seem very nice. Instead have each and every interrupt controller
provide a barrier function. This means that intr_barrier(9) will in the
end be executed by the interrupt controller that actually wired the pin
to a core. And that's the only place where the information is stored.
ok kettenis@
Diffstat (limited to 'sys/dev/fdt/mvicu.c')
-rw-r--r-- | sys/dev/fdt/mvicu.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/fdt/mvicu.c b/sys/dev/fdt/mvicu.c index 0659c81a158..805aac01c82 100644 --- a/sys/dev/fdt/mvicu.c +++ b/sys/dev/fdt/mvicu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mvicu.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */ +/* $OpenBSD: mvicu.c,v 1.6 2020/07/17 08:07:34 patrick Exp $ */ /* * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> * @@ -96,6 +96,7 @@ void mvicu_register(struct mvicu_softc *, int, int); void *mvicu_intr_establish(void *, int *, int, struct cpu_info *, int (*)(void *), void *, char *); void mvicu_intr_disestablish(void *); +void mvicu_intr_barrier(void *); int mvicu_match(struct device *parent, void *match, void *aux) @@ -171,6 +172,7 @@ mvicu_register(struct mvicu_softc *sc, int node, int idx) sn->sn_ic.ic_cookie = sn; sn->sn_ic.ic_establish = mvicu_intr_establish; sn->sn_ic.ic_disestablish = mvicu_intr_disestablish; + sn->sn_ic.ic_barrier = mvicu_intr_barrier; while (node && !phandle) { phandle = OF_getpropint(node, "msi-parent", 0); @@ -198,6 +200,7 @@ mvicu_intr_establish(void *cookie, int *cell, int level, struct mvicu_subnode *sn = cookie; struct mvicu_softc *sc = sn->sn_sc; struct interrupt_controller *ic = sn->sn_parent_ic; + struct arm_intr_handle *ih; uint32_t idx, flags; uint64_t addr, data; int edge = 0; @@ -258,7 +261,11 @@ mvicu_intr_establish(void *cookie, int *cell, int level, (edge ? ICU_INT_EDGE : 0)); } - return cookie; + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); + ih->ih_ic = ic; + ih->ih_ih = cookie; + + return ih; } void @@ -266,3 +273,12 @@ mvicu_intr_disestablish(void *cookie) { panic("%s", __func__); } + +void +mvicu_intr_barrier(void *cookie) +{ + struct arm_intr_handle *ih = cookie; + struct interrupt_controller *ic = ih->ih_ic; + + ic->ic_barrier(ih->ih_ih); +} |