From patchwork Fri Mar 23 16:05:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132347 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp776829ljb; Fri, 23 Mar 2018 09:06:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELv0tUSe3qS0LyX0SD6Yx3Zxst8IRUTzZ6kPRTvbAVANyotx7l8KePGOQPALnV8UXSEXD3sD X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr7907480plg.28.1521821173870; Fri, 23 Mar 2018 09:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821173; cv=none; d=google.com; s=arc-20160816; b=RYSxiRjuwUYz/4tMIl/4RYkr+86RYyARQbhlV5x5hcWfTHmcELEtWrcD4n9G699Igy mGpZy1lHcnmHBAcwaT3uhjVNtiFmmzEgMJlNJz0hq/onlacgFKwuda+RUZyfDAgTQGVc +vFktJVWKnviu5F+LyQNOoljUuGvSZ1tPry3b1egYq0MH6qXZEm9fKGjgjIsZSvr64pl ro/FWorqXTIXm59J/FIgDjBsbDUtE80PvmceyFIZsrup5QvHeDvnLJxb7HkZT9YIjWXL V+6v9fGn8Y/swpTdsaMThEtFh7AMG6Q0sKvZK+8cRwkPQ4BBo8IcOfkC9ZPCkEetKl7I ZyhA== 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=IjVyu5lDdg3iKCmJx6nw2OdTE+4Vq65snDdnOEY4/jw=; b=o7bR0N/d0HyRQptx+vAquyT6rWd0gUBM5aNVL3An9VyW3Rx2ee845Be1k1fD1O2AG1 FrE3WrqGL2FRdJgMmA8aD6dSRjJVC8c77ItIBHpQDxu5O6QVkPjxwjqJELiHrodnX9Ue Dadmzl8slczErpJCP2VHrxjPFpdtQfkX8h2jNsTk7cbyx2h1YH8yO3Ys8qmIR6dOgACu JfhBhYklsBP6At2lvjEhqsEgcgX7C6CDnrQI4Kg1FrKWrgdqIAhgfMNrAMlsqqVl5OEu XjhSpDSGhntIFzyac9szZ02FNV5K+QawDZdywo0I2b0MmtMMlugHBo6d3hBSpYmxSFUP G7fA== ARC-Authentication-Results: i=1; mx.google.com; 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 h12-v6si6477466pls.68.2018.03.23.09.06.13; Fri, 23 Mar 2018 09:06:13 -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; 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 S1752219AbeCWQGJ (ORCPT + 28 others); Fri, 23 Mar 2018 12:06:09 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6684 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751923AbeCWQGF (ORCPT ); Fri, 23 Mar 2018 12:06:05 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 9EFD346E9E727; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:44 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 1/8] scsi: hisi_sas: make SAS address of SATA disks unique Date: Sat, 24 Mar 2018 00:05:08 +0800 Message-ID: <1521821115-120040-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen When directly connected with SATA disks in different SAS cores, fill SAS address with scsi_host's id to make it's fake SAS address unique. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 + 1 file changed, 1 insertion(+) -- 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 f89fb9a..89b9505 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3295,6 +3295,7 @@ static irqreturn_t sata_int_v2_hw(int irq_no, void *p) sas_phy->oob_mode = SATA_OOB_MODE; /* Make up some unique SAS address */ attached_sas_addr[0] = 0x50; + attached_sas_addr[6] = hisi_hba->shost->host_no; attached_sas_addr[7] = phy_no; memcpy(sas_phy->attached_sas_addr, attached_sas_addr, SAS_ADDR_SIZE); memcpy(sas_phy->frame_rcvd, fis, sizeof(struct dev_to_host_fis)); From patchwork Fri Mar 23 16:05:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132351 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp778046ljb; Fri, 23 Mar 2018 09:07:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELs6tECLWpZn7qKTZPOLikTKOx91q9rsDhl0DtG6vJ9QdCg2yfYWTlyLoRS1wqi0DbxuHInG X-Received: by 10.98.97.1 with SMTP id v1mr24824631pfb.119.1521821234877; Fri, 23 Mar 2018 09:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821234; cv=none; d=google.com; s=arc-20160816; b=B4vTLUqceHFoWtzyzZ/2iEulSXoVfTMA2kxvSHZSMEzC+4lrVGh1RJRymvOm8i08c6 6YCV9udb3Lt+A5gAShfqXKQHyybVB1+hljqOF42EY1SFVCpJp0XJdeDKgBO+kC3XvP3N 0AkILiky0lPqjkjN9P+q2Vsvcohc7d95mLB+e/xRCfEue1ExMoAkcmt9lddL/QW28tSt yBTgKL0NOso2BC/yGOq7XtQlzNNeDacA2GcmLecJ1GkZrnb0EhNi9TmSpaeeSnRTjTf+ A6Lk7lQMkgCpDrTK5FMZTYIPEJGzNPB6GozRNy99681kU9POyZVFLOITZNaQr/ytpDPJ px1g== 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=qf0rAdXhdI5kvaceM7y67LsVNSSUVS5SQ6DYrxRxT0A=; b=mx9nA3b8uXSeJ6seWe0kc8hIK8cMUfNo5xJmxriY18TrWEysNdGm0/w72lHcFpuPQ6 g4wJOeLcdZumYcgaDsCr+yQfYgTIxZJeMZ59U1vdPQ5wz5xubcg7/0ogptN5yS75c9dl j23WAXyP0kp5ScrxW9QlqAzktZM//apJSw04tEFy+6PvFGOQJxVSu0I3GFp1yj148PFI Rp4K3aX8+26CDxM5wA8/WUM0DGnSV1SFKEKXb5D1lo7V0/BatEMYWVGzV8q2TwkUFrPm 2jlCbXP1dTwBiUQDCdWEmfuPOTjXea71+R+lfox0rBpt6PV63UtNw0S45Pl4emVbbNLj yzGg== ARC-Authentication-Results: i=1; mx.google.com; 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 g66si3338643pfc.383.2018.03.23.09.07.14; Fri, 23 Mar 2018 09:07:14 -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; 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 S1752449AbeCWQHL (ORCPT + 28 others); Fri, 23 Mar 2018 12:07:11 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6689 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752221AbeCWQGL (ORCPT ); Fri, 23 Mar 2018 12:06:11 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E33C56C81E7A2; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:44 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 2/8] scsi: hisi_sas: update RAS feature for later revision of v3 HW Date: Sat, 24 Mar 2018 00:05:09 +0800 Message-ID: <1521821115-120040-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan There is an modification for later revision of v3 hw. More HW errors are reported through RAS interrupt. These errors were originally reported only through MSI. When report to RAS, some combinations are done to port AXI errors and FIFO OMIT errors. For example, each port has 4 AXI errors, and they are combined to one when report to RAS. This patch does two things. 1. Enable RAS interrupt of these errors and handle them in PCI error handlers. 2. Disable MSI interrupts of these errors for this later revision hw. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 60 ++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) -- 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 6f3e5ba..df5414a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -216,6 +216,9 @@ #define SAS_RAS_INTR1 (RAS_BASE + 0x04) #define SAS_RAS_INTR0_MASK (RAS_BASE + 0x08) #define SAS_RAS_INTR1_MASK (RAS_BASE + 0x0c) +#define CFG_SAS_RAS_INTR_MASK (RAS_BASE + 0x1c) +#define SAS_RAS_INTR2 (RAS_BASE + 0x20) +#define SAS_RAS_INTR2_MASK (RAS_BASE + 0x24) /* HW dma structures */ /* Delivery queue header */ @@ -392,6 +395,7 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba, static void init_reg_v3_hw(struct hisi_hba *hisi_hba) { + struct pci_dev *pdev = hisi_hba->pci_dev; int i; /* Global registers init */ @@ -409,7 +413,10 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, ENT_INT_SRC3, 0xffffffff); hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0xfefefefe); hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0xfefefefe); - hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xfffe20ff); + if (pdev->revision >= 0x21) + hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xffff7fff); + else + hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xfffe20ff); hisi_sas_write32(hisi_hba, CHNL_PHYUPDOWN_INT_MSK, 0x0); hisi_sas_write32(hisi_hba, CHNL_ENT_INT_MSK, 0x0); hisi_sas_write32(hisi_hba, HGC_COM_INT_MSK, 0x0); @@ -428,7 +435,12 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, i, CHL_INT1, 0xffffffff); hisi_sas_phy_write32(hisi_hba, i, CHL_INT2, 0xffffffff); hisi_sas_phy_write32(hisi_hba, i, RXOP_CHECK_CFG_H, 0x1000); - hisi_sas_phy_write32(hisi_hba, i, CHL_INT1_MSK, 0xff87ffff); + if (pdev->revision >= 0x21) + hisi_sas_phy_write32(hisi_hba, i, CHL_INT1_MSK, + 0xffffffff); + else + hisi_sas_phy_write32(hisi_hba, i, CHL_INT1_MSK, + 0xff87ffff); hisi_sas_phy_write32(hisi_hba, i, CHL_INT2_MSK, 0xffffbfe); hisi_sas_phy_write32(hisi_hba, i, PHY_CTRL_RDY_MSK, 0x0); hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_NOT_RDY_MSK, 0x0); @@ -503,6 +515,8 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) /* RAS registers init */ hisi_sas_write32(hisi_hba, SAS_RAS_INTR0_MASK, 0x0); hisi_sas_write32(hisi_hba, SAS_RAS_INTR1_MASK, 0x0); + hisi_sas_write32(hisi_hba, SAS_RAS_INTR2_MASK, 0x0); + hisi_sas_write32(hisi_hba, CFG_SAS_RAS_INTR_MASK, 0x0); } static void config_phy_opt_mode_v3_hw(struct hisi_hba *hisi_hba, int phy_no) @@ -1319,6 +1333,13 @@ static irqreturn_t int_chnl_int_v3_hw(int irq_no, void *p) CHL_INT1); u32 irq_value2 = hisi_sas_phy_read32(hisi_hba, phy_no, CHL_INT2); + u32 irq_msk1 = hisi_sas_phy_read32(hisi_hba, phy_no, + CHL_INT1_MSK); + u32 irq_msk2 = hisi_sas_phy_read32(hisi_hba, phy_no, + CHL_INT2_MSK); + + irq_value1 &= ~irq_msk1; + irq_value2 &= ~irq_msk2; if ((irq_msk & (4 << (phy_no * 4))) && irq_value1) { @@ -1448,6 +1469,7 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p) hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, irq_msk | 0x1df00); irq_value = hisi_sas_read32(hisi_hba, ENT_INT_SRC3); + irq_value &= ~irq_msk; for (i = 0; i < ARRAY_SIZE(fatal_axi_error); i++) { const struct hisi_sas_hw_error *error = &fatal_axi_error[i]; @@ -2222,6 +2244,29 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) { .irq_msk = BIT(31), .msg = "DMAC7_RX_POISON" }, }; +static const struct hisi_sas_hw_error sas_ras_intr2_nfe[] = { + { .irq_msk = BIT(0), .msg = "DMAC0_AXI_BUS_ERR" }, + { .irq_msk = BIT(1), .msg = "DMAC1_AXI_BUS_ERR" }, + { .irq_msk = BIT(2), .msg = "DMAC2_AXI_BUS_ERR" }, + { .irq_msk = BIT(3), .msg = "DMAC3_AXI_BUS_ERR" }, + { .irq_msk = BIT(4), .msg = "DMAC4_AXI_BUS_ERR" }, + { .irq_msk = BIT(5), .msg = "DMAC5_AXI_BUS_ERR" }, + { .irq_msk = BIT(6), .msg = "DMAC6_AXI_BUS_ERR" }, + { .irq_msk = BIT(7), .msg = "DMAC7_AXI_BUS_ERR" }, + { .irq_msk = BIT(8), .msg = "DMAC0_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(9), .msg = "DMAC1_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(10), .msg = "DMAC2_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(11), .msg = "DMAC3_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(12), .msg = "DMAC4_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(13), .msg = "DMAC5_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(14), .msg = "DMAC6_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(15), .msg = "DMAC7_FIFO_OMIT_ERR" }, + { .irq_msk = BIT(16), .msg = "HGC_RLSE_SLOT_UNMATCH" }, + { .irq_msk = BIT(17), .msg = "HGC_LM_ADD_FCH_LIST_ERR" }, + { .irq_msk = BIT(18), .msg = "HGC_AXI_BUS_ERR" }, + { .irq_msk = BIT(19), .msg = "HGC_FIFO_OMIT_ERR" }, +}; + static bool process_non_fatal_error_v3_hw(struct hisi_hba *hisi_hba) { struct device *dev = hisi_hba->dev; @@ -2252,6 +2297,17 @@ static bool process_non_fatal_error_v3_hw(struct hisi_hba *hisi_hba) } hisi_sas_write32(hisi_hba, SAS_RAS_INTR1, irq_value); + irq_value = hisi_sas_read32(hisi_hba, SAS_RAS_INTR2); + for (i = 0; i < ARRAY_SIZE(sas_ras_intr2_nfe); i++) { + ras_error = &sas_ras_intr2_nfe[i]; + if (ras_error->irq_msk & irq_value) { + dev_warn(dev, "SAS_RAS_INTR2: %s(irq_value=0x%x) found.\n", + ras_error->msg, irq_value); + need_reset = true; + } + } + hisi_sas_write32(hisi_hba, SAS_RAS_INTR2, irq_value); + return need_reset; } From patchwork Fri Mar 23 16:05:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132352 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp778427ljb; Fri, 23 Mar 2018 09:07:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELt/kmPOCe6sWxX6L9etOlgS153kN8BmL33B2T4vewuIAN00ebafMKQOSgx3LsPsHzNl57yi X-Received: by 10.98.57.143 with SMTP id u15mr24513825pfj.79.1521821254201; Fri, 23 Mar 2018 09:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821254; cv=none; d=google.com; s=arc-20160816; b=F2HFgykRv+CQOyGpLK0H6nOidpsNzHTzBNiBCYdpngSFdLSjEG7PJLEwMdByp1gvZY KR9/jPZfHC4BBHE2Jcc2wTFHv9Nj8NL9CNksBMlWO1CU4eq97R/brFNkV4SYyd+TFJVe sz8eXkkK69XBGnn2fBVcZAxYr9oIycLihkhSTQXWH4t0NzA95P44lzfmV3Xc7EjgOuIv N4uAuxXUimQNAUv2u0h03ZpAUWJfJIbxj3PqCKe7qNpqmes7FrXEOZ7ngFPWyDQFiXIb 3/nN8LCllyI7+3BaPp0BszyoGYho5wpRuvL3rhmwionNi9xNdQ/WtTKE8Cgvpnw5VYhH r0bA== 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=qxziBHC9vfOOtOQZYh8XMBDpvpTRaj/yQZpaWAv8mOM=; b=vCJ+KR+8DbZUAW3npxDbJT3+1UzQxackYtnSmNZi8vP/a3khtIOmIpvxxVHQNW6V+t q3W5i5Zcsokfj5jR5quLPJvZm4mAnyFJyOxTW6+Y28mUHpABCP7I+R1VmDD5qODnbfIQ oZKHw+Fa2wmYbyXjKMECTBerj8vnFkAIV+iAnfM/zb8dzrqrmfxKdIHo+bHIKDhzghGX DYuqdfPrZwvhg3Rrj1FxC/pnpnRiOGXDhlQeRx9ucMlwEfur3WAyIs2aAZKO1MLIxTlh TKdySfgRYr8FfQilYN4ZJaQDHwxm9uK3tlO8MLRXdLNayfEstnJW93aVPfM64HcuZ7td DOPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 v23-v6si8407309plo.276.2018.03.23.09.07.33; Fri, 23 Mar 2018 09:07:34 -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; 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 S1752465AbeCWQHb (ORCPT + 28 others); Fri, 23 Mar 2018 12:07:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6688 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752019AbeCWQGI (ORCPT ); Fri, 23 Mar 2018 12:06:08 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D58511D8D22F5; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:45 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 3/8] scsi: hisi_sas: delete timer when removing hisi_sas driver Date: Sat, 24 Mar 2018 00:05:10 +0800 Message-ID: <1521821115-120040-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Delete timer for v1 and v3 hw when removing hisi_sas driver. Signed-off-by: Xiang chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 +++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 49c1fa6..a216795 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2177,6 +2177,9 @@ int hisi_sas_remove(struct platform_device *pdev) struct hisi_hba *hisi_hba = sha->lldd_ha; struct Scsi_Host *shost = sha->core.shost; + if (timer_pending(&hisi_hba->timer)) + del_timer(&hisi_hba->timer); + sas_unregister_ha(sha); sas_remove_host(sha->core.shost); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 89b9505..bed6afb 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3599,9 +3599,6 @@ static int hisi_sas_v2_remove(struct platform_device *pdev) struct sas_ha_struct *sha = platform_get_drvdata(pdev); struct hisi_hba *hisi_hba = sha->lldd_ha; - if (timer_pending(&hisi_hba->timer)) - del_timer(&hisi_hba->timer); - hisi_sas_kill_tasklets(hisi_hba); return hisi_sas_remove(pdev); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index df5414a..efe64bc 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2183,6 +2183,9 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) struct hisi_hba *hisi_hba = sha->lldd_ha; struct Scsi_Host *shost = sha->core.shost; + if (timer_pending(&hisi_hba->timer)) + del_timer(&hisi_hba->timer); + sas_unregister_ha(sha); sas_remove_host(sha->core.shost); From patchwork Fri Mar 23 16:05:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132354 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp778953ljb; Fri, 23 Mar 2018 09:08:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELtKo3VOiu5iqc1b/YUjynx6GbmySPpauss17zhe0AaDivJZ+GeNC06OVeoMowgCiOF6QNgy X-Received: by 10.99.119.133 with SMTP id s127mr21301817pgc.441.1521821283923; Fri, 23 Mar 2018 09:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821283; cv=none; d=google.com; s=arc-20160816; b=m9LYUSl644Kll+1UCECETvlBsS3uuwjq/cqjPkFUy6pE0Iw0kgMRyqqs9YmdlQDDPQ PA00Ipxgtng3l5xtEjPUqWZvREDC1xdetsVOg8mIQH1s3ekw6GYL6eE29fd0rWJASbNe mOU4/Lx78ycqJCAVsydjpsUGkJxFLJxR60TpozJ+ckgkjQafBe/ydWwfl/25aiNQ+Ni+ S/tKa68U0+qS9ya/QwSZG1LtCEmABAU8COZT+lNhhq2ji4NRdk0+jB7g8Y83l+qBV6qp yzsekOXLk517p4kKkCOiTEmAso/vex2zpHaIzzMG6GdvJMS1lXVD9A1cO/9J8ycXFEbK mziQ== 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=CYrTBxjq6Rl+/rjiR+riPdLwctDiRKs0iBQQcQhgKlI=; b=SQW+WerOcFhak0JJvZgq7dek/o/0vWpQ+E0pVSeO3VSFBNTkavwtvQ/WAvRmw4Qcl2 uqnRZxBwo1fqSu9knrFMBIIhe4vF+FCITFh4SF/GPgOkoaSO2/ANNcUdu3kGheAo6MP0 tg6Q+12mpTpa8+9AkLPyfBB5eSUW/PouOWMtbF+sWrCuXUBoFJO2h9N16H5LV0+cQ5z/ 6aDQFOH6MRB6oe0/d1nZoYy3LWqLhzjkJ6oYemqgc/AmQfMzOidgDO3zN5HeV1e+5hPs S2FyzCNglLrPJMWNsZadLQ8b7Pttv4RDZtj/Q8tTxVboVGvj37bTtD9DikhiDjPw/SGo EEXg== ARC-Authentication-Results: i=1; mx.google.com; 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 b6-v6si1987823plx.263.2018.03.23.09.08.03; Fri, 23 Mar 2018 09:08:03 -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; 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 S1752487AbeCWQHt (ORCPT + 28 others); Fri, 23 Mar 2018 12:07:49 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6686 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751889AbeCWQGH (ORCPT ); Fri, 23 Mar 2018 12:06:07 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B9F2E42499A36; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:45 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 4/8] scsi: hisi_sas: use dma_zalloc_coherent() Date: Sat, 24 Mar 2018 00:05:11 +0800 Message-ID: <1521821115-120040-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen This is a warning coming from Coccinelle, and need to use new interface dma_zalloc_coherent() instead of dma_alloc_coherent()/memset(). Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index a216795..9563dfa 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1822,13 +1822,11 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) goto err_out; s = HISI_SAS_MAX_ITCT_ENTRIES * sizeof(struct hisi_sas_itct); - hisi_hba->itct = dma_alloc_coherent(dev, s, &hisi_hba->itct_dma, + hisi_hba->itct = dma_zalloc_coherent(dev, s, &hisi_hba->itct_dma, GFP_KERNEL); if (!hisi_hba->itct) goto err_out; - memset(hisi_hba->itct, 0, s); - hisi_hba->slot_info = devm_kcalloc(dev, max_command_entries, sizeof(struct hisi_sas_slot), GFP_KERNEL); From patchwork Fri Mar 23 16:05:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132353 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp778798ljb; Fri, 23 Mar 2018 09:07:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELts4XGXJzCNbddPQru9GNZy2pWhKFRhNgn0SfcpEYdAiu/RY+mC/TfH2rue9pEeFMYeU/cT X-Received: by 10.99.140.77 with SMTP id q13mr8641607pgn.44.1521821274619; Fri, 23 Mar 2018 09:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821274; cv=none; d=google.com; s=arc-20160816; b=fQRWiVZncEjbq+Mr59bonqcUERTOR4tW0lS5+PHSEhcydFAnR+QMx7/GtCPPW/ey69 pwlFYMZSvdWBRtRlxY0Anbo+sfuQoLTNIizfNeA0c3/Z07HbtCsfOvAiA8S2Y9aOmZNl ldi6UAB+ULLPqLji+6uT0LAZMpFtczeb72MkDcPbvONuCYv0r5mz4CnmOBBQAZ8ajPYO eLd8qkAQjZBkMPwS9LBZtDaXSbGs/8nA/33U1+sHDB7bzbGku96zKT/T88h6xMVoK8w2 A9VpPaNlUVQt94l31MDzQNCuJICZquKBMhZmZBoBlk4sF2bjVcjAbamAEmnjhGaU+Cks FNbQ== 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=dLGHn/6r2yOzRFIiSeTXX14Xvp6iVv7sZVLSXg3vdWU=; b=C4cnv0Zqidoh1KbxALrO8F1bbpsKuLOW3d++22YbQPATZ/TzBA/I2bH9fuDmFi905J Y2PbQxhpy6QHPyp0Gq2D+Cc+E2moHuvBFRoXU/AhRuipmFnRnrL2J+R4JSp2v0JJfI2M HlRfUzugt4lxpRxpLNu8mYELDUZ8VvI9wsawChz/joau5QU8m0GPRBOXBvJ2vOLEGyv1 uEvEcU3MAj8xFOrw839/XDJI0ador8QbHaVzpkhMq03YUSM1pI1bg7Y3blU1ZvScCnYG ZDgTFArfM2ED69JPXHL/sHU+DOzq8bQysoLoJxFQaEP1TYJW68G99RWp2nxgg5Bv/U5b OSRA== ARC-Authentication-Results: i=1; mx.google.com; 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 b6-v6si1987823plx.263.2018.03.23.09.07.54; Fri, 23 Mar 2018 09:07:54 -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; 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 S1752507AbeCWQHu (ORCPT + 28 others); Fri, 23 Mar 2018 12:07:50 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6683 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751898AbeCWQGH (ORCPT ); Fri, 23 Mar 2018 12:06:07 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 91009AEB0AB6; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:45 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 5/8] scsi: hisi_sas: consolidate command check in hisi_sas_get_ata_protocol() Date: Sat, 24 Mar 2018 00:05:12 +0800 Message-ID: <1521821115-120040-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan Currently we check the fis->command value in 2 locations in hisi_sas_get_ata_protocol() switch statement. Fix this by consolidating the check for fis->command value to 1 location only. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 9563dfa..8557fd0 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -78,22 +78,23 @@ u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis, int direction) case ATA_CMD_STANDBYNOW1: case ATA_CMD_ZAC_MGMT_OUT: return HISI_SAS_SATA_PROTOCOL_NONDATA; + + case ATA_CMD_SET_MAX: + switch (fis->features) { + case ATA_SET_MAX_PASSWD: + case ATA_SET_MAX_LOCK: + return HISI_SAS_SATA_PROTOCOL_PIO; + + case ATA_SET_MAX_PASSWD_DMA: + case ATA_SET_MAX_UNLOCK_DMA: + return HISI_SAS_SATA_PROTOCOL_DMA; + + default: + return HISI_SAS_SATA_PROTOCOL_NONDATA; + } + default: { - if (fis->command == ATA_CMD_SET_MAX) { - switch (fis->features) { - case ATA_SET_MAX_PASSWD: - case ATA_SET_MAX_LOCK: - return HISI_SAS_SATA_PROTOCOL_PIO; - - case ATA_SET_MAX_PASSWD_DMA: - case ATA_SET_MAX_UNLOCK_DMA: - return HISI_SAS_SATA_PROTOCOL_DMA; - - default: - return HISI_SAS_SATA_PROTOCOL_NONDATA; - } - } if (direction == DMA_NONE) return HISI_SAS_SATA_PROTOCOL_NONDATA; return HISI_SAS_SATA_PROTOCOL_PIO; From patchwork Fri Mar 23 16:05:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132349 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp776960ljb; Fri, 23 Mar 2018 09:06:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELuxsceHQad5DZmS6GPejQx57kQprrPjtlkN5mUgZl3wsEIjQ32sjkrsRJNpl3gvDlaSTT0T X-Received: by 10.99.182.73 with SMTP id v9mr21082255pgt.158.1521821179551; Fri, 23 Mar 2018 09:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821179; cv=none; d=google.com; s=arc-20160816; b=BHF+uts+6H9E4dTiBTdG8phvmZGJ3DmM+SJDSwAKYlx3EdgcpPzes9ZH7arukdchhX fPWB9a7S90ItK/wlLCXQLE5Br62I4s5ZVjWGTl4kQ1WB5ZuC+22zGofEZojsQsGTkF/J VMNWlZv8f6Y4LEhC0RbnZX0R+nofCErylPRGxSiE9uFZVrxhCiLN4jPsDKfzuGAwcYK/ izySFtHu3go1YErOVUOZZhskeSMtD6Gd+gu7WgkHbXtcojibWuvRubrOoivHf0vidlD0 oxi5ca91MayQb6oCw64A5u1x0NbtSgjlVx/85AvxUt7kqsfwCheAOyzZGJpDQtY244gC 4B9g== 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=05pDpoGG/nTpHWbfUOY/gxOFs0iC+CcL3inK221LYhw=; b=pMUWyCV0mgYqkYYfx1kc3W8Ba23HyUdmCvUVe0Uvug/z/lR1lZ4npRO8YVBMU/mOvl 4rZWotuehquQJKt73trnE5JfOa5rSsAlKnyakWYdttCvrH2I4GBNOhqRXhtHqs7Jxglr uBlgvExCAt10jK1J4NkCkJHHJ1VFhpuGfH4VMtdAymzQ9Hzfu2V3y0efcH0bV9Pqc+yX gyAumP71PsY7homXbUBz5tDwyBkNM7vnsplQO6QSXY037J/wjvUxzVdF/yqwjpmccgn4 2bagJ8tzIOavGRwmrpEavDeOt5vLiMWtK6xWOimM3sRHdsOD5BBh8lmChnQGapkYDuxD lh3g== ARC-Authentication-Results: i=1; mx.google.com; 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 b9-v6si3058025pla.32.2018.03.23.09.06.19; Fri, 23 Mar 2018 09:06:19 -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; 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 S1752310AbeCWQGQ (ORCPT + 28 others); Fri, 23 Mar 2018 12:06:16 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6685 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752229AbeCWQGO (ORCPT ); Fri, 23 Mar 2018 12:06:14 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id AC815C78AEC85; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:46 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 6/8] scsi: hisi_sas: check IPTT is valid before using it for v3 hw Date: Sat, 24 Mar 2018 00:05:13 +0800 Message-ID: <1521821115-120040-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan There is a bug of v3 hw development version. When AXI error happen, hw may return an abnormal CQ that IPTT value is 0xffff. This will cause IPTT out-of-bounds reference. This patch add an check of IPTT in cq_tasklet_v3_hw(), and discard invalid slot. This workaround scheme is just to enhance fault-tolerance of the driver. So, we will apply this scheme for all version of v3 hw, although release version has fixed this SoC bug. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 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 efe64bc..aa52d5e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1731,15 +1731,19 @@ static void cq_tasklet_v3_hw(unsigned long val) while (rd_point != wr_point) { struct hisi_sas_complete_v3_hdr *complete_hdr; + struct device *dev = hisi_hba->dev; int iptt; complete_hdr = &complete_queue[rd_point]; iptt = (complete_hdr->dw1) & CMPLT_HDR_IPTT_MSK; - slot = &hisi_hba->slot_info[iptt]; - slot->cmplt_queue_slot = rd_point; - slot->cmplt_queue = queue; - slot_complete_v3_hw(hisi_hba, slot); + if (likely(iptt < HISI_SAS_COMMAND_ENTRIES_V3_HW)) { + slot = &hisi_hba->slot_info[iptt]; + slot->cmplt_queue_slot = rd_point; + slot->cmplt_queue = queue; + slot_complete_v3_hw(hisi_hba, slot); + } else + dev_err(dev, "IPTT %d is invalid, discard it.\n", iptt); if (++rd_point >= HISI_SAS_QUEUE_SLOTS) rd_point = 0; From patchwork Fri Mar 23 16:05:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132348 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp776860ljb; Fri, 23 Mar 2018 09:06:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELtkgPYaEAPmYeUu6VPc+breX+1/V1chPQIplTP/C840SUVjFqFlSQx6cF0qCudrJAD6c3ck X-Received: by 2002:a17:902:ab85:: with SMTP id f5-v6mr26041488plr.380.1521821175378; Fri, 23 Mar 2018 09:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821175; cv=none; d=google.com; s=arc-20160816; b=d27j8jZ8aVRKd1M7BPIi08K33bBua3VNzcAHDTMHWqznNYs4LjaYwNF3R7GkRCYnHX QIEPahJbGGw7AILkAN8N52TawJwPK/ivpD6fcr5STIVuwQGiAhcgH1YbjSuxcCvjY5nD jKaT3aECUrc061o2rFZK19N0r3EkKrLzn9Fj3O2ASJwKFn4Y3GIrT4H5Kt/YOWGYPHKM qaXBJdHCwbTCBrhB4IpfXuEVtRA8xyumRU15Obaz1uM72ABcClQAZQ5ViuvELwQZk71j LOcVOZOW05DCNdLKfyrQjSOq5/O1wtxrsLVGhhNfrnprndh9i6crNvYFxu4aLn3xImZO 3K1w== 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=ua9Qz88/v51c4vGKoDefNuU5/JwEI+5iRJ+aC+hd0ic=; b=ynHn4vcuE/IYtgCiAVFecsVMH0Kce5EhT8chWgjD0k4NhQ2WINULZ2DOOSdDw/0XYY YBYzsNoP2gKok0+cPjjQ8M/jxsr7DJIZeiDff9x897rzPheEc810lxq0jUbDCnOpMndw 5gdlLrG4GbDpBB8f3YpfE4E+wLeiraOeYa7Sq5cOkBvvM4J7FXwfzyAqXBbUh57iitLn QEmQ4tVz2BJunu1wOp2+QYfKrf9+BmS8rPB8gpjER1GG4fBRuxUufi3sOM7sXDb0xryh Uq1vsaqS1eI8IM3Rp+zl4g9Bg8gQIVDGyLCv36Y+xlxqaGsVH6qks6SqAAEnFHfc1fVb WHdA== ARC-Authentication-Results: i=1; mx.google.com; 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 p11-v6si9129030pli.599.2018.03.23.09.06.15; Fri, 23 Mar 2018 09:06:15 -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; 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 S1752267AbeCWQGM (ORCPT + 28 others); Fri, 23 Mar 2018 12:06:12 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6687 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751811AbeCWQGK (ORCPT ); Fri, 23 Mar 2018 12:06:10 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C79BBE6513FAA; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:46 +0800 From: John Garry To: , CC: , , , John Garry Subject: [PATCH 7/8] scsi: hisi_sas: print device id for errors Date: Sat, 24 Mar 2018 00:05:14 +0800 Message-ID: <1521821115-120040-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we find an erroneous slot completion, to help aid debugging add the device index to the current debug log. Signed-off-by: John Garry Reviewed-by: Xiang Chen --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 4 ++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 ++-- 2 files changed, 4 insertions(+), 4 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 bed6afb..a5abde8 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2459,10 +2459,10 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, slot_err_v2_hw(hisi_hba, task, slot, 2); if (ts->stat != SAS_DATA_UNDERRUN) - dev_info(dev, "erroneous completion iptt=%d task=%p " + dev_info(dev, "erroneous completion iptt=%d task=%p dev id=%d " "CQ hdr: 0x%x 0x%x 0x%x 0x%x " "Error info: 0x%x 0x%x 0x%x 0x%x\n", - slot->idx, task, + slot->idx, task, sas_dev->device_id, complete_hdr->dw0, complete_hdr->dw1, complete_hdr->act, complete_hdr->dw3, error_info[0], error_info[1], diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index aa52d5e..760724a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1641,10 +1641,10 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p) slot_err_v3_hw(hisi_hba, task, slot); if (ts->stat != SAS_DATA_UNDERRUN) - dev_info(dev, "erroneous completion iptt=%d task=%p " + dev_info(dev, "erroneous completion iptt=%d task=%p dev id=%d " "CQ hdr: 0x%x 0x%x 0x%x 0x%x " "Error info: 0x%x 0x%x 0x%x 0x%x\n", - slot->idx, task, + slot->idx, task, sas_dev->device_id, complete_hdr->dw0, complete_hdr->dw1, complete_hdr->act, complete_hdr->dw3, error_info[0], error_info[1], From patchwork Fri Mar 23 16:05:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132346 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp776687ljb; Fri, 23 Mar 2018 09:06:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELt9DWeF+DgX1LIe0wYEQ1vYxr79SrVut17iHV1hzM0Pob/v4pOuOBgshGbgYZwek7Kh2DDj X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr22245799plb.89.1521821167397; Fri, 23 Mar 2018 09:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821167; cv=none; d=google.com; s=arc-20160816; b=NOzWhA5b6sExj4SQN3GYPWOdL4LSD6Bi+QbWfuQ8CgSS24Tm+FfbsIBRes+txzt0bP 9noX6zWdilvlyN2FzWMknQspHcZKuGBFtgk3E8WAcB1M7PCBm0yKvHgC7Cmz+t7axCPX seojnc19Ze6dJQitU6EqizXI3QSoPrJWtkaMCaDy8fza6GDbyTGyTOM3TONYWz+s7WEY agiMYflMSJjcQecz5QJIGg8ZB5EpH6Ew36tSbhNQWllktP+GCnYx1E7bUFPELA4Wl/1R H0HvN5ZNU9PlVrWQim2Du1DwtWKjyVA9QHt6Am0nYyUl12tRRxowXLQBv+Ph+zImnHs8 wZEQ== 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=qvrL3o2zbRJIqmpfNSobcndF8j+h+lS5tCVV9xz4TFk=; b=UFu7eLHm0IwFV8E312aBgTIslfJvTyHQWO6jTuhHQx4s70WaA82BOff+adRkBGEn0e +K2vaqLMqXrTgzXBDHCzUl0nNRAquW3zm8kN6eAzfsQwkJnC3bNyr71qB6+S7ulUV6Nd PAYwszVT1EQlOf5d4cUhHklU0XFHeLpDAVMC3iOfZvn1/Rfyvh8Yh/TO0pMFUOY4Tx+u ev8xd9XPAExXYq3/h6WeTpl4CAsXjgrTqkNZraOTWt4Aud6xxu5EQSSpihb9W+xCRT77 W/mGBS1OBIkz3i2K/1RWtY4+FsSaaSQ6eFVJdb8uFdB5PU2VhJKPcvZWNJnFwVY89xBU gHcA== ARC-Authentication-Results: i=1; mx.google.com; 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 a33-v6si3718802pla.618.2018.03.23.09.06.07; Fri, 23 Mar 2018 09:06:07 -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; 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 S1752163AbeCWQGE (ORCPT + 28 others); Fri, 23 Mar 2018 12:06:04 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:53507 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751811AbeCWQGD (ORCPT ); Fri, 23 Mar 2018 12:06:03 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 14068DB87F524; Sat, 24 Mar 2018 00:05:56 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:46 +0800 From: John Garry To: , CC: , , , John Garry Subject: [PATCH 8/8] scsi: hisi_sas: remove some unneeded structure members Date: Sat, 24 Mar 2018 00:05:15 +0800 Message-ID: <1521821115-120040-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch removes unneeded structure elements: - hisi_sas_phy.dev_sas_addr: only ever written - Also remove associated function which writes it, hisi_sas_init_add(). - hisi_sas_device.attached_phy: only ever written - Also remove code to set it in hisi_sas_dev_found() Signed-off-by: John Garry Reviewed-by: Xiang Chen --- drivers/scsi/hisi_sas/hisi_sas.h | 3 --- drivers/scsi/hisi_sas/hisi_sas_main.c | 17 +---------------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 -- 3 files changed, 1 insertion(+), 21 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index d1153e8..d413d05 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -137,7 +137,6 @@ struct hisi_sas_phy { struct asd_sas_phy sas_phy; struct sas_identify identify; u64 port_id; /* from hw */ - u64 dev_sas_addr; u64 frame_rcvd_size; u8 frame_rcvd[32]; u8 phy_attached; @@ -174,7 +173,6 @@ struct hisi_sas_device { struct completion *completion; struct hisi_sas_dq *dq; struct list_head list; - u64 attached_phy; enum sas_device_type dev_type; int device_id; int sata_idx; @@ -440,7 +438,6 @@ struct hisi_sas_slot_buf_table { extern struct scsi_host_template *hisi_sas_sht; extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba); -extern void hisi_sas_init_add(struct hisi_hba *hisi_hba); extern int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost); extern void hisi_sas_free(struct hisi_hba *hisi_hba); extern u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis, diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 8557fd0..d1a61b1 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -577,10 +577,8 @@ static int hisi_sas_dev_found(struct domain_device *device) for (phy_no = 0; phy_no < phy_num; phy_no++) { phy = &parent_dev->ex_dev.ex_phy[phy_no]; if (SAS_ADDR(phy->attached_sas_addr) == - SAS_ADDR(device->sas_addr)) { - sas_dev->attached_phy = phy_no; + SAS_ADDR(device->sas_addr)) break; - } } if (phy_no == phy_num) { @@ -2079,17 +2077,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, return NULL; } -void hisi_sas_init_add(struct hisi_hba *hisi_hba) -{ - int i; - - for (i = 0; i < hisi_hba->n_phy; i++) - memcpy(&hisi_hba->phy[i].dev_sas_addr, - hisi_hba->sas_addr, - SAS_ADDR_SIZE); -} -EXPORT_SYMBOL_GPL(hisi_sas_init_add); - int hisi_sas_probe(struct platform_device *pdev, const struct hisi_sas_hw *hw) { @@ -2143,8 +2130,6 @@ int hisi_sas_probe(struct platform_device *pdev, sha->sas_port[i] = &hisi_hba->port[i].sas_port; } - hisi_sas_init_add(hisi_hba); - rc = scsi_add_host(shost, &pdev->dev); if (rc) goto err_out_ha; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 760724a..33735a7 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2134,8 +2134,6 @@ static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) sha->sas_port[i] = &hisi_hba->port[i].sas_port; } - hisi_sas_init_add(hisi_hba); - rc = scsi_add_host(shost, dev); if (rc) goto err_out_ha;