From patchwork Fri Dec 8 17:16:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121207 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp866989qgn; Fri, 8 Dec 2017 08:34:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMZGY2foR0gQ4Q8hJge2k4rd7Eq9D5DJW1JefuSp0A9NCbe2kSK2DGCXyIRuNnn+KemdkV5y X-Received: by 10.101.73.203 with SMTP id t11mr30418464pgs.446.1512750871084; Fri, 08 Dec 2017 08:34:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750871; cv=none; d=google.com; s=arc-20160816; b=yYQhNDDup/LGimbxUjMRAfzExkWX2UBZ7JaTlCsnlFG8uKfCKV+NTISN6x8sGilWzi /IPZ1TS1p6AckNXBZ1q9GCbUGwTCy8BIJQ1It9/deTuVax7M+wfk+Huf6j1xs9WZTtNz GZDU4rBgQ3A9ZEYd9KZvhv9FVg04iRXrxGE+WlFQE15z3aMyFHrdiCEhn5eVvzhzt3RJ 5pTlLGeMbFoOfppygsSR7aTumayGEErdE977G/Px3gYGK1BIa8WZf+f3iWTxa5h9h5md qqsZyCnG2siaQVkVoCKbkvKSO4ktW+kT+nkRP0mi7aFZOT6dDdUloa278akFM5QLRbda r1Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=JlOYLLV/qFeiPH+kpF3KnVz5s/U7c7jOwB+vHj/0E54=; b=ni2wSIPyYiwRII240lYaSdMq/0B0IpNJSitZi9KYJxGrLr44tjGfNaDhNy6rHmYbQP lYdl/6HGyxEC+qo3qeEOg3LNMcnqnUj3hsBibk/GK79Whm//YpKeNiictkipH5OpaskK rT+jfmScLDdOP6nnhwk3m8cs9pmVCkSa5nGSMnMtiJuT8iTSoGkgGOq8mg8VTKB4N66y OyPRtyBXzFg9xmxNd30vF0+T82UbJX4lCEnysUFLNnSROrKm+j69PeC0THpFw0ZXKmb+ UHhvjtQRbehQq26TxaBlWyknJFXGDOorUAAqgLaEhM2Jt1x8iJtZdS1cUWnBJQ9Rc9uh g20w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 x28si5793255pgc.520.2017.12.08.08.34.30; Fri, 08 Dec 2017 08:34:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754125AbdLHQea (ORCPT + 1 other); Fri, 8 Dec 2017 11:34:30 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2668 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754310AbdLHQbF (ORCPT ); Fri, 8 Dec 2017 11:31:05 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 22FEF2483C9D9; Sat, 9 Dec 2017 00:30:45 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 00:30:38 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 09/19] scsi: hisi_sas: add RAS feature for v3 hw Date: Sat, 9 Dec 2017 01:16:40 +0800 Message-ID: <1512753410-50924-10-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiaofei Tan We use PCIe AER to support RAS feature for v3 hw. This driver should do following two things to support this: 1. Enable RAS interrupts, so that errors can be reported to RAS module. 2. Realize err_handler for sas_v3_pci_driver. Then if non-fatal error is detected, print error source and try to recover SAS controller. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 139 +++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 69aa7bc..d356e12 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -204,6 +204,13 @@ #define AM_ROB_ECC_MULBIT_ERR_ADDR_OFF 8 #define AM_ROB_ECC_MULBIT_ERR_ADDR_MSK (0xff << AM_ROB_ECC_MULBIT_ERR_ADDR_OFF) +/* RAS registers need init */ +#define RAS_BASE (0x6000) +#define SAS_RAS_INTR0 (RAS_BASE) +#define SAS_RAS_INTR1 (RAS_BASE + 0x04) +#define SAS_RAS_INTR0_MASK (RAS_BASE + 0x08) +#define SAS_RAS_INTR1_MASK (RAS_BASE + 0x0c) + /* HW dma structures */ /* Delivery queue header */ /* dw0 */ @@ -496,6 +503,10 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, SATA_INITI_D2H_STORE_ADDR_HI, upper_32_bits(hisi_hba->initial_fis_dma)); + + /* RAS registers init */ + hisi_sas_write32(hisi_hba, SAS_RAS_INTR0_MASK, 0x0); + hisi_sas_write32(hisi_hba, SAS_RAS_INTR1_MASK, 0x0); } static void config_phy_opt_mode_v3_hw(struct hisi_hba *hisi_hba, int phy_no) @@ -2129,6 +2140,127 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) scsi_host_put(shost); } +static const struct hisi_sas_hw_error sas_ras_intr0_nfe[] = { + { .irq_msk = BIT(19), .msg = "HILINK_INT" }, + { .irq_msk = BIT(20), .msg = "HILINK_PLL0_OUT_OF_LOCK" }, + { .irq_msk = BIT(21), .msg = "HILINK_PLL1_OUT_OF_LOCK" }, + { .irq_msk = BIT(22), .msg = "HILINK_LOSS_OF_REFCLK0" }, + { .irq_msk = BIT(23), .msg = "HILINK_LOSS_OF_REFCLK1" }, + { .irq_msk = BIT(24), .msg = "DMAC0_TX_POISON" }, + { .irq_msk = BIT(25), .msg = "DMAC1_TX_POISON" }, + { .irq_msk = BIT(26), .msg = "DMAC2_TX_POISON" }, + { .irq_msk = BIT(27), .msg = "DMAC3_TX_POISON" }, + { .irq_msk = BIT(28), .msg = "DMAC4_TX_POISON" }, + { .irq_msk = BIT(29), .msg = "DMAC5_TX_POISON" }, + { .irq_msk = BIT(30), .msg = "DMAC6_TX_POISON" }, + { .irq_msk = BIT(31), .msg = "DMAC7_TX_POISON" }, +}; + +static const struct hisi_sas_hw_error sas_ras_intr1_nfe[] = { + { .irq_msk = BIT(0), .msg = "RXM_CFG_MEM3_ECC2B_INTR" }, + { .irq_msk = BIT(1), .msg = "RXM_CFG_MEM2_ECC2B_INTR" }, + { .irq_msk = BIT(2), .msg = "RXM_CFG_MEM1_ECC2B_INTR" }, + { .irq_msk = BIT(3), .msg = "RXM_CFG_MEM0_ECC2B_INTR" }, + { .irq_msk = BIT(4), .msg = "HGC_CQE_ECC2B_INTR" }, + { .irq_msk = BIT(5), .msg = "LM_CFG_IOSTL_ECC2B_INTR" }, + { .irq_msk = BIT(6), .msg = "LM_CFG_ITCTL_ECC2B_INTR" }, + { .irq_msk = BIT(7), .msg = "HGC_ITCT_ECC2B_INTR" }, + { .irq_msk = BIT(8), .msg = "HGC_IOST_ECC2B_INTR" }, + { .irq_msk = BIT(9), .msg = "HGC_DQE_ECC2B_INTR" }, + { .irq_msk = BIT(10), .msg = "DMAC0_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(11), .msg = "DMAC1_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(12), .msg = "DMAC2_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(13), .msg = "DMAC3_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(14), .msg = "DMAC4_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(15), .msg = "DMAC5_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(16), .msg = "DMAC6_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(17), .msg = "DMAC7_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(18), .msg = "OOO_RAM_ECC2B_INTR" }, + { .irq_msk = BIT(20), .msg = "HGC_DQE_POISON_INTR" }, + { .irq_msk = BIT(21), .msg = "HGC_IOST_POISON_INTR" }, + { .irq_msk = BIT(22), .msg = "HGC_ITCT_POISON_INTR" }, + { .irq_msk = BIT(23), .msg = "HGC_ITCT_NCQ_POISON_INTR" }, + { .irq_msk = BIT(24), .msg = "DMAC0_RX_POISON" }, + { .irq_msk = BIT(25), .msg = "DMAC1_RX_POISON" }, + { .irq_msk = BIT(26), .msg = "DMAC2_RX_POISON" }, + { .irq_msk = BIT(27), .msg = "DMAC3_RX_POISON" }, + { .irq_msk = BIT(28), .msg = "DMAC4_RX_POISON" }, + { .irq_msk = BIT(29), .msg = "DMAC5_RX_POISON" }, + { .irq_msk = BIT(30), .msg = "DMAC6_RX_POISON" }, + { .irq_msk = BIT(31), .msg = "DMAC7_RX_POISON" }, +}; + +static bool process_non_fatal_error_v3_hw(struct hisi_hba *hisi_hba) +{ + struct device *dev = hisi_hba->dev; + const struct hisi_sas_hw_error *ras_error; + bool need_reset = false; + u32 irq_value; + int i; + + irq_value = hisi_sas_read32(hisi_hba, SAS_RAS_INTR0); + for (i = 0; i < ARRAY_SIZE(sas_ras_intr0_nfe); i++) { + ras_error = &sas_ras_intr0_nfe[i]; + if (ras_error->irq_msk & irq_value) { + dev_warn(dev, "SAS_RAS_INTR0: %s(irq_value=0x%x) found.\n", + ras_error->msg, irq_value); + need_reset = true; + } + } + hisi_sas_write32(hisi_hba, SAS_RAS_INTR0, irq_value); + + irq_value = hisi_sas_read32(hisi_hba, SAS_RAS_INTR1); + for (i = 0; i < ARRAY_SIZE(sas_ras_intr1_nfe); i++) { + ras_error = &sas_ras_intr1_nfe[i]; + if (ras_error->irq_msk & irq_value) { + dev_warn(dev, "SAS_RAS_INTR1: %s(irq_value=0x%x) found.\n", + ras_error->msg, irq_value); + need_reset = true; + } + } + hisi_sas_write32(hisi_hba, SAS_RAS_INTR1, irq_value); + + return need_reset; +} + +static pci_ers_result_t hisi_sas_error_detected_v3_hw(struct pci_dev *pdev, + pci_channel_state_t state) +{ + struct sas_ha_struct *sha = pci_get_drvdata(pdev); + struct hisi_hba *hisi_hba = sha->lldd_ha; + struct device *dev = hisi_hba->dev; + + dev_info(dev, "PCI error: detected callback, state(%d)!!\n", state); + if (state == pci_channel_io_perm_failure) + return PCI_ERS_RESULT_DISCONNECT; + + if (process_non_fatal_error_v3_hw(hisi_hba)) + return PCI_ERS_RESULT_NEED_RESET; + + return PCI_ERS_RESULT_CAN_RECOVER; +} + +static pci_ers_result_t hisi_sas_mmio_enabled_v3_hw(struct pci_dev *pdev) +{ + return PCI_ERS_RESULT_RECOVERED; +} + +static pci_ers_result_t hisi_sas_slot_reset_v3_hw(struct pci_dev *pdev) +{ + struct sas_ha_struct *sha = pci_get_drvdata(pdev); + struct hisi_hba *hisi_hba = sha->lldd_ha; + struct device *dev = hisi_hba->dev; + HISI_SAS_DECLARE_RST_WORK_ON_STACK(r); + + dev_info(dev, "PCI error: slot reset callback!!\n"); + queue_work(hisi_hba->wq, &r.work); + wait_for_completion(r.completion); + if (r.done) + return PCI_ERS_RESULT_RECOVERED; + + return PCI_ERS_RESULT_DISCONNECT; +} + enum { /* instances of the controller */ hip08, @@ -2139,11 +2271,18 @@ enum { {} }; +static const struct pci_error_handlers hisi_sas_err_handler = { + .error_detected = hisi_sas_error_detected_v3_hw, + .mmio_enabled = hisi_sas_mmio_enabled_v3_hw, + .slot_reset = hisi_sas_slot_reset_v3_hw, +}; + static struct pci_driver sas_v3_pci_driver = { .name = DRV_NAME, .id_table = sas_v3_pci_table, .probe = hisi_sas_v3_probe, .remove = hisi_sas_v3_remove, + .err_handler = &hisi_sas_err_handler, }; module_pci_driver(sas_v3_pci_driver); From patchwork Fri Dec 8 17:16:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121198 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp863246qgn; Fri, 8 Dec 2017 08:31:18 -0800 (PST) X-Google-Smtp-Source: AGs4zMabHZwWLnB/d5pEs9E4PQ+7wgrQBJTKgULnYUt+lLVBlTy0vSLapUL4MQpESFHqHyjCJh5T X-Received: by 10.99.171.13 with SMTP id p13mr26146388pgf.30.1512750678908; Fri, 08 Dec 2017 08:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750678; cv=none; d=google.com; s=arc-20160816; b=b41cL6Q6/kigY7fRTs0GrkikL1/A904uZyBqpZJ++zPq+gXstiJc7GsU3sTbya9MEd WBEfx1PvA4hJDrqwowlRIbrvUBER3xPKWDRuawUMHbbxUPdM2yyQcX2GnxSJSNDOkn/c 1wCQ8inNVzTTwunFYGlYdGi4HimkeQR0MnPXsLRimE9xMGKfGIQN1nYpqDTM8Gcuu2Zq A/qJ8GpkE3BBdTWPdPrr+hejRAhYDtgGujWYxfRDCQs1iu7vIlgMya7A2oi2F3+X9vPs 3REA9eF+ryQhKAIDUN3rSS6c1Aq8ykjIguSYUQL51M7L2ArIVQXtkKU0YF9rWUji+mE5 qWKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=/xwQ3sdK2/+tg5l8DVNQtDSO/TD6aeXyPb6VidFadHo=; b=Br+OyQUMY05qijJeAJqnm7lJWWn3og/8wSgppn1WGcQWE6ym4jw55lFK4NJ8uwX9DD KVr0qaFduuyuobiAWJRHOMUM3kHSoExBIRpkYtiFCoyKbxxyBnn9qEEqxUy7mFuBQg+S rwxhNZivCm6o/eK/oLbKZNSuXdRE/6p/CYkhRpyEPz/Qf4oiTgytRcwOKJh9layo0bdd XWFcdaBsWz2Ktq56no2V+DSi2olaYs6+AaCXuLsqAh6l3MoY8sAE5t+J7e5dx35rDuMJ oqN9b48Ftq4N+8zxes/k3VYmbCp6VxUkpAWRDFXHZYAmH9fNoKcYWuAKpn55+kuQB4K1 K3+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 o6si2289947pls.300.2017.12.08.08.31.18; Fri, 08 Dec 2017 08:31:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754627AbdLHQbR (ORCPT + 1 other); Fri, 8 Dec 2017 11:31:17 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2230 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754362AbdLHQbH (ORCPT ); Fri, 8 Dec 2017 11:31:07 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id DD99971A7D200; Sat, 9 Dec 2017 00:30:44 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 00:30:39 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 11/19] scsi: hisi_sas: improve int_chnl_int_v2_hw() consistency with v3 hw Date: Sat, 9 Dec 2017 01:16:42 +0800 Message-ID: <1512753410-50924-12-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiaofei Tan Change code format of int_chnl_int_v2_hw() to be consistent with v3 hw to reduce an tag indent. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 58 ++++++++++++++++------------------ 1 file changed, 28 insertions(+), 30 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 8d6886a..4c4a000 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2848,40 +2848,38 @@ static irqreturn_t int_chnl_int_v2_hw(int irq_no, void *p) HGC_INVLD_DQE_INFO_FB_CH3_OFF) & 0x1ff; while (irq_msk) { - if (irq_msk & (1 << phy_no)) { - u32 irq_value0 = hisi_sas_phy_read32(hisi_hba, phy_no, - CHL_INT0); - u32 irq_value1 = hisi_sas_phy_read32(hisi_hba, phy_no, - CHL_INT1); - u32 irq_value2 = hisi_sas_phy_read32(hisi_hba, phy_no, - CHL_INT2); - - if (irq_value1) { - if (irq_value1 & (CHL_INT1_DMAC_RX_ECC_ERR_MSK | - CHL_INT1_DMAC_TX_ECC_ERR_MSK)) - panic("%s: DMAC RX/TX ecc bad error!\ - (0x%x)", - dev_name(dev), irq_value1); - - hisi_sas_phy_write32(hisi_hba, phy_no, - CHL_INT1, irq_value1); - } + u32 irq_value0 = hisi_sas_phy_read32(hisi_hba, phy_no, + CHL_INT0); + u32 irq_value1 = hisi_sas_phy_read32(hisi_hba, phy_no, + CHL_INT1); + u32 irq_value2 = hisi_sas_phy_read32(hisi_hba, phy_no, + CHL_INT2); + + if ((irq_msk & (1 << phy_no)) && irq_value1) { + if (irq_value1 & (CHL_INT1_DMAC_RX_ECC_ERR_MSK | + CHL_INT1_DMAC_TX_ECC_ERR_MSK)) + panic("%s: DMAC RX/TX ecc bad error!\ + (0x%x)", + dev_name(dev), irq_value1); - if (irq_value2) - hisi_sas_phy_write32(hisi_hba, phy_no, - CHL_INT2, irq_value2); + hisi_sas_phy_write32(hisi_hba, phy_no, + CHL_INT1, irq_value1); + } + if ((irq_msk & (1 << phy_no)) && irq_value2) + hisi_sas_phy_write32(hisi_hba, phy_no, + CHL_INT2, irq_value2); - if (irq_value0) { - if (irq_value0 & CHL_INT0_SL_RX_BCST_ACK_MSK) - phy_bcast_v2_hw(phy_no, hisi_hba); - hisi_sas_phy_write32(hisi_hba, phy_no, - CHL_INT0, irq_value0 - & (~CHL_INT0_HOTPLUG_TOUT_MSK) - & (~CHL_INT0_SL_PHY_ENABLE_MSK) - & (~CHL_INT0_NOT_RDY_MSK)); - } + if ((irq_msk & (1 << phy_no)) && irq_value0) { + if (irq_value0 & CHL_INT0_SL_RX_BCST_ACK_MSK) + phy_bcast_v2_hw(phy_no, hisi_hba); + + hisi_sas_phy_write32(hisi_hba, phy_no, + CHL_INT0, irq_value0 + & (~CHL_INT0_HOTPLUG_TOUT_MSK) + & (~CHL_INT0_SL_PHY_ENABLE_MSK) + & (~CHL_INT0_NOT_RDY_MSK)); } irq_msk &= ~(1 << phy_no); phy_no++; From patchwork Fri Dec 8 17:16:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121196 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp863103qgn; Fri, 8 Dec 2017 08:31:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMY+ArDJiVmqbXmqeL7F7BlN75pXpo/ZatzqauxAWssxf8Z2TfIHQRA7+HH3eCN34asB0y+f X-Received: by 10.99.3.146 with SMTP id 140mr30488155pgd.275.1512750671347; Fri, 08 Dec 2017 08:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750671; cv=none; d=google.com; s=arc-20160816; b=vrGQzlgVk0m7LlMJoyAdiUwhvg982pRPiDPDofYqut+r6SnAR73cN3wP4TAI/GqKGc aCMZdiowyTIdrilkL6l2WoiSCMr9y0DsKdZB6cGtkAK2BafWwthuy2g/kJYvqsr91uSs KNEmAJjbIsB1nDpUWEy3LH7cnYY9GPsF+zKrH1Ef0H9zFCuQUy/K4I72XSSkrgabl3P9 V3Da8hglTUlKbYok4tTCJXnb+feIxuVvCs6/8wZMt0KFotB8WPFtJtdzJ/4DJAE4wcMx lTVQdNNJiGrY5z0ZY8y7zvPdqtGnM7nE/9pxNP1FXX8pq7RZO65pfS9k7RdMkzrvpnGQ 1dbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=45YynZnIdKpj3B9tLAqK8kcCC/ckY+dDjh6hBlhA5mM=; b=xJ+FgQqTFNUcDoos/cYtqkKeq2KT5Vodg5K+7Ki+/4QIP7/dujigt55A0nHP+aEksy dTmTf/skJFp+PQW9EDw74SPuZgv/P4uWWyygNh5Vqb2FHRgZvdg1rin6uV69FRLHDJeP Mj8j5cri/Dox9qNiiK7vUaAop/iXskk6G5I+YZ1Cc4xGn4oH1C5oJHQKAj7tZ/uI1K40 AfNVy4xnNwUkuIQQkMEoRsyInw/yctb2001qpO182DzCXR5Gamag4SI3OiPPPh5fkV08 O8oW71r4lLiPGB2iB4gjSYyN7rR7UvyYKq7eCyEi+DwGYtayRbIR/C/Jrwbbhl0dw/DF wXZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 o6si2289947pls.300.2017.12.08.08.31.11; Fri, 08 Dec 2017 08:31:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754594AbdLHQbI (ORCPT + 1 other); Fri, 8 Dec 2017 11:31:08 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:36074 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754199AbdLHQbD (ORCPT ); Fri, 8 Dec 2017 11:31:03 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 878BA8326B2B6; Sat, 9 Dec 2017 00:30:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 00:30:41 +0800 From: John Garry To: , CC: , , , Xiang Chen , Xiaofei Tan , John Garry Subject: [PATCH 17/19] scsi: hisi_sas: fix SAS_QUEUE_FULL problem while running IO Date: Sat, 9 Dec 2017 01:16:48 +0800 Message-ID: <1512753410-50924-18-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen This patch fix SAS_QUEUE_FULL problem. The test situation is close port while running IO. In sas_eh_handle_sas_errors(), SCSI EH will free sas_task of the device if lldd_I_T_nexus_reset() return TMF_RESP_FUNC_COMPLETE or -ENODEV. But in our SAS driver, we only free slots of the device when the return value is TMF_RESP_FUNC_COMPLETE. So if the return value is -ENODEV, the slot resource will not free any more. As an solution, we should also free slots of the device in lldd_I_T_nexus_reset() if the return value is -ENODEV. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 302da84..9bd98e5 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1308,7 +1308,7 @@ static int hisi_sas_I_T_nexus_reset(struct domain_device *device) rc = hisi_sas_debug_I_T_nexus_reset(device); - if (rc == TMF_RESP_FUNC_COMPLETE) { + if ((rc == TMF_RESP_FUNC_COMPLETE) || (rc == -ENODEV)) { spin_lock_irqsave(&hisi_hba->lock, flags); hisi_sas_release_task(hisi_hba, device); spin_unlock_irqrestore(&hisi_hba->lock, flags); From patchwork Fri Dec 8 17:16:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121197 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp863126qgn; Fri, 8 Dec 2017 08:31:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMa8BDVgFX4B7MNimQTP0PiOZ3bEdH1nUCWq1L/W6XPf1IXlXLJjLvtYRxl5a+hrQ4GfpaAa X-Received: by 10.159.234.75 with SMTP id c11mr32195752plr.422.1512750672247; Fri, 08 Dec 2017 08:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750672; cv=none; d=google.com; s=arc-20160816; b=D1USlRoxwL1pSYzUAGkQXSp3bI7NZZwicbFuQzP0ooprUH+2NzgUe821UYS+18Ucfn xej1bxd/YSOzAhGBxyMWyaKRifL47Xqrk6JfeE8wXu7guV7QUPhMvXHnCo2KZMEBvQ44 ms4kUMDHMNOyan0NCk1LmI95jntX0HFYl+5I/tDVr5i7SO1tGkq4kuq4DUHTokjMWJ8/ EkSpUdHuY/cjUp9o2cQiTT26IPEcV814zwSVSbT6xMyoYElOUjrjS1GrdJdquhXRg+Pk kq7s+1y3viDysdImqeIT26wrYbleXKysEVHdpk3rC6tjH2QG/2/GveGLLer4fcozAci2 Jo8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=adeLi8k6iw3sUq3AlpdSQizt3XBFUmcRB4nVtLczlmA=; b=bgRlL6cDaIzysxPDTQ0f7KDrePjEWikEGKe+oNBDzIwB8Wkw/l75PbDy6xRaXmWv7k oQuGedrQE8YYcHi9XGF5uuMoxwGiXpGv4lbjiqrI+DdP3ps1JEbHaVXTrUYYGplR7Yvn p87wRm/mWDknqOPUsx9rP2vf/TUqxXOH7CqwVqkJvZiuoeTmy6N3LcUSCmkxwyYmLKJm HVfjnpfn/GAh3rs3qv7sz/DbfENYJzkqTKp9nfYlO2vg5CfwS7PNCt6WN8w3AjmNBsZm D/DQS3PGpeXvTYVAzKWUqr0UUvO94gK9VySv/K/gzpkjJ8WtfFX0CsMYER66OU2hL2UR O/qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 o6si2289947pls.300.2017.12.08.08.31.12; Fri, 08 Dec 2017 08:31:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753210AbdLHQbL (ORCPT + 1 other); Fri, 8 Dec 2017 11:31:11 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:36068 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754093AbdLHQbD (ORCPT ); Fri, 8 Dec 2017 11:31:03 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4D6CBB047D2F0; Sat, 9 Dec 2017 00:30:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 00:30:42 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 18/19] scsi: hisi_sas: re-add the lldd_port_deformed() Date: Sat, 9 Dec 2017 01:16:49 +0800 Message-ID: <1512753410-50924-19-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen In function sas_suspend_devices(), it requires callback lldd_port_deformed callback to be implemented if lldd_port_deformed is implemented. So add a stub for lldd_port_deformed. Callback lldd_port_deformed was not required as the port deformation is done elsewhere in the LLDD. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 5 +++++ 1 file changed, 5 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 9bd98e5..ad12237 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1613,6 +1613,10 @@ static void hisi_sas_port_formed(struct asd_sas_phy *sas_phy) hisi_sas_port_notify_formed(sas_phy); } +static void hisi_sas_port_deformed(struct asd_sas_phy *sas_phy) +{ +} + static void hisi_sas_phy_disconnected(struct hisi_sas_phy *phy) { phy->phy_attached = 0; @@ -1703,6 +1707,7 @@ void hisi_sas_kill_tasklets(struct hisi_hba *hisi_hba) .lldd_query_task = hisi_sas_query_task, .lldd_clear_nexus_ha = hisi_sas_clear_nexus_ha, .lldd_port_formed = hisi_sas_port_formed, + .lldd_port_deformed = hisi_sas_port_deformed, }; void hisi_sas_init_mem(struct hisi_hba *hisi_hba)