From patchwork Fri Nov 9 14:06:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 150650 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp212172ljp; Fri, 9 Nov 2018 06:07:00 -0800 (PST) X-Google-Smtp-Source: AJdET5f0e95gLvH7T8yEOBBpB9Jw85YOEmAmPWVvXnUMOgZRkoW25bMSk0MLs6fXDQNKnkBUj7Fl X-Received: by 2002:a17:902:b943:: with SMTP id h3-v6mr8500559pls.124.1541772420540; Fri, 09 Nov 2018 06:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541772420; cv=none; d=google.com; s=arc-20160816; b=JQMggosy3sl8027qxARNAOaOiZMYUlbiDoBYetKE+phppW37KzSGRUriGVDUWJy3p4 3nMEC8VtXWHrbXEpS8rktXYWMGHo//jCvkwCdBO/rxDMACIBTFlqpPuJSUc95O3rtdK+ P+AhqficAkPUkHZKicvHJVt94nLB11JE4cjmOyEpy0Q/KyMINgA02RqNBm0KUha17Fgf 4/4mQyZp0zySQxEz5xCKph0f0eLWksw6mTQj14mfquhCTke5Y6JHaZhN5zIt12VQfgGy H8425Mwy5YXywN3AMIHQDFnZCE1vPVfgUxEJAD/zdtzRtFoiZ7S0i+r4wRPKA6Z48JML zoAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Ws2YXea5CUGZyi2UpAVjM+A/Gn51IVmfwiReEsf2QrY=; b=N7SSPry6Y4lSmTEzmsrEtSZ/yNNdnZyTUGXOjH/1w+qn2VJm2QO4lkLD2XWtUr4yTw PvBs3eDSRrxcC8FZGwfJqbk77U3S9UYLbatCqXyR4Xt/UVSm4HvxFncrPz+MnpV2v69W lbzzBnIQPvXd3E1eS+29bU2oVck8VEndB3iAD0vUYFaHXQClqzhLd4uRWpl9PAJze5mz puDFIQ4X224+3H7uoNuCRkZeURU96HjoBOuA7mlupcn0oVgBVMgwT6DMLDipcDD0Nso0 uGNXsAzVFxKOr44iZfERvRplaGfcVC+rBt47i98WkaFrrXUWIiPW/2cDdpkB78MMOXUr W/rg== 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 l184si6806759pgd.523.2018.11.09.06.06.44; Fri, 09 Nov 2018 06:07:00 -0800 (PST) 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 S1728351AbeKIXp7 (ORCPT + 32 others); Fri, 9 Nov 2018 18:45:59 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:47734 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728026AbeKIXpx (ORCPT ); Fri, 9 Nov 2018 18:45:53 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id DD0B255EAAD; Fri, 9 Nov 2018 22:05:04 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 9 Nov 2018 22:04:54 +0800 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH 1/5] scsi: hisi_sas: Create separate host attributes per HBA Date: Fri, 9 Nov 2018 22:06:32 +0800 Message-ID: <1541772396-161814-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1541772396-161814-1-git-send-email-john.garry@huawei.com> References: <1541772396-161814-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Currently all the three HBA (v1/v2/v3 HW) share the same host attribute. To support each HBA having separate attributes in future, create per-HBA attributes. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 - drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ------ drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 7 ++++++- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 7 ++++++- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 7 ++++++- 5 files changed, 18 insertions(+), 10 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 0ddb53c..94a9e13 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -468,7 +468,6 @@ extern int hisi_sas_probe(struct platform_device *pdev, extern int hisi_sas_slave_configure(struct scsi_device *sdev); extern int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time); extern void hisi_sas_scan_start(struct Scsi_Host *shost); -extern struct device_attribute *host_attrs[]; extern int hisi_sas_host_reset(struct Scsi_Host *shost, int reset_type); extern void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy); extern void hisi_sas_slot_task_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 b3f01d5..8633ff9 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1994,12 +1994,6 @@ void hisi_sas_kill_tasklets(struct hisi_hba *hisi_hba) struct scsi_transport_template *hisi_sas_stt; EXPORT_SYMBOL_GPL(hisi_sas_stt); -struct device_attribute *host_attrs[] = { - &dev_attr_phy_event_threshold, - NULL, -}; -EXPORT_SYMBOL_GPL(host_attrs); - static struct sas_domain_function_template hisi_sas_transport_ops = { .lldd_dev_found = hisi_sas_dev_found, .lldd_dev_gone = hisi_sas_dev_gone, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index f0e457e..d24342b 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1799,6 +1799,11 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba) return 0; } +static struct device_attribute *host_attrs_v1_hw[] = { + &dev_attr_phy_event_threshold, + NULL +}; + static struct scsi_host_template sht_v1_hw = { .name = DRV_NAME, .module = THIS_MODULE, @@ -1817,7 +1822,7 @@ static int hisi_sas_v1_init(struct hisi_hba *hisi_hba) .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, - .shost_attrs = host_attrs, + .shost_attrs = host_attrs_v1_hw, }; static const struct hisi_sas_hw hisi_sas_v1_hw = { diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index cc36b64..e78a97e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3554,6 +3554,11 @@ static void wait_cmds_complete_timeout_v2_hw(struct hisi_hba *hisi_hba, dev_dbg(dev, "wait commands complete %dms\n", time); } +struct device_attribute *host_attrs_v2_hw[] = { + &dev_attr_phy_event_threshold, + NULL +}; + static struct scsi_host_template sht_v2_hw = { .name = DRV_NAME, .module = THIS_MODULE, @@ -3572,7 +3577,7 @@ static void wait_cmds_complete_timeout_v2_hw(struct hisi_hba *hisi_hba, .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, - .shost_attrs = host_attrs, + .shost_attrs = host_attrs_v2_hw, }; static const struct hisi_sas_hw hisi_sas_v2_hw = { diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index bd4ce38..68a6ec2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2091,6 +2091,11 @@ static void wait_cmds_complete_timeout_v3_hw(struct hisi_hba *hisi_hba, dev_dbg(dev, "wait commands complete %dms\n", time); } +struct device_attribute *host_attrs_v3_hw[] = { + &dev_attr_phy_event_threshold, + NULL +}; + static struct scsi_host_template sht_v3_hw = { .name = DRV_NAME, .module = THIS_MODULE, @@ -2109,7 +2114,7 @@ static void wait_cmds_complete_timeout_v3_hw(struct hisi_hba *hisi_hba, .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, - .shost_attrs = host_attrs, + .shost_attrs = host_attrs_v3_hw, .tag_alloc_policy = BLK_TAG_ALLOC_RR, }; From patchwork Fri Nov 9 14:06:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 150649 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp211324ljp; Fri, 9 Nov 2018 06:06:30 -0800 (PST) X-Google-Smtp-Source: AJdET5fMRipn9QUqANQy023tNUV/d6BYn5WZRAP3a01NJ6WWz+ukapnck5o/zQ5L4+ZUlUUktAj0 X-Received: by 2002:a62:83c2:: with SMTP id h185-v6mr9035675pfe.187.1541772390487; Fri, 09 Nov 2018 06:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541772390; cv=none; d=google.com; s=arc-20160816; b=iMRzhnrLG/Z2pe6OmY6O5tevZ12QIN/oJxwlNCGuOj8FEzFlXBi0UjDfltKkGb6Ta5 5lUYAs1LL7XHHg5Ly8gsMU/vIdH+aenOeQMeS8uQlk02YCE4XXCeS0Vo80u/V2Tdnnq7 lz4FbCOQiES55whqx1CUEb9R2SvEfb8OmP0Qxh76XLI7DAXmX4VxO4sg05CCH1sAIYo7 DsTvKcgCgVxJF5v34STb+5kloIRez0dTpEYPfJaBLJBj4mFaaJIoAvaSFg/ee/5L/PcF RFGCflMgdZMAiQK+W7oQ261jfjf+t1pyAlAARzr4NbX2yZvsJMCV+JEUWDPHEO0E80Kq Z1IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=y0ir2bFuJsTYed02a4YuL4KoOA+L/W8LCBVQVggLctU=; b=PUvWUheGZYrqX9vRNtHjzh6zJqd0khHZNG/Q5D8B0s9IuLmO4hkSWY4JxcKms2Ug50 /stl4PNQKDD1+Lu3cZVcze38CYXxSfyGbLJ4PVxQv+XzvLp+NGngvzq30FhZu2F8vPPB 2b6PtjzHUvERdR/OGnecdnNDKY4eM6Q6ca8o2EJDduYJyhD2MbJa5BIVNC3DHP2VJGM3 Iyr5UWxuoRKNgQastQ8mWhf7s57ktb4qqZRLCvKyUSB9LO8rrjhy4BJDctKJicjwcnn4 EslhJdFeUWDSE/LCxeqp+V18xBejtKAVT0pQ/PFDYLmGZ4rRPfmiiMr7dBSHoqQtrvRO uNsA== 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 l184si6806759pgd.523.2018.11.09.06.06.00; Fri, 09 Nov 2018 06:06:30 -0800 (PST) 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 S1728296AbeKIXpw (ORCPT + 32 others); Fri, 9 Nov 2018 18:45:52 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:47741 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728236AbeKIXpv (ORCPT ); Fri, 9 Nov 2018 18:45:51 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E1BA5692CA548; Fri, 9 Nov 2018 22:05:04 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 9 Nov 2018 22:04:55 +0800 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH 2/5] scsi: hisi_sas: Add support for interrupt converge for v3 hw Date: Fri, 9 Nov 2018 22:06:33 +0800 Message-ID: <1541772396-161814-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1541772396-161814-1-git-send-email-john.garry@huawei.com> References: <1541772396-161814-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen If CQ_INT_CONVERGE_EN is enabled, the interrupts of all the 16 CQ queues will be reported by CQ0. So we need to change the process of CQ tasklet for this situation. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 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 68a6ec2..10d1651 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -42,6 +42,7 @@ #define MAX_CON_TIME_LIMIT_TIME 0xa4 #define BUS_INACTIVE_LIMIT_TIME 0xa8 #define REJECT_TO_OPEN_LIMIT_TIME 0xac +#define CQ_INT_CONVERGE_EN 0xb0 #define CFG_AGING_TIME 0xbc #define HGC_DFX_CFG2 0xc0 #define CFG_ABT_SET_QUERY_IPTT 0xd4 @@ -371,6 +372,9 @@ struct hisi_sas_err_record_v3 { ((fis.command == ATA_CMD_DEV_RESET) && \ ((fis.control & ATA_SRST) != 0))) +static bool hisi_sas_intr_conv; +MODULE_PARM_DESC(intr_conv, "interrupt converge enable (0-1)"); + static u32 hisi_sas_read32(struct hisi_hba *hisi_hba, u32 off) { void __iomem *regs = hisi_hba->regs + off; @@ -436,6 +440,8 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1); hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1); hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1); + hisi_sas_write32(hisi_hba, CQ_INT_CONVERGE_EN, + hisi_sas_intr_conv); hisi_sas_write32(hisi_hba, OQ_INT_SRC, 0xffff); hisi_sas_write32(hisi_hba, ENT_INT_SRC1, 0xffffffff); hisi_sas_write32(hisi_hba, ENT_INT_SRC2, 0xffffffff); @@ -1880,10 +1886,12 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) for (i = 0; i < hisi_hba->queue_count; i++) { struct hisi_sas_cq *cq = &hisi_hba->cq[i]; struct tasklet_struct *t = &cq->tasklet; + int nr = hisi_sas_intr_conv ? 16 : 16 + i; + unsigned long irqflags = hisi_sas_intr_conv ? IRQF_SHARED : 0; - rc = devm_request_irq(dev, pci_irq_vector(pdev, i+16), - cq_interrupt_v3_hw, 0, - DRV_NAME " cq", cq); + rc = devm_request_irq(dev, pci_irq_vector(pdev, nr), + cq_interrupt_v3_hw, irqflags, + DRV_NAME " cq", cq); if (rc) { dev_err(dev, "could not request cq%d interrupt, rc=%d\n", @@ -1900,8 +1908,9 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) free_cq_irqs: for (k = 0; k < i; k++) { struct hisi_sas_cq *cq = &hisi_hba->cq[k]; + int nr = hisi_sas_intr_conv ? 16 : 16 + k; - free_irq(pci_irq_vector(pdev, k+16), cq); + free_irq(pci_irq_vector(pdev, nr), cq); } free_irq(pci_irq_vector(pdev, 11), hisi_hba); free_chnl_interrupt: @@ -2091,8 +2100,16 @@ static void wait_cmds_complete_timeout_v3_hw(struct hisi_hba *hisi_hba, dev_dbg(dev, "wait commands complete %dms\n", time); } +static ssize_t intr_conv_v3_hw_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return scnprintf(buf, PAGE_SIZE, "%u\n", hisi_sas_intr_conv); +} +static DEVICE_ATTR_RO(intr_conv_v3_hw); + struct device_attribute *host_attrs_v3_hw[] = { &dev_attr_phy_event_threshold, + &dev_attr_intr_conv_v3_hw, NULL }; @@ -2308,8 +2325,9 @@ struct device_attribute *host_attrs_v3_hw[] = { free_irq(pci_irq_vector(pdev, 11), hisi_hba); for (i = 0; i < hisi_hba->queue_count; i++) { struct hisi_sas_cq *cq = &hisi_hba->cq[i]; + int nr = hisi_sas_intr_conv ? 16 : 16 + i; - free_irq(pci_irq_vector(pdev, i+16), cq); + free_irq(pci_irq_vector(pdev, nr), cq); } pci_free_irq_vectors(pdev); } @@ -2631,6 +2649,7 @@ static int hisi_sas_v3_resume(struct pci_dev *pdev) }; module_pci_driver(sas_v3_pci_driver); +module_param_named(intr_conv, hisi_sas_intr_conv, bool, 0444); MODULE_LICENSE("GPL"); MODULE_AUTHOR("John Garry "); From patchwork Fri Nov 9 14:06:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 150652 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp212971ljp; Fri, 9 Nov 2018 06:07:33 -0800 (PST) X-Google-Smtp-Source: AJdET5eP4+XF9A+hATpKeOGmGWoNC1Nd4baxhYboZGSaiX47Nu22HDvPED/Xz35oNi3w5FR+X9U+ X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr9181640pla.131.1541772452966; Fri, 09 Nov 2018 06:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541772452; cv=none; d=google.com; s=arc-20160816; b=UxudlmQrEBGdof30cjUawyqOT2BzLMJgr/9zNo1LDECvTlQTeBxOAJzDDY7CpCt3eL HW0GmnTvln9w2HEtRHgK+8uT4jX/hQvyNeZZrM6RDC0nVs9U1StD8o56u4XkT40rt/4Z wDGSin6/XyvF1w8DS2eTjCTuDNNd2chaF/YFsC3NonGzA63AdUBCWptr8+q3s39H8yvV YERmIiE9P63NGPF0vwvSyYv7sWB3YzIL4eH6xibyydcqQi7KGhYdYVfN/nN/K7VAqYj7 wbxT3E5E95PPV1iolfAczQNMEctQqRCrVNjopYmHgscWbWL6nTwF3VExSjkCspqF3LvL dvxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Du7KnrGyUsGPBLUIq506jdmzzIZU70I3xHUkRV2z4Ao=; b=Biq9o1CxjuEIfwT/EKkedZ9Bp9M+Yy7F9lLJr89yO1cLENjDojZt0rZFXjC5ZuCjIe rB4orc1CFFeTbqu3uML9RcTrCA4RDwaG61RIXUoB9pdK9OCc3L17yYMN3GY5V5f7FrFp Mlc/T5U92H9z9UZovASCJov3wUpbDGW67Vlf9LI6m6HYFYb3y/F7anDzqhxcKz9R27MK j8Q+ndawN/kZOmvUShPe6DBlHuyEl8pbokhh0B6U0IcUn9O4Npw2HcqeKHPdDe9sopfd OwDZYznEQ+gAqrckD7Jrmz7gdMyq9StkwitarrSBRKjsgWifCNG4mNiUwFfahO5E3eY0 efYA== 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 l184si6806759pgd.523.2018.11.09.06.07.21; Fri, 09 Nov 2018 06:07:32 -0800 (PST) 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 S1728376AbeKIXqU (ORCPT + 32 others); Fri, 9 Nov 2018 18:46:20 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:47755 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728237AbeKIXqU (ORCPT ); Fri, 9 Nov 2018 18:46:20 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EF6015679302F; Fri, 9 Nov 2018 22:05:04 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 9 Nov 2018 22:04:55 +0800 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH 3/5] scsi: hisi_sas: Add support for interrupt coalescing for v3 hw Date: Fri, 9 Nov 2018 22:06:34 +0800 Message-ID: <1541772396-161814-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1541772396-161814-1-git-send-email-john.garry@huawei.com> References: <1541772396-161814-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen If INT_COAL_EN is enabled, config time and count of interrupt coalescing. Then if CQ collects count of CQ entries in time, it will report the interrupt. Or if CQ doesn't collect enough CQ entries in time, it Will report the interrupt at timeout. As all the registers are not supported to be changed dynamically, so need to config those register between disable and enable PHYs. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 100 +++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 94a9e13..535c613 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -322,6 +322,8 @@ struct hisi_hba { unsigned long sata_dev_bitmap[BITS_TO_LONGS(HISI_SAS_MAX_DEVICES)]; struct work_struct rst_work; u32 phy_state; + u32 intr_coal_ticks; /* Time of interrupt coalesce in us */ + u32 intr_coal_count; /* Interrupt count to coalesce */ }; /* Generic HW DMA host memory structures */ diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 10d1651..0c3fa43 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -2107,9 +2107,109 @@ static ssize_t intr_conv_v3_hw_show(struct device *dev, } static DEVICE_ATTR_RO(intr_conv_v3_hw); +static void config_intr_coal_v3_hw(struct hisi_hba *hisi_hba) +{ + /* config those registers between enable and disable PHYs */ + hisi_sas_stop_phys(hisi_hba); + + if (hisi_hba->intr_coal_ticks == 0 || + hisi_hba->intr_coal_count == 0) { + hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1); + hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1); + hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1); + } else { + hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x3); + hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, + hisi_hba->intr_coal_ticks); + hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, + hisi_hba->intr_coal_count); + } + phys_init_v3_hw(hisi_hba); +} + +static ssize_t intr_coal_ticks_v3_hw_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct hisi_hba *hisi_hba = shost_priv(shost); + + return scnprintf(buf, PAGE_SIZE, "%u\n", + hisi_hba->intr_coal_ticks); +} + +static ssize_t intr_coal_ticks_v3_hw_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct hisi_hba *hisi_hba = shost_priv(shost); + u32 intr_coal_ticks; + int ret; + + ret = kstrtou32(buf, 10, &intr_coal_ticks); + if (ret) { + dev_err(dev, "Input data of interrupt coalesce unmatch\n"); + return -EINVAL; + } + + if (intr_coal_ticks >= BIT(24)) { + dev_err(dev, "intr_coal_ticks must be less than 2^24!\n"); + return -EINVAL; + } + + hisi_hba->intr_coal_ticks = intr_coal_ticks; + + config_intr_coal_v3_hw(hisi_hba); + + return count; +} +static DEVICE_ATTR_RW(intr_coal_ticks_v3_hw); + +static ssize_t intr_coal_count_v3_hw_show(struct device *dev, + struct device_attribute + *attr, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct hisi_hba *hisi_hba = shost_priv(shost); + + return scnprintf(buf, PAGE_SIZE, "%u\n", + hisi_hba->intr_coal_count); +} + +static ssize_t intr_coal_count_v3_hw_store(struct device *dev, + struct device_attribute + *attr, const char *buf, size_t count) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct hisi_hba *hisi_hba = shost_priv(shost); + u32 intr_coal_count; + int ret; + + ret = kstrtou32(buf, 10, &intr_coal_count); + if (ret) { + dev_err(dev, "Input data of interrupt coalesce unmatch\n"); + return -EINVAL; + } + + if (intr_coal_count >= BIT(8)) { + dev_err(dev, "intr_coal_count must be less than 2^8!\n"); + return -EINVAL; + } + + hisi_hba->intr_coal_count = intr_coal_count; + + config_intr_coal_v3_hw(hisi_hba); + + return count; +} +static DEVICE_ATTR_RW(intr_coal_count_v3_hw); + struct device_attribute *host_attrs_v3_hw[] = { &dev_attr_phy_event_threshold, &dev_attr_intr_conv_v3_hw, + &dev_attr_intr_coal_ticks_v3_hw, + &dev_attr_intr_coal_count_v3_hw, NULL }; From patchwork Fri Nov 9 14:06:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 150651 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp212647ljp; Fri, 9 Nov 2018 06:07:20 -0800 (PST) X-Google-Smtp-Source: AJdET5dRxwZnUwZ49jKgrcLJ9RG+IV36FGkQgTIMdfz5uz7FGz45TV2qOmpPKN4CXtUMgN5uv6wN X-Received: by 2002:a63:585c:: with SMTP id i28mr7637911pgm.178.1541772440122; Fri, 09 Nov 2018 06:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541772440; cv=none; d=google.com; s=arc-20160816; b=tD25TYOR1Q+A06AoaRObzBSVBSP1TwZm6FQjw8LvpOeg4o5kLRwv+4IgoJq/+wwp8D HR/kPhcQXDnLWe7T4oPevjogJoCr2IMJPyTm34S2aLhKxnZDpGqdD8CgGJrDfJz5l3Jq 1jEsY15jebsSRgad4HEUaiQfg933UFkU1rJOsiwGIef2rzqUg/tbW8z/Q8sD6H56XXuf rEKhs18K00FkQHV9nRcJwVsL4JVLqNQelkeoHtJktaHvgshHbSLPeMUJm1LI9yHNH7cP 6LysAaXU630zzF7iR7I+jLujQ9N5wczMDZ/4g059hF/RIF3dXhHUItdCPmMTnDBMS6MN LsHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=6vezAt6QPraC8w/apFmg9eHDF5aLYCmFFqYeXurs+jY=; b=SHQIjYLGelEuu2vpoTxZf2p/bKtyfvLosljnCuCPXw/bziOCX4++N4i1uzvsZ3DGiU lpffApIAB7FJIS0QgNCXhMHS+bbxVricuvLUOA/0iWC6b3Y99gubbOuVf+CI7TUWAsFW gmtMMIXHV41wRLevEfwnSQaJLZFNx0FR3LYZxv/uWSoIh6roWR3wNK4ReYiwxyBiPicx 0BOpydEzc2PYA3U56lEYgSuFNTcvVEsjDKpOR1kF623gruf0HEYWkqpU4fG8L875eL9T EFqH5H518LWvnPhbqXhh5Sjf1YJNDoZKubjKAUGMZNKxfuxzIZTs2OQgxHe7xtrWOmFk 1h9g== 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 l184si6806759pgd.523.2018.11.09.06.07.05; Fri, 09 Nov 2018 06:07:20 -0800 (PST) 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 S1728265AbeKIXpw (ORCPT + 32 others); Fri, 9 Nov 2018 18:45:52 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:47752 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727988AbeKIXpv (ORCPT ); Fri, 9 Nov 2018 18:45:51 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EAEA3DB3921BB; Fri, 9 Nov 2018 22:05:04 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 9 Nov 2018 22:04:56 +0800 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH 5/5] scsi: hisi_sas: change the time of SAS SSP connection Date: Fri, 9 Nov 2018 22:06:36 +0800 Message-ID: <1541772396-161814-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1541772396-161814-1-git-send-email-john.garry@huawei.com> References: <1541772396-161814-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Currently the time of SAS SSP connection is 1ms, which means the link connection will fail if no IO response after this period. For some disks handling large IO (such as 512k), 1ms is not enough, so change it to 5ms. 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 0c3fa43..a677296 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -500,7 +500,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, i, PHYCTRL_OOB_RESTART_MSK, 0x1); hisi_sas_phy_write32(hisi_hba, i, STP_LINK_TIMER, 0x7f7a120); hisi_sas_phy_write32(hisi_hba, i, CON_CFG_DRIVER, 0x2a0a01); - + hisi_sas_phy_write32(hisi_hba, i, SAS_SSP_CON_TIMER_CFG, 0x32); /* used for 12G negotiate */ hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e); hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff);