From patchwork Sat Apr 22 00:24:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9694017 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 6E604600CA for ; Sat, 22 Apr 2017 00:26:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60FBD28673 for ; Sat, 22 Apr 2017 00:26:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55AEC2868C; Sat, 22 Apr 2017 00:26:35 +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=unavailable 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 DEE9428687 for ; Sat, 22 Apr 2017 00:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1042930AbdDVAYq (ORCPT ); Fri, 21 Apr 2017 20:24:46 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33222 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1040186AbdDVAYK (ORCPT ); Fri, 21 Apr 2017 20:24:10 -0400 Received: by mail-oi0-f68.google.com with SMTP id a189so24135221oib.0; Fri, 21 Apr 2017 17:24:09 -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=bRst1JCwU+9+vmugS7hP/MkYbfvoOctGYjeBrNsWas/vZJMEc4saPb/Nnhydr/PfJz 9jeTRxA3VTDcgujoWGw5R3Rb7lKCZ9QXGiLcVJLWqwVlBz85q3qkNXZy2eaO7Q8RNIgr FbJnU6LOsu5vGIPhOH9QAa0c927uahO101Ykgf/72JaBvNT2U7299TXlGp70s3SjMH36 rpeP33/9kbOHEF7nZ+T63pSSwxARciDXJ28noAnUuqmtf0yF6u6M78kmaqlfILaQc4s7 Eb/dqJwL9wZh4i8hkRk5ll3L5JPzmNZPa5pGOpzbBbSrWPbbYNF1xQLRrgkthUekWRGL lW1w== 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=VvVZbdnowTfwopYBx+S9xCujAU6wuq9wmx+i4KBh+47V6AMUp/SC/1prxuIfU6v+SX 8F8zydN5ploPfYri9XQ/3FlWv14K2GaLhb11pNFL/Y+sNjGJPJO16qV/s26IGP3Kzi9z pFX04PSWZPWkTfetQl01ktE5g8gTriFiDoZUDlXaXl1gxzh7ylcGx177aMIf08EC16Cj UceDqyiitJKSHNAwM8xM7WJEPGFd+OSqDwsPkvjitkyslX3BEMz+FK6DEUzLJv0ARr7g XwCdgCsoJarm9nLKD3EW5LnpqjcaFiz52y76c39idcEColWRAEHEGwo8jo/dVVbfnyP9 iPHw== X-Gm-Message-State: AN3rC/4QqvocBC+M2KHTH7BQMBWaQ8xSREsdlWv4Fl1PMr1t/fD7Nh55 Nwhg44GfI2n3qBbF X-Received: by 10.202.6.2 with SMTP id 2mr8608813oig.198.1492820649207; Fri, 21 Apr 2017 17:24:09 -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 u26sm4820869otg.31.2017.04.21.17.24.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Apr 2017 17:24:08 -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] lpfc: Fix panic on BFS configuration. Date: Fri, 21 Apr 2017 17:24:04 -0700 Message-Id: <20170422002404.16027-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;