From ee534da32b68a1e05622d68919fc8f66e7090217 Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 19 May 2023 20:54:55 +0000 Subject: [PATCH] Clear interrupt before executing the interrupt handler as we otherwise risk losing an interrupt for the same pin. This can happen when a second interrupt occurs between the interrupt handler's execution and us clearing the interrupt. ok kettenis@ --- sys/dev/fdt/qcipcc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/fdt/qcipcc.c b/sys/dev/fdt/qcipcc.c index c72ae8c59b7..18d83e3b67d 100644 --- a/sys/dev/fdt/qcipcc.c +++ b/sys/dev/fdt/qcipcc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qcipcc.c,v 1.1 2023/05/17 23:19:00 patrick Exp $ */ +/* $OpenBSD: qcipcc.c,v 1.2 2023/05/19 20:54:55 patrick Exp $ */ /* * Copyright (c) 2023 Patrick Wildt * @@ -156,6 +156,8 @@ qcipcc_intr(void *arg) int handled = 0; while ((reg = HREAD4(sc, IPCC_RECV_ID)) != ~0) { + HWRITE4(sc, IPCC_RECV_SIGNAL_CLEAR, reg); + client_id = (reg >> IPCC_CLIENT_ID_SHIFT) & IPCC_CLIENT_ID_MASK; signal_id = (reg >> IPCC_SIGNAL_ID_SHIFT) & @@ -168,8 +170,6 @@ qcipcc_intr(void *arg) ih->ih_func(ih->ih_arg); handled = 1; } - - HWRITE4(sc, IPCC_RECV_SIGNAL_CLEAR, reg); } return handled; -- 2.20.1