From patchwork Wed Sep 14 08:47:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guixin Liu X-Patchwork-Id: 12975830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CBF1ECAAD3 for ; Wed, 14 Sep 2022 08:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbiINIsX (ORCPT ); Wed, 14 Sep 2022 04:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbiINIsW (ORCPT ); Wed, 14 Sep 2022 04:48:22 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A4FE6A487 for ; Wed, 14 Sep 2022 01:48:17 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VPmeSKn_1663145290; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0VPmeSKn_1663145290) by smtp.aliyun-inc.com; Wed, 14 Sep 2022 16:48:14 +0800 From: Guixin Liu To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH 1/5] scsi: megaraid_sas: correct the parameter of scsi_device_lookup Date: Wed, 14 Sep 2022 16:47:59 +0800 Message-Id: <1663145283-4872-2-git-send-email-kanie@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> References: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When a delete event is received, find the scsi_device and remove it, the scsi_device_lookup`s parameter id should be "ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL". Fixes: ae6874ba4b43 ("scsi: megaraid_sas: Early detection of VD deletion through RaidMap update") Signed-off-by: Guixin Liu Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7f8632c..44d5e93 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -8922,7 +8922,7 @@ void megasas_add_remove_devices(struct megasas_instance *instance, sdev1 = scsi_device_lookup(instance->host, MEGASAS_MAX_PD_CHANNELS + (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), - (ld_target_id - MEGASAS_MAX_DEV_PER_CHANNEL), + (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL), 0); dev_info(&instance->pdev->dev, "Debug_lgx: ld_target_id:%u, sdev1:%p.\n", ld_target_id, sdev1); From patchwork Wed Sep 14 08:48:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guixin Liu X-Patchwork-Id: 12975831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CCD2ECAAD8 for ; Wed, 14 Sep 2022 08:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbiINIsa (ORCPT ); Wed, 14 Sep 2022 04:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbiINIsZ (ORCPT ); Wed, 14 Sep 2022 04:48:25 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2646696E9 for ; Wed, 14 Sep 2022 01:48:23 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VPmX.Sr_1663145295; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0VPmX.Sr_1663145295) by smtp.aliyun-inc.com; Wed, 14 Sep 2022 16:48:21 +0800 From: Guixin Liu To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH 2/5] scsi: megaraid_sas: correct an error message Date: Wed, 14 Sep 2022 16:48:00 +0800 Message-Id: <1663145283-4872-3-git-send-email-kanie@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> References: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Correct the error message when alloc init request fail. Signed-off-by: Guixin Liu Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 44d5e93..4973c9c 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7224,7 +7224,7 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) if (!fusion->ioc_init_request) { dev_err(&pdev->dev, - "Failed to allocate PD list buffer\n"); + "Failed to allocate ioc init request\n"); return -ENOMEM; } From patchwork Wed Sep 14 08:48:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guixin Liu X-Patchwork-Id: 12975832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E726DECAAD3 for ; Wed, 14 Sep 2022 08:48:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbiINIsm (ORCPT ); Wed, 14 Sep 2022 04:48:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbiINIsb (ORCPT ); Wed, 14 Sep 2022 04:48:31 -0400 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6E0C6F54E for ; Wed, 14 Sep 2022 01:48:29 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R991e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VPmY40c_1663145302; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0VPmY40c_1663145302) by smtp.aliyun-inc.com; Wed, 14 Sep 2022 16:48:27 +0800 From: Guixin Liu To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH 3/5] scsi: megaraid_sas: simplify the megasas_update_device_list Date: Wed, 14 Sep 2022 16:48:01 +0800 Message-Id: <1663145283-4872-4-git-send-email-kanie@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> References: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove unnecessary dcmd_ret check and go to statements. Signed-off-by: Guixin Liu Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas_base.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 4973c9c..1ac33b1 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -8766,33 +8766,26 @@ static inline void megasas_remove_scsi_device(struct scsi_device *sdev) int megasas_update_device_list(struct megasas_instance *instance, int event_type) { - int dcmd_ret = DCMD_SUCCESS; + int dcmd_ret; if (instance->enable_fw_dev_list) { - dcmd_ret = megasas_host_device_list_query(instance, false); - if (dcmd_ret != DCMD_SUCCESS) - goto out; + return megasas_host_device_list_query(instance, false); } else { if (event_type & SCAN_PD_CHANNEL) { dcmd_ret = megasas_get_pd_list(instance); - if (dcmd_ret != DCMD_SUCCESS) - goto out; + return dcmd_ret; } if (event_type & SCAN_VD_CHANNEL) { if (!instance->requestorId || megasas_get_ld_vf_affiliation(instance, 0)) { - dcmd_ret = megasas_ld_list_query(instance, + return megasas_ld_list_query(instance, MR_LD_QUERY_TYPE_EXPOSED_TO_HOST); - if (dcmd_ret != DCMD_SUCCESS) - goto out; } } } - -out: - return dcmd_ret; + return DCMD_SUCCESS; } /** From patchwork Wed Sep 14 08:48:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guixin Liu X-Patchwork-Id: 12975833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6D2DC6FA89 for ; Wed, 14 Sep 2022 08:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbiINIsn (ORCPT ); Wed, 14 Sep 2022 04:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbiINIsg (ORCPT ); Wed, 14 Sep 2022 04:48:36 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0231172B6A for ; Wed, 14 Sep 2022 01:48:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R691e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VPmeSTT_1663145307; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0VPmeSTT_1663145307) by smtp.aliyun-inc.com; Wed, 14 Sep 2022 16:48:31 +0800 From: Guixin Liu To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH 4/5] scsi: megaraid_sas: remove unnecessary memset Date: Wed, 14 Sep 2022 16:48:02 +0800 Message-Id: <1663145283-4872-5-git-send-email-kanie@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> References: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove memset pd_list and ld_ids in megasas_get_device_list, because they will be memset in megasas_host_device_list_query or megasas_get_pd_list and megasas_ld_list_query. Signed-off-by: Guixin Liu Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas_base.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 1ac33b1..b5503f9 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5878,10 +5878,6 @@ static void megasas_setup_reply_map(struct megasas_instance *instance) static int megasas_get_device_list(struct megasas_instance *instance) { - memset(instance->pd_list, 0, - (MEGASAS_MAX_PD * sizeof(struct megasas_pd_list))); - memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); - if (instance->enable_fw_dev_list) { if (megasas_host_device_list_query(instance, true)) return FAILED; From patchwork Wed Sep 14 08:48:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guixin Liu X-Patchwork-Id: 12975834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF63ECAAD3 for ; Wed, 14 Sep 2022 08:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbiINIsp (ORCPT ); Wed, 14 Sep 2022 04:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbiINIsj (ORCPT ); Wed, 14 Sep 2022 04:48:39 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 462916A487 for ; Wed, 14 Sep 2022 01:48:38 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VPmWGJJ_1663145311; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0VPmWGJJ_1663145311) by smtp.aliyun-inc.com; Wed, 14 Sep 2022 16:48:36 +0800 From: Guixin Liu To: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org Subject: [PATCH 5/5] scsi: megaraid_sas: move megasas_dbg_lvl init to megasas_init Date: Wed, 14 Sep 2022 16:48:03 +0800 Message-Id: <1663145283-4872-6-git-send-email-kanie@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> References: <1663145283-4872-1-git-send-email-kanie@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The megasas_dbg_lvl is a driver level parameter, dont init in probe path, otherwise we can not see any debug print when bind a device to megaraid driver. Signed-off-by: Guixin Liu Acked-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index b5503f9..66f84b5 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -7439,7 +7439,6 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) instance->flag_ieee = 1; - megasas_dbg_lvl = 0; instance->flag = 0; instance->unload = 1; instance->last_time = 0; @@ -9011,6 +9010,7 @@ static int __init megasas_init(void) */ pr_info("megasas: %s\n", MEGASAS_VERSION); + megasas_dbg_lvl = 0; support_poll_for_event = 2; support_device_change = 1; support_nvme_encapsulation = true;