From 452daaedc6a44247dc76c56f4c33bc4131b7c50c Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 17 Jul 2020 08:07:33 +0000 Subject: 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@ --- sys/dev/fdt/rkgpio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/dev/fdt/rkgpio.c') diff --git a/sys/dev/fdt/rkgpio.c b/sys/dev/fdt/rkgpio.c index e45d533f1c2..4b31efd13e7 100644 --- a/sys/dev/fdt/rkgpio.c +++ b/sys/dev/fdt/rkgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkgpio.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */ +/* $OpenBSD: rkgpio.c,v 1.6 2020/07/17 08:07:34 patrick Exp $ */ /* * Copyright (c) 2017 Mark Kettenis * Copyright (c) 2019 Patrick Wildt @@ -102,6 +102,7 @@ void rkgpio_intr_disestablish(void *); void rkgpio_recalc_ipl(struct rkgpio_softc *); void rkgpio_intr_enable(void *); void rkgpio_intr_disable(void *); +void rkgpio_intr_barrier(void *); int rkgpio_match(struct device *parent, void *match, void *aux) @@ -148,6 +149,7 @@ rkgpio_attach(struct device *parent, struct device *self, void *aux) sc->sc_ic.ic_disestablish = rkgpio_intr_disestablish; sc->sc_ic.ic_enable = rkgpio_intr_enable; sc->sc_ic.ic_disable = rkgpio_intr_disable; + sc->sc_ic.ic_barrier = rkgpio_intr_barrier; fdt_intr_register(&sc->sc_ic); printf("\n"); @@ -390,3 +392,12 @@ rkgpio_intr_disable(void *cookie) HSET4(sc, GPIO_INTMASK, 1 << ih->ih_irq); splx(s); } + +void +rkgpio_intr_barrier(void *cookie) +{ + struct intrhand *ih = cookie; + struct rkgpio_softc *sc = ih->ih_sc; + + intr_barrier(sc->sc_ih); +} -- cgit v1.2.3-59-g8ed1b