From patchwork Tue Jun 25 11:04:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FAB313AF for ; Tue, 25 Jun 2019 11:04:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DE611FF29 for ; Tue, 25 Jun 2019 11:04:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DAFE2896F; Tue, 25 Jun 2019 11:04:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6532E1FF29 for ; Tue, 25 Jun 2019 11:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729774AbfFYLE5 (ORCPT ); Tue, 25 Jun 2019 07:04:57 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42021 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLE5 (ORCPT ); Tue, 25 Jun 2019 07:04:57 -0400 Received: by mail-pg1-f195.google.com with SMTP id k13so2620462pgq.9 for ; Tue, 25 Jun 2019 04:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TgCgky6YIODK9Qkx2FukavRnGMLU1Hv4ZF/hfiUliTU=; b=LL6ct4K8F57DIeoySOPDbPGSPUIxRuAw5aaw+UQ6owDHsZ0fxcLnLnSsStYRuIbyXN xcZAcinrt8xCkv/MiQ7+CS9rgBT4BdlXAgvZKN2HSLo/4y+w96T9wnA0YtMkflP+ZiIn pngXbJpDEu14LyywlKkteZqAk6+D/hSs4LZig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TgCgky6YIODK9Qkx2FukavRnGMLU1Hv4ZF/hfiUliTU=; b=Xf9vN9iiN7nOy27E0+lWV8kweXg+sXY/bdLC9bndu8aJZrhY15OG2Sxl30ja3EfY9H d30DaAS00FxOMAtz7K50+GWCKUE965WX0YshsKOhIhq1u8Z16jkdykay+CUGWDTP6BwB C5YETGEikmlql9sTyGjnPnvcU894TXKJiGQrwF55SR0AbVrY0qO5h5cxOoJJZBJEmMlE 6Lk9P6juTe/M5kExBNODElusCrsaCXW+3HtEeTsJKSFNoHW9t7qCuDhhIVVjSc8pwjqZ 6m2/RRgU23cXtsXPXGRGQSTQi/Gn1vKGCpiE5v1rLAuLMx76HUYlLg4eBnFdbYUTiwQ0 eIaQ== X-Gm-Message-State: APjAAAWLoR1zP0rpZQykfkpc1niGh3E4udWQNmUUSfOzdGstTuteqW0u pYkyu02Uc28t4Y3tXoym6LJQRsKmSBVKEo7KG+h2A/5hHrYN6ie5n8MxxVZFDRfqLhUrwX8mOOw T4WDDIYwwHSzhGrKJUHUhEVJmVw7homZ6viBmKM+cP3KZuGb9xC5aiWYK1JPG1uthCC7TbUkfWU OE/h5WQ199fv4j X-Google-Smtp-Source: APXvYqyRjbqdgAwqOc0Bfz+UBC/23sSRcw8B3lHs1+BKDA5oiT5oKQIZUrPsP4C1QNhghIjm9214BA== X-Received: by 2002:a65:448a:: with SMTP id l10mr37968483pgq.53.1561460695464; Tue, 25 Jun 2019 04:04:55 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.04.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:04:54 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 01/18] megaraid_sas: Add 32 bit atomic descriptor support to AERO adapters Date: Tue, 25 Jun 2019 16:34:19 +0530 Message-Id: <20190625110436.4703-2-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Aero adapters provides Atomic Request Descriptor as an alternative method for posting an entry onto a request queue. The posting of an Atomic Request Descriptor is an atomic operation, providing a safe mechanism for multiple processors on the host to post requests without synchronization. This Atomic Request Descriptor format is identical to first 32 bits of Default Request Descriptor and uses only 32 bits. If Aero adapters support Atomic descriptor, driver should use it for posting IOs and DCMDs to firmware. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 3 ++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 45 +++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index e138d14..a08dd9c 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1600,6 +1600,8 @@ enum FW_BOOT_CONTEXT { #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 +#define MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET (1 << 24) + #define MR_CAN_HANDLE_64_BIT_DMA_OFFSET (1 << 25) #define MEGASAS_WATCHDOG_THREAD_INTERVAL 1000 @@ -2395,6 +2397,7 @@ struct megasas_instance { struct dentry *raidmap_dump; #endif u8 enable_fw_dev_list; + bool atomic_desc_support; }; struct MR_LD_VF_MAP { u32 size; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 8a7ac5c..4411408 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -277,21 +277,17 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance, } /** - * megasas_fire_cmd_fusion - Sends command to the FW - * @instance: Adapter soft state - * @req_desc: 64bit Request descriptor - * - * Perform PCI Write. + * megasas_write_64bit_req_desc - PCI writes 64bit request descriptor + * @instance: Adapter soft state + * @req_desc: 64bit Request descriptor */ - static void -megasas_fire_cmd_fusion(struct megasas_instance *instance, +megasas_write_64bit_req_desc(struct megasas_instance *instance, union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc) { #if defined(writeq) && defined(CONFIG_64BIT) u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) | le32_to_cpu(req_desc->u.low)); - writeq(req_data, &instance->reg_set->inbound_low_queue_port); #else unsigned long flags; @@ -305,6 +301,25 @@ megasas_fire_cmd_fusion(struct megasas_instance *instance, } /** + * megasas_fire_cmd_fusion - Sends command to the FW + * @instance: Adapter soft state + * @req_desc: 32bit or 64bit Request descriptor + * + * Perform PCI Write. AERO SERIES supports 32 bit Descriptor. + * Prior to AERO_SERIES support 64 bit Descriptor. + */ +static void +megasas_fire_cmd_fusion(struct megasas_instance *instance, + union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc) +{ + if (instance->atomic_desc_support) + writel(le32_to_cpu(req_desc->u.low), + &instance->reg_set->inbound_single_queue_port); + else + megasas_write_64bit_req_desc(instance, req_desc); +} + +/** * megasas_fusion_update_can_queue - Do all Adapter Queue depth related calculations here * @instance: Adapter soft state * fw_boot_context: Whether this function called during probe or after OCR @@ -1171,7 +1186,8 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) break; } - megasas_fire_cmd_fusion(instance, &req_desc); + /* For AERO also, IOC_INIT requires 64 bit descriptor write */ + megasas_write_64bit_req_desc(instance, &req_desc); wait_and_poll(instance, cmd, MFI_IO_TIMEOUT_SECS); @@ -1181,6 +1197,17 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) goto fail_fw_init; } + if (instance->adapter_type >= AERO_SERIES) { + scratch_pad_1 = megasas_readl + (instance, &instance->reg_set->outbound_scratch_pad_1); + + instance->atomic_desc_support = + (scratch_pad_1 & MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET) ? 1 : 0; + + dev_info(&instance->pdev->dev, "FW supports atomic descriptor\t: %s\n", + instance->atomic_desc_support ? "Yes" : "No"); + } + return 0; fail_fw_init: From patchwork Tue Jun 25 11:04:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA52214B6 for ; Tue, 25 Jun 2019 11:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB5501FF29 for ; Tue, 25 Jun 2019 11:05:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF0E12896F; Tue, 25 Jun 2019 11:05:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45D3F1FF29 for ; Tue, 25 Jun 2019 11:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730037AbfFYLFA (ORCPT ); Tue, 25 Jun 2019 07:05:00 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37617 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLE7 (ORCPT ); Tue, 25 Jun 2019 07:04:59 -0400 Received: by mail-pl1-f195.google.com with SMTP id bh12so8649453plb.4 for ; Tue, 25 Jun 2019 04:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MTW9Jfhqa3WzeDUCjzlQ1hjebGSFomDtiNWcykKm+Kw=; b=OWmBReklaDXx4th2BrPSCrFgIjxxVD+Or6UNYj/toE397SB08Iang4UA4Z+2fT/YRa cw0rbXLx6XQ6PmiB2lQH6sMCLHVeThNaAymaZCXd7wFMmhFOV1TqGgDaFwr770imqnXZ e0cbQ94vBCGmvW5ob9IgbMcOYFf1VxqVxgCCw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MTW9Jfhqa3WzeDUCjzlQ1hjebGSFomDtiNWcykKm+Kw=; b=WJ5L/vtjoHj7fFH2/6vp061djiB6NfUWxx51Orm6y0dS2SkoR8UdRJHchwT6IP0p2y bdtA1Hg//uOxdejg8d7QIF/jcAflV760FHWLlJVFO38gUsxAnZxAXFL0dJMLYCVzdiby HZ4y1BSSAxqRHGKQ3qsFEo0jpcW2uiOJxkEkiuCj429B9jGMovYpylNfr6jBWlC+eksp +oxYjPyinF7TAHU6FBLA+NMdJJ2T4+mnuY9PFcU+rwc3XJGjhuaDKlyzPSTTPaiBfSQW xvCXKHFOvLp0+sO+OWdCoMUyk4EYiDv0Obv1LYupzMKF26o5WsKimAfFYgxUycdRCIKL hpvg== X-Gm-Message-State: APjAAAU/GH1ktR+0ZyEieqZ0yDPfvwko/UgQxbhJ8KBzMhmvpidHPQOS ZnYMde5JpjC6/RrWCt6rZsO0+yv4qSTtMdYcTL2S9+yKeXF/QyVihrIY6hZZ+2qJj5iCbUjgC/a 2VGTcyV1IzZdkeS6ezs7zjROCVYTz/ILyEsL8ylbDvVTdQNnaLUsSR7AR5OK6NYl7M1wF2vj1wo ij1wo4AHm0frpa X-Google-Smtp-Source: APXvYqx0ctpgdj5vA1ZJF4Q7xytpafO3AlzZlVhUqKQD/DvIRNwkNjWNEQSAMbtgk6GIsFH0S94BIg== X-Received: by 2002:a17:902:6903:: with SMTP id j3mr77310483plk.247.1561460698600; Tue, 25 Jun 2019 04:04:58 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.04.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:04:58 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 02/18] megaraid_sas: Add support for Non-secure Aero PCI IDs Date: Tue, 25 Jun 2019 16:34:20 +0530 Message-Id: <20190625110436.4703-3-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch will add support for Non-secure Aero adapters' PCI IDs. Driver will throw an error message when a non-secure type controller is detected. Purpose of this interface is to avoid interacting with any firmware which is not secured/signed by Broadcom. Any tampering on Firmware component will be detected by hardware and it will be communicated to the driver to avoid any further interaction with that component. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 4 ++++ drivers/scsi/megaraid/megaraid_sas_base.c | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index a08dd9c..61bcf7a 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -64,6 +64,10 @@ #define PCI_DEVICE_ID_LSI_AERO_10E2 0x10e2 #define PCI_DEVICE_ID_LSI_AERO_10E5 0x10e5 #define PCI_DEVICE_ID_LSI_AERO_10E6 0x10e6 +#define PCI_DEVICE_ID_LSI_AERO_10E0 0x10e0 +#define PCI_DEVICE_ID_LSI_AERO_10E3 0x10e3 +#define PCI_DEVICE_ID_LSI_AERO_10E4 0x10e4 +#define PCI_DEVICE_ID_LSI_AERO_10E7 0x10e7 /* * Intel HBA SSDIDs diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5490898..7d1cf4e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -168,6 +168,10 @@ static struct pci_device_id megasas_pci_table[] = { {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E2)}, {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E5)}, {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E6)}, + {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E0)}, + {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E3)}, + {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E4)}, + {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_AERO_10E7)}, {} }; @@ -6991,6 +6995,12 @@ static int megasas_probe_one(struct pci_dev *pdev, u16 control = 0; switch (pdev->device) { + case PCI_DEVICE_ID_LSI_AERO_10E0: + case PCI_DEVICE_ID_LSI_AERO_10E3: + case PCI_DEVICE_ID_LSI_AERO_10E4: + case PCI_DEVICE_ID_LSI_AERO_10E7: + dev_err(&pdev->dev, "Adapter is in non secure mode\n"); + return 1; case PCI_DEVICE_ID_LSI_AERO_10E1: case PCI_DEVICE_ID_LSI_AERO_10E5: dev_info(&pdev->dev, "Adapter is in configurable secure mode\n"); @@ -7246,6 +7256,10 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) struct megasas_instance *instance; instance = pci_get_drvdata(pdev); + + if (!instance) + return 0; + instance->unload = 1; dev_info(&pdev->dev, "%s is called\n", __func__); @@ -7299,6 +7313,10 @@ megasas_resume(struct pci_dev *pdev) int irq_flags = PCI_IRQ_LEGACY; instance = pci_get_drvdata(pdev); + + if (!instance) + return 0; + host = instance->host; pci_set_power_state(pdev, PCI_D0); pci_enable_wake(pdev, PCI_D0, 0); @@ -7467,6 +7485,10 @@ static void megasas_detach_one(struct pci_dev *pdev) u32 pd_seq_map_sz; instance = pci_get_drvdata(pdev); + + if (!instance) + return; + host = instance->host; fusion = instance->ctrl_context; @@ -7595,6 +7617,9 @@ static void megasas_shutdown(struct pci_dev *pdev) { struct megasas_instance *instance = pci_get_drvdata(pdev); + if (!instance) + return; + instance->unload = 1; if (megasas_wait_for_adapter_operational(instance)) From patchwork Tue Jun 25 11:04:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABBCD14B6 for ; Tue, 25 Jun 2019 11:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8711FF29 for ; Tue, 25 Jun 2019 11:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AD502896F; Tue, 25 Jun 2019 11:05:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FACD1FF29 for ; Tue, 25 Jun 2019 11:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730046AbfFYLFD (ORCPT ); Tue, 25 Jun 2019 07:05:03 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38463 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFC (ORCPT ); Tue, 25 Jun 2019 07:05:02 -0400 Received: by mail-pl1-f195.google.com with SMTP id g4so8639835plb.5 for ; Tue, 25 Jun 2019 04:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ao3L+nsrX/w76VkkQgVXFDTTGZFNBOjj6cS0RAgCCzo=; b=AKhO3uc00SEKDky+6QGFmw116YX1QFH65G+WCWVxYjPoe480Bajn4715Wf/jv71JYA npAPeQsaQ8WbWeITAGN2Xfx24q0cvR761rsqEMy0XhGkmuXqXFGbbMU6HIYFMpDGe+1s NDbpnpARyqUSBWr6tQNXfDDUNidWvtCHmZCrM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ao3L+nsrX/w76VkkQgVXFDTTGZFNBOjj6cS0RAgCCzo=; b=iE34P7PfVSCTGXBSV8Qcoh73XaMsaPcZ9Y6vUwyUWdYm31ReBEymaYYBK8Bgmn9E6X CTnnSueQQV0du0uZPDoqT07e3/LkQQ870dmpOP8CWC1/zoGXsi+Pha9g5LaCu7Idk6uT 07CRNlo4qht0UxjqMcZMhbYmc4ITITFCc6mG5Wbd6mpO/rXf5b43OrancllRkJ89OVO6 UPOnyqtycuOSonLp1pAo+ihRc2eGGHLX+KAWiocQGGBnH3qPrxcqaYZX39uVGWiqJ1v4 hmsHm4jmRZguFieqKUJOUNT2fYtYpY+2qY6x2MreM4L8+CfSha3UnvP8ge0EGjKDgxnf qR1w== X-Gm-Message-State: APjAAAVkcIsfaVbRIIz9/GgUstZr3IehJiPT6Do0WvtYKallEAth1cvI eP/xZXq0LbN8JvKkTj2M+BxCmpCRg0jzuc8qUU3e2xqGKwaUmjxJmsKai/diT5/EBU3fH9E6MzU zMV+tuJ4W2UWp/rxiN5MfyPMqRF+a8666B0KqJ9vjbe+pYYenXR/z8cb+lTsa5xeImN9/+koA4t lpAWv96kLQ2G8J X-Google-Smtp-Source: APXvYqxVpYVV23V8kLWpw20GJn4qSrR7cmTeDe1rgSwiEvKY1yzn97jnsDi5byHa4xcyg9oQgJBpsw== X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr144681440plb.108.1561460701649; Tue, 25 Jun 2019 04:05:01 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.04.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:01 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 03/18] megaraid_sas: Remove few debug counters from IO path Date: Tue, 25 Jun 2019 16:34:21 +0530 Message-Id: <20190625110436.4703-4-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kashyap Desai Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 5 ----- drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 ----- 2 files changed, 10 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 61bcf7a..a972021 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2323,11 +2323,6 @@ struct megasas_instance { atomic_t fw_outstanding; atomic_t ldio_outstanding; atomic_t fw_reset_no_pci_access; - atomic_t ieee_sgl; - atomic_t prp_sgl; - atomic_t sge_holes_type1; - atomic_t sge_holes_type2; - atomic_t sge_holes_type3; atomic64_t total_io_count; struct megasas_instance_template *instancet; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 4411408..dac8552 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2066,7 +2066,6 @@ megasas_is_prp_possible(struct megasas_instance *instance, mega_mod64(sg_dma_address(sg_scmd), mr_nvme_pg_size)) { build_prp = false; - atomic_inc(&instance->sge_holes_type1); break; } } @@ -2076,7 +2075,6 @@ megasas_is_prp_possible(struct megasas_instance *instance, sg_dma_len(sg_scmd)), mr_nvme_pg_size))) { build_prp = false; - atomic_inc(&instance->sge_holes_type2); break; } } @@ -2085,7 +2083,6 @@ megasas_is_prp_possible(struct megasas_instance *instance, if (mega_mod64(sg_dma_address(sg_scmd), mr_nvme_pg_size)) { build_prp = false; - atomic_inc(&instance->sge_holes_type3); break; } } @@ -2218,7 +2215,6 @@ megasas_make_prp_nvme(struct megasas_instance *instance, struct scsi_cmnd *scmd, main_chain_element->Length = cpu_to_le32(num_prp_in_chain * sizeof(u64)); - atomic_inc(&instance->prp_sgl); return build_prp; } @@ -2293,7 +2289,6 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, memset(sgl_ptr, 0, instance->max_chain_frame_sz); } } - atomic_inc(&instance->ieee_sgl); } /** From patchwork Tue Jun 25 11:04:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84CAD13AF for ; Tue, 25 Jun 2019 11:05:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 766961FF29 for ; Tue, 25 Jun 2019 11:05:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A87E2896F; Tue, 25 Jun 2019 11:05:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F57D1FF29 for ; Tue, 25 Jun 2019 11:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730057AbfFYLFF (ORCPT ); Tue, 25 Jun 2019 07:05:05 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46467 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFF (ORCPT ); Tue, 25 Jun 2019 07:05:05 -0400 Received: by mail-pl1-f193.google.com with SMTP id e5so8648745pls.13 for ; Tue, 25 Jun 2019 04:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1YBgpyZC5t+wsWk7wChS8HOs3vSiojNUjxFitgNjZEY=; b=UZr+JLWSv4RDIoZuGb0u5D4Nt5dXUTK4Jz9QdMizZy3dFhRs6WBlz2QpkOY6x3vXAu 7aW/c5Evrttw66M7v7+/SOO64IIAMGX75mwrZNx8GIVH6nLcScUGxsfOLulJ+6H2Tkp3 1k2PDx75fVPkcpYF2P6wMi4sJOuPHZ9g6NTvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1YBgpyZC5t+wsWk7wChS8HOs3vSiojNUjxFitgNjZEY=; b=T2cB7cJ1h9NJjPOZVvxgINzYBbWWs9v+PYNIhSs8Ul+pS6pDgaW0EYD3wjd32U79oW 0TF0/Dl36UZz+ZYWjHVI6724lApURyySnkRgrB7tRx4WTIeZmsRRN42DslXOp8ynRNXh iLnLuW+rZ1bgRtLCDZ2TKwh9EqNqQxm6B4dobkL81YZ4KZ83/PV+lJTtMGobl948RPvE 0EcuaHVFJ+2/3cyKbEVTfwhPlzZoB3QQVd5qZKKXOKPGit3mtJ3i4eOnDhOWu4ml4cOF zs/sqmBs4rk+Ckn8LIef+zojeIdwbALZFabKuywt5uvwgjLl3CIEU+SlIR4Y8uWxNVEn qOJg== X-Gm-Message-State: APjAAAUpdb6+io7yTq4etH8XuaNk/QuJTZ5D7ryg0eTYK5TxE9jvOKQa z8A2uAffGKgBDGl7IEJcvxomV+RHqfkDRrVYxCLcoDAW8bfV08yYwa9pKGaxh9vf5D7okkhKRWW kqSF4mT6KbW0DrybNFLT719rpOv7dPggTXjrdFnqEQ7SnJVk63qIj81dg7MBvvvfAvqwTiWIr9l XzYx5xlNvECvIA X-Google-Smtp-Source: APXvYqwaNQq1hMGXn9AVC/r9rMuy7sU7wYphzZ5Dx5rXsqeguXYb/7gnNnIeEAp7nB4bFGFzUH3BGg== X-Received: by 2002:a17:902:8f93:: with SMTP id z19mr66325482plo.97.1561460704709; Tue, 25 Jun 2019 04:05:04 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:04 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 04/18] megaraid_sas: Call disable_irq from process IRQ poll Date: Tue, 25 Jun 2019 16:34:22 +0530 Message-Id: <20190625110436.4703-5-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On PowerPC architecture, calling disable_irq_nosync from IRQ context is not providing the required effect. In current megaraid_sas driver, disable_irq_nosync is being called from IRQ context before enabling IRQ poll. But due to the issue seen on PPC, after IRQ poll disable and legacy ISR is enabled, we are not seeing our ISR getting called. Fix: Call disable_irq from IRQ poll thread context instead of IRQ context. Signed-off-by: Shivasharan S Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index a972021..d333b8e 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2186,6 +2186,7 @@ struct megasas_irq_context { u32 os_irq; struct irq_poll irqpoll; bool irq_poll_scheduled; + bool irq_line_enable; }; struct MR_DRV_SYSTEM_INFO { diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index dac8552..b8a5bbf 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -3601,7 +3601,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex, if (irq_context) { if (!irq_context->irq_poll_scheduled) { irq_context->irq_poll_scheduled = true; - disable_irq_nosync(irq_context->os_irq); + irq_context->irq_line_enable = true; irq_poll_sched(&irq_context->irqpoll); } return num_completed; @@ -3681,6 +3681,11 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget) irq_ctx = container_of(irqpoll, struct megasas_irq_context, irqpoll); instance = irq_ctx->instance; + if (irq_ctx->irq_line_enable) { + disable_irq(irq_ctx->os_irq); + irq_ctx->irq_line_enable = false; + } + num_entries = complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx); if (num_entries < budget) { irq_poll_complete(irqpoll); @@ -3726,6 +3731,11 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp) if (instance->mask_interrupts) return IRQ_NONE; +#if defined(ENABLE_IRQ_POLL) + if (irq_context->irq_poll_scheduled) + return IRQ_HANDLED; +#endif + if (!instance->msix_vectors) { mfiStatus = instance->instancet->clear_intr(instance); if (!mfiStatus) From patchwork Tue Jun 25 11:04:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0F3414B6 for ; Tue, 25 Jun 2019 11:05:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A25C21FF29 for ; Tue, 25 Jun 2019 11:05:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9688D2896F; Tue, 25 Jun 2019 11:05:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3403D1FF29 for ; Tue, 25 Jun 2019 11:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730086AbfFYLFJ (ORCPT ); Tue, 25 Jun 2019 07:05:09 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44774 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFI (ORCPT ); Tue, 25 Jun 2019 07:05:08 -0400 Received: by mail-pl1-f195.google.com with SMTP id t7so8653569plr.11 for ; Tue, 25 Jun 2019 04:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x21bqmk9dLzO1D0BNR75+yjl+IKbX45VB/zMtMVbSDI=; b=avzhxG8wbhsi8UUhUecO+m84ZzYIuNfH39ntme7l4OzF1ouuoROq/Z3vKz0OcfCiFB ijZoSFaWf1pN03I/3iSi348B16ZP05+GGFReOL7zOdKEgKS5A4ruzEMjj4YlgpShHr8f BDDkoBsIMuxIoqVOHKG9S4yjgdYXI+Huoj+ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x21bqmk9dLzO1D0BNR75+yjl+IKbX45VB/zMtMVbSDI=; b=jiFsSgeTapgtElRHJsQfpT5HbE2LuxsqWDOynTz6e49yhk8LpjaHZ2Wu/+zowOCrgj N8n9Ea5GIT/UNSpRhRkrTRhGbL2GM/kkHrsrQ8j1npuDBAvgjB0+LIS5p8nF+iG4tEsL kslJikxV1f+8cfPLMisOo1LJWaeC4s0hbixOV5CeHjdhWShldZStoXM6QHTuz8RTixsS yVbKLyGd7cxDu3hMJG+yaeJCuB+N25W50j1jrMpbh3jIyM7UeXELsB3I36mjeObaUrMm Qhr34RSAYz7QF1FDXmAiCGyOpH5W1ZRD2FlA16r4ZC9VGiU7ITszH27pIrbDRxfTrP+6 FQeg== X-Gm-Message-State: APjAAAWD0GYdEVSGWmssbdIqlvT2r+fZ1RcFtXBv7QVMxgNVFO4sBh+k 55hEHM6uxw3L8QoQqmBFjH6eIA/2WzIn0YNEj0veJt6RBCoBV73JPXkiFXF3x/Un9yc5R+rRwMP VsDpHZG6ZQ1xRV6xrE7p6pS1ECKi9ss1M/Z/NzB4SFFDx2M60oYUn68pJRrnCC8oCVg5C4ERqco sAydUZv8Qln4J/ X-Google-Smtp-Source: APXvYqzV/I0TEMCsJHuIPbszHT3B76H/12S4sPMdRf2pj/JbJxeEgH7Xh+CIAiJrrqv47O1gLjmLLA== X-Received: by 2002:a17:902:106:: with SMTP id 6mr92090963plb.64.1561460707796; Tue, 25 Jun 2019 04:05:07 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:07 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 05/18] megaraid_sas: Release Mutex lock before OCR in case of DCMD timeout Date: Tue, 25 Jun 2019 16:34:23 +0530 Message-Id: <20190625110436.4703-6-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Issue: There is possibility of few DCMDs timing out with 'reset_mutex' lock held. As part of DCMD timeout handling, driver calls function megasas_reset_fusion which also tries to acquire same lock 'reset_mutex' and end up with deadlock. Fix: Upon timeout of DCMDs(which are fired with 'reset_mutex' lock held), driver will release 'reset_mutex' before calling OCR function and will acquire lock again after OCR function returns. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_base.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7d1cf4e..54bb48e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4369,8 +4369,10 @@ megasas_get_pd_info(struct megasas_instance *instance, struct scsi_device *sdev) switch (dcmd_timeout_ocr_possible(instance)) { case INITIATE_OCR: cmd->flags |= DRV_DCMD_SKIP_REFIRE; + mutex_unlock(&instance->reset_mutex); megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR); + mutex_lock(&instance->reset_mutex); break; case KILL_ADAPTER: megaraid_sas_kill_hba(instance); @@ -4861,8 +4863,10 @@ megasas_host_device_list_query(struct megasas_instance *instance, switch (dcmd_timeout_ocr_possible(instance)) { case INITIATE_OCR: cmd->flags |= DRV_DCMD_SKIP_REFIRE; + mutex_unlock(&instance->reset_mutex); megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR); + mutex_lock(&instance->reset_mutex); break; case KILL_ADAPTER: megaraid_sas_kill_hba(instance); @@ -5010,8 +5014,10 @@ void megasas_get_snapdump_properties(struct megasas_instance *instance) switch (dcmd_timeout_ocr_possible(instance)) { case INITIATE_OCR: cmd->flags |= DRV_DCMD_SKIP_REFIRE; + mutex_unlock(&instance->reset_mutex); megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR); + mutex_lock(&instance->reset_mutex); break; case KILL_ADAPTER: megaraid_sas_kill_hba(instance); @@ -5141,8 +5147,10 @@ megasas_get_ctrl_info(struct megasas_instance *instance) switch (dcmd_timeout_ocr_possible(instance)) { case INITIATE_OCR: cmd->flags |= DRV_DCMD_SKIP_REFIRE; + mutex_unlock(&instance->reset_mutex); megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR); + mutex_lock(&instance->reset_mutex); break; case KILL_ADAPTER: megaraid_sas_kill_hba(instance); @@ -6398,8 +6406,10 @@ megasas_get_target_prop(struct megasas_instance *instance, switch (dcmd_timeout_ocr_possible(instance)) { case INITIATE_OCR: cmd->flags |= DRV_DCMD_SKIP_REFIRE; + mutex_unlock(&instance->reset_mutex); megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR); + mutex_lock(&instance->reset_mutex); break; case KILL_ADAPTER: megaraid_sas_kill_hba(instance); @@ -7801,10 +7811,13 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, opcode = le32_to_cpu(cmd->frame->dcmd.opcode); if (opcode == MR_DCMD_CTRL_SHUTDOWN) { + mutex_lock(&instance->reset_mutex); if (megasas_get_ctrl_info(instance) != DCMD_SUCCESS) { megasas_return_cmd(instance, cmd); + mutex_unlock(&instance->reset_mutex); return -1; } + mutex_unlock(&instance->reset_mutex); } if (opcode == MR_DRIVER_SET_APP_CRASHDUMP_MODE) { From patchwork Tue Jun 25 11:04:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAC6E14B6 for ; Tue, 25 Jun 2019 11:05:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCB311FF29 for ; Tue, 25 Jun 2019 11:05:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D074C2896F; Tue, 25 Jun 2019 11:05:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73F7C1FF29 for ; Tue, 25 Jun 2019 11:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730097AbfFYLFM (ORCPT ); Tue, 25 Jun 2019 07:05:12 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43385 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFM (ORCPT ); Tue, 25 Jun 2019 07:05:12 -0400 Received: by mail-pg1-f195.google.com with SMTP id f25so8789726pgv.10 for ; Tue, 25 Jun 2019 04:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mveVJiAznNjg5E86Wj26dh5RZ/LgPI6cFDk8lk8GhzU=; b=GmnyJJQDe1wrNdcJBBW9N7XyS3ZqEzwmfsflhECYGcTzykT4gV3Q0/KQyDdEvzI6kH DyWXBhKi0KmbVvQQdthkHn4pJui0QZH6F+bLuBt7LYGtNcqqheCfs4r6agQoA/+R4q2/ LOW9b7CB7IFBRpWlxsM90VhopUyDlyNmNJsNQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mveVJiAznNjg5E86Wj26dh5RZ/LgPI6cFDk8lk8GhzU=; b=MyfrzE5eSfFmpaW1DvFOecf9rXigPy+Y7Axk1/MU6oR4hx1p1XsjMHmyfd4p/C8odQ NZ6f0g6D7Bnoq1/f9XIPfobrjaxRhEzoImiZqkGl3y3dsO9Pej/QNAj2nPZDUneg5eJB 9mpEoknRoodPxlrwg6CcTMV7lm30aNYXPg2hSDbTN7w2upDLfk/qbqmLg/fqP1KCAW34 b9lu9L55TdhSbLn7jdEkHJD17fScFs+yF/8RyJCCrGduZXCubcyQlMiouhp7cMNeFbYD Kk565GmIv/Cw1BJ+wL/bgXT1c1FfFre8sU/ZPJJdbYQggrqh/lbpXw3YHZs26nlZ7BuU aXZw== X-Gm-Message-State: APjAAAUigHivCfTuRP5FlduzSESKhpudz68GV5/U86MAwhw4spjTM8Jf V+u5HndOV95CTqvLe8C4LQR9fvqaZElqtSDJv6O+psSWUVcPje+LJUZ2J3F71IAN8i9na219F5t Q0RjR/1Hr/HSO9w7BScE9MPrNnR0HSnyHcTgRqCH+oCa1funMckezScrOWWPyfTa00QZLlwp+83 BmkJY01bnucY82 X-Google-Smtp-Source: APXvYqw3GwOT285Ivaze4vy9EbGLcSZ6uWvZRtVTaltML0xoVwBr8Pb6rLkXT1N7Z53hdGwAqQtSdQ== X-Received: by 2002:a63:c03:: with SMTP id b3mr27660113pgl.68.1561460710894; Tue, 25 Jun 2019 04:05:10 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:10 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 06/18] megaraid_sas: In probe context, retry IOC INIT once if firmware is in fault Date: Tue, 25 Jun 2019 16:34:24 +0530 Message-Id: <20190625110436.4703-7-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Issue: Under certain conditions, controller goes in FAULT state after IOC INIT fired to firmware. Such Fault can be recovered through controller reset. Fix: In driver probe context, if firmware fault is observed post IOC INIT, driver would do controller reset followed by retry logic for IOC INIT command. Signed-off-by: Shivasharan S Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index b8a5bbf..2e711b1 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1009,6 +1009,7 @@ wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd, { int i; struct megasas_header *frame_hdr = &cmd->frame->hdr; + u32 status_reg; u32 msecs = seconds * 1000; @@ -1018,6 +1019,12 @@ wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd, for (i = 0; (i < msecs) && (frame_hdr->cmd_status == 0xff); i += 20) { rmb(); msleep(20); + if (!(i % 5000)) { + status_reg = instance->instancet->read_fw_status_reg(instance) + & MFI_STATE_MASK; + if (status_reg == MFI_STATE_FAULT) + break; + } } if (frame_hdr->cmd_status == MFI_STAT_INVALID_STATUS) @@ -1720,6 +1727,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) struct fusion_context *fusion; u32 scratch_pad_1; int i = 0, count; + u32 status_reg; fusion = instance->ctrl_context; @@ -1802,8 +1810,21 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) if (megasas_alloc_cmds_fusion(instance)) goto fail_alloc_cmds; - if (megasas_ioc_init_fusion(instance)) - goto fail_ioc_init; + if (megasas_ioc_init_fusion(instance)) { + status_reg = instance->instancet->read_fw_status_reg(instance); + if (((status_reg & MFI_STATE_MASK) == MFI_STATE_FAULT) && + (status_reg & MFI_RESET_ADAPTER)) { + /* Do a chip reset and then retry IOC INIT once */ + if (megasas_adp_reset_wait_for_ready + (instance, true, 0) == FAILED) + goto fail_ioc_init; + + if (megasas_ioc_init_fusion(instance)) + goto fail_ioc_init; + } else { + goto fail_ioc_init; + } + } megasas_display_intel_branding(instance); if (megasas_get_ctrl_info(instance)) { From patchwork Tue Jun 25 11:04:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E25213AF for ; Tue, 25 Jun 2019 11:05:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 203D31FF29 for ; Tue, 25 Jun 2019 11:05:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 148C02896F; Tue, 25 Jun 2019 11:05:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB54E1FF29 for ; Tue, 25 Jun 2019 11:05:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730105AbfFYLFP (ORCPT ); Tue, 25 Jun 2019 07:05:15 -0400 Received: from mail-pf1-f182.google.com ([209.85.210.182]:32977 "EHLO mail-pf1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729774AbfFYLFP (ORCPT ); Tue, 25 Jun 2019 07:05:15 -0400 Received: by mail-pf1-f182.google.com with SMTP id x15so9322742pfq.0 for ; Tue, 25 Jun 2019 04:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RL1aRJOLxqXyxOFp2XTkM11O//DXdQuboF4qE6dMT68=; b=afEc9cwEHFNMIhN1gOqr1rcLD5CV0Ul9WQKH9S0zIEvHC4EOfl/McV206OSVJ+Eq3W 2BGoYo9DUiV7YaqUvf9e9E/8zA9o6tGLbqM8uA8LVRtZZi6iOqRJM1tLhAzliiVzIDAs RdyDeaekgpPj4fcx5kQfHfF3YYFdeq3h5XcRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RL1aRJOLxqXyxOFp2XTkM11O//DXdQuboF4qE6dMT68=; b=fiwrWgXLaubO8RllfhTTCYqNv4z0OfQ9CYkhHxW6lAm9YTO72DdsDwLbVfugudn2dk /pGodnrMjS2I0Kw8pao85j/AHtmJKzSFDGu7cywyPg0EnCgYt1A9jALA8xbvBG6ccBdT PZC9Il4lzy3k4zGXj9YebQuG8+4YIHFukoIILkC7esFzv3TgzMVJWESrhQ9Of7B4r5Rx +iBEYrsbi6V0dPaqW8ydLdd0KDZiy3VAVhLh5Q7DikgzGJsuLUbp7uvYAFCEZ2YXeGSx 4Dij+9Hv/G2sXjiz534WpeJm9yLMEHlqAoHrd0m96W7ksb/o9Q0mrtbbRCFPNjshic// yusA== X-Gm-Message-State: APjAAAWPJTswMvTNNLRN/YV/x29QiFRtNGINEcaPS38T0tm6vLPsTJxd cWE68zDiCpEgibds9/LaNjXhKk6lDo908hpB3uWZ/y11EtP1ydvfaUCVu0ALPc/okfPzG1vMQmw GnzPifaEtuXXW0JYYdXI8rx9W1g/VAGoaKdgqAjEl73WJLRiKPrbV4p5QBmr6VJcIPu2cZLKZC9 IOD3VKxyk6BRT5 X-Google-Smtp-Source: APXvYqxONfLqD+4eiOvp/pDPGsg1BsRriXMNogj1R8TluQ0wF+G21+w56OzBxrLDH7S5EPQpdBOIVg== X-Received: by 2002:a17:90a:2627:: with SMTP id l36mr32026539pje.71.1561460714130; Tue, 25 Jun 2019 04:05:14 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:13 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 07/18] megaraid_sas: Don't send FPIO to RL Bypass queue Date: Tue, 25 Jun 2019 16:34:25 +0530 Message-Id: <20190625110436.4703-8-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Firmware does not expect FastPath IO sent through Region Lock Bypass queue. Though firmware never exposes such settings when fastpath IO can be sent to RL bypass queue but it's safer to remove dead code which directs fastpath IO to RL Bypass queue. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 2e711b1..a765662 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2876,10 +2876,6 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, (MPI2_REQ_DESCRIPT_FLAGS_FP_IO << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); if (instance->adapter_type == INVADER_SERIES) { - if (rctx->reg_lock_flags == REGION_TYPE_UNUSED) - cmd->request_desc->SCSIIO.RequestFlags = - (MEGASAS_REQ_DESCRIPT_FLAGS_NO_LOCK << - MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); rctx->type = MPI2_TYPE_CUDA; rctx->nseg = 0x1; io_request->IoFlags |= cpu_to_le16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH); From patchwork Tue Jun 25 11:04:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0BF814B6 for ; Tue, 25 Jun 2019 11:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F15F1FF29 for ; Tue, 25 Jun 2019 11:05:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 835202896F; Tue, 25 Jun 2019 11:05:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 633C0286A8 for ; Tue, 25 Jun 2019 11:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730037AbfFYLFT (ORCPT ); Tue, 25 Jun 2019 07:05:19 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46493 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFS (ORCPT ); Tue, 25 Jun 2019 07:05:18 -0400 Received: by mail-pl1-f194.google.com with SMTP id e5so8649041pls.13 for ; Tue, 25 Jun 2019 04:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZcglgUXaK1MvJIHZ8sWYFR18WSuVnGfZV5jcIw8NZcc=; b=TUIkdqNzP4kO+VSwvP02UtTvqso3PdI/SC1hb1Dh9yXw/Yk3EIqdZxgwL1ZaCSHzU3 BCZj4rblR2AKdk1cB0W9JdrOjXXZ9UvWWFNjg9lQexTCVZwlMRkPVADeMP5go2D/yx6t RSqtCmOWG3E0OyGJSnE5lyQTRnlqIy2zSeU44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZcglgUXaK1MvJIHZ8sWYFR18WSuVnGfZV5jcIw8NZcc=; b=Xz7Vp+fxHKZJ0rDmSAwR+41CU9eIGadaInKmPmhWxNgF5YDr+py3iSur01SudlkPw5 ComICBJVuIB7ugJBeRYOuTmzXrY5PoyUR1oJ31jVwLOejYIx963Etzg4hxZXWZ1TNKhG IHr6QT5nWya/KoAsWKzrADoGudM69M/JDubStjHwcrdPw5kEgHpxcI6a1WJIEKSQ72Eo K1j/qoGpi1vDpDAXo2VReeOiUj0YNIrKSvP1HYoJUAH/lgS5NKYkR8bT/bxVP0zkfVhl aBA00rVHzFNQR+xQRqAqUavkKx62rW9uXLkxevT8+4O9VKKK+gnBH+zUUNIDNxKt5IJU i6oA== X-Gm-Message-State: APjAAAXQLdh3KAneYawGOibcpxLsBkSDREeMU2lum8fg9aqpB45xVTZx Y947ntRCfpVNCFlhU2eHEHA/wHci4lOMgLHgozZvqf28yrAXxzVc056pXCdmkWfDVOhbsGOR7Gl +QPwK0XQiS8RdTOqgygfHinGUyQjk7F09fLKgrNCVg57jQ+uXEKa8moxztqpmbzemft4I8TMgij fbMT2d0aKmQfw6 X-Google-Smtp-Source: APXvYqxr9OsgCODYJJZ8FQaIg9OROJTlIoNlWSLVdcSMshkZV4TWdJwIC2ZnVM/lXHU2i+g3N+WWLw== X-Received: by 2002:a17:902:bc83:: with SMTP id bb3mr133834042plb.56.1561460717179; Tue, 25 Jun 2019 04:05:17 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:16 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 08/18] megaraid_sas: Handle sequence JBOD map failure at driver level Date: Tue, 25 Jun 2019 16:34:26 +0530 Message-Id: <20190625110436.4703-9-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Issue: This issue is applicable to scenario when JBOD sequence map is unavailable (memory allocation for JBOD sequence map failed) to driver but feature is supported by firmware. If the driver sends a JBOD IO by not adding 255(MAX_PHYSICAL_DEVICES - 1) to device ID when underlying firmware supports JBOD sequence map, it will lead to the IO failure. Fix: For JBOD IOs, driver will not use the RAID map to fetch the devhandle, if JBOD sequence map is unavailable. Driver will set Devhandle to 0xffff and Target ID to 'device ID + 255(MAX_PHYSICAL_DEVICES - 1)'. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 2 + drivers/scsi/megaraid/megaraid_sas_base.c | 14 ++++-- drivers/scsi/megaraid/megaraid_sas_fusion.c | 77 ++++++++++++++++------------- 3 files changed, 55 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index d333b8e..cd63281 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2398,7 +2398,9 @@ struct megasas_instance { #endif u8 enable_fw_dev_list; bool atomic_desc_support; + bool support_seqnum_jbod_fp; }; + struct MR_LD_VF_MAP { u32 size; union MR_LD_REF ref; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 54bb48e..554ec72 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5103,7 +5103,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance) * in case of Firmware upgrade without system reboot. */ megasas_update_ext_vd_details(instance); - instance->use_seqnum_jbod_fp = + instance->support_seqnum_jbod_fp = ci->adapterOperations3.useSeqNumJbodFP; instance->support_morethan256jbod = ci->adapter_operations4.support_pd_map_target_id; @@ -5140,6 +5140,8 @@ megasas_get_ctrl_info(struct megasas_instance *instance) dev_info(&instance->pdev->dev, "FW provided TM TaskAbort/Reset timeout\t: %d secs/%d secs\n", instance->task_abort_tmo, instance->max_reset_tmo); + dev_info(&instance->pdev->dev, "JBOD sequence map support\t: %s\n", + instance->support_seqnum_jbod_fp ? "Yes" : "No"); break; @@ -5554,10 +5556,12 @@ megasas_setup_jbod_map(struct megasas_instance *instance) pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1)); + instance->use_seqnum_jbod_fp = + instance->support_seqnum_jbod_fp; if (reset_devices || !fusion || - !instance->ctrl_info_buf->adapterOperations3.useSeqNumJbodFP) { + !instance->support_seqnum_jbod_fp) { dev_info(&instance->pdev->dev, - "Jbod map is not supported %s %d\n", + "JBOD sequence map is disabled %s %d\n", __func__, __LINE__); instance->use_seqnum_jbod_fp = false; return; @@ -6042,8 +6046,8 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->UnevenSpanSupport ? "yes" : "no"); dev_info(&instance->pdev->dev, "firmware crash dump : %s\n", instance->crash_dump_drv_support ? "yes" : "no"); - dev_info(&instance->pdev->dev, "jbod sync map : %s\n", - instance->use_seqnum_jbod_fp ? "yes" : "no"); + dev_info(&instance->pdev->dev, "JBOD sequence map : %s\n", + instance->use_seqnum_jbod_fp ? "enabled" : "disabled"); instance->max_sectors_per_req = instance->max_num_sge * SGE_BUFFER_SIZE / 512; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index a765662..5121d4c 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -3083,44 +3083,55 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT; /* If FW supports PD sequence number */ - if (instance->use_seqnum_jbod_fp && - instance->pd_list[pd_index].driveType == TYPE_DISK) { - /* TgtId must be incremented by 255 as jbod seq number is index - * below raid map - */ - /* More than 256 PD/JBOD support for Ventura */ - if (instance->support_morethan256jbod) - pRAID_Context->virtual_disk_tgt_id = - pd_sync->seq[pd_index].pd_target_id; - else - pRAID_Context->virtual_disk_tgt_id = - cpu_to_le16(device_id + (MAX_PHYSICAL_DEVICES - 1)); - pRAID_Context->config_seq_num = pd_sync->seq[pd_index].seqNum; - io_request->DevHandle = pd_sync->seq[pd_index].devHandle; - if (instance->adapter_type >= VENTURA_SERIES) { - io_request->RaidContext.raid_context_g35.routing_flags |= - (1 << MR_RAID_CTX_ROUTINGFLAGS_SQN_SHIFT); - io_request->RaidContext.raid_context_g35.nseg_type |= - (1 << RAID_CONTEXT_NSEG_SHIFT); - io_request->RaidContext.raid_context_g35.nseg_type |= - (MPI2_TYPE_CUDA << RAID_CONTEXT_TYPE_SHIFT); + if (instance->support_seqnum_jbod_fp) { + if (instance->use_seqnum_jbod_fp && + instance->pd_list[pd_index].driveType == TYPE_DISK) { + + /* More than 256 PD/JBOD support for Ventura */ + if (instance->support_morethan256jbod) + pRAID_Context->virtual_disk_tgt_id = + pd_sync->seq[pd_index].pd_target_id; + else + pRAID_Context->virtual_disk_tgt_id = + cpu_to_le16(device_id + + (MAX_PHYSICAL_DEVICES - 1)); + pRAID_Context->config_seq_num = + pd_sync->seq[pd_index].seqNum; + io_request->DevHandle = + pd_sync->seq[pd_index].devHandle; + if (instance->adapter_type >= VENTURA_SERIES) { + io_request->RaidContext.raid_context_g35.routing_flags |= + (1 << MR_RAID_CTX_ROUTINGFLAGS_SQN_SHIFT); + io_request->RaidContext.raid_context_g35.nseg_type |= + (1 << RAID_CONTEXT_NSEG_SHIFT); + io_request->RaidContext.raid_context_g35.nseg_type |= + (MPI2_TYPE_CUDA << RAID_CONTEXT_TYPE_SHIFT); + } else { + pRAID_Context->type = MPI2_TYPE_CUDA; + pRAID_Context->nseg = 0x1; + pRAID_Context->reg_lock_flags |= + (MR_RL_FLAGS_SEQ_NUM_ENABLE | + MR_RL_FLAGS_GRANT_DESTINATION_CUDA); + } } else { - pRAID_Context->type = MPI2_TYPE_CUDA; - pRAID_Context->nseg = 0x1; - pRAID_Context->reg_lock_flags |= - (MR_RL_FLAGS_SEQ_NUM_ENABLE|MR_RL_FLAGS_GRANT_DESTINATION_CUDA); + pRAID_Context->virtual_disk_tgt_id = + cpu_to_le16(device_id + + (MAX_PHYSICAL_DEVICES - 1)); + pRAID_Context->config_seq_num = 0; + io_request->DevHandle = cpu_to_le16(0xFFFF); } - } else if (fusion->fast_path_io) { - pRAID_Context->virtual_disk_tgt_id = cpu_to_le16(device_id); - pRAID_Context->config_seq_num = 0; - local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)]; - io_request->DevHandle = - local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; } else { - /* Want to send all IO via FW path */ pRAID_Context->virtual_disk_tgt_id = cpu_to_le16(device_id); pRAID_Context->config_seq_num = 0; - io_request->DevHandle = cpu_to_le16(0xFFFF); + + if (fusion->fast_path_io) { + local_map_ptr = + fusion->ld_drv_map[(instance->map_id & 1)]; + io_request->DevHandle = + local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; + } else { + io_request->DevHandle = cpu_to_le16(0xFFFF); + } } cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; From patchwork Tue Jun 25 11:04:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 340FA13AF for ; Tue, 25 Jun 2019 11:05:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 264B31FF29 for ; Tue, 25 Jun 2019 11:05:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ED7F2896F; Tue, 25 Jun 2019 11:05:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 084671FF29 for ; Tue, 25 Jun 2019 11:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730134AbfFYLFV (ORCPT ); Tue, 25 Jun 2019 07:05:21 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36502 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFV (ORCPT ); Tue, 25 Jun 2019 07:05:21 -0400 Received: by mail-pg1-f196.google.com with SMTP id f21so8806599pgi.3 for ; Tue, 25 Jun 2019 04:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CMzim16g0haLFiQPV9XYI5J3leuIdfSlox5jPaNCXRY=; b=eQ5hKHCr6IxIdRxUK1QQBLuJehW5uCfZ4Ulo3t7ikEUNFgqtVF9k5WLlNq9Er3JeiR yFd2LdqCg4T76ckM2BbKc10EHqeh1jEtAKitTZj2ZgVnMyCRJv0RrB7PRp/fYOojq5KH ytzXk4AiQtmA49ZpjOrb9OtZuNvDJtF1/PnSs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CMzim16g0haLFiQPV9XYI5J3leuIdfSlox5jPaNCXRY=; b=jsn3jMAJcvYxJO5uSz+f/L/vW3h7Y4TPHbS1peabOJDnDwSq3VD7T6zzgZvgrMEEEl M1nAwDmp4/eJBYVxYVVscOnGs6GPLnR9SP68/tPmSINrJ4OhVv7YPDgxnmsUYFtHQEul kztrWj+LYiOpA5M3WCQMqhncF/7HLQlDHV5s1HSWCIsa5IODsiGradAqN4y1ar2LOTIP XeP1B72AicfB9xCnFMCc70vNnCAueJSfqtd1fvydJUOmJ3D7sKqv2otYOrplvvigbuWR 6GjyWd/TZzVbeBnI29C0a1JbI6CcqkD9u1nklZROjJtyb07U9Yau/ysDSEAeA4KC+4iY Tgow== X-Gm-Message-State: APjAAAVqlC7qUwoyLW7LBR/S2DX/npZN9TeMndHwkOYYhr/rEtSmO/zO kOCHO2x1jRnkhetkpZhrrv8HX36cPih4UEsnT4ULO2/uKx+VrkLOGZw8U/3dsNA6xMWpJ3f7JnQ Ec5itJgrVecQn/bTMVAUvOsU6JogaEU+NxUvoH1rYan+OscWRIZqCfoVpqgwI1a39k8R+zugLRb DNKqxIYNAiut+F X-Google-Smtp-Source: APXvYqxvIrtn34p6fyS4z3QiFKutG2yGeDooCWLi2Xhfh7vi9vol+MA3ROcU/6yHCMYCy9fmsfzJ8Q== X-Received: by 2002:a63:f746:: with SMTP id f6mr14652232pgk.56.1561460720245; Tue, 25 Jun 2019 04:05:20 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:19 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 09/18] megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD Date: Tue, 25 Jun 2019 16:34:27 +0530 Message-Id: <20190625110436.4703-10-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Shivasharan S Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 554ec72..a886de3e3 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4827,6 +4827,9 @@ megasas_host_device_list_query(struct megasas_instance *instance, */ count = le32_to_cpu(ci->count); + if (count > (MEGASAS_MAX_PD + MAX_LOGICAL_DRIVES_EXT)) + break; + if (megasas_dbg_lvl & LD_PD_DEBUG) dev_info(&instance->pdev->dev, "%s, Device count: 0x%x\n", __func__, count); From patchwork Tue Jun 25 11:04:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 356C913AF for ; Tue, 25 Jun 2019 11:05:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27CD1286A8 for ; Tue, 25 Jun 2019 11:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B5AE1FF29; Tue, 25 Jun 2019 11:05:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71A071FF29 for ; Tue, 25 Jun 2019 11:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730147AbfFYLFZ (ORCPT ); Tue, 25 Jun 2019 07:05:25 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:40926 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFY (ORCPT ); Tue, 25 Jun 2019 07:05:24 -0400 Received: by mail-pl1-f196.google.com with SMTP id a93so8676711pla.7 for ; Tue, 25 Jun 2019 04:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TUNP3/GEs4BdPR5S0pmQLB6jVYGQK1gtCSlVf7s5jwk=; b=PKxRbVI9GA8nMdEKc4lW3oWdcbucgq3wsu0zaJU9faM5As8X02ydleX85DoUVq7VSB q1hTTPksw4f4RcSfbRmrBvswLOthf5JyQUpsVuc4V7p2eez7vSAXQ/0CpLASUit+jM+R M7naI65oiLB3A7blXs3ML8j2buLjNCCSvMtC8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TUNP3/GEs4BdPR5S0pmQLB6jVYGQK1gtCSlVf7s5jwk=; b=eBFM6VmTiW1LOAJIqxKqujYweVQUkjmwG/j3JL00N0WfDHF6wKt2KD5FRMcKGnTrgT BWx9a6dnf7L4uhd0qiAmMA+tcPXIjGwCX2JKllEDWaIZiInwC6FyCOJ8t6NxhBX+7n9d ZmoaXYlX2OGoaZAP2/bhKQ0WgpPvzRvs4DWCCWPTn90yaLoNY7IEuZE3aJU+Bf18OXHn 3mp6jgSZL7ncMKLkN2/YLyWxVp434jLYOke5W1kwG7WhAhnroUnplMIKbUYzjfOZtSCh x1F9dh+DTsnQlec7f19gApBXJvOr0edBs+bH/pGnnBL1bxQgLsSYNfJ6UFDI0xoCkKl6 0Nlw== X-Gm-Message-State: APjAAAWgkEnak0G8YQ/5j2sj1fsczWomptlGzLKU5wJ4D3/ZSn04dXYJ 4+hePZYpRLh9CLqu2BAhOIypOT0W4zg8HydEMjQ2GKOrDwculu4k58m5m0KsBmn791JLSz85APP LV2khr0sr1woSiERMg0P/EHl1bpFlCV59r9Byjy67u0+l2lxkLVxGZZ/xxZNbuk8X5M2fKCgl2+ dsAqsUUBeueWMq X-Google-Smtp-Source: APXvYqwMpxPoNkNb6D6pBS2TNcsif1DsYDhoAZvicJrL+/ep7fNCOS+xj+7ct0awoo3MUXjBn6NFSg== X-Received: by 2002:a17:902:d887:: with SMTP id b7mr47317853plz.28.1561460723686; Tue, 25 Jun 2019 04:05:23 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:23 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 10/18] megaraid_sas: RAID1 PCI bandwidth limit algorithm is applicable for only Ventura Date: Tue, 25 Jun 2019 16:34:28 +0530 Message-Id: <20190625110436.4703-11-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP RAID1 PCI bandwidth limit algorithm is not applicable to Aero as it's PCIe Gen4 adapter. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 24 +++++++++++++----------- drivers/scsi/megaraid/megaraid_sas_fusion.h | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index a886de3e3..5244b6e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5777,6 +5777,9 @@ static int megasas_init_fw(struct megasas_instance *instance) MR_MAX_RAID_MAP_SIZE_MASK); } + if (instance->adapter_type == VENTURA_SERIES) + fusion->pcie_bw_limitation = true; + /* Check if MSI-X is supported while in ready state */ msix_enable = (instance->instancet->read_fw_status_reg(instance) & 0x4000000) >> 0x1a; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 5121d4c..ad18474 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2621,9 +2621,10 @@ static void megasas_stream_detect(struct megasas_instance *instance, * */ static void -megasas_set_raidflag_cpu_affinity(union RAID_CONTEXT_UNION *praid_context, - struct MR_LD_RAID *raid, bool fp_possible, - u8 is_read, u32 scsi_buff_len) +megasas_set_raidflag_cpu_affinity(struct fusion_context *fusion, + union RAID_CONTEXT_UNION *praid_context, + struct MR_LD_RAID *raid, bool fp_possible, + u8 is_read, u32 scsi_buff_len) { u8 cpu_sel = MR_RAID_CTX_CPUSEL_0; struct RAID_CONTEXT_G35 *rctx_g35; @@ -2681,11 +2682,11 @@ megasas_set_raidflag_cpu_affinity(union RAID_CONTEXT_UNION *praid_context, * vs MR_RAID_FLAGS_IO_SUB_TYPE_CACHE_BYPASS. * IO Subtype is not bitmap. */ - if ((raid->level == 1) && (!is_read)) { - if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE) - praid_context->raid_context_g35.raid_flags = - (MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT - << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT); + if ((fusion->pcie_bw_limitation) && (raid->level == 1) && (!is_read) && + (scsi_buff_len > MR_LARGE_IO_MIN_SIZE)) { + praid_context->raid_context_g35.raid_flags = + (MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT + << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT); } } @@ -2834,8 +2835,9 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, (instance->host->can_queue)) { fp_possible = false; atomic_dec(&instance->fw_outstanding); - } else if ((scsi_buff_len > MR_LARGE_IO_MIN_SIZE) || - (atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint) > 0)) { + } else if (fusion->pcie_bw_limitation && + ((scsi_buff_len > MR_LARGE_IO_MIN_SIZE) || + (atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint) > 0))) { fp_possible = false; atomic_dec(&instance->fw_outstanding); if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE) @@ -2860,7 +2862,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, /* If raid is NULL, set CPU affinity to default CPU0 */ if (raid) - megasas_set_raidflag_cpu_affinity(&io_request->RaidContext, + megasas_set_raidflag_cpu_affinity(fusion, &io_request->RaidContext, raid, fp_possible, io_info.isRead, scsi_buff_len); else diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 9873829..b50da38 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -1335,7 +1335,7 @@ struct fusion_context { dma_addr_t ioc_init_request_phys; struct MPI2_IOC_INIT_REQUEST *ioc_init_request; struct megasas_cmd *ioc_init_cmd; - + bool pcie_bw_limitation; }; union desc_value { From patchwork Tue Jun 25 11:04:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4647514B6 for ; Tue, 25 Jun 2019 11:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D7A31FE8B for ; Tue, 25 Jun 2019 11:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E86F28610; Tue, 25 Jun 2019 11:05:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63FDC1FE8B for ; Tue, 25 Jun 2019 11:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730150AbfFYLF3 (ORCPT ); Tue, 25 Jun 2019 07:05:29 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33488 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLF2 (ORCPT ); Tue, 25 Jun 2019 07:05:28 -0400 Received: by mail-pg1-f194.google.com with SMTP id m4so8191085pgk.0 for ; Tue, 25 Jun 2019 04:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UwfdqmjTCz96BciZ834nttPOE+gzE0u5ZgR+uMxNsaI=; b=OgjzaFRCCqF9jtt58/PQBtwLc26s72vePsYjN8bfER7MbWB4qupP6n4ePHazetWqsv 5DLdBaWjU/VXVP8EhF5NV/Ksy8mD/w34SgLbJMx6T2xBqs+WC7pUtxAUMRMGgtN/BSFD 3tmh3yPYY38610dOvEhTQAQKdsNl+XFpEdYAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UwfdqmjTCz96BciZ834nttPOE+gzE0u5ZgR+uMxNsaI=; b=epWQp9NWf5w/ozN0W1IPfD/RY9u8se8/gko6mltahwDKlatd520Vl3nTQETVardMvg 6AFfk5xtZFWTPTllS1hkcGOkxNlQsFMqns3Kfl5eg/YvtNCWcZy+j5RWWuedS9xwJaUZ hHCOxiTDcHcDXmGe2SlRV7XgScT0hBoVjgHoiyxJIJk6otdNuWSSIca9ZTAer1didQjk CtVkCvlvOgG+00e1zqKl+OZ9ZJfaT+MHuVo619FGBwivBuFpIlurLdpzMZzoM5VFrqlk vY5XHguK2OdtUPdJqGGFbmH+oOjJg45I8nvbsNvEYKMzt36IQLEO6/gNnuCyckQyy73p baQw== X-Gm-Message-State: APjAAAXqFPHp2LSEt/vZfcVwlEBzqqmkq9nYjmPLGC5BrhTMR5zYlk3z fGbMuoCze0I7GYYVk7q04ZO83m/E9b9ZWDgPW8OD1vy3vN6dFwvqr11BlSnLKk6V7dH8B59D1Av 0p2AURep8CjXvX9F7mSqETgGoTHPzmHlkSPHSU15zPeIxraKW8iSENrT2HT6sRJsY3tHL0/zc/y l4giRokmuH9Bpx X-Google-Smtp-Source: APXvYqxKIvHv+iGBWJRbQndUR39ph+Ba3y/HP2N6FKpDCjl6keP5QZCOMOXEiF9EZUKzjJ70i3lB6Q== X-Received: by 2002:a63:c0f:: with SMTP id b15mr26679256pgl.33.1561460726764; Tue, 25 Jun 2019 04:05:26 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:26 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 11/18] megaraid_sas: Offload Aero RAID5/6 division calculations to driver Date: Tue, 25 Jun 2019 16:34:29 +0530 Message-Id: <20190625110436.4703-12-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For RAID5/RAID6 volumes configured behind Aero, driver will be doing 64bit division operations on behalf of firmware as controller's ARM CPU is very slow in this division. Later, driver calculate Q-ARM, P-ARM and Log-ARM and pass those values to firmware by writing these values to RAID_CONTEXT. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_base.c | 10 +++- drivers/scsi/megaraid/megaraid_sas_fp.c | 78 +++++++++++++++++++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +-- drivers/scsi/megaraid/megaraid_sas_fusion.h | 24 ++++++--- 4 files changed, 108 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5244b6e..81e708b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5777,8 +5777,16 @@ static int megasas_init_fw(struct megasas_instance *instance) MR_MAX_RAID_MAP_SIZE_MASK); } - if (instance->adapter_type == VENTURA_SERIES) + switch (instance->adapter_type) { + case VENTURA_SERIES: fusion->pcie_bw_limitation = true; + break; + case AERO_SERIES: + fusion->r56_div_offload = true; + break; + default: + break; + } /* Check if MSI-X is supported while in ready state */ msix_enable = (instance->instancet->read_fw_status_reg(instance) & diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index d296255..43a2e49 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -902,6 +902,77 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, } /* + * mr_get_phy_params_r56_rmw - Calculate parameters for R56 CTIO write operation + * @instance: Adapter soft state + * @ld: LD index + * @stripNo: Strip Number + * @io_info: IO info structure pointer + * pRAID_Context: RAID context pointer + * map: RAID map pointer + * + * This routine calculates the logical arm, data Arm, row number and parity arm + * for R56 CTIO write operation. + */ +static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance, + u32 ld, u64 stripNo, + struct IO_REQUEST_INFO *io_info, + struct RAID_CONTEXT_G35 *pRAID_Context, + struct MR_DRV_RAID_MAP_ALL *map) +{ + struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); + u8 span, dataArms, arms, dataArm, logArm; + s8 rightmostParityArm, PParityArm; + u64 rowNum; + u64 *pdBlock = &io_info->pdBlock; + + dataArms = raid->rowDataSize; + arms = raid->rowSize; + + rowNum = mega_div64_32(stripNo, dataArms); + /* parity disk arm, first arm is 0 */ + rightmostParityArm = (arms - 1) - mega_mod64(rowNum, arms); + + /* logical arm within row */ + logArm = mega_mod64(stripNo, dataArms); + /* physical arm for data */ + dataArm = mega_mod64((rightmostParityArm + 1 + logArm), arms); + + if (raid->spanDepth == 1) { + span = 0; + } else { + span = (u8)MR_GetSpanBlock(ld, rowNum, pdBlock, map); + if (span == SPAN_INVALID) + return; + } + + if (raid->level == 6) { + /* P Parity arm, note this can go negative adjust if negative */ + PParityArm = (arms - 2) - mega_mod64(rowNum, arms); + + if (PParityArm < 0) + PParityArm += arms; + + /* rightmostParityArm is P-Parity for RAID 5 and Q-Parity for RAID */ + pRAID_Context->flow_specific.r56_arm_map = rightmostParityArm; + pRAID_Context->flow_specific.r56_arm_map |= + (u16)(PParityArm << RAID_CTX_R56_P_ARM_SHIFT); + } else { + pRAID_Context->flow_specific.r56_arm_map |= + (u16)(rightmostParityArm << RAID_CTX_R56_P_ARM_SHIFT); + } + + pRAID_Context->reg_lock_row_lba = cpu_to_le64(rowNum); + pRAID_Context->flow_specific.r56_arm_map |= + (u16)(logArm << RAID_CTX_R56_LOG_ARM_SHIFT); + cpu_to_le16s(&pRAID_Context->flow_specific.r56_arm_map); + pRAID_Context->span_arm = (span << RAID_CTX_SPANARM_SPAN_SHIFT) | dataArm; + pRAID_Context->raid_flags = (MR_RAID_FLAGS_IO_SUB_TYPE_R56_DIV_OFFLOAD << + MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT); + + return; +} + +/* ****************************************************************************** * * MR_BuildRaidContext function @@ -1108,6 +1179,13 @@ MR_BuildRaidContext(struct megasas_instance *instance, /* save pointer to raid->LUN array */ *raidLUN = raid->LUN; + /* Aero R5/6 Division Offload for WRITE */ + if (fusion->r56_div_offload && (raid->level >= 5) && !isRead) { + mr_get_phy_params_r56_rmw(instance, ld, start_strip, io_info, + (struct RAID_CONTEXT_G35 *)pRAID_Context, + map); + return true; + } /*Get Phy Params only if FP capable, or else leave it to MR firmware to do the calculation.*/ diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ad18474..058d22b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -3324,9 +3324,9 @@ void megasas_prepare_secondRaid1_IO(struct megasas_instance *instance, r1_cmd->request_desc->SCSIIO.DevHandle = cmd->r1_alt_dev_handle; r1_cmd->io_request->DevHandle = cmd->r1_alt_dev_handle; r1_cmd->r1_alt_dev_handle = cmd->io_request->DevHandle; - cmd->io_request->RaidContext.raid_context_g35.smid.peer_smid = + cmd->io_request->RaidContext.raid_context_g35.flow_specific.peer_smid = cpu_to_le16(r1_cmd->index); - r1_cmd->io_request->RaidContext.raid_context_g35.smid.peer_smid = + r1_cmd->io_request->RaidContext.raid_context_g35.flow_specific.peer_smid = cpu_to_le16(cmd->index); /*MSIxIndex of both commands request descriptors should be same*/ r1_cmd->request_desc->SCSIIO.MSIxIndex = @@ -3444,7 +3444,7 @@ megasas_complete_r1_command(struct megasas_instance *instance, rctx_g35 = &cmd->io_request->RaidContext.raid_context_g35; fusion = instance->ctrl_context; - peer_smid = le16_to_cpu(rctx_g35->smid.peer_smid); + peer_smid = le16_to_cpu(rctx_g35->flow_specific.peer_smid); r1_cmd = fusion->cmd_list[peer_smid - 1]; scmd_local = cmd->scmd; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index b50da38..ca32b2b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -87,7 +87,8 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { MR_RAID_FLAGS_IO_SUB_TYPE_RMW_P = 3, MR_RAID_FLAGS_IO_SUB_TYPE_RMW_Q = 4, MR_RAID_FLAGS_IO_SUB_TYPE_CACHE_BYPASS = 6, - MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT = 7 + MR_RAID_FLAGS_IO_SUB_TYPE_LDIO_BW_LIMIT = 7, + MR_RAID_FLAGS_IO_SUB_TYPE_R56_DIV_OFFLOAD = 8 }; /* @@ -151,12 +152,15 @@ struct RAID_CONTEXT_G35 { u16 timeout_value; /* 0x02 -0x03 */ u16 routing_flags; // 0x04 -0x05 routing flags u16 virtual_disk_tgt_id; /* 0x06 -0x07 */ - u64 reg_lock_row_lba; /* 0x08 - 0x0F */ + __le64 reg_lock_row_lba; /* 0x08 - 0x0F */ u32 reg_lock_length; /* 0x10 - 0x13 */ - union { - u16 next_lmid; /* 0x14 - 0x15 */ - u16 peer_smid; /* used for the raid 1/10 fp writes */ - } smid; + union { // flow specific + u16 rmw_op_index; /* 0x14 - 0x15, R5/6 RMW: rmw operation index*/ + u16 peer_smid; /* 0x14 - 0x15, R1 Write: peer smid*/ + u16 r56_arm_map; /* 0x14 - 0x15, Unused [15], LogArm[14:10], P-Arm[9:5], Q-Arm[4:0] */ + + } flow_specific; + u8 ex_status; /* 0x16 : OUT */ u8 status; /* 0x17 status */ u8 raid_flags; /* 0x18 resvd[7:6], ioSubType[5:4], @@ -247,6 +251,13 @@ union RAID_CONTEXT_UNION { #define RAID_CTX_SPANARM_SPAN_SHIFT (5) #define RAID_CTX_SPANARM_SPAN_MASK (0xE0) +/* LogArm[14:10], P-Arm[9:5], Q-Arm[4:0] */ +#define RAID_CTX_R56_Q_ARM_MASK (0x1F) +#define RAID_CTX_R56_P_ARM_SHIFT (5) +#define RAID_CTX_R56_P_ARM_MASK (0x3E0) +#define RAID_CTX_R56_LOG_ARM_SHIFT (10) +#define RAID_CTX_R56_LOG_ARM_MASK (0x7C00) + /* number of bits per index in U32 TrackStream */ #define BITS_PER_INDEX_STREAM 4 #define INVALID_STREAM_NUM 16 @@ -1336,6 +1347,7 @@ struct fusion_context { struct MPI2_IOC_INIT_REQUEST *ioc_init_request; struct megasas_cmd *ioc_init_cmd; bool pcie_bw_limitation; + bool r56_div_offload; }; union desc_value { From patchwork Tue Jun 25 11:04:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83E7514B6 for ; Tue, 25 Jun 2019 11:05:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 752681FE8B for ; Tue, 25 Jun 2019 11:05:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68D9228610; Tue, 25 Jun 2019 11:05:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4D1B1FE8B for ; Tue, 25 Jun 2019 11:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730157AbfFYLFb (ORCPT ); Tue, 25 Jun 2019 07:05:31 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36547 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFb (ORCPT ); Tue, 25 Jun 2019 07:05:31 -0400 Received: by mail-pl1-f196.google.com with SMTP id k8so8677816plt.3 for ; Tue, 25 Jun 2019 04:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M5Ikn0WwF0jEYEACrmAo3QQIMRMmJhSVmksSrHy10kE=; b=RreL/fvgJFCzzZq1KQgOlvNEYP5SRK7t3sPUZtQo9d0oeLU4ha3Wcevq8e4gbxHwaQ XqZSCBrv8L8LHVJsO01/m0gCRwudKse5EPNkCO4fZpyurmF8hBpSxI/St6fjG7MyJFPT 4OsbVni0XcvEY2WYsdobGxeAMF/ZCXCkfWlBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M5Ikn0WwF0jEYEACrmAo3QQIMRMmJhSVmksSrHy10kE=; b=EjdcqpoVXsZdAAr2lN/Uqxx4or7bzzgqC15hZwySqbp+2srUERidldb96UN+J6AmQX BOV97P0YdRxJanRrxSROq7yzgmsmMbCtlhvo2OlNYtcozBZv/Vi1x45JPcHkt2QuIajy F14j+Ekvx7qKE5ZBqxU8+OYQ6UfPlTDX2wGt5PQIYM8p90osHrUdtmmo+YrPvcSnUl9F c10waHM9ZngXw+sgm9+CADijrMHQ5lcCZv+Pj6dg1wZWxw3UTiElW6LrtiLckCNsy1JT kADBot57kLOXG4peXeRcNuShX0WZfVNBHQZYmTmnYEUqVVFUu+A7brtu2SpJRPG3JYf8 qMJw== X-Gm-Message-State: APjAAAVQQG65yfciBNIqmgXfzx26iGUfjrLfp8pmPAqJIKQ4usIiOFRI J9caZx1ru6Z+uHh2hQxy/BEHudr3WcyJCW23yfg2hDZMNVJ1f0C5UvYvvNd2krA6TVTQruk3IUE hkQ+NaRjLo4Z6ybfl5u3zt+dt2M/E8BSx3a5wi5na7ncEYAZfxP2/HBjv0F+tAtA4c71yHS5QHo 0ykwC39Kx93OVo X-Google-Smtp-Source: APXvYqxLJKefa6cXFGH34xEtLj6l3sWJwuLk2zkxtHI7IQN5Q3P+h8DVTLSaNFtCzp6rkdo4WSaIFQ== X-Received: by 2002:a17:902:a5c5:: with SMTP id t5mr156477905plq.288.1561460729981; Tue, 25 Jun 2019 04:05:29 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:29 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 12/18] megaraid_sas: Add support for MPI toolbox commands Date: Tue, 25 Jun 2019 16:34:30 +0530 Message-Id: <20190625110436.4703-13-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added driver support to allow passthrough MPI toolbox type MFI commands to firmware based on firmware capability. Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 36 ++++++++++++++++++++++++++++- drivers/scsi/megaraid/megaraid_sas_base.c | 31 ++++++++++++++++++++++++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 ++++++ 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index cd63281..83baac3 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -208,6 +208,7 @@ enum MFI_CMD_OP { MFI_CMD_SMP = 0x7, MFI_CMD_STP = 0x8, MFI_CMD_NVME = 0x9, + MFI_CMD_TOOLBOX = 0xa, MFI_CMD_OP_COUNT, MFI_CMD_INVALID = 0xff }; @@ -1467,7 +1468,39 @@ struct megasas_ctrl_info { u8 reserved6[64]; - u32 rsvdForAdptOp[64]; + struct { + #if defined(__BIG_ENDIAN_BITFIELD) + u32 reserved:19; + u32 support_pci_lane_margining: 1; + u32 support_psoc_update:1; + u32 support_force_personality_change:1; + u32 support_fde_type_mix:1; + u32 support_snap_dump:1; + u32 support_nvme_tm:1; + u32 support_oce_only:1; + u32 support_ext_mfg_vpd:1; + u32 support_pcie:1; + u32 support_cvhealth_info:1; + u32 support_profile_change:2; + u32 mr_config_ext2_supported:1; + #else + u32 mr_config_ext2_supported:1; + u32 support_profile_change:2; + u32 support_cvhealth_info:1; + u32 support_pcie:1; + u32 support_ext_mfg_vpd:1; + u32 support_oce_only:1; + u32 support_nvme_tm:1; + u32 support_snap_dump:1; + u32 support_fde_type_mix:1; + u32 support_force_personality_change:1; + u32 support_psoc_update:1; + u32 support_pci_lane_margining: 1; + u32 reserved:19; + #endif + } adapter_operations5; + + u32 rsvdForAdptOp[63]; u8 reserved7[3]; @@ -2399,6 +2432,7 @@ struct megasas_instance { u8 enable_fw_dev_list; bool atomic_desc_support; bool support_seqnum_jbod_fp; + bool support_pci_lane_margining; }; struct MR_LD_VF_MAP { diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 81e708b..4c7a093 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -188,6 +188,7 @@ static u32 support_poll_for_event; u32 megasas_dbg_lvl; static u32 support_device_change; static bool support_nvme_encapsulation; +static bool support_pci_lane_margining; /* define lock for aen poll */ spinlock_t poll_aen_lock; @@ -3494,6 +3495,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, case MFI_CMD_SMP: case MFI_CMD_STP: case MFI_CMD_NVME: + case MFI_CMD_TOOLBOX: megasas_complete_int_cmd(instance, cmd); break; @@ -5099,6 +5101,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance) le32_to_cpus((u32 *)&ci->adapterOperations2); le32_to_cpus((u32 *)&ci->adapterOperations3); le16_to_cpus((u16 *)&ci->adapter_operations4); + le32_to_cpus((u32 *)&ci->adapter_operations5); /* Update the latest Ext VD info. * From Init path, store current firmware details. @@ -5112,6 +5115,8 @@ megasas_get_ctrl_info(struct megasas_instance *instance) ci->adapter_operations4.support_pd_map_target_id; instance->support_nvme_passthru = ci->adapter_operations4.support_nvme_passthru; + instance->support_pci_lane_margining = + ci->adapter_operations5.support_pci_lane_margining; instance->task_abort_tmo = ci->TaskAbortTO; instance->max_reset_tmo = ci->MaxResetTO; @@ -5145,6 +5150,8 @@ megasas_get_ctrl_info(struct megasas_instance *instance) instance->task_abort_tmo, instance->max_reset_tmo); dev_info(&instance->pdev->dev, "JBOD sequence map support\t: %s\n", instance->support_seqnum_jbod_fp ? "Yes" : "No"); + dev_info(&instance->pdev->dev, "PCI Lane Margining support\t: %s\n", + instance->support_pci_lane_margining ? "Yes" : "No"); break; @@ -7793,7 +7800,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, if ((ioc->frame.hdr.cmd >= MFI_CMD_OP_COUNT) || ((ioc->frame.hdr.cmd == MFI_CMD_NVME) && - !instance->support_nvme_passthru)) { + !instance->support_nvme_passthru) || + ((ioc->frame.hdr.cmd == MFI_CMD_TOOLBOX) && + !instance->support_pci_lane_margining)) { dev_err(&instance->pdev->dev, "Received invalid ioctl command 0x%x\n", ioc->frame.hdr.cmd); @@ -8277,6 +8286,14 @@ support_nvme_encapsulation_show(struct device_driver *dd, char *buf) static DRIVER_ATTR_RO(support_nvme_encapsulation); +static ssize_t +support_pci_lane_margining_show(struct device_driver *dd, char *buf) +{ + return sprintf(buf, "%u\n", support_pci_lane_margining); +} + +static DRIVER_ATTR_RO(support_pci_lane_margining); + static inline void megasas_remove_scsi_device(struct scsi_device *sdev) { sdev_printk(KERN_INFO, sdev, "SCSI device is removed\n"); @@ -8546,6 +8563,7 @@ static int __init megasas_init(void) support_poll_for_event = 2; support_device_change = 1; support_nvme_encapsulation = true; + support_pci_lane_margining = true; memset(&megasas_mgmt_info, 0, sizeof(megasas_mgmt_info)); @@ -8602,8 +8620,17 @@ static int __init megasas_init(void) if (rval) goto err_dcf_support_nvme_encapsulation; + rval = driver_create_file(&megasas_pci_driver.driver, + &driver_attr_support_pci_lane_margining); + if (rval) + goto err_dcf_support_pci_lane_margining; + return rval; +err_dcf_support_pci_lane_margining: + driver_remove_file(&megasas_pci_driver.driver, + &driver_attr_support_nvme_encapsulation); + err_dcf_support_nvme_encapsulation: driver_remove_file(&megasas_pci_driver.driver, &driver_attr_support_device_change); @@ -8643,6 +8670,8 @@ static void __exit megasas_exit(void) driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); driver_remove_file(&megasas_pci_driver.driver, &driver_attr_support_nvme_encapsulation); + driver_remove_file(&megasas_pci_driver.driver, + &driver_attr_support_pci_lane_margining); pci_unregister_driver(&megasas_pci_driver); megasas_exit_debugfs(); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 058d22b..e124341 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -4246,6 +4246,13 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance) } break; + case MFI_CMD_TOOLBOX: + if (!instance->support_pci_lane_margining) { + cmd_mfi->frame->hdr.cmd_status = MFI_STAT_INVALID_CMD; + result = COMPLETE_CMD; + } + + break; default: break; } From patchwork Tue Jun 25 11:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B4E713AF for ; Tue, 25 Jun 2019 11:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D065284C8 for ; Tue, 25 Jun 2019 11:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50B6428610; Tue, 25 Jun 2019 11:05:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 971C528585 for ; Tue, 25 Jun 2019 11:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730164AbfFYLFe (ORCPT ); Tue, 25 Jun 2019 07:05:34 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46075 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730159AbfFYLFe (ORCPT ); Tue, 25 Jun 2019 07:05:34 -0400 Received: by mail-pl1-f196.google.com with SMTP id bi6so8657311plb.12 for ; Tue, 25 Jun 2019 04:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sEFNuVq5acDFnuFNK80WEE4N3ubRxRDH6lU83qeQjQo=; b=dKTQgkvpWFKCISQ7HDFy5Nn00y/rwgYNY+Cu1OzAepN2SKg4oaBP/jx32R1zhiQ/47 AF6cmKT15L4k3Ktu9Q5m8fLwN+vxaroU0gTxqp2NO2Ilg55zSUSlVT0mTE4ThXumRxHo 5uzQ4wQ+GUiOgABl4UkEJc55iTI7AEIHvKSfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sEFNuVq5acDFnuFNK80WEE4N3ubRxRDH6lU83qeQjQo=; b=LEhyCfhoE4qbszKi4cwaUaDlbUUcJnPzB4dR/pnSsh7qxE6lEwOY5nJHqFk11kDzbw 61JvUR5DX/Yo4IVpAOuOZjioVkkK94kRdSGIpdw28/th0t71fale8lbquhIw+Y2Qv5Xx muLWcE2EoI9WN7p6v2F4m7OCQTy4YsEDj1Iqp9kFXFNc65uWW12gWU9NORbwtTSmEFD/ h6Lo3wBPrrjbG0QNhE2OhhRLoil+QdWLL4j8BqrrYGVPvuQ4oq+KlCJVyjJSyCenMqb0 fQFW4qmT4nYGUmBqI+TcvuSZeS0vLbbzG+QTVjUk8WXdnXkFgqqXk+ywwl2rsgE/wKCs NyAw== X-Gm-Message-State: APjAAAX/h0fSuLZc8wiUNmlxKA4NgNJmSGwXUFJv6LvuHhRW28LLURYa m5vz+b14SBCNjGlXCGA6NgQTy+xEIwKTz8vL8HCxXpFkrdWjLrE2/4v+vIkx8rFQoDvO4I19LBY L42ZXER9lJBEV1KSdd/+RBRbOlMgYWu50WNjvD8xliLzjl2kqBUjEyv4vulBgRr63wPBOLDnRut v3dYcQD9qdLg== X-Google-Smtp-Source: APXvYqxGZLTkrcfl94O53EiQlforUixvCRRsvKg09Wol6G6k6mARVfks2sN7psrXh6HTLupmIyhX/w== X-Received: by 2002:a17:902:f082:: with SMTP id go2mr17863767plb.25.1561460733072; Tue, 25 Jun 2019 04:05:33 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:32 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 13/18] megaraid_sas: Add support for High IOPs queues Date: Tue, 25 Jun 2019 16:34:31 +0530 Message-Id: <20190625110436.4703-14-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Aero controllers support balanced performance mode through the ability to configure queues with different properties. Reply queues with interrupt coalescing enabled are called "high iops reply queues" and reply queues with interrupt coalescing disabled are called "low latency reply queues". The driver configures a combination of high iops and low latency reply queues if: - HBA is an AERO controller; - MSI-X vectors supported by the HBA is 128; - Total CPU count in the system more than high iops queue count; - Driver is loaded with default max_msix_vectors module parameter; and - System booted in non-kdump mode. Signed-off-by: Kashyap Desai Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 6 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 135 ++++++++++++++++++++++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 11 +++ 3 files changed, 135 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 83baac3..5b17d0f 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1640,6 +1640,7 @@ enum FW_BOOT_CONTEXT { #define MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET (1 << 24) #define MR_CAN_HANDLE_64_BIT_DMA_OFFSET (1 << 25) +#define MR_INTR_COALESCING_SUPPORT_OFFSET (1 << 26) #define MEGASAS_WATCHDOG_THREAD_INTERVAL 1000 #define MEGASAS_WAIT_FOR_NEXT_DMA_MSECS 20 @@ -2250,6 +2251,9 @@ enum MR_PD_TYPE { #define MR_DEFAULT_NVME_MDTS_KB 128 #define MR_NVME_PAGE_SIZE_MASK 0x000000FF +/*Aero performance parameters*/ +#define MR_HIGH_IOPS_QUEUE_COUNT 8 + struct megasas_instance { unsigned int *reply_map; @@ -2433,6 +2437,8 @@ struct megasas_instance { bool atomic_desc_support; bool support_seqnum_jbod_fp; bool support_pci_lane_margining; + u8 low_latency_index_start; + bool balanced_mode; }; struct MR_LD_VF_MAP { diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 4c7a093..2e3c7fd 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5472,6 +5472,8 @@ megasas_setup_irqs_ioapic(struct megasas_instance *instance) __func__, __LINE__); return -1; } + instance->balanced_mode = false; + instance->low_latency_index_start = 0; return 0; } @@ -5610,9 +5612,11 @@ megasas_setup_jbod_map(struct megasas_instance *instance) static void megasas_setup_reply_map(struct megasas_instance *instance) { const struct cpumask *mask; - unsigned int queue, cpu; + unsigned int queue, cpu, low_latency_index_start; - for (queue = 0; queue < instance->msix_vectors; queue++) { + low_latency_index_start = instance->low_latency_index_start; + + for (queue = low_latency_index_start; queue < instance->msix_vectors; queue++) { mask = pci_irq_get_affinity(instance->pdev, queue); if (!mask) goto fallback; @@ -5623,8 +5627,14 @@ static void megasas_setup_reply_map(struct megasas_instance *instance) return; fallback: - for_each_possible_cpu(cpu) - instance->reply_map[cpu] = cpu % instance->msix_vectors; + queue = low_latency_index_start; + for_each_possible_cpu(cpu) { + instance->reply_map[cpu] = queue; + if (queue == (instance->msix_vectors - 1)) + queue = low_latency_index_start; + else + queue++; + } } /** @@ -5661,6 +5671,66 @@ int megasas_get_device_list(struct megasas_instance *instance) return SUCCESS; } + +static int +__megasas_alloc_irq_vectors(struct megasas_instance *instance) +{ + int i, irq_flags; + struct irq_affinity desc = { .pre_vectors = instance->low_latency_index_start }; + struct irq_affinity *descp = &desc; + + irq_flags = PCI_IRQ_MSIX; + + if (instance->smp_affinity_enable) + irq_flags |= PCI_IRQ_AFFINITY; + else + descp = NULL; + + i = pci_alloc_irq_vectors_affinity(instance->pdev, + instance->low_latency_index_start, + instance->msix_vectors, irq_flags, descp); + + return i; +} + +/** + * megasas_alloc_irq_vectors - Allocate IRQ vectors/enable MSI-x vectors + * @instance: Adapter soft state + * return: void + */ +static void +megasas_alloc_irq_vectors(struct megasas_instance *instance) +{ + int i; + unsigned int num_msix_req; + + i = __megasas_alloc_irq_vectors(instance); + + if (instance->balanced_mode && (i != instance->msix_vectors)) { + if (instance->msix_vectors) + pci_free_irq_vectors(instance->pdev); + /*Disable Balanced IOPs mode and try realloc vectors*/ + instance->balanced_mode = false; + instance->low_latency_index_start = 1; + num_msix_req = num_online_cpus() + instance->low_latency_index_start; + + instance->msix_vectors = min(num_msix_req, + instance->msix_vectors); + + i = __megasas_alloc_irq_vectors(instance); + + } + + dev_info(&instance->pdev->dev, + "requested/available msix %d/%d\n", instance->msix_vectors, i); + + if (i > 0) + instance->msix_vectors = i; + else + instance->msix_vectors = 0; + +} + /** * megasas_init_fw - Initializes the FW * @instance: Adapter soft state @@ -5680,6 +5750,8 @@ static int megasas_init_fw(struct megasas_instance *instance) int i, j, loop; struct IOV_111 *iovPtr; struct fusion_context *fusion; + bool intr_coalescing; + unsigned int num_msix_req; fusion = instance->ctrl_context; @@ -5799,7 +5871,6 @@ static int megasas_init_fw(struct megasas_instance *instance) msix_enable = (instance->instancet->read_fw_status_reg(instance) & 0x4000000) >> 0x1a; if (msix_enable && !msix_disable) { - int irq_flags = PCI_IRQ_MSIX; scratch_pad_1 = megasas_readl (instance, &instance->reg_set->outbound_scratch_pad_1); @@ -5865,19 +5936,49 @@ static int megasas_init_fw(struct megasas_instance *instance) } else /* MFI adapters */ instance->msix_vectors = 1; - /* Don't bother allocating more MSI-X vectors than cpus */ - instance->msix_vectors = min(instance->msix_vectors, - (unsigned int)num_online_cpus()); - if (instance->smp_affinity_enable) - irq_flags |= PCI_IRQ_AFFINITY; - i = pci_alloc_irq_vectors(instance->pdev, 1, - instance->msix_vectors, irq_flags); - if (i > 0) { - instance->msix_vectors = i; - } else { - instance->msix_vectors = 0; + + /* + * For Aero(if few conditions are met), driver will configure + * few additional reply queues with interrupt coalescing enabled. + * These queues with interrupt coalescing enabled are called + * High IOPs queues and rest of reply queues(based on number of + * logical CPUs) are termed as Low latency queues. + * + * Total Number of reply queues = High IOPs queues + low latency queues + * + * For rest of fusion adapters, 1 additional reply queue will be + * reserved for management commands, rest of reply queues + * (based on number of logical CPUs) will be used for IOs and + * referenced as IO queues. + * Total Number of reply queues = 1 + IO queues + * + * MFI adapters supports single MSI-x so single reply queue + * will be used for IO and management commands. + */ + + intr_coalescing = (scratch_pad_1 & MR_INTR_COALESCING_SUPPORT_OFFSET) ? + true : false; + if (intr_coalescing && + (num_online_cpus() >= MR_HIGH_IOPS_QUEUE_COUNT) && + (instance->msix_vectors == MEGASAS_MAX_MSIX_QUEUES)) + instance->balanced_mode = true; + else + instance->balanced_mode = false; + + if (instance->balanced_mode) + instance->low_latency_index_start = + MR_HIGH_IOPS_QUEUE_COUNT; + else + instance->low_latency_index_start = 1; + + num_msix_req = num_online_cpus() + instance->low_latency_index_start; + + instance->msix_vectors = min(num_msix_req, + instance->msix_vectors); + + megasas_alloc_irq_vectors(instance); + if (!instance->msix_vectors) instance->msix_load_balance = false; - } } /* * MSI-X host index 0 is common for all adapter. diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index e124341..44bfbe8 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1058,6 +1058,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) u32 scratch_pad_1; ktime_t time; bool cur_fw_64bit_dma_capable; + bool cur_intr_coalescing; fusion = instance->ctrl_context; @@ -1091,6 +1092,16 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) goto fail_fw_init; } + cur_intr_coalescing = (scratch_pad_1 & MR_INTR_COALESCING_SUPPORT_OFFSET) ? + true : false; + + if ((instance->low_latency_index_start == + MR_HIGH_IOPS_QUEUE_COUNT) && cur_intr_coalescing) + instance->balanced_mode = true; + + dev_info(&instance->pdev->dev, "Balanced mode :%s\n", + instance->balanced_mode ? "Yes" : "No"); + instance->fw_sync_cache_support = (scratch_pad_1 & MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 : 0; dev_info(&instance->pdev->dev, "FW supports sync cache\t: %s\n", From patchwork Tue Jun 25 11:04:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E5F714B6 for ; Tue, 25 Jun 2019 11:05:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F46E284C8 for ; Tue, 25 Jun 2019 11:05:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 132B728585; Tue, 25 Jun 2019 11:05:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B126C284C8 for ; Tue, 25 Jun 2019 11:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730046AbfFYLFh (ORCPT ); Tue, 25 Jun 2019 07:05:37 -0400 Received: from mail-pl1-f170.google.com ([209.85.214.170]:35508 "EHLO mail-pl1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFh (ORCPT ); Tue, 25 Jun 2019 07:05:37 -0400 Received: by mail-pl1-f170.google.com with SMTP id w24so785475plp.2 for ; Tue, 25 Jun 2019 04:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6QT4tQX6YeIvXgliqgWDFrZYwJqIGjTRFovye1EtSvM=; b=L/C4oBt2uTruu3VeHMREOtQrokUTdAvACtRW0EKa9vuxY6BbpUHmyARvZdX+5ZCZzh j6iy7GmhQjMMg4SyCJ8JHyN3kjokc9w2fhHgV0+85U/ZDk9P2er3Na8t2RvI+Yi02yJr yzxaqVxqVgk6KIt7iWetoochJkD+qSQI4qzBM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6QT4tQX6YeIvXgliqgWDFrZYwJqIGjTRFovye1EtSvM=; b=dtGA42ezFq1uQv5McCvIhgHHvB24rFhLEPhLRXw/Q5q/wJfU1HuUVdNZfRibYk6ZJE ugbRkJNtWsykV/TxzM58eCEG979DnzdYEK/f9u5TJ0oKRpZmfr0P6y/96JcA160WT2M6 ZkTqswzascdR+c/OHqSvfe4vsOBoh6hZGCN77HCicGdzoZ9JBIpsOYsagDOPZzVTIT2U 630cYFTJzfMTcTCsac4zjKAKBBxffqaQM6TYDN3mQZhmC1Oqp1rgzndIIUAKQJQskQnC 3Bzk2KAFQy2ihY8AouoAOjmL9Bna1N1uTUsY7FWKWwxMhDnFJn0kg6NJpo5Nv+VnHSU+ vqNQ== X-Gm-Message-State: APjAAAXg8nbTDsENi5rc1dgYop5EFL3dLwaYzywAglUuodxEz7Q9tAml GW6Ef9RDHb/Xf/JXB6nJv1PALUCnUnOZgVAAEHkYjm9zFh7UjT4k61lk1HV6ZMRq0r4Rh4kw3FY 9ZwNOlJ+S6WhqFdkaJXXPQR9Bw+mKy+zWr4vX9m3vhD/g8+tHtX01uajOfUYQZuU9LUumdfyoxX eCSCtNKtg5Ig== X-Google-Smtp-Source: APXvYqwnAsxDeXpju+2/NdwNwOdKinkQHkRcV4n3i1rlB/70NgA3oDicBK7GsTKILcHmWs+PDKU7rQ== X-Received: by 2002:a17:902:d891:: with SMTP id b17mr29001319plz.48.1561460736127; Tue, 25 Jun 2019 04:05:36 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:35 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 14/18] megaraid_sas: Enable coalescing for high IOPs queues Date: Tue, 25 Jun 2019 16:34:32 +0530 Message-Id: <20190625110436.4703-15-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver should enable interrupt coalescing(during driver load and after Controller Reset) for High IOPs queues by masking appropriate bits in IOC INIT frame. Signed-off-by: Kashyap Desai Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 2 +- drivers/scsi/megaraid/megaraid_sas_fusion.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 5b17d0f..02e6e15 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1819,7 +1819,7 @@ struct megasas_init_frame { __le32 pad_0; /*0Ch */ __le16 flags; /*10h */ - __le16 reserved_3; /*12h */ + __le16 replyqueue_mask; /*12h */ __le32 data_xfer_len; /*14h */ __le32 queue_info_new_phys_addr_lo; /*18h */ diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 44bfbe8..845ca2f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1186,6 +1186,14 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) cpu_to_le32(lower_32_bits(ioc_init_handle)); init_frame->data_xfer_len = cpu_to_le32(sizeof(struct MPI2_IOC_INIT_REQUEST)); + /* + * Each bit in replyqueue_mask represents one group of MSI-x vectors + * (each group has 8 vectors) + */ + if (instance->balanced_mode) + init_frame->replyqueue_mask = + cpu_to_le16(~(~0 << instance->low_latency_index_start / 8)); + req_desc.u.low = cpu_to_le32(lower_32_bits(cmd->frame_phys_addr)); req_desc.u.high = cpu_to_le32(upper_32_bits(cmd->frame_phys_addr)); req_desc.MFAIo.RequestFlags = From patchwork Tue Jun 25 11:04:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AC9314B6 for ; Tue, 25 Jun 2019 11:05:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D771284C8 for ; Tue, 25 Jun 2019 11:05:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3ACF28585; Tue, 25 Jun 2019 11:05:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98181284C8 for ; Tue, 25 Jun 2019 11:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730166AbfFYLFk (ORCPT ); Tue, 25 Jun 2019 07:05:40 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38531 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730057AbfFYLFk (ORCPT ); Tue, 25 Jun 2019 07:05:40 -0400 Received: by mail-pl1-f194.google.com with SMTP id g4so8640670plb.5 for ; Tue, 25 Jun 2019 04:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FIPydZ3jEWaeWPodWxnrqDckJVIVod1VLHb1/9k7Fxg=; b=CIFCY1w626bTzOUOiY626W/PsZU0essBlv6U95YmCyphuHHLlcJberXjvNmrSgMHOt V/gRdEm6aY6VwMkOy7XgsuFqEHbaLd9A5Pm0X+Z40uAxDsAT1yTK2GczNf/J43NT/z2p Wgp3e1fwfiuwbmYSZPH1kZ9gqoX/Ygy02Ja5o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FIPydZ3jEWaeWPodWxnrqDckJVIVod1VLHb1/9k7Fxg=; b=mZMWEvt17OwWs7YnzM68jtXkrhBXMeC6AyJ0ZS8SOI2w+bq0nKfFWTrJwAGGpHXrVA b7c6QY1Y+ODWCbArZH7OVlDiIndOkWP2tiU9zJe/9HCtcw+FfhjvcNUjxslkvN2OgZBP h0hH2Yya/p04lx0UChOB0JB5rLEHehqo9WZHi4iVGH7gCyQPgHRlXpQItS+66Js/48dk e/wd2J+P6As5d5fD28zHIpeXJIF8tcwJJF0OPaU0bHpSuaznm38J/MrTMxrNxlDKIXtI 31utSmLknOZ/DMI5QZK6hMJQ+PIS5qQBuBC8uDedGRbHNYV+gk8qR2oUorDATUlTXCXu 6h6w== X-Gm-Message-State: APjAAAXb1Va4SC2LylpUSBUvTeBPQcWEQdc2gctfw5bW3PcfAl34ou+X y7IkM/yI2Mad/EZQ7R6y7VQ+1HNU5irLYam/xkatXHVgAXj52vGQFfBw2x5v88Zmn8sh7i4fJwR X3Npx90j57MhJWq5FtZiQ06S9hNWs80ijwipXnTNKHH/Km9rQ4cuDE28Jr4QkH+P8nepJkWd+Fx BVLUWZ9RXyCw== X-Google-Smtp-Source: APXvYqyB5uHM30ddXQsXnrtiwnO6Pb4Owi262lNKjyL0SLv3Gjsrm+MtwjHhsyitzjfr+AAej2Qqng== X-Received: by 2002:a17:902:306:: with SMTP id 6mr156117704pld.148.1561460739169; Tue, 25 Jun 2019 04:05:39 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:38 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 15/18] megaraid_sas: Set affinity for high IOPs reply queues Date: Tue, 25 Jun 2019 16:34:33 +0530 Message-Id: <20190625110436.4703-16-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP High iops queues are mapped to non-managed IRQs. Set affinity of non-managed irqs to local numa node. Low latency queues are mapped to managed IRQs. Driver reserves some reply queues for high iops queues (through pci_alloc_irq_vectors_affinity and .pre_vectors interface). The rest of queues are for low latency. Based on IO workload, driver will decide which group of reply queues (either high iops queues or low latency queues) to be used. High iops queues will be mapped to local numa node of controller and low latency queues will be mapped to CPUs across numa nodes. In general, high iops and low latency queues should fit into 128 reply queues which is the max number of reply queues supported by Aero adapters. Signed-off-by: Kashyap Desai Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas_base.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 2e3c7fd..fec3e57 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5672,6 +5672,26 @@ int megasas_get_device_list(struct megasas_instance *instance) return SUCCESS; } +/** + * megasas_set_high_iops_queue_affinity_hint - Set affinity hint for high IOPs queues + * @instance: Adapter soft state + * return: void + */ +static inline void +megasas_set_high_iops_queue_affinity_hint(struct megasas_instance *instance) +{ + int i; + int local_numa_node; + + if (instance->balanced_mode) { + local_numa_node = dev_to_node(&instance->pdev->dev); + + for (i = 0; i < instance->low_latency_index_start; i++) + irq_set_affinity_hint(pci_irq_vector(instance->pdev, i), + cpumask_of_node(local_numa_node)); + } +} + static int __megasas_alloc_irq_vectors(struct megasas_instance *instance) { @@ -5729,6 +5749,8 @@ megasas_alloc_irq_vectors(struct megasas_instance *instance) else instance->msix_vectors = 0; + if (instance->smp_affinity_enable) + megasas_set_high_iops_queue_affinity_hint(instance); } /** From patchwork Tue Jun 25 11:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CEA513AF for ; Tue, 25 Jun 2019 11:05:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F36C28581 for ; Tue, 25 Jun 2019 11:05:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 339F228610; Tue, 25 Jun 2019 11:05:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADA5E28581 for ; Tue, 25 Jun 2019 11:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730170AbfFYLFo (ORCPT ); Tue, 25 Jun 2019 07:05:44 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39316 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFo (ORCPT ); Tue, 25 Jun 2019 07:05:44 -0400 Received: by mail-pg1-f195.google.com with SMTP id 196so8793653pgc.6 for ; Tue, 25 Jun 2019 04:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T4xFAUQiRTbKSvU/plzn2gO53ObR6gnzkNhb7ykrKfo=; b=Mb1OkNV0i/hvmtqYzu7PTd6cw+vEGWB2im/+3ujUVNMx5DFOQHx33+Gdu6xXnSHyi8 QzzvakfcOGFcuMD2oqLQD3iCi4457wrhYup4qZNM9MDC4qBf02KzS64iGovkUWQ6SUrA FM4JEbRZAai+onB783m5qqNOmQmi6A8alBeeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=T4xFAUQiRTbKSvU/plzn2gO53ObR6gnzkNhb7ykrKfo=; b=nYL/0Piz2J5TPwYlbbGXwio/lrdwRCFQqmLdSvMupJ86I/6c9aa/ZaSEhJ0CdhjbIG iemj6/KaH/JNTKRWuIQebwMuePCMeY5NgWpRkU6xaHU7WIftlOiAqBbOoILTPZyuBatU cTpzSoxtv2d/F7g6GY9Y/ERXbE4H8LHsfp2wuT/H9w4hymKlT7n+MV4U4lBfvPA3H+BP 0WkZtQCTE6ky+77JB2hBcGGdMh5gYujSP8kx68Xay45yDagGFr/yoekwiETtz+JLMN5E HfVlELyltuBLBBLlp/XZGKHkJAaCCPNUxQf8Kr4NdVv9pF1lOzAjO1fm7YI2G3IEBqdv h7MA== X-Gm-Message-State: APjAAAVgPPSbYhwiyitgbNFww3COAdnYIwuxGW1br4taaTRUqQ0q3sQ/ zid71gXU8DyfEwDXT5D+Z8bX1hNwk/+1oobcn7qTEHfhK2njRvJS5FDt31nYKPhMLVyjqnQ2Msp NYBByJnn3NELNQXfrgndUlT1FBRh0bfNUiGdXdYbuj4HI6azhKJNtwgeiLrjREnhXJLdH8Ko7sj MJ3d+Z5UlN/w== X-Google-Smtp-Source: APXvYqyjCA9E933W4rYJlp5aotifrGZDPbzocoC/GOg7ndnehM3HLqwPt7/ZD8OVV2/ZYNMroA/J7w== X-Received: by 2002:a17:90a:3544:: with SMTP id q62mr31508839pjb.53.1561460742847; Tue, 25 Jun 2019 04:05:42 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.39 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:42 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 16/18] megaraid_sas: Use high IOPs queues based on IO workload Date: Tue, 25 Jun 2019 16:34:34 +0530 Message-Id: <20190625110436.4703-17-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver will use round-robin method for IO submission in batches within the high iops queues when the number of in-flight ios on the target device is larger than 8. Otherwise the driver will use low latency reply queues. Signed-off-by: Kashyap Desai Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_fp.c | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 16 ++++++++++++++-- drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 02e6e15..3f4cb52 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2253,6 +2253,8 @@ enum MR_PD_TYPE { /*Aero performance parameters*/ #define MR_HIGH_IOPS_QUEUE_COUNT 8 +#define MR_DEVICE_HIGH_IOPS_DEPTH 8 +#define MR_HIGH_IOPS_BATCH_COUNT 16 struct megasas_instance { @@ -2362,6 +2364,7 @@ struct megasas_instance { atomic_t ldio_outstanding; atomic_t fw_reset_no_pci_access; atomic64_t total_io_count; + atomic64_t high_iops_outstanding; struct megasas_instance_template *instancet; struct tasklet_struct isr_tasklet; diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index 43a2e49..f9f7c34 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -1038,6 +1038,7 @@ MR_BuildRaidContext(struct megasas_instance *instance, stripSize = 1 << raid->stripeShift; stripe_mask = stripSize-1; + io_info->data_arms = raid->rowDataSize; /* * calculate starting row and stripe, and number of strips and rows diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 845ca2f..90dced4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2811,6 +2811,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, io_info.r1_alt_dev_handle = MR_DEVHANDLE_INVALID; scsi_buff_len = scsi_bufflen(scp); io_request->DataLength = cpu_to_le32(scsi_buff_len); + io_info.data_arms = 1; if (scp->sc_data_direction == DMA_FROM_DEVICE) io_info.isRead = 1; @@ -2830,7 +2831,13 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, fp_possible = (io_info.fpOkForIo > 0) ? true : false; } - if (instance->msix_load_balance) + if (instance->balanced_mode && + atomic_read(&scp->device->device_busy) > + (io_info.data_arms * MR_DEVICE_HIGH_IOPS_DEPTH)) + cmd->request_desc->SCSIIO.MSIxIndex = + mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) / + MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start); + else if (instance->msix_load_balance) cmd->request_desc->SCSIIO.MSIxIndex = (mega_mod64(atomic64_add_return(1, &instance->total_io_count), instance->msix_vectors)); @@ -3157,7 +3164,12 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; - if (instance->msix_load_balance) + if (instance->balanced_mode && + atomic_read(&scmd->device->device_busy) > MR_DEVICE_HIGH_IOPS_DEPTH) + cmd->request_desc->SCSIIO.MSIxIndex = + mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) / + MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start); + else if (instance->msix_load_balance) cmd->request_desc->SCSIIO.MSIxIndex = (mega_mod64(atomic64_add_return(1, &instance->total_io_count), instance->msix_vectors)); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index ca32b2b..6fe3343 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -962,6 +962,7 @@ struct IO_REQUEST_INFO { u8 pd_after_lb; u16 r1_alt_dev_handle; /* raid 1/10 only */ bool ra_capable; + u8 data_arms; }; struct MR_LD_TARGET_SYNC { From patchwork Tue Jun 25 11:04:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E809D14B6 for ; Tue, 25 Jun 2019 11:05:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA0BB284C8 for ; Tue, 25 Jun 2019 11:05:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDFAD28585; Tue, 25 Jun 2019 11:05:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 145DC284C8 for ; Tue, 25 Jun 2019 11:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730105AbfFYLFr (ORCPT ); Tue, 25 Jun 2019 07:05:47 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33062 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFr (ORCPT ); Tue, 25 Jun 2019 07:05:47 -0400 Received: by mail-pf1-f193.google.com with SMTP id x15so9323378pfq.0 for ; Tue, 25 Jun 2019 04:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TA6OlXHmIgziVTuF/o1NmjZZ9RqFmCrsMmYBz+MXj9U=; b=f0N9UTcVjnBt7unm87LV4OXlmeNgE0uxq4Spqwa9bSUVUdZ6RQqe3fBAFMOfKtsAk0 zQ21D0GBXN5nr/RBv190dHV6cO1QRcHxQ4Qi6wiJ0skXiKbC73zLrBsruZshLIU8Gae7 QAkGNyMl15Ap6KyAhp8wAtJsyKJRl9WqSFaOk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TA6OlXHmIgziVTuF/o1NmjZZ9RqFmCrsMmYBz+MXj9U=; b=l+O/kkEhsUfDow2C2MhXnq8H+7cDYAaVdpk4F0ud70THEio5Q/Gp7tLpV18Oqz7KGM ONh0L3CNYdQCrQAeiO3+/6sil0rZDjaBseRHvqA/iSZecCdZKh7XSYGV99trHuPCxOVz RgryJM6gMhhYn/w7N8P4xWXFX7CuocttELDi4bGC9gU3ZAWssAKFIrmjGomloBSPktHa eu8htuuyjknE6nFIpBFgSmOQ8kQhbV8cPJT5lvqMfWfLpplY9wqaPqNAWAcWVhnREJBI 9ikzAiwMCWCVesOHxZ1395XXOcc6qKFCkCfxftdq48WezDSfmYbV8COObflv06zmXbFE gekw== X-Gm-Message-State: APjAAAU/mKOxf/yjNiiU/6LZL+g2Wuzy8RK7nPgzCEGbqoUQFoG73dGq p+H3eIdqsO1UXs3bDBzakjJZ/bGijYAZ5O4bbn0io/WrBP1+/hhh7Z4Ve72NkK9NQaiI07MHdZ0 XQ4YvI04YU+EDTEDHHETsnZQFVGpZjiH+H2GLgWPM4z6SqVJDNIdj+a2AX11pNBQC4rTOmRMqgG qrcuwrgTkM+w== X-Google-Smtp-Source: APXvYqyokcJIqn8XgcgRyHW0i2TsuXUs3pAI6ZgPLxWVyroLxW/8Dry1DwF1IKG3BNqGw+Dr/WOq5w== X-Received: by 2002:a63:fc61:: with SMTP id r33mr14263375pgk.294.1561460746094; Tue, 25 Jun 2019 04:05:46 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:45 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 17/18] megaraid_sas: Introduce various Aero performance modes Date: Tue, 25 Jun 2019 16:34:35 +0530 Message-Id: <20190625110436.4703-18-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For Aero adapters, driver provides three different performance modes controlled through module parameter named- 'perf_mode'. Below are those performance modes: 0: Balanced - Additional high IOPs reply queues will be enabled along with low latency queues. Interrupt coalescing will be enabled only for these high IOPs reply queues. 1: IOPs - No additional high IOPs queues are enabled. Interrupt coalescing will be enabled on all reply queues. 2: Latency - No additional high IOPs queues are enabled. Interrupt coalescing will be disabled on all reply queues. This is a legacy behavior similar to Ventura & Invader Series. Default performance mode settings: -Performance mode set to 'Balanced', if Aero controller is working in 16GT/s PCIe speed. -Performance mode will be set to 'Latency' mode for all other cases. Through module parameter- 'perf_mode', user can override default performance mode to desired one. Captured below some performance numbers with these performance modes. 4k Random Read IO performance numbers on 24 SAS SSD drives for above three permormance modes. Performance data is from Intel Skylake and HGST SS300 (drive model SDLL1DLR400GCCA1). IOPs: ----------------------------------------------------------------------- |perf_mode | qd = 1 | qd = 64 | note | |-------------|--------|---------|------------------------------------- |balanced | 259K | 3061k | Provides max performance numbers | | | | | both on lower QD workload & | | | | | also on higher QD workload | |-------------|--------|---------|------------------------------------- |iops | 220K | 3100k | Provides max performance numbers | | | | | only on higher QD workload. | |-------------|--------|---------|------------------------------------- |latency | 246k | 2226k | Provides good performance numbers | | | | | only on lower QD worklaod. | ----------------------------------------------------------------------- Average Latency: ----------------------------------------------------- |perf_mode | qd = 1 | qd = 64 | |-------------|--------------|----------------------| |balanced | 92.05 usec | 501.12 usec | |-------------|--------------|----------------------| |iops | 108.40 usec | 498.10 usec | |-------------|--------------|----------------------| |latency | 97.10 usec | 689.26 usec | ----------------------------------------------------- Signed-off-by: Sumit Saxena Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 14 ++++++- drivers/scsi/megaraid/megaraid_sas_base.c | 60 +++++++++++++++++++++++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 22 +++++++---- 3 files changed, 81 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 3f4cb52..0b38691 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2256,6 +2256,18 @@ enum MR_PD_TYPE { #define MR_DEVICE_HIGH_IOPS_DEPTH 8 #define MR_HIGH_IOPS_BATCH_COUNT 16 +enum MR_PERF_MODE { + MR_BALANCED_PERF_MODE = 0, + MR_IOPS_PERF_MODE = 1, + MR_LATENCY_PERF_MODE = 2, +}; + +#define MEGASAS_PERF_MODE_2STR(mode) \ + ((mode) == MR_BALANCED_PERF_MODE ? "Balanced" : \ + (mode) == MR_IOPS_PERF_MODE ? "IOPs" : \ + (mode) == MR_LATENCY_PERF_MODE ? "Latency" : \ + "Unknown") + struct megasas_instance { unsigned int *reply_map; @@ -2441,7 +2453,7 @@ struct megasas_instance { bool support_seqnum_jbod_fp; bool support_pci_lane_margining; u8 low_latency_index_start; - bool balanced_mode; + int perf_mode; }; struct MR_LD_VF_MAP { diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index fec3e57..b4c0bbc 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -105,6 +105,18 @@ unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; module_param(scmd_timeout, int, 0444); MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer."); +int perf_mode = -1; +module_param(perf_mode, int, 0444); +MODULE_PARM_DESC(perf_mode, "Performance mode (only for Aero adapters), options:\n\t\t" + "0 - balanced: High iops and low latency queues are allocated &\n\t\t" + "interrupt coalescing is enabled only on high iops queues\n\t\t" + "1 - iops: High iops queues are not allocated &\n\t\t" + "interrupt coalescing is enabled on all queues\n\t\t" + "2 - latency: High iops queues are not allocated &\n\t\t" + "interrupt coalescing is disabled on all queues\n\t\t" + "default mode is 'balanced'" + ); + MODULE_LICENSE("GPL"); MODULE_VERSION(MEGASAS_VERSION); MODULE_AUTHOR("megaraidlinux.pdl@broadcom.com"); @@ -5472,7 +5484,7 @@ megasas_setup_irqs_ioapic(struct megasas_instance *instance) __func__, __LINE__); return -1; } - instance->balanced_mode = false; + instance->perf_mode = MR_LATENCY_PERF_MODE; instance->low_latency_index_start = 0; return 0; } @@ -5683,7 +5695,7 @@ megasas_set_high_iops_queue_affinity_hint(struct megasas_instance *instance) int i; int local_numa_node; - if (instance->balanced_mode) { + if (instance->perf_mode == MR_BALANCED_PERF_MODE) { local_numa_node = dev_to_node(&instance->pdev->dev); for (i = 0; i < instance->low_latency_index_start; i++) @@ -5726,11 +5738,12 @@ megasas_alloc_irq_vectors(struct megasas_instance *instance) i = __megasas_alloc_irq_vectors(instance); - if (instance->balanced_mode && (i != instance->msix_vectors)) { + if ((instance->perf_mode == MR_BALANCED_PERF_MODE) && + (i != instance->msix_vectors)) { if (instance->msix_vectors) pci_free_irq_vectors(instance->pdev); /*Disable Balanced IOPs mode and try realloc vectors*/ - instance->balanced_mode = false; + instance->perf_mode = MR_LATENCY_PERF_MODE; instance->low_latency_index_start = 1; num_msix_req = num_online_cpus() + instance->low_latency_index_start; @@ -5774,6 +5787,7 @@ static int megasas_init_fw(struct megasas_instance *instance) struct fusion_context *fusion; bool intr_coalescing; unsigned int num_msix_req; + u16 lnksta, speed; fusion = instance->ctrl_context; @@ -5983,11 +5997,43 @@ static int megasas_init_fw(struct megasas_instance *instance) if (intr_coalescing && (num_online_cpus() >= MR_HIGH_IOPS_QUEUE_COUNT) && (instance->msix_vectors == MEGASAS_MAX_MSIX_QUEUES)) - instance->balanced_mode = true; + instance->perf_mode = MR_BALANCED_PERF_MODE; else - instance->balanced_mode = false; + instance->perf_mode = MR_LATENCY_PERF_MODE; + + + if (instance->adapter_type == AERO_SERIES) { + pcie_capability_read_word(instance->pdev, PCI_EXP_LNKSTA, &lnksta); + speed = lnksta & PCI_EXP_LNKSTA_CLS; + + /* + * For Aero, if PCIe link speed is <16 GT/s, then driver should operate + * in latency perf mode and enable R1 PCI bandwidth algorithm + */ + if (speed < 0x4) { + instance->perf_mode = MR_LATENCY_PERF_MODE; + fusion->pcie_bw_limitation = true; + } + + /* + * Performance mode settings provided through module parameter-perf_mode will + * take affect only for: + * 1. Aero family of adapters. + * 2. When user sets module parameter- perf_mode in range of 0-2. + */ + if ((perf_mode >= MR_BALANCED_PERF_MODE) && + (perf_mode <= MR_LATENCY_PERF_MODE)) + instance->perf_mode = perf_mode; + /* + * If intr coalescing is not supported by controller FW, then IOPs + * and Balanced modes are not feasible. + */ + if (!intr_coalescing) + instance->perf_mode = MR_LATENCY_PERF_MODE; + + } - if (instance->balanced_mode) + if (instance->perf_mode == MR_BALANCED_PERF_MODE) instance->low_latency_index_start = MR_HIGH_IOPS_QUEUE_COUNT; else diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 90dced4..8a3e255 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1097,10 +1097,10 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) if ((instance->low_latency_index_start == MR_HIGH_IOPS_QUEUE_COUNT) && cur_intr_coalescing) - instance->balanced_mode = true; + instance->perf_mode = MR_BALANCED_PERF_MODE; - dev_info(&instance->pdev->dev, "Balanced mode :%s\n", - instance->balanced_mode ? "Yes" : "No"); + dev_info(&instance->pdev->dev, "Performance mode :%s\n", + MEGASAS_PERF_MODE_2STR(instance->perf_mode)); instance->fw_sync_cache_support = (scratch_pad_1 & MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 : 0; @@ -1190,9 +1190,17 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) * Each bit in replyqueue_mask represents one group of MSI-x vectors * (each group has 8 vectors) */ - if (instance->balanced_mode) + switch (instance->perf_mode) { + case MR_BALANCED_PERF_MODE: init_frame->replyqueue_mask = - cpu_to_le16(~(~0 << instance->low_latency_index_start / 8)); + cpu_to_le16(~(~0 << instance->low_latency_index_start/8)); + break; + case MR_IOPS_PERF_MODE: + init_frame->replyqueue_mask = + cpu_to_le16(~(~0 << instance->msix_vectors/8)); + break; + } + req_desc.u.low = cpu_to_le32(lower_32_bits(cmd->frame_phys_addr)); req_desc.u.high = cpu_to_le32(upper_32_bits(cmd->frame_phys_addr)); @@ -2831,7 +2839,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, fp_possible = (io_info.fpOkForIo > 0) ? true : false; } - if (instance->balanced_mode && + if ((instance->perf_mode == MR_BALANCED_PERF_MODE) && atomic_read(&scp->device->device_busy) > (io_info.data_arms * MR_DEVICE_HIGH_IOPS_DEPTH)) cmd->request_desc->SCSIIO.MSIxIndex = @@ -3164,7 +3172,7 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; - if (instance->balanced_mode && + if ((instance->perf_mode == MR_BALANCED_PERF_MODE) && atomic_read(&scmd->device->device_busy) > MR_DEVICE_HIGH_IOPS_DEPTH) cmd->request_desc->SCSIIO.MSIxIndex = mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) / From patchwork Tue Jun 25 11:04:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 11015311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 876E713AF for ; Tue, 25 Jun 2019 11:05:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A5CC284C8 for ; Tue, 25 Jun 2019 11:05:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E7A928585; Tue, 25 Jun 2019 11:05:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10EB8284C8 for ; Tue, 25 Jun 2019 11:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730173AbfFYLFu (ORCPT ); Tue, 25 Jun 2019 07:05:50 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41818 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfFYLFu (ORCPT ); Tue, 25 Jun 2019 07:05:50 -0400 Received: by mail-pf1-f195.google.com with SMTP id m30so9293484pff.8 for ; Tue, 25 Jun 2019 04:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K1LOMhUpywtS5Uzk5w46aLkAjiUVQZ4DE25kBQbLzcQ=; b=bz/1A3KqupgBmHx3Tt2rIoq9vLuE8zg6QNSkNpU5X0KdWs0vWM3fyv3ImgvF3ySEKu XsAx8zM1T3EiSkxl6EdWB7kgu4xQisEPdq76rZ0m+ki4oKmtQ4GMWggp0Hnn/V8tvIm2 wCH3YZrQCC6o8Oi9Pj7R0YxMVTJhZgRx+5l4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K1LOMhUpywtS5Uzk5w46aLkAjiUVQZ4DE25kBQbLzcQ=; b=kH6UTo65o4kX4R5bkFKzvKXHQuzT2vzjFe4g2xjPtc0uRNugJAMNlRP3WjITt05Ynx /WZ0Dm0/1d3v5oeol+ocCcRUpvi474SVYDtvQR0tJNp0Jpga8qrRYW6gQpu0RbIwCy+g PguYXofV9GY+iC2BdJykecbxzB0ohdbK68UhbtZfKF0Cvp4QMGqcz/dlLdY4lGM9oELq sHAFfgrcoSYW3x9ADrmnzosyrdYmDftscrZGuE4mYv+LiBkINmv4ZGc5Y6wWmJRIPkr9 l2qw3555KvM8irAdoTj6DCCIiLh07OmKC/ZF7v/jYWcZOVNKq5HNi1casdE70UwAJpdV 2T9A== X-Gm-Message-State: APjAAAW22HUp3qFsZftqRMYNzsTLAC1EVuvwaWd4Kset7KUZz5HZ9SZt fmfUq82l8IRRSImurBxT2eC8FDXF3jYWfRj+ta1fqTdYMamH3R7oQEM/RhvTQ4NLSAFD+eOBS6H BhQVUG+C8UIN1NmZulfzBS2srx4D01fYCWjJjsra16pkxDSdHN9XdW26iqXhiHxgDH5E5XCTpKg zdmv4HXFRUcQ== X-Google-Smtp-Source: APXvYqxcuKFvv2AhnakMIxqPH7iA87X4O2xX1LVxRYuO4gmQHiW7+XyK2va0CtRIq0LFbr+zrR9o7Q== X-Received: by 2002:a63:2326:: with SMTP id j38mr16699886pgj.134.1561460749343; Tue, 25 Jun 2019 04:05:49 -0700 (PDT) Received: from dhcp-10-123-20-30.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t5sm14757389pgh.46.2019.06.25.04.05.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 04:05:48 -0700 (PDT) From: Chandrakanth Patil To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, shivasharan.srikanteshwara@broadcom.com, anand.lodnoor@broadcom.com, Chandrakanth Patil Subject: [PATCH v3 18/18] megaraid_sas: Update driver version to 07.710.06.00-rc1 Date: Tue, 25 Jun 2019 16:34:36 +0530 Message-Id: <20190625110436.4703-19-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> References: <20190625110436.4703-1-chandrakanth.patil@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Chandrakanth Patil --- drivers/scsi/megaraid/megaraid_sas.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 0b38691..dc0f71f 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -33,8 +33,8 @@ /* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION "07.708.03.00-rc1" -#define MEGASAS_RELDATE "March 14, 2019" +#define MEGASAS_VERSION "07.710.06.00-rc1" +#define MEGASAS_RELDATE "June 18, 2019" /* * Device IDs