From patchwork Fri Apr 26 09:36:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918927 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 F3E1D1575 for ; Fri, 26 Apr 2019 09:38:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3FF728D55 for ; Fri, 26 Apr 2019 09:38:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D819028D69; Fri, 26 Apr 2019 09:38:13 +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 8853228D55 for ; Fri, 26 Apr 2019 09:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726193AbfDZJiN (ORCPT ); Fri, 26 Apr 2019 05:38:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38279 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbfDZJiN (ORCPT ); Fri, 26 Apr 2019 05:38:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id 10so1440320pfo.5 for ; Fri, 26 Apr 2019 02:38:12 -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=1l5cQcHT4dT5TKu+rRmWN9++CuA6N+bsfsSSqBnqWYs=; b=gtotp/Oo1ovBTGe73l8JOKx49X+Oqdr3dSa+q9zjUm4USvzX21gTY0kE3Cv4JAZnye DRLmEK/JRAr1g7Oup1Gw/8sFnte9Gzj/1Igf+bqFkUE9s9tRaWZ1l9Jizw09VhKth8oa A0/0H1FulrUnUzwM92SBFwtHM/EDNReqDz/eg= 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=1l5cQcHT4dT5TKu+rRmWN9++CuA6N+bsfsSSqBnqWYs=; b=Lh8HsxLcfmnZh5NOdQBOcH8d9UjjLWqkTOTCEGRSrbpXyCPletTuf38qHFrBEKm37v jR7wuz6mkkIKA/Z9fpqhEOBwqT4QKNuCddBIw1DadYa/hBf2+EwGBlPj5P8QSMuICRxC x+ccdWoonJpeYR9utc5lkTRTJKw+FbBp2gDu15Qn8WA7cu7RqVO4Z+5nzhjNdxg8ivLj gm5lAvHVBDZkyGxsY5PzsaylQQ0hS3T8PLELq6+t3kxTBt7BaqbjNtP4vJtJw6T4tMkr sFiyHiacUw5JnoXa46VqQcjQSqwIb1BBVB1XzLyRe9d9XX/u0TlSQQPeEpllQ9boLsAq +Zyg== X-Gm-Message-State: APjAAAVT8eZ+k64zU0656CEAgqP4sDXI6i0wGqVoDD0izL8YOeFAKbCb RsrnnoqykccLZYN45i9DKtMKJDCXj6v+cd5z/R/LYB/3DI2BOwfpMXlPS9RdEFZmDxU4ptTuimX LtE/SSDl9zrJpUCcYaw4wengvUVr7vPhp0JRwwaN7OyQ9uW4qO0LqFmRpG81iGIg2gzlAUFv91R z2u/UpBp3gcCZVfCbakzwe X-Google-Smtp-Source: APXvYqy+ximgn/Zz1va8evGJ/L+CCdTvjIA56KB51zjsVdA8yWulVkTJZ94RPEUjSq2JDSYNUT+33Q== X-Received: by 2002:a65:6105:: with SMTP id z5mr42936945pgu.378.1556271491792; Fri, 26 Apr 2019 02:38:11 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:11 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 01/21] megaraid_sas: remove unused variable target_index Date: Fri, 26 Apr 2019 02:36:55 -0700 Message-Id: <1556271435-27252-2-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 No functional change. Remove set but unused variable in megasas_set_static_target_properties. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index bbe6972f3477..f677a84f6bc8 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1931,7 +1931,6 @@ megasas_set_nvme_device_properties(struct scsi_device *sdev, u32 max_io_size) static void megasas_set_static_target_properties(struct scsi_device *sdev, bool is_target_prop) { - u16 target_index = 0; u8 interface_type; u32 device_qd = MEGASAS_DEFAULT_CMD_PER_LUN; u32 max_io_size_kb = MR_DEFAULT_NVME_MDTS_KB; @@ -1948,8 +1947,6 @@ static void megasas_set_static_target_properties(struct scsi_device *sdev, */ blk_queue_rq_timeout(sdev->request_queue, scmd_timeout * HZ); - target_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id; - switch (interface_type) { case SAS_PD: device_qd = MEGASAS_SAS_QD; From patchwork Fri Apr 26 09:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918929 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 68F031575 for ; Fri, 26 Apr 2019 09:38:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 582E828CDA for ; Fri, 26 Apr 2019 09:38:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C32A28D56; Fri, 26 Apr 2019 09:38:18 +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 F294A28CDA for ; Fri, 26 Apr 2019 09:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726202AbfDZJiR (ORCPT ); Fri, 26 Apr 2019 05:38:17 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46189 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZJiR (ORCPT ); Fri, 26 Apr 2019 05:38:17 -0400 Received: by mail-pf1-f193.google.com with SMTP id j11so1417158pff.13 for ; Fri, 26 Apr 2019 02:38:16 -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=1S4534JddqAgWEg4VWFs7BXIkYSpCa3aMZMkw9jTEEo=; b=EmiLy1/uSWRw2cT1y/JyJpE22UiziPQWFQvktfYxvix5LsabqJbiaQKvrxnT+eAdqD nLB+wNG3Bk3G8R6YVJ/tMQzeZDMWZ5yOXQcqZGwtOCZ8rov6V/JkvIZvs/T4iRls/LoS IrWWSMxpyx6bBVUyu4RmZus1GiSbe2+8dURug= 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=1S4534JddqAgWEg4VWFs7BXIkYSpCa3aMZMkw9jTEEo=; b=HAe1jhWs/8RarMQ0/ZPog3kTv8gUCnxvXBDURXCgraTRkX6WtLorXHz4w85S41TKAb 6QqY85xBLfo4aKky28cVLh2F3QVvUuDw7IjI3+iCbeiIRArghDvpe3+sNnsd4ecIeJOg HqK/DS0Y1YuDkRu46w5mpQTSy9PIh5pdAwwLEkt0/3hOpNGcaqR/1EHsa5PYAK1+j8P0 MAd5qE5AZRwA1VCaBzFm/+ABjpa3PI/siHC516j1Uk3sutrfROWa/2D04AFnza3czB1P U8STPfhC6UlZUad+vnWhRrkkBs6ehNogZ/epIRFESb00jC5XsTtNiww/DguBk6YJI5j6 NZlQ== X-Gm-Message-State: APjAAAWl92oKO5lFPVkGgSH0eg41rjtEqZnlbIQanJJ8CQB9DRDQIvb1 2q/VUmVnuwJKOrfp+7sgpGSo+X9jOtlIAx9al0/0nQpAXvlSl1zcI5MCVpmbJnsSGTLYHRtGjp3 Yze+bY/mS4BeuLqOUX+LqvN8pfrKxjkXcsffD8acyZxPZdlHtZPtOPlWpJjYjO6yOsIv8kkAw5x oQ15Ym2Fefk7SoKlFpslXO X-Google-Smtp-Source: APXvYqyGU7BMW5q7CwIB92UzwizfOGV3N5CksOdNaAfSiGahObjrbn3BOVl7vOujFRkJ/OnxqgJkyw== X-Received: by 2002:a65:6554:: with SMTP id a20mr43195549pgw.284.1556271495999; Fri, 26 Apr 2019 02:38:15 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:15 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S , stable@vger.kernel.org Subject: [PATCH 02/21] megaraid_sas: Fix calculation of target ID Date: Fri, 26 Apr 2019 02:36:56 -0700 Message-Id: <1556271435-27252-3-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 In megasas_get_target_prop(), driver is incorrectly calculating the target ID for devices with channel 1 and 3. Due to this, firmware will either fail the command (if there is no device with the target id sent from driver) or could return the properties for a target which was not intended. Devices could end up with the wrong queue depth due to this. Fix target id calculation for channel 1 and 3. Cc: stable@vger.kernel.org Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f677a84f6bc8..d2714fc833ae 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -6165,7 +6165,8 @@ megasas_get_target_prop(struct megasas_instance *instance, int ret; struct megasas_cmd *cmd; struct megasas_dcmd_frame *dcmd; - u16 targetId = (sdev->channel % 2) + sdev->id; + u16 targetId = ((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + + sdev->id; cmd = megasas_get_cmd(instance); From patchwork Fri Apr 26 09:36:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918931 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 E49B11390 for ; Fri, 26 Apr 2019 09:38:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D332628D55 for ; Fri, 26 Apr 2019 09:38:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C65F028D69; Fri, 26 Apr 2019 09:38:22 +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 B692628D55 for ; Fri, 26 Apr 2019 09:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726218AbfDZJiV (ORCPT ); Fri, 26 Apr 2019 05:38:21 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36014 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbfDZJiV (ORCPT ); Fri, 26 Apr 2019 05:38:21 -0400 Received: by mail-pl1-f195.google.com with SMTP id w20so671577plq.3 for ; Fri, 26 Apr 2019 02:38: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=b8LcUew8y2c2qcOdIdJueDfN1EbZQu2fqTFNgaHgjzU=; b=R7nhwWEQ/E0ysCxBSqvCwe1MqeTgI3kk1sXletDM7z+z0lIPBl0pSYGQEYe6lVPTNg +p2iIt0P6bQXYrNtafh25nlYYLjOV4s787EReXC1pDJ5xrRuCl73yStyz5bFaizBJPeS Mtl4c580AMMJAG0SkenUU7RNWnzaphGMR12iQ= 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=b8LcUew8y2c2qcOdIdJueDfN1EbZQu2fqTFNgaHgjzU=; b=dkeY6hLMZ3KPsDrgdoW8WJUXnNQcAta5r1zGJBp+IQQyEe7UjcOM8I4yU6ayLZWl6U 4ayRzD4524o+jFI1bt16SbVYkYSx1s0h0ui7fWN1ZJY872a8gzN/XBGRUJfY8WONOnaZ i6ADJuQDZJLgoL11saQt9dM/zn7LX8fkXd586KBCrFblGvqPtVjOfWm9U+/tTmttXTRd EZLQuNqvYqKrlRtYFI/+dVze0MBY93Su0QirqyhbovbbAsV+Yping+ofbiEnYBO1ivIz RMlMatCqpsDQmy2Ccly8mkPkyrE0Tl2Wp75uzeXojxoZRKYN2YRnEJDVbpXP/Y9fTKQf 4eUw== X-Gm-Message-State: APjAAAUNbME2NpEseEcvza7FyjW9+AuYP9aIPsK5BJTZ54OSEMMCIT4e 3Z8yUaMb/YQ9sh5MvbfdbK42KCyDohubJv9h/YotWFzPO85/XKjcmuAz/2uUjOr42WdfPHVb4XG apAkzpcHuGffYSk1GfvwJTg8tmkYZiYHA7qVDJW++aZ4rfHqUPdLSMWZ7cO/ib1l34TPHQvyX8V E2eu9wzY/G9no5uPGz89Ja X-Google-Smtp-Source: APXvYqzjhRuNo2QpvDS/3WcLT/gr810wkwLiNfy2/a8SvVGJi7/kyuvbvXf4FQELBZR8sDF6Rdng6w== X-Received: by 2002:a17:902:e109:: with SMTP id cc9mr747635plb.148.1556271500258; Fri, 26 Apr 2019 02:38:20 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:19 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 03/21] megaraid_sas: fw_reset_no_pci_access required for MFI adapters only Date: Fri, 26 Apr 2019 02:36:57 -0700 Message-Id: <1556271435-27252-4-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 fw_reset_no_pci_access is only applicable for MFI controllers and is not used for Fusion controllers. For all Fusion controllers, driver can check reset adapter bit in status register before performing a chip reset, without setting "fw_reset_no_pci_access". Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index d2714fc833ae..77db6e773a01 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5489,7 +5489,6 @@ static int megasas_init_fw(struct megasas_instance *instance) int i, j, loop, fw_msix_count = 0; struct IOV_111 *iovPtr; struct fusion_context *fusion; - bool do_adp_reset = true; fusion = instance->ctrl_context; @@ -5536,13 +5535,18 @@ static int megasas_init_fw(struct megasas_instance *instance) } if (megasas_transition_to_ready(instance, 0)) { - if (instance->adapter_type >= INVADER_SERIES) { + if (instance->adapter_type != MFI_SERIES) { status_reg = instance->instancet->read_fw_status_reg( instance); - do_adp_reset = status_reg & MFI_RESET_ADAPTER; - } - - if (do_adp_reset) { + if (status_reg & MFI_RESET_ADAPTER) { + instance->instancet->adp_reset + (instance, instance->reg_set); + if (megasas_transition_to_ready(instance, 0)) + goto fail_ready_state; + } else { + goto fail_ready_state; + } + } else { atomic_set(&instance->fw_reset_no_pci_access, 1); instance->instancet->adp_reset (instance, instance->reg_set); @@ -5556,8 +5560,6 @@ static int megasas_init_fw(struct megasas_instance *instance) if (megasas_transition_to_ready(instance, 0)) goto fail_ready_state; - } else { - goto fail_ready_state; } } From patchwork Fri Apr 26 09:36:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918933 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 99B5F1390 for ; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8822928D55 for ; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 797B728D69; Fri, 26 Apr 2019 09:38: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 1408E28D55 for ; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726228AbfDZJiZ (ORCPT ); Fri, 26 Apr 2019 05:38:25 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33298 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfDZJiZ (ORCPT ); Fri, 26 Apr 2019 05:38:25 -0400 Received: by mail-pl1-f194.google.com with SMTP id y3so452244plp.0 for ; Fri, 26 Apr 2019 02:38:25 -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=nZmw5ywIbzOc8VruWmb764fG6flSNtrbuGspqfBaQaI=; b=K+vaTBFGUnlX4K4uhmTKDVegOJnYeEpBMd9zggxXVqHOQI9x0iytXYEVGUpwBYnLdp WvqSvyfJCV2+kzAcNyIE71xK/XKanYzoB84oHID5Zo1lig/PdHwAdiblWbjJC4i9xtUF kj5U7d3RQV9Mgzlp5JTiTufHdkQzT7ROC8WWE= 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=nZmw5ywIbzOc8VruWmb764fG6flSNtrbuGspqfBaQaI=; b=fpmbxmxeUOQCG3SftZKidqpz6kP9ZFjKXblc4KGyVBY9/TDYaLYuQi926zhOqDNAKE LcBMO7hqNLOKxVJVtQpVDViscyrEhaoXI7KWDUkM7tAOygNKbu8RJySsRguuROp/uZCA x76FLeFHlZF92k9o9LO/fFNnXbgxvzxywBm2m3Q7lx/E7lvYaA6y5Ajg+Zhi3zsgpkrs 8ZWfjRCm43I+eEuWyHfr8LFO8sNN8nRLNGQ5DWFitA1ylvcc2fPE0wCnF7YTdJq8d0cr ghytB7qMvvbIOd84wdBTmSaWnh+cwC+3jttn+G/Fez+Gr/YAohSZdhx7HPeGonXtP8sr FNJg== X-Gm-Message-State: APjAAAXnGkmpKG5KFj4j2gMMA2hCppeq6QSFNRC43TO2HZ6dPz01P8b7 nO7gqVr7K9T/dDil+eBGA7TKbwluJbAWJAGdpWn8lBnoGf72s8ZdGifeNChbVm4XsGaahdlYSVw qaCUiWM6xg33zbB4k4s5aGV9hT5s27lO2tM+Zzvm35RL5xUb/l1E8fnWDpbba8ClxYac6wnCBiB rJAYr5ye8smxQZ2UXNgzPd X-Google-Smtp-Source: APXvYqytm4zJRS8ozDb80kYX4g+H2LIkyy07tFQfnHI4aY/BELiVrlDN/uJj/afYlDHpAPFqY4/6fQ== X-Received: by 2002:a17:902:a988:: with SMTP id bh8mr25932761plb.243.1556271504357; Fri, 26 Apr 2019 02:38:24 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:23 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 04/21] megaraid_sas: rework code around controller reset Date: Fri, 26 Apr 2019 02:36:58 -0700 Message-Id: <1556271435-27252-5-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 No functional change. This patch reworks code around controller reset path which gets rid of a couple of goto labels. This is in preparation for the next patch which adds PCI config space access locking while controller reset is in progress. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 6fd57f7f0b1e..902b11b97999 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1571,6 +1571,7 @@ enum FW_BOOT_CONTEXT { #define MFI_IO_TIMEOUT_SECS 180 #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) +#define MEGASAS_SRIOV_MAX_RESET_TRIES_VF 1 #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index bf1fa963af0b..76bd29c92752 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -4568,6 +4568,8 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) struct scsi_device *sdev; int ret_target_prop = DCMD_FAILED; bool is_target_prop = false; + bool do_adp_reset = true; + int max_reset_tries = MEGASAS_FUSION_MAX_RESET_TRIES; instance = (struct megasas_instance *)shost->hostdata; fusion = instance->ctrl_context; @@ -4686,34 +4688,30 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Let SR-IOV VF & PF sync up if there was a HB failure */ if (instance->requestorId && !reason) { msleep(MEGASAS_OCR_SETTLE_TIME_VF); - goto transition_to_ready; + do_adp_reset = false; + max_reset_tries = MEGASAS_SRIOV_MAX_RESET_TRIES_VF; } /* Now try to reset the chip */ - for (i = 0; i < MEGASAS_FUSION_MAX_RESET_TRIES; i++) { + for (i = 0; i < max_reset_tries; i++) { - if (instance->instancet->adp_reset + if (do_adp_reset && + instance->instancet->adp_reset (instance, instance->reg_set)) continue; -transition_to_ready: + /* Wait for FW to become ready */ if (megasas_transition_to_ready(instance, 1)) { dev_warn(&instance->pdev->dev, "Failed to transition controller to ready for " "scsi%d.\n", instance->host->host_no); - if (instance->requestorId && !reason) - goto fail_kill_adapter; - else - continue; + continue; } megasas_reset_reply_desc(instance); megasas_fusion_update_can_queue(instance, OCR_CONTEXT); if (megasas_ioc_init_fusion(instance)) { - if (instance->requestorId && !reason) - goto fail_kill_adapter; - else - continue; + continue; } if (megasas_get_ctrl_info(instance)) { @@ -4799,7 +4797,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) goto out; } -fail_kill_adapter: /* Reset failed, kill the adapter */ dev_warn(&instance->pdev->dev, "Reset failed, killing " "adapter scsi%d.\n", instance->host->host_no); From patchwork Fri Apr 26 09:36:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918935 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 C09681575 for ; Fri, 26 Apr 2019 09:38:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE1D628D55 for ; Fri, 26 Apr 2019 09:38:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1D8E28D69; Fri, 26 Apr 2019 09:38: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 2411D28D55 for ; Fri, 26 Apr 2019 09:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726229AbfDZJi3 (ORCPT ); Fri, 26 Apr 2019 05:38:29 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35185 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZJi3 (ORCPT ); Fri, 26 Apr 2019 05:38:29 -0400 Received: by mail-pl1-f196.google.com with SMTP id w24so1303243plp.2 for ; Fri, 26 Apr 2019 02:38:29 -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=xidrd8LC2JRaLE5PKfyFNBrAHwqEptbcNXmQylZbJnY=; b=VWNlkgOuWD3EEpUgGLJV/SK5lqaWVmjHo8f47sXses+DB2cyYqnb4sppbvy5g1479x fMc38LAPI+JtxtOfRyIQLgcELUS5Rv2GzOEhMKbZabl5rXozIg9799ZE5WsN9hBwc5RB plGLj8RaB+B3jjrqPT7B6YdqaXDTggDZRCRxs= 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=xidrd8LC2JRaLE5PKfyFNBrAHwqEptbcNXmQylZbJnY=; b=RoO/nkCrK7pj/FnIVyapnoZ7SF6ICWZk2v0Pwkm0vl/FSjqbaYqPYmoeZJvL6JsYb8 vOHjI2YKPeMqZS0ZNvwgZywOwVIbTygrF2ibJir5aTq3a9FZWOX3EFiKKrMDC45AdoBU H8zjuLGdS89714yF8O+HWBTseeK2xWtq4+QOLmug1DDSYHobgCq2sxf7bAUtGSDEr6iN bPRTdoqThMayecZYnG9WRqO2nDUlFPnsAyTSbGBXz32l1TYjnPc80iy+7N0UPumvt7cG iRqGbgCm5qqRj5w5LIHA8gYcQ4PnOqH4D7auL4yErdCcrPpJ56SzOBGSbao/C3FTxeYF bVcQ== X-Gm-Message-State: APjAAAVyLPjuZHkEmi8N2l8LWvLpySuDbwYuCcCOqO8w/LVJfbDror+F 1igOvPQtwpJ9SYlu/N0TMvB7ZhsG8cCeAuD/RL87+ZZRcem/zVhT3xVJlnSeVp+9ghwM7SjI8rK EyZxxxFg4Ufb9P36NnoHffdWDGXC2m2/ShcBKkyatoloDmKdHXGqeBV/o4HFrYBUZRyHqTPCppo 8NV58FXRHVLrdhGLMofPYc X-Google-Smtp-Source: APXvYqwEi9qW5OJCvzVqI7TH8ac3gPlIm73Tplmime9yfFMok5y3PpiMhsiH45mCeOgaUwKTskUguQ== X-Received: by 2002:a17:902:a7:: with SMTP id a36mr44708044pla.111.1556271508369; Fri, 26 Apr 2019 02:38:28 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:27 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 05/21] megaraid_sas: Block PCI config space access from userspace during OCR Date: Fri, 26 Apr 2019 02:36:59 -0700 Message-Id: <1556271435-27252-6-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 While an online controller reset(OCR) is in progress, there is short duration where all access to controller's PCI config space from the host needs to be blocked. This is due to a hardware limitation of MegaRAID controllers. With this patch, driver will block all access to controller's config space from userland applications by calling pci_cfg_access_lock() while OCR is in progress and unlocking after controller comes back to ready state. Added helper function which locks the config space before initiating OCR and wait for controller to become READY. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 3 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 15 ++++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 66 +++++++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 902b11b97999..990ee23d7bc2 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2636,4 +2636,7 @@ void megasas_fusion_stop_watchdog(struct megasas_instance *instance); void megasas_set_dma_settings(struct megasas_instance *instance, struct megasas_dcmd_frame *dcmd, dma_addr_t dma_addr, u32 dma_len); +int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, + bool do_adp_reset, + int ocr_context); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 77db6e773a01..5e5170b40f6f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5535,13 +5535,15 @@ static int megasas_init_fw(struct megasas_instance *instance) } if (megasas_transition_to_ready(instance, 0)) { + dev_info(&instance->pdev->dev, + "Failed to transition controller to ready from %s!\n", + __func__); if (instance->adapter_type != MFI_SERIES) { status_reg = instance->instancet->read_fw_status_reg( instance); if (status_reg & MFI_RESET_ADAPTER) { - instance->instancet->adp_reset - (instance, instance->reg_set); - if (megasas_transition_to_ready(instance, 0)) + if (megasas_adp_reset_wait_for_ready + (instance, true, 0) == FAILED) goto fail_ready_state; } else { goto fail_ready_state; @@ -5551,9 +5553,6 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->instancet->adp_reset (instance, instance->reg_set); atomic_set(&instance->fw_reset_no_pci_access, 0); - dev_info(&instance->pdev->dev, - "FW restarted successfully from %s!\n", - __func__); /*waiting for about 30 second before retry*/ ssleep(30); @@ -5561,6 +5560,10 @@ static int megasas_init_fw(struct megasas_instance *instance) if (megasas_transition_to_ready(instance, 0)) goto fail_ready_state; } + + dev_info(&instance->pdev->dev, + "FW restarted successfully from %s!\n", + __func__); } megasas_init_ctrl_params(instance); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 76bd29c92752..59bab98274f6 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -98,6 +98,62 @@ static void megasas_fusion_crash_dump(struct megasas_instance *instance); extern u32 megasas_readl(struct megasas_instance *instance, const volatile void __iomem *addr); +/** + * megasas_adp_reset_wait_for_ready - initiate chip reset and wait for + * controller to come to ready state + * @instance - adapter's soft state + * @do_adp_reset - If true, do a chip reset + * @ocr_context - If called from OCR context this will + * be set to 1, else 0 + * + * This functon initates a chip reset followed by a wait for controller to + * transition to ready state. + * During this, driver will block all access to PCI config space from userspace + */ +int +megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, + bool do_adp_reset, + int ocr_context) +{ + int ret = FAILED; + + /* + * Block access to PCI config space from userspace + * when diag reset is initiated from driver + */ + if (megasas_dbg_lvl & OCR_LOGS) + dev_info(&instance->pdev->dev, + "Block access to PCI config space %s %d\n", + __func__, __LINE__); + + pci_cfg_access_lock(instance->pdev); + + if (do_adp_reset) { + if (instance->instancet->adp_reset + (instance, instance->reg_set)) + goto out; + } + + /* Wait for FW to become ready */ + if (megasas_transition_to_ready(instance, ocr_context)) { + dev_warn(&instance->pdev->dev, + "Failed to transition controller to ready for scsi%d.\n", + instance->host->host_no); + goto out; + } + + ret = SUCCESS; +out: + if (megasas_dbg_lvl & OCR_LOGS) + dev_info(&instance->pdev->dev, + "Unlock access to PCI config space %s %d\n", + __func__, __LINE__); + + pci_cfg_access_unlock(instance->pdev); + + return ret; +} + /** * megasas_check_same_4gb_region - check if allocation * crosses same 4GB boundary or not @@ -4694,10 +4750,12 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Now try to reset the chip */ for (i = 0; i < max_reset_tries; i++) { - - if (do_adp_reset && - instance->instancet->adp_reset - (instance, instance->reg_set)) + /* + * Do adp reset and wait for + * controller to transition to ready + */ + if (megasas_adp_reset_wait_for_ready(instance, + do_adp_reset, 1) == FAILED) continue; /* Wait for FW to become ready */ From patchwork Fri Apr 26 09:37:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918937 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 DE1891575 for ; Fri, 26 Apr 2019 09:38:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAA0728D55 for ; Fri, 26 Apr 2019 09:38:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF08828D6E; Fri, 26 Apr 2019 09:38: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 7871C28D55 for ; Fri, 26 Apr 2019 09:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726243AbfDZJie (ORCPT ); Fri, 26 Apr 2019 05:38:34 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35503 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZJie (ORCPT ); Fri, 26 Apr 2019 05:38:34 -0400 Received: by mail-pf1-f196.google.com with SMTP id t21so1445895pfh.2 for ; Fri, 26 Apr 2019 02:38: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=di6sryvd77R3++aQozSGfn7YwNEZhTIS5wNll07PYWw=; b=bb4agmLtS2ehMhr8gXdX4gsDky1s3jaTXVi2VT4aZfjckVBPFSxOpqvE3Bpz8VWiDb C+tVxiGBLMaZ0Koc/vH7pn3qC9FIwzdojynXpiCqRMliHdnXekFqDB4vv6XRRL80b5TG KnyrHWJn2GJYIt6f2fkh0BCzEt5nfEHM7hLDg= 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=di6sryvd77R3++aQozSGfn7YwNEZhTIS5wNll07PYWw=; b=Xn04jLrAI3FiGTgagYWNog1RP85ps3VhQvUSnOdzUSRybbbQxCfUSMv6jJ2givXPNx 96lbsfT46nXThtK2UoFWBBGl/qTAKuCM+1SX9vdLZTKioHJq2T2jEJi0N7UPcyXl5BOt RdUqBqRmx2oIkeiMKNxbqqin/jQlM/qo2tpDS70FiHcwv+Uamybkw1VJVgbFBagEkuiO ZwmZ4I8gburc5eC8Rm7Lk09uABpLggXKPUX3j830jGrRWWV3ebYgdEjwiAu6R6GKBbNO 3eg+lZ/vA/wMmOf+SmVpoV6E5I1XhNvIv0YoZYH6xTNqbb6GIdmLstZ1c9l88elVEMda b2gA== X-Gm-Message-State: APjAAAVSDlfuVvHm7Ws3fW9eBTCMMBOnMYeSUXc/e3tc2sVu/9Yj10i0 /WEzx4vm9QdhhqoOGg6rQKt6Z6/3vJnI9QIoIPV94Gu1dgDB0VOXLw8sIBl33A/7rBsqQukYLPH R/ci2roci4dciEAHwBzfJB2yQHw/ZJnkKAElLdvaGtZuKGpSlTKJeI7WPohjtncWwSbAjF5Hbbb pvTh2Ijx0cTt9o1s3dO9yY X-Google-Smtp-Source: APXvYqwMIL9xqj1cOcyfRBseTIQWBr+oQSK7UqxYkW4nr1m4e8FnYqcTTYtmODK4PVw0V8NxEvxtfw== X-Received: by 2002:a62:e50a:: with SMTP id n10mr46502110pff.55.1556271512322; Fri, 26 Apr 2019 02:38:32 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:31 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 06/21] megaraid_sas: IRQ poll to avoid CPU hard lockups Date: Fri, 26 Apr 2019 02:37:00 -0700 Message-Id: <1556271435-27252-7-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Description: We have seen cpu lock up issues from field if system has greater (more than 96) logical cpu count. SAS3.0 controller (Invader series) supports at max 96 msix vector and SAS3.5 product (Ventura) supports at max 128 msix vectors. This may be a generic issue (if PCI device support completion on multiple reply queues). Let me explain it w.r.t megaraid_sas supported h/w just to simplify the problem and possible changes to handle such issues. MegaRAID controller supports multiple reply queues in completion path. Driver creates MSI-x vectors for controller as "minimum of (FW supported Reply queues, Logical CPUs)". If submitter is not interrupted via completion on same CPU, there is a loop in the IO path. This behavior can cause hard/soft CPU lockups, IO timeout, system sluggish etc. Example - one CPU (e.g. CPU A) is busy submitting the IOs and another CPU (e.g. CPU B) is busy with processing the corresponding IO's reply descriptors from reply descriptor queue upon receiving the interrupts from HBA. If CPU A is continuously pumping the IOs then always CPU B (which is executing the ISR) will see the valid reply descriptors in the reply descriptor queue and it will be continuously processing those reply descriptor in a loop without quitting the ISR handler. megaraid_sas driver will exit ISR handler if it finds unused reply descriptor in the reply descriptor queue. Since CPU A will be continuously sending the IOs, CPU B may always see a valid reply descriptor (posted by HBA Firmware after processing the IO) in the reply descriptor queue. In worst case, driver will not quit from this loop in the ISR handler. Eventually, CPU lockup will be detected by watchdog. Above mentioned behavior is not common if "rq_affinity" set to 2 or affinity_hint is honored by irqbalancer as "exact". If rq_affinity is set to 2, submitter will be always interrupted via completion on same CPU. If irqbalancer is using "exact" policy, interrupt will be delivered to submitter CPU. Problem statement - If CPU count to MSI-X vectors (reply descriptor Queues) count ratio is not 1:1, we still have exposure of issue explained above and for that we don't have any solution. Exposure of soft/hard lockup is seen if CPU count is more than MSI-x supported by device. If CPUs count to MSI-x vectors count ratio is not 1:1, (Other way, if CPU counts to MSI-x vector count ratio is something like X:1, where X > 1) then 'exact' irqbalance policy OR rq_affinity = 2 won't help to avoid CPU hard/soft lockups. There won't be any one to one mapping between CPU to MSI-x vector instead one MSI-x interrupt (or reply descriptor queue) is shared with group/set of CPUs and there is a possibility of having a loop in the IO path within that CPU group and may observe lockups. For example: Consider a system having two NUMA nodes and each node having four logical CPUs and also consider that number of MSI-x vectors enabled on the HBA is two, then CPUs count to MSI-x vector count ratio as 4:1. e.g. MSIx vector 0 is affinity to CPU 0, CPU 1, CPU 2 & CPU 3 of NUMA node 0 and MSIx vector 1 is affinity to CPU 4, CPU 5, CPU 6 & CPU 7 of NUMA node 1. numactl --hardware available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 --> MSI-x 0 node 0 size: 65536 MB node 0 free: 63176 MB node 1 cpus: 4 5 6 7 --> MSI-x 1 node 1 size: 65536 MB node 1 free: 63176 MB Assume that user started an application which uses all the CPUs of NUMA node 0 for issuing the IOs. Only one CPU from affinity list (it can be any cpu since this behavior depends upon irqbalance) CPU0 will receive the interrupts from MSIx 0 for all the IOs. Eventually, CPU 0 IO submission percentage will be decreasing and ISR processing percentage will be increasing as it is more busy with processing the interrupts. Gradually IO submission percentage on CPU 0 will be zero and it's ISR processing percentage will be 100 percentage as IO loop has already formed within the NUMA node 0, i.e. CPU 1, CPU 2 & CPU 3 will be continuously busy with submitting the heavy IOs and only CPU 0 is busy in the ISR path as it always find the valid reply descriptor in the reply descriptor queue. Eventually, we will observe the hard lockup here. Chances of occurring of hard/soft lockups are directly proportional to value of X. If value of X is high, then chances of observing CPU lockups is high. Solution - Fix - Use IRQ poll interface defined in "irq_poll.c". megaraid_sas driver will execute ISR routine in Softirq context and it will always quit the loop based on budget provided in IRQ poll interface. Driver will switch to IRQ poll only when more than a threshold number of reply descriptors are handled in one ISR. Currently threshold is set as 1/4th of HBA queue depth. In these scenarios (i.e. where CPUs count to MSI-X vectors count ratio is X:1 (where X > 1)), IRQ poll interface will avoid CPU hard lockups due to voluntary exit from the reply queue processing based on budget. Note - Only one MSI-x vector is busy doing processing. Select CONFIG_IRQ_POLL from driver Kconfig for driver compilation. Signed-off-by: Kashyap Desai Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/Kconfig.megaraid | 1 + drivers/scsi/megaraid/megaraid_sas.h | 5 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 36 ++++++++ drivers/scsi/megaraid/megaraid_sas_fp.c | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 122 +++++++++++++++++++++------- drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 - 6 files changed, 136 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/megaraid/Kconfig.megaraid b/drivers/scsi/megaraid/Kconfig.megaraid index 17419e30ffc8..1fa9d095ae36 100644 --- a/drivers/scsi/megaraid/Kconfig.megaraid +++ b/drivers/scsi/megaraid/Kconfig.megaraid @@ -78,6 +78,7 @@ config MEGARAID_LEGACY config MEGARAID_SAS tristate "LSI Logic MegaRAID SAS RAID Module" depends on PCI && SCSI + select IRQ_POLL help Module for LSI Logic's SAS based RAID controllers. To compile this driver as a module, choose 'm' here. diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 990ee23d7bc2..8d6a9c511455 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2173,6 +2173,9 @@ struct megasas_aen_event { struct megasas_irq_context { struct megasas_instance *instance; u32 MSIxIndex; + u32 os_irq; + struct irq_poll irqpoll; + bool irq_poll_scheduled; }; struct MR_DRV_SYSTEM_INFO { @@ -2303,6 +2306,7 @@ struct megasas_instance { struct pci_dev *pdev; u32 unique_id; u32 fw_support_ieee; + u32 threshold_reply_count; atomic_t fw_outstanding; atomic_t ldio_outstanding; @@ -2639,4 +2643,5 @@ void megasas_set_dma_settings(struct megasas_instance *instance, int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, bool do_adp_reset, int ocr_context); +int megasas_irqpoll(struct irq_poll *irqpoll, int budget); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5e5170b40f6f..f7ffa72e9572 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -5272,6 +5273,25 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) return 1; } +static +void megasas_setup_irq_poll(struct megasas_instance *instance) +{ + struct megasas_irq_context *irq_ctx; + u32 count, i; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; + + /* Initialize IRQ poll */ + for (i = 0; i < count; i++) { + irq_ctx = &instance->irq_context[i]; + irq_ctx->os_irq = pci_irq_vector(instance->pdev, i); + irq_ctx->irq_poll_scheduled = false; + irq_poll_init(&irq_ctx->irqpoll, + instance->threshold_reply_count, + megasas_irqpoll); + } +} + /* * megasas_setup_irqs_ioapic - register legacy interrupts. * @instance: Adapter soft state @@ -5350,6 +5370,16 @@ static void megasas_destroy_irqs(struct megasas_instance *instance) { int i; + int count; + struct megasas_irq_context *irq_ctx; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; + if (instance->adapter_type != MFI_SERIES) { + for (i = 0; i < count; i++) { + irq_ctx = &instance->irq_context[i]; + irq_poll_disable(&irq_ctx->irqpoll); + } + } if (instance->msix_vectors) for (i = 0; i < instance->msix_vectors; i++) { @@ -5722,6 +5752,9 @@ static int megasas_init_fw(struct megasas_instance *instance) megasas_setup_irqs_ioapic(instance)) goto fail_init_adapter; + if (instance->adapter_type != MFI_SERIES) + megasas_setup_irq_poll(instance); + instance->instancet->enable_intr(instance); dev_info(&instance->pdev->dev, "INIT adapter done\n"); @@ -7187,6 +7220,9 @@ megasas_resume(struct pci_dev *pdev) megasas_setup_irqs_ioapic(instance)) goto fail_init_mfi; + if (instance->adapter_type != MFI_SERIES) + megasas_setup_irq_poll(instance); + /* Re-launch SR-IOV heartbeat timer */ if (instance->requestorId) { if (!megasas_sriov_start_heartbeat(instance, 0)) diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index 87c2c0472c8f..9ac357619b28 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 59bab98274f6..4d90c7aecee3 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -1789,6 +1790,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) instance->flag_ieee = 1; instance->r1_ldio_hint_default = MR_R1_LDIO_PIGGYBACK_DEFAULT; + instance->threshold_reply_count = instance->max_fw_cmds / 4; fusion->fast_path_io = 0; if (megasas_allocate_raid_maps(instance)) @@ -3422,7 +3424,8 @@ megasas_complete_r1_command(struct megasas_instance *instance, * Completes all commands that is in reply descriptor queue */ int -complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) +complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex, + struct megasas_irq_context *irq_context) { union MPI2_REPLY_DESCRIPTORS_UNION *desc; struct MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *reply_desc; @@ -3555,7 +3558,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) * number of reply counts and still there are more replies in reply queue * pending to be completed */ - if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { + if (threshold_reply_count >= instance->threshold_reply_count) { if (instance->msix_combined) writel(((MSIxIndex & 0x7) << 24) | fusion->last_reply_idx[MSIxIndex], @@ -3565,23 +3568,46 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) fusion->last_reply_idx[MSIxIndex], instance->reply_post_host_index_addr[0]); threshold_reply_count = 0; + if (irq_context) { + if (!irq_context->irq_poll_scheduled) { + irq_context->irq_poll_scheduled = true; + disable_irq_nosync(irq_context->os_irq); + irq_poll_sched(&irq_context->irqpoll); + } + return num_completed; + } } } - if (!num_completed) - return IRQ_NONE; + if (num_completed) { + wmb(); + if (instance->msix_combined) + writel(((MSIxIndex & 0x7) << 24) | + fusion->last_reply_idx[MSIxIndex], + instance->reply_post_host_index_addr[MSIxIndex/8]); + else + writel((MSIxIndex << 24) | + fusion->last_reply_idx[MSIxIndex], + instance->reply_post_host_index_addr[0]); + megasas_check_and_restore_queue_depth(instance); + } + return num_completed; +} - wmb(); - if (instance->msix_combined) - writel(((MSIxIndex & 0x7) << 24) | - fusion->last_reply_idx[MSIxIndex], - instance->reply_post_host_index_addr[MSIxIndex/8]); - else - writel((MSIxIndex << 24) | - fusion->last_reply_idx[MSIxIndex], - instance->reply_post_host_index_addr[0]); - megasas_check_and_restore_queue_depth(instance); - return IRQ_HANDLED; +/** + * megasas_enable_irq_poll() - enable irqpoll + */ +void megasas_enable_irq_poll(struct megasas_instance *instance) +{ + u32 count, i; + struct megasas_irq_context *irq_ctx; + + count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; + + for (i = 0; i < count; i++) { + irq_ctx = &instance->irq_context[i]; + irq_poll_enable(&irq_ctx->irqpoll); + } } /** @@ -3593,11 +3619,46 @@ void megasas_sync_irqs(unsigned long instance_addr) u32 count, i; struct megasas_instance *instance = (struct megasas_instance *)instance_addr; + struct megasas_irq_context *irq_ctx; count = instance->msix_vectors > 0 ? instance->msix_vectors : 1; - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) { synchronize_irq(pci_irq_vector(instance->pdev, i)); + irq_ctx = &instance->irq_context[i]; + irq_poll_disable(&irq_ctx->irqpoll); + if (irq_ctx->irq_poll_scheduled) { + irq_ctx->irq_poll_scheduled = false; + enable_irq(irq_ctx->os_irq); + } + } +} + +/** + * megasas_irqpoll() - process a queue for completed reply descriptors + * @irqpoll: IRQ poll structure associated with queue to poll. + * @budget: Threshold of reply descriptors to process per poll. + * + * Return: The number of entries processed. + */ + +int megasas_irqpoll(struct irq_poll *irqpoll, int budget) +{ + struct megasas_irq_context *irq_ctx; + struct megasas_instance *instance; + int num_entries; + + irq_ctx = container_of(irqpoll, struct megasas_irq_context, irqpoll); + instance = irq_ctx->instance; + + num_entries = complete_cmd_fusion(instance, irq_ctx->MSIxIndex, irq_ctx); + if (num_entries < budget) { + irq_poll_complete(irqpoll); + irq_ctx->irq_poll_scheduled = false; + enable_irq(irq_ctx->os_irq); + } + + return num_entries; } /** @@ -3620,7 +3681,7 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr) return; for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) - complete_cmd_fusion(instance, MSIxIndex); + complete_cmd_fusion(instance, MSIxIndex, NULL); } /** @@ -3647,7 +3708,8 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp) return IRQ_HANDLED; } - return complete_cmd_fusion(instance, irq_context->MSIxIndex); + return complete_cmd_fusion(instance, irq_context->MSIxIndex, irq_context) + ? IRQ_HANDLED : IRQ_NONE; } /** @@ -4334,6 +4396,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle, instance->instancet->disable_intr(instance); megasas_sync_irqs((unsigned long)instance); instance->instancet->enable_intr(instance); + megasas_enable_irq_poll(instance); if (scsi_lookup->scmd == NULL) break; } @@ -4347,6 +4410,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle, megasas_sync_irqs((unsigned long)instance); rc = megasas_track_scsiio(instance, id, channel); instance->instancet->enable_intr(instance); + megasas_enable_irq_poll(instance); break; case MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET: @@ -4735,10 +4799,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) dev_warn(&instance->pdev->dev, "Reset not supported" ", killing adapter scsi%d.\n", instance->host->host_no); - megaraid_sas_kill_hba(instance); - instance->skip_heartbeat_timer_del = 1; - retval = FAILED; - goto out; + goto kill_hba; } /* Let SR-IOV VF & PF sync up if there was a HB failure */ @@ -4776,9 +4837,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) dev_info(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__); - megaraid_sas_kill_hba(instance); - retval = FAILED; - goto out; + goto kill_hba; } megasas_refire_mgmt_cmd(instance); @@ -4807,7 +4866,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); instance->instancet->enable_intr(instance); - + megasas_enable_irq_poll(instance); shost_for_each_device(sdev, shost) { if ((instance->tgt_prop) && (instance->nvme_page_size)) @@ -4858,9 +4917,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Reset failed, kill the adapter */ dev_warn(&instance->pdev->dev, "Reset failed, killing " "adapter scsi%d.\n", instance->host->host_no); - megaraid_sas_kill_hba(instance); - instance->skip_heartbeat_timer_del = 1; - retval = FAILED; + goto kill_hba; } else { /* For VF: Restart HB timer if we didn't OCR */ if (instance->requestorId) { @@ -4868,8 +4925,15 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) } clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); instance->instancet->enable_intr(instance); + megasas_enable_irq_poll(instance); atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); + goto out; } +kill_hba: + megaraid_sas_kill_hba(instance); + megasas_enable_irq_poll(instance); + instance->skip_heartbeat_timer_del = 1; + retval = FAILED; out: clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); mutex_unlock(&instance->reset_mutex); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 1481bf029490..160ac16941fe 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -100,7 +100,6 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { #define MEGASAS_FP_CMD_LEN 16 #define MEGASAS_FUSION_IN_RESET 0 -#define THRESHOLD_REPLY_COUNT 50 #define RAID_1_PEER_CMDS 2 #define JBOD_MAPS_COUNT 2 #define MEGASAS_REDUCE_QD_COUNT 64 From patchwork Fri Apr 26 09:37:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918939 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 57D251390 for ; Fri, 26 Apr 2019 09:38:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 470B028D55 for ; Fri, 26 Apr 2019 09:38:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B18F28D6A; Fri, 26 Apr 2019 09:38:39 +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 1D8D828D55 for ; Fri, 26 Apr 2019 09:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbfDZJih (ORCPT ); Fri, 26 Apr 2019 05:38:37 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37564 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZJih (ORCPT ); Fri, 26 Apr 2019 05:38:37 -0400 Received: by mail-pl1-f193.google.com with SMTP id z8so1300360pln.4 for ; Fri, 26 Apr 2019 02:38:37 -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=ITxpB765SgS9TW5lsN2Ul07gMIAhNHPyrySesZoXl00=; b=HbxRoS/K1WW6WM40vbvc1IOqj0JvIFDJx0GcJ/q/D7wEg/Hr9u0livjz2ieeNV9PFG Sbea1gw2pCcaE8ezqEbUsMQY9vakxPO+qeaR87/MvPXCH20ezn8obhEcut866kc3jL1n 6ThUSvkzQbh7Gki+APRuaLyWYvOjv0xj2wJeA= 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=ITxpB765SgS9TW5lsN2Ul07gMIAhNHPyrySesZoXl00=; b=gA3XnfkIHNecZCo5QxB46tD8TpVcV2wyt6AEexq+fmZ+6OlOlyymtazNvTWzoIrP4c YVAS3Xih0pLpbScojp9pKWbiHn422kXS5Jo+Mjr06pQbvq+uth2q9026SlD66qhE1Iwm VgXsj3mQwxcNPX49C7FG2BWjhJnfeTdygx3KCdxYT4H8f/+UdV1N2ZIC8Zs6XymAyT5K PJC4ccRs7+ToW3m2zSeCyckgiLl70jkXx5ms+pWprw0RR5aUzaB/yqsOwpaWJx2VxGmN TXoAk4b+SITWQmBu6NuOL9DCscMLL0oFlzpNJxS1V+p7/0920/NsS8BY1XwD4Ty4lm9S 1R2w== X-Gm-Message-State: APjAAAUUf3Rdinz1+qf4KvVjZofqV6FAVe2TZmhtUhlubloRP1uqrsqN UmwTULd2K7aEfjIfFtYZb6xbzTnWmTFH0K+LQl6zd5FyLe5opTYkFX1PfhpxVO101AjXfRYKr9G eFjtIoLFsBSIdxzwbkLfDQKR2U4iv96pRdWzRqrMzaeY0xHBSltjpa4F51qDSFN1WbARDOzNh2d wZ5HgRvTa7hsbtb3ajG5nR X-Google-Smtp-Source: APXvYqx7vhz23iWOOyZ026gr4wE6w9OHj+ChRhQObkOcx9hXNxskMes3isjyCEkoqOuiSD1IvC0yeQ== X-Received: by 2002:a17:902:a5cb:: with SMTP id t11mr15640104plq.268.1556271516385; Fri, 26 Apr 2019 02:38:36 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:35 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 07/21] megaraid_sas: Load balance completions across all MSIx Date: Fri, 26 Apr 2019 02:37:01 -0700 Message-Id: <1556271435-27252-8-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 will use "reply descriptor post queues" in round robin fashion when the combined MSI-x mode is not enabled. With this IO completions are distributed and loadbalanced across all the available reply descriptor post queues equally. This is enabled only if combined MSI-x mode is not enabled in firmware. This improves performance and also fixes soft lockups. When load balancing is enabled, IRQ affinity from driver needs to be disabled. Signed-off-by: Kashyap Desai Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 3 +++ drivers/scsi/megaraid/megaraid_sas_base.c | 22 ++++++++++++++++++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 18 ++++++++++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 8d6a9c511455..6be748f302cf 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2262,6 +2262,7 @@ struct megasas_instance { u32 secure_jbod_support; u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */ bool use_seqnum_jbod_fp; /* Added for PD sequence */ + bool smp_affinity_enable; spinlock_t crashdump_lock; struct megasas_register_set __iomem *reg_set; @@ -2279,6 +2280,7 @@ struct megasas_instance { u16 ldio_threshold; u16 cur_can_queue; u32 max_sectors_per_req; + bool msix_load_balance; struct megasas_aen_event *ev; struct megasas_cmd **cmd_list; @@ -2316,6 +2318,7 @@ struct megasas_instance { 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; struct tasklet_struct isr_tasklet; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f7ffa72e9572..102a7e40996e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5350,6 +5350,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) &instance->irq_context[j]); /* Retry irq register for IO_APIC*/ instance->msix_vectors = 0; + instance->msix_load_balance = false; if (is_probe) { pci_free_irq_vectors(instance->pdev); return megasas_setup_irqs_ioapic(instance); @@ -5358,6 +5359,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) } } } + return 0; } @@ -5661,6 +5663,12 @@ static int megasas_init_fw(struct megasas_instance *instance) if (rdpq_enable) instance->is_rdpq = (scratch_pad_1 & MR_RDPQ_MODE_OFFSET) ? 1 : 0; + + if (!instance->msix_combined) { + instance->msix_load_balance = true; + instance->smp_affinity_enable = false; + } + fw_msix_count = instance->msix_vectors; /* Save 1-15 reply post index address to local memory * Index 0 is already saved from reg offset @@ -5679,17 +5687,20 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->msix_vectors); } 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 (smp_affinity_enable) + 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) + if (i > 0) { instance->msix_vectors = i; - else + } else { instance->msix_vectors = 0; + instance->msix_load_balance = false; + } } /* * MSI-X host index 0 is common for all adapter. @@ -6797,6 +6808,7 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) INIT_LIST_HEAD(&instance->internal_reset_pending_q); atomic_set(&instance->fw_outstanding, 0); + atomic64_set(&instance->total_io_count, 0); init_waitqueue_head(&instance->int_cmd_wait_q); init_waitqueue_head(&instance->abort_cmd_wait_q); @@ -6819,6 +6831,8 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) instance->last_time = 0; instance->disableOnlineCtrlReset = 1; instance->UnevenSpanSupport = 0; + instance->smp_affinity_enable = smp_affinity_enable ? true : false; + instance->msix_load_balance = false; if (instance->adapter_type != MFI_SERIES) INIT_WORK(&instance->work_init, megasas_fusion_ocr_wq); @@ -7182,7 +7196,7 @@ megasas_resume(struct pci_dev *pdev) /* Now re-enable MSI-X */ if (instance->msix_vectors) { irq_flags = PCI_IRQ_MSIX; - if (smp_affinity_enable) + if (instance->smp_affinity_enable) irq_flags |= PCI_IRQ_AFFINITY; } rval = pci_alloc_irq_vectors(instance->pdev, 1, diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 4d90c7aecee3..1f30a11944c3 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2769,8 +2769,13 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, fp_possible = (io_info.fpOkForIo > 0) ? true : false; } - cmd->request_desc->SCSIIO.MSIxIndex = - instance->reply_map[raw_smp_processor_id()]; + if (instance->msix_load_balance) + cmd->request_desc->SCSIIO.MSIxIndex = + (mega_mod64(atomic64_add_return(1, &instance->total_io_count), + instance->msix_vectors)); + else + cmd->request_desc->SCSIIO.MSIxIndex = + instance->reply_map[raw_smp_processor_id()]; if (instance->adapter_type >= VENTURA_SERIES) { /* FP for Optimal raid level 1. @@ -3083,8 +3088,13 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; - cmd->request_desc->SCSIIO.MSIxIndex = - instance->reply_map[raw_smp_processor_id()]; + if (instance->msix_load_balance) + cmd->request_desc->SCSIIO.MSIxIndex = + (mega_mod64(atomic64_add_return(1, &instance->total_io_count), + instance->msix_vectors)); + else + cmd->request_desc->SCSIIO.MSIxIndex = + instance->reply_map[raw_smp_processor_id()]; if (!fp_possible) { /* system pd firmware path */ From patchwork Fri Apr 26 09:37:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918941 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 2C4621575 for ; Fri, 26 Apr 2019 09:38:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A5FC28D55 for ; Fri, 26 Apr 2019 09:38:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EC9028D6E; Fri, 26 Apr 2019 09:38:44 +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 F332928D69 for ; Fri, 26 Apr 2019 09:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726263AbfDZJim (ORCPT ); Fri, 26 Apr 2019 05:38:42 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34877 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZJim (ORCPT ); Fri, 26 Apr 2019 05:38:42 -0400 Received: by mail-pg1-f193.google.com with SMTP id h1so1367744pgs.2 for ; Fri, 26 Apr 2019 02:38:41 -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=oB9RPp6WnwsjYS5CXqwxL1EjJg0DXpAe6+bh2YmNZmE=; b=NprB6cOKAFMgMAsIxp2/UOwy09jHVxK3Cggnn5yHtrLgBVWPdde8HRMKnjeWcW5r2p HJHf5sizMIxfli+TV+F/oWFKnlfBsMxnKajt1B5D7DfN8I0EAZEbGd7+rdcIzaeK3hEW 8R96nB5tHJ3z8MWlTiOSBh85tsplb89AIjYuE= 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=oB9RPp6WnwsjYS5CXqwxL1EjJg0DXpAe6+bh2YmNZmE=; b=Aw13anMeC6A7gPSSH510nYQgVeEX1GiRTZr3m+nOywBdFGB5SAkH/Tt7DxkJrKrLT2 9Ywgr790vLAFcX8Nc6y7acszb/G0WslJfvYtpZ5tjgRK6b2ktbinwrNnKMtYQjpFXOxb pWYZO0grBUlsBE3/u0B9yDaw/T9kWleclZLnzn8HDeruhd1ilBF6UaSuRGMAdZzyQcAi LKvsuV2kXZeB5kfgdNxMBcs9dWA0VJCqHiCDZwnymLgU5lGXYUtd5bJeUlhHjPvcrBI/ +mOTvaJsE/0F66rlZ25D8BYaIjHpC6OUnEpw9yjixJyhFLlEkOmhiq4RDegmINU4E8Rw oomw== X-Gm-Message-State: APjAAAWOnvuinpHUIV/BjW+w7FFSG/PpUZsQRTObuPrgksibZgJbGM+j SIVQFseGHEeAnU6Gzu+SozYXaNGQBcrSHE4QArVO/12SzcBo9h3ilGL5C4zFdGh8HyfCkws9tT7 +R/iK7X7xVkZf9gdYxgW2FanYP88vD9dyx4bmcUJAhK0AsgXZRapGFMStSFwBqnG6fsA0Yy4dhF v0GZJ82/LUn0+HJI2oVWt+ X-Google-Smtp-Source: APXvYqxDEO0VTTQfpU8TlXy/apzg6mIzhJig+0Sjv6bITtdfoOC9zXDeEauva6MwnxPQKbEM/fiaUw== X-Received: by 2002:a65:424a:: with SMTP id d10mr41995896pgq.335.1556271520438; Fri, 26 Apr 2019 02:38:40 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:39 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 08/21] megaraid_sas: Enhance prints in OCR and TM path Date: Fri, 26 Apr 2019 02:37:02 -0700 Message-Id: <1556271435-27252-9-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 enhances the existing debug prints in reset and task management path. These debug prints in adapter reset path helps with debugging issues related to IO timeouts that are seen frequently in the field. Add additional debug prints to dump the pending command frames before initiating a adapter reset. Also, print FastPath IOs that are outstanding. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 4 +- drivers/scsi/megaraid/megaraid_sas_base.c | 69 ++++++++++++++++++++++------- drivers/scsi/megaraid/megaraid_sas_fusion.c | 44 +++++++++--------- 3 files changed, 80 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 6be748f302cf..27980d68cf1b 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1495,7 +1495,8 @@ struct megasas_ctrl_info { #define MEGASAS_FW_BUSY 1 /* Driver's internal Logging levels*/ -#define OCR_LOGS (1 << 0) +#define OCR_DEBUG (1 << 0) +#define TM_DEBUG (1 << 1) #define SCAN_PD_CHANNEL 0x1 #define SCAN_VD_CHANNEL 0x2 @@ -2647,4 +2648,5 @@ int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, bool do_adp_reset, int ocr_context); int megasas_irqpoll(struct irq_poll *irqpoll, int budget); +void megasas_dump_fusion_io(struct scsi_cmnd *scmd); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 102a7e40996e..032d91b1f3ba 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "megaraid_sas_fusion.h" #include "megaraid_sas.h" @@ -2833,23 +2834,63 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) } /** - * megasas_dump_frame - This function will dump MPT/MFI frame + * megasas_dump - This function will provide hexdump + * @ptr: Pointer starting which memory should be dumped + * @size: Size of memory to be dumped */ -static inline void -megasas_dump_frame(void *mpi_request, int sz) +inline void +megasas_dump(void *ptr, int sz) { int i; - __le32 *mfp = (__le32 *)mpi_request; + __le32 *loc = (__le32 *)ptr; - printk(KERN_INFO "IO request frame:\n\t"); for (i = 0; i < sz / sizeof(__le32); i++) { if (i && ((i % 8) == 0)) printk("\n\t"); - printk("%08x ", le32_to_cpu(mfp[i])); + printk("%08x ", le32_to_cpu(loc[i])); } printk("\n"); } +/** + * megasas_dump_fusion_io - This function will print key details + * of SCSI IO + * @scmd: SCSI command pointer of SCSI IO + */ +void +megasas_dump_fusion_io(struct scsi_cmnd *scmd) +{ + struct megasas_cmd_fusion *cmd; + union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; + struct megasas_instance *instance; + + cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; + instance = (struct megasas_instance *)scmd->device->host->hostdata; + + scmd_printk(KERN_INFO, scmd, + "scmd: (0x%p) retries: 0x%x allowed: 0x%x\n", + scmd, scmd->retries, scmd->allowed); + scsi_print_command(scmd); + + if (cmd) { + req_desc = (union MEGASAS_REQUEST_DESCRIPTOR_UNION *)cmd->request_desc; + scmd_printk(KERN_INFO, scmd, "Request descriptor details:\n"); + scmd_printk(KERN_INFO, scmd, + "RequestFlags:0x%x MSIxIndex:0x%x SMID:0x%x LMID:0x%x DevHandle:0x%x\n", + req_desc->SCSIIO.RequestFlags, + req_desc->SCSIIO.MSIxIndex, req_desc->SCSIIO.SMID, + req_desc->SCSIIO.LMID, req_desc->SCSIIO.DevHandle); + + printk(KERN_INFO "IO request frame:\n"); + megasas_dump(cmd->io_request, + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + printk(KERN_INFO "Chain frame:\n"); + megasas_dump(cmd->sg_frame, + instance->max_chain_frame_sz); + } + +} + /** * megasas_reset_bus_host - Bus & host reset handler entry point */ @@ -2861,24 +2902,20 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd) instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd, - "Controller reset is requested due to IO timeout\n" - "SCSI command pointer: (%p)\t SCSI host state: %d\t" - " SCSI host busy: %d\t FW outstanding: %d\n", - scmd, scmd->device->host->shost_state, + "OCR is requested due to IO timeout!!\n"); + + scmd_printk(KERN_INFO, scmd, + "SCSI host state: %d SCSI host busy: %d FW outstanding: %d\n", + scmd->device->host->shost_state, scsi_host_busy(scmd->device->host), atomic_read(&instance->fw_outstanding)); - /* * First wait for all commands to complete */ if (instance->adapter_type == MFI_SERIES) { ret = megasas_generic_reset(scmd); } else { - struct megasas_cmd_fusion *cmd; - cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; - if (cmd) - megasas_dump_frame(cmd->io_request, - MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + megasas_dump_fusion_io(scmd); ret = megasas_reset_fusion(scmd->device->host, SCSIIO_TIMEOUT_OCR); } diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 1f30a11944c3..030c04435cd5 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -122,7 +122,7 @@ megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, * Block access to PCI config space from userspace * when diag reset is initiated from driver */ - if (megasas_dbg_lvl & OCR_LOGS) + if (megasas_dbg_lvl & OCR_DEBUG) dev_info(&instance->pdev->dev, "Block access to PCI config space %s %d\n", __func__, __LINE__); @@ -145,7 +145,7 @@ megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, ret = SUCCESS; out: - if (megasas_dbg_lvl & OCR_LOGS) + if (megasas_dbg_lvl & OCR_DEBUG) dev_info(&instance->pdev->dev, "Unlock access to PCI config space %s %d\n", __func__, __LINE__); @@ -4519,9 +4519,6 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) instance = (struct megasas_instance *)scmd->device->host->hostdata; - scmd_printk(KERN_INFO, scmd, "task abort called for scmd(%p)\n", scmd); - scsi_print_command(scmd); - if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) { dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL," "SCSI host:%d\n", instance->host->host_no); @@ -4564,7 +4561,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) goto out; } sdev_printk(KERN_INFO, scmd->device, - "attempting task abort! scmd(%p) tm_dev_handle 0x%x\n", + "attempting task abort! scmd(0x%p) tm_dev_handle 0x%x\n", scmd, devhandle); mr_device_priv_data->tm_busy = 1; @@ -4575,9 +4572,12 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) mr_device_priv_data->tm_busy = 0; mutex_unlock(&instance->reset_mutex); -out: - sdev_printk(KERN_INFO, scmd->device, "task abort: %s scmd(%p)\n", + scmd_printk(KERN_INFO, scmd, "task abort %s!! scmd(0x%p)\n", ((ret == SUCCESS) ? "SUCCESS" : "FAILED"), scmd); +out: + scsi_print_command(scmd); + if (megasas_dbg_lvl & TM_DEBUG) + megasas_dump_fusion_io(scmd); return ret; } @@ -4600,9 +4600,6 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) instance = (struct megasas_instance *)scmd->device->host->hostdata; - sdev_printk(KERN_INFO, scmd->device, - "target reset called for scmd(%p)\n", scmd); - if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) { dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL," "SCSI host:%d\n", instance->host->host_no); @@ -4611,8 +4608,8 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) } if (!mr_device_priv_data) { - sdev_printk(KERN_INFO, scmd->device, "device been deleted! " - "scmd(%p)\n", scmd); + sdev_printk(KERN_INFO, scmd->device, + "device been deleted! scmd: (0x%p)\n", scmd); scmd->result = DID_NO_CONNECT << 16; ret = SUCCESS; goto out; @@ -4635,7 +4632,7 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) } sdev_printk(KERN_INFO, scmd->device, - "attempting target reset! scmd(%p) tm_dev_handle 0x%x\n", + "attempting target reset! scmd(0x%p) tm_dev_handle: 0x%x\n", scmd, devhandle); mr_device_priv_data->tm_busy = 1; ret = megasas_issue_tm(instance, devhandle, @@ -4644,10 +4641,10 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) mr_device_priv_data); mr_device_priv_data->tm_busy = 0; mutex_unlock(&instance->reset_mutex); -out: - scmd_printk(KERN_NOTICE, scmd, "megasas: target reset %s!!\n", + scmd_printk(KERN_NOTICE, scmd, "target reset %s!!\n", (ret == SUCCESS) ? "SUCCESS" : "FAILED"); +out: return ret; } @@ -4692,7 +4689,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) struct megasas_instance *instance; struct megasas_cmd_fusion *cmd_fusion, *r1_cmd; struct fusion_context *fusion; - u32 abs_state, status_reg, reset_adapter; + u32 abs_state, status_reg, reset_adapter, fpio_count = 0; u32 io_timeout_in_crash_mode = 0; struct scsi_cmnd *scmd_local = NULL; struct scsi_device *sdev; @@ -4766,7 +4763,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) if (convert) reason = 0; - if (megasas_dbg_lvl & OCR_LOGS) + if (megasas_dbg_lvl & OCR_DEBUG) dev_info(&instance->pdev->dev, "\nPending SCSI commands:\n"); /* Now return commands back to the OS */ @@ -4779,13 +4776,17 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) } scmd_local = cmd_fusion->scmd; if (cmd_fusion->scmd) { - if (megasas_dbg_lvl & OCR_LOGS) { + if (megasas_dbg_lvl & OCR_DEBUG) { sdev_printk(KERN_INFO, cmd_fusion->scmd->device, "SMID: 0x%x\n", cmd_fusion->index); - scsi_print_command(cmd_fusion->scmd); + megasas_dump_fusion_io(cmd_fusion->scmd); } + if (cmd_fusion->io_request->Function == + MPI2_FUNCTION_SCSI_IO_REQUEST) + fpio_count++; + scmd_local->result = megasas_check_mpio_paths(instance, scmd_local); @@ -4798,6 +4799,9 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) } } + dev_info(&instance->pdev->dev, "Outstanding fastpath IOs: %d\n", + fpio_count); + atomic_set(&instance->fw_outstanding, 0); status_reg = instance->instancet->read_fw_status_reg(instance); From patchwork Fri Apr 26 09:37:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918943 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 7BEE51390 for ; Fri, 26 Apr 2019 09:38:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B6E528D55 for ; Fri, 26 Apr 2019 09:38:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FC6328D69; Fri, 26 Apr 2019 09:38:46 +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 0BFBE28D55 for ; Fri, 26 Apr 2019 09:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726268AbfDZJip (ORCPT ); Fri, 26 Apr 2019 05:38:45 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41681 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbfDZJip (ORCPT ); Fri, 26 Apr 2019 05:38:45 -0400 Received: by mail-pg1-f195.google.com with SMTP id f6so1349965pgs.8 for ; Fri, 26 Apr 2019 02:38:45 -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=kOA1Bx5cGF6fzOBzG0i3z220U4AD6UldXBrPPdCIklo=; b=NQigmVFAJxtY1FKdEeGGse+aQYag+llsNxrD7IsG38tKSYuvk/nHT296UPmFtM9Ap8 KEc9iu/dI2/yR5VX59+zWq9YGjEbZSkEQyBalOVzaylfLeCVd3nmJlYqkBGa9/BAjGXG L32Qkg4ObHfxkzDjqKQLDP1t88MsHDhHoaku8= 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=kOA1Bx5cGF6fzOBzG0i3z220U4AD6UldXBrPPdCIklo=; b=VJiwvc+ZFnZTwGmKOE1gAgvrCRWDEa7NrnNC95pTady95R7o6suieytDmDkHIEhR+L mQTEezegQ7RgUu9yV6D4oNfQr3bw2PCuRoWpAFIXmdrPOPAlZ26XmbU83txzdkRed2Uy w9RNB3H3QJlP5t28Pn2SgVygrZgjnpxh1S3/hvf32zBmiwUN+8sNEV+ifeGs0ovUiUNm /hyzh7JuVOiWjfq3HgE9NTDRVt/An5HO7hdtgbadlVEgaGQNDU8IIBFiD50VEw8Iq+H4 n9Demq4fv7T38eoczewOYp8yUqD/T8LeYmLWmYMOdvn7ETGDTWvu0Ka3jGEY1wVujE31 9crw== X-Gm-Message-State: APjAAAWtj7++ew3zixb+diDMOLlAfXsoBxxO8nTTWSVyQXCgFGXapIB7 OxEsLzar298i4rGWw1q++uPq07PPZqCJ4dWUBQvjwNaNT7jjjoYeg9fgWJBw5LTa+Zfh2qgjUbX 4sz2yghbNmVuEwZyMNBsCs0bKReMaWI1iuAcyBGcA20nDOp2o0IKhkjewuNAAdEFrHhJDKa12nr S/HhKgFmelnpxgjqI5ps/H X-Google-Smtp-Source: APXvYqzPlU8dDhWy/4N1K2GqOw40RW0Lg4fTyo/1srsERlIzdFn9KoFNfM2G6dMW3KhPy+nF343+RA== X-Received: by 2002:a65:6201:: with SMTP id d1mr7180972pgv.28.1556271524450; Fri, 26 Apr 2019 02:38:44 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:43 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 09/21] megaraid_sas: Enhance internal DCMD timeout prints Date: Fri, 26 Apr 2019 02:37:03 -0700 Message-Id: <1556271435-27252-10-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add prints to identify the internal DCMD opcode that has timed out, for debugging. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 032d91b1f3ba..7449df36a092 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1113,8 +1113,9 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance, ret = wait_event_timeout(instance->int_cmd_wait_q, cmd->cmd_status_drv != MFI_STAT_INVALID_STATUS, timeout * HZ); if (!ret) { - dev_err(&instance->pdev->dev, "Failed from %s %d DCMD Timed out\n", - __func__, __LINE__); + dev_err(&instance->pdev->dev, + "DCMD(opcode: 0x%x) is timed out, func:%s\n", + cmd->frame->dcmd.opcode, __func__); return DCMD_TIMEOUT; } } else @@ -1143,6 +1144,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd; struct megasas_abort_frame *abort_fr; int ret = 0; + u32 opcode; cmd = megasas_get_cmd(instance); @@ -1178,8 +1180,10 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, ret = wait_event_timeout(instance->abort_cmd_wait_q, cmd->cmd_status_drv != MFI_STAT_INVALID_STATUS, timeout * HZ); if (!ret) { - dev_err(&instance->pdev->dev, "Failed from %s %d Abort Timed out\n", - __func__, __LINE__); + opcode = cmd_to_abort->frame->dcmd.opcode; + dev_err(&instance->pdev->dev, + "Abort(to be aborted DCMD opcode: 0x%x) is timed out func:%s\n", + opcode, __func__); return DCMD_TIMEOUT; } } else From patchwork Fri Apr 26 09:37:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918945 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 729AA1575 for ; Fri, 26 Apr 2019 09:38:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61A5928D55 for ; Fri, 26 Apr 2019 09:38:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5605328D69; Fri, 26 Apr 2019 09:38: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 F186728D55 for ; Fri, 26 Apr 2019 09:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbfDZJiu (ORCPT ); Fri, 26 Apr 2019 05:38:50 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45494 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726058AbfDZJiu (ORCPT ); Fri, 26 Apr 2019 05:38:50 -0400 Received: by mail-pl1-f195.google.com with SMTP id o5so1282741pls.12 for ; Fri, 26 Apr 2019 02:38: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=dcCoZiF26ORknzMxcBW3zcM05iT1n+AfBsRDn09t5Cc=; b=HeixsCd8jwBGOqASS0SbtNvhjf1OpoTHEbtRMkH9UA1JWadvC3JQepjg/J6x+SOx5z vyCClESgW052YKGvHmStYoHLZdJUP8UEcZnTYM99jfaacTN3mF6iufZ1PmN7T6T+SOo4 dsLbesGxeMJa+cuTyujO5hGumLk681sF14X0Y= 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=dcCoZiF26ORknzMxcBW3zcM05iT1n+AfBsRDn09t5Cc=; b=ttTELQ7QIHPIfugrFLYNjQ92CGFZNBp1XjzTIqvTBktScwybH9OrGUL//y4rcH55nf 3j9H7mTAj9a6NoZctRaORA7m26UyMMKkqXFEbgNGngy7v65Qw+LAnenxv/Tp4GLvwpz9 DoVhWrBt3I+5LyWPQb1iQr8Nc3KYRW6HxlRb3amW7il8Qstd8KsbPM9deU4HaNMDldgx gAKvI/8cSWg8up/qL4ax72WVkiRBXSmCj8uy3BD8LO3vmm93qYjJJDFVCgJg7IpJySoN zLVp+2hr8xw/nqZSLEQpRPEDaUBnu+FTcAcOgH1mTSsnj5lUEbLFxljxVshsAcTuHksE i9Ng== X-Gm-Message-State: APjAAAUg5s4BBtph0K/lqnbcpdLlRe085DZYVc7RwhynKT2HRgVuXveF sdu4UFGUuzqtY0VVcLwuoEwNLBftLwizFf6C/nCGuFWuHbbEkyupIv6liLgRay467e7aLY0LDn7 o6lWtZIsd5LlZcomexaye64KGjIF0bjSxwcvuKaZh8tfpBE3C7k13pg43Zl6CyYoMgvr1Qjamt4 SfY1h0lJ2nrruTrZMf3vzD X-Google-Smtp-Source: APXvYqypgtZb7UpwcH9n3yyzbuH14DiXdCbFU5O8WzP1QWAhxsa8rxUdn/G825Ob5km+qLyZqVaHxw== X-Received: by 2002:a17:902:758b:: with SMTP id j11mr7627549pll.87.1556271529375; Fri, 26 Apr 2019 02:38:49 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:48 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 10/21] megaraid_sas: Add formatting option for megasas_dump Date: Fri, 26 Apr 2019 02:37:04 -0700 Message-Id: <1556271435-27252-11-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add option to format the buffer that is being dumped. Currently, the IO frame and chain frame dumped in the syslog is getting split across multiple lines based on the formatting. Fix this by using KERN_CONT in printk. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7449df36a092..d0fd307e30af 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2838,22 +2838,28 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) } /** - * megasas_dump - This function will provide hexdump - * @ptr: Pointer starting which memory should be dumped - * @size: Size of memory to be dumped + * megasas_dump - This function will print hexdump of provided buffer. + * @buf: Buffer to be dumped + * @sz: Size in bytes + * @format: Different formats of dumping e.g. format=n will + * cause only 'n' 32 bit words to be dumped in a single + * line. */ inline void -megasas_dump(void *ptr, int sz) +megasas_dump(void *buf, int sz, int format) { int i; - __le32 *loc = (__le32 *)ptr; + __le32 *buf_loc = (__le32 *)buf; - for (i = 0; i < sz / sizeof(__le32); i++) { - if (i && ((i % 8) == 0)) - printk("\n\t"); - printk("%08x ", le32_to_cpu(loc[i])); + for (i = 0; i < (sz / sizeof(__le32)); i++) { + if ((i % format) == 0) { + if (i != 0) + printk(KERN_CONT "\n"); + printk(KERN_CONT "%08x: ", (i * 4)); + } + printk(KERN_CONT "%08x ", le32_to_cpu(buf_loc[i])); } - printk("\n"); + printk(KERN_CONT "\n"); } /** @@ -2887,10 +2893,10 @@ megasas_dump_fusion_io(struct scsi_cmnd *scmd) printk(KERN_INFO "IO request frame:\n"); megasas_dump(cmd->io_request, - MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE, 8); printk(KERN_INFO "Chain frame:\n"); megasas_dump(cmd->sg_frame, - instance->max_chain_frame_sz); + instance->max_chain_frame_sz, 8); } } From patchwork Fri Apr 26 09:37:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918947 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 928F71575 for ; Fri, 26 Apr 2019 09:38:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80E7328D56 for ; Fri, 26 Apr 2019 09:38:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7538E28D6E; Fri, 26 Apr 2019 09:38:55 +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 1BF4928D56 for ; Fri, 26 Apr 2019 09:38:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbfDZJiy (ORCPT ); Fri, 26 Apr 2019 05:38:54 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35227 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726058AbfDZJiy (ORCPT ); Fri, 26 Apr 2019 05:38:54 -0400 Received: by mail-pl1-f193.google.com with SMTP id w24so1303776plp.2 for ; Fri, 26 Apr 2019 02:38:54 -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=bKEkF/RP/Uj6DsuhWWt0OMgcf0YUysezEt+iSASd9Zs=; b=E3lqg1WnryJ0vlZgeDpZo+NxskmDiHie+jqZcbYVFsTP/1w+eL31jroT+Rkef0WCym 0lZDqCXHT783jvLEg4rlkHPmQoS0EQuhq//SqG3+FkTjMWvADUzIFlS1IPIEUBGrFhcb nPWuULPKdKnM1msh/aeS7i43YdyTJXdemPFMI= 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=bKEkF/RP/Uj6DsuhWWt0OMgcf0YUysezEt+iSASd9Zs=; b=LZD1dmRa7fQ118VozK8x0DxafuZA5UUlk6kLYV+k99sHIlFrzKJ2RGTTUZ0I7H8rK7 4tnBq3s3dEOK13PCF/mG0kiyS8OYFrfSzagnVnpB94PzJrr5t+t07zMXTZu699323rEp W3Ew9ml657vhQd+U1O736hwvyhhwnEA/5/3ciFqijcIWXZoRUFg3bwSnel8Idfb2CXpE y5VdIKtTRP/qWI8tg1Z0Esyq9gmt5qdbkDkHJ+HysVvZ8L+0j1C/VGYYZ0l0VptKgvN4 0a9pto04MbVNlpg/ZpLhWHnNXuhRYRDwqXPdNhWxWnrwl5Yt8PezEmxjNf9Wbjt40ZO1 0zhg== X-Gm-Message-State: APjAAAVSGOg+XkfduDAbCIg81lEUpXbWF9gGQYVMeWi8fDGDd6nndYNi J2K8X5uM2QK6Vo7BCp4e0i6kNldX/tugVGiNYQsnIh1JbzT/jysEYgq81fxHYp7h6dXSg+Xah0A yjnxGqQb6HU1awWudY8YCSOk67RoTLvHU3D04A1TLIWblWxAsAsuzPp1xKeT8Hp+2s3BVaTVem8 L/7TXjD0DBpjLXB4cwoAYa X-Google-Smtp-Source: APXvYqzlfywaCgfuikzqt8L6PsPth4dDVO6j6Oa+HGI3Guqu0HdderaRG6gvpRcv7hYkPwg2x194QA== X-Received: by 2002:a17:902:3064:: with SMTP id u91mr653653plb.181.1556271533447; Fri, 26 Apr 2019 02:38:53 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:52 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 11/21] megaraid_sas: Dump system interface regs from sysfs Date: Fri, 26 Apr 2019 02:37:05 -0700 Message-Id: <1556271435-27252-12-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add a sysfs interface to dump the controller's system interface registers. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index d0fd307e30af..5d2f346f3f49 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2901,6 +2901,29 @@ megasas_dump_fusion_io(struct scsi_cmnd *scmd) } +/* + * megasas_dump_sys_regs - This function will dump system registers through + * sysfs. + * @reg_set: Pointer to System register set. + * @buf: Buffer to which output is to be written. + * @return: Number of bytes written to buffer. + */ +static inline ssize_t +megasas_dump_sys_regs(void __iomem *reg_set, char *buf) +{ + unsigned int i, sz = 256; + int bytes_wrote = 0; + char *loc = (char *)buf; + + __le32 *reg = (__le32 *)reg_set; + + for (i = 0; i < sz / sizeof(__le32); i++) { + bytes_wrote += snprintf(loc + bytes_wrote, PAGE_SIZE, + "%08x: %08x\n", (i * 4), + le32_to_cpu(readl(®[i]))); + } + return bytes_wrote; +} /** * megasas_reset_bus_host - Bus & host reset handler entry point */ @@ -3223,6 +3246,17 @@ megasas_fw_cmds_outstanding_show(struct device *cdev, return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&instance->fw_outstanding)); } +static ssize_t +megasas_dump_system_regs_show(struct device *cdev, + struct device_attribute *attr, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(cdev); + struct megasas_instance *instance = + (struct megasas_instance *)shost->hostdata; + + return megasas_dump_sys_regs(instance->reg_set, buf); +} + static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR, megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store); static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO, @@ -3235,6 +3269,8 @@ static DEVICE_ATTR(ldio_outstanding, S_IRUGO, megasas_ldio_outstanding_show, NULL); static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO, megasas_fw_cmds_outstanding_show, NULL); +static DEVICE_ATTR(dump_system_regs, S_IRUGO, + megasas_dump_system_regs_show, NULL); struct device_attribute *megaraid_host_attrs[] = { &dev_attr_fw_crash_buffer_size, @@ -3243,6 +3279,7 @@ struct device_attribute *megaraid_host_attrs[] = { &dev_attr_page_size, &dev_attr_ldio_outstanding, &dev_attr_fw_cmds_outstanding, + &dev_attr_dump_system_regs, NULL, }; From patchwork Fri Apr 26 09:37:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918949 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 91E191390 for ; Fri, 26 Apr 2019 09:38:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80ED928D55 for ; Fri, 26 Apr 2019 09:38:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 757DF28D6A; Fri, 26 Apr 2019 09:38:59 +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 182BA28D55 for ; Fri, 26 Apr 2019 09:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726058AbfDZJi6 (ORCPT ); Fri, 26 Apr 2019 05:38:58 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38343 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJi6 (ORCPT ); Fri, 26 Apr 2019 05:38:58 -0400 Received: by mail-pf1-f194.google.com with SMTP id 10so1441224pfo.5 for ; Fri, 26 Apr 2019 02:38:58 -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=KusFE6EzOlM2/C6Baiw/EvtE4y1EaqDC0BiuiGqnrQU=; b=frIDVQzLA6d35+f+sn4wE7Rrmuoi2AOROgfGkRml/ymIdIiETPG4v53QnaQmlAUJNg yo4Rs3C7HS2gPr1exXSIhihk+nTO6IOUaKMhDg60WNKC2Pq7F2vt7kzfsKNdUO7qac4k TNCXKx53P5Bf9ZQ6tTR25z/qOznamkzl0LLEI= 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=KusFE6EzOlM2/C6Baiw/EvtE4y1EaqDC0BiuiGqnrQU=; b=aWsAdeHiDtbDm4fjDJq2OqW5TQm1WsI3zckxYQYugKVGi7hkWcHpzjSpNFgl/J+HTs V+5rH9BHh6ST+Hb4RRR3sTniXXw+KY2YUPAWfmPFE2/8/dsWF9IPIRrl0zQnqefXXccT serZCNFgtdJkjrgODgTyCOswPOS9g2xBueAmrb4IkgIUnloSVJqcpuX5MzoP0QNWBBTX uNTqMgJ4c+FTdWH8A7mXbjMj3gUzmeFYRFB3EL7chjdN+RvKHS9epc0nJQjoqLdyklkr zO9jH+TvoIxNFxLSP6doZuHX6+n6gUuUmggSDT3plXt8j4F4X1kwQ6IMca57bnNG6/pz jCOw== X-Gm-Message-State: APjAAAXXYP3hLXOWzpUng3x9agunKQwFz+7Z/v3QI65nuUmjkezOp23Y 7OuCy/2WtZvDQFb22j+l/jOXORvkO9aEwrDRIYLk8A0LHISLBf77LsmEzobB+56IcB/DIz8lRs0 RshV2foUBND7dDJopDS+oQRfL0Am0WMrLS0GTWR2MFqtDEdzLaVhsjheKcywYGgDZtYI2KNDTFx Q76B1Tf7bpSaUmUDvBaA9R X-Google-Smtp-Source: APXvYqyVrRSnTtVF3Cvs2dbJvj0FC6Ba/bGK1WJy5Jr5OBI9D2BIdYZ2E4Xc4BZgZ6uBzE5O9m+/Qw== X-Received: by 2002:aa7:9193:: with SMTP id x19mr26192532pfa.108.1556271537496; Fri, 26 Apr 2019 02:38:57 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:56 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 12/21] megaraid_sas: Dump system registers for debugging Date: Fri, 26 Apr 2019 02:37:06 -0700 Message-Id: <1556271435-27252-13-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 When controller fails to transition to READY state during driver probe, dump the system interface register set. This will give snapshot of the firmware status for debugging driver load issues. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5d2f346f3f49..5725d4cfbd14 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2862,6 +2862,24 @@ megasas_dump(void *buf, int sz, int format) printk(KERN_CONT "\n"); } +/** + * megasas_dump_reg_set - This function will print hexdump of register set + * @buf: Buffer to be dumped + * @sz: Size in bytes + * @format: Different formats of dumping e.g. format=n will + * cause only 'n' 32 bit words to be dumped in a + * single line. + */ +inline void +megasas_dump_reg_set(void __iomem *reg_set) +{ + unsigned int i, sz = 256; + __le32 *reg = (__le32 *)reg_set; + + for (i = 0; i < (sz / sizeof(__le32)); i++) + printk("%08x: %08x\n", (i * 4), le32_to_cpu(readl(®[i]))); +} + /** * megasas_dump_fusion_io - This function will print key details * of SCSI IO @@ -3891,8 +3909,11 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) max_wait = MEGASAS_RESET_WAIT_TIME; cur_state = MFI_STATE_FAULT; break; - } else + } else { + dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n"); + megasas_dump_reg_set(instance->reg_set); return -ENODEV; + } case MFI_STATE_WAIT_HANDSHAKE: /* @@ -4000,6 +4021,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) default: dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n", fw_state); + dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n"); + megasas_dump_reg_set(instance->reg_set); return -ENODEV; } @@ -4022,6 +4045,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) if (curr_abs_state == abs_state) { dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed " "in %d secs\n", fw_state, max_wait); + dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n"); + megasas_dump_reg_set(instance->reg_set); return -ENODEV; } From patchwork Fri Apr 26 09:37:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918951 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 829101575 for ; Fri, 26 Apr 2019 09:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7013E28D55 for ; Fri, 26 Apr 2019 09:39:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 646C728D6A; Fri, 26 Apr 2019 09:39: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 1752D28D55 for ; Fri, 26 Apr 2019 09:39:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726291AbfDZJjC (ORCPT ); Fri, 26 Apr 2019 05:39:02 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45512 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjC (ORCPT ); Fri, 26 Apr 2019 05:39:02 -0400 Received: by mail-pl1-f194.google.com with SMTP id o5so1283006pls.12 for ; Fri, 26 Apr 2019 02:39: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=v1ZkDGBIj26UwYkIE0THY0DZ//QVPPvQZK+lbbaR3ak=; b=WMc12sAiMIsMkrqN/tByz5jGk30B8XadsTxhrNr9HGMRKBBG7+1WYf7BOVyQXYa9MU r+iWBnxXQJhCuXOgw3aUZcNGmtaIdk52QlOvZb7Se8nl/3JxlpItIsBI7b2Vy5Rl6bAj 4nvX63eO43zM2CBsH8T5lNq8zkYT7V7XC5J7c= 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=v1ZkDGBIj26UwYkIE0THY0DZ//QVPPvQZK+lbbaR3ak=; b=nSiOSbaIb3q/fF5QAXaDocOHl+bkDPYI0tO/rHp2Au6TWliW6qjuCY0lIq9ZDnVSNk DCObl+cWuSIawPVuNzGf6JwSLYMV16QkgVD3wnzuuBOP8c3DMeSb8nUnBtHR0d+5nsqX SSXNNfnOaIAf28oVBLVD3Z0/iOXeaDmylchm4PtCQDJ6P9+wTozh1b2UtO9KKH3w8cWn LHBdwalD5VvLupB91N+UAor3ucL5Xa4ZwdWXl8xwYbgDF/azLBF0Y6/WjAKY5gPrEYZn MPp68aC1yO94yp103MaKq+QYX+Qw/vvIe3HWozCT0FCXZ6U20qdcc16eYBIwEH6m9vrT UGlQ== X-Gm-Message-State: APjAAAWn1Wrk8PhBcOKTgxT8RVjnRv/WTU438hhwcj0DqkdWB+hfln9Q sHyYK1MOmscpWTpoZSIpwl5rs7JjTk5ATpKrRCv5umuXyAYd4g5C1U0EhwbK77h+Peubu9Co/PF PUKdxBpzEcwok/m+TCi5m6f80c9mNaD36C8K/6l7HGaYuXMxZblT/M1wzeneSPOHEDyHGOb3lJ3 ReMUduA4jTNMf7nlvBPy3M X-Google-Smtp-Source: APXvYqw2z+gmDJJ9PYjQweGaQ5hvGx37oqD5n94ITZqoPmf+iokyt66Brmyrk6/4Y5s6H4G7urkbsg== X-Received: by 2002:a17:902:e408:: with SMTP id ci8mr10585075plb.100.1556271541416; Fri, 26 Apr 2019 02:39:01 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:00 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 13/21] megaraid_sas: Print BAR information from driver Date: Fri, 26 Apr 2019 02:37:07 -0700 Message-Id: <1556271435-27252-14-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add prints for BAR address information during driver load. This helps in debugging issues with BAR address changing during OS boot. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 5725d4cfbd14..84ec4ab03364 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5625,6 +5625,7 @@ static int megasas_init_fw(struct megasas_instance *instance) u32 max_sectors_2, tmp_sectors, msix_enable; u32 scratch_pad_1, scratch_pad_2, scratch_pad_3, status_reg; resource_size_t base_addr; + void *base_addr_phys; struct megasas_ctrl_info *ctrl_info = NULL; unsigned long bar_list; int i, j, loop, fw_msix_count = 0; @@ -5650,6 +5651,11 @@ static int megasas_init_fw(struct megasas_instance *instance) goto fail_ioremap; } + base_addr_phys = &base_addr; + dev_printk(KERN_DEBUG, &instance->pdev->dev, + "BAR:0x%lx BAR's base_addr(phys):%pa mapped virt_addr:0x%p\n", + instance->bar, base_addr_phys, instance->reg_set); + if (instance->adapter_type != MFI_SERIES) instance->instancet = &megasas_instance_template_fusion; else { From patchwork Fri Apr 26 09:37:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918953 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 6DADD1575 for ; Fri, 26 Apr 2019 09:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B52928D55 for ; Fri, 26 Apr 2019 09:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E36928D69; Fri, 26 Apr 2019 09:39:07 +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 EC03E28D55 for ; Fri, 26 Apr 2019 09:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726295AbfDZJjG (ORCPT ); Fri, 26 Apr 2019 05:39:06 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43925 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjG (ORCPT ); Fri, 26 Apr 2019 05:39:06 -0400 Received: by mail-pg1-f195.google.com with SMTP id z9so1346119pgu.10 for ; Fri, 26 Apr 2019 02:39:06 -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=PHatEoaMWFs4FZHmh6Wx4FdHzegrx2ZW/QIt/upfph8=; b=A8QUMqJqNzQYTjT1itm5pt+t2cVX73+faBzWIMppLj33FNgbCAhwjAWkKl0sA4Vt07 p7sglyuuRab5BHo7hqjSBSq95447zTg9uDkzsqGy20+IzB+qMSXH+R+fqYuxukGbugRT gc6DZAQ2FswmQsd9Fi+J1n9ykCRSoV3+K1oQI= 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=PHatEoaMWFs4FZHmh6Wx4FdHzegrx2ZW/QIt/upfph8=; b=L5x7r4e5sCqBGgUOIw/BZt1WB1wE3ETk0RlsFSNvZ7sY+8MfXoDr2+edavB4owxTrx Byo7+Aa4RoY6MwzCaMJxredCQOSs3IPYiQLLtfaAq10HH3zoUtFD3NNb95EHfcolB0BO CTYft5qzLrQlU3j8KNkXw54Ojp/RfIsOrnJGhu/6U0bN6xK8q/6c7+VnZoRNXU08ieNH 2my60SgLSVA5iZoDlmuVqp0yGuWrqgo8+AUoDgYVPOWjc0+ZKXhbwNZhTXGhGAI9LfX9 NeeRLJBYnJTY1/vY1vwuIVTsVKz3osRQO949citu4gpip27dWdJBgw0rTXFJE4W4svRt cOxw== X-Gm-Message-State: APjAAAUV/nmT8UUZRzIcJCNsFEqpltwC+8sE19qpF3h/YvEs09Yz8fBN tqp9dOg5QmsoWF2KZT1X2zxV7+9I0LmVIpKqXg8PXc2zaeXr6QGnB8CQLcX4s6MUOt9EciZ9qpu MPpU/IDoxwA2S7Fv2amnt6jvvAMCSB9sVVed08fEokCiatNBc2+9ifMrBB4ZluqlR72cwIHrDoU PQ1vmrZTgKWUjY5n2f6zQD X-Google-Smtp-Source: APXvYqxVbOqnrq9/fcKqJugXLjuKQAVbmJpETBqK5/zNAPnQ/+C5AGvjah+KogZfkgT0I+Ca85b++w== X-Received: by 2002:aa7:8c86:: with SMTP id p6mr19888004pfd.37.1556271545324; Fri, 26 Apr 2019 02:39:05 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:04 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 14/21] megaraid_sas: Export RAID map id through sysfs Date: Fri, 26 Apr 2019 02:37:08 -0700 Message-Id: <1556271435-27252-15-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add a sysfs interface to get the raid map index that is being used by driver. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 84ec4ab03364..7a903bde2f48 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3275,6 +3275,18 @@ megasas_dump_system_regs_show(struct device *cdev, return megasas_dump_sys_regs(instance->reg_set, buf); } +static ssize_t +megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr, + char *buf) +{ + struct Scsi_Host *shost = class_to_shost(cdev); + struct megasas_instance *instance = + (struct megasas_instance *)shost->hostdata; + + return snprintf(buf, PAGE_SIZE, "%ld\n", + (unsigned long)instance->map_id); +} + static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR, megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store); static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO, @@ -3289,6 +3301,8 @@ static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO, megasas_fw_cmds_outstanding_show, NULL); static DEVICE_ATTR(dump_system_regs, S_IRUGO, megasas_dump_system_regs_show, NULL); +static DEVICE_ATTR(raid_map_id, S_IRUGO, + megasas_raid_map_id_show, NULL); struct device_attribute *megaraid_host_attrs[] = { &dev_attr_fw_crash_buffer_size, @@ -3298,6 +3312,7 @@ struct device_attribute *megaraid_host_attrs[] = { &dev_attr_ldio_outstanding, &dev_attr_fw_cmds_outstanding, &dev_attr_dump_system_regs, + &dev_attr_raid_map_id, NULL, }; From patchwork Fri Apr 26 09:37:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918961 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 A29111390 for ; Fri, 26 Apr 2019 09:39:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9054B28D55 for ; Fri, 26 Apr 2019 09:39:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84B8128D69; Fri, 26 Apr 2019 09:39: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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI 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 6844228D55 for ; Fri, 26 Apr 2019 09:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726012AbfDZJjL (ORCPT ); Fri, 26 Apr 2019 05:39:11 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:41217 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjK (ORCPT ); Fri, 26 Apr 2019 05:39:10 -0400 Received: by mail-pl1-f195.google.com with SMTP id d9so1293686pls.8 for ; Fri, 26 Apr 2019 02:39:10 -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=EE6QfDBsO4Vsi8XI1jWPUhCx9XMUQp2d5ZsdMGh+12Q=; b=GxTS9G0r2udRjm/73X64gQ3BYTWuIfrkTIb8r1pA1R6HNSfOe+jbKmYbMgLaCKnV3A qWYKos2R7RQePvC/u+lgIPPZCgWk49YUWGJlxr4Hzop1pHQun+66BA/LUTiKdTF7QKVq lFWEPGnlFP5HRlKRmrqajFryIh2HuUjwh/Xyg= 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=EE6QfDBsO4Vsi8XI1jWPUhCx9XMUQp2d5ZsdMGh+12Q=; b=GPtFE/SOMioKgMuuYos5/LRnQu74+onzixbuUWvcW/fjZmOzbY0Epitc6cUz7xHvce jPK+4pZhZk/wwJ2sPtaMFF3D6Mxri1ESVsPjODTrptgz6uclMbcQsFsz4+AjvRc6NwYM lPINZs3PTcUY0S7NnkACnGo5UiYxJe3sOwhHHrEKiH9HQDeDVnyV3CETNkropMqyHjUV DSl1/KuEZlKJwxMz9229DBbHR2mv+RWYiaNUma0s4TL4y/g3iOP8mpH+jN2E19Y3zuF7 qpwn6hj0AFG6u5FdsWo4/iOoPLaJStAmBsuYGXu72nPDfgJ2JMVB8TiVlRmRj8mmzI8B H/5g== X-Gm-Message-State: APjAAAVWplQ+bLbuWvcoys7BHPMDOW4kVjuH8yHu89k8+0qchBOFMCgB kRbJMOrjd6zhpL6S5VF9DB/SuZTSaFDbe9O3ubJNw61e2bRVYhfkQFHVp/MgQ9UbToElz8laiO5 HrquCmc970RPV9NGK0Ju/HmvPshXTR0sD+KtFmELLlct1scJresj5/cPTRFunL3zLaAQLtPd/et wYKsNxv1kieihOixtJOhZV X-Google-Smtp-Source: APXvYqzqauiAve27X9KNwL6vnrQ480qd01E+c4NvWA7mW31qwcFF1X78XfRgPmEtXVK6I6yG6eiXog== X-Received: by 2002:a17:902:102a:: with SMTP id b39mr45192546pla.188.1556271549424; Fri, 26 Apr 2019 02:39:09 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:08 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 15/21] megaraid_sas: Print FW fault information Date: Fri, 26 Apr 2019 02:37:09 -0700 Message-Id: <1556271435-27252-16-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 When driver detects a firmware fault during load, dump additional information on fault code and subcode that will help in debugging. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 2 ++ drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 25 ++++++++++++++----------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 27980d68cf1b..8df6ef01785e 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -135,6 +135,8 @@ #define MFI_RESET_ADAPTER 0x00000002 #define MEGAMFI_FRAME_SIZE 64 +#define MFI_STATE_FAULT_CODE 0x0FFF0000 +#define MFI_STATE_FAULT_SUBCODE 0x0000FF00 /* * During FW init, clear pending cmds & reset state using inbound_msg_0 * diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7a903bde2f48..a7ae10aa2e3f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3919,7 +3919,10 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) switch (fw_state) { case MFI_STATE_FAULT: - dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW in FAULT state!!\n"); + dev_printk(KERN_ERR, &instance->pdev->dev, + "FW in FAULT state, Fault code:0x%x subcode:0x%x func:%s\n", + abs_state & MFI_STATE_FAULT_CODE, + abs_state & MFI_STATE_FAULT_SUBCODE, __func__); if (ocr) { max_wait = MEGASAS_RESET_WAIT_TIME; cur_state = MFI_STATE_FAULT; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 030c04435cd5..5a82e5ea420b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -3984,7 +3984,7 @@ megasas_check_reset_fusion(struct megasas_instance *instance, static inline void megasas_trigger_snap_dump(struct megasas_instance *instance) { int j; - u32 fw_state; + u32 fw_state, abs_state; if (!instance->disableOnlineCtrlReset) { dev_info(&instance->pdev->dev, "Trigger snap dump\n"); @@ -3994,11 +3994,13 @@ static inline void megasas_trigger_snap_dump(struct megasas_instance *instance) } for (j = 0; j < instance->snapdump_wait_time; j++) { - fw_state = instance->instancet->read_fw_status_reg(instance) & - MFI_STATE_MASK; + abs_state = instance->instancet->read_fw_status_reg(instance); + fw_state = abs_state & MFI_STATE_MASK; if (fw_state == MFI_STATE_FAULT) { - dev_err(&instance->pdev->dev, - "Found FW in FAULT state, after snap dump trigger\n"); + dev_printk(KERN_ERR, &instance->pdev->dev, + "FW in FAULT state Fault code:0x%x subcode:0x%x func:%s\n", + abs_state & MFI_STATE_FAULT_CODE, + abs_state & MFI_STATE_FAULT_SUBCODE, __func__); return; } msleep(1000); @@ -4010,7 +4012,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, int reason, int *convert) { int i, outstanding, retval = 0, hb_seconds_missed = 0; - u32 fw_state; + u32 fw_state, abs_state; u32 waittime_for_io_completion; waittime_for_io_completion = @@ -4029,12 +4031,13 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, for (i = 0; i < waittime_for_io_completion; i++) { /* Check if firmware is in fault state */ - fw_state = instance->instancet->read_fw_status_reg(instance) & - MFI_STATE_MASK; + abs_state = instance->instancet->read_fw_status_reg(instance); + fw_state = abs_state & MFI_STATE_MASK; if (fw_state == MFI_STATE_FAULT) { - dev_warn(&instance->pdev->dev, "Found FW in FAULT state," - " will reset adapter scsi%d.\n", - instance->host->host_no); + dev_printk(KERN_ERR, &instance->pdev->dev, + "FW in FAULT state Fault code:0x%x subcode:0x%x func:%s\n", + abs_state & MFI_STATE_FAULT_CODE, + abs_state & MFI_STATE_FAULT_SUBCODE, __func__); megasas_complete_cmd_dpc_fusion((unsigned long)instance); if (instance->requestorId && reason) { dev_warn(&instance->pdev->dev, "SR-IOV Found FW in FAULT" From patchwork Fri Apr 26 09:37:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918955 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 975DC1390 for ; Fri, 26 Apr 2019 09:39:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 873E528D56 for ; Fri, 26 Apr 2019 09:39:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AD8A28D6A; Fri, 26 Apr 2019 09:39:15 +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 26D9928D56 for ; Fri, 26 Apr 2019 09:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbfDZJjO (ORCPT ); Fri, 26 Apr 2019 05:39:14 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39966 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjO (ORCPT ); Fri, 26 Apr 2019 05:39:14 -0400 Received: by mail-pl1-f195.google.com with SMTP id b3so1293610plr.7 for ; Fri, 26 Apr 2019 02:39: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=lwR4lynoFKo2yobFL3J9rGs6Isbx6us6LnAh4RykX48=; b=Ut0a1w/Gt4mVEYhp4T8s9CAlmDlO8UwoXNG5NLxbK0kFxfv+L7Pfef8M1oheqLyycC x8P2HvdHMbsWai0jbdEvR6BvHqfbqJNBQqgiwtObLlOcM3+ZZzNm24fLbmbIemdMAMyb UUDkoDLPmdly5q8DtSliTg1j0PZRKXTymExXk= 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=lwR4lynoFKo2yobFL3J9rGs6Isbx6us6LnAh4RykX48=; b=IWglrm9K+i2YwgfIo1W6Ka36wVGdrIVp9t0rtmvUAHhgZBa3QmvnQUWGRw1kjxLu/x bEciJBdXhEjWe2no6pk5Kp2Kft5631oQaWphoSbxRBUYgtrCIXgCQau9ZxZt118zBQ/b 9El05nd45ZDpGAYKWNOYiM/Fp/NHjJwJ532Fm1GyMpQfkx5sjqptuZ1MvCQFaT8tQSXg WzG2ie96EpriglRCF5HWWhVQorocYMyrKe7I9uYprYWJcIFOqpCsH/R2L8M0kRL8GKj2 zCPSCMhVNUtcaQXuNgOjXFJ+uYDXp+1IpCvaYBGJOIsF1U/6ehnBqyhx3Z/tiXOIneP2 fnSQ== X-Gm-Message-State: APjAAAXgKIbAGPYibtkpSwa0K2xz1jtytm1COTU6KEND6lRstg8M2Uwo adJqMis2zFQFygev1uUwTnb5/jQ+PiCmcW64uvF7h/rp+pJLNZ7SlHQpZdtXVn6R3Tvb+rOzrvl 2sHekPgiHS6WSaUG4JKCmJOZVt53MRiEw2PZlycAGN4bscJEBD2fJzUs1e037dI3MveQIrbTJVl bKh3CC+SSwMFSVvGhnqwha X-Google-Smtp-Source: APXvYqzkfKWFcfF5GptafAQpRoR/P1wS7JAzsOr2VrKvU1dCuWgGwbyMqTXEBvrTEBifolFV8LNDyg== X-Received: by 2002:a17:902:380c:: with SMTP id l12mr44515140plc.320.1556271553579; Fri, 26 Apr 2019 02:39:13 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:12 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 16/21] megaraid_sas: Print firmware interrupt status Date: Fri, 26 Apr 2019 02:37:10 -0700 Message-Id: <1556271435-27252-17-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add a print to dump the interrupt status in system log for debugging. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 5a82e5ea420b..2fa9941514d9 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -202,7 +202,8 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) writel(~MFI_FUSION_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask); /* Dummy readl to force pci flush */ - readl(®s->outbound_intr_mask); + dev_info(&instance->pdev->dev, "%s is called outbound_intr_mask:0x%08x\n", + __func__, readl(®s->outbound_intr_mask)); } /** @@ -213,14 +214,14 @@ void megasas_disable_intr_fusion(struct megasas_instance *instance) { u32 mask = 0xFFFFFFFF; - u32 status; struct megasas_register_set __iomem *regs; regs = instance->reg_set; instance->mask_interrupts = 1; writel(mask, ®s->outbound_intr_mask); /* Dummy readl to force pci flush */ - status = readl(®s->outbound_intr_mask); + dev_info(&instance->pdev->dev, "%s is called outbound_intr_mask:0x%08x\n", + __func__, readl(®s->outbound_intr_mask)); } int @@ -4895,9 +4896,9 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); - dev_info(&instance->pdev->dev, "Interrupts are enabled and" - " controller is OPERATIONAL for scsi:%d\n", - instance->host->host_no); + dev_info(&instance->pdev->dev, + "Adapter is OPERATIONAL for scsi:%d\n", + instance->host->host_no); /* Restart SR-IOV heartbeat */ if (instance->requestorId) { From patchwork Fri Apr 26 09:37:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918957 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 D1D511575 for ; Fri, 26 Apr 2019 09:39:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C120928D56 for ; Fri, 26 Apr 2019 09:39:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B51DA28D6A; Fri, 26 Apr 2019 09:39: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 9DC1728D56 for ; Fri, 26 Apr 2019 09:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbfDZJjT (ORCPT ); Fri, 26 Apr 2019 05:39:19 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40533 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjT (ORCPT ); Fri, 26 Apr 2019 05:39:19 -0400 Received: by mail-pf1-f193.google.com with SMTP id s4so1434877pfh.7 for ; Fri, 26 Apr 2019 02:39:18 -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=8ez+GI5DD4AnwGxy1UuxitMHJ/5sXbRTw2W/oaoFn14=; b=GlZW60jm8ldt5pWluJueiso6u1oCkCwthPgFwcc5s8kwhLiKDPp52Z5MeTU2qF2nBD fw6T/k43fSXhjOAj7oU99N6Wc7uuM5zmlsi2xZxg8Pwas57VT5DazIEtx9s7LmrnOGJ8 CHPXNR38kE51UwYS3H0r2zm82SqHpuaQVNofg= 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=8ez+GI5DD4AnwGxy1UuxitMHJ/5sXbRTw2W/oaoFn14=; b=H/byafWWRkj2sJ4dE0soewIgM6K1jXemaD2O1uqNxCO2gDKZGWC58z0ZzTtAjkykuG s413t2qYiYX6odLuFCzTkWY5W8ydw/YzBbC4/pZ+RYh/zMdqctuMlDLR4PJO0jBea9FG ZVKJF8RMCoaq5pFXIHQOPw/bqpU0A74N6avzZBLSg65AcuLz1/rz1FVJeoAvNM5aURjo id9FkaLdhpflkUillEHKZJORAkH7y8CyiEdOnU+XUwip4V+4s3M/Cv/DiQ9vckWG3jNV weEAS2IliZ624k9VEl6JVPiITqdi0ZjeWt4n6bjE6r6HKNB8CmCULavgSSegHIvRuQAV CV3Q== X-Gm-Message-State: APjAAAWMLIn/YAgyPTN8VzcJcjTimrIZtI0Lo6CLh4pjyQFcPzK0NcMD 4VzzTZna9qNQE+I85diUsO0iaTg3jYH6KQpw6BRzBzBtV9cX1lnm9XbRpbDKsRliXJ2WQp/cUs5 60BxWacNN7pPTlf2YcbrUBmalF8yLoWG2H1bdWQSyN1+f0sT09QeuZMyl/spxeGGgy9h0OEvj30 yypeGPZfMabZcTrA4jEgNE X-Google-Smtp-Source: APXvYqx50QCEDsELozWXNqC3Yy/LnEQNjQX0P1shq/4wfWdPVK1+FDF1v2JY/5jhG2WLsx8KzA61RA== X-Received: by 2002:a65:5286:: with SMTP id y6mr41708184pgp.79.1556271557842; Fri, 26 Apr 2019 02:39:17 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:16 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 17/21] megaraid_sas: Add prints in suspend and resume path Date: Fri, 26 Apr 2019 02:37:11 -0700 Message-Id: <1556271435-27252-18-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add prints in resume/suspend path to help in debugging hibernation issues. The print gives an indication when the driver entry points are called. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- 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 a7ae10aa2e3f..b1aedfb0963e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7244,6 +7244,8 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) host = instance->host; instance->unload = 1; + dev_info(&pdev->dev, "%s is called\n", __func__); + /* Shutdown SR-IOV heartbeat timer */ if (instance->requestorId && !instance->skip_heartbeat_timer_del) del_timer_sync(&instance->sriov_heartbeat_timer); @@ -7298,6 +7300,7 @@ megasas_resume(struct pci_dev *pdev) pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); + dev_info(&pdev->dev, "%s is called\n", __func__); /* * PCI prepping: enable device set bus mastering and dma mask */ From patchwork Fri Apr 26 09:37:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918959 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 43EFA1575 for ; Fri, 26 Apr 2019 09:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 328BB28D56 for ; Fri, 26 Apr 2019 09:39:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 272F128D6A; Fri, 26 Apr 2019 09:39: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 AD5F828D56 for ; Fri, 26 Apr 2019 09:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725993AbfDZJjX (ORCPT ); Fri, 26 Apr 2019 05:39:23 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41736 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJjX (ORCPT ); Fri, 26 Apr 2019 05:39:23 -0400 Received: by mail-pg1-f193.google.com with SMTP id f6so1350766pgs.8 for ; Fri, 26 Apr 2019 02:39:22 -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=HUshbZgispaVESkt2yvBoruihGZoZo9iBzkXuAkjWGo=; b=Clq1f85lbYvCOStlUAeMOuiKrtQiVbo7uyvkSBKmSEPe3FPXuu8TzLjkx4tyEn5Ooz jO+F+cNarohk3ZGaBSz5tyEW0PD70kcbicQP+tU8pkDwLAx0UgnO+FwL61jWPjVweneV LaLRyvaRESXPGVQWgSDE9NgxrTt7CfWMYlFKE= 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=HUshbZgispaVESkt2yvBoruihGZoZo9iBzkXuAkjWGo=; b=d6wLqeCtB1aBQ591Ejv/5rIeIDFt19qnVIde6phnPCDqqqWcDrWufylh9v/ijkT9FH iv95qAObTEKiDhW97jlw3rijq/tPbqjLq75uzKK+TaVI33E5RgoB4MH6CPKBBH18PHRE ApG3g6k73s32KHM7RjrkNJr/KhU3UuRUw29lCI7id7lyKDx2PRgIK/k9wwpm1qQzc7lH eYtMgKjejx2C6JB7/wPobjvaKW/z/0Ea0OxM92fe2jX8Z0aTVTCW2BWa9xNhrXDa+U2U NvtrBEN+3oWjV40RTP0ncoRu5ZiaQ41oCKldgrIpBNbi65DcaQAPfmY2HSZ++FWFkPf4 opgQ== X-Gm-Message-State: APjAAAW1bPD5c+mpY1hXoZeFfzPj2ivarln0kmD7U9aw9r5L0tRZXDYW MITvpRojmnxxRZXIwcHo4iUgx7nJ0OaHyxsuF//m+PsKTjAIubCQ8n58moHkjPFhlh6uwue4WHg BPfsZeEuRzB7qAeqqi7r1E4zHQoU+gawMlYkDKxa7mKEtXjwVeCUEOh+4eybooOuwD91t59VSLP DR/dCBv29MR0QDBglNs0+o X-Google-Smtp-Source: APXvYqwUng7eM3CqmutqMEppLdT/siRjkW2QaSVy9RoRkj3j3uyYmu4k7PrJQCM71ZYrThbtr3Y18Q== X-Received: by 2002:a62:4115:: with SMTP id o21mr45774329pfa.153.1556271561816; Fri, 26 Apr 2019 02:39:21 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:21 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 18/21] megaraid_sas: Add debug prints for device list Date: Fri, 26 Apr 2019 02:37:12 -0700 Message-Id: <1556271435-27252-19-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Add debug prints related to device list being returned by firmware. The a debug flag to activate these prints. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 35 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 8df6ef01785e..840506f2f33c 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1499,6 +1499,7 @@ struct megasas_ctrl_info { /* Driver's internal Logging levels*/ #define OCR_DEBUG (1 << 0) #define TM_DEBUG (1 << 1) +#define LD_PD_DEBUG (1 << 2) #define SCAN_PD_CHANNEL 0x1 #define SCAN_VD_CHANNEL 0x2 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index b1aedfb0963e..29fe77a8d2a6 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4512,6 +4512,9 @@ megasas_get_pd_list(struct megasas_instance *instance) case DCMD_SUCCESS: pd_addr = ci->addr; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, sysPD count: 0x%x\n", + __func__, le32_to_cpu(ci->count)); if ((le32_to_cpu(ci->count) > (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) @@ -4527,6 +4530,11 @@ megasas_get_pd_list(struct megasas_instance *instance) pd_addr->scsiDevType; instance->local_pd_list[le16_to_cpu(pd_addr->deviceId)].driveState = MR_PD_STATE_SYSTEM; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "PD%d: targetID: 0x%03x deviceType:0x%x\n", + pd_index, le16_to_cpu(pd_addr->deviceId), + pd_addr->scsiDevType); pd_addr++; } @@ -4630,6 +4638,10 @@ megasas_get_ld_list(struct megasas_instance *instance) break; case DCMD_SUCCESS: + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, LD count: 0x%x\n", + __func__, ld_count); + if (ld_count > instance->fw_supported_vd_count) break; @@ -4639,6 +4651,10 @@ megasas_get_ld_list(struct megasas_instance *instance) if (ci->ldList[ld_index].state != 0) { ids = ci->ldList[ld_index].ref.targetId; instance->ld_ids[ids] = ci->ldList[ld_index].ref.targetId; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "LD%d: targetID: 0x%03x\n", + ld_index, ids); } } @@ -4742,6 +4758,10 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type) case DCMD_SUCCESS: tgtid_count = le32_to_cpu(ci->count); + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, LD count: 0x%x\n", + __func__, tgtid_count); + if ((tgtid_count > (instance->fw_supported_vd_count))) break; @@ -4749,6 +4769,9 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type) for (ld_index = 0; ld_index < tgtid_count; ld_index++) { ids = ci->targetId[ld_index]; instance->ld_ids[ids] = ci->targetId[ld_index]; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "LD%d: targetID: 0x%03x\n", + ld_index, ci->targetId[ld_index]); } break; @@ -4828,6 +4851,10 @@ megasas_host_device_list_query(struct megasas_instance *instance, */ count = le32_to_cpu(ci->count); + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, "%s, Device count: 0x%x\n", + __func__, count); + memset(instance->local_pd_list, 0, MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)); memset(instance->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT); @@ -4839,8 +4866,16 @@ megasas_host_device_list_query(struct megasas_instance *instance, ci->host_device_list[i].scsi_type; instance->local_pd_list[target_id].driveState = MR_PD_STATE_SYSTEM; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "Device %d: PD targetID: 0x%03x deviceType:0x%x\n", + i, target_id, ci->host_device_list[i].scsi_type); } else { instance->ld_ids[target_id] = target_id; + if (megasas_dbg_lvl & LD_PD_DEBUG) + dev_info(&instance->pdev->dev, + "Device %d: LD targetID: 0x%03x\n", + i, target_id); } } From patchwork Fri Apr 26 09:37:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918963 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 EE0721390 for ; Fri, 26 Apr 2019 09:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD30A28D55 for ; Fri, 26 Apr 2019 09:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D18ED28D69; Fri, 26 Apr 2019 09:39:27 +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 6F4F428D55 for ; Fri, 26 Apr 2019 09:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbfDZJj1 (ORCPT ); Fri, 26 Apr 2019 05:39:27 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33454 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJj1 (ORCPT ); Fri, 26 Apr 2019 05:39:27 -0400 Received: by mail-pg1-f194.google.com with SMTP id k19so1375285pgh.0 for ; Fri, 26 Apr 2019 02:39:26 -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=vdkio3QBlD5zsBnzYoszfBeSpqkcWZqqW1rk0pQR2sE=; b=SS6V2Cd6SNw/yORJkZ1Zknew5l2mHG0iH6FkosAYnLeJutBC+mwuW11SHcht9tX+M0 TFaDvfiZmMG8VYWqM5SREPii6LmRF4bJ2VVOaxbAKChfHsboW/9p4awa0MP1wGLNv1vO a8+m+8ZwhnCwwSd67vSb/QpJTQQmzAEvVaUwU= 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=vdkio3QBlD5zsBnzYoszfBeSpqkcWZqqW1rk0pQR2sE=; b=K5gePVoZR7Nqbvv2BiHrW9WZdNLErJVxk0eQHOnr4weNFpbvVhFMToiaHSVFKzEb1J GdmprOFeam9d8PVFxkrAdpwDguMYK9jCoQqRkaLvrO6YCESAiN+BzdFaH+PuiGnVnxDc P8M3dXqfoNY5dL39oJ3FswgeU1Y04mQe7ZiLQUXlF8Yd05B6IcJFlBzmLgmYCHh6w59w y2j2IOr4FibcL/01aeuqKfQoIPL9dxW2Y/ABy2X3ChydjBK3qGHKNAeoH2ZrF/5Bpk3U ortcNYDR/aAu7MG4tI46VVoZwwZWcQsHMqGQ1JTjlhWHd18Z8Tj4v0GrRDWGTOvj6QKM RKtA== X-Gm-Message-State: APjAAAXYomrQBDuIXJKLtqoYPbBRwR7cAyM1fNRip+CJ+E/ffj1JhVph HInYKNuWdIIov2EosX/0m3MqzmMHSmh7EAohC+qxnLr2/9AclVr3txFeStBVbnJdcA0e3SjLWp8 takilKz5xQ0lFaoycDAuKHCBee840j0jw3kVexBIPnZSjGXW4ZS9Hm+UDdZMhphBZIzWcJThA/b YbORyIpegqbGA53QumVygJ X-Google-Smtp-Source: APXvYqzhsi4gTMEEd5LrmYzoHJR4oN49izNLUHoacehfJ4iWh84xsHjvvNrow1Uw7BMTio65YiLtUQ== X-Received: by 2002:a63:e042:: with SMTP id n2mr42080351pgj.45.1556271565894; Fri, 26 Apr 2019 02:39:25 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:25 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 19/21] megaraid_sas: Fix MSI-x vector print Date: Fri, 26 Apr 2019 02:37:13 -0700 Message-Id: <1556271435-27252-20-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Print FW supported MSI-x vector count only if FW supports MSI-x. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 29fe77a8d2a6..18e157e3a99f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5681,7 +5681,7 @@ static int megasas_init_fw(struct megasas_instance *instance) void *base_addr_phys; struct megasas_ctrl_info *ctrl_info = NULL; unsigned long bar_list; - int i, j, loop, fw_msix_count = 0; + int i, j, loop; struct IOV_111 *iovPtr; struct fusion_context *fusion; @@ -5802,7 +5802,6 @@ static int megasas_init_fw(struct megasas_instance *instance) /* Thunderbolt Series*/ instance->msix_vectors = (scratch_pad_1 & MR_MAX_REPLY_QUEUES_OFFSET) + 1; - fw_msix_count = instance->msix_vectors; } else { instance->msix_vectors = ((scratch_pad_1 & MR_MAX_REPLY_QUEUES_EXT_OFFSET) @@ -5837,7 +5836,6 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->smp_affinity_enable = false; } - fw_msix_count = instance->msix_vectors; /* Save 1-15 reply post index address to local memory * Index 0 is already saved from reg offset * MPI2_REPLY_POST_HOST_INDEX_OFFSET @@ -5850,6 +5848,10 @@ static int megasas_init_fw(struct megasas_instance *instance) + (loop * 0x10)); } } + + dev_info(&instance->pdev->dev, + "firmware supports msix\t: (%d)", + instance->msix_vectors); if (msix_vectors) instance->msix_vectors = min(msix_vectors, instance->msix_vectors); @@ -5892,8 +5894,6 @@ static int megasas_init_fw(struct megasas_instance *instance) megasas_setup_reply_map(instance); - dev_info(&instance->pdev->dev, - "firmware supports msix\t: (%d)", fw_msix_count); dev_info(&instance->pdev->dev, "current msix/online cpus\t: (%d/%d)\n", instance->msix_vectors, (unsigned int)num_online_cpus()); From patchwork Fri Apr 26 09:37:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918965 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 47AE61575 for ; Fri, 26 Apr 2019 09:39:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3296828D55 for ; Fri, 26 Apr 2019 09:39:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2333928D69; Fri, 26 Apr 2019 09:39: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 4361428D55 for ; Fri, 26 Apr 2019 09:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726329AbfDZJjd (ORCPT ); Fri, 26 Apr 2019 05:39:33 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44289 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbfDZJjb (ORCPT ); Fri, 26 Apr 2019 05:39:31 -0400 Received: by mail-pf1-f196.google.com with SMTP id y13so1424616pfm.11 for ; Fri, 26 Apr 2019 02:39: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=smTrVtsYE5boFxND9T/fEKY4g3GIikGprJtcj/rVbpY=; b=SLfyzj5nOaQp0RZ2Kfj2/r3RUaxUOBnUiRkVAlzxfa13oXSbbece+IKcSYjQxMDp0F 1HZ/RDGoC2culo9czho+AVwMX9PnVJUKRcemjDkBKWZq8zFLo3pg1bCUCEmcLlWHVx5H FBEQG2PbXO1WTiOVQssu8zgnCFZKqMP5MHufI= 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=smTrVtsYE5boFxND9T/fEKY4g3GIikGprJtcj/rVbpY=; b=kmHwFFCNqpaX97pp+osIj5JM2+bGdVQ9tcSQRnHa1oyGBeQZit5zdbqCfUNuWcTn28 t0Y5wxXcblztZpsFAUPg7ZtGxJ9vVK9dKE5mNfRcb3aZD/YwKEyAB01haea5TtNWKLPa QfcnyR30/+qsVGDXtKIlEhxnTZnGoZUP2RK/Vovxpd0CdsDFWtuqTZU3b4D54Da+hs68 aJoCQgzgcp/ybNTWHrgAUQ7pa1/BhLQ+Nu0Xdmp1ql+STFYZDOPKO//lJTlyrKZjKmgI 29wMggHh85NbUG3KHWvzrQiP/xXptx+Bie4s2EuDHzgHO/B8uBogb/nZua+bxhYn5Jpp a0mw== X-Gm-Message-State: APjAAAVGvrN8bpApP939gC1Cuv9xVNV3XrSOvqiGhfAm1e51eX339SLX VAce2BheAD6gTYFSojzDe0nNozR0ZbQreVfgI+HXhGQtvziYuGZvpDC6JwvoVTipYguygoGuJxX TzEUw8w+xACviBNjv8y1BTHV2CEKmBkKbwrMnyjf6f2ppgXxjX1dVGBfiOhMNhnKsFEZn0j8Q3p YS1TZMkDv74aVs2kEN7Bxl X-Google-Smtp-Source: APXvYqxAsEtSveJvjLiMriQQIkwzdsj5c1tkjYGpoWIlwsbGZhMqQwbvV6EcMNORK/lazNakTneHng== X-Received: by 2002:a63:5a1d:: with SMTP id o29mr43288149pgb.320.1556271569868; Fri, 26 Apr 2019 02:39:29 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:29 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 20/21] megaraid_sas: Export RAID map through debugfs Date: Fri, 26 Apr 2019 02:37:14 -0700 Message-Id: <1556271435-27252-21-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 Create a debugfs interface for megaraid_sas driver. Provide interface to dump driver RAID map in debugfs. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/Makefile | 2 +- drivers/scsi/megaraid/megaraid_sas.h | 4 + drivers/scsi/megaraid/megaraid_sas_base.c | 14 +++ drivers/scsi/megaraid/megaraid_sas_debugfs.c | 180 +++++++++++++++++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.h | 5 + 5 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 drivers/scsi/megaraid/megaraid_sas_debugfs.c diff --git a/drivers/scsi/megaraid/Makefile b/drivers/scsi/megaraid/Makefile index 6e74d21227a5..12177e4cae65 100644 --- a/drivers/scsi/megaraid/Makefile +++ b/drivers/scsi/megaraid/Makefile @@ -3,4 +3,4 @@ obj-$(CONFIG_MEGARAID_MM) += megaraid_mm.o obj-$(CONFIG_MEGARAID_MAILBOX) += megaraid_mbox.o obj-$(CONFIG_MEGARAID_SAS) += megaraid_sas.o megaraid_sas-objs := megaraid_sas_base.o megaraid_sas_fusion.o \ - megaraid_sas_fp.o + megaraid_sas_fp.o megaraid_sas_debugfs.o diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 840506f2f33c..56b3204d3fc6 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -2390,6 +2390,10 @@ struct megasas_instance { u8 task_abort_tmo; u8 max_reset_tmo; u8 snapdump_wait_time; +#ifdef CONFIG_DEBUG_FS + struct dentry *debugfs_root; + struct dentry *raidmap_dump; +#endif u8 enable_fw_dev_list; }; struct MR_LD_VF_MAP { diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 18e157e3a99f..e8fdf90e3a40 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -188,6 +188,12 @@ static bool support_nvme_encapsulation; /* define lock for aen poll */ spinlock_t poll_aen_lock; +extern struct dentry *megasas_debugfs_root; +extern void megasas_init_debugfs(void); +extern void megasas_exit_debugfs(void); +extern void megasas_setup_debugfs(struct megasas_instance *instance); +extern void megasas_destroy_debugfs(struct megasas_instance *instance); + void megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, u8 alt_status); @@ -7141,6 +7147,8 @@ static int megasas_probe_one(struct pci_dev *pdev, goto fail_start_aen; } + megasas_setup_debugfs(instance); + /* Get current SR-IOV LD/VF affiliation */ if (instance->requestorId) megasas_get_ld_vf_affiliation(instance, 1); @@ -7611,6 +7619,8 @@ static void megasas_detach_one(struct pci_dev *pdev) megasas_free_ctrl_mem(instance); + megasas_destroy_debugfs(instance); + scsi_host_put(host); pci_disable_device(pdev); @@ -8538,6 +8548,8 @@ static int __init megasas_init(void) megasas_mgmt_majorno = rval; + megasas_init_debugfs(); + /* * Register ourselves as PCI hotplug module */ @@ -8597,6 +8609,7 @@ static int __init megasas_init(void) err_dcf_attr_ver: pci_unregister_driver(&megasas_pci_driver); err_pcidrv: + megasas_exit_debugfs(); unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); return rval; } @@ -8619,6 +8632,7 @@ static void __exit megasas_exit(void) &driver_attr_support_nvme_encapsulation); pci_unregister_driver(&megasas_pci_driver); + megasas_exit_debugfs(); unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } diff --git a/drivers/scsi/megaraid/megaraid_sas_debugfs.c b/drivers/scsi/megaraid/megaraid_sas_debugfs.c new file mode 100644 index 000000000000..e52837bb6807 --- /dev/null +++ b/drivers/scsi/megaraid/megaraid_sas_debugfs.c @@ -0,0 +1,180 @@ +/* + * Linux MegaRAID driver for SAS based RAID controllers + * + * Copyright (c) 2003-2018 LSI Corporation. + * Copyright (c) 2003-2018 Avago Technologies. + * Copyright (c) 2003-2018 Broadcom Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: Broadcom Inc. + * Kashyap Desai + * Sumit Saxena + * Shivasharan S + * + * Send feedback to: megaraidlinux.pdl@broadcom.com + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "megaraid_sas_fusion.h" +#include "megaraid_sas.h" + +#ifdef CONFIG_DEBUG_FS +#include + +struct dentry *megasas_debugfs_root; + +static ssize_t +megasas_debugfs_read(struct file *filp, char __user *ubuf, size_t cnt, + loff_t *ppos) +{ + struct megasas_debugfs_buffer *debug = filp->private_data; + + if (!debug || !debug->buf) + return 0; + + return simple_read_from_buffer(ubuf, cnt, ppos, debug->buf, debug->len); +} + +static int +megasas_debugfs_raidmap_open(struct inode *inode, struct file *file) +{ + struct megasas_instance *instance = inode->i_private; + struct megasas_debugfs_buffer *debug; + struct fusion_context *fusion; + + fusion = instance->ctrl_context; + + debug = kzalloc(sizeof(struct megasas_debugfs_buffer), GFP_KERNEL); + if (!debug) + return -ENOMEM; + + debug->buf = (void *)fusion->ld_drv_map[(instance->map_id & 1)]; + debug->len = fusion->drv_map_sz; + file->private_data = debug; + + return 0; +} + +static int +megasas_debugfs_release(struct inode *inode, struct file *file) +{ + struct megasas_debug_buffer *debug = file->private_data; + + if (!debug) + return 0; + + file->private_data = NULL; + kfree(debug); + return 0; +} + +static const struct file_operations megasas_debugfs_raidmap_fops = { + .owner = THIS_MODULE, + .open = megasas_debugfs_raidmap_open, + .read = megasas_debugfs_read, + .release = megasas_debugfs_release, +}; + +/* + * megasas_init_debugfs : Create debugfs root for megaraid_sas driver + */ +void megasas_init_debugfs(void) +{ + megasas_debugfs_root = debugfs_create_dir("megaraid_sas", NULL); + if (!megasas_debugfs_root) + pr_info("Cannot create debugfs root\n"); +} + +/* + * megasas_exit_debugfs : Remove debugfs root for megaraid_sas driver + */ +void megasas_exit_debugfs(void) +{ + debugfs_remove_recursive(megasas_debugfs_root); +} + +/* + * megasas_setup_debugfs : Setup debugfs per Fusion adapter + * instance: Soft instance of adapter + */ +void +megasas_setup_debugfs(struct megasas_instance *instance) +{ + char name[64]; + struct fusion_context *fusion; + + fusion = instance->ctrl_context; + + if (fusion) { + snprintf(name, sizeof(name), + "scsi_host%d", instance->host->host_no); + if (!instance->debugfs_root) { + instance->debugfs_root = + debugfs_create_dir(name, megasas_debugfs_root); + if (!instance->debugfs_root) { + dev_err(&instance->pdev->dev, + "Cannot create per adapter debugfs directory\n"); + return; + } + } + + snprintf(name, sizeof(name), "raidmap_dump"); + instance->raidmap_dump = + debugfs_create_file(name, S_IRUGO, + instance->debugfs_root, instance, + &megasas_debugfs_raidmap_fops); + if (!instance->raidmap_dump) { + dev_err(&instance->pdev->dev, + "Cannot create raidmap debugfs file\n"); + debugfs_remove(instance->debugfs_root); + return; + } + } + +} + +/* + * megasas_destroy_debugfs : Destroy debugfs per Fusion adapter + * instance: Soft instance of adapter + */ +void megasas_destroy_debugfs(struct megasas_instance *instance) +{ + debugfs_remove_recursive(instance->debugfs_root); +} + +#else +void megasas_init_debugfs(void) +{ +} +void megasas_exit_debugfs(void) +{ +} +void megasas_setup_debugfs(struct megasas_instance *instance) +{ +} +void megasas_destroy_debugfs(struct megasas_instance *instance) +{ +} +#endif /*CONFIG_DEBUG_FS*/ diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 160ac16941fe..98738290c533 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -1360,6 +1360,11 @@ struct MR_SNAPDUMP_PROPERTIES { u8 reserved[12]; }; +struct megasas_debugfs_buffer { + void *buf; + u32 len; +}; + void megasas_free_cmds_fusion(struct megasas_instance *instance); int megasas_ioc_init_fusion(struct megasas_instance *instance); u8 megasas_get_map_info(struct megasas_instance *instance); From patchwork Fri Apr 26 09:37:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918967 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 316B81575 for ; Fri, 26 Apr 2019 09:39:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20E1828D55 for ; Fri, 26 Apr 2019 09:39:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 135C028D69; Fri, 26 Apr 2019 09:39:36 +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 B112E28D55 for ; Fri, 26 Apr 2019 09:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726336AbfDZJjf (ORCPT ); Fri, 26 Apr 2019 05:39:35 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35288 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbfDZJjf (ORCPT ); Fri, 26 Apr 2019 05:39:35 -0400 Received: by mail-pl1-f194.google.com with SMTP id w24so1304628plp.2 for ; Fri, 26 Apr 2019 02:39:34 -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=4z2u4bzz9iAHqXSwhW/gdsQ9hBMNYvHh74EOpQ3IDEw=; b=Wc0NhZisTszSHJFXrff56OjxgMbototR9q/cBRC0QPPJEUOaadhtYO29Hhjz0jhLXO afwMrVFkSi9mzu7cNulOZ5WahQ+iBIp8fdVVV8T+IcPxFdeEJjodcM30dlPbjdAcLfes kXCjyZsnl3+h0x0uaG3pVfCrvvWZlm3irLOXI= 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=4z2u4bzz9iAHqXSwhW/gdsQ9hBMNYvHh74EOpQ3IDEw=; b=gxlihCyDyxXrua9rjgceZPs+i2LDVcuD9itwbP41CE8K5rZDxGqiJ5r+nZ7Y8CvNz4 /6ZfgUus3KkMPMp1L3T8O+0DfII2A7Ktt3178QIUjTLI90gHNIdFXQa1uI7o9mK+cS8Q L6P9z71186Gc+iY5QTVOzNbsUYCsxDftVxKuHl3HNn/jhv/AoL+RKYBGzh7+936cI7W6 t8qPTGz+kWtAbUYKN585z5LfyZ0alVbMSkOtbe6cqGaJmRmwxk6gCc+mIwujM2gvlgPV 53KBcMaZT8PuPgdEHNyqgpJDV636Gt0KEqHceccnfVGZQgeLLNwAkYIICX89+7bSJUQP KaDg== X-Gm-Message-State: APjAAAWi7Z4LfXCgYyBWnXLpA1mrQIFeRFUNeZvX2hzcYtT+nD0b4Qz3 ArP+A9fqNWdI5KxnIAyUjhNKv+JI2vdb3vnS8yv04p1XaGX59v/ewvZHUvQHbD2Kn3F6LDvq8hr kB7noxXs+75BVIA1cX8oikdNEIcYKJNOwSGBNJN4OQwhaK6PiuXR2gRc7Wp7/Dz06O9Nptu4rFN GBIoZD8kiTS5k8L3X4Vc0g X-Google-Smtp-Source: APXvYqzKj2ovbKF71rGYU7FppX+nBhRu11tbeC9OXgNK+ujVLCh5wAWtvDK/f/EkfZaPul9+8hYufQ== X-Received: by 2002:a17:902:2d04:: with SMTP id o4mr45467127plb.88.1556271573931; Fri, 26 Apr 2019 02:39:33 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.39.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:39:33 -0700 (PDT) From: Shivasharan S 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, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 21/21] megaraid_sas: Update driver version to 07.708.03.00 Date: Fri, 26 Apr 2019 02:37:15 -0700 Message-Id: <1556271435-27252-22-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@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 --- 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 56b3204d3fc6..e138d1447e43 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.707.51.00-rc1" -#define MEGASAS_RELDATE "February 7, 2019" +#define MEGASAS_VERSION "07.708.03.00-rc1" +#define MEGASAS_RELDATE "March 14, 2019" /* * Device IDs