From patchwork Thu Feb 24 10:11:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12758304 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 DB4FCC433EF for ; Thu, 24 Feb 2022 10:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233260AbiBXKMI (ORCPT ); Thu, 24 Feb 2022 05:12:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232278AbiBXKMG (ORCPT ); Thu, 24 Feb 2022 05:12:06 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC5DD193DE for ; Thu, 24 Feb 2022 02:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645697496; x=1677233496; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=S4zEpoMx77CN+B2oXbx0vq9Ww9LaJo0Ni4rWb11orHw=; b=C97suqyQmCWAx7MiTlor1ZO69xlmIlU7wxYGD+y76/xcYfFM8QWpnzZf 1hISizY1rNCLxeLDsxgpmLLwLQWR+v49RQszNBZzUXb5XyFCgMQwstX+z bhvCmvM2dM4ZRaGJduIqrXeDXubpo4xlNFRLGovDEjTfVfjy894BsGx5X hxDBL6b4PcnSQOEjr2MDCxG5N/rPTGXHG3yhbij19ioCbhCGelCWMxwdz 3s0rS2whrqU+ZUSw0CKPGhl5Aj+2l/G8lcgiuvoWXoORjtLszLp3fI3Gq cso0ezN+CEaIsUQV6dkroBiqHlFt+4bv3Owbh1f3iSGg7nVst7npxgMVN w==; X-IronPort-AV: E=Sophos;i="5.88,393,1635177600"; d="scan'208";a="297965112" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Feb 2022 18:11:35 +0800 IronPort-SDR: X1a5OKG4LbTSd1gK5RfNm2GpXHC5zgTMiK1bbWeqMkpIcomAUBxNYJ8pFpKt25XYbB7Aj2x5Pa t1q7Z4Kf7CHXzXXd7aO3YTA+eHfjMmqLXj0spDAZE/nbAxhRRp47zA9TqfN+kn2yhEkZznk/v8 CjIQqIs93gJMHj99wBR2qh6TVfWQSHkIdN5nvi3zTvPQXpy5TodXgnq6aKJn0Z5+Qxxrxw05Kv TS4ATcbheEb60Teqj28IONe321cEkqpsMvxAhVbsmPc+PSJ+ViYT8mYinFf6zPd1g2YpoEnB90 fXBa86Nv0Xi1TkZpdC1nq7so Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 01:43:06 -0800 IronPort-SDR: qFHVTfG46k9qbR9qGMc7q/MHqkwpR//odlx/rDl+D5qefnD8q1wZlEymrboOT/3Rd2KKBTqrKM sw9NIKCAP9FpDtEAnilir37TGOmUcdZgogLVmhAKTDGJfLXxGE/JQsXzu1HkKRUlWn86ghBnss Qf03sbdlRtaUnf6CWZvxBniJWtOmj/E6/6wSA1ZJ+p0Inz+63xWOG7M3TbWN/GfFCFHjl5yOm7 INmu7uAuvAaclQpdG7CFegwBz9SrwsGqTLi2/4oEvVfB+Kzyor0UgIR1PwDfYtVGdWowPCSsS3 32g= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 02:11:35 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K47wl3skKz1SVp2 for ; Thu, 24 Feb 2022 02:11:35 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645697495; x=1648289496; bh=S4zEpoMx77CN+B2oXb x0vq9Ww9LaJo0Ni4rWb11orHw=; b=SjDrj/4+adhqk/ly002+uElAeEETjsmD4W ByrJ9vOh5eqmv2LTa+Tdi6/hn1vNXFKZ9zeKLwEtgO7zJDiPTrE8FvMv7eRUPPdA 6SA48dtI7a9wvkkgkHs1b6C1KA5pYRCYMd1UqQ5X3dARbuBjm7/0KbHwrKu9j+Ri 2dnd4cOqJo2fuMBdN96i/8KRifVwT105UCfXgu+upBN4sY63HgbwcgkWJ+Cd4Vv1 7h/7MvbVH7Ibt8PzJnXmgW7fIYjtDrxdHOVL1ncwWOv3A6lbuPcl+36wFQa5htb4 rHYYbqEfFRVDnwrSurwBJ7b6H3Fpim2cufdrCLEXgLu7u8yKEqIg== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KcUTO3r6coOW for ; Thu, 24 Feb 2022 02:11:35 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K47wk0BWqz1Rwrw; Thu, 24 Feb 2022 02:11:33 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH 1/5] scsi: mpt3sas: fix Mpi2SCSITaskManagementRequest_t TaskMID handling Date: Thu, 24 Feb 2022 19:11:25 +0900 Message-Id: <20220224101129.371905-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> References: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The TaskMID field of sturtc Mpi2SCSITaskManagementRequest_t seems to be a 16-bits little endian value but is not declared as such, causing sparse to generate warnings. Change this field declaration to __le16 and fix a test in _ctl_set_task_mid() to avoid sparse warnings. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpi/mpi2_init.h | 2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_init.h b/drivers/scsi/mpt3sas/mpi/mpi2_init.h index 8f1b903fe0a9..80bcf7d83184 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_init.h @@ -428,7 +428,7 @@ typedef struct _MPI2_SCSI_TASK_MANAGE_REQUEST { U16 Reserved3; /*0x0A */ U8 LUN[8]; /*0x0C */ U32 Reserved4[7]; /*0x14 */ - U16 TaskMID; /*0x30 */ + __le16 TaskMID; /*0x30 */ U16 Reserved5; /*0x32 */ } MPI2_SCSI_TASK_MANAGE_REQUEST, *PTR_MPI2_SCSI_TASK_MANAGE_REQUEST, diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index d92ca140d298..eac253fce2da 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c @@ -618,7 +618,8 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, * first outstanding smid will be picked up. Otherwise, * targeted smid will be the one. */ - if (!tm_request->TaskMID || tm_request->TaskMID == st->smid) { + if (!tm_request->TaskMID || + tm_request->TaskMID == cpu_to_le16(st->smid)) { tm_request->TaskMID = cpu_to_le16(st->smid); found = 1; } From patchwork Thu Feb 24 10:11:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12758306 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 C678CC433EF for ; Thu, 24 Feb 2022 10:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232995AbiBXKMJ (ORCPT ); Thu, 24 Feb 2022 05:12:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233163AbiBXKMH (ORCPT ); Thu, 24 Feb 2022 05:12:07 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A65561AF1F for ; Thu, 24 Feb 2022 02:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645697497; x=1677233497; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=OFmN811CwEBOyhUbY0uvSQICwH7isycEQM+uR5+NIlc=; b=Ybma6puu6QZZQLaAw17e7ahdc58CK9Vc5EY5alyXh0c9hYe9ZN4mNS4s ZylgbltIqSIKa2TiJ5S8PzVyH/XCGqmjam0ORXF1Msj3pVEZz2UU2BPky 2AWkJ7unSVQv470/mtlMV7KNtIwfkVOinzA5c2EG3EEo+PMzRV3xGOiHL tpIywaPimVRkuQupEDbv/nLW05CHyolMENdtIM9hBCENXIFHeE3isnBaS tXdfrfKDGzYwS8Gvm3IsJ7/Jpf+VWEV/O2Q6BrlH1jEzhesCH0vdoE1CS KoGnV9zrOvABfI0qtmsvaoegJ4SI830hPMsQad0VRD1f+Qqrbpkky0jgh w==; X-IronPort-AV: E=Sophos;i="5.88,393,1635177600"; d="scan'208";a="297965115" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Feb 2022 18:11:37 +0800 IronPort-SDR: wGEj/qBKUbBnxef/nSWhbgXl8L50fxlmp7IaMM9bBtMx78vWMF/d1ZQfDccDLAQumwpQirju/f n7ruNuBAQi3q5P9cWApLeiLi+a+cUpcNYlNExlwsG792nohC7BEQQ5DoMN2QhbVgu1rxL6bhxH SDP5uQwS2EjjmMTTCEsgepFGih7zKW/y9Y1wJdKNruTEsN5IBDekRoffJxmcdI2GXvW2+1yZJw 4vRRsLbQ5ENm1mEvtPrjxXzSnfcbh7rEz4iTw1cIF2hAWFPWG2v7OAIUZ7hH94Ly8yrsHF59JY M8fB6hbwBst6/0LQfEPD9mdI Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 01:43:07 -0800 IronPort-SDR: LR7UA6+qvZJz7AR3+g3aEBip9wtOfkuisBLCYIb+TC8cNJnV9hythiNyrnQnCJpBjKs1LYW+KH hgJvvslLk7QWJnysS73hZPBVUAyM3Bj9tPesisKNXJPqnvipg8ZbhACHQVgJKY9yNBs2BOYMKL XZv87oFSyYww/QGZn1NhxxBhkFg4mkD6eVUZQqN0oZlNqgZRXIYoYec3qHjoF8TbtL3VnoeiwF aTbYJR03GytS3TJr2TzHkrwJNcfRSghznPHHR/2RVA4XGhfHqPUDznHG8nPhms5Mj49loThlyO EVU= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 02:11:37 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K47wm6KwRz1SVp3 for ; Thu, 24 Feb 2022 02:11:36 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645697496; x=1648289497; bh=OFmN811CwEBOyhUbY0 uvSQICwH7isycEQM+uR5+NIlc=; b=Tl1gV3v+A/l9p83QPf+BFwN2q0OjnHmrVC ydejjTGWNt9Th4oKiL3HP0fDdOCqApxrpIDsOAPjFY31SGtsayyuqEnFkISNr6Ap wdYifVYTRL+/cu2GUUdNcb3uMo98rxS6kH09KqEcjfEucxhA9RTOAcJcXw+8K+X4 utYcnc5Qkf0GkLUyqP3Py+rL1MzWiglt8WnGwmTO2L0pWQlS/XHOAcibVdiNbsyL Si5GS1ysr4kcTafhTXGBZAGbvRMgcIm4KO5nHE+6K4XXvk128bXYVjqgduIlrs6x scsl43AwcfpyIpc74CIThP8R06RScgN61CQ787o+bPkXHEPi7poA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id h_K8PrwJXyaq for ; Thu, 24 Feb 2022 02:11:36 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K47wl2HD4z1Rvlx; Thu, 24 Feb 2022 02:11:35 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH 2/5] scsi: mpt3sas: Fix writel() use Date: Thu, 24 Feb 2022 19:11:26 +0900 Message-Id: <20220224101129.371905-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> References: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org writel() internally execute cpu_to_le32() to convert the vale being wrritten to little endian. The caller should thus not use this conversion function for the value passed to writel(). Remove the cpu_to_le32() calls in _base_put_smid_scsi_io_atomic(), _base_put_smid_fast_path_atomic(), _base_put_smid_hi_priority_atomic() _base_put_smid_default_atomic() amd _base_handshake_req_reply_wait(). Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 511726f92d9a..6ebdfedd84f5 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -4323,7 +4323,7 @@ _base_put_smid_scsi_io_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid, descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid); descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -4345,7 +4345,7 @@ _base_put_smid_fast_path_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid, descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid); descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -4368,7 +4368,7 @@ _base_put_smid_hi_priority_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid, descriptor.MSIxIndex = msix_task; descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -4389,7 +4389,7 @@ _base_put_smid_default_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid) descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid); descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -6906,7 +6906,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, /* send message 32-bits at a time */ for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) { - writel(cpu_to_le32(request[i]), &ioc->chip->Doorbell); + writel(request[i], &ioc->chip->Doorbell); if ((_base_wait_for_doorbell_ack(ioc, 5))) failed = 1; } From patchwork Thu Feb 24 10:11:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12758307 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 6A72AC433EF for ; Thu, 24 Feb 2022 10:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233269AbiBXKMR (ORCPT ); Thu, 24 Feb 2022 05:12:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233264AbiBXKMI (ORCPT ); Thu, 24 Feb 2022 05:12:08 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2DC72C125 for ; Thu, 24 Feb 2022 02:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645697498; x=1677233498; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=unaPc+bJDjDEi5zJ5BafAvJLsHIWC/zgKf9goBf7tAQ=; b=nuLTGHNBkFErfXzNhL1wbXnBAMWJrM2XA5RFbYi1byKmh2lH95IpRCsY V/wMmrFGpOypVxBlP/lViEy107R5iX05DZO4vJ2qXcZEYng3/Nk16Ej60 RoiY2w4S6bnVI9l9ml5zXXFQx/84TTmHFmq/R8cjfaWVqxvoRlLfLctrG EkCEADgyCFq4StIrkC/n1Jxb9Gdi7U8tfmJHOifo/kR4I6zs4gA4Qb4wx Lgdl1VUVZar5oZ5WmPaQybgR+KI9axI5o4SfHVT5/aEsQ077Y3aSLdwbK u15s0wr9CEi7z7w2sOdoGeDNJYgvf0om0ufmdAAh7LVM7nkfhVvCXQYV5 w==; X-IronPort-AV: E=Sophos;i="5.88,393,1635177600"; d="scan'208";a="297965118" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Feb 2022 18:11:38 +0800 IronPort-SDR: JqC8zctUljGBCLVKjtFLGQgbCPUOfN/oex92ZkFyOXotuv0BbdFX58viLQiZE+sPYEWmN1Ei2v o1uoyVm6RDm6SiUMo0JwR2Vtp6mpMihl041AsxKahZ3/0EdToUKK4OqeTclp9b1LSu5qEMUOQu Uq1JYJQ0WRHMSJ1gciCiabpnG2IdAZjC4lzGqW5RBYrPGH3DVCyCjeAR0qI8LsvzfwL3QwsZ1w 1/X5PWoEpgP84kN8OZBEWOnO22sQkoBMGp18EXouUOsprhKyefNAIQpfnNWNUoXH7G8aXA9+L2 KwFnYVa7tQzrdu4IVTTba1KE Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 01:43:08 -0800 IronPort-SDR: Q9hOYozxcNegkiOmyp+xlF/DMnTvxT/B9B4lHplgveJhtP+8u0ic+DQum7rJ4Uj7vONfFHIo9Q cZ0T921vm3LIYMAQfeYevHBsSfzDSlcC0JvAwBP80ICZonqTFjfELLnVFNV5lEzsrL4jM5rlQf EEuzdUBJ36ZLYMovMliK6yfipFQP966sPM30cx39EI0U/HXibGekNpT1qz9EbmHgdfD++eEFXC kVSXK1+JWuKUqTjylhi5nonveLrG3Zh6emkVUJC2k9rRJS0vK2ATdINSfnp0+49v2tQ6Gju3gm lWg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 02:11:38 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K47wp0Pq8z1SVnx for ; Thu, 24 Feb 2022 02:11:38 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645697497; x=1648289498; bh=unaPc+bJDjDEi5zJ5B afAvJLsHIWC/zgKf9goBf7tAQ=; b=hLp4XajfRCd+9vLZeBE1Puf/eYpUC4Dw1M ESyVtsg8brbjkvMmmEB9yL0A4pbrV4vEgDy7W/xFLPFVR+Gi1bth8TIXHtJQxiTA xqbKg+9wW2d37i69UQ20ZSVesjT8yTqS8O9Rb46Q9tmKD86s3EVtK1R9oi95EvzK vHk+63TGOCnIgzNCaCe5PYvHrI0lJhlKlmyIPoTBtX3fIIZjLlPaMMCHGsTjEhqr DX8wtu189O+QkT0DobuZXVrOoWv30+ZzMCnldzxAVecwmHbDIftb201PfVWmDrtH erY6NrxGe8XRz8JhKEVrvoHKjJpNValgwFMlVzmqwvNGIChGRQCw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cRhPaQwysYXe for ; Thu, 24 Feb 2022 02:11:37 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K47wm4kDPz1Rwrw; Thu, 24 Feb 2022 02:11:36 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH 3/5] scsi: mpt3sas: fix ioc->base_readl() use Date: Thu, 24 Feb 2022 19:11:27 +0900 Message-Id: <20220224101129.371905-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> References: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The functions _base_readl_aero() and _base_readl() used for an adapter base_readl() method are implemented using a regular readl() call which performs internally a conversion to CPU endianness (le32_to_cpu()) of the values read. The users of the ioc base_readl() method should thus not convert again the values read using le16_to_cpu(). Fixing this removes sparse warnings. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 6ebdfedd84f5..5efe4bd186db 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -6925,16 +6925,16 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, } /* read the first two 16-bits, it gives the total length of the reply */ - reply[0] = le16_to_cpu(ioc->base_readl(&ioc->chip->Doorbell) - & MPI2_DOORBELL_DATA_MASK); + reply[0] = ioc->base_readl(&ioc->chip->Doorbell) + & MPI2_DOORBELL_DATA_MASK; writel(0, &ioc->chip->HostInterruptStatus); if ((_base_wait_for_doorbell_int(ioc, 5))) { ioc_err(ioc, "doorbell handshake int failed (line=%d)\n", __LINE__); return -EFAULT; } - reply[1] = le16_to_cpu(ioc->base_readl(&ioc->chip->Doorbell) - & MPI2_DOORBELL_DATA_MASK); + reply[1] = ioc->base_readl(&ioc->chip->Doorbell) + & MPI2_DOORBELL_DATA_MASK; writel(0, &ioc->chip->HostInterruptStatus); for (i = 2; i < default_reply->MsgLength * 2; i++) { @@ -6946,9 +6946,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, if (i >= reply_bytes/2) /* overflow case */ ioc->base_readl(&ioc->chip->Doorbell); else - reply[i] = le16_to_cpu( - ioc->base_readl(&ioc->chip->Doorbell) - & MPI2_DOORBELL_DATA_MASK); + reply[i] = ioc->base_readl(&ioc->chip->Doorbell) + & MPI2_DOORBELL_DATA_MASK; writel(0, &ioc->chip->HostInterruptStatus); } From patchwork Thu Feb 24 10:11:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12758309 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 BF67AC433FE for ; Thu, 24 Feb 2022 10:11:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233278AbiBXKMZ (ORCPT ); Thu, 24 Feb 2022 05:12:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233266AbiBXKMK (ORCPT ); Thu, 24 Feb 2022 05:12:10 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3EFE33A29 for ; Thu, 24 Feb 2022 02:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645697499; x=1677233499; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=fy482iV7TvYo4Oi9JfCYtzCX6QbrjUioqGVwAf3nVMc=; b=eMGqINQchYtORAAcQ/Eik59+11H7zld4xcEDfqdxwl+YAtmHsINycq+y FMtpbyeocJLln8M1QIHcv/NQWGNa7PRuhtRqJaZaA4SnzBwSl2/WsU1G8 bu815WzLBzFMXL/s9ZwYbCdc8TGCSgsHDm1sIo1jEzRId1clAxd/LcRx4 Ys7QbzfdHjnHwsZYuAEi884FvJry+3OkKUMQ/w1tzTJ54pka5bZRcX88K mMCRh/34Z+pU6+Pfwk76TWs3mmWP6/htdqPl7KywAhFHtb+KJ5pvGD4NV QVPsXZjCFoOP/1X6257r20wbchryzsB70Vijil6jQISyYzKfViiLd7e4G w==; X-IronPort-AV: E=Sophos;i="5.88,393,1635177600"; d="scan'208";a="297965121" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Feb 2022 18:11:39 +0800 IronPort-SDR: 7DF9abao0wW4ESOKJrxZL5DK+GPkzKehN/Fuxd581sxPdXL+MYpcq5Kso5RMPpyBV3v5e/v11O cojjp/hD0p0PyRouahdrxd2+7VAtudNb7QYpGa9HGXl43gS57JamE4E0lsY6T5qatbbqeOldjP k9Abu1FUth8PYhrH+1KbSCEtkkSLBxhGgaj68nuz+KN2pC8a9L+h8uAt7iYolhdbOZq9111zqy f6m9QkLcencwD0cV+Gsn8n9tFQhjyTo8r+3RWAOxQvONgReWKa7NYzm6Q2U6HgJk9qtJowfg7b 2wW6N78iKzw1TCIrmOXX1xiO Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 01:43:10 -0800 IronPort-SDR: K27F23flgpvLp9UpxBwsHmDMQJbveFoSSMWCz2t4/9pbmxIaky/XDdqXNzeVrzYX7xTMStvxqS xv7LETa70k8S1Aiu9OnpplZ48bF3AWeRTHLkS/Jbhoz6hO+ZSMF1uf/9IwsASG8bLgFhRyCwiG zuCSkBaLxNr3h4QYNtUnKFg9iynoXdfdmBg3MlabkwMBzit8+RufAL+pMuCc3DzrTkLQ5Jdi3b CxNTzFsqpCpHIbsWVFEUD86Vdkpnbaku3KbWX1aD05bmzsi4N70K3c5+ir158PcjSjotoRX/LE U5k= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 02:11:39 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K47wq2mYXz1SVp3 for ; Thu, 24 Feb 2022 02:11:39 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645697498; x=1648289499; bh=fy482iV7TvYo4Oi9Jf CYtzCX6QbrjUioqGVwAf3nVMc=; b=fWdeRlXwEz6tKu1K1307Hn3IYCTUtDImqj nay3htdjqZkhFM/nJzGjLpuu6D836FzvTBS0us6w3CuAX+6emlL7HdAVUGwhmrdM QOSl7Z41t6Q+tD9fi6Y464wtf6yQTOW0A4/V1a9zug8M2QO6rTxA/nAstNjSx5Cy CrVZp5a2Mq3fCHLx7B/FzR4Tw3Dl0PVUPwLY7PLgFqmfDrZ15pkFAYzbgjKi1vUj s6knKCVl2jWf90IEwX/jEP4CP8/A0+mQ1QRKOSlvoxdOi4YlTWEtum71WYSNzoGX gD2JJkEDK5SAqL16eny4VfoE4bdJjLz+wtR+OVAHJm3hiwaH1ImA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XKYfdgPIGIog for ; Thu, 24 Feb 2022 02:11:38 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K47wn6VG5z1Rvlx; Thu, 24 Feb 2022 02:11:37 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH 4/5] scsi: mpt3sas: fix event callback log_code value handling Date: Thu, 24 Feb 2022 19:11:28 +0900 Message-Id: <20220224101129.371905-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> References: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In mpt3sas_scsih_event_callback(), fix a sparse warning when testing the event log code value by replacing the use of a pointer to the address storing the event log code with a log code local variable . Doing so, le32_to_cpu() is used when the log code value is assigned, avoiding a sparse warning. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 00792767c620..a355bc145577 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -10926,20 +10926,20 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, case MPI2_EVENT_LOG_ENTRY_ADDED: { Mpi2EventDataLogEntryAdded_t *log_entry; - u32 *log_code; + u32 log_code; if (!ioc->is_warpdrive) break; log_entry = (Mpi2EventDataLogEntryAdded_t *) mpi_reply->EventData; - log_code = (u32 *)log_entry->LogData; + log_code = le32_to_cpu(*(__le32 *)log_entry->LogData); if (le16_to_cpu(log_entry->LogEntryQualifier) != MPT2_WARPDRIVE_LOGENTRY) break; - switch (le32_to_cpu(*log_code)) { + switch (log_code) { case MPT2_WARPDRIVE_LC_SSDT: ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n"); break; From patchwork Thu Feb 24 10:11:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12758308 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 C1006C433EF for ; Thu, 24 Feb 2022 10:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233271AbiBXKMY (ORCPT ); Thu, 24 Feb 2022 05:12:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233163AbiBXKMK (ORCPT ); Thu, 24 Feb 2022 05:12:10 -0500 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0DAF36B4C for ; Thu, 24 Feb 2022 02:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645697500; x=1677233500; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=cEltjDqj/9pJQTo/KSSustfkwvntQF26zL2bd9bpM3I=; b=DW5hZBmapXxLIuNA0Yas4CpNPrSfyXgvZewuMRaoYMCwTTLuHydw4JOU Q6OjuYH5HJidFR2YX+ZWCVNrbfIXXp+fA2JEm49hmZYMMaOPsx3G5A8VM GBih6pCPUf+QiRPZUPd1CPqYtR2kMnXT26XDDpc62zY3kK0rx3Ok5bmPQ EK4nWXzWvITBHYH6nT0o8BCNhM5KOfr2nZCFcDY0OBUUaxrSMeWPnZcpS VqfpODz17KlPg/uw+JDBHoCxMcxa6OMPh3doDQIRnrysqIu9/arKXLn4/ buWCxPKpjRhPKpSCAm41csf+c+GzqFa7zv/AJghqa+pAogHG0b9BWm00l g==; X-IronPort-AV: E=Sophos;i="5.88,393,1635177600"; d="scan'208";a="297965123" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Feb 2022 18:11:40 +0800 IronPort-SDR: 8CTrHXBeb5aS+BTipEmh4XgbtxLBxBDjJa9yVHb+6kOUGNTGaMeQ4faHcplRcTP4GTIZUTfUH/ Tfbc4Jli2Vk2XedoOrfFSOydp2Y59ZjDkmc6/3EWSWv9n5OSoGN5jI/sNOu9p7pUGk2RdZ7LCo Pq/KuxT2/mU1m/klTbWhz+6B0iYfq9fWdBmmVaNJGOwmIbVmyJHA/Hvzy5N+ZtqIz26vaY0kQD Sls2DKlin9Qs57R1RkU5b4P3vcecmiabZF01oH1xhUnjKanfO3kfXOhuqzkchURXjw+a8EHNe1 NoLsrgAONnVJYGD5H8OfS3W1 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 01:43:11 -0800 IronPort-SDR: e/763P9R5xp+bvgy2zG/Xbh/F8lxTu3a0YOJRRdrlBEUgE80wSwyTfHLnXUSncneCW1wdKyMu5 7fwj/aaP485JD2qndYmFknhJJuCyq3ARkHau6oIrUceH9GaRXoA9rWGYNQlw+ECckXDPkJW5Jx VaRvBWSGS5PQNVjPlF8Rxiw4aMq0Nl2TfUcsb6aRQanWvLmIG1qP/aOMToOhIUV850mSbXJg5U J71ZTRMT1Rv/71COzBnSrI4iBxqVmXly05AqRzypd40mTl5FVIBR3gSC1WgMGeiXWxfoHpJ6gP nw4= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 02:11:40 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K47wr3phcz1Rvlx for ; Thu, 24 Feb 2022 02:11:40 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645697500; x=1648289501; bh=cEltjDqj/9pJQTo/KS SustfkwvntQF26zL2bd9bpM3I=; b=nPQa/PkM7OxfszdB0HOiXetS78FbiEgM/J +EmaNteGGMVWpSLKZz4uQgzGWe+yAOuGDh1zhuOl/vPr9cAqWa4yiaMNZx0NoeTy zn3NsyziDGenR4FWBFC6qakyyKWtSuBGIBUoQm1w05skey9RD3YQhhkWZBAa74RJ PtWilDr6SY8eCabwhgE6twlCHy06avYWj3fZcslQ1rLkci5RiWOouuPAvaqvBI1x dmiR9Pnr4j8GtASJZMfTITL/LkmrFjAUzlBL1gcXdyVVQL1MfYOtrL9QYuKQ059V MC+soRJEyjHBOhTjK7MyXj4jkBsAtmZ3KHFWAmV4hEDTqPmGQfPw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZMyYguilikon for ; Thu, 24 Feb 2022 02:11:40 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K47wq0wjlz1Rwrw; Thu, 24 Feb 2022 02:11:39 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH 5/5] scsi: mpt3sas: fix adapter replyPostRegisterIndex handling Date: Thu, 24 Feb 2022 19:11:29 +0900 Message-Id: <20220224101129.371905-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> References: <20220224101129.371905-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The replyPostRegisterIndex array of struct MPT3SAS_ADAPTER is regular memory allocated from RAM, and not an IO mem resource. writel() should thus not be used to assign values to the array entries. Replace the writel() call modifying the array with direct assignements. This change suppresses sparse warnings. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 37 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 5efe4bd186db..4caa719b4ef4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1771,10 +1771,13 @@ _base_process_reply_queue(struct adapter_reply_queue *reply_q) */ if (completed_cmds >= ioc->thresh_hold) { if (ioc->combined_reply_queue) { - writel(reply_q->reply_post_host_index | - ((msix_index & 7) << - MPI2_RPHI_MSIX_INDEX_SHIFT), - ioc->replyPostRegisterIndex[msix_index/8]); + unsigned long idx = + reply_q->reply_post_host_index | + ((msix_index & 7) << + MPI2_RPHI_MSIX_INDEX_SHIFT); + + ioc->replyPostRegisterIndex[msix_index/8] = + (resource_size_t *) idx; } else { writel(reply_q->reply_post_host_index | (msix_index << @@ -1826,14 +1829,17 @@ _base_process_reply_queue(struct adapter_reply_queue *reply_q) * new reply host index value in ReplyPostIndex Field and msix_index * value in MSIxIndex field. */ - if (ioc->combined_reply_queue) - writel(reply_q->reply_post_host_index | ((msix_index & 7) << - MPI2_RPHI_MSIX_INDEX_SHIFT), - ioc->replyPostRegisterIndex[msix_index/8]); - else + if (ioc->combined_reply_queue) { + unsigned long idx = reply_q->reply_post_host_index | + ((msix_index & 7) << MPI2_RPHI_MSIX_INDEX_SHIFT); + + ioc->replyPostRegisterIndex[msix_index/8] = + (resource_size_t *) idx; + } else { writel(reply_q->reply_post_host_index | (msix_index << MPI2_RPHI_MSIX_INDEX_SHIFT), &ioc->chip->ReplyPostHostIndex); + } atomic_dec(&reply_q->busy); return completed_cmds; } @@ -8095,14 +8101,17 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) /* initialize reply post host index */ list_for_each_entry(reply_q, &ioc->reply_queue_list, list) { - if (ioc->combined_reply_queue) - writel((reply_q->msix_index & 7)<< - MPI2_RPHI_MSIX_INDEX_SHIFT, - ioc->replyPostRegisterIndex[reply_q->msix_index/8]); - else + if (ioc->combined_reply_queue) { + unsigned long idx =(reply_q->msix_index & 7) << + MPI2_RPHI_MSIX_INDEX_SHIFT; + + ioc->replyPostRegisterIndex[reply_q->msix_index/8] = + (resource_size_t *) idx; + } else { writel(reply_q->msix_index << MPI2_RPHI_MSIX_INDEX_SHIFT, &ioc->chip->ReplyPostHostIndex); + } if (!_base_is_controller_msix_enabled(ioc)) goto skip_init_reply_post_host_index;