Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1776980ybi; Sat, 8 Jun 2019 18:32:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRtWOMR9uv0UY2lrWX30q4uVbZrWRA0qqvctvfoGFkPsJcTekIwapO0Yx2ueXc6/83iwj0 X-Received: by 2002:a17:902:467:: with SMTP id 94mr8063261ple.131.1560043966644; Sat, 08 Jun 2019 18:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560043966; cv=none; d=google.com; s=arc-20160816; b=fTN2t2iigNf7dyYq1VgxQrGbIRySeNwW9E0/kTFpiUsZTmD7pi+ZofnFU+1lZwQHFa bGDqEcCRPnz+3jNzOlksZeq3P8idUoFQ+UzGvfy+IedawJZ/NI7m5qoMmP+KRLA1AcS7 H8T4P13FqIkNld8QtYo0GiC6jNwU4jtJo/iZN7k5BvcKTVwtlNDPjZCHQvWd1vcP9aDc K2enHgLRclxEGI3zVvISk6nwFggcPbn+k7lDHx+ZkwvxqRsT/SuYiChGb9qA+dBmprX6 3R8X1tByHoXedO43NGXRgvzJKcVnkWhxHDLO2hEpGcbooniMAF5lN2IZ8wX5w0XWKZC5 EQAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=J1TetCIntHGXoSbBV3y//pPh3rSzObRmQQZALpBw6rs=; b=NYPc03Ny31JEmr1jBgjw3w+aTl923xRzEoUVsvguGrJXQtTWDdXskAs/NtAFcWPuub T+X6HHzlWNwdEoXWOcycQ3TAYXsr+IBtDuc+vo/OKU1hrRtL6n+90FkTyOVMBk1Ier1R eiSYQTnzv+zJ/9TwP7ConnsW5StBITlPtwzlmbhfF1b4fwP5KS+fBWeNn45+oJ6FoEfb rV89VkrffbeEcHy5o7OGzg9x9GswWaXjMxyq8OMd4+U25Fgy1qxElIULjCIWdJslU+yR tIWKsnct3E+6Y+zFE4KdZfSJ1jsTujAMp6LIgeI12FVFBPKanJP666c/R9zWqQ3TqYUC ACDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si5783659pgq.69.2019.06.08.18.32.30; Sat, 08 Jun 2019 18:32:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728175AbfFIB1T (ORCPT + 99 others); Sat, 8 Jun 2019 21:27:19 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:59934 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727577AbfFIB0o (ORCPT ); Sat, 8 Jun 2019 21:26:44 -0400 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id B1D6327868; Sat, 8 Jun 2019 21:26:42 -0400 (EDT) To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: "Michael Schmitz" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Message-Id: <61f0c0f6aaf8fa96bf3dade5475615b2cfbc8846.1560043151.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v2 2/7] scsi: NCR5380: Always re-enable reselection interrupt Date: Sun, 09 Jun 2019 11:19:11 +1000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The reselection interrupt gets disabled during selection and must be re-enabled when hostdata->connected becomes NULL. If it isn't re-enabled a disconnected command may time-out or the target may wedge the bus while trying to reselect the host. This can happen after a command is aborted. Fix this by enabling the reselection interrupt in NCR5380_main() after calls to NCR5380_select() and NCR5380_information_transfer() return. Cc: Michael Schmitz Cc: stable@vger.kernel.org # v4.9+ Fixes: 8b00c3d5d40d ("ncr5380: Implement new eh_abort_handler") Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index fe0535affc14..08e3ea8159b3 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -709,6 +709,8 @@ static void NCR5380_main(struct work_struct *work) NCR5380_information_transfer(instance); done = 0; } + if (!hostdata->connected) + NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); spin_unlock_irq(&hostdata->lock); if (!done) cond_resched(); @@ -1110,8 +1112,6 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) spin_lock_irq(&hostdata->lock); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_reselect(instance); - if (!hostdata->connected) - NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); shost_printk(KERN_ERR, instance, "reselection after won arbitration?\n"); goto out; } @@ -1119,7 +1119,6 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) if (err < 0) { spin_lock_irq(&hostdata->lock); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); - NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); /* Can't touch cmd if it has been reclaimed by the scsi ML */ if (!hostdata->selecting) @@ -1157,7 +1156,6 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) if (err < 0) { shost_printk(KERN_ERR, instance, "select: REQ timeout\n"); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); - NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); goto out; } if (!hostdata->selecting) { @@ -1826,9 +1824,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) */ NCR5380_write(TARGET_COMMAND_REG, 0); - /* Enable reselect interrupts */ - NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); - maybe_release_dma_irq(instance); return; case MESSAGE_REJECT: @@ -1860,8 +1855,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) */ NCR5380_write(TARGET_COMMAND_REG, 0); - /* Enable reselect interrupts */ - NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); #ifdef SUN3_SCSI_VME dregs->csr |= CSR_DMA_ENABLE; #endif @@ -1964,7 +1957,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) cmd->result = DID_ERROR << 16; complete_cmd(instance, cmd); maybe_release_dma_irq(instance); - NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); return; } msgout = NOP; -- 2.21.0