From eb132ade4af4184cfa47b70e44b01db40e96a0d0 Mon Sep 17 00:00:00 2001 From: Leandro Lupori Date: Mon, 9 Mar 2020 19:01:17 +0000 Subject: [PATCH] [aacraid] Handle both AIF and SYNC interrupts Without this change, if an AIF interrupt comes at the same time a SYNC command is finished, the SYNC interrupt will be lost. This happens because all interrupt bits (bellbits) are cleared, but only one of them is handled. Debugging shows that, (at least) when !sc->msi_enabled and (sc->flags & AAC_FLAGS_SYNC_MODE) is true (sync mode), both bits may be set at the same time. PR: 237463 Reviewed by: scottl Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23859 --- sys/dev/aacraid/aacraid.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c index cd7d27558e8a..0847e15309c0 100644 --- a/sys/dev/aacraid/aacraid.c +++ b/sys/dev/aacraid/aacraid.c @@ -899,7 +899,7 @@ aacraid_new_intr_type1(void *arg) AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits); if (bellbits_shifted & AAC_DB_AIF_PENDING) mode |= AAC_INT_MODE_AIF; - else if (bellbits_shifted & AAC_DB_SYNC_COMMAND) + if (bellbits_shifted & AAC_DB_SYNC_COMMAND) mode |= AAC_INT_MODE_SYNC; } /* ODR readback, Prep #238630 */ @@ -923,7 +923,10 @@ aacraid_new_intr_type1(void *arg) sc->flags &= ~AAC_QUEUE_FRZN; sc->aac_sync_cm = NULL; } - mode = 0; + if (mode & AAC_INT_MODE_INTX) + mode &= ~AAC_INT_MODE_SYNC; + else + mode = 0; } if (mode & AAC_INT_MODE_AIF) { @@ -933,6 +936,9 @@ aacraid_new_intr_type1(void *arg) } } + if (sc->flags & AAC_FLAGS_SYNC_MODE) + mode = 0; + if (mode) { /* handle async. status */ index = sc->aac_host_rrq_idx[vector_no];