Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1131847ybi; Fri, 2 Aug 2019 09:48:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx+r1vcQoA2NIX8HzQLFRqSigPpP0dPMyGeUFOC5zXQEHantAIW4iATMInuz9/exkVneSb X-Received: by 2002:a65:44cc:: with SMTP id g12mr46975598pgs.409.1564764537148; Fri, 02 Aug 2019 09:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564764537; cv=none; d=google.com; s=arc-20160816; b=jx/5hfpz0gx1iCKp3gVwrw4eN2lYQC2wUNw+UhOvB5vaOvu5BHxFTP/YGGAAs+end0 fvJ+FEu/NandOHaZ92J2Iqi9Z27624T7FoppiLGpe4uIKimUmgsOjeGkB9YXLcC1WdlO 2mD+Hce5bnSB8zWmUrT212iRjuWU2eLRCloVePMpWGxEmzyuDhEPbLAYD+zmncA0EDSA aNB0ohAr++wkcRya06umxiAyUxi9+6H8RQlMOQW+xF+ssY1D9lpmFjIpzceFBH1C/+4D TM9T/QqdsO0Q19SNHF4Bfuk9UuTO9pvDsMLEas8zWUcuJc7yzQk/jiyqHdIdjtiBY60b pLQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F+vnbzMs7C+WOBYlq5mrRgzkA2/uiP8IXntcoMMp8NU=; b=xn5IlIa4gAP8HErLujGnCQOxg4+RJfNFVLWMur4eRy/2Vh4BSTOkZn/s1b78pc9bZI BJO28dDQ9RV2iwnoqVmGWrWivnX6LAQ3IsmPlizxqjUtxEBGBL+yf2yQM5ZJyq1yQLFQ V1RZqOsTPXyhGB4g8uMMBn1AHv6l6dmgqyCi/E+GCQu3nhrs1UBiYJqq3Nb1kSFjlNl+ /JqhHYQ94hZ+F+qFXz560MNuJhFSgrQZMrow7s/hFZUCIev82tV2xHgFf9Xn00+OC4Hh gxs0GiwFn/NbdfKu3MH42PlZd3HMkNHFimDsDC8wjRICtA/f56D76aBgaOoC5WQzChoG Oycg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0pqyKB1D; 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 o4si36455587pgv.157.2019.08.02.09.48.41; Fri, 02 Aug 2019 09:48:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0pqyKB1D; 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 S2405051AbfHBJnZ (ORCPT + 99 others); Fri, 2 Aug 2019 05:43:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:46090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391954AbfHBJnQ (ORCPT ); Fri, 2 Aug 2019 05:43:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D7BB20679; Fri, 2 Aug 2019 09:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738994; bh=BNjn9YxPzNl3/wZkvHFhI70VUuK9qv3cMeiVmH51GzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0pqyKB1DVj7qjNAL/+YtHdHnY0/0sXUy73SfPiYSXokzqspe41klEg7Cw2qcJRjLF yujfK1zC/PWPanqqlUF9uqHxzs+RjOBFoMrOEx2eJRjED10dvjrWUBMfogFHleIi+c eyGZ9YyAcQhryTL8mN/Q9IQjY/hw2/dlXCRhfDzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Schmitz , Finn Thain , Stan Johnson , "Martin K. Petersen" Subject: [PATCH 4.9 076/223] scsi: NCR5380: Always re-enable reselection interrupt Date: Fri, 2 Aug 2019 11:35:01 +0200 Message-Id: <20190802092243.758580816@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finn Thain commit 57f31326518e98ee4cabf9a04efe00ed57c54147 upstream. 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") Signed-off-by: Finn Thain Tested-by: Stan Johnson Tested-by: Michael Schmitz Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/NCR5380.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -813,6 +813,8 @@ static void NCR5380_main(struct work_str 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(); @@ -1208,8 +1210,6 @@ static struct scsi_cmnd *NCR5380_select( 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; } @@ -1217,7 +1217,6 @@ static struct scsi_cmnd *NCR5380_select( 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) @@ -1255,7 +1254,6 @@ static struct scsi_cmnd *NCR5380_select( 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) { @@ -1906,9 +1904,6 @@ static void NCR5380_information_transfer */ 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: @@ -1940,8 +1935,6 @@ static void NCR5380_information_transfer */ 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 @@ -2049,7 +2042,6 @@ static void NCR5380_information_transfer 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;