From patchwork Sat Apr 22 00:21:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9694011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E30AD602A7 for ; Sat, 22 Apr 2017 00:21:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEBFE2866E for ; Sat, 22 Apr 2017 00:21:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A197A2868A; Sat, 22 Apr 2017 00:21:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C4B52866E for ; Sat, 22 Apr 2017 00:21:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1042918AbdDVAVx (ORCPT ); Fri, 21 Apr 2017 20:21:53 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33440 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1042890AbdDVAVw (ORCPT ); Fri, 21 Apr 2017 20:21:52 -0400 Received: by mail-oi0-f67.google.com with SMTP id a189so24129758oib.0; Fri, 21 Apr 2017 17:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Qe07nEDnOd6g+HB4UE3Q1P0sr8ELO9J0Q7vX/WR+8mw=; b=q59Fu78Jjv7gghEvjhTt4nWhnbHFhje8RP2A+H6ciAuXFIyzzo/VgnNMuAhL2o6Don zsQMKrhyHQI8lvX2xl23hmdRwL+La+tVhgJxjoYXInBL44wBSFmRmrJtWSpStvC9eJig yETZW9q18lJKWd5vKDnyrqR9iGbNb6NfDvUu1joxRJ1gDzrs9A6PpDnRPDb90uhqdAX6 C3xTCoIrCv8/3bC7Y5Ew8L0vk8Y6E+rwhcerLNKbRItG74SDVLeJkYDqKnLthOBXitzA phil360vUDjkAKEIlKYC+X9nR1uKk+yVsByNJ9d74ZwsUenK4oqfNu43U5aTRapwRX8M xqQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Qe07nEDnOd6g+HB4UE3Q1P0sr8ELO9J0Q7vX/WR+8mw=; b=byqjeHpJ9X4Ovxq4eGK6/auyoYaEL9qLq/o+jKzJ2+E1ViWd1JRGqi7e88QZTYz9na 68q98TjByAOR8n5ZUd1ANrOG1lQCkuAwKJJO2R788FkTafho28p69FU5h4zJtrLE5JWC H9Lk1/zRru3ZDyphnrdvKF3g5jpCrrH7yJTADwNuljbmlNdJhTPuCAmq+mupGk98CUik dV7/A1cQARKvdC9Ap1kXaJhRF0C3PhN3U6Ip/m8DEPyjbS/TmFU0sqJKfgKNcLaPEL4+ ympdPti8jgXrlCJBkXdUMLkVxaIQtLo+bJUFHD7yMHWvc+vzXDh37WgZKkWO6z1ZfX6e MQdg== X-Gm-Message-State: AN3rC/5yjNuHjRWj6qi/28UYCndpGeypcnSWwm96nuToT9U0iTfObrJi c+jeFOAYZKkR4w== X-Received: by 10.202.215.67 with SMTP id o64mr8501131oig.83.1492820510998; Fri, 21 Apr 2017 17:21:50 -0700 (PDT) Received: from flash.localdomain (ip68-5-29-33.oc.oc.cox.net. [68.5.29.33]) by smtp.gmail.com with ESMTPSA id z23sm1488697oia.26.2017.04.21.17.21.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Apr 2017 17:21:50 -0700 (PDT) From: jsmart2021@gmail.com To: linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, sagi@grimberg.me, emilne@redhat.com, jthumshirn@suse.de, linux-block@vger.kernel.org, stable@vger.kernel.org, martin.petersen@oracle.com Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH] Fix panic on BFS configuration. Date: Fri, 21 Apr 2017 17:21:45 -0700 Message-Id: <20170422002145.15923-1-jsmart2021@gmail.com> X-Mailer: git-send-email 2.9.3 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: James Smart To select the appropriate shost template, the driver is issuing a mailbox command to retrieve the wwn. Turns out the sending of the command precedes the reset of the function. On SLI-4 adapters, this is inconsequential as the mailbox command location is specified by dma via the BMBX register. However, on SLI-3 adapters, the location of the mailbox command submission area changes. When the function is first powered on or reset, the cmd is submitted via PCI bar memory. Later the driver changes the function config to use host memory and DMA. The request to start a mailbox command is the same, a simple doorbell write, regardless of submission area. So.. if there has not been a boot driver run against the adapter, the mailbox command works as defaults are ok. But, if the boot driver has configured the card and, and if no platform pci function/slot reset occurs as the os starts, the mailbox command will fail. The SLI-3 device will use the stale boot driver dma location. This can cause PCI eeh errors. Fix is to reset the sli-3 function before sending the mailbox command, thus synchronizing the function/driver on mailbox location. This issue was introduced by this patch: http://www.spinics.net/lists/linux-scsi/msg105908.html which is in the stable pools with commit id: 96418b5e2c8867da3279d877f5d1ffabfe460c3d This patch needs to be applied to the stable trees where ever the introducing patch exists. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Cc: stable@vger.kernel.org --- drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 7 +++++++ drivers/scsi/lpfc/lpfc_sli.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 944b32c..62016d6 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -294,6 +294,7 @@ int lpfc_selective_reset(struct lpfc_hba *); void lpfc_reset_barrier(struct lpfc_hba *); int lpfc_sli_brdready(struct lpfc_hba *, uint32_t); int lpfc_sli_brdkill(struct lpfc_hba *); +int lpfc_sli_chipset_init(struct lpfc_hba *); int lpfc_sli_brdreset(struct lpfc_hba *); int lpfc_sli_brdrestart(struct lpfc_hba *); int lpfc_sli_hba_setup(struct lpfc_hba *); diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 90ae354..e85f273 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -3602,6 +3602,13 @@ lpfc_get_wwpn(struct lpfc_hba *phba) LPFC_MBOXQ_t *mboxq; MAILBOX_t *mb; + if (phba->sli_rev < LPFC_SLI_REV4) { + /* Reset the port first */ + lpfc_sli_brdrestart(phba); + rc = lpfc_sli_chipset_init(phba); + if (rc) + return (uint64_t)-1; + } mboxq = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index cf19f49..22862b7 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -4446,7 +4446,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba) * iteration, the function will restart the HBA again. The function returns * zero if HBA successfully restarted else returns negative error code. **/ -static int +int lpfc_sli_chipset_init(struct lpfc_hba *phba) { uint32_t status, i = 0;