From patchwork Thu Aug 10 16:09:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109837 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp2548986qge; Thu, 10 Aug 2017 08:50:20 -0700 (PDT) X-Received: by 10.98.103.145 with SMTP id t17mr4449933pfj.13.1502380219607; Thu, 10 Aug 2017 08:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380219; cv=none; d=google.com; s=arc-20160816; b=eZX9Bx1iyFKV9bMg1sTXrw3TqyRCEmwZB9GdrknZMBI5sYYvgyzkMs6ynfzhbfgBon 18bce2i87tAxi/uBzR2uccF4a+F2e5mKI05+jfleR++Xpn5gP1bgcDEU93FQGUjIubGE mzw58Epz8r0Q65fG22tfCJnhWyJMOb0BBBBsF8Cv8OFuWZksKyAfKf4O/UFCUQZNjXfm xWKX1h2inEwj9qHyYAWnfEWgO0Lq2WzVIVJhGFkarO6DkZIOKyDmMPzRGoT4O7Afp4Qv a3swdIdO68kMURXfXQGvHyxezfd9gVB1R6Dr3h8BgJsI3LIilFOIS4HzKm0rrJRlEZYD Etcw== 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=c2w8RR6y4g6sn+57C0fTc7WLGcFZq6SbNPs0QqTyCGE=; b=Vj7hTP5r8Htecy88/fwRBGbP8evMS+8ucli4AxsIC/eNY66N9wgyB1oS2FBL7TP/TL ILzE4X7a4gHg6+0+NWUS+EjKYQh7klh6FTidJDvs/yeAPJhASbICGxoxWaijv+AKDxWd JvJGjmcC7Or5dHuxEwM+yEtN9t8/p2dzzmGFHhXFKWXUBeg5+GWVkGbmW4phGc2/lKT/ s7j+KzV7su0Bcw4StD6OehdpcKccN1hoNtyhnmu6Pg2K16iU9UmB/4shAQaiJAZUpFhK ojToDwFiOn9bF2NFJO2Q4brv6DKDGeoZf0YJ9lPe/a8NCpUbASAENtNeJ0KTu0xAFuq4 mv1w== 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 q83si3606018pfa.305.2017.08.10.08.50.19; Thu, 10 Aug 2017 08:50: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 S1753128AbdHJPtH (ORCPT + 25 others); Thu, 10 Aug 2017 11:49:07 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3049 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752890AbdHJPmu (ORCPT ); Thu, 10 Aug 2017 11:42:50 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38525; Thu, 10 Aug 2017 23:42:47 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:35 +0800 From: John Garry To: , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 01/19] scsi: hisi_sas: fix reset and port ID refresh issues Date: Fri, 11 Aug 2017 00:09:26 +0800 Message-ID: <1502381384-219889-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EF8.004D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c25b3dd54b58f07be3aa18b8f289d6b7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan This patch provides fixes for the following issues: 1. Fix issue of controller reset required to send commands. For reset process, it may be required to send commands to the controller, but not during soft reset. So add HISI_SAS_NOT_ACCEPT_CMD_BIT to prevent executing a task during this period. 2. Send a broadcast event in rescan topology to detect any topology changes during reset. 3. Previously it was not ensured that libsas has processed the PHY up and down events after reset. Potentially this could cause an issue that we still process the PHY event after reset. So resolve this by flushing shot workqueue in LLDD reset. 4. Port ID requires refresh after reset. The port ID generated after reset is not guaranteed to be the same as before reset, so it needs to be refreshed for each device's ITCT. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 4 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 152 ++++++++++++++++++++++----------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 36 ++++---- 3 files changed, 118 insertions(+), 74 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index a722f2b..3c4defa 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -33,6 +33,7 @@ #define HISI_SAS_MAX_ITCT_ENTRIES 2048 #define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES #define HISI_SAS_RESET_BIT 0 +#define HISI_SAS_REJECT_CMD_BIT 1 #define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer)) #define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table)) @@ -201,6 +202,7 @@ struct hisi_sas_hw { void (*dereg_device)(struct hisi_hba *hisi_hba, struct domain_device *device); int (*soft_reset)(struct hisi_hba *hisi_hba); + u32 (*get_phys_state)(struct hisi_hba *hisi_hba); int max_command_entries; int complete_hdr_size; }; @@ -408,6 +410,4 @@ extern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, struct hisi_sas_slot *slot); extern void hisi_sas_init_mem(struct hisi_hba *hisi_hba); -extern void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, - u32 state); #endif diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 4022c3f..bd1d619 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -433,7 +433,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_dq *dq = sas_dev->dq; - if (unlikely(test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags))) + if (unlikely(test_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags))) return -EINVAL; /* protect task_prep and start_delivery sequence */ @@ -967,37 +967,117 @@ static int hisi_sas_debug_issue_ssp_tmf(struct domain_device *device, sizeof(ssp_task), tmf); } +static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba, + struct asd_sas_port *sas_port, enum sas_linkrate linkrate) +{ + struct hisi_sas_device *sas_dev; + struct domain_device *device; + int i; + + for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) { + sas_dev = &hisi_hba->devices[i]; + device = sas_dev->sas_device; + if ((sas_dev->dev_type == SAS_PHY_UNUSED) + || !device || (device->port != sas_port)) + continue; + + hisi_hba->hw->free_device(hisi_hba, sas_dev); + + /* Update linkrate of directly attached device. */ + if (!device->parent) + device->linkrate = linkrate; + + hisi_hba->hw->setup_itct(hisi_hba, sas_dev); + } +} + +static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, + u32 state) +{ + struct sas_ha_struct *sas_ha = &hisi_hba->sha; + struct asd_sas_port *_sas_port = NULL; + int phy_no; + + for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + struct asd_sas_phy *sas_phy = &phy->sas_phy; + struct asd_sas_port *sas_port = sas_phy->port; + struct hisi_sas_port *port = to_hisi_sas_port(sas_port); + bool do_port_check = !!(_sas_port != sas_port); + + if (!sas_phy->phy->enabled) + continue; + + /* Report PHY state change to libsas */ + if (state & (1 << phy_no)) { + if (do_port_check && sas_port) { + struct domain_device *dev = sas_port->port_dev; + + _sas_port = sas_port; + port->id = phy->port_id; + hisi_sas_refresh_port_id(hisi_hba, + sas_port, sas_phy->linkrate); + + if (DEV_IS_EXPANDER(dev->dev_type)) + sas_ha->notify_port_event(sas_phy, + PORTE_BROADCAST_RCVD); + } + } else if (old_state & (1 << phy_no)) + /* PHY down but was up before */ + hisi_sas_phy_down(hisi_hba, phy_no, 0); + + } + + drain_workqueue(hisi_hba->shost->work_q); +} + static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) { + struct sas_ha_struct *sas_ha = &hisi_hba->sha; + struct device *dev = hisi_hba->dev; + struct Scsi_Host *shost = hisi_hba->shost; + u32 old_state, state; + unsigned long flags; int rc; if (!hisi_hba->hw->soft_reset) return -1; - if (!test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) { - struct device *dev = hisi_hba->dev; - struct sas_ha_struct *sas_ha = &hisi_hba->sha; - unsigned long flags; + if (test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) + return -1; - dev_dbg(dev, "controller reset begins!\n"); - scsi_block_requests(hisi_hba->shost); - rc = hisi_hba->hw->soft_reset(hisi_hba); - if (rc) { - dev_warn(dev, "controller reset failed (%d)\n", rc); - goto out; - } - spin_lock_irqsave(&hisi_hba->lock, flags); - hisi_sas_release_tasks(hisi_hba); - spin_unlock_irqrestore(&hisi_hba->lock, flags); + dev_dbg(dev, "controller resetting...\n"); + old_state = hisi_hba->hw->get_phys_state(hisi_hba); - sas_ha->notify_ha_event(sas_ha, HAE_RESET); - dev_dbg(dev, "controller reset successful!\n"); - } else - return -1; + scsi_block_requests(shost); + set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); + rc = hisi_hba->hw->soft_reset(hisi_hba); + if (rc) { + dev_warn(dev, "controller reset failed (%d)\n", rc); + clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); + goto out; + } + spin_lock_irqsave(&hisi_hba->lock, flags); + hisi_sas_release_tasks(hisi_hba); + spin_unlock_irqrestore(&hisi_hba->lock, flags); + + sas_ha->notify_ha_event(sas_ha, HAE_RESET); + clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); + + /* Init and wait for PHYs to come up and all libsas event finished. */ + hisi_hba->hw->phys_init(hisi_hba); + msleep(1000); + drain_workqueue(hisi_hba->wq); + drain_workqueue(shost->work_q); + + state = hisi_hba->hw->get_phys_state(hisi_hba); + hisi_sas_rescan_topology(hisi_hba, old_state, state); + dev_dbg(dev, "controller reset complete\n"); out: - scsi_unblock_requests(hisi_hba->shost); + scsi_unblock_requests(shost); clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); + return rc; } @@ -1241,7 +1321,7 @@ static int hisi_sas_query_task(struct sas_task *task) int dlvry_queue_slot, dlvry_queue, n_elem = 0, rc, slot_idx; unsigned long flags, flags_dq; - if (unlikely(test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags))) + if (unlikely(test_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags))) return -EINVAL; if (!device->port) @@ -1437,36 +1517,6 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy) } EXPORT_SYMBOL_GPL(hisi_sas_phy_down); -void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, - u32 state) -{ - struct sas_ha_struct *sas_ha = &hisi_hba->sha; - int phy_no; - - for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { - struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; - struct asd_sas_phy *sas_phy = &phy->sas_phy; - struct asd_sas_port *sas_port = sas_phy->port; - struct domain_device *dev; - - if (sas_phy->enabled) { - /* Report PHY state change to libsas */ - if (state & (1 << phy_no)) - continue; - - if (old_state & (1 << phy_no)) - /* PHY down but was up before */ - hisi_sas_phy_down(hisi_hba, phy_no, 0); - } - if (!sas_port) - continue; - dev = sas_port->port_dev; - - if (DEV_IS_EXPANDER(dev->dev_type)) - sas_ha->notify_phy_event(sas_phy, PORTE_BROADCAST_RCVD); - } -} -EXPORT_SYMBOL_GPL(hisi_sas_rescan_topology); struct scsi_transport_template *hisi_sas_stt; EXPORT_SYMBOL_GPL(hisi_sas_stt); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 2bfea70..a6be33c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1364,8 +1364,15 @@ static void start_phys_v2_hw(struct hisi_hba *hisi_hba) { int i; - for (i = 0; i < hisi_hba->n_phy; i++) + for (i = 0; i < hisi_hba->n_phy; i++) { + struct hisi_sas_phy *phy = &hisi_hba->phy[i]; + struct asd_sas_phy *sas_phy = &phy->sas_phy; + + if (!sas_phy->phy->enabled) + continue; + start_phy_v2_hw(hisi_hba, i); + } } static void phys_init_v2_hw(struct hisi_hba *hisi_hba) @@ -3383,14 +3390,16 @@ static void interrupt_disable_v2_hw(struct hisi_hba *hisi_hba) synchronize_irq(platform_get_irq(pdev, i)); } + +static u32 get_phys_state_v2_hw(struct hisi_hba *hisi_hba) +{ + return hisi_sas_read32(hisi_hba, PHY_STATE); +} + static int soft_reset_v2_hw(struct hisi_hba *hisi_hba) { struct device *dev = hisi_hba->dev; - u32 old_state, state; int rc, cnt; - int phy_no; - - old_state = hisi_sas_read32(hisi_hba, PHY_STATE); interrupt_disable_v2_hw(hisi_hba); hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, 0x0); @@ -3425,22 +3434,6 @@ static int soft_reset_v2_hw(struct hisi_hba *hisi_hba) phys_reject_stp_links_v2_hw(hisi_hba); - /* Re-enable the PHYs */ - for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { - struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; - struct asd_sas_phy *sas_phy = &phy->sas_phy; - - if (sas_phy->enabled) - start_phy_v2_hw(hisi_hba, phy_no); - } - - /* Wait for the PHYs to come up and read the PHY state */ - msleep(1000); - - state = hisi_sas_read32(hisi_hba, PHY_STATE); - - hisi_sas_rescan_topology(hisi_hba, old_state, state); - return 0; } @@ -3468,6 +3461,7 @@ static int soft_reset_v2_hw(struct hisi_hba *hisi_hba) .max_command_entries = HISI_SAS_COMMAND_ENTRIES_V2_HW, .complete_hdr_size = sizeof(struct hisi_sas_complete_v2_hdr), .soft_reset = soft_reset_v2_hw, + .get_phys_state = get_phys_state_v2_hw, }; static int hisi_sas_v2_probe(struct platform_device *pdev) From patchwork Thu Aug 10 16:09:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109835 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2567932obb; Thu, 10 Aug 2017 08:49:14 -0700 (PDT) X-Received: by 10.99.115.28 with SMTP id o28mr7692374pgc.183.1502380154611; Thu, 10 Aug 2017 08:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380154; cv=none; d=google.com; s=arc-20160816; b=zGjiwtrPBgZ0dwfowinKX38AKCazgRnfFPTvxJ9tw9BtUGrw+brG7AQC0y1Icx+qED M2YoVLebdTmIYkKTlXSS6UV2+dbm0DoM/8KBWSHZBogFHBLDMdNpvs3uBzfEq0XBX7Em 2+PkMAc7a8/Gj/ll2fFOlZlH9ziZLGMbN6NT6Ft2fKsY82Cw3YKPcBmRuUuxVBJ5J17x z+GfS4B6rT5l7UYKjsewzDibTz1LrATiBlutjEWaNyu+eZK1JRN1leqO6UO3uCsCDdjC YkuSEM4GO9DCI+HS/J82TPAJz6uoztvb2apsJjPda/dXNrKPfmSGrJWkaDKCDg5XudjI oIgA== 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=Uh6Tao+8laHXJ0HQVqktJnhJZ19lrrI5fRVyWgxZBrE=; b=Gzku4ttRpay76qJsxy+QTXdLPtgTe561Fl0OUuzZ2NwlFphOuXs+0VCdy/5LnXsf3w x9uifhUBEYVSoEuFd/qlimugdNps5adZgSLtnOUO8h+iHd2xrBpbUGF9X1JSFp4su6ob vgCFxc8dwC8vTknjmOgHWLsXrfjHBpMM2e8Vuo3vKQMDFmCR42XedFs6IU03MAMeTAim N+wKlXYnlg9qa9UVD9xZfraLOu5HSk2EcJWfUh7eA2lxFPLUUcuNEUiQWuMD0RmnOX3g 42fLgfb2phOUhzovu0dfn//tP/ndvd95LNIlkOK5Km0I5FywF/gKLuG5aXjZ1srXPcMc P2zA== 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 g127si4089705pgc.537.2017.08.10.08.49.14; Thu, 10 Aug 2017 08:49: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 S1753330AbdHJPtM (ORCPT + 25 others); Thu, 10 Aug 2017 11:49:12 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3050 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752891AbdHJPmu (ORCPT ); Thu, 10 Aug 2017 11:42:50 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38521; Thu, 10 Aug 2017 23:42:46 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:36 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 03/19] scsi: hisi_sas: fix v2 hw underflow residual value Date: Fri, 11 Aug 2017 00:09:28 +0800 Message-ID: <1502381384-219889-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EF7.002C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 06bfd8345bd6354c443294e6ed437730 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen The value dw0 is the residual bytes when UNDERFLOW error happens, but we filled the residual with the value of dw3 before. So change the residual from dw3 to dw0. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 8c504b4..a762b25 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1972,7 +1972,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, } case DMA_RX_DATA_LEN_UNDERFLOW: { - ts->residual = dma_rx_err_type; + ts->residual = trans_tx_fail_type; ts->stat = SAS_DATA_UNDERRUN; break; } @@ -2098,7 +2098,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, } case DMA_RX_DATA_LEN_UNDERFLOW: { - ts->residual = dma_rx_err_type; + ts->residual = trans_tx_fail_type; ts->stat = SAS_DATA_UNDERRUN; break; } From patchwork Thu Aug 10 16:09:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109820 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2562237obb; Thu, 10 Aug 2017 08:44:57 -0700 (PDT) X-Received: by 10.98.155.153 with SMTP id e25mr12879362pfk.109.1502379897147; Thu, 10 Aug 2017 08:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502379897; cv=none; d=google.com; s=arc-20160816; b=HTyXvdmuouAuminfNdZEm7qGk26401Lmkks/I4NKst75Ob0FRJV3U5ldyWPtN3ont7 DOKfHN5w/Vuoe2vMr2ScPU8OBn9ajkkZw4TppS5QqEGIJUEEpfPwKpwh6eg2OLgd3M2E uF2iYxerVYNQrTfITZVJ7C/fQ/nxo6DMGwEfvxDP257mvYe0FDipyTZFsVsXKC6yEQP1 C0YvhgyUnmLbkueW+0tc10/8XY3+88sNpo8fp1L5Kr8EBxkzv37k1tTqNOcx26ozh3De tHa08fvkVEGBBE+kpgaiT07wj1QfNntKivimvPtl3omt7+nD/uHGCrFWJCBv2LAAVoZL DIhA== 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=p1QpaoCZg+YLExka8qqEIPGl7PMVy9WyoE1qQS1yqyA=; b=H7QMmbnw55gFEdiAE89bkuyW56CbQHsUyI9bNb7ZFxlz4aLfYHBv2eJW4/yIFvygks tFhwD4m0LRvbSEjHeFBiZJ9mYg7+LiXtTbBrbYU0pmO5zhAT7yNrPEN7uVKCINZDOhgc nivai1u7qpAFHtOJGIvpx5OSsFdHclyChEbt1KVY2YejapcNGzNc4MIuA1qSnBWf7KMQ R+Yab/no+ze8YzI/KL6k70tc4coDPZP4W+s6mWGtoZ4l1YmiwxQJBM1FzdZCmuyt2Fl9 ouzCn8pnk6uvXHqw1UEzD1YTxuohFxjP07Px7C/zF4zeQJ6NrSORwbIYHeIkm5X0dvR4 LiXg== 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 r2si4621882plj.471.2017.08.10.08.44.56; Thu, 10 Aug 2017 08:44:57 -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 S1752986AbdHJPmz (ORCPT + 25 others); Thu, 10 Aug 2017 11:42:55 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3046 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752889AbdHJPmu (ORCPT ); Thu, 10 Aug 2017 11:42:50 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38523; Thu, 10 Aug 2017 23:42:47 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:36 +0800 From: John Garry To: , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 04/19] scsi: hisi_sas: add v2 hw DFX feature Date: Fri, 11 Aug 2017 00:09:29 +0800 Message-ID: <1502381384-219889-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EF7.00BA, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e9838471e9e8943e7cfc64e8e957e318 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan Add DFX feature for v2 hw. We are adding support for the following errors: - loss_of_dword_sync_count - invalid_dword_count - phy_reset_problem_count - running_disparity_error_count Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 + drivers/scsi/hisi_sas/hisi_sas_main.c | 7 ++++++- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 3c4defa..ef2238c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -193,6 +193,7 @@ struct hisi_sas_hw { void (*phy_enable)(struct hisi_hba *hisi_hba, int phy_no); void (*phy_disable)(struct hisi_hba *hisi_hba, int phy_no); void (*phy_hard_reset)(struct hisi_hba *hisi_hba, int phy_no); + void (*get_events)(struct hisi_hba *hisi_hba, int phy_no); void (*phy_set_linkrate)(struct hisi_hba *hisi_hba, int phy_no, struct sas_phy_linkrates *linkrates); enum sas_linkrate (*phy_get_max_linkrate)(void); diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index bd1d619..aaa7296 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -764,7 +764,12 @@ static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func, case PHY_FUNC_SET_LINK_RATE: hisi_hba->hw->phy_set_linkrate(hisi_hba, phy_no, funcdata); break; - + case PHY_FUNC_GET_EVENTS: + if (hisi_hba->hw->get_events) { + hisi_hba->hw->get_events(hisi_hba, phy_no); + break; + } + /* fallthru */ case PHY_FUNC_RELEASE_SPINUP_HOLD: default: return -EOPNOTSUPP; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index a762b25..41e8033 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -256,6 +256,8 @@ #define LINK_DFX2_RCVR_HOLD_STS_MSK (0x1 << LINK_DFX2_RCVR_HOLD_STS_OFF) #define LINK_DFX2_SEND_HOLD_STS_OFF 10 #define LINK_DFX2_SEND_HOLD_STS_MSK (0x1 << LINK_DFX2_SEND_HOLD_STS_OFF) +#define SAS_ERR_CNT4_REG (PORT_BASE + 0x290) +#define SAS_ERR_CNT6_REG (PORT_BASE + 0x298) #define PHY_CTRL_RDY_MSK (PORT_BASE + 0x2b0) #define PHYCTRL_NOT_RDY_MSK (PORT_BASE + 0x2b4) #define PHYCTRL_DWS_RESET_MSK (PORT_BASE + 0x2b8) @@ -1360,6 +1362,25 @@ static void phy_hard_reset_v2_hw(struct hisi_hba *hisi_hba, int phy_no) start_phy_v2_hw(hisi_hba, phy_no); } +static void phy_get_events_v2_hw(struct hisi_hba *hisi_hba, int phy_no) +{ + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + struct asd_sas_phy *sas_phy = &phy->sas_phy; + struct sas_phy *sphy = sas_phy->phy; + u32 err4_reg_val, err6_reg_val; + + /* loss dword syn, phy reset problem */ + err4_reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SAS_ERR_CNT4_REG); + + /* disparity err, invalid dword */ + err6_reg_val = hisi_sas_phy_read32(hisi_hba, phy_no, SAS_ERR_CNT6_REG); + + sphy->loss_of_dword_sync_count += (err4_reg_val >> 16) & 0xFFFF; + sphy->phy_reset_problem_count += err4_reg_val & 0xFFFF; + sphy->invalid_dword_count += (err6_reg_val & 0xFF0000) >> 16; + sphy->running_disparity_error_count += err6_reg_val & 0xFF; +} + static void start_phys_v2_hw(struct hisi_hba *hisi_hba) { int i; @@ -3457,6 +3478,7 @@ static int soft_reset_v2_hw(struct hisi_hba *hisi_hba) .phy_enable = enable_phy_v2_hw, .phy_disable = disable_phy_v2_hw, .phy_hard_reset = phy_hard_reset_v2_hw, + .get_events = phy_get_events_v2_hw, .phy_set_linkrate = phy_set_linkrate_v2_hw, .phy_get_max_linkrate = phy_get_max_linkrate_v2_hw, .max_command_entries = HISI_SAS_COMMAND_ENTRIES_V2_HW, From patchwork Thu Aug 10 16:09:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109836 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2568212obb; Thu, 10 Aug 2017 08:49:27 -0700 (PDT) X-Received: by 10.99.113.14 with SMTP id m14mr12097003pgc.185.1502380167353; Thu, 10 Aug 2017 08:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380167; cv=none; d=google.com; s=arc-20160816; b=Z3wuvsdw8N8VV/FHMqyJC+lUNqsNhuJuj7LkbwesVaTyDkIxfysU+iioEAaU3gln3J EU4iyzJHHcWO82ZSGev856xL5yZ5dct2Ysu97Qu1Ie4Ve/xecAtcnwL9/6rqsEbiTaHx a9bU5osMDuwFWYWs/iyps+GjqVrZEMe1cGUSVmCZWlWAPAysH5Sm909Y5xo7sXvkCr5u eDmjEoJJOvPH0ikyC7+OAk9p7V8AzuTZ4ufkTRbTw9kqi0KUuiwJm0V3n04hzgMJAjcs vPO3GqBd4v8B2zBJ4zQHxjAs8drda5TWye1Oh+3ebiufPTef4X7l7G3CguDfnhkWkyfc Hjfw== 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=fL04EGwzh8u9DcOySEVIINaaopjqnEDu56JzhdQEIVE=; b=P1K8HHFsN4mjxLWvmEdwTJ5bSWtDwvfe54xpdeOvFG/HnSCrYmaXqJ38Z9O8B0kTLJ EFEG3fOHY3fdDPOhslOwVpVD2JbGmQjncx1t0V/udn7p0h6AQVt1EObxHDEz15YRi5ZE 5ykxZD28GWKdCGyMIBP3ObYGPJoLpgWJRGn3amCpHMpFp8fqcpCyElTOYyiTg8Gfrm7+ SzIEkkLAd/89bKjoHuRs3BWfMHbVyn3FtVViKYfVzYJh2tm6+pbUe0z+yGOKqaP0nRCp pH079iFhECzsU16aE52cij9BM4W0yrYNxVl0mk/T49VSQic2RV+Pz8TKTKgbUfc7vVm4 PpVw== 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 w5si4115861pgt.227.2017.08.10.08.49.27; Thu, 10 Aug 2017 08:49:27 -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 S1753281AbdHJPtK (ORCPT + 25 others); Thu, 10 Aug 2017 11:49:10 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3048 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752894AbdHJPmu (ORCPT ); Thu, 10 Aug 2017 11:42:50 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38519; Thu, 10 Aug 2017 23:42:46 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:37 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 06/19] scsi: hisi_sas: remove repeated device config in v2 hw Date: Fri, 11 Aug 2017 00:09:31 +0800 Message-ID: <1502381384-219889-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.598C7EF8.005E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d8a42df23d008ae44084f32cce45f591 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen This patch removes some repeated configurations: (1) The device id of the device is already set in the alloc function, so we don't need to modify in free device function. (2) Field dev_type and dev_status are configured in hisi_sas_dev_gone(), so there is no need for repeated config in free_device_v3_hw. 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_v3_hw.c | 2 -- 2 files changed, 5 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 aaa7296..81ad6cd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -716,7 +716,6 @@ static void hisi_sas_dev_gone(struct domain_device *device) struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct device *dev = hisi_hba->dev; - int dev_id = sas_dev->device_id; dev_info(dev, "found dev[%d:%x] is gone\n", sas_dev->device_id, sas_dev->dev_type); @@ -729,9 +728,7 @@ static void hisi_sas_dev_gone(struct domain_device *device) hisi_hba->hw->free_device(hisi_hba, sas_dev); device->lldd_dev = NULL; memset(sas_dev, 0, sizeof(*sas_dev)); - sas_dev->device_id = dev_id; sas_dev->dev_type = SAS_PHY_UNUSED; - sas_dev->dev_status = HISI_SAS_DEV_NORMAL; } static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 83d2dca..dc5c551 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -578,8 +578,6 @@ static void free_device_v3_hw(struct hisi_hba *hisi_hba, memset(itct, 0, sizeof(struct hisi_sas_itct)); hisi_sas_write32(hisi_hba, ENT_INT_SRC3, ENT_INT_SRC3_ITC_INT_MSK); - hisi_hba->devices[dev_id].dev_type = SAS_PHY_UNUSED; - hisi_hba->devices[dev_id].dev_status = HISI_SAS_DEV_NORMAL; /* clear the itct */ hisi_sas_write32(hisi_hba, ITCT_CLR, 0); From patchwork Thu Aug 10 16:09:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109831 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2566158obb; Thu, 10 Aug 2017 08:47:54 -0700 (PDT) X-Received: by 10.98.14.143 with SMTP id 15mr5847976pfo.72.1502380074260; Thu, 10 Aug 2017 08:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380074; cv=none; d=google.com; s=arc-20160816; b=MTgTaj4rGyl9L1W5LKZAmdQEA7OU4s46PxO4xHk7Qi0qJllJacvyZKhP8NiNWqWilY 6gomTcq7UrdJN5QSgnNA+68Twh4do9BMnxQFM8emV8Tm9CloGvDyEeY1Z+rxzmohJulC 3FaxtDDxixyewgGqekj8AyfCNrHKgoWDBvDdWAtr/2vpz0vkhYNVQCh8Ptwu+95RdQV8 qwrs80/8k4AchNMNzUSyHsElncu3G7+y0X76aznn8sGySqsnBiSqGFb0JxJEgNhe40tr F55e8xerusqQvsuHYC9nLHyZDUzEgg8GvBBRXfARJzOzUbJfj2yoWynU2BszlUwl/vb1 T7bw== 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=kCO8eQhvL2XSoYFE6GZ5serl4nEtLmsgJme+p1EJGnk=; b=jkyTYAXc7yKbRiZAkitMb9SeKRIM7ZxdWbGnSWt+qbBC7q+BKyDSwvQkAfN8kSoQWp vp9l8b/bI1r9oqmABxbTIZRN9xTpSe3ObBff8HpHr88focSPkAPsn9iI1XwWjdlaf25u bOdIsYOBSB45A+RijPTzVHFib69LWhPP20quVMdfbsfUuFdZ9dWrD+AkVXp0DgdxT7X8 z2jwEKQUZXuTyzSXiLwqzshdqyT5s/TvX3wVEDolTgNVmpv//0oSK/zZIxzk1qB2KZ1A OjiOqNBq6c8/9xt3Vy2hlLTZJ5LsYJGZYJQmdywQm+VkdYGrn58GTv5E2BNgzFOYe8Fi i3Dw== 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 o2si4629926pli.507.2017.08.10.08.47.53; Thu, 10 Aug 2017 08:47: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 S1753320AbdHJPrv (ORCPT + 25 others); Thu, 10 Aug 2017 11:47:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3054 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752902AbdHJPmv (ORCPT ); Thu, 10 Aug 2017 11:42:51 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38526; Thu, 10 Aug 2017 23:42:48 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:37 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 07/19] scsi: hisi_sas: add irq and tasklet cleanup in v2 hw Date: Fri, 11 Aug 2017 00:09:32 +0800 Message-ID: <1502381384-219889-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.598C7EF8.00CC, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0391ab8a1840523a3439aef8481adc1f Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen This patch adds support to clean-up allocated IRQs and kill tasklets when probe fails and for driver removal. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 96 +++++++++++++++++----------------- 1 file changed, 49 insertions(+), 47 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 bcbc16e..9eea0b4 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3290,97 +3290,92 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba) { struct platform_device *pdev = hisi_hba->platform_dev; struct device *dev = &pdev->dev; - int i, irq, rc, irq_map[128]; - + int irq, rc, irq_map[128]; + int i, phy_no, fatal_no, queue_no, k; for (i = 0; i < 128; i++) irq_map[i] = platform_get_irq(pdev, i); for (i = 0; i < HISI_SAS_PHY_INT_NR; i++) { - int idx = i; - - irq = irq_map[idx + 1]; /* Phy up/down is irq1 */ - if (!irq) { - dev_err(dev, "irq init: fail map phy interrupt %d\n", - idx); - return -ENOENT; - } - + irq = irq_map[i + 1]; /* Phy up/down is irq1 */ rc = devm_request_irq(dev, irq, phy_interrupts[i], 0, DRV_NAME " phy", hisi_hba); if (rc) { dev_err(dev, "irq init: could not request " "phy interrupt %d, rc=%d\n", irq, rc); - return -ENOENT; + rc = -ENOENT; + goto free_phy_int_irqs; } } - for (i = 0; i < hisi_hba->n_phy; i++) { - struct hisi_sas_phy *phy = &hisi_hba->phy[i]; - int idx = i + 72; /* First SATA interrupt is irq72 */ - - irq = irq_map[idx]; - if (!irq) { - dev_err(dev, "irq init: fail map phy interrupt %d\n", - idx); - return -ENOENT; - } + for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) { + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + irq = irq_map[phy_no + 72]; rc = devm_request_irq(dev, irq, sata_int_v2_hw, 0, DRV_NAME " sata", phy); if (rc) { dev_err(dev, "irq init: could not request " "sata interrupt %d, rc=%d\n", irq, rc); - return -ENOENT; + rc = -ENOENT; + goto free_sata_int_irqs; } } - for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++) { - int idx = i; - - irq = irq_map[idx + 81]; - if (!irq) { - dev_err(dev, "irq init: fail map fatal interrupt %d\n", - idx); - return -ENOENT; - } - - rc = devm_request_irq(dev, irq, fatal_interrupts[i], 0, + for (fatal_no = 0; fatal_no < HISI_SAS_FATAL_INT_NR; fatal_no++) { + irq = irq_map[fatal_no + 81]; + rc = devm_request_irq(dev, irq, fatal_interrupts[fatal_no], 0, DRV_NAME " fatal", hisi_hba); if (rc) { dev_err(dev, "irq init: could not request fatal interrupt %d, rc=%d\n", irq, rc); - return -ENOENT; + rc = -ENOENT; + goto free_fatal_int_irqs; } } - for (i = 0; i < hisi_hba->queue_count; i++) { - int idx = i + 96; /* First cq interrupt is irq96 */ - struct hisi_sas_cq *cq = &hisi_hba->cq[i]; + for (queue_no = 0; queue_no < hisi_hba->queue_count; queue_no++) { + struct hisi_sas_cq *cq = &hisi_hba->cq[queue_no]; struct tasklet_struct *t = &cq->tasklet; - irq = irq_map[idx]; - if (!irq) { - dev_err(dev, - "irq init: could not map cq interrupt %d\n", - idx); - return -ENOENT; - } + irq = irq_map[queue_no + 96]; rc = devm_request_irq(dev, irq, cq_interrupt_v2_hw, 0, - DRV_NAME " cq", &hisi_hba->cq[i]); + DRV_NAME " cq", cq); if (rc) { dev_err(dev, "irq init: could not request cq interrupt %d, rc=%d\n", irq, rc); - return -ENOENT; + rc = -ENOENT; + goto free_cq_int_irqs; } tasklet_init(t, cq_tasklet_v2_hw, (unsigned long)cq); } return 0; + +free_cq_int_irqs: + for (k = 0; k < queue_no; k++) { + struct hisi_sas_cq *cq = &hisi_hba->cq[k]; + + free_irq(irq_map[k + 96], cq); + tasklet_kill(&cq->tasklet); + } +free_fatal_int_irqs: + for (k = 0; k < fatal_no; k++) + free_irq(irq_map[k + 81], hisi_hba); +free_sata_int_irqs: + for (k = 0; k < phy_no; k++) { + struct hisi_sas_phy *phy = &hisi_hba->phy[k]; + + free_irq(irq_map[k + 72], phy); + } +free_phy_int_irqs: + for (k = 0; k < i; k++) + free_irq(irq_map[k + 1], hisi_hba); + return rc; } static int hisi_sas_v2_init(struct hisi_hba *hisi_hba) @@ -3518,10 +3513,17 @@ 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; + int i; if (timer_pending(&hisi_hba->timer)) del_timer(&hisi_hba->timer); + for (i = 0; i < hisi_hba->queue_count; i++) { + struct hisi_sas_cq *cq = &hisi_hba->cq[i]; + + tasklet_kill(&cq->tasklet); + } + return hisi_sas_remove(pdev); } From patchwork Thu Aug 10 16:09:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109830 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2566134obb; Thu, 10 Aug 2017 08:47:52 -0700 (PDT) X-Received: by 10.84.218.71 with SMTP id f7mr14146069plm.129.1502380072784; Thu, 10 Aug 2017 08:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380072; cv=none; d=google.com; s=arc-20160816; b=MTiAACgXFIOku9P3rzAkYDWM1FZHMQSEtNGgxtLIF2K83qSKOvg1qSPuNLw/WaHLHm Bhmctiet7KM9ydxzwIbnD+bJoX5+RlFMCnVdMScw6ZwZH8gYQpUZTl7NK5zrH9an1GlI /FvMehFWYQgN8hIod6Qgbuj3W8Hbaj6knFwc52QwCioOFHMB1g7L6GzV9mpLonyMqc1Q knyfqKO/4sGLjbXYtLmsSxC+fYdeYsKC8Nj+bnWSYW+qm2x+Cv91xkE+ONQBK52iLjau gaitw3UgQ+9Q9GwCxBdw7GribPCDEz7Ne5kP/5dVUWXtERmcfGHZKvboWxmqz4EG9LyC xNqw== 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=OaApO6HFXZbpvhUT7Tg0Erf3vLPCITfgCHsx8AEQPC0=; b=OtBWrpfFCXIHm9gA8AxF58yNkG57VC4UP6kScrpu0BMq1GcND8KjhOP7ILUycM394S UIF6PWPUL9NNPaIT1Q3sUvhOmcA1DsOVYNYWMw21ovBlQCbEHgAmGc8gfu3zDMoBTWbY 1qmHwZZQPtkdNvahhm/J20BSW1Xtl+ls1TdgZO5q11U2qR2jNwquRV1prjIzz/A/XL+g 1+PzVgautdxivO8ffjFQ2H8hfMdH8C1BiB0msMGiaW3l5stxWwZYwcadu8Yu8Me5BNz4 be6Zs23izUzKVmCrTFWi+bqWU9ZhvBBCz5QEENwwURKao7u2ZwM8qWfxlTTInL86aqGU momw== 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 l6si4709986plk.441.2017.08.10.08.47.52; Thu, 10 Aug 2017 08:47:52 -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 S1753077AbdHJPru (ORCPT + 25 others); Thu, 10 Aug 2017 11:47:50 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3057 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752904AbdHJPmv (ORCPT ); Thu, 10 Aug 2017 11:42:51 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38533; Thu, 10 Aug 2017 23:42:49 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:38 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 08/19] scsi: hisi_sas: service interrupt ITCT_CLR interrupt in v2 hw Date: Fri, 11 Aug 2017 00:09:33 +0800 Message-ID: <1502381384-219889-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.598C7EF9.004E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 32e2c431684a6a12f592a56242a61821 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen This patch is a fix related to free'ing a device in v2 hw driver. Before, we polled to ITCT CLR interrupt to check if a device is free. This was error prone, as if the interrupt doesn't occur in 10us, we miss processing it. To avoid this situation, service this interrupt and sync the event with a completion. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 + drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 40 ++++++++++++++++------------------ 2 files changed, 20 insertions(+), 21 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index ad6b2d1..23a22dc 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -141,6 +141,7 @@ struct hisi_sas_dq { struct hisi_sas_device { struct hisi_hba *hisi_hba; struct domain_device *sas_device; + struct completion *completion; struct hisi_sas_dq *dq; struct list_head list; u64 attached_phy; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 9eea0b4..0e3634e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -974,12 +974,14 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba, static void free_device_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_device *sas_dev) { + DECLARE_COMPLETION_ONSTACK(completion); u64 dev_id = sas_dev->device_id; - struct device *dev = hisi_hba->dev; struct hisi_sas_itct *itct = &hisi_hba->itct[dev_id]; u32 reg_val = hisi_sas_read32(hisi_hba, ENT_INT_SRC3); int i; + sas_dev->completion = &completion; + /* SoC bug workaround */ if (dev_is_sata(sas_dev->sas_device)) clear_bit(sas_dev->sata_idx, hisi_hba->sata_dev_bitmap); @@ -989,28 +991,12 @@ static void free_device_v2_hw(struct hisi_hba *hisi_hba, hisi_sas_write32(hisi_hba, ENT_INT_SRC3, ENT_INT_SRC3_ITC_INT_MSK); - /* clear the itct int*/ for (i = 0; i < 2; i++) { - /* clear the itct table*/ - reg_val = hisi_sas_read32(hisi_hba, ITCT_CLR); - reg_val |= ITCT_CLR_EN_MSK | (dev_id & ITCT_DEV_MSK); + reg_val = ITCT_CLR_EN_MSK | (dev_id & ITCT_DEV_MSK); hisi_sas_write32(hisi_hba, ITCT_CLR, reg_val); + wait_for_completion(sas_dev->completion); - udelay(10); - reg_val = hisi_sas_read32(hisi_hba, ENT_INT_SRC3); - if (ENT_INT_SRC3_ITC_INT_MSK & reg_val) { - dev_dbg(dev, "got clear ITCT done interrupt\n"); - - /* invalid the itct state*/ - memset(itct, 0, sizeof(struct hisi_sas_itct)); - hisi_sas_write32(hisi_hba, ENT_INT_SRC3, - ENT_INT_SRC3_ITC_INT_MSK); - - /* clear the itct */ - hisi_sas_write32(hisi_hba, ITCT_CLR, 0); - dev_dbg(dev, "clear ITCT ok\n"); - break; - } + memset(itct, 0, sizeof(struct hisi_sas_itct)); } } @@ -1191,7 +1177,7 @@ static void init_reg_v2_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, ENT_INT_SRC3, 0xffffffff); hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0x7efefefe); hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0x7efefefe); - hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0x7ffffffe); + 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); @@ -3092,8 +3078,20 @@ static irqreturn_t fatal_axi_int_v2_hw(int irq_no, void *p) irq_value); queue_work(hisi_hba->wq, &hisi_hba->rst_work); } + + if (irq_value & BIT(ENT_INT_SRC3_ITC_INT_OFF)) { + u32 reg_val = hisi_sas_read32(hisi_hba, ITCT_CLR); + u32 dev_id = reg_val & ITCT_DEV_MSK; + struct hisi_sas_device *sas_dev = + &hisi_hba->devices[dev_id]; + + hisi_sas_write32(hisi_hba, ITCT_CLR, 0); + dev_dbg(dev, "clear ITCT ok\n"); + complete(sas_dev->completion); + } } + hisi_sas_write32(hisi_hba, ENT_INT_SRC3, irq_value); hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, irq_msk); return IRQ_HANDLED; From patchwork Thu Aug 10 16:09:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109833 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2567458obb; Thu, 10 Aug 2017 08:48:50 -0700 (PDT) X-Received: by 10.84.134.129 with SMTP id 1mr14060538plh.449.1502380130816; Thu, 10 Aug 2017 08:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380130; cv=none; d=google.com; s=arc-20160816; b=XUtv6WdYKlwgxfbLxQgURsnLyVCBmOWoBkXbupKdFf7mtynWaSnqAEn3sbPEhjvtun y8a6VYAguSzpjEmZ2OQsVUtBwORPIWOPjTb+dP3MpZwkh8t4zurbUyGoqT2y082MjGXI 96HhpM7ItkpqM1YXyD6vxtDO9EGJToTnH5HQxjULi5h792SvzLzmrNLBJR6FKq3Jufth 0ZJtw8OQYgQQ6mrKjeLclKmz+PC7441E6FExeWw+xs+8IBwEaVaobUH/tfg8A5KLHzSB mtmrmnCdbwnOJ9tc+f7uuAtE3T2OVM6fWLY7EW7rdptMc/t1ic2g+RbGNOm6WROqvSiX vXmQ== 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=jzy7hbE3fMaFpMp7ij9vh19FQYSsKxS1afuo8Tao5lo=; b=quVa7xVoQg9m+RYhsc7wM+KQCnnKcI0xMCJEt1TkomgABLrFOaLhKNajySRPCpUCLH lQfG6ewbacBvy6pjeKKwY9W0JbPIhUU83KypP0V1yPaEg1Jzcnb/zKDqg1DEpu26iRs9 AXoAvjv1NiEU/sqOwjpaXw0F8Lvj7I++BYzTSxw9ljxXN2+vIiJ7DIFX2URQ+yZzoxmX 6ngeBDbjGDO0QqjTUvicMJacLo9ZGlUVWThjddJInueMaHIRKBUlSRamvzQI05rOe3rC ho6+NESnnRo//JVHbVJEfhkoERn/0MWTsImqfuWhfegtQM+GQ62azwUoOaZBObrzErYC eMZg== 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 s63si4048135pgs.142.2017.08.10.08.48.50; Thu, 10 Aug 2017 08:48:50 -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 S1753117AbdHJPsd (ORCPT + 25 others); Thu, 10 Aug 2017 11:48:33 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3055 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752903AbdHJPmv (ORCPT ); Thu, 10 Aug 2017 11:42:51 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38531; Thu, 10 Aug 2017 23:42:48 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:38 +0800 From: John Garry To: , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 09/19] scsi: hisi_sas: support zone management commands Date: Fri, 11 Aug 2017 00:09:34 +0800 Message-ID: <1502381384-219889-10-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.598C7EF8.00FD, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a8e9b40b1ee7e7a57beffc76648c7c75 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan Add two ATA commands, ATA_CMD_ZAC_MGMT_IN and ATA_CMD_ZAC_MGMT_OUT in hisi_sas_get_ata_protocol(), to support SATA SMR disk. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 ++ 1 file changed, 2 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 81ad6cd..86868ec 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -61,6 +61,7 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction) case ATA_CMD_WRITE_QUEUED: case ATA_CMD_WRITE_LOG_DMA_EXT: case ATA_CMD_WRITE_STREAM_DMA_EXT: + case ATA_CMD_ZAC_MGMT_IN: return HISI_SAS_SATA_PROTOCOL_DMA; case ATA_CMD_CHK_POWER: @@ -73,6 +74,7 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction) case ATA_CMD_SET_FEATURES: case ATA_CMD_STANDBY: case ATA_CMD_STANDBYNOW1: + case ATA_CMD_ZAC_MGMT_OUT: return HISI_SAS_SATA_PROTOCOL_NONDATA; default: if (direction == DMA_NONE) From patchwork Thu Aug 10 16:09:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109834 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2567867obb; Thu, 10 Aug 2017 08:49:12 -0700 (PDT) X-Received: by 10.99.52.135 with SMTP id b129mr11739201pga.241.1502380152038; Thu, 10 Aug 2017 08:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380152; cv=none; d=google.com; s=arc-20160816; b=xBCxD6XTI0VvOwlrW2jitlpcFrBhpgflf0JxycSp7NlE4sVjX8s3SiXm3+8uRtOBIb 6+EjKohnda2Sj3eEZPl5rAqYRuxMM4gp7MkHrRYZyrjPwCdNPSSGMUy5vCdM7wceC0nx A0ZJvnlwVGhNEPSmR+1lVIkNoQbusiohY+wckWXokJmvlSFIH1HqpLXLCQtHv6VyiQiB EUc5KdW+Ig6KF/G+me1ta/4y3J7uNJV+ai1phKvystLD/HSAXtBqGRxSqJcNjywqsGLu tu9t2L7m7rKw6yQmJg2JjGRUid+EtRHuAilCHPNx25rE3ZTIPLku6hMpTlfIiiyZI8kf LRMg== 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=Sro/AJLmZM8tChHAmgCp2csC6rb/DoRdqNWMcQPI1Mg=; b=rZ7IHMZydPYfl308/fjCCf3Q52F7qrurTWiPuv/IywN7FirA5iipD5yJXuRw6Kk/wm 20qTYmJXL/6FlZqjTH2UP4IBTuiP89splkrJwymrxK0Q2A1JNNJh6qxaB7fC9DTjCmz/ Fx69Sm83CCJDZ30mVtcGdfeHsn6zpfynImYRAEphqiRkYCe7G+1XPd2khwUNgfz2sNMe xpBvTAwK20mMXY3guq9kBBfp/0e7XcjdKKwe60PL2d7RzNELGw3hOY29bJAlxf9j3iqE SvY+6TyPSTCwet7hA+jYwEthifnmg81CRjDn76jQWmgjyQCgVCi3KTgwd8pd2utIpxcD +9+g== 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 g127si4089705pgc.537.2017.08.10.08.49.11; Thu, 10 Aug 2017 08:49:12 -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 S1753243AbdHJPtI (ORCPT + 25 others); Thu, 10 Aug 2017 11:49:08 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3051 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752895AbdHJPmu (ORCPT ); Thu, 10 Aug 2017 11:42:50 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38518; Thu, 10 Aug 2017 23:42:46 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:38 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 10/19] scsi: hisi_sas: add status and command buffer for internal abort Date: Fri, 11 Aug 2017 00:09:35 +0800 Message-ID: <1502381384-219889-11-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.598C7EF8.0065, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8ff28d3c738211d9190e98dd8786b899 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen For v3 hw, internal abort function required status and command buffer to be set, so add necessary code for this. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 86868ec..7e642c8 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1363,12 +1363,21 @@ static int hisi_sas_query_task(struct sas_task *task) slot->port = port; task->lldd_task = slot; + slot->buf = dma_pool_alloc(hisi_hba->buffer_pool, + GFP_ATOMIC, &slot->buf_dma); + if (!slot->buf) { + rc = -ENOMEM; + goto err_out_tag; + } + memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr)); + memset(hisi_sas_cmd_hdr_addr_mem(slot), 0, HISI_SAS_COMMAND_TABLE_SZ); + memset(hisi_sas_status_buf_addr_mem(slot), 0, HISI_SAS_STATUS_BUF_SZ); rc = hisi_sas_task_prep_abort(hisi_hba, slot, device_id, abort_flag, task_tag); if (rc) - goto err_out_tag; + goto err_out_buf; list_add_tail(&slot->entry, &sas_dev->list); @@ -1386,6 +1395,9 @@ static int hisi_sas_query_task(struct sas_task *task) return 0; +err_out_buf: + dma_pool_free(hisi_hba->buffer_pool, slot->buf, + slot->buf_dma); err_out_tag: spin_lock_irqsave(&hisi_hba->lock, flags); hisi_sas_slot_index_free(hisi_hba, slot_idx); From patchwork Thu Aug 10 16:09:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109832 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2567170obb; Thu, 10 Aug 2017 08:48:38 -0700 (PDT) X-Received: by 10.98.15.217 with SMTP id 86mr12478348pfp.23.1502380118265; Thu, 10 Aug 2017 08:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380118; cv=none; d=google.com; s=arc-20160816; b=SZojtNwVCF78CHw6amkxcYJ6aBm/ZXO0lJMww9DMzTgcwKJBmGSaXA9xBJpfpYSPJU JlwoX1oNA0n0W+BzFd7olSamn+PyRcjpncxJETBoeYXh4RtPTGmcb9HvQRwVZczPu/CM s8M2ILE/B8K3cYUNumGTcrCQD3k6fsuwJZ+K4WfZiI/l6dsBiu0Hb6502i8PxgNh1TIQ ETAvgLGA/ja/hBbKXeSC7yZyuvEyBUhXMJv4V/93+cgwaE1R1cMNMIzKFddCwCDnrgZu fJrvs9f+uyvznYG43f55dicNU70iWmMcIkMqiI7wYWF5X3ZH/mBS6wOONwmyhwhlt07A QYXg== 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=4guNIGAvcThDsm9/IBZ35up2nLiFNEOVRSn/LWO5lSs=; b=kHXAUc+vtkMKyX2Vj+OhfvfG/aHMfX6OKPIg8vB1G55e2+v24GC8/UnX2BzqkKld+7 LEOCntsa4ltM1ZQKtnIE6zjx/2KH6VMo8VtUwXKTYHsiU9v/dmmUsftn6JRum1KLgOKr Eo6mz8m0s501mJmJLv2tWsywWc5ag39fRVscFa/mbL395WtKviWOU9iLc6sUNgrsu4BD J8wNZoU7ecqlG6HfBGDG35RwL8Ik38q6bjQUUxLZrr1Lbie7VBjkplKRu6PZzAS+KlFz nQA91aHBKneJ8nU7Jh3Jo9yM7nBvhhuzJeTHQfb9IxqY+uLDCLF1eD12yTdRQ9o0jICI pMHw== 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 v29si4143433pgo.576.2017.08.10.08.48.37; Thu, 10 Aug 2017 08:48:38 -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 S1753218AbdHJPse (ORCPT + 25 others); Thu, 10 Aug 2017 11:48:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3053 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752898AbdHJPmv (ORCPT ); Thu, 10 Aug 2017 11:42:51 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38524; Thu, 10 Aug 2017 23:42:47 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:38 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 11/19] scsi: hisi_sas: Modify v3 hw STP_LINK_TIMER setting Date: Fri, 11 Aug 2017 00:09:36 +0800 Message-ID: <1502381384-219889-12-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.598C7EF8.006D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 2c01769674fe6e0adec4e9e575598280 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Modify STP link timer from 10ms to 500ms. Also add the register address. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index dc5c551..bb79b776 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -137,6 +137,7 @@ #define TX_HARDRST_MSK (0x1 << TX_HARDRST_OFF) #define RX_IDAF_DWORD0 (PORT_BASE + 0xc4) #define RXOP_CHECK_CFG_H (PORT_BASE + 0xfc) +#define STP_LINK_TIMER (PORT_BASE + 0x120) #define SAS_SSP_CON_TIMER_CFG (PORT_BASE + 0x134) #define SAS_SMP_CON_TIMER_CFG (PORT_BASE + 0x138) #define SAS_STP_CON_TIMER_CFG (PORT_BASE + 0x13c) @@ -401,6 +402,8 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) 0xa0064); hisi_sas_phy_write32(hisi_hba, i, SAS_STP_CON_TIMER_CFG, 0xa0064); + hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, + 0x7f7a120); } for (i = 0; i < hisi_hba->queue_count; i++) { /* Delivery queue */ From patchwork Thu Aug 10 16:09:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109828 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2565585obb; Thu, 10 Aug 2017 08:47:28 -0700 (PDT) X-Received: by 10.84.194.165 with SMTP id h34mr13776519pld.373.1502380048719; Thu, 10 Aug 2017 08:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380048; cv=none; d=google.com; s=arc-20160816; b=TO+O1c1e01hpn8tkrvxFmEJrHoRku0gqJqgVPog7Adsj59eXmnlF8llX7YSGK8RquP 37xd/eFA6rFcr69NGcTB8I+qDlEFileGCH6GHkCevuA2d4alTm1ynULY++BnNdhyoAaD Yu6s3YXxlFwAA8tryYxRukuRix0K9tQtXwa4vAviR4uaaofeabV9uQcQpicu6u8oPPoT QfJGNyFMRUZX6UVgD++4f7al6tu9x5PSEddmg2FHn/0SDAsNdLxO3Nzo7z9DokrOXCJ2 JNtYFExIByG+4lSoUfblznBbRbR691deSrjILnEvu6R56VpjOUu18m/XJx7ZUh3Q4Ire H/2g== 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=tRWIwC8YCr3N8cHmuS5vJkTY4EqxrUKLApa1zNuE+80=; b=XEK2nWfupSr5p5kEHPShNBO8ldb0Fj7JQDwMXo4YIvEYwVh/M6XEZypD1inp1R2LLU xKBIBS55G1+aOwwLjHXV+LdA2uaWGqw8qEje5HtKY/hPVVCq06GFCPfH0+ni2eGLJoSx HmDqJPXxAfbvf6+BoLvp7wtwcLjjalcHYPXwrXaywQgno+FnXydtBN6Eqo4VKKTKpSdb NLX0QZKuj1dWt2lZUYilS25QoZ68Lp1kR9XMw+Umsvnl7CjDpM/AF0TlM6IcdbB3RduZ YLbIXJZj+FqSCx7XpCWksqXfsqKA2Lv4coYL+OnPUYZ33XvnhID2Ssl1LAcPBwIWu5vs lMzA== 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 i130si4325688pfe.224.2017.08.10.08.47.28; Thu, 10 Aug 2017 08:47:28 -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 S1753238AbdHJPrZ (ORCPT + 25 others); Thu, 10 Aug 2017 11:47:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3056 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752905AbdHJPmw (ORCPT ); Thu, 10 Aug 2017 11:42:52 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEY38529; Thu, 10 Aug 2017 23:42:48 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:39 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 12/19] scsi: hisi_sas: fix v3 hw channel interrupt processing Date: Fri, 11 Aug 2017 00:09:37 +0800 Message-ID: <1502381384-219889-13-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.598C7EF8.00AB, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 4ffad1809cb3f571485ad1b27cf7279d Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen The channel interrupt is to process all the interrupts except PHY UP/DOWN and broadcast interrupt. So we need to clear all the interrupts except those 3 interrupts after processing channel interrupts. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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 bb79b776..a8bd557 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1260,7 +1260,7 @@ static irqreturn_t int_chnl_int_v3_hw(int irq_no, void *p) if (irq_msk & (2 << (phy_no * 4)) && irq_value0) { hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, irq_value0 - & (~CHL_INT0_HOTPLUG_TOUT_MSK) + & (~CHL_INT0_SL_RX_BCST_ACK_MSK) & (~CHL_INT0_SL_PHY_ENABLE_MSK) & (~CHL_INT0_NOT_RDY_MSK)); } From patchwork Thu Aug 10 16:09:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109827 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2565079obb; Thu, 10 Aug 2017 08:47:07 -0700 (PDT) X-Received: by 10.99.109.77 with SMTP id i74mr12547325pgc.438.1502380027436; Thu, 10 Aug 2017 08:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380027; cv=none; d=google.com; s=arc-20160816; b=dHFsN0CUTP+yhjMvREnSdAfjf7PzVR4UaWKhqsljlQPVdFkKKDMI7O+9o4pr+bnitt Vi8u/iaEbu0nSQMLYr2YsnDLbic4AHjucxHjj36Hvm6uKqgdM282aRZtrhfKXeUABA7m 6YSXOTXa7RXlgHzs1PVS6IkXzzfWWe9Cw6oyBr1gtRxkqpX9k923ylbTbS0bAWWr8sD1 UxkItvshvGP2kgLMD/atdz8Pfn5qPHl0G/Cg60aWycBlf2ML8WkCs7dj3zx5/sK+TZ9C rJeJkQGdEXTd2R+sAWaNs8q1NzE2liCjX81Pm6D3lD7wt8PikZP71TVO5Yf9p2XSGzc+ PPqg== 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=VQDUKImHH6ncfAYTrofca2eJHPjtjIBGUt6KF9A93J4=; b=tlMa7mfDnSeHC2WHB104CL8qFW1GpKHtUNQPqPppolBRMlZCZbbhRLYIZv1GKUU4NC f/wyZ3UwFjcqj3khJRltSrPLy+pOwG25pDUdEvZZinGBQnmXuW01X7O5i86wlMMT4lcl JH0kuiArYes9s7y/PyFFEjvhtg4tF5Af0yev7JNwkA7gLO7M87VNT3KFTN2uxoDDNbLl pNaNIe8U1LPS2lrdGLdITObo0C0C4mMq48uE3cQzMrBsYGfceYFUdy/R0dyxDLCP3j8+ Kcl0AkIIK25F8UUUrxQPWZdsLo1qzWdAbiquAj9800wtGnA2Ul7loHmqvPrcIJPDftp3 MFGw== 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 i28si4323259pfk.84.2017.08.10.08.47.06; Thu, 10 Aug 2017 08:47: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 S1753285AbdHJPqf (ORCPT + 25 others); Thu, 10 Aug 2017 11:46:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3493 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbdHJPmx (ORCPT ); Thu, 10 Aug 2017 11:42:53 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99171; Thu, 10 Aug 2017 23:42:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:39 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 13/19] scsi: hisi_sas: kill tasklet when destroying irq in v3 hw Date: Fri, 11 Aug 2017 00:09:38 +0800 Message-ID: <1502381384-219889-14-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EFB.0003, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f4c4f8be62a79427985733d61f7f2f3c Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen This patch adds calls to kill CQ takslets v3 hw during probe failure. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 1 file changed, 1 insertion(+) -- 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 a8bd557..992ccc2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1802,6 +1802,7 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) struct hisi_sas_cq *cq = &hisi_hba->cq[i]; free_irq(pci_irq_vector(pdev, i+16), cq); + tasklet_kill(&cq->tasklet); } pci_free_irq_vectors(pdev); } From patchwork Thu Aug 10 16:09:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109826 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2564459obb; Thu, 10 Aug 2017 08:46:40 -0700 (PDT) X-Received: by 10.84.210.65 with SMTP id z59mr14153359plh.450.1502380000240; Thu, 10 Aug 2017 08:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502380000; cv=none; d=google.com; s=arc-20160816; b=LejNc6nq7qtJXBdwFfPcLDNzDiFXpeAp9UbCJThwMZzv4QrDZdo08ey753E4GlI22C y9xoE7HjjcMZcvfAfaFjjLYj8hCnURSRKFScTxdgYG8vAsShdNH2WpiBs9/K+N0jRn9Q g2V7QlZOwEtEPXj8WZzB3jf6q/LCrI1lE0pgoiQehIk9PraShr3janYaSTNdt9/cH4nm kYuksmDVnBJcfKAMcePaJSFq6CvhikU7zyUquz58NlCTF0lxKO4hphFy49d6+5QNdI24 m0osPFpdw8gYmwq57dPUnBvwYyiI9jsGLNLvlY2wlrnCKShOp22kB55AIbTbI+HBwqzc IrdA== 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=zyt7KPBBoSPtlGGvvMXMgM10yw5DwAxCZlMCsyUp4yY=; b=x+etQCZPibZooMrHVYXf5kGlbDJoG3+j4y2Y/g+appjjlRkjFr3MS3WHdcocR6rIiP MoTWixYIm+EsWfUzAco0NkNms70v/9b2r2+dwLaZhavusEeixOnWluSkYfY9rPTPnSKZ uX6wba35HXgZo2sV4ogZyrCLtYTT9bNgZ4M4DzWKvM1LbMg7RY/EH9MxXD191yGjpft1 ejCh6g2tkFkDCZthQ+VBSMtwFuSarK+OigRKBfSMIUhwGS+z4/7TW0UPPfivW6ykSk/t gkc8bpkUr6HN6Gom3ShBab8aHKKrDY+lsROqU7zuCl6zaOfXclcJHtvbM7S7Ws0056FK 6bdg== 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 e194si4282584pfh.204.2017.08.10.08.46.39; Thu, 10 Aug 2017 08:46:40 -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 S1753079AbdHJPqh (ORCPT + 25 others); Thu, 10 Aug 2017 11:46:37 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3494 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752936AbdHJPmx (ORCPT ); Thu, 10 Aug 2017 11:42:53 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99172; Thu, 10 Aug 2017 23:42:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:39 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 14/19] scsi: hisi_sas: update some v3 register init settings Date: Fri, 11 Aug 2017 00:09:39 +0800 Message-ID: <1502381384-219889-15-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.598C7EFB.0027, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c5a0825d14e3c394de69f9b58852dae0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen This patch updates some register setting according to recommendation from HW designer and experiment. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 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 992ccc2..efc2e82 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -23,14 +23,11 @@ #define PHY_STATE 0x24 #define PHY_PORT_NUM_MA 0x28 #define PHY_CONN_RATE 0x30 -#define AXI_AHB_CLK_CFG 0x3c #define ITCT_CLR 0x44 #define ITCT_CLR_EN_OFF 16 #define ITCT_CLR_EN_MSK (0x1 << ITCT_CLR_EN_OFF) #define ITCT_DEV_OFF 0 #define ITCT_DEV_MSK (0x7ff << ITCT_DEV_OFF) -#define AXI_USER1 0x48 -#define AXI_USER2 0x4c #define IO_SATA_BROKEN_MSG_ADDR_LO 0x58 #define IO_SATA_BROKEN_MSG_ADDR_HI 0x5c #define SATA_INITI_D2H_STORE_ADDR_LO 0x60 @@ -355,8 +352,6 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) /* Global registers init */ hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, (u32)((1ULL << hisi_hba->queue_count) - 1)); - hisi_sas_write32(hisi_hba, AXI_USER1, 0x0); - hisi_sas_write32(hisi_hba, AXI_USER2, 0x40000060); hisi_sas_write32(hisi_hba, HGC_SAS_TXFAIL_RETRY_CTRL, 0x108); hisi_sas_write32(hisi_hba, CFG_1US_TIMER_TRSH, 0xd); hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1); @@ -372,15 +367,14 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) 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); - hisi_sas_write32(hisi_hba, SAS_ECC_INTR_MSK, 0xfff00c30); + hisi_sas_write32(hisi_hba, SAS_ECC_INTR_MSK, 0x0); 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, AXI_AHB_CLK_CFG, 1); hisi_sas_write32(hisi_hba, HYPER_STREAM_ID_EN_CFG, 1); - hisi_sas_write32(hisi_hba, CFG_MAX_TAG, 0xfff07fff); + hisi_sas_write32(hisi_hba, AXI_MASTER_CFG_BASE, 0x30000); for (i = 0; i < hisi_hba->n_phy; i++) { hisi_sas_phy_write32(hisi_hba, i, PROG_PHY_LINK_RATE, 0x801); @@ -390,7 +384,6 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, i, RXOP_CHECK_CFG_H, 0x1000); hisi_sas_phy_write32(hisi_hba, i, CHL_INT1_MSK, 0xffffffff); hisi_sas_phy_write32(hisi_hba, i, CHL_INT2_MSK, 0x8ffffbff); - hisi_sas_phy_write32(hisi_hba, i, SL_CFG, 0x83f801fc); hisi_sas_phy_write32(hisi_hba, i, PHY_CTRL_RDY_MSK, 0x0); hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_NOT_RDY_MSK, 0x0); hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_DWS_RESET_MSK, 0x0); @@ -399,9 +392,9 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_OOB_RESTART_MSK, 0x0); hisi_sas_phy_write32(hisi_hba, i, PHY_CTRL, 0x199b4fa); hisi_sas_phy_write32(hisi_hba, i, SAS_SSP_CON_TIMER_CFG, - 0xa0064); + 0xa03e8); hisi_sas_phy_write32(hisi_hba, i, SAS_STP_CON_TIMER_CFG, - 0xa0064); + 0xa03e8); hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, 0x7f7a120); } From patchwork Thu Aug 10 16:09:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109821 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2562301obb; Thu, 10 Aug 2017 08:44:59 -0700 (PDT) X-Received: by 10.99.52.72 with SMTP id b69mr11838033pga.240.1502379899597; Thu, 10 Aug 2017 08:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502379899; cv=none; d=google.com; s=arc-20160816; b=qXZLCbd0XxsNhlV6YjL+Lg7gyEq1oVK/L9UUjEUTlwK2XZngc8uhXC1cBOnsCAH1vF Sk5xcaDLFQgI2AbfPpbSFaM3ME115I5MmBU+jezd6NGYrF8ROoy7KqbO1NnB/F97OsHx 38qrdmvExprvXMi423PhECZRBnaQoMh0se64QNZpH6I8B4tJYCYRFN496nz0numiJhcZ Rij4J0FDZQVmGIV0G/9rHbAL6J3z5VOCeWMFCjXvrIm2pEHNyQalEU5cIfZoW4oFRBZd 44bNJdCtSddRaqHkzqJWFu3Ftai37QP9L1LfcAdjjw6RhMtA9PZLblXw5vNwCy+wkM2z NLtA== 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=cwITHxDGdK8sjs41tLv5MjrMjY/2cwxFKD92KRDfy6g=; b=VGQhSuz8X17J0hCrUpX2pfwv2hqA5yW8yDsSMYMx1P5GJ+SVw6YP1Hz3+qdu/Od+o2 HkPJ8gJHhw0AkzpbyYIjGDkTuifuPD53ydYUKwH9wS76YLThfGuFzeLZqluRkWgkzqI8 gltXldljQsNXp15YT8YucH0fOLgXhUmvanPJ8OqZJBPRqfL+39P1oWv0iKS7oTU/nPmz N8dwn1cb54yAjeIEjPOXahirVBaL4X3J4UjGNs9kmL/9FIMPTKrfRelNoAH0RaciOWL7 bS9HIUUCk12xJrBfNRSJThwbpn2Lprz20D5xMzx7lIz5inHJ+06yFLKZAyD4yHsE2ZIX cGgw== 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 r2si4621882plj.471.2017.08.10.08.44.59; Thu, 10 Aug 2017 08:44:59 -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 S1753242AbdHJPo5 (ORCPT + 25 others); Thu, 10 Aug 2017 11:44:57 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3497 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752906AbdHJPmz (ORCPT ); Thu, 10 Aug 2017 11:42:55 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99179; Thu, 10 Aug 2017 23:42:52 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:40 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 15/19] scsi: hisi_sas: add reset handler for v3 hw Date: Fri, 11 Aug 2017 00:09:40 +0800 Message-ID: <1502381384-219889-16-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EFC.009B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 96735f22875f883bdb633dc6f973fc85 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Use ACPI "_RST" method to reset the controller, since FLR is not supported. Function hisi_sas_stop_phys() is introduced to remove some code duplication. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 + drivers/scsi/hisi_sas/hisi_sas_main.c | 9 ++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 24 +---- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 158 +++++++++++++++++++++++++++++---- 4 files changed, 157 insertions(+), 36 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 23a22dc..4c393cd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -402,6 +403,7 @@ struct hisi_sas_slot_buf_table { extern struct scsi_transport_template *hisi_sas_stt; 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); diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 7e642c8..4112afd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -127,6 +127,15 @@ struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port) } EXPORT_SYMBOL_GPL(to_hisi_sas_port); +void hisi_sas_stop_phys(struct hisi_hba *hisi_hba) +{ + int phy_no; + + for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) + hisi_hba->hw->phy_disable(hisi_hba, phy_no); +} +EXPORT_SYMBOL_GPL(hisi_sas_stop_phys); + static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx) { void *bitmap = hisi_hba->slot_index_tags; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 0e3634e..779af97 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1486,25 +1486,12 @@ static void start_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no) enable_phy_v2_hw(hisi_hba, phy_no); } -static void stop_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no) -{ - disable_phy_v2_hw(hisi_hba, phy_no); -} - -static void stop_phys_v2_hw(struct hisi_hba *hisi_hba) -{ - int i; - - for (i = 0; i < hisi_hba->n_phy; i++) - stop_phy_v2_hw(hisi_hba, i); -} - static void phy_hard_reset_v2_hw(struct hisi_hba *hisi_hba, int phy_no) { struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; u32 txid_auto; - stop_phy_v2_hw(hisi_hba, phy_no); + disable_phy_v2_hw(hisi_hba, phy_no); if (phy->identify.device_type == SAS_END_DEVICE) { txid_auto = hisi_sas_phy_read32(hisi_hba, phy_no, TXID_AUTO); hisi_sas_phy_write32(hisi_hba, phy_no, TXID_AUTO, @@ -1533,7 +1520,7 @@ static void phy_get_events_v2_hw(struct hisi_hba *hisi_hba, int phy_no) sphy->running_disparity_error_count += err6_reg_val & 0xFF; } -static void start_phys_v2_hw(struct hisi_hba *hisi_hba) +static void phys_init_v2_hw(struct hisi_hba *hisi_hba) { int i; @@ -1548,11 +1535,6 @@ static void start_phys_v2_hw(struct hisi_hba *hisi_hba) } } -static void phys_init_v2_hw(struct hisi_hba *hisi_hba) -{ - start_phys_v2_hw(hisi_hba); -} - static void sl_notify_v2_hw(struct hisi_hba *hisi_hba, int phy_no) { u32 sl_control; @@ -3429,7 +3411,7 @@ static int soft_reset_v2_hw(struct hisi_hba *hisi_hba) interrupt_disable_v2_hw(hisi_hba); hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, 0x0); - stop_phys_v2_hw(hisi_hba); + hisi_sas_stop_phys(hisi_hba); mdelay(10); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index efc2e82..111e45c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -165,6 +165,31 @@ #define PHYCTRL_PHY_ENA_MSK (PORT_BASE + 0x2bc) #define SL_RX_BCAST_CHK_MSK (PORT_BASE + 0x2c0) #define PHYCTRL_OOB_RESTART_MSK (PORT_BASE + 0x2c4) +#define DMA_TX_STATUS (PORT_BASE + 0x2d0) +#define DMA_TX_STATUS_BUSY_OFF 0 +#define DMA_TX_STATUS_BUSY_MSK (0x1 << DMA_TX_STATUS_BUSY_OFF) +#define DMA_RX_STATUS (PORT_BASE + 0x2e8) +#define DMA_RX_STATUS_BUSY_OFF 0 +#define DMA_RX_STATUS_BUSY_MSK (0x1 << DMA_RX_STATUS_BUSY_OFF) + +#define MAX_ITCT_HW 4096 /* max the hw can support */ +#define DEFAULT_ITCT_HW 2048 /* reset value, not reprogrammed */ +#if (HISI_SAS_MAX_DEVICES > DEFAULT_ITCT_HW) +#error Max ITCT exceeded +#endif + +#define AXI_MASTER_CFG_BASE (0x5000) +#define AM_CTRL_GLOBAL (0x0) +#define AM_CURR_TRANS_RETURN (0x150) + +#define AM_CFG_MAX_TRANS (0x5010) +#define AM_CFG_SINGLE_PORT_MAX_TRANS (0x5014) +#define AXI_CFG (0x5100) +#define AM_ROB_ECC_ERR_ADDR (0x510c) +#define AM_ROB_ECC_ONEBIT_ERR_ADDR_OFF 0 +#define AM_ROB_ECC_ONEBIT_ERR_ADDR_MSK (0xff << AM_ROB_ECC_ONEBIT_ERR_ADDR_OFF) +#define AM_ROB_ECC_MULBIT_ERR_ADDR_OFF 8 +#define AM_ROB_ECC_MULBIT_ERR_ADDR_MSK (0xff << AM_ROB_ECC_MULBIT_ERR_ADDR_OFF) /* HW dma structures */ /* Delivery queue header */ @@ -604,8 +629,52 @@ static void dereg_device_v3_hw(struct hisi_hba *hisi_hba, 1 << CFG_ABT_SET_IPTT_DONE_OFF); } +static int reset_hw_v3_hw(struct hisi_hba *hisi_hba) +{ + struct device *dev = hisi_hba->dev; + int ret; + u32 val; + + hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, 0); + + /* Disable all of the PHYs */ + hisi_sas_stop_phys(hisi_hba); + udelay(50); + + /* Ensure axi bus idle */ + ret = readl_poll_timeout(hisi_hba->regs + AXI_CFG, val, !val, + 20000, 1000000); + if (ret) { + dev_err(dev, "axi bus is not idle, ret = %d!\n", ret); + return -EIO; + } + + if (ACPI_HANDLE(dev)) { + acpi_status s; + + s = acpi_evaluate_object(ACPI_HANDLE(dev), "_RST", NULL, NULL); + if (ACPI_FAILURE(s)) { + dev_err(dev, "Reset failed\n"); + return -EIO; + } + } else + dev_err(dev, "no reset method!\n"); + + return 0; +} + static int hw_init_v3_hw(struct hisi_hba *hisi_hba) { + struct device *dev = hisi_hba->dev; + int rc; + + rc = reset_hw_v3_hw(hisi_hba); + if (rc) { + dev_err(dev, "hisi_sas_reset_hw failed, rc=%d", rc); + return rc; + } + + msleep(100); init_reg_v3_hw(hisi_hba); return 0; @@ -634,25 +703,12 @@ static void start_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) enable_phy_v3_hw(hisi_hba, phy_no); } -static void stop_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) -{ - disable_phy_v3_hw(hisi_hba, phy_no); -} - -static void start_phys_v3_hw(struct hisi_hba *hisi_hba) -{ - int i; - - for (i = 0; i < hisi_hba->n_phy; i++) - start_phy_v3_hw(hisi_hba, i); -} - static void phy_hard_reset_v3_hw(struct hisi_hba *hisi_hba, int phy_no) { struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; u32 txid_auto; - stop_phy_v3_hw(hisi_hba, phy_no); + disable_phy_v3_hw(hisi_hba, phy_no); if (phy->identify.device_type == SAS_END_DEVICE) { txid_auto = hisi_sas_phy_read32(hisi_hba, phy_no, TXID_AUTO); hisi_sas_phy_write32(hisi_hba, phy_no, TXID_AUTO, @@ -669,7 +725,17 @@ enum sas_linkrate phy_get_max_linkrate_v3_hw(void) static void phys_init_v3_hw(struct hisi_hba *hisi_hba) { - start_phys_v3_hw(hisi_hba); + int i; + + for (i = 0; i < hisi_hba->n_phy; i++) { + struct hisi_sas_phy *phy = &hisi_hba->phy[i]; + struct asd_sas_phy *sas_phy = &phy->sas_phy; + + if (!sas_phy->phy->enabled) + continue; + + start_phy_v3_hw(hisi_hba, i); + } } static void sl_notify_v3_hw(struct hisi_hba *hisi_hba, int phy_no) @@ -1614,6 +1680,66 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) return 0; } +static void interrupt_disable_v3_hw(struct hisi_hba *hisi_hba) +{ + struct pci_dev *pdev = hisi_hba->pci_dev; + int i; + + synchronize_irq(pci_irq_vector(pdev, 1)); + synchronize_irq(pci_irq_vector(pdev, 2)); + synchronize_irq(pci_irq_vector(pdev, 11)); + for (i = 0; i < hisi_hba->queue_count; i++) { + hisi_sas_write32(hisi_hba, OQ0_INT_SRC_MSK + 0x4 * i, 0x1); + synchronize_irq(pci_irq_vector(pdev, i + 16)); + } + + hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0xffffffff); + hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0xffffffff); + hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xffffffff); + hisi_sas_write32(hisi_hba, SAS_ECC_INTR_MSK, 0xffffffff); + + for (i = 0; i < hisi_hba->n_phy; i++) { + hisi_sas_phy_write32(hisi_hba, i, CHL_INT1_MSK, 0xffffffff); + hisi_sas_phy_write32(hisi_hba, i, CHL_INT2_MSK, 0xffffffff); + hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_NOT_RDY_MSK, 0x1); + hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_PHY_ENA_MSK, 0x1); + hisi_sas_phy_write32(hisi_hba, i, SL_RX_BCAST_CHK_MSK, 0x1); + } +} + +static u32 get_phys_state_v3_hw(struct hisi_hba *hisi_hba) +{ + return hisi_sas_read32(hisi_hba, PHY_STATE); +} + +static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) +{ + struct device *dev = hisi_hba->dev; + int rc; + u32 status; + + interrupt_disable_v3_hw(hisi_hba); + hisi_sas_write32(hisi_hba, DLVRY_QUEUE_ENABLE, 0x0); + + hisi_sas_stop_phys(hisi_hba); + + mdelay(10); + + hisi_sas_write32(hisi_hba, AXI_MASTER_CFG_BASE + AM_CTRL_GLOBAL, 0x1); + + /* wait until bus idle */ + rc = readl_poll_timeout(hisi_hba->regs + AXI_MASTER_CFG_BASE + + AM_CURR_TRANS_RETURN, status, status == 0x3, 10, 100); + if (rc) { + dev_err(dev, "axi bus is not idle, rc = %d\n", rc); + return rc; + } + + hisi_sas_init_mem(hisi_hba); + + return hw_init_v3_hw(hisi_hba); +} + static const struct hisi_sas_hw hisi_sas_v3_hw = { .hw_init = hisi_sas_v3_init, .setup_itct = setup_itct_v3_hw, @@ -1635,6 +1761,8 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) .phy_hard_reset = phy_hard_reset_v3_hw, .phy_get_max_linkrate = phy_get_max_linkrate_v3_hw, .dereg_device = dereg_device_v3_hw, + .soft_reset = soft_reset_v3_hw, + .get_phys_state = get_phys_state_v3_hw, }; static struct Scsi_Host * From patchwork Thu Aug 10 16:09:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109823 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2563658obb; Thu, 10 Aug 2017 08:46:04 -0700 (PDT) X-Received: by 10.99.51.200 with SMTP id z191mr11991561pgz.329.1502379964281; Thu, 10 Aug 2017 08:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502379964; cv=none; d=google.com; s=arc-20160816; b=AsICOvGcL/QhBBq8jfuShnARaCvIgROgzy+DBx0eTD1QpZsUfHh4cDF2+7XhAzg/fU gDq6lZOrbJbXf/y7yJzj9T8LJtpoXEy5U7Jll8ogkFNZcGLS6uAmKMEt+qmPIakW6ARq LLMwz4qvhO6gbG3MjnYgB6l3yIi5IWYqlEI5Y4Eo94A1mhf9csWgapblR8qA7nsCgz+W QMUvGgtM1HApH3mR+9jlSHyWc5puZtJ8Wo9dhB88jKgWN+FZHbCSK38LgeT8pUGatm6h N2gZ5takbj7fspng2wLQ54AaGUhAG1ynnn21ekN2v0pUJE9ZX0yYIT+vNeZo9Qm5DIoT G5xQ== 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=S37a2k9sWqWiFlRowhEjUIgf7h/N3+tOMlOShXWEeck=; b=GiTbhner0g6kPjZEfiVr4uZ70P+GIMwTIhfDWIrtf3o0rOr+gAO1XI4YBr8zfkBcQd rYHMe+ln4LkoP0c3eeAgr3eiw4OEqrK2XAI5ZH+aKMh2jED3piNN1FG0G1mc/+oMagqM 3f+kNP1t0EV623VX0HoigU2U6JWjWb15XYVNq/zKUgrHkDFPJfhw3k35r5iVjQgK/J1q m6/I+XJlqxft7PU7bjMeB/9NnzU/07WWjhDnJ003RhqafebIDLswt6BNrxICrObnysfN rH1x0bNncNuizhH8gyWwifRBLHuIDbMn2gOhO5WYROd9Li/Ffuu/JK3Aa0UL98LhY1g1 VPkg== 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 x10si4619180plm.860.2017.08.10.08.46.03; Thu, 10 Aug 2017 08:46:04 -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 S1753262AbdHJPqB (ORCPT + 25 others); Thu, 10 Aug 2017 11:46:01 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3496 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752357AbdHJPmz (ORCPT ); Thu, 10 Aug 2017 11:42:55 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99177; Thu, 10 Aug 2017 23:42:51 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:40 +0800 From: John Garry To: , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 16/19] scsi: hisi_sas: add phy_set_linkrate_v3_hw() Date: Fri, 11 Aug 2017 00:09:41 +0800 Message-ID: <1502381384-219889-17-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.598C7EFB.0091, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7635ac857e54d9ceabba143e19d40deb Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Add function to set linkrate for v3 hw. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 111e45c..8e4bfad 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1680,6 +1680,44 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) return 0; } +static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no, + struct sas_phy_linkrates *r) +{ + u32 prog_phy_link_rate = + hisi_sas_phy_read32(hisi_hba, phy_no, PROG_PHY_LINK_RATE); + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + struct asd_sas_phy *sas_phy = &phy->sas_phy; + int i; + enum sas_linkrate min, max; + u32 rate_mask = 0; + + if (r->maximum_linkrate == SAS_LINK_RATE_UNKNOWN) { + max = sas_phy->phy->maximum_linkrate; + min = r->minimum_linkrate; + } else if (r->minimum_linkrate == SAS_LINK_RATE_UNKNOWN) { + max = r->maximum_linkrate; + min = sas_phy->phy->minimum_linkrate; + } else + return; + + sas_phy->phy->maximum_linkrate = max; + sas_phy->phy->minimum_linkrate = min; + + min -= SAS_LINK_RATE_1_5_GBPS; + max -= SAS_LINK_RATE_1_5_GBPS; + + for (i = 0; i <= max; i++) + rate_mask |= 1 << (i * 2); + + prog_phy_link_rate &= ~0xff; + prog_phy_link_rate |= rate_mask; + + hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, + prog_phy_link_rate); + + phy_hard_reset_v3_hw(hisi_hba, phy_no); +} + static void interrupt_disable_v3_hw(struct hisi_hba *hisi_hba) { struct pci_dev *pdev = hisi_hba->pci_dev; @@ -1760,6 +1798,7 @@ static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) .phy_disable = disable_phy_v3_hw, .phy_hard_reset = phy_hard_reset_v3_hw, .phy_get_max_linkrate = phy_get_max_linkrate_v3_hw, + .phy_set_linkrate = phy_set_linkrate_v3_hw, .dereg_device = dereg_device_v3_hw, .soft_reset = soft_reset_v3_hw, .get_phys_state = get_phys_state_v3_hw, From patchwork Thu Aug 10 16:09:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109824 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2564023obb; Thu, 10 Aug 2017 08:46:21 -0700 (PDT) X-Received: by 10.84.231.200 with SMTP id g8mr13705547pln.21.1502379981839; Thu, 10 Aug 2017 08:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502379981; cv=none; d=google.com; s=arc-20160816; b=kDi8ooNfB4Ysd9GkA9rezFSty5dwUUftCUX6vcawjSgFCfJVS6mobko/Aihj+fJ9c/ DUmkrMrug6uZqopq3N7J3Rhvvm3k/cyNZeSuPOXzHwMjkv9PXJyuXr5d4aNQ5gA8/Z4Q HntINSLVYD01Kq4huukD6WBs4j7Z2CZFp0B8FaVf57U0qmWMBN4UZdMcCth6QIBe9wIV 9fXzQ9BQXJnXmrToXGgRR6eI5D/h/3G3hdy4decVVZU4GpC02ImHBmITJeMsPyYVKcCR dddoLAOhVXA/2FekjNbY1enGaEt9R4S6+hXMS414lQ43dezke36fGH3uw6Rx0HL8d4CG wytQ== 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=zpzjLHt2zX0/z6jYv9nPiE5qedQgLTn27cNx7gdLSUk=; b=lyOYXtvAqqeCxWBV3WoW91xyM3p51bGvkb6GfMmQaePUoLG5twBp7+vRO5iV34CECV 7A7X17EJTXdBcrfO2d9lv5Xh6FereFkyi9a1BIzvvqxBAnYx4w9RzR07qY2Oc0+NWZNH LqwnwF5e3Mul25xi2hZS7A37OIRtgupuJK71PowCT/SUi8kev++twn+eBq+rhWW6YSKo QOfhxbcp8Y28HEwA3YELx8p0Os3fGSqMDoY+Z/ikFvnnM78nFkbRbmhsHEbtQrgxvxA3 FXOOEQy+nr6AFJFOMZu2lJNgAoU3HGNw6WOjTazXdkrfDQsyk1snoHmbW536r/2hSel6 vNXQ== 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 u140si4082417pgb.966.2017.08.10.08.46.21; Thu, 10 Aug 2017 08:46:21 -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 S1753266AbdHJPqT (ORCPT + 25 others); Thu, 10 Aug 2017 11:46:19 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3495 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944AbdHJPmy (ORCPT ); Thu, 10 Aug 2017 11:42:54 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99176; Thu, 10 Aug 2017 23:42:51 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:40 +0800 From: John Garry To: , CC: , , , , John Garry Subject: [PATCH 17/19] scsi: hisi_sas: remove phy_down_v3_hw() res variable Date: Fri, 11 Aug 2017 00:09:42 +0800 Message-ID: <1502381384-219889-18-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EFB.00C4, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 30298d4c6d8c44798f7b513410563a3a Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Variable res only holds value 0, so remove it. This cleans up a coccicheck warning. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 1 file changed, 1 insertion(+), 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 8e4bfad..3620a3e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1200,7 +1200,6 @@ static int phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) static int phy_down_v3_hw(int phy_no, struct hisi_hba *hisi_hba) { - int res = 0; u32 phy_state, sl_ctrl, txid_auto; struct device *dev = hisi_hba->dev; @@ -1221,7 +1220,7 @@ static int phy_down_v3_hw(int phy_no, struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, CHL_INT0_NOT_RDY_MSK); hisi_sas_phy_write32(hisi_hba, phy_no, PHYCTRL_NOT_RDY_MSK, 0); - return res; + return 0; } static void phy_bcast_v3_hw(int phy_no, struct hisi_hba *hisi_hba) From patchwork Thu Aug 10 16:09:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109817 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2559856obb; Thu, 10 Aug 2017 08:43:01 -0700 (PDT) X-Received: by 10.84.218.3 with SMTP id q3mr13628583pli.282.1502379781846; Thu, 10 Aug 2017 08:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502379781; cv=none; d=google.com; s=arc-20160816; b=Xp86lBLnG6vXv4k1UjWuXYb50WCPfDKSR3W74MTuuT0ps5NsGef0J2W5mXsIgTZxZS /3ti3diud4U0ZOoftRLzXZGzxmHNIQzHsKNHvQRM5zJeHAWz/mFpoRwKENcJNVsUfzdZ dYeftgG62F8t2aGV9LVIwrO+HAT0j1/QtkYhBo89K2b0f9GVR9lxOe3GtnUD9nQx2pwN fC4b4DCNT2gK3M9A9p8AIK4BuqBLbaB20L0+mWsq9HcrDQ9UxVB0qKRzH3oLWFkgSd+9 H5yPqijd7cG8U/bk0nId7O+14C5BFdWhaj2e9GpAmtPzi8ze0OnIyJSIzi/MjwzJ4fkd j36w== 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=iV43jI3giAWxIcCRGkaw/Euo/Z3o6nsQDTyM+Yt0qfk=; b=MQcE0fSKh5nK8I/ULj0zSH0l0IalAfvJs5/nG5zngPegKsQx7H5FoMfxaOWjRDhy87 MEBEZWHCsVD4MFirChawOigNfxNcsoMBGtRa2je/kxcQQ+JxcltwlSOQMpxGDbYYROCT Be3+RUMy5cCiNjvuK4izvhbnB32N1ajmvALIGrjA3nqkKMzIiKGUdXLT+iGgSKyLqg7L 3fnGVvJlzNQaPRRU7+37ekFqNUPwOQfGQ962Q1TZD1m39O6gXPj5FyC+FAjxIgYlPsqs zy+OnMmt3eC+rmaCM04HgMvrRkwlA3HQANqtfSqMFwqd7tJZOy5fQdFZLZMIrHJ9PuH9 0pQw== 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 t5si3994150pgj.524.2017.08.10.08.43.01; Thu, 10 Aug 2017 08:43:01 -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 S1753033AbdHJPm7 (ORCPT + 25 others); Thu, 10 Aug 2017 11:42:59 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3498 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752959AbdHJPmz (ORCPT ); Thu, 10 Aug 2017 11:42:55 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99173; Thu, 10 Aug 2017 23:42:51 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:40 +0800 From: John Garry To: , CC: , , , , John Garry Subject: [PATCH 18/19] scsi: hisi_sas: replace kfree with scsi_host_put Date: Fri, 11 Aug 2017 00:09:43 +0800 Message-ID: <1502381384-219889-19-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.598C7EFC.0091, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: aa0af5180a793c491ab3ef21b0ad5ed5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instances of kfree(shost) should be replaced with scsi_host_put(). In addition, a missing scsi_host_put() is added for error path in hisi_sas_shost_alloc_pci() and v3 driver removal. Signed-off-by: Pan Bian # For main.c changes Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 +++--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 13 +++++++++---- 2 files changed, 12 insertions(+), 7 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 4112afd..9427835 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1900,7 +1900,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, return shost; err_out: - kfree(shost); + scsi_host_put(shost); dev_err(dev, "shost alloc failed\n"); return NULL; } @@ -1991,7 +1991,7 @@ int hisi_sas_probe(struct platform_device *pdev, scsi_remove_host(shost); err_out_ha: hisi_sas_free(hisi_hba); - kfree(shost); + scsi_host_put(shost); return rc; } EXPORT_SYMBOL_GPL(hisi_sas_probe); @@ -2006,7 +2006,7 @@ int hisi_sas_remove(struct platform_device *pdev) sas_remove_host(sha->core.shost); hisi_sas_free(hisi_hba); - kfree(shost); + scsi_host_put(shost); return 0; } EXPORT_SYMBOL_GPL(hisi_sas_remove); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 3620a3e..a20e354 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1811,8 +1811,10 @@ static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) struct device *dev = &pdev->dev; shost = scsi_host_alloc(hisi_sas_sht, sizeof(*hisi_hba)); - if (!shost) - goto err_out; + if (!shost) { + dev_err(dev, "shost alloc failed\n"); + return NULL; + } hisi_hba = shost_priv(shost); hisi_hba->hw = &hisi_sas_v3_hw; @@ -1833,6 +1835,7 @@ static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) return shost; err_out: + scsi_host_put(shost); dev_err(dev, "shost alloc failed\n"); return NULL; } @@ -1941,7 +1944,7 @@ static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) err_out_register_ha: scsi_remove_host(shost); err_out_ha: - kfree(shost); + scsi_host_put(shost); err_out_regions: pci_release_regions(pdev); err_out_disable_device: @@ -1971,14 +1974,16 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) struct device *dev = &pdev->dev; struct sas_ha_struct *sha = dev_get_drvdata(dev); struct hisi_hba *hisi_hba = sha->lldd_ha; + struct Scsi_Host *shost = sha->core.shost; sas_unregister_ha(sha); sas_remove_host(sha->core.shost); - hisi_sas_free(hisi_hba); hisi_sas_v3_destroy_irqs(pdev, hisi_hba); pci_release_regions(pdev); pci_disable_device(pdev); + hisi_sas_free(hisi_hba); + scsi_host_put(shost); } enum { From patchwork Thu Aug 10 16:09:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 109822 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2562599obb; Thu, 10 Aug 2017 08:45:14 -0700 (PDT) X-Received: by 10.99.157.8 with SMTP id i8mr11929969pgd.101.1502379914512; Thu, 10 Aug 2017 08:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502379914; cv=none; d=google.com; s=arc-20160816; b=qY68uERaMbxSJH8QhPMBaD3qmgXEl05OcZihzondN7m/LggBEEqjK28SLRvPGo+mb6 3jN+ltXpvLhwTOWNv48ZuCdrq7RekJVz4jBonBhqLrzevdDmlnzA9akmUqTRqwvfr+ax HlbSxNpFARPhOVW+U92UNATjiWyq8u+6Y/RMo//Avigmrm/tPso9CaR1YJI+QaanUEJo lXyAMe1JT39HJci81bIrMgJQTM4dnz54w1tKEweO2Pjqj58Bl+qIe0QxxrcrwwbKtpVp 1JARvRPuOZjR40Tblw3ESEDrgimJr0P1BcVVtMqE7Xqg0YVo/I2BKK3BkNN6rTELgtNA N+vA== 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=FtNHd/Czb9Vc4hbi5akhNyOjP8bjNCmRiWh18b9P9ho=; b=pFeAOpnuzo+zJdvyEFo2rOyg67Xep0Ksa4yxe1TLp1LOVMYJeCPyda5cjtnA8S5Kj8 gMtLRTgf8a11X1uiPN4bC/shMC9IVSvFVm8Wbyp0FV3AwsXcXFqvI1EIqdBhYdUmYBej uhGNzERlyh39ie+I0xBkUx8Gqz2fY5MTJP0OyWL0t5jwqAi46LL+t8erHC6Z5CnOWJvr pxxD8z4/t/ake2/26ZG5cWOKCgs9lZSAtvJeX+wGJv9n8gQ94HRSQ/W/2eOZ9xnPnmiE TWF97pGLTnz+Jg2IuKJ3oYdrHNgAaHoMfF2ycrdc2WhFQBhYb2JKWwUESqOCqCNqnBwi J4rA== 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 a62si4322125pfj.230.2017.08.10.08.45.13; Thu, 10 Aug 2017 08:45: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 S1753221AbdHJPoz (ORCPT + 25 others); Thu, 10 Aug 2017 11:44:55 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3499 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752962AbdHJPmz (ORCPT ); Thu, 10 Aug 2017 11:42:55 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEV99178; Thu, 10 Aug 2017 23:42:51 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Thu, 10 Aug 2017 23:42:41 +0800 From: John Garry To: , CC: , , , , John Garry Subject: [PATCH 19/19] scsi: hisi_sas: remove driver versioning Date: Fri, 11 Aug 2017 00:09:44 +0800 Message-ID: <1502381384-219889-20-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502381384-219889-1-git-send-email-john.garry@huawei.com> References: <1502381384-219889-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598C7EFD.000E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 30093efa697e45dad0af716b0cedae0c Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver version is not updated with changes to the driver, so it has no value, so just get rid of it. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 -- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 - 3 files changed, 6 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 4c393cd..07f4a4c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -26,8 +26,6 @@ #include #include -#define DRV_VERSION "v1.6" - #define HISI_SAS_MAX_PHYS 9 #define HISI_SAS_MAX_QUEUES 32 #define HISI_SAS_QUEUE_SLOTS 512 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 9427835..bdef111 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2013,8 +2013,6 @@ int hisi_sas_remove(struct platform_device *pdev) static __init int hisi_sas_init(void) { - pr_info("hisi_sas: driver version %s\n", DRV_VERSION); - hisi_sas_stt = sas_domain_attach_transport(&hisi_sas_transport_ops); if (!hisi_sas_stt) return -ENOMEM; @@ -2030,7 +2028,6 @@ static __exit void hisi_sas_exit(void) module_init(hisi_sas_init); module_exit(hisi_sas_exit); -MODULE_VERSION(DRV_VERSION); MODULE_LICENSE("GPL"); MODULE_AUTHOR("John Garry "); MODULE_DESCRIPTION("HISILICON SAS controller driver"); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index a20e354..2e5fa97 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2005,7 +2005,6 @@ enum { module_pci_driver(sas_v3_pci_driver); -MODULE_VERSION(DRV_VERSION); MODULE_LICENSE("GPL"); MODULE_AUTHOR("John Garry "); MODULE_DESCRIPTION("HISILICON SAS controller v3 hw driver based on pci device");