From patchwork Tue Sep 1 11:13:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248870 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4318045ilg; Tue, 1 Sep 2020 07:57:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRDAnDcyu0wVWRCipgnTNnkYLhlrQP3anzhYjFjLyA/alkriqGbhRN+DIKcPZBXpcM3FZk X-Received: by 2002:a17:906:829a:: with SMTP id h26mr1875164ejx.11.1598972244634; Tue, 01 Sep 2020 07:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972244; cv=none; d=google.com; s=arc-20160816; b=b4fctGQW8nbR7OkNbRz/+pQT4rPLQ7LQwUIzJZjBb4F1X8O5eVtNj/Rd8QzRbthZV0 yO4EOn9uhIXfjvkkaDT/l9Z7GWv5GoJMZt8Eddz0YVfqqJHFvY855cIrpJzjQa2YAnbw j2rRI3Y50CEOHtMneJngx0p3Sdr29v+0R8rGdjFomC8sItSuvJmZx9LDJk1jhc8bokbj ikqMbTYrqIXc2r7mjJRGJPrsvt+TL41LuElOdOoRiSs9dIXopHGHtk2H50hszcof0F88 ZMbFVHiGezQdFAYJdRcAU5GTVxKbYm6NEJ7RvK8cNmeXn3sA91Q+DKhJiE9Z6HjMf+Eb GqaA== 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; bh=NKrxG679GL/DSJIoGLgByhmUm9rLGwsOW8E5+17YJls=; b=a7SJTwGAwGzqnGOZz5ca14JP433otEi71jSFEIrARh/Kpt20STLPVpfEp/21zklX7t eVcMgNFSyml0+BVDYXzMXY0suCnZRjQwZ+HUszgqx0qiFpY+EujxwHPd7q8yJpXL3xTU F1aEKBel8vKyswx8DTOuWQfc84QiTGbiS+TExaWwMbARQMHAoqEcFoFWGSTESgb3TmjJ 8k6tqYrIo0+NkOW6MlLhaHWXIH82zZyKZm29rhMckpAtZw6AWoJJ7ZgYDNuxTp3GRVLy WL88DSboURvu95gFr71ckeCUIvZzZ7NG0RsY37MiXKMzwBv2RDEIwhB9Y7HY9hdJdszo GYJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si802550ejc.567.2020.09.01.07.57.24 for ; Tue, 01 Sep 2020 07:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728876AbgIAOzM (ORCPT ); Tue, 1 Sep 2020 10:55:12 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44770 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726984AbgIALeb (ORCPT ); Tue, 1 Sep 2020 07:34:31 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 41B54EC1076991CB71A6; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:16:58 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 1/8] scsi: hisi_sas: Avoid accessing to SSP task for SMP IOs Date: Tue, 1 Sep 2020 19:13:03 +0800 Message-ID: <1598958790-232272-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] 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 hisi_sas_slot_task_free(), it accesses to SSP task for non-ATA task. But if it is SMP task here, it accesses to wrong structure though it may not cause any issue. To avoid it, only access to ssp task when slot->n_elem_dif is not 0 which indicates this is SSP task. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 11caa4b0d797..fdf5f0f1b60b 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -229,17 +229,18 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, task->lldd_task = NULL; if (!sas_protocol_ata(task->task_proto)) { - struct sas_ssp_task *ssp_task = &task->ssp_task; - struct scsi_cmnd *scsi_cmnd = ssp_task->cmd; - if (slot->n_elem) dma_unmap_sg(dev, task->scatter, task->num_scatter, task->data_dir); - if (slot->n_elem_dif) + if (slot->n_elem_dif) { + struct sas_ssp_task *ssp_task = &task->ssp_task; + struct scsi_cmnd *scsi_cmnd = ssp_task->cmd; + dma_unmap_sg(dev, scsi_prot_sglist(scsi_cmnd), scsi_prot_sg_count(scsi_cmnd), task->data_dir); + } } } From patchwork Tue Sep 1 11:13:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248845 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4135254ilg; Tue, 1 Sep 2020 04:35:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTYALZ4fSj7DFlWdOMe9f91S4tX9JV5yDQ17hoiPaK21l03iscTwoNKRfOVwv0yO/4K4yp X-Received: by 2002:aa7:c549:: with SMTP id s9mr1384977edr.58.1598960121388; Tue, 01 Sep 2020 04:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598960121; cv=none; d=google.com; s=arc-20160816; b=yAl2u9zHHvIcLDjypE5qP+esWYVQ0ScLHfu0g+1t3cB8g4SzXBlcVy0ENcoRkdbPdo 9/eH63EOfMAP/nPpuLoDit1BaBcHZy3vdBkBri+CkphVZeYciQKh/8UPWJoch6zGkIA3 DQhlr7MkLIjkreUi/Uydnx5HT9pHxT+I+im+4T7i+XUhTn/IPgCc9wddHjm5kagNfuWh pxp3akP/Wo/bzj26UcVBS6+BAVowWcSVimlKm6+9Ds+HILHBU6lttU2UpCk3EPeAe1TR XOlRKYBxMbYyPLzyMXwidEt2QyK0e7zANtpTzzVDj9I1OFpgd9eN6jOoi7PeudlWf5nR grJA== 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; bh=ouymIRPwifbgmYqmOBVUZJLPHvrr3eONs7ulCvSfpqk=; b=BNpwmv+eT1tVoQ9gxeSUmhOi4WADCIfF8yHe0D8CKt8hRtKc21zHGhrsgQxn7v4l5A Y9l4cVk45+141XekSZKDHHusVM0yoNvh3UQxzo6YfwwLZim0ixvA3bP/f1Ed/AVEbTX5 itTPeC0JlJsC87ynwazhuvRNpRg7VyHvI+JSqQM2fvWwq7VkhspaMc6Qr/UqcdDaPYjt Y8mZ+wPicsAOB3lXCYvzmTXdAFq7akEaDDGBPRFgu4kdU2jzx3QaRwNvRYd4p8Y2dwEg UIkG4M3EYr2XdVzmDhlkYeljMVpueLfAqTRhDD+e6eL70C37i2j8gczlvjlA43ncWB7g LnRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si465390ejc.635.2020.09.01.04.35.21 for ; Tue, 01 Sep 2020 04:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727035AbgIALfQ (ORCPT ); Tue, 1 Sep 2020 07:35:16 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43740 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726537AbgIALeh (ORCPT ); Tue, 1 Sep 2020 07:34:37 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 69B232334A629702BB85; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:16:58 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 2/8] scsi: hisi_sas: Modify macro name for OOB phy linkrate Date: Tue, 1 Sep 2020 19:13:04 +0800 Message-ID: <1598958790-232272-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing The macro for OOB phy linkrate is named as CFG_PROG_PHY_LINK_RATE_*, but it's not correct. To avoid some misunderstand, we modify it to a correct naming. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 60adf5c32143..05b60cdf6b24 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -191,8 +191,8 @@ #define PHY_CFG_PHY_RST_OFF 3 #define PHY_CFG_PHY_RST_MSK (0x1 << PHY_CFG_PHY_RST_OFF) #define PROG_PHY_LINK_RATE (PORT_BASE + 0x8) -#define CFG_PROG_PHY_LINK_RATE_OFF 8 -#define CFG_PROG_PHY_LINK_RATE_MSK (0xf << CFG_PROG_PHY_LINK_RATE_OFF) +#define CFG_PROG_OOB_PHY_LINK_RATE_OFF 8 +#define CFG_PROG_OOB_PHY_LINK_RATE_MSK (0xf << CFG_PROG_OOB_PHY_LINK_RATE_OFF) #define PHY_CTRL (PORT_BASE + 0x14) #define PHY_CTRL_RESET_OFF 0 #define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF) @@ -2998,8 +2998,8 @@ static void hisi_sas_bist_test_restore_v3_hw(struct hisi_hba *hisi_hba) /* restore the linkrate */ reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, PROG_PHY_LINK_RATE); /* init OOB link rate as 1.5 Gbits */ - reg_val &= ~CFG_PROG_PHY_LINK_RATE_MSK; - reg_val |= (0x8 << CFG_PROG_PHY_LINK_RATE_OFF); + reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK; + reg_val |= (0x8 << CFG_PROG_OOB_PHY_LINK_RATE_OFF); hisi_sas_phy_write32(hisi_hba, phy_id, PROG_PHY_LINK_RATE, reg_val); /* enable PHY */ @@ -3027,8 +3027,8 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) /* set linkrate of bit test*/ reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, PROG_PHY_LINK_RATE); - reg_val &= ~CFG_PROG_PHY_LINK_RATE_MSK; - reg_val |= (linkrate << CFG_PROG_PHY_LINK_RATE_OFF); + reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK; + reg_val |= (linkrate << CFG_PROG_OOB_PHY_LINK_RATE_OFF); hisi_sas_phy_write32(hisi_hba, phy_id, PROG_PHY_LINK_RATE, reg_val); @@ -3050,8 +3050,7 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) hisi_sas_phy_write32(hisi_hba, phy_id, SAS_PHY_BIST_CODE, SAS_PHY_BIST_CODE_INIT); - hisi_sas_phy_write32(hisi_hba, phy_id, - SAS_PHY_BIST_CODE1, + hisi_sas_phy_write32(hisi_hba, phy_id, SAS_PHY_BIST_CODE1, SAS_PHY_BIST_CODE1_INIT); mdelay(100); From patchwork Tue Sep 1 11:13:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248869 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4318013ilg; Tue, 1 Sep 2020 07:57:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkm+2aGQZ7WZ14EKKYbU3D/8zP5QWJUOSakbzkHE4zX+CCZYWGRqhhqZaUYhO1jeuf8iv3 X-Received: by 2002:a17:906:17c5:: with SMTP id u5mr1721677eje.453.1598972242208; Tue, 01 Sep 2020 07:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972242; cv=none; d=google.com; s=arc-20160816; b=aD/PSGkW/nHav8LzUMySr3Pd73jz7iXVWxuQgcRHk8XAdqgTuRReAyEHto70SvO8CR 5w49//YJMpvFDOd2Rz1RZmY/K8lrmNnwBEO82bgI6/gGCe/fmZu5RWUZ+XhXW4CmHf8g b6MQmAfBbcq8bN+e1TjvjdHLFh8p3xDdKa0exQwmrWclg2Ms9igzSZBfjvMJ1mStoA8M QVfdAQ4QOvfA+iUHngKBAENaystNxi90lUDXImUi6VHLjf1tJVtv19puU9dOdExbSx86 Q+iW9Aik4OqiL3IieNeyc4qf9u5ffYN+HsfKzXp3QiMhCtNEYyoTfMKeBF/GDWrjpboZ RthA== 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; bh=7FrJWCUblZrnoXgudbyioHHALVELoWgvuaCavfX85l8=; b=AdWONy/pkRHA3HENP9F8QzodWcSShXiJji8siSaYIJpbJPY0PsBjK8P6lBM9vHPNiO Mj1jWSW61CtNiYhyZMvX+19uQNl8DajtvV7ILMoWWThHkL70l1/Gc1NGjsUrhq9vQ22X k3254bD8hx037H7PsNPVjrhI3mZToo8KQqGWyxHzhXnWZHT1HtlXdhoILLilkILEECBy 8bsHF/vdSnDcAqmBewJdPVNNQAiQyHm2N6N2W+/b8L1gWcl4hFy4ZM52LsZ2VQ6XyviT Fr7Jqs6BnGdGJpjygQvpp2NlMWcO9DfTWftsxHoYqkL33U8lS0LDnMiyROMaRO1DIAZY FEXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh13si755309ejb.706.2020.09.01.07.57.22 for ; Tue, 01 Sep 2020 07:57:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728116AbgIAOzT (ORCPT ); Tue, 1 Sep 2020 10:55:19 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44772 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726997AbgIALeb (ORCPT ); Tue, 1 Sep 2020 07:34:31 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4633EDAAF5E80908D7C9; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:16:58 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 3/8] scsi: hisi_sas: Do not modify upper fields of PROG_PHY_LINK_RATE reg Date: Tue, 1 Sep 2020 19:13:05 +0800 Message-ID: <1598958790-232272-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing When we update register of PROG_PHY_LINK_RATE to set linkrate for a phy, we used a hard-coded initial value instead of getting the current value from register. We had assumed that this register would not be modified, but in fact it was partially modified in new version of hardware. So hard-coded value we used change default value of register to a wrong setting and make SAS controller can not change linkrate for phy at new version of hardware. So we delete hard-coded value and always read the latest value of register before we update part of it. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 05b60cdf6b24..b7d94f2e49ae 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -191,6 +191,8 @@ #define PHY_CFG_PHY_RST_OFF 3 #define PHY_CFG_PHY_RST_MSK (0x1 << PHY_CFG_PHY_RST_OFF) #define PROG_PHY_LINK_RATE (PORT_BASE + 0x8) +#define CFG_PROG_PHY_LINK_RATE_OFF 0 +#define CFG_PROG_PHY_LINK_RATE_MSK (0xff << CFG_PROG_PHY_LINK_RATE_OFF) #define CFG_PROG_OOB_PHY_LINK_RATE_OFF 8 #define CFG_PROG_OOB_PHY_LINK_RATE_MSK (0xf << CFG_PROG_OOB_PHY_LINK_RATE_OFF) #define PHY_CTRL (PORT_BASE + 0x14) @@ -598,20 +600,19 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, HYPER_STREAM_ID_EN_CFG, 1); for (i = 0; i < hisi_hba->n_phy; i++) { + enum sas_linkrate max; struct hisi_sas_phy *phy = &hisi_hba->phy[i]; struct asd_sas_phy *sas_phy = &phy->sas_phy; - u32 prog_phy_link_rate = 0x800; + u32 prog_phy_link_rate = hisi_sas_phy_read32(hisi_hba, i, + PROG_PHY_LINK_RATE); + prog_phy_link_rate &= ~CFG_PROG_PHY_LINK_RATE_MSK; if (!sas_phy->phy || (sas_phy->phy->maximum_linkrate < - SAS_LINK_RATE_1_5_GBPS)) { - prog_phy_link_rate = 0x855; - } else { - enum sas_linkrate max = sas_phy->phy->maximum_linkrate; - - prog_phy_link_rate = - hisi_sas_get_prog_phy_linkrate_mask(max) | - 0x800; - } + SAS_LINK_RATE_1_5_GBPS)) + max = SAS_LINK_RATE_12_0_GBPS; + else + max = sas_phy->phy->maximum_linkrate; + prog_phy_link_rate |= hisi_sas_get_prog_phy_linkrate_mask(max); hisi_sas_phy_write32(hisi_hba, i, PROG_PHY_LINK_RATE, prog_phy_link_rate); hisi_sas_phy_write32(hisi_hba, i, SERDES_CFG, 0xffc00); @@ -2501,8 +2502,10 @@ static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no, struct sas_phy_linkrates *r) { enum sas_linkrate max = r->maximum_linkrate; - u32 prog_phy_link_rate = 0x800; + u32 prog_phy_link_rate = hisi_sas_phy_read32(hisi_hba, phy_no, + PROG_PHY_LINK_RATE); + prog_phy_link_rate &= ~CFG_PROG_PHY_LINK_RATE_MSK; prog_phy_link_rate |= hisi_sas_get_prog_phy_linkrate_mask(max); hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, prog_phy_link_rate); From patchwork Tue Sep 1 11:13:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248871 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4318367ilg; Tue, 1 Sep 2020 07:57:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypVERUp0XvjGW03OQ8nHhxEVAcQ2dyX2RBhXmcgHQBRPbEVDZADaaWwXxIkrxHuCJ8v1oF X-Received: by 2002:a17:906:b04d:: with SMTP id bj13mr1909093ejb.175.1598972267302; Tue, 01 Sep 2020 07:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972267; cv=none; d=google.com; s=arc-20160816; b=tZQU0QKo1G7NW9XUzAb4yr8cAylR3AgydG5V9WDUStVEUICh+w3Za/SZkHSSjjh9bR i3uQ+8gjjOoM1D5ZQza2VmGS+hnn1mzww6/PuQxQNvM7i0mAE+SojHH4Xi2q7gO/4szG C/WhXhtjuHl275cyFlXFBKjXbM+I34N7aZo3brEnSY67JI4yfk+2PB3AahcAHHXX7Syg XnwANzct7TZBIpe5PfvqdIAWnFZDXvQcv5tc2RISVhfv65VlMl+3Po4BHrOwTIDByl+p Y7wIrXRue/87w88cTQXl3DCnL0GwmUl14GpdAtPrzzQJS3Ea3PeBRqBl/iDIb1ALueHf zWqA== 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; bh=rckvZqiZPE8GuhoRXwMV4Zb0eDPmNHPiaRNzHhpIfeg=; b=GFdLChpmezNFgBgtxq05un6okoKcVFjptQKEP5fmQfE9g8udXjvoMt7bxvFUI6jpme toTDmHJiXID4EsJ84BdGUHeGI4Usch01DX1zUNaQpwXLgIqey3VFqyxKNjMLhzW1NhoZ Tt3NzwQsw6oM8TQaIGR49XTFl0VlUgxekhAtcCDUnJnkX+GzDIIZtFJMaW5u76tLfruw Y3QjXZWCNHnAvSRGBEh8S7+KZqrd/bXJVPpWYk8A6nfT+WdW2z0AbvipdCGCYM8m4alw YxO1nOqijfZB6n8qgVE4YRBos8lV25DFbSXY3T2nYHii+/4WMMq+ICFj5R4QhGR0rxK5 p7rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si813371ejc.211.2020.09.01.07.57.47 for ; Tue, 01 Sep 2020 07:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726355AbgIALWd (ORCPT ); Tue, 1 Sep 2020 07:22:33 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:47604 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbgIALTu (ORCPT ); Tue, 1 Sep 2020 07:19:50 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 554C5CB1E8FE32F7B9DB; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:16:59 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 4/8] scsi: hisi_sas: Make phy index variable name consistent Date: Tue, 1 Sep 2020 19:13:06 +0800 Message-ID: <1598958790-232272-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing We use "phy_id" to identify phy in the BIST code, but the rest of code always use "phy_no". So we change it for consistent coding style. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 50 +++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index b7d94f2e49ae..8a5c6f5e2a7a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2971,42 +2971,42 @@ static void read_iost_itct_cache_v3_hw(struct hisi_hba *hisi_hba, static void hisi_sas_bist_test_prep_v3_hw(struct hisi_hba *hisi_hba) { u32 reg_val; - int phy_id = hisi_hba->debugfs_bist_phy_no; + int phy_no = hisi_hba->debugfs_bist_phy_no; /* disable PHY */ - hisi_sas_phy_enable(hisi_hba, phy_id, 0); + hisi_sas_phy_enable(hisi_hba, phy_no, 0); /* disable ALOS */ - reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, SERDES_CFG); + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SERDES_CFG); reg_val |= CFG_ALOS_CHK_DISABLE_MSK; - hisi_sas_phy_write32(hisi_hba, phy_id, SERDES_CFG, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, SERDES_CFG, reg_val); } static void hisi_sas_bist_test_restore_v3_hw(struct hisi_hba *hisi_hba) { u32 reg_val; - int phy_id = hisi_hba->debugfs_bist_phy_no; + int phy_no = hisi_hba->debugfs_bist_phy_no; /* disable loopback */ - reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, SAS_PHY_BIST_CTRL); + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL); reg_val &= ~(CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK | CFG_BIST_TEST_MSK); - hisi_sas_phy_write32(hisi_hba, phy_id, SAS_PHY_BIST_CTRL, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL, reg_val); /* enable ALOS */ - reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, SERDES_CFG); + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SERDES_CFG); reg_val &= ~CFG_ALOS_CHK_DISABLE_MSK; - hisi_sas_phy_write32(hisi_hba, phy_id, SERDES_CFG, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, SERDES_CFG, reg_val); /* restore the linkrate */ - reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, PROG_PHY_LINK_RATE); + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, PROG_PHY_LINK_RATE); /* init OOB link rate as 1.5 Gbits */ reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK; reg_val |= (0x8 << CFG_PROG_OOB_PHY_LINK_RATE_OFF); - hisi_sas_phy_write32(hisi_hba, phy_id, PROG_PHY_LINK_RATE, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, reg_val); /* enable PHY */ - hisi_sas_phy_enable(hisi_hba, phy_id, 1); + hisi_sas_phy_enable(hisi_hba, phy_no, 1); } #define SAS_PHY_BIST_CODE_INIT 0x1 @@ -3015,28 +3015,28 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) { u32 reg_val, mode_tmp; u32 linkrate = hisi_hba->debugfs_bist_linkrate; - u32 phy_id = hisi_hba->debugfs_bist_phy_no; + u32 phy_no = hisi_hba->debugfs_bist_phy_no; u32 code_mode = hisi_hba->debugfs_bist_code_mode; u32 path_mode = hisi_hba->debugfs_bist_mode; struct device *dev = hisi_hba->dev; - dev_info(dev, "BIST info:linkrate=%d phy_id=%d code_mode=%d path_mode=%d\n", - linkrate, phy_id, code_mode, path_mode); + dev_info(dev, "BIST info:linkrate=%d phy_no=%d code_mode=%d path_mode=%d\n", + linkrate, phy_no, code_mode, path_mode); mode_tmp = path_mode ? 2 : 1; if (enable) { /* some preparations before bist test */ hisi_sas_bist_test_prep_v3_hw(hisi_hba); /* set linkrate of bit test*/ - reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, PROG_PHY_LINK_RATE); reg_val &= ~CFG_PROG_OOB_PHY_LINK_RATE_MSK; reg_val |= (linkrate << CFG_PROG_OOB_PHY_LINK_RATE_OFF); - hisi_sas_phy_write32(hisi_hba, phy_id, - PROG_PHY_LINK_RATE, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, + reg_val); /* set code mode of bit test */ - reg_val = hisi_sas_phy_read32(hisi_hba, phy_id, + reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL); reg_val &= ~(CFG_BIST_MODE_SEL_MSK | CFG_LOOP_TEST_MODE_MSK | @@ -3046,28 +3046,28 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) reg_val |= ((code_mode << CFG_BIST_MODE_SEL_OFF) | (mode_tmp << CFG_LOOP_TEST_MODE_OFF) | CFG_BIST_TEST_MSK); - hisi_sas_phy_write32(hisi_hba, phy_id, + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL, reg_val); /* set the bist init value */ - hisi_sas_phy_write32(hisi_hba, phy_id, + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CODE, SAS_PHY_BIST_CODE_INIT); - hisi_sas_phy_write32(hisi_hba, phy_id, SAS_PHY_BIST_CODE1, + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CODE1, SAS_PHY_BIST_CODE1_INIT); mdelay(100); reg_val |= (CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK); - hisi_sas_phy_write32(hisi_hba, phy_id, + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL, reg_val); /* clear error bit */ mdelay(100); - hisi_sas_phy_read32(hisi_hba, phy_id, SAS_BIST_ERR_CNT); + hisi_sas_phy_read32(hisi_hba, phy_no, SAS_BIST_ERR_CNT); } else { /* disable bist test and recover it */ hisi_hba->debugfs_bist_cnt += hisi_sas_phy_read32(hisi_hba, - phy_id, SAS_BIST_ERR_CNT); + phy_no, SAS_BIST_ERR_CNT); hisi_sas_bist_test_restore_v3_hw(hisi_hba); } From patchwork Tue Sep 1 11:13:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248846 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4135796ilg; Tue, 1 Sep 2020 04:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqJD2dMRnjE2U6n089gB7XDjxiXuIaHqQzi8h79bn+s+/+urAkwhAoxMYNs5Nc3DrM0Pfd X-Received: by 2002:a50:fa94:: with SMTP id w20mr1114047edr.206.1598960171666; Tue, 01 Sep 2020 04:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598960171; cv=none; d=google.com; s=arc-20160816; b=hKh4B7Eh8R2RCLrmq0WjibBtBmht28XNopUmx2aPvKsIFcPM6H7VlA03BuzOqVXRTn rEpsiuWNc8zInWi+qw8oAbEwV6m3lvYEcuOmvuX/9YkfXOx80xRbxXJo1aKqLVJwNd0R YUFQ7ptwqpBz/fYsIjSLwI8hr+koQM5r5F+LGwN2zF8PQtQVl93L0CgTsrMJtw1emCEv U5qshKf2JiplFOnPFbLwi55GTCu7SbktRz+fBRDpiNTBshJCZJkxoEtgd0FOYKBdoXHK m5hPMRNiBAvBB1S1j6YeiWr/s5UzrTEgSVR/o55rxY1pQ9RcFdkDiTsXwds++IfQf/yM x/+A== 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; bh=pgIkdjBn3ZbpB8giKiTiZUVJkp9AZaKu8U/VNEOGke8=; b=PLycTcu5vizNdi9MnM/amVdQdeIXAVv02BNY2YrnLs/H6YQyOhOpNJtqhmrruK6cdY nIBursvNvlKaoDxZ+7Kv/3FHjmXfXDnWOB3gj48BKECa+dopSg+uxjc2CyxVwqzjY0q8 Kaa34qXP2kkD/G20fg1ttN9LzyA/6CsE5viMhP7UxTbS8htda4CzcKDIYRGPl/YoBvI1 s87OLKfXqmCA9MHtcRx+qnORFJ4Rbz3kC6378ilWnJ6JPNUY7s45+g27RSitwjs89OC7 sInUwPrf2xvEXf9nBpVsBDg/lBpi8AyU0sVqMSYVoVBKZrXQ5U+dWXikgv4DtKy6pNZL lH5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si465390ejc.635.2020.09.01.04.36.11 for ; Tue, 01 Sep 2020 04:36:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726625AbgIALfU (ORCPT ); Tue, 1 Sep 2020 07:35:20 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44776 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726722AbgIALec (ORCPT ); Tue, 1 Sep 2020 07:34:32 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4FCFC7322F11FFCFF2E9; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:16:59 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 5/8] scsi: hisi_sas: Add BIST support for phy FFE Date: Tue, 1 Sep 2020 19:13:07 +0800 Message-ID: <1598958790-232272-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing Add BIST support for phy FFE(Feed forward equalizer) setting. Through the new debugfs interface, the user can configure FFE if they want. FFE are a kind of parameter which used for link layer of board. They will affect the link quality between the SAS controller and the backplane. In the BIST test, FFE parameter interface is provided to assist board tester in optimizing link parameters. The modification of the FFE parameter will affect the test after BIST or the normal running of the board, so user should save FFE's initial value before modify it, and restore them after BIST test if necessary. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 13 +++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 76 ++++++++++++++++++++++++++ drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 25 ++++++++- 3 files changed, 111 insertions(+), 3 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 2bdd64648ef0..ce6a7d212afe 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -273,6 +273,18 @@ enum hisi_sas_debugfs_cache_type { HISI_SAS_IOST_CACHE, }; +enum hisi_sas_debugfs_bist_ffe_cfg { + FFE_SAS_1_5_GBPS, + FFE_SAS_3_0_GBPS, + FFE_SAS_6_0_GBPS, + FFE_SAS_12_0_GBPS, + FFE_RESV, + FFE_SATA_1_5_GBPS, + FFE_SATA_3_0_GBPS, + FFE_SATA_6_0_GBPS, + FFE_CFG_MAX +}; + struct hisi_sas_hw { int (*hw_init)(struct hisi_hba *hisi_hba); void (*setup_itct)(struct hisi_hba *hisi_hba, @@ -440,6 +452,7 @@ struct hisi_hba { int debugfs_bist_mode; u32 debugfs_bist_cnt; int debugfs_bist_enable; + u32 debugfs_bist_ffe[HISI_SAS_MAX_PHYS][FFE_CFG_MAX]; /* debugfs memories */ /* Put Global AXI and RAS Register into register array */ diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index fdf5f0f1b60b..6cd9b25fbbe7 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -3704,6 +3704,58 @@ static const struct file_operations hisi_sas_debugfs_bist_enable_ops = { .owner = THIS_MODULE, }; +static const struct { + char *name; +} hisi_sas_debugfs_ffe_name[FFE_CFG_MAX] = { + { "SAS_1_5_GBPS" }, + { "SAS_3_0_GBPS" }, + { "SAS_6_0_GBPS" }, + { "SAS_12_0_GBPS" }, + { "FFE_RESV" }, + { "SATA_1_5_GBPS" }, + { "SATA_3_0_GBPS" }, + { "SATA_6_0_GBPS" }, +}; + +static ssize_t hisi_sas_debugfs_write(struct file *filp, + const char __user *buf, + size_t count, loff_t *ppos) +{ + struct seq_file *m = filp->private_data; + u32 *val = m->private; + int res; + + res = kstrtouint_from_user(buf, count, 0, val); + if (res) + return res; + + return count; +} + +static int hisi_sas_debugfs_show(struct seq_file *s, void *p) +{ + u32 *val = s->private; + + seq_printf(s, "0x%x\n", *val); + + return 0; +} + +static int hisi_sas_debugfs_open(struct inode *inode, struct file *filp) +{ + return single_open(filp, hisi_sas_debugfs_show, + inode->i_private); +} + +static const struct file_operations hisi_sas_debugfs_ops = { + .open = hisi_sas_debugfs_open, + .read = seq_read, + .write = hisi_sas_debugfs_write, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; + static ssize_t hisi_sas_debugfs_phy_down_cnt_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) @@ -3901,6 +3953,9 @@ static void hisi_sas_debugfs_phy_down_cnt_init(struct hisi_hba *hisi_hba) static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) { + struct dentry *ports_dentry; + int phy_no; + hisi_hba->debugfs_bist_dentry = debugfs_create_dir("bist", hisi_hba->debugfs_dir); debugfs_create_file("link_rate", 0600, @@ -3924,6 +3979,27 @@ static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) debugfs_create_file("enable", 0600, hisi_hba->debugfs_bist_dentry, hisi_hba, &hisi_sas_debugfs_bist_enable_ops); + ports_dentry = debugfs_create_dir("port", hisi_hba->debugfs_bist_dentry); + + for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { + struct dentry *port_dentry; + struct dentry *ffe_dentry; + char name[256]; + int i; + + snprintf(name, 256, "%d", phy_no); + port_dentry = debugfs_create_dir(name, ports_dentry); + ffe_dentry = debugfs_create_dir("ffe", port_dentry); + for (i = 0; i < FFE_CFG_MAX; i++) { + if (i == FFE_RESV) + continue; + debugfs_create_file(hisi_sas_debugfs_ffe_name[i].name, + 0600, ffe_dentry, + &hisi_hba->debugfs_bist_ffe[phy_no][i], + &hisi_sas_debugfs_ops); + } + } + hisi_hba->debugfs_bist_linkrate = SAS_LINK_RATE_1_5_GBPS; } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 8a5c6f5e2a7a..f5d566832d6c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -297,6 +297,7 @@ #define DMA_RX_STATUS_BUSY_MSK (0x1 << DMA_RX_STATUS_BUSY_OFF) #define COARSETUNE_TIME (PORT_BASE + 0x304) +#define TXDEEMPH_G1 (PORT_BASE + 0x350) #define ERR_CNT_DWS_LOST (PORT_BASE + 0x380) #define ERR_CNT_RESET_PROB (PORT_BASE + 0x384) #define ERR_CNT_INVLD_DW (PORT_BASE + 0x390) @@ -567,7 +568,7 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba, static void init_reg_v3_hw(struct hisi_hba *hisi_hba) { - int i; + int i, j; /* Global registers init */ hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, @@ -637,6 +638,13 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) /* used for 12G negotiate */ hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e); hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff); + + /* get default FFE configuration for BIST */ + for (j = 0; j < FFE_CFG_MAX; j++) { + u32 val = hisi_sas_phy_read32(hisi_hba, i, + TXDEEMPH_G1 + (j * 0x4)); + hisi_hba->debugfs_bist_ffe[i][j] = val; + } } for (i = 0; i < hisi_hba->queue_count; i++) { @@ -2972,10 +2980,16 @@ static void hisi_sas_bist_test_prep_v3_hw(struct hisi_hba *hisi_hba) { u32 reg_val; int phy_no = hisi_hba->debugfs_bist_phy_no; + int i; /* disable PHY */ hisi_sas_phy_enable(hisi_hba, phy_no, 0); + /* update FFE */ + for (i = 0; i < FFE_CFG_MAX; i++) + hisi_sas_phy_write32(hisi_hba, phy_no, TXDEEMPH_G1 + (i * 0x4), + hisi_hba->debugfs_bist_ffe[phy_no][i]); + /* disable ALOS */ reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SERDES_CFG); reg_val |= CFG_ALOS_CHK_DISABLE_MSK; @@ -3016,12 +3030,17 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) u32 reg_val, mode_tmp; u32 linkrate = hisi_hba->debugfs_bist_linkrate; u32 phy_no = hisi_hba->debugfs_bist_phy_no; + u32 *ffe = hisi_hba->debugfs_bist_ffe[phy_no]; u32 code_mode = hisi_hba->debugfs_bist_code_mode; u32 path_mode = hisi_hba->debugfs_bist_mode; struct device *dev = hisi_hba->dev; - dev_info(dev, "BIST info:linkrate=%d phy_no=%d code_mode=%d path_mode=%d\n", - linkrate, phy_no, code_mode, path_mode); + dev_info(dev, "BIST info:phy%d link_rate=%d code_mode=%d path_mode=%d ffe={0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x}\n", + phy_no, linkrate, code_mode, path_mode, + ffe[FFE_SAS_1_5_GBPS], ffe[FFE_SAS_3_0_GBPS], + ffe[FFE_SAS_6_0_GBPS], ffe[FFE_SAS_12_0_GBPS], + ffe[FFE_SATA_1_5_GBPS], ffe[FFE_SATA_3_0_GBPS], + ffe[FFE_SATA_6_0_GBPS]); mode_tmp = path_mode ? 2 : 1; if (enable) { /* some preparations before bist test */ From patchwork Tue Sep 1 11:13:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248842 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4126635ilg; Tue, 1 Sep 2020 04:21:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbT0ZAAPR4j2+AAU1J4hESPm0ZR7DeZf5+YZiMhcAKymu2ClY08hWVEVdXTIFxerLdvunm X-Received: by 2002:a17:906:15c2:: with SMTP id l2mr1019210ejd.112.1598959314052; Tue, 01 Sep 2020 04:21:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598959314; cv=none; d=google.com; s=arc-20160816; b=wBJVyF6U58QpuovKbN6GxH2/0caBvjGvLzOlif1wy4AdK+n6kKgi9hpZbuQtjcidOe Uck9+euGk0QB5wJOATc9aoLnvNaTfc0TgPyF1/gyxoO+m27T1vOCirpu7awglXiUlZ61 Ohu+/SB1BfCk+18ros8WjuL5lT4QzJFuh3mA6Lb+BBiLLPh4wQq8pMmuC0kocig+nbRm ayxp8oikx10G4MobG1QVfm6SEIJQtQJSN8BqbxOtFSsNvyMfCyLkCJZdQIM/tBAnYqOh j3O+IgGEODCNSchY5JS1VcfciVoP5LdE9Cbnkyu6lAVjXftMNb1YzjZJqhy3Kyg6zOPo ecGw== 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; bh=IqYQoKOq6SuTYS3SbmW1KU6O725qvQQBnrROeIhvni4=; b=mCk0LTpKQK1M1DuGBME7QQod2KulCyikhjnqE1KfIQ2CN4tf6Zp72T3oWRy7SqL4PX Fy647R04aUROz9Jn7fk/fLBiv1MvaPAyeRDrid36jTT9Lzy0K3jPpGmjTfvKCN+TwbZI 2cPVUaVtelNOzqE93pPY9+UFe1D0m2vkRer7F2FKKcmvVZVCNixtwQrXBkn8elB3NmkE MFMyPfNd5LtYXz6ER8NrnHgiwgHGY5aqPG5y0tdfAJ3Xsvc0BeVAWePm7d+rlokKcMZR JGNMsnSejuJG+/U0tj75a2TI1TOrJqNMBvtzmnTgHbCpNAsGMYmG6xJtCE2dmSoxctCH u37A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si462835ejk.740.2020.09.01.04.21.53 for ; Tue, 01 Sep 2020 04:21:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726105AbgIALUz (ORCPT ); Tue, 1 Sep 2020 07:20:55 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:47610 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726518AbgIALTv (ORCPT ); Tue, 1 Sep 2020 07:19:51 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5A1F9B41CA48ED149795; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:17:00 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 6/8] scsi: hisi_sas: Add BIST support for fixed code pattern Date: Tue, 1 Sep 2020 19:13:08 +0800 Message-ID: <1598958790-232272-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing Add BIST support for fixed code pattern. Through the new debugfs interface, the user can select fixed code pattern if they want. We added two new interfaces fixed_code and fixed_code1 to configure fixed code pattern. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 22 +++++++++++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 25 ++++++--------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 43 ++++++++++++++++---------- 3 files changed, 59 insertions(+), 31 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index ce6a7d212afe..c617ac8d8315 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -285,6 +285,27 @@ enum hisi_sas_debugfs_bist_ffe_cfg { FFE_CFG_MAX }; +enum hisi_sas_debugfs_bist_fixed_code { + FIXED_CODE, + FIXED_CODE_1, + FIXED_CODE_MAX +}; + +enum { + HISI_SAS_BIST_CODE_MODE_PRBS7, + HISI_SAS_BIST_CODE_MODE_PRBS23, + HISI_SAS_BIST_CODE_MODE_PRBS31, + HISI_SAS_BIST_CODE_MODE_JTPAT, + HISI_SAS_BIST_CODE_MODE_CJTPAT, + HISI_SAS_BIST_CODE_MODE_SCRAMBED_0, + HISI_SAS_BIST_CODE_MODE_TRAIN, + HISI_SAS_BIST_CODE_MODE_TRAIN_DONE, + HISI_SAS_BIST_CODE_MODE_HFTP, + HISI_SAS_BIST_CODE_MODE_MFTP, + HISI_SAS_BIST_CODE_MODE_LFTP, + HISI_SAS_BIST_CODE_MODE_FIXED_DATA, +}; + struct hisi_sas_hw { int (*hw_init)(struct hisi_hba *hisi_hba); void (*setup_itct)(struct hisi_hba *hisi_hba, @@ -453,6 +474,7 @@ struct hisi_hba { u32 debugfs_bist_cnt; int debugfs_bist_enable; u32 debugfs_bist_ffe[HISI_SAS_MAX_PHYS][FFE_CFG_MAX]; + u32 debugfs_bist_fixed_code[FIXED_CODE_MAX]; /* debugfs memories */ /* Put Global AXI and RAS Register into register array */ diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 6cd9b25fbbe7..6d1e42389cd6 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -3334,21 +3334,6 @@ enum { HISI_SAS_BIST_LOOPBACK_MODE_REMOTE, }; -enum { - HISI_SAS_BIST_CODE_MODE_PRBS7 = 0, - HISI_SAS_BIST_CODE_MODE_PRBS23, - HISI_SAS_BIST_CODE_MODE_PRBS31, - HISI_SAS_BIST_CODE_MODE_JTPAT, - HISI_SAS_BIST_CODE_MODE_CJTPAT, - HISI_SAS_BIST_CODE_MODE_SCRAMBED_0, - HISI_SAS_BIST_CODE_MODE_TRAIN, - HISI_SAS_BIST_CODE_MODE_TRAIN_DONE, - HISI_SAS_BIST_CODE_MODE_HFTP, - HISI_SAS_BIST_CODE_MODE_MFTP, - HISI_SAS_BIST_CODE_MODE_LFTP, - HISI_SAS_BIST_CODE_MODE_FIXED_DATA, -}; - static const struct { int value; char *name; @@ -3966,6 +3951,16 @@ static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) hisi_hba->debugfs_bist_dentry, hisi_hba, &hisi_sas_debugfs_bist_code_mode_ops); + debugfs_create_file("fixed_code", 0600, + hisi_hba->debugfs_bist_dentry, + &hisi_hba->debugfs_bist_fixed_code[0], + &hisi_sas_debugfs_ops); + + debugfs_create_file("fixed_code_1", 0600, + hisi_hba->debugfs_bist_dentry, + &hisi_hba->debugfs_bist_fixed_code[1], + &hisi_sas_debugfs_ops); + debugfs_create_file("phy_id", 0600, hisi_hba->debugfs_bist_dentry, hisi_hba, &hisi_sas_debugfs_bist_phy_ops); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index f5d566832d6c..8522f693033f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3033,14 +3033,16 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) u32 *ffe = hisi_hba->debugfs_bist_ffe[phy_no]; u32 code_mode = hisi_hba->debugfs_bist_code_mode; u32 path_mode = hisi_hba->debugfs_bist_mode; + u32 *fix_code = &hisi_hba->debugfs_bist_fixed_code[0]; struct device *dev = hisi_hba->dev; - dev_info(dev, "BIST info:phy%d link_rate=%d code_mode=%d path_mode=%d ffe={0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x}\n", + dev_info(dev, "BIST info:phy%d link_rate=%d code_mode=%d path_mode=%d ffe={0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x} fixed_code={0x%x, 0x%x}\n", phy_no, linkrate, code_mode, path_mode, ffe[FFE_SAS_1_5_GBPS], ffe[FFE_SAS_3_0_GBPS], ffe[FFE_SAS_6_0_GBPS], ffe[FFE_SAS_12_0_GBPS], ffe[FFE_SATA_1_5_GBPS], ffe[FFE_SATA_3_0_GBPS], - ffe[FFE_SATA_6_0_GBPS]); + ffe[FFE_SATA_6_0_GBPS], fix_code[FIXED_CODE], + fix_code[FIXED_CODE_1]); mode_tmp = path_mode ? 2 : 1; if (enable) { /* some preparations before bist test */ @@ -3057,28 +3059,37 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) /* set code mode of bit test */ reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL); - reg_val &= ~(CFG_BIST_MODE_SEL_MSK | - CFG_LOOP_TEST_MODE_MSK | - CFG_RX_BIST_EN_MSK | - CFG_TX_BIST_EN_MSK | - CFG_BIST_TEST_MSK); + reg_val &= ~(CFG_BIST_MODE_SEL_MSK | CFG_LOOP_TEST_MODE_MSK | + CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK | + CFG_BIST_TEST_MSK); reg_val |= ((code_mode << CFG_BIST_MODE_SEL_OFF) | (mode_tmp << CFG_LOOP_TEST_MODE_OFF) | CFG_BIST_TEST_MSK); - hisi_sas_phy_write32(hisi_hba, phy_no, - SAS_PHY_BIST_CTRL, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL, + reg_val); /* set the bist init value */ - hisi_sas_phy_write32(hisi_hba, phy_no, - SAS_PHY_BIST_CODE, - SAS_PHY_BIST_CODE_INIT); - hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CODE1, - SAS_PHY_BIST_CODE1_INIT); + if (code_mode == HISI_SAS_BIST_CODE_MODE_FIXED_DATA) { + reg_val = hisi_hba->debugfs_bist_fixed_code[0]; + hisi_sas_phy_write32(hisi_hba, phy_no, + SAS_PHY_BIST_CODE, reg_val); + + reg_val = hisi_hba->debugfs_bist_fixed_code[1]; + hisi_sas_phy_write32(hisi_hba, phy_no, + SAS_PHY_BIST_CODE1, reg_val); + } else { + hisi_sas_phy_write32(hisi_hba, phy_no, + SAS_PHY_BIST_CODE, + SAS_PHY_BIST_CODE_INIT); + hisi_sas_phy_write32(hisi_hba, phy_no, + SAS_PHY_BIST_CODE1, + SAS_PHY_BIST_CODE1_INIT); + } mdelay(100); reg_val |= (CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK); - hisi_sas_phy_write32(hisi_hba, phy_no, - SAS_PHY_BIST_CTRL, reg_val); + hisi_sas_phy_write32(hisi_hba, phy_no, SAS_PHY_BIST_CTRL, + reg_val); /* clear error bit */ mdelay(100); From patchwork Tue Sep 1 11:13:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248844 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4135106ilg; Tue, 1 Sep 2020 04:35:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn28f8eo8i/+cna1jv2iZQTp1e1BkJZVqCZcZbaY7wUERGxh7NEElCCrmfuj7UMeu6YqzS X-Received: by 2002:a17:906:9604:: with SMTP id s4mr1154196ejx.182.1598960108952; Tue, 01 Sep 2020 04:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598960108; cv=none; d=google.com; s=arc-20160816; b=yikopTF+Q8R3NrE6fkhkczu+VN2Uo7rB3BGASzTc/4UjRWEmklmr/NQuYoLrg3N/b/ wNCv1qv0iDRxFotKS7N8mv0jt0U1Cg/pQMcWjsvcZvX9uil8vlMLCYJWgYzv3PukFYPJ McDwdG9KE4/4QwvUKf5Px/4ic7t1IXmJa4D+D9mXOrR0AcXW5D/I5snnJaRa92SEjAzC dnxVT2zAi1dxJL8LVojvF/+FuykLIbIS++zyRFodkSD3i+l1ZvFriv1/gCiRgmAn7QZi MslHQtTUjICMTb0ThzPxBKIhaapeoFPmK4sCLMsGi/jgWRS6Ur6YI0v+ALkTcdb3KXGK tVaQ== 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; bh=OV9936+q3qmoUdbrsl7HfXynOABFqlrHPyvKs28QUcI=; b=VibWb5PNRiPhm26cLMBBTbZE2nJa5jfQ8GdQG1SZ1tHQPk+U3USM8rLLgH3aWxbkjQ fyidQvU214VX4RCJBlNevb4eHrc0jzI/E2G06fszswZg7VES3U2//DtxozmQv6n4kKyo CjyfS4i9y57fWDZVUgrQ26wZaW3qraOkVixbIKRdMYTTmFg+/4Lw6m6H/aVJ7SQSpTIO 8McbpetjEM9KtIpIDBpyzBEgMaMQZPlBumSPZYey4L7ostPkiyNvRSkCbLV6DW9BOxNt +xPWSFB5woq0nAJN5iQXXtKtLuW0IivfXMQLlbhogchwr5WllmLWPH2IDqHtZkiFRACQ osdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si465390ejc.635.2020.09.01.04.35.08 for ; Tue, 01 Sep 2020 04:35:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726419AbgIALe7 (ORCPT ); Tue, 1 Sep 2020 07:34:59 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44774 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726789AbgIALea (ORCPT ); Tue, 1 Sep 2020 07:34:30 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4ADCB44067A7C855BD8A; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:17:00 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 7/8] scsi: hisi_sas: Add carriage returns to some prints Date: Tue, 1 Sep 2020 19:13:09 +0800 Message-ID: <1598958790-232272-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] 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 There is no carriage return for some prints, so add carriage returns for them. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 24 ++++++++++++------------ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 6d1e42389cd6..f5ad8e662b4b 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -335,7 +335,7 @@ static int hisi_sas_dma_map(struct hisi_hba *hisi_hba, } if (*n_elem > HISI_SAS_SGE_PAGE_CNT) { - dev_err(dev, "task prep: n_elem(%d) > HISI_SAS_SGE_PAGE_CNT", + dev_err(dev, "task prep: n_elem(%d) > HISI_SAS_SGE_PAGE_CNT\n", *n_elem); rc = -EINVAL; goto err_out_dma_unmap; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index 7922a9bb1b28..45e866cb9164 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -752,7 +752,7 @@ static int hw_init_v1_hw(struct hisi_hba *hisi_hba) rc = reset_hw_v1_hw(hisi_hba); if (rc) { - dev_err(dev, "hisi_sas_reset_hw failed, rc=%d", rc); + dev_err(dev, "hisi_sas_reset_hw failed, rc=%d\n", rc); return rc; } @@ -1166,7 +1166,7 @@ static void slot_err_v1_hw(struct hisi_hba *hisi_hba, case SAS_PROTOCOL_STP: case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: { - dev_err(dev, "slot err: SATA/STP not supported"); + dev_err(dev, "slot err: SATA/STP not supported\n"); } break; default: @@ -1218,35 +1218,35 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba, u32 info_reg = hisi_sas_read32(hisi_hba, HGC_INVLD_DQE_INFO); if (info_reg & HGC_INVLD_DQE_INFO_DQ_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq IPTT err", + dev_err(dev, "slot complete: [%d:%d] has dq IPTT err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_TYPE_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq type err", + dev_err(dev, "slot complete: [%d:%d] has dq type err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_FORCE_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq force phy err", + dev_err(dev, "slot complete: [%d:%d] has dq force phy err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_PHY_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq phy id err", + dev_err(dev, "slot complete: [%d:%d] has dq phy id err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_ABORT_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq abort flag err", + dev_err(dev, "slot complete: [%d:%d] has dq abort flag err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_IPTT_OF_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq IPTT or ICT err", + dev_err(dev, "slot complete: [%d:%d] has dq IPTT or ICT err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_SSP_ERR_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq SSP frame type err", + dev_err(dev, "slot complete: [%d:%d] has dq SSP frame type err\n", slot->cmplt_queue, slot->cmplt_queue_slot); if (info_reg & HGC_INVLD_DQE_INFO_OFL_MSK) - dev_err(dev, "slot complete: [%d:%d] has dq order frame len err", + dev_err(dev, "slot complete: [%d:%d] has dq order frame len err\n", slot->cmplt_queue, slot->cmplt_queue_slot); ts->stat = SAS_OPEN_REJECT; @@ -1294,7 +1294,7 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba, case SAS_PROTOCOL_SATA: case SAS_PROTOCOL_STP: case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: - dev_err(dev, "slot complete: SATA/STP not supported"); + dev_err(dev, "slot complete: SATA/STP not supported\n"); break; default: @@ -1417,7 +1417,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) irq_value = hisi_sas_phy_read32(hisi_hba, phy_no, CHL_INT2); if (!(irq_value & CHL_INT2_SL_RX_BC_ACK_MSK)) { - dev_err(dev, "bcast: irq_value = %x not set enable bit", + dev_err(dev, "bcast: irq_value = %x not set enable bit\n", irq_value); res = IRQ_NONE; goto end; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 043f47ba3600..68d07a4f8422 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1382,7 +1382,7 @@ static int hw_init_v2_hw(struct hisi_hba *hisi_hba) rc = reset_hw_v2_hw(hisi_hba); if (rc) { - dev_err(dev, "hisi_sas_reset_hw failed, rc=%d", rc); + dev_err(dev, "hisi_sas_reset_hw failed, rc=%d\n", rc); return rc; } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 8522f693033f..397846388e85 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -909,7 +909,7 @@ static int hw_init_v3_hw(struct hisi_hba *hisi_hba) rc = reset_hw_v3_hw(hisi_hba); if (rc) { - dev_err(dev, "hisi_sas_reset_hw failed, rc=%d", rc); + dev_err(dev, "hisi_sas_reset_hw failed, rc=%d\n", rc); return rc; } From patchwork Tue Sep 1 11:13:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 248843 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4127474ilg; Tue, 1 Sep 2020 04:23:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYZQF0fQvppToeXw7otl7c9isMzdXZSERTefwzxzOE0PbNTYcgPBfRfqiTD5rlH162wxCk X-Received: by 2002:a17:906:4c81:: with SMTP id q1mr1006270eju.72.1598959392134; Tue, 01 Sep 2020 04:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598959392; cv=none; d=google.com; s=arc-20160816; b=tQC269pX10uTL9N4NlrSL+n2GJXKZ0YdaL50YxcXJtls75/JjkWrNYU3V3wicr8Xz3 s+t0ML0ntU5cz8qLlbeOuOyj3p3NS3Ire+4ul3unbNmQOYtJHfdjFj+U0ZUcMTAdt/G9 8WVwgX0OsSNBqhDLLaGVa6arXVrD2bpzR69aoLPWYYQbwjRjNT4PvcKy8sP6Qkwnutl4 A5nd4uKmw9hlXSNxZnAGZzlMCX2wmUhQUBqjt0YyY7afOriIDecsa6f2+QvfHWw0nn8O +OFtfSiodKadzKK2vlbMpY9bx2nualTBXD98IB9WR3BWBhJVYv9KdvEWAHyz7fr+MUzz dtXA== 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; bh=i+Xip9fok79L9n/uidp9ELLvYbda6LpuchM5U2ZwLsk=; b=JD4EoeiTFqrAWzeOitGF+wk5AObXM7+63Edyb3WSfsmVNeRCN93olRCB6ajkgI4EMD 5y7AoZYq6nCy5mtldPICWjeR/kZEAXyfUYsnoMwn4coEcsSND8P7KkoO+qemEPmPwMRd WRpXGp9nNYgYmPt/t/Gh2GbNNnOTmDtmOtAr5lm2TQh6kHH3pxOhYCEV53MDsVc4Teo8 deEfSkGzM7GOO/xix1eP7IeW54bwhI2vJZlDSXHvsZmkw5Y/HSPkU/MUmoca7FKn4OT/ 8/LgDTTRqOm0BYJW+4vAJ/wS/I8/DfLnPAMQXjMlbk+qZJvVWfXRqFnhe9d6FXhvwUyy VpQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si470451ejw.434.2020.09.01.04.23.11 for ; Tue, 01 Sep 2020 04:23:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726594AbgIALWi (ORCPT ); Tue, 1 Sep 2020 07:22:38 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:47606 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726285AbgIALTu (ORCPT ); Tue, 1 Sep 2020 07:19:50 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5F488E04F8117BC3CBA4; Tue, 1 Sep 2020 19:17:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 1 Sep 2020 19:17:00 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 8/8] scsi: hisi_sas: Some very minor tidying Date: Tue, 1 Sep 2020 19:13:10 +0800 Message-ID: <1598958790-232272-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1598958790-232272-1-git-send-email-john.garry@huawei.com> References: <1598958790-232272-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing We found an extra blank line at the end of some functions, so delete them. And add spaces around some operators. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index f5ad8e662b4b..f18452942508 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1430,7 +1430,6 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) } else { hisi_sas_phy_down(hisi_hba, phy_no, 0); } - } } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 68d07a4f8422..b57177b52fac 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1202,7 +1202,7 @@ static void init_reg_v2_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0x7ffe20fe); hisi_sas_write32(hisi_hba, SAS_ECC_INTR_MSK, 0xfff00c30); for (i = 0; i < hisi_hba->queue_count; i++) - hisi_sas_write32(hisi_hba, OQ0_INT_SRC_MSK+0x4*i, 0); + hisi_sas_write32(hisi_hba, OQ0_INT_SRC_MSK + 0x4 * i, 0); hisi_sas_write32(hisi_hba, AXI_AHB_CLK_CFG, 1); hisi_sas_write32(hisi_hba, HYPER_STREAM_ID_EN_CFG, 1); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 397846388e85..87bda037303f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -596,7 +596,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, AWQOS_AWCACHE_CFG, 0xf0f0); hisi_sas_write32(hisi_hba, ARQOS_ARCACHE_CFG, 0xf0f0); for (i = 0; i < hisi_hba->queue_count; i++) - hisi_sas_write32(hisi_hba, OQ0_INT_SRC_MSK+0x4*i, 0); + hisi_sas_write32(hisi_hba, OQ0_INT_SRC_MSK + 0x4 * i, 0); hisi_sas_write32(hisi_hba, HYPER_STREAM_ID_EN_CFG, 1); @@ -1350,7 +1350,6 @@ static void prep_smp_v3_hw(struct hisi_hba *hisi_hba, hdr->cmd_table_addr = cpu_to_le64(req_dma_addr); hdr->sts_buffer_addr = cpu_to_le64(hisi_sas_status_buf_addr_dma(slot)); - } static void prep_ata_v3_hw(struct hisi_hba *hisi_hba, @@ -1456,7 +1455,6 @@ static void prep_abort_v3_hw(struct hisi_hba *hisi_hba, /* dw7 */ hdr->dw7 = cpu_to_le32(tag_to_abort << CMD_HDR_ABORT_IPTT_OFF); hdr->transfer_tags = cpu_to_le32(slot->idx); - } static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)