Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2523430ybi; Sat, 1 Jun 2019 18:30:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVKqvKtkbem4PFeDhJc90746SjlFdMTDd+oJXRTCTvXvDmHo8DH7TO7PnhX4KrVsl0TAoX X-Received: by 2002:a63:e708:: with SMTP id b8mr19692987pgi.168.1559439055578; Sat, 01 Jun 2019 18:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559439055; cv=none; d=google.com; s=arc-20160816; b=cWWLPeFBtYeEN7jxILKY2BQwdQQtYCIKR2iQzfwnTVQMjSRl5kqNnEdsoDAI2BXhGv IXr9/pqi9d1wpx9ace3oiL8x73kxnLqWP2MxLL+OSf9ifNVG44gFpGPvNLQKpezywn/7 UJOGrPHyl/qUl9lNTB5oNOCLIBmNmGax9fR5sqkU/cbrTZwEY5rYzyBJykvsZLGt/jYD 4ud1ZKJbGa7y5BEk1Y2p6KhADt2fSsdX2kKMS54YZOjqeBwkSdFL1W1aBmBiFb9yZwAA 4Sb0/FMmYIUjBUn+4zXXObtXtdqX+LuEYSGuP+IUbFfhZURfo083BGkslbBiW0T+88YH mLcw== 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=ToVZQwwNPyVQH/1sTgZH99MBpWf8vQDrYI9uYYiWXaTDZPlLgBDqd8yrWSvwB0J8yv qNLh2Kvap0QIhf/bXTSavgFjWo9eRruSBiz06Ev+65521iB8Wf9w+sYuvk7SoaxtIaSW dblgWjQ8KgHSZczzhVoWZMsBn6/rlvPBo9xR2bEEMKcnjZzI1/mysquLI/VrQkbqFc4p RFU3JKhcbQClBJwz2li3ijoo3p7CAsrkewIrfutB0jML6scvDSCRveRqdP09zHGm4eKO 887Z04DYfmHxv6FrAV63uzGd9XfDZub7iTgawucmSuzieQMtgaSMOizPvWrvIxfxQ5Ts oPPA== 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 c32si12901831pje.0.2019.06.01.18.30.39; Sat, 01 Jun 2019 18:30:55 -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 S1726965AbfFBB3Z (ORCPT + 99 others); Sat, 1 Jun 2019 21:29:25 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:34610 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbfFBB3K (ORCPT ); Sat, 1 Jun 2019 21:29:10 -0400 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id D7B4F27E4D; Sat, 1 Jun 2019 21:29:06 -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: <16486d63c31a51aa08ca79490e423569c7deaa57.1559438652.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH 2/7] scsi: NCR5380: Always re-enable reselection interrupt Date: Sun, 02 Jun 2019 11:24:12 +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