Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1979546imm; Thu, 24 May 2018 03:58:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZruHO3XhcwwiH1s6VZNNOgt850GTGdpl8zBtriYHcIdAtCz4+E2WnBAfUSmM6OLEQoaTvte X-Received: by 2002:a62:d286:: with SMTP id c128-v6mr6785276pfg.240.1527159519548; Thu, 24 May 2018 03:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159519; cv=none; d=google.com; s=arc-20160816; b=yJ1kNGkQiww0QGgyFisdsOMKofSqTmGrjI7TZ6Sh/MZ2sbYmR2MMLo7Coe7Wlstz7N Mw44EOJL5QnyvbhytUsXiIAnwnpErw1W9opyYQaA0h5+7nEijbTpll/CC4/ihDc4Z1h1 rEK4I+aamt4PfC7cVTtYAmPgbqyvXrzw977aRjG38A65uHsBBwnyshDnvX79cU/priqU pC725BSO7pbCqtzmPKgvJBengaVMy9pSaRPTMzLuvIxYux3TKdErYnX6+4bTAOKFuLem txuuYXOQqcLflItIqSmL1roQep8OaknwjC42R9aV54c0dJyP5cTScvWnQQXz+prlL/Lf hhuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=lKANvCog72qIUIXDXFTzcd8ndQnJMam6X4RfaoDTbHA=; b=LdLliECyAj0TBVrP9FADx6Al1OuNqHGRSRCw563vzjst8Llz7ZtC6ah5hzBpf3QYNk qzPaDqFjAwJ8/joL3YSC1mlAtK/+4eRU8SmD2BhpT1ypkszKIec7iZCueUvkopUmhU6y kaatXooGalM3bsfqCEsE4p6v8VkpEyHSmcNHD3+xVDHOOsyZ/tKJ9vPpi2ryg7ke5V6R fRfpr/Vvr1VFkavq+YtVa48PGX99JGqJq1I6dioPQFNvjPN2hOY42Tzklgb4pVJS1pSE /WnzkZ6xcCCgmNWVqAz/PR2xMDcnD/9HIrvCPM9RGHidg52Q95Xt8AKZ6LV4PczU3JIu rZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p4ZyZ5mz; 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 t11-v6si4202383pgs.32.2018.05.24.03.58.25; Thu, 24 May 2018 03:58:39 -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=p4ZyZ5mz; 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 S1032697AbeEXK5m (ORCPT + 99 others); Thu, 24 May 2018 06:57:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:36108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030259AbeEXJ4L (ORCPT ); Thu, 24 May 2018 05:56:11 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 31654208A0; Thu, 24 May 2018 09:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155770; bh=fZURIPK6mpGlo2WydL27levr6MdX2TOQTC0/Sx9SFd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4ZyZ5mznIPNaRYGk0SWYO3mVKp4eflR0zwcmbY0D763JZkmvkr+kRYBzRPkgU50I wrb0kIE7wCry+ee1FG+iGuFRN9TBNrdbfNmOiYUfjaprhSqaGsRjJNY9w9AQ6CJogv APucVqpWqmvFSJI587sU6CqZEnwha0w6SDZ8upRU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manish Rangankar , "Ewan D. Milne" , Tomas Henzl , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 109/165] scsi: qla4xxx: skip error recovery in case of register disconnect. Date: Thu, 24 May 2018 11:38:35 +0200 Message-Id: <20180524093626.428842355@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Manish Rangankar [ Upstream commit 1bc5ad3a6acdcf56f83272f2de1cd2389ea9e9e2 ] A system crashes when continuously removing/re-adding the storage controller. Signed-off-by: Manish Rangankar Reviewed-by: Ewan D. Milne Reviewed-by: Tomas Henzl Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla4xxx/ql4_def.h | 2 + drivers/scsi/qla4xxx/ql4_os.c | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h @@ -168,6 +168,8 @@ #define DEV_DB_NON_PERSISTENT 0 #define DEV_DB_PERSISTENT 1 +#define QL4_ISP_REG_DISCONNECT 0xffffffffU + #define COPY_ISID(dst_isid, src_isid) { \ int i, j; \ for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \ --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -262,6 +262,24 @@ static struct iscsi_transport qla4xxx_is static struct scsi_transport_template *qla4xxx_scsi_transport; +static int qla4xxx_isp_check_reg(struct scsi_qla_host *ha) +{ + u32 reg_val = 0; + int rval = QLA_SUCCESS; + + if (is_qla8022(ha)) + reg_val = readl(&ha->qla4_82xx_reg->host_status); + else if (is_qla8032(ha) || is_qla8042(ha)) + reg_val = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_ALIVE_COUNTER); + else + reg_val = readw(&ha->reg->ctrl_status); + + if (reg_val == QL4_ISP_REG_DISCONNECT) + rval = QLA_ERROR; + + return rval; +} + static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num, uint32_t iface_type, uint32_t payload_size, uint32_t pid, struct sockaddr *dst_addr) @@ -9188,10 +9206,17 @@ static int qla4xxx_eh_abort(struct scsi_ struct srb *srb = NULL; int ret = SUCCESS; int wait = 0; + int rval; ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n", ha->host_no, id, lun, cmd, cmd->cmnd[0]); + rval = qla4xxx_isp_check_reg(ha); + if (rval != QLA_SUCCESS) { + ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n"); + return FAILED; + } + spin_lock_irqsave(&ha->hardware_lock, flags); srb = (struct srb *) CMD_SP(cmd); if (!srb) { @@ -9243,6 +9268,7 @@ static int qla4xxx_eh_device_reset(struc struct scsi_qla_host *ha = to_qla_host(cmd->device->host); struct ddb_entry *ddb_entry = cmd->device->hostdata; int ret = FAILED, stat; + int rval; if (!ddb_entry) return ret; @@ -9262,6 +9288,12 @@ static int qla4xxx_eh_device_reset(struc cmd, jiffies, cmd->request->timeout / HZ, ha->dpc_flags, cmd->result, cmd->allowed)); + rval = qla4xxx_isp_check_reg(ha); + if (rval != QLA_SUCCESS) { + ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n"); + return FAILED; + } + /* FIXME: wait for hba to go online */ stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun); if (stat != QLA_SUCCESS) { @@ -9305,6 +9337,7 @@ static int qla4xxx_eh_target_reset(struc struct scsi_qla_host *ha = to_qla_host(cmd->device->host); struct ddb_entry *ddb_entry = cmd->device->hostdata; int stat, ret; + int rval; if (!ddb_entry) return FAILED; @@ -9322,6 +9355,12 @@ static int qla4xxx_eh_target_reset(struc ha->host_no, cmd, jiffies, cmd->request->timeout / HZ, ha->dpc_flags, cmd->result, cmd->allowed)); + rval = qla4xxx_isp_check_reg(ha); + if (rval != QLA_SUCCESS) { + ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n"); + return FAILED; + } + stat = qla4xxx_reset_target(ha, ddb_entry); if (stat != QLA_SUCCESS) { starget_printk(KERN_INFO, scsi_target(cmd->device), @@ -9376,9 +9415,16 @@ static int qla4xxx_eh_host_reset(struct { int return_status = FAILED; struct scsi_qla_host *ha; + int rval; ha = to_qla_host(cmd->device->host); + rval = qla4xxx_isp_check_reg(ha); + if (rval != QLA_SUCCESS) { + ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n"); + return FAILED; + } + if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba) qla4_83xx_set_idc_dontreset(ha);