Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3784500ybi; Mon, 29 Jul 2019 12:33:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzo91XgXobIk6ICdpdEx8ZhfL4sJ6i5oAJy4aJ0yMJ4MNK0dVmhDpoWoUEi/jP+jhA7j3z+ X-Received: by 2002:a63:7887:: with SMTP id t129mr20508342pgc.309.1564428828516; Mon, 29 Jul 2019 12:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428828; cv=none; d=google.com; s=arc-20160816; b=HlE1bEzAYcAQddqncv7kcvRIZ4RBt9BKhheZaKaSx73/LuwKiVPYYHQ5vi2FTliPCZ lD6yJmE5n/h3NGTmGlc9ZjnUJ4g3Do1lc5wI/twicbrkm916g4EOAilH1gRVa4PwVF/5 ywf211qezwxSA7RmLyPXt7B32d5C1+csQC12ZWJc9TXtqGbBPN0j0K0Ullmzrph0f6jq Vc8qUPB3VUpC0BKxc7op6Ms5jVcuUbFo5WfF/bcirYkN3cKE+nnhzn97hXsZwd1l8V+j 15T6b1qicKSr+ReLGB0ysY9DI12oqp131xtbX6KDfpOGpV5fxMYSQKcSfpBf1ahH+lmH zEGQ== 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=nyH1o3GMtPo7XzkTJJvRiZsMWLUEYSYvHadKtYANcgY=; b=dnrtTqGVlizkgXGMP3qLe0fYBcucV9mvK7G2oeD9flzXeb2EuwDcS6UApoPnOUq2LB GHlq2iLM37xzQFl6zg4FryK0FQhyHJXraFkQ+KSHg8VG5rUUoTRp/1ikSmw/Oi9mmhg9 LCSLUk5fq1lHDvSHfRC4kkd9Y99zz52Gb1ZqthpXNy9LK69GViHYzaOdMOOmSbONEI4m OTcsVyp45l81mC8wyyMwZsLGPIDQx0ToAOz3KJwiOO422q/PSJdgStjLFJ/znh8jR/nL hrA8zRZ/JGDcfPr4u9qTuqkcH47lnqdcbzcZhApnWwQEoRQUJFt1kOaYGSyFkfr3Hqdx Drbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BogrNDAE; 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 co4si7625881plb.363.2019.07.29.12.33.33; Mon, 29 Jul 2019 12:33:48 -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=BogrNDAE; 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 S1730092AbfG2T3R (ORCPT + 99 others); Mon, 29 Jul 2019 15:29:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:41918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729125AbfG2T3M (ORCPT ); Mon, 29 Jul 2019 15:29:12 -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 43B2E217F5; Mon, 29 Jul 2019 19:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428551; bh=8VBU01KzegVBNk90L5Zskd7WJIALXijJGVy0aMoXn50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BogrNDAE3i5Axi6E67/0Oq8JYire/d3UAP+w+jeb+ox8sKkdVMqrfdENRtksbuRrJ VqpNKM5LAF5Pppnco78QQodYhnpKETDmwMg197Ekyndj8eHuWjqdneJ9noGiCa47fY JkpR7HGLkN/mDcnsYJpvU6161UwnigSyPOAMJQtM= 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.14 113/293] scsi: NCR5380: Always re-enable reselection interrupt Date: Mon, 29 Jul 2019 21:20:04 +0200 Message-Id: <20190729190833.289471786@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 @@ -710,6 +710,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(); @@ -1106,8 +1108,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; } @@ -1115,7 +1115,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) @@ -1153,7 +1152,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) { @@ -1820,9 +1818,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: @@ -1854,8 +1849,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 @@ -1963,7 +1956,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;