cxlflash: Fix to prevent stale AFU RRQ
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Wed, 21 Oct 2015 20:15:14 +0000 (15:15 -0500)
committerJames Bottomley <JBottomley@Odin.com>
Fri, 30 Oct 2015 08:18:53 +0000 (17:18 +0900)
Following an adapter reset, the AFU RRQ that resides in host memory
holds stale data. This can lead to a condition where the RRQ interrupt
handler tries to process stale entries and/or endlessly loops due to an
out of sync generation bit.

To fix, the AFU RRQ in host memory needs to be cleared after each reset.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/cxlflash/main.c

index eeb1c4798207bcaa8dce4215136958b2b4db82ce..c77cb929dacb7d35d470cea16c210ff6d600f29e 100644 (file)
@@ -1598,6 +1598,9 @@ static int start_afu(struct cxlflash_cfg *cfg)
 
        init_pcr(cfg);
 
+       /* After an AFU reset, RRQ entries are stale, clear them */
+       memset(&afu->rrq_entry, 0, sizeof(afu->rrq_entry));
+
        /* Initialize RRQ pointers */
        afu->hrrq_start = &afu->rrq_entry[0];
        afu->hrrq_end = &afu->rrq_entry[NUM_RRQ_ENTRY - 1];