From patchwork Thu Feb 10 11:41:59 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: 542335 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 EC66FC433EF for ; Thu, 10 Feb 2022 11:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241105AbiBJLmZ (ORCPT ); Thu, 10 Feb 2022 06:42:25 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241058AbiBJLmY (ORCPT ); Thu, 10 Feb 2022 06:42:24 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79AEB1019 for ; Thu, 10 Feb 2022 03:42:25 -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=1644493346; x=1676029346; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=V82tCpFaYvpcK1xKWfEXtOUXB3QC/wmQbMrXpEthOUo=; b=TVNbJO0c6fJe5WEGPvN9NIbEsMzx6KMlTv9zXFIgAm5fpJVr/Fj2LO/Z HXy6nH5Y8Hz3rwZQ9jwAMgbDot5ZF+aiYceLX8SCxZCVTlaNZGxDX0Pzm IUZk9C2trU+sECaANetms8Ev/Jn5nRLgiy2IyCB+52Otgt6dawwGH26o6 o0aOu9JRcDePQdDNIHHznBAzF3/Wyha86hCwlCkmYJEvhG7BOwj7BjEc0 1EJ+RNYOH+HPGnQYcXzTLTyj14uUDGSFk1N2yrASt4wG2CUTjsE5PczGA JgV5JI/webtpVgSoKN4W4XeyRLSQDZbv/rTfqgsTW/jyyxxw7nMr5wofz w==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575605" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:25 +0800 IronPort-SDR: nNIoH7F5UZBL7eCoT5faJfsRTdK5AKaaeWf19BXLMjCBUzVBtq5BDIks3kGtmMTbVdvfRrO6AU hRL2rvxUy7VgS4LwIGPyaX3tne9jlBw/CqIn/zTBLHYZLbLCJZAg+VMzIHkyA4B7TJRAAR0tOu PydwW/D2A/GQQzuVM0is7StSzZyMECi17fKjCM1Le1u8Tj01O27dZUj/E3KaoWN7rYbLA+bB5B iAykKNxMCVJ2vpTFTszQ0w5381qjJ3+31vJXMObcOEg6HAEEo47JhmfVLC43e2MOfgGej2oECz fpDApxakiBvcN0y+JdJEKBCh Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:22 -0800 IronPort-SDR: q94iWborlo3LVyhrudGy20WEUPui+BcNwzJNFYq4NdG/66KM+lYRXUuR41l1KAsS9trXw0UnRh iqPcv5UCLAyJaRh+mRWGQuCYF9NRjThYMob7qfmhXkoSDWnFos8KF1ehp4zQbHnkD7tVf/0P45 dPywHt4SZPGGWiqgCbZK5l+I+M2g2XH8qvXZVr+gqIYHQXoNSw84tMQy2DL4ZTzGyV6xl4oINS F2g7+ZnSt7Xsqu6M8YCSa4c6CH/vuvvSvY8U4PyodufupWikttCMY2+lM16DdTNkFpwsZpFwCw 9Xk= 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; 10 Feb 2022 03:42:25 -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 4JvZc05tHHz1SVp2 for ; Thu, 10 Feb 2022 03:42:24 -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=1644493344; x=1647085345; bh=V82tCpFaYvpcK1xKWf EXtOUXB3QC/wmQbMrXpEthOUo=; b=TtJ3/Lk8eMusVlAuxf8Yqt00LjDP4uSRKK uPldJrZun7cHXvghQTe8RTOK3n4yOszMhY69OVWygHuo+IChyl9ZXiyxGXq4+fG1 q3N4+Jy0VLpgVdSPmIbfBa1tR1z9gYWjSEtOdZ9leVyNyi+lDSt8n2KNFDNiDdSH oV0azj4hlkmpe0Ix8Q7ihY7jBAs+4b/AIw67tBk48KIHQYRKUOBccWtQgy0Dxf6k kIGzxTDPLvV5BV/c8F1OXiKv4aYVOcoCGXsjW0BmIHot7TQAXXh2sh+A6lLFxflR ByoONN8kmGhROReS9ffAggSjDxV9iQVdhsuOV6zbwY7m/NOP3xGQ== 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 wAuUImQVHUF5 for ; Thu, 10 Feb 2022 03:42:24 -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 4JvZbz2ndmz1SHwl; Thu, 10 Feb 2022 03:42:23 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 01/20] scsi: libsas: fix sas_ata_qc_issue() handling of NCQ NON DATA commands Date: Thu, 10 Feb 2022 20:41:59 +0900 Message-Id: <20220210114218.632725-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To detect for the DMA_NONE (no data transfer) DMA direction, sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. This test does not include the ATA_CMD_NCQ_NON_DATA command as this command protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and not as ATA_PROT_NODATA. To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA direction, use "!ata_is_data()". Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal --- drivers/scsi/libsas/sas_ata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index a315715b3622..7e0cde710fc3 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) task->total_xfer_len = qc->nbytes; task->num_scatter = qc->n_elem; task->data_dir = qc->dma_dir; - } else if (qc->tf.protocol == ATA_PROT_NODATA) { + } else if (!ata_is_data(qc->tf.protocol)) { task->data_dir = DMA_NONE; } else { for_each_sg(qc->sg, sg, qc->n_elem, si) From patchwork Thu Feb 10 11:42:00 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: 541679 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 2FEDBC433EF for ; Thu, 10 Feb 2022 11:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241111AbiBJLm2 (ORCPT ); Thu, 10 Feb 2022 06:42:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235932AbiBJLmY (ORCPT ); Thu, 10 Feb 2022 06:42:24 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660ACFF0 for ; Thu, 10 Feb 2022 03:42:26 -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=1644493347; x=1676029347; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=62dKy7FJi/LOczLf/foDrU5lssulm4RAJbK5vqkwQOQ=; b=SGSJGu+A44sb3MGsxXfGD3nvvkRLwJxzWFCaQuyN+WnnZDaTLqlL+myQ ktcTgsClbSRVM+DQZa9A61mhx4NMREsUmq2F5IGM1ZDTUQ2WefGQx1ZZg f3X4Y4LZce3z/M0cApUaLyeLlbPqI4ZjiZwn/SMQW6LtC4AYmCtWmOm/U 6uZO6k8S4/Q+7s/SeuxLPgps0/7pqJ5OiNqJDmoup0R35OjoLhncf8Mc/ FtpkDvxVsT15gws7ZHY7jyRp7S8JKwVepq0ZeuFronIqmVki6Ug7YN/RA aYTmdefZZihyUZ6Kj8taAsIVxnuibx5YuLaEmyDZOcwbEupGBnSvDSUdq A==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575611" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:26 +0800 IronPort-SDR: HyM/g/S41QDTKCHJUHha2X4Rbe6MBLjwzgENFXf90EcyN3MTHUhn+LtR8pWJIRg37dCxhMG+V6 7xDurXshIzWPF7yKXS6dGnJ755YIrnnf4Xl3b41BE7ZfkKdFwnJfCktJVC45D4ivlnVKdCH0Oj uGhFYQnxnESGPIp5+Tdb7mVn/IJFMLUqGMWhv4SIR/TN3+ZgiClzih3Vb2ZCrHITWhUjRImbJQ pmqLMrhTlI+wyUj40h/WPUin+3oGwCbDgwNa3c9caEcu3H/nHjveTw9IRLAC//Qm4Q/CM+Yr2K G4wFQxMsYsy/A5z3InOnmSPG Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:23 -0800 IronPort-SDR: /ALfSRjzXC1dHwhIgW7BwVCcYowLliMAtOSQrkp/SsNbHRXRxLvYFhZEwLJmvjh92dWLCIyZvb xDvy4EdfooRv9/jI81sImp3t2A6zLt+Ejimki0dJUGSAP6QxMygtRfYCNQlLIAuGgtUEv8JliL bW5HayjIMvWkNOF9RBaf85mWmP1MAFdT7dyBzT/3qVUSrOswrCekpr5ePR3fftTyXwGmBLmbNU 5m0ti0ISlhysVJcDH7/R2TPQi6vn8jAzgiir8wpFSmn4+JQUAdWOnYJN21dvPV3EK/IelvMTQK 8ZE= 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; 10 Feb 2022 03:42:27 -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 4JvZc1703cz1SVp0 for ; Thu, 10 Feb 2022 03:42:25 -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=1644493345; x=1647085346; bh=62dKy7FJi/LOczLf/f oDrU5lssulm4RAJbK5vqkwQOQ=; b=GfUqSHB9pDS/BdHuKIQoRzap/rgtYRG/eS 1+mhFuRDNzIK9fcH2vhN4RMCwza0oRZTzjOXshTG3BNVdJfrfUzwDs1qoUSXmRPX nMJXxg88gn+9X1dqRMgnnrymQIEqRXgphwm5UJY/SO5s0OFXU6zcJwFL9SF/+rZR 3cQWDof/sTahYbhyY2nHjZ5uACra68bIRIsmON0HFYP9JS9hq59dgc+Usp6p0nKS XZ7k6s+PBk16SwAnNfNqUP1VPX/+6ZJkVf/U9AFPbMzePQD91UA8hsjIAv9uplgv itIm/KsTjwV9BejUb8+hDfD4WtwQ0s7RhkCd0KHXYimRsnq+37BA== 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 1tLKXf7jds3b for ; Thu, 10 Feb 2022 03:42:25 -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 4JvZc049vvz1Rwrw; Thu, 10 Feb 2022 03:42:24 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 02/20] scsi: libsas: simplify sas_ata_qc_issue() detection of NCQ commands Date: Thu, 10 Feb 2022 20:42:00 +0900 Message-Id: <20220210114218.632725-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To detect if a command is NCQ, there is no need to test all possible NCQ command codes. Instead, use ata_is_ncq() to test the command protocol. Signed-off-by: Damien Le Moal --- drivers/scsi/libsas/sas_ata.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 7e0cde710fc3..99549862c9c7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -181,14 +181,9 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) task->task_proto = SAS_PROTOCOL_STP; task->task_done = sas_ata_task_done; - if (qc->tf.command == ATA_CMD_FPDMA_WRITE || - qc->tf.command == ATA_CMD_FPDMA_READ || - qc->tf.command == ATA_CMD_FPDMA_RECV || - qc->tf.command == ATA_CMD_FPDMA_SEND || - qc->tf.command == ATA_CMD_NCQ_NON_DATA) { - /* Need to zero out the tag libata assigned us */ + /* For NCQ commands, zero out the tag libata assigned us */ + if (ata_is_ncq(qc->tf.protocol)) qc->tf.nsect = 0; - } ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *)&task->ata_task.fis); task->uldd_task = qc; From patchwork Thu Feb 10 11:42:01 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: 542334 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 16438C433F5 for ; Thu, 10 Feb 2022 11:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241115AbiBJLma (ORCPT ); Thu, 10 Feb 2022 06:42:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241058AbiBJLm0 (ORCPT ); Thu, 10 Feb 2022 06:42:26 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E761019 for ; Thu, 10 Feb 2022 03:42:28 -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=1644493348; x=1676029348; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=++Jen2Z7eE/Z+IcddaXljZMWolo9K9TW92C06sjcO7M=; b=lT6Zk7KU2YEgDXh3lLLaax8PAVcS/jKoYo3vW/dNud/owxu2Jl4IrcYC UH/nL4Mh7WoTNZPwPmcNqSa2rX6upjrG0i2Z7bLveIXeFpWVqj/UlJcPU NgSkBgA2gU9iCeTtDIewml0KyILMtActnVyQsPJYrciyBBNqn5F+in5yr 9YiS7/gkuTGB+fPuzXGd5eQkePoHdjYEBWOjMh3M7yof3ncZvcFTVxbnz sHYfsvX7/e2Hapy+8LwIpBhY62BtokKNgWmMtSJgA+qXBehUo6tI3dPxm wMxLpafmhbahWiOeiewqEfWt9+8/zfx6dAJt53iY+Rj6wRh6dPBOdJtbb g==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575622" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:28 +0800 IronPort-SDR: cPBH/oAPqHgSgf04xPuql3lXy9o17gdnYYFpDIOaF79L7MEzbq4EmtzCyba5ClZohUwLpW19+k F95aEP2ttDEr3PUYbRXZBK12iNT74l1JU4gyk9kJPeZpSbWJAbHEfG2MgKzNNMu2DIczJabxpa 2Uy/pfSGfEIid2N6oupSFI/YdlCWe98dLwYACTcUWzB3Qi3wLje9rBSQH9V5cHhqVE1Whvz1bB AUyoa3UgfAj5kBQDMiPbC8ygeAUy0qHXRpdUs/nqVCunPPtckxMp5VrwQh+aRSYrhRSp+DWbgP avIVfnZRfr+Fjp8DKKsikU4i Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:24 -0800 IronPort-SDR: BZv6e8WyEFPb/k7RxLTdZ66a0SnXGifeohAqtnE/YwLnWw5hJffpQIozwYsm2tL5AxdljzjDAG FFIozvEMpshe2hgSq93uE8l8cVjtvWcO2QdfBGwQ9TZEW3U3wwNBoU7Wye5X/U/DjLuPXHEbgJ fjzmTkrmD4+VjdtdmT4sl4HhQ7G8LBypMZJw+P0abmc4maWM++PJQRrQ6i4BNw6LuMe9LGdkIE vqk9gy3p8ACN+COdp7rdPlWSb8pr0n8mRAX1TjHTOF4QVubg60Hf3FMTeBi2XdAm5qslM17Jbu fjM= 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; 10 Feb 2022 03:42:28 -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 4JvZc32GH2z1SVp3 for ; Thu, 10 Feb 2022 03:42:27 -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=1644493346; x=1647085347; bh=++Jen2Z7eE/Z+Icdda XljZMWolo9K9TW92C06sjcO7M=; b=eUjJ3NF7nLrA93E51AqVSJQ3DhFYxPoL6h BIAzY8lIrGrxqRTowvLTwzujeEn7mGgOznUvJBvL/GjuXTBhKQT2uE1JZeR9dV0T DVPhB3WhdFXqkVzEkHYq00tQlVsJ5v/8f/j9MKqfqBh++nEUZObX18Aj0MJJXeDL dfF8RCkWePRqZbSgAvnSSKk1FG0pN0+5Hk2KG0z7S1ZZ4qgHi2SVQGNw5/Im81OY rKGShXhjo3TFiI1eREaVEsXw/evHOVM+6rc+ottUIphBo8JnRCXr0VbcUtd3G0Mf xGdRH/61gk7n06nME6Udwyi9z1iw3HZ6gMVSaavO0qj1jilEgHmQ== 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 XquKJPMUtS0U for ; Thu, 10 Feb 2022 03:42:26 -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 4JvZc15xSQz1SHwl; Thu, 10 Feb 2022 03:42:25 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 03/20] scsi: libsas: Remove unnecessary initialization in sas_ata_qc_issue() Date: Thu, 10 Feb 2022 20:42:01 +0900 Message-Id: <20220210114218.632725-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org sas_task_alloc() sets the state flag SAS_TASK_STATE_PENDING for any new task allocated. So there is no need to set this flag again in sas_ata_qc_issue() after the task allocation. Signed-off-by: Damien Le Moal --- drivers/scsi/libsas/sas_ata.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 99549862c9c7..a03a841921db 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -204,7 +204,6 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) } task->scatter = qc->sg; task->ata_task.retry_count = 1; - task->task_state_flags = SAS_TASK_STATE_PENDING; qc->lldd_task = task; task->ata_task.use_ncq = ata_is_ncq(qc->tf.protocol); From patchwork Thu Feb 10 11:42:02 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: 541678 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 611B6C433EF for ; Thu, 10 Feb 2022 11:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241116AbiBJLma (ORCPT ); Thu, 10 Feb 2022 06:42:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241107AbiBJLm1 (ORCPT ); Thu, 10 Feb 2022 06:42:27 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE509101E for ; Thu, 10 Feb 2022 03:42:28 -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=1644493349; x=1676029349; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=N3XJN8UajDt2lz2CuLZiwl5BwExscC5k8xty4uLPeNE=; b=DJhZVUs1y/63SPqQt7rn5YUHIJH1855iXwaVjE5eKXDYl13QvyRKnkKh 7lw6Rx7lUcw587nBCFT9KtBOPozfTOZRg+KRzuZ3QuHxGZVfAyoFsU94v 04H8IrpWPykALB0mjWxw6MNPWl1sGe+WG+Ec1K3iGWAtLudDIi166ZEMq N6HQdcNYantCQ/qwFmP9kIPStx+uowjnJQlOxBYfQR0EKgKExh3i2HSpy FLTnsFJwpK22F6QqaVkXbNuppEsfhYPbw5OaIcGqttoDE5StcnparBb9v GDzXalkdee/RCkj6s2syoEzGbIrkuv5BCLrrsO9jcoGWslQsRV3wztbYq w==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575626" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:29 +0800 IronPort-SDR: eQ7LySPqBpmJKIrnqt9y7SCLLmr8bJ3jZYc8f8uH/Gqy5VIx305HkqfsdpS6cto1SxDMb4+x52 EguG8vlAgf6ESOqieof82mhwT/DNxBDSnQVEjC7WrB5lenqcO6dwaV4/oEqnV864gsaW9vhe4p ZCfdjBgGiGwpH2BCgBUCMdvrUZKbSIbag9yMJcsRI4tezMuPw1DItt/DZ+hqMzElbEhHRmxWcA bqE9xOd6bfA/qN1PbsUyRaMFUyGbmZ3I7JP6OaEQLRIFL9R9e2owzIA/9hQYLpIBs/Qu36Fmix M+8pRo93XcDKZYdmDT0H83Ih Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:25 -0800 IronPort-SDR: 3LeuCNkKdDlkCzjGyIlyYt4gbTjmt9GFcql0Bx6p2hro8BCsOh3a3FOuuH0uMXFvNoKrmnW+C5 gNwlb8qPeQlRUTQVAzpqZZtYsHGeeoQ7O8lplGmJxihrx4QqIsWMIFVDuEiql8jt7CFsVO+9S4 QDoBmG8SDyEKHB97UffmDSDyn2aPSumoUqYTUzYy7P7xTpFOb3e7uKjH+xvwMAgsX1Nfhm5zad 4p5wh4BWyELP5dewUPB9VgNH3d+eC0JeNkQ9uKd7+wTW65HWYQSH2NTPwF+zS72+9UQbC86whn qTY= 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; 10 Feb 2022 03:42:29 -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 4JvZc436Qhz1SVp0 for ; Thu, 10 Feb 2022 03:42:28 -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=1644493348; x=1647085349; bh=N3XJN8UajDt2lz2CuL Ziwl5BwExscC5k8xty4uLPeNE=; b=ZyWCuBPp9toXQ6MEmjF/U5oTbKG6BHgE+h moQo7tn7UnEy9w14dlO+RFGNEymyv/MjXM+Nw0l6YMsNinEBoAm9WSYUmLnaA2yN p7+1Lg5TplZtXW6LSa8KvTqSew9A1DReRJGmRAUcfYoSWqBKXD64EX1d0ixXo5a+ D3d/Gv38mOVa3QrCyGuOFeKv0YMwEbrdYgvB/HjyYeWO91QjkMhpfc/KynpAb/hu kJRkv8BDQScfp5oJxtRfQ/Ck+wIhtj7ee4dIt6yKTSkDcQ+TssPJ7y/vNbtdz0ot CAhJR/DqtlIUzlK2dqEGXCTUCJRD389YJW1masEixF2ySksYWR0g== 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 hhTb9MA7fvME for ; Thu, 10 Feb 2022 03:42:28 -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 4JvZc30cl0z1Rwrw; Thu, 10 Feb 2022 03:42:26 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 04/20] scsi: pm8001: fix __iomem pointer use in pm8001_phy_control() Date: Thu, 10 Feb 2022 20:42:02 +0900 Message-Id: <20220210114218.632725-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Avoid the sparse warning "warning: cast removes address space '__iomem' of expression" by using a local unsigned long variable to store an iomem address. Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_sas.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 32edda3e55c6..6805c7f43e41 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -234,9 +234,10 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, } { struct sas_phy *phy = sas_phy->phy; - uint32_t *qp = (uint32_t *)(((char *) - pm8001_ha->io_mem[2].memvirtaddr) - + 0x1034 + (0x4000 * (phy_id & 3))); + unsigned long vaddr = (unsigned long) + pm8001_ha->io_mem[2].memvirtaddr; + uint32_t *qp = (uint32_t *) + (vaddr + 0x1034 + (0x4000 * (phy_id & 3))); phy->invalid_dword_count = qp[0]; phy->running_disparity_error_count = qp[1]; From patchwork Thu Feb 10 11:42:03 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: 542333 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 61F2AC433FE for ; Thu, 10 Feb 2022 11:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241124AbiBJLmc (ORCPT ); Thu, 10 Feb 2022 06:42:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241113AbiBJLm2 (ORCPT ); Thu, 10 Feb 2022 06:42:28 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE361026 for ; Thu, 10 Feb 2022 03:42:30 -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=1644493350; x=1676029350; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ejO8Y5jwWSKmpKfhNMn6tqrpuf8bsQwZ4IjznBqtY7Y=; b=UPpMoD9TAZGqzIzfocyI+4kCEI3Dh7ZMP+ASRGvj7nqwo7LGXFgxbBK1 Tr8JSoyP1wxaYwHf3CWiCQeOMNXG2cvq7Rx+X0ybyuIrvh2xnT7eMcrA6 3rFHXSq5VR+ZdGX2Mx+F2q5VqfMDO9PVFt1QEimELbfuV3v9GNPc3c9mc zpPCXrjPSulg4TgvLlaRgS6IUj8SAEKWH9dsQSvClIo2W4o0oha0IO10w wVt/VGaFgcMQP9UGbw969pSpsHBi+HhrU+Y1cXaAbW5bUKaS0earHE/Iv LoMOLd6IpVbfL0LUeluBl6SgAuYcjngq2LhVrHBFShWMtAgi62opXNykP A==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575627" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:30 +0800 IronPort-SDR: Yfa1C5Mj004n9Zgh8Ttt2R+Vpp4oZXePJMhXK4sBA6XoYNl04Mib0u2PW4h/AyacctME8MQ8fg 6nCyPtC4wLlaYv+XdQOEzSdd+WG6aHT2eJ4UalLFnGJ1TJBnywNLfZHASNddZQeKciYbhXLYPC 9LG9ch24y5Gfj0kxEYtKouCa3zM/2eIYJ9C3sTFQ07G9HoQ0soDDksU4z7kl4RhVMi4lufISsA jffpQhe2lFiAdnkbbb8XgJ5a8S+fCfMSor1HXARcKSJ5oY5akl9binTUPHZ+IPsOOZXYkuU/4S Idv6gNgTVi3t4J6Cyh3DNK8e Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:27 -0800 IronPort-SDR: Wk3FHXBCqb6IqiO3OOvuBJORwJ+bFMic3I03u2wPWQDcbzyh24ZO9aJKkJ59ex+DF2AtOZivuS O3GYvTzaO9cg9KzS2kOaia2svmU6wdFbR4KjsYVi3fAp6SRudLSgpIclZ3LHGP2Cgpuzpr7hyI 6tFRj4fChIVeo3vSQfCmwMQnQ0K/iHWxhs5eICtagN8ltpvaHzLB235TnPil+1r55R1wXEnBCz QaDPvhjxkPpxZaYBwB3Y21aE/Vsh0zxHH/5u2GX2jQJOvsvDrhT4+NYgn6uo4pfbKPtyGz+nkN swk= 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; 10 Feb 2022 03:42:30 -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 4JvZc55Fdcz1SVp2 for ; Thu, 10 Feb 2022 03:42:29 -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=1644493349; x=1647085350; bh=ejO8Y5jwWSKmpKfhNM n6tqrpuf8bsQwZ4IjznBqtY7Y=; b=AxH34ZwhIxXseR4o///UlW1/8IOeT9i08s jajNpdvlnJLNjVA0sNaKbPoodYuFfJ4O35CzwSEAiBzJXJ88xs+o0Nr1s8rAEoBP 2YbdqW4gesk+Z//1VAN3oJd2fJ6aWlNk/tWQiFYw6Kfv8WZXf0vDHNtVJA/zQk2G X/6Ul6TFB7Yz3K4s/sCrAM0gJXc5Wl9JaoB7bHAgo0IndzUnkAoAZ+WLRga8Y1UF b2hBIMViVw7SM4fTCDTfbI05D47aD5ggR5yD4maAjcdXnj5v+0zQEuCRgD9T9/t8 09p69GjAXBmqgILvdaXnAZCIxefUVAB4S/uXhJCAy7fiFvw84omQ== 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 6Tb8L4-lYDGp for ; Thu, 10 Feb 2022 03:42:29 -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 4JvZc42LwGz1SHwl; Thu, 10 Feb 2022 03:42:28 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 05/20] scsi: pm8001: Remove local variable in pm8001_pci_resume() Date: Thu, 10 Feb 2022 20:42:03 +0900 Message-Id: <20220210114218.632725-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In pm8001_pci_resume(), the use of the u32 type for the local variable device_state causes a sparse warning: warning: incorrect type in assignment (different base types) expected unsigned int [usertype] device_state got restricted pci_power_t [usertype] current_state Since this variable is used only once in the function, remove it and use pdev->current_state directly. While at it, also add a blank line after the last local variable declaration. Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index d8a2121cb8d9..4b9a26f008a9 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -1335,13 +1335,13 @@ static int __maybe_unused pm8001_pci_resume(struct device *dev) struct pm8001_hba_info *pm8001_ha; int rc; u8 i = 0, j; - u32 device_state; DECLARE_COMPLETION_ONSTACK(completion); + pm8001_ha = sha->lldd_ha; - device_state = pdev->current_state; - pm8001_info(pm8001_ha, "pdev=0x%p, slot=%s, resuming from previous operating state [D%d]\n", - pdev, pm8001_ha->name, device_state); + pm8001_info(pm8001_ha, + "pdev=0x%p, slot=%s, resuming from previous operating state [D%d]\n", + pdev, pm8001_ha->name, pdev->current_state); rc = pci_go_44(pdev); if (rc) From patchwork Thu Feb 10 11:42:04 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: 541677 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 98FA2C433EF for ; Thu, 10 Feb 2022 11:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241117AbiBJLmd (ORCPT ); Thu, 10 Feb 2022 06:42:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241114AbiBJLm3 (ORCPT ); Thu, 10 Feb 2022 06:42:29 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656D2FF0 for ; Thu, 10 Feb 2022 03:42:31 -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=1644493352; x=1676029352; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=3YhGeYPBwZrSeSc35Br5ADny29zolAB/42QRCJwcMUA=; b=hzFwpbbN+H6F7fApZqLOMXJJWoPpGrH/qYIWgCMuYvIhgJcApGzYIJG2 y8lwFAoGaNBGTvlfle0sKuEq7GUekLKpKibpXdcLoHN6yIaSWZz1xtXd1 faHZLAgfIfY3ay3P46wBdkEsYxJ9L5iZtpzI9lYyH9Di1fvpxnW0kjx46 YUtfbAf+MDv1w206h33DzGYI/84KFkmtgAqPqIPR0FBftrr6wW94Mfd4f aUVbcr/2Q340K/x3j2aQYtnwg/QjXPfeQrDyn9S/3MUdvNNB0+sBBDSgA 8N5aQHdKgoqJSULMqe3vPHRg4dH781Ar+JWAD902y+Tef2jSeDPIl/N06 Q==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575631" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:31 +0800 IronPort-SDR: aXcpXocqnetwDUB2C/kkbh6lDwTxDe7ZesJIjrWlqOzWVlmQauNMOC1mYmle0P5d2BmIdJMeYH 4qfzgmZIDIKSbXB3bWhXJNdpsQ7RDg7nY0UP3koAfYK9t6P7HTy43DvVvGhZrxH7le6OEY3xlL wQl9UWhGIrPZZGN5SOltT1ShJNA2b8LOgBV4QiaYIP1m3rY0YI7Mv7zrL67Gl+PgB/EPQmHRyw q1/D51YJtbHd5c8aho+FunjjrfLCZWq+QObD6lvw78/lWqvwejw7kwV34JPc0vPbmzSynV+FyZ r8B4AEe2MADBT9uC3mw9r+4U Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:28 -0800 IronPort-SDR: JRN9T9gBsV3pxS/pWJA9H+0avVTMjSpMtFdNBa/2CraV7/LszVswMpAMB7tgBhx2w5N7kWx2eZ 5jrVbnO1THOothT318WvSQTFFGFud8yopT5CPC2SuZIm0ggcj2XyTD0F6WDbTfEET2pwJw7sRI aTzDbtceUJOwAnNTmNxwKihQBVadJpZCUerimIms158NsroufzDUaZ7aSPgGZKAIDbWC61mPDv bupmPBn34cEQMsR3yQj5uPnoYc6dQ63f/XllpYsLL+FYmD+hVho4MBSzi9PH1MFs1sMsl4qgik 08o= 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; 10 Feb 2022 03:42:32 -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 4JvZc702vbz1SVp0 for ; Thu, 10 Feb 2022 03:42:30 -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=1644493350; x=1647085351; bh=3YhGeYPBwZrSeSc35B r5ADny29zolAB/42QRCJwcMUA=; b=UoC0T62ughfYf1K35aY0bJnZv1cZ66vYfx rrsQC4lSu7Nti+5r9wY7rRijIPMBp1KLzo7CcCHb1avxkxCR9fNKu1zh12+pvqfE HD1TzHFI5H1DIJCSd3s01cMEewBE2ODR59XxXujosQi3D97Z9KJN2FhkPFrKL2l6 E/szKC7x61Lf0Se0ZaAjUJzPk0fYKGdcvjandLB8PzPZTPw/POS2dco3vj4s5zDD GpVXa8mgpmAyU+FnEQW2AOpOC0XYgWqlzFb9wTx6kIl2cjsG3BerSyTeagf7ZA2r v+oyFvGc3MmZzaKZwtJyBNcI65y3xkrjs/JdBuXmTMwZS2vt3BGw== 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 5OG7nTIe9ch1 for ; Thu, 10 Feb 2022 03:42:30 -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 4JvZc5400Lz1Rwrw; Thu, 10 Feb 2022 03:42:29 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 06/20] scsi: pm8001: Fix pm8001_update_flash() local variable type Date: Thu, 10 Feb 2022 20:42:04 +0900 Message-Id: <20220210114218.632725-7-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Chnage the type of partitionSizeTmp from u32 to __be32 to suppress the sparse warning: warning: cast to restricted __be32 Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_ctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 41a63c9b719b..03aff0ba3657 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c @@ -721,7 +721,8 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha) DECLARE_COMPLETION_ONSTACK(completion); u8 *ioctlbuffer; struct fw_control_info *fwControl; - u32 partitionSize, partitionSizeTmp; + __be32 partitionSizeTmp; + u32 partitionSize; u32 loopNumber, loopcount; struct pm8001_fw_image_header *image_hdr; u32 sizeRead = 0; @@ -740,7 +741,7 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha) image_hdr = (struct pm8001_fw_image_header *)pm8001_ha->fw_image->data; while (sizeRead < pm8001_ha->fw_image->size) { partitionSizeTmp = - *(u32 *)((u8 *)&image_hdr->image_length + sizeRead); + *(__be32 *)((u8 *)&image_hdr->image_length + sizeRead); partitionSize = be32_to_cpu(partitionSizeTmp); loopcount = DIV_ROUND_UP(partitionSize + HEADER_LEN, IOCTL_BUF_SIZE); From patchwork Thu Feb 10 11:42:05 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: 541676 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 615CFC433EF for ; Thu, 10 Feb 2022 11:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241135AbiBJLmf (ORCPT ); Thu, 10 Feb 2022 06:42:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241123AbiBJLmb (ORCPT ); Thu, 10 Feb 2022 06:42:31 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E7111026 for ; Thu, 10 Feb 2022 03:42:32 -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=1644493353; x=1676029353; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=CeJzPK5/WkuMI+dI7emyt1AUY4copPziRAwmpxYlnw0=; b=qAFQjA3pUQv+U91R4hHmsHz7vaOZR3/KBq+xqNIL1RV1euiALm0rRfU7 gICP0wGLDGPMgv0mg4/8b2YVEfYSGQxkQyEuwi6s1ePGMHF8ZseAqhzeS VnvYcmvY12FIlyoflLhsIXEJkSEh8MnCNO2/ZjNaVxXhJgGQM8U6tmHb1 wib2mny6zjn/HujWr8JYXEc6JbQpnayUt+pV5ObNmA/0gAtZ9BhYTLy/P 95dSq8kc5bAv4twYrQAG1quqG7bG0IABENUD37zJoY376u5T7watq6Hhz Yb8W5cxg8OGuErg2zoWty6hK66zUqCv/oUV2+ucPCO2zx/YmmFESTmJV0 w==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575634" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:33 +0800 IronPort-SDR: ekeE9Iku9B+sR2PJAL7LRezJpxXwErsdpxm5KTosuRg7B8srxmGtOzAyIoUJ9IbeFLkGWTjj2B fH9aSZilI9AjUlK02SzNnykeFRPpCtNXCVqSDAS2NGOsQ/9eAgpmh01z4P+P8kXmnFDiwvezUf RkiURmJo2d+rn2cO9Eazf7M8RjH8OPg7rwaf7P7l0VFKw+NTHj9XfPVYYtizUC59nVZnZmdamJ OCdl7X2Nnoli7ICREx3K3A0WSPU+Wq97QZ/7388kTEUM7zkvVNf9Hf0URo7f3KJFJRF9LAMOmB lYRQoMcVCjWgIz/fZ2+gK4Yc Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:29 -0800 IronPort-SDR: N+gTWQIGA3lUGy4GybPtMXjE975PmqRCR2pCcbfeCdnQShfGni21yPJdEsO0LsWy8+a/niXG2j m19BLNIBJWObanoYTJuspyGqlTYJYZy5i2lYB6/Ifwd/myBbLwxIl2t7K0nfJ3XyxpygFsHFIw MsCw/rbbrp9PBwsLVppgfvyF6/1hkMsKWSe45ZLESc9R1T9qJL+rwPn6li4WRIgVZ6FIivg34t ikbTKWuCzr6o7OnRTZR+fuaYCLVaT2m4RfFYkxfhrzvMS98hD/EVLFTcM2+4CkN156VSMvnz7i 3UM= 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; 10 Feb 2022 03:42:33 -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 4JvZc81NwDz1SVp0 for ; Thu, 10 Feb 2022 03:42:32 -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=1644493351; x=1647085352; bh=CeJzPK5/WkuMI+dI7e myt1AUY4copPziRAwmpxYlnw0=; b=AtNUDNF2Ihl7MO7wpfwRg2KUL5VxHOgXVm XsIfUuBZo7nv+HyvEztaQrzYUfpUjIqaChbrihk7ZdLn1kizJy7nihimXBoWCoG0 nZ0ZNSXiXUlGU9lw5lO08fWNdVTzAVvK6l5SyGnxN4HTtIA8Wky7oVriBYZoE8ok nGaYyI0s2qeZAQoIPfNtQmg/ByZcW2WvK+GxvaxZhOH4Rg76LBE5lsC8GOfCvwCD F+K6IgDtxQMfpW7YeSYD9zEOJtvk11ioYyfhT3SJTxe+YjDFszNsy0sMAW2v8IxA NPePM8rRGpINHBukSCZ82JRO2Luu+DKa3d6cxRQ6gfM4551EPa6g== 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 MsTMR85-TzfD for ; Thu, 10 Feb 2022 03:42:31 -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 4JvZc65qZ5z1SHwl; Thu, 10 Feb 2022 03:42:30 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 07/20] scsi: pm8001: Fix command initialization in pm80XX_send_read_log() Date: Thu, 10 Feb 2022 20:42:05 +0900 Message-Id: <20220210114218.632725-8-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since the sata_cmd struct is zeroed out before its fields are initialized, there is no need for using "|=" to initialize the ncqtag_atap_dir_m field. Using a standard assignment removes the sparse warning: warning: invalid assignment: |= Also, since the ncqtag_atap_dir_m field has type __le32, use cpu_to_le32() to generate the assigned value. Fixes: c6b9ef5779c3 ("[SCSI] pm80xx: NCQ error handling changes") Signed-off-by: Damien Le Moal Reviewed-by: John Garry --- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 9ec310b795c3..d978f7226206 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1865,7 +1865,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag = cpu_to_le32(ccb_tag); sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m |= ((0x1 << 7) | (0x5 << 9)); + sata_cmd.ncqtag_atap_dir_m = cpu_to_le32((0x1 << 7) | (0x5 << 9)); memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 9d20f8009b89..ec6b970e05a1 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1882,7 +1882,7 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag = cpu_to_le32(ccb_tag); sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 << 7) | (0x5 << 9)); + sata_cmd.ncqtag_atap_dir_m_dad = cpu_to_le32(((0x1 << 7) | (0x5 << 9))); memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, From patchwork Thu Feb 10 11:42:06 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: 542332 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 27750C4332F for ; Thu, 10 Feb 2022 11:42:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241134AbiBJLme (ORCPT ); Thu, 10 Feb 2022 06:42:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241127AbiBJLmc (ORCPT ); Thu, 10 Feb 2022 06:42:32 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBA201028 for ; Thu, 10 Feb 2022 03:42:33 -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=1644493354; x=1676029354; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=nldFEaphJv0td9vVAodKbsUeQBGB9NZPcBJugf7Ye10=; b=eurk+owpt+aOChuyHcKIPbMKwZ+oStYBcLAv0forqlNVB9LzucQWHLmN 3qgRn6D1vI8CJomMv9C2kiN6y3W5OmuEf5u9woD1XgdQu2GVt/JihInfK jiR7OfKWI808FGX32TQICetT3I1nyFbluLeYlEs6895Xpgc2G4QBaEZd5 4TwY1IiU31Y1pgG10svyKGVxqExPtq9rOLsMne7lztFlzLDqfbMqhhmKO qBhGcNMBRK4iOtKZH5zswA5nK5SXrrgdvxxS45SeNv4fVN/nZ7WvbE+zZ Ty/mzgSaL9N5nIobqAJJIp0gmFmQAhRoeRMDuFyD/972nSznrD11dlFd0 g==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575639" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:34 +0800 IronPort-SDR: 0EctaDME7MRpCSKGtdRCHQGgRwDrmnx2OUwcb50v1SQhEnuPG1Q1oqucL6m1601/4viVv2kSgJ L0KHZIrmEf7n87eE3qXoNBSkNLBZ4o8LZm1boCXiCuqMBgBSty6xAie6rMSKl4QN3yLajRdywD OYz7nN9DVfZEEZIGD1f8rzQDEWIshslw6eZMExm3yQq4or2A6mZbrH10IuwPGu2pxbduhw9uF3 uXaZmAxZcCfeCg+YjtCepai2ytfaq1cZuD7kYe7Ji4JudN9mxfPlaEeNKCgCW7FY9Rs18gmyOU 8+LftCKdJukYU3YkIYKsH3dJ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:30 -0800 IronPort-SDR: TrOlacK+xQite0rMiEUJZg9FkDHW7P1OysDQ4LZGl0rQBsPJcCQqlx8Pe7pbmvvTIa30DAo2iw cWuD22OPkAGBob1uXbbNJnd7i3jXFCu3LC9JE6ijaaXHNZr/g1yevGX3Z1OgtlMIVff0PwmGy5 nj7+FGHQOkostAvMXpAS4cY4Dqb2I0GXPb9PKnDjoAjJ2jiIuX66D4UceRMW3XHa2JIB8nFijU IKsNUjSxn+3n0vaWz1lTVZn+dUSZIpz+JxfOLVXIZ9FsofAHG4g4sKm6tDP0QoVF18LR9kwGGX sRU= 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; 10 Feb 2022 03:42:34 -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 4JvZc93DT2z1SVp3 for ; Thu, 10 Feb 2022 03:42:33 -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=1644493352; x=1647085353; bh=nldFEaphJv0td9vVAo dKbsUeQBGB9NZPcBJugf7Ye10=; b=KmKsTm0NnvwsqVi4s7Jp/wHXjQp1zQbHZw 9zljoxQfHMYBf8p3BvkQjH/tB18+4wtzCWtOnl3YC4yGGcnkVt4/JNRC2ktq3/pI BXlWvGTuRVfnHEOATSu/QvkpGn/k6uxGoBaZFbRha+a+A11Y990ick2qVpJUxoPb 11XVJrDIEwOxdhSEr9a1JXIndmruUGH4Dc11DiBenUmrpHO/2DxxAA8yk7QDN55b CRflrAJZJlHwYPck39wqAw/SBS8BH9z+j34kcqkhYLHkXK/6NPVlehu7GzEUHyKx lZg/IlEhETVMqWOqtNklY6DjdOLzNcB9EXIvXT/atrY9Ev+qWJvg== 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 10KKMTgkXGAQ for ; Thu, 10 Feb 2022 03:42:32 -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 4JvZc80NSrz1Rwrw; Thu, 10 Feb 2022 03:42:31 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 08/20] scsi: pm8001: Fix local variable declaration in pm80xx_pci_mem_copy() Date: Thu, 10 Feb 2022 20:42:06 +0900 Message-Id: <20220210114218.632725-9-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Declare the local variable destination1 as a pointer to a __le32 value rather than a u32. This suppresses the sparse warning: warning: incorrect type in assignment (different base types) expected unsigned int [usertype] got restricted __le32 [usertype] Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm80xx_hwi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index ec6b970e05a1..37ede7c79e85 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -71,14 +71,13 @@ static void pm80xx_pci_mem_copy(struct pm8001_hba_info *pm8001_ha, u32 soffset, u32 dw_count, u32 bus_base_number) { u32 index, value, offset; - u32 *destination1; - destination1 = (u32 *)destination; + __le32 *destination1 = (__le32 *)destination; for (index = 0; index < dw_count; index += 4, destination1++) { offset = (soffset + index); if (offset < (64 * 1024)) { value = pm8001_cr32(pm8001_ha, bus_base_number, offset); - *destination1 = cpu_to_le32(value); + *destination1 = cpu_to_le32(value); } } return; From patchwork Thu Feb 10 11:42:07 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: 542331 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 7D0F1C433EF for ; Thu, 10 Feb 2022 11:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241105AbiBJLmm (ORCPT ); Thu, 10 Feb 2022 06:42:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241118AbiBJLme (ORCPT ); Thu, 10 Feb 2022 06:42:34 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 357C4FF0 for ; Thu, 10 Feb 2022 03:42:35 -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=1644493355; x=1676029355; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=QxFaq4u/ltI4EXOZN0EExZT+6BlFEgHRDm4Mn9uwkNU=; b=o4wdWYRvkaSEvSZ22+FZAS+8ajTNDyoI7SjsA1elQII0GFHSFO/JCdVT e6e+3ILSYwmqNBYBnbM7ATT424EC5EFWT0dulzHhTzGTxke71KhfPJgvR DS9uJfI/VvlIn0JiwG1KsimjCTqqbuyYCXavDY04OgFtKSgzV3lZd1g9J gQaYGTuqGKMySi+NQctNa8sZAuonFiaF1NdgxfB7VNI61+RJxCef5FEIQ EZwESXt5/02CtlI3QJLGxtsdTdyppK1cBRQAuwCyrCkTToJ0PAnbZGIgk U3ZnE9/mAdzHzqxSQ1Oe5b32aoxOm5FAnqsTFakDh9EhvC2pzGApzdkfs A==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575642" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:35 +0800 IronPort-SDR: a/jZxFmbjGpwonQks8SQHYoEUFTWOZ3K+UgChkuyykYAADGqbGBDUC6Rchqf4uhEy4cjcpI+S+ 4rWWR53WmptMf0e03wyQQY8OwUOd+FfC3RtVoAMpe5adJ54x8aZD/0UA+PqLMPG8AU1wXxk5Ek d2H0OVNKlFxfG4ETUNbcsDG5VUTtJH2HsRP1rpgQlM9KZEQOCAuCwSy2OMMMFzrEMOM297nmLI t4WySQy50HGlF12K5ybrGP44tBhaT5EIIFnQLxBghWIPOXTcZH0g+B32TmeE0KJ9B8wl/ML+bY kEkXnELXcLH5rGqDGphz+IPh Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:32 -0800 IronPort-SDR: INrMcJrOncbAnR8Rbtv0mPPz/aFUgW5H4pCmU4i19A+pkvqDYsMd2vc8Pz2AVbnVw8WspOHA4J Mjv1JwUS1IGnJm0YC1hTNlf5RSPlCMabXK1bOwd8N+byWltalsbddEYtwoWz2YqgnP5EmggtMx 3EpQd/Zni7THhNaO6bB62OVzVvCV3saank+yfh7N2Hvq4LBNXj6H3znZ3iZs45tKYKsUUKdMZF Bjlzbv7joFNv3AJLg0QQlVK/8ju4sHEx2FXIKspWYaV4KM6DfUFKnu33dz7T2zkQKSYiv/tTJu t/8= 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; 10 Feb 2022 03:42: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 4JvZcB4WXQz1SVny for ; Thu, 10 Feb 2022 03:42:34 -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=1644493354; x=1647085355; bh=QxFaq4u/ltI4EXOZN0 EExZT+6BlFEgHRDm4Mn9uwkNU=; b=rKRyeJV6+rWaVyw+ZVNknTrClNKHehMRry vwbkEBL9s9HPJr+ZOnx8sP86QiyFqbrr+a1fSbUUpTfSDXnO0JrrL2yedkXuKDg3 isYiy+l7p4X89JXfP2u3ZDNvfl5vVGN4CMobl5YtDAbY/iT215WTlzhszxe3NFvz wuAkUzZfc6gmijvsy0Aq88ul46v5LJcRaaJ9gh9VCKyCVMN5qKJ5FytMeJHf0mYo VhTtXpSZ3T4pz3lgdBp/kmEH54WoOTfa8yoeHhmnc8vc7cGdLbPBXricSnzdW2AK tfxaKtrSCsNYW1p5sWaIhUjennI4BFrcSq1E3ytcKqAGA8xbu8tA== 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 QOzqrEdIHWt3 for ; Thu, 10 Feb 2022 03:42:34 -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 4JvZc91n9zz1SHwl; Thu, 10 Feb 2022 03:42:33 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 09/20] scsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req() Date: Thu, 10 Feb 2022 20:42:07 +0900 Message-Id: <20220210114218.632725-10-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The ds_ads_m field of struct ssp_ini_tm_start_req has the type __le32. Assigning a value to it should thus use cpu_to_le32(). This fixes the sparse warning: warning: incorrect type in assignment (different base types) expected restricted __le32 [addressable] [assigned] [usertype] ds_ads_m got int Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index d978f7226206..43c2ab90f711 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -4626,7 +4626,7 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha, memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); if (pm8001_ha->chip_id != chip_8001) - sspTMCmd.ds_ads_m = 0x08; + sspTMCmd.ds_ads_m = cpu_to_le32(0x08); circularQ = &pm8001_ha->inbnd_q_tbl[0]; ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd, sizeof(sspTMCmd), 0); From patchwork Thu Feb 10 11:42:08 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: 541675 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 AB65DC433F5 for ; Thu, 10 Feb 2022 11:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241141AbiBJLmn (ORCPT ); Thu, 10 Feb 2022 06:42:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241127AbiBJLmf (ORCPT ); Thu, 10 Feb 2022 06:42:35 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E80E1026 for ; Thu, 10 Feb 2022 03:42: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=1644493357; x=1676029357; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=n3PQdYPDIFO8Uwr/FMnjUNEQTlCYp4IwHIQHnJXVWd8=; b=pjk6I/8iAWXMIdHRTSoI1ZhA+5mcs/QnkP1cQp886zY74E5yKXzMzucA Ng3R2xtE/HCCKfLZc0IsesrsIllHtmFhOqD/z5p4ouVvtO4GItulYpX5c i8eesgdckehGhnNetCYIKdvAAEsnrreFU+iUEea8qdfwhx6G/6I+myHZK o2HZ2i+ksLna/DSO9WqRKuWRAOvJLVAWCIvRJMY0f19qGpDE/C13LOfty 2zIfR+he2cd0hiMWYMV0ZjWUh0bgZUPOGWxjpRFtW2q7iaQHzMrPWxEUg o+Vv6xZfkBZCLArjlYph748dwDna44d+pT2XrKguLwLhjIHQB+EuwsnFv Q==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575646" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:37 +0800 IronPort-SDR: +kSif5Ho/Zsy6p+vuFwGlUspoGm5kOnnIrdMXF+1Nrg5yl8pAddBQPid8PgKSatF34RYkaz2Hu FjUNDRugapXTcclJ3gTADkICmBcvjYl3zVz2w3AamKtL5mPVAuD7UsYc0kGtblI8uIBu3yrPw6 erV5e+/kS7U651HGTYtHrwggxnvqfMBJwGjrelRbvVBX259XnQt8xtnb2Kexi/0cl2QYCfBsey wyxmSKz5T2XzQK4GOMLGickoywV9feqC4rqr9Nj1+T8o4f5KvAv1uM1u2vNxx373+PIl0P9Ry9 WJ4A9ESQxw8tm2GO6QYu+20Q Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:33 -0800 IronPort-SDR: WB6svrIKOzqh0MSYMzuM0UOz0yAelzVd//doRMKQGDZ51MRuhD05V10jojSSKrAGjQPHX6akkw x/elH9kV1pFNbgsyJ+jTRHuKyMcjE5sUoqtznCDUe8XuBTnCP+yhsi0sxhDLT9Ha9Dus5o8I4P jB+grePuU7t1PdkHgLIsdTuZCXXrowpQgUNYzNaaj/y4SJkfvU3522YsBMAQOxT5d61tykDqs6 BPaNvx9xRx0/2v8JBY1eoglikd0FTq7Q02SOmQpgTGy1Vz8pqbUpAXYE2Kd1rZmROolJ/kLXcB 7FY= 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; 10 Feb 2022 03:42: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 4JvZcC6vpzz1SVp3 for ; Thu, 10 Feb 2022 03:42: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=1644493355; x=1647085356; bh=n3PQdYPDIFO8Uwr/FM njUNEQTlCYp4IwHIQHnJXVWd8=; b=idYyzbuWd5J26Wgsf/UidoF3uk2l9iFBer HAXP5utfToZsJUvShzfFpDPpltYXnIx3DmrMzmM5w0mX24A5BaqITzUR+HCJJ0da uqSg+BV+wksYPMSPMvh/su3cgWIxsPJ5qSxBRue8OqzAUyZJtCcHiW5rB1KvKpmP Xcf47rFfApLgwKXM0Uo4l3nI+Vv9WjdmwLDQax1Yi1jQDiskab5FpV3zd3l00r+2 PmuLLVXKcYQbAStkdH6gQEOTKUZENIa1uqZNu4eTdSb//+xv5sEsn+1Op5Sehom2 QX4Rc/atnsmXlhayq1jYslgau10nS9YA3Cok/ALKbnyDdSuxQwsQ== 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 HxOeoKEIahUc for ; Thu, 10 Feb 2022 03:42: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 4JvZcB3ZYsz1Rwrw; Thu, 10 Feb 2022 03:42:34 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 10/20] scsi: pm8001: fix payload initialization in pm80xx_set_thermal_config() Date: Thu, 10 Feb 2022 20:42:08 +0900 Message-Id: <20220210114218.632725-11-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The fields of the set_ctrl_cfg_req structure have the __le32 type, so use cpu_to_le32() to assign them. This removes the sparse warnings: warning: incorrect type in assignment (different base types) expected restricted __le32 got unsigned int Fixes: 842784e0d15b ("pm80xx: Update For Thermal Page Code") Fixes: f5860992db55 ("[SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files") Signed-off-by: Damien Le Moal Reviewed-by: John Garry --- drivers/scsi/pm8001/pm80xx_hwi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 37ede7c79e85..9c7383fb4bdc 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1202,9 +1202,11 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha) else page_code = THERMAL_PAGE_CODE_8H; - payload.cfg_pg[0] = (THERMAL_LOG_ENABLE << 9) | - (THERMAL_ENABLE << 8) | page_code; - payload.cfg_pg[1] = (LTEMPHIL << 24) | (RTEMPHIL << 8); + payload.cfg_pg[0] = + cpu_to_le32((THERMAL_LOG_ENABLE << 9) | + (THERMAL_ENABLE << 8) | page_code); + payload.cfg_pg[1] = + cpu_to_le32((LTEMPHIL << 24) | (RTEMPHIL << 8)); pm8001_dbg(pm8001_ha, DEV, "Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n", From patchwork Thu Feb 10 11:42:09 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: 542330 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 BA9F0C433FE for ; Thu, 10 Feb 2022 11:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241146AbiBJLmo (ORCPT ); Thu, 10 Feb 2022 06:42:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241136AbiBJLml (ORCPT ); Thu, 10 Feb 2022 06:42:41 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0A7B1029 for ; Thu, 10 Feb 2022 03:42: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=1644493358; x=1676029358; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ZWrSXM1hykW2G2gy5Fsaq5oKKtBp9OoMP2U/QSrvZ/I=; b=KVxnCfbHdhQotHIrsGCzDpDCQhZESrI1yt1qu46ClqH15TYlgv0KtQuL dpS36fOdFAeBrU2cBJT4FvotJPY+B0zxaWcpKGyzXNSGRsmLtrxkzuvuS WDteOifzYRZ1i1PedNAv11tCPN7JBYuUQiIqdi0i3OStyggWyJnPMR1+B rcxYWiTtZqtr4p5FFBy80GfbUCIo+PM0VVRLhaktOEibAISKOkww+XVaA 7Nr6TC8f37R8AinkILw8pLZJqGjUWL6vTkT+vpGzo7NiRixr4Ou7z2kDH kLUXUFvwrMUZ/p03jz6QUamv7MEmunfAxHf7Elc0jS3X1Rz0yYa/sNEaR Q==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575648" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:38 +0800 IronPort-SDR: bnZfIXX6uZQejJnmShmb0xt9Hp/cb1sYic+OCYPhkTPa2t5RI/YWcJ89LhFS9K8108PaSUReQW NAqr789JWnZ7awEA6tDlumxNHEH9tiww6MoYLi4ntZWe/E6ozHzmsnPwIyXoTV5K6qBiJ7vxv2 qq/bNLR/AGuh7LA1ewwX4VarV1oDfb4tvSGKEoDMRehqW3UpeK5nyGwaMDM/PIVd0YChKnlXOu Wf4SCV6J7EMSpABmuj0JI1neG43nBNiE+jeZvl5OBpV0exi9UG2VFJTB22Xy1Iahj3lCzmfzVG qqwqitvNnZ1RsJhwJIp03eWj Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:34 -0800 IronPort-SDR: hrif1rqpoxzUpPrsldr26bVXJubSfMaxQAQtaNloyMIylB/ev2GnbMSJt7LhaWCaEieKzJSCOu y4DY5z5KjXUoSKA5OUVy5/ZDy08O2wKu/JlD7K+hMJO5Q23sdDM6WPLqJY6tIf2jOhPqjVnosy ulDjSRGU6J7IYsKu3Uk3eNLUP2mv4d6GjEzIM0aE33Pa3rfQ9aD1N/nN3VF0jhJKuic1bgQm9u +RyZ4cLLEhEHix+hPBay7UL4gdFWuK0E4AtfsUHl5LrAStgxW792x082GpUx7j66rTqm2RQSiW lhs= 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; 10 Feb 2022 03:42: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 4JvZcF32Gjz1SVp3 for ; Thu, 10 Feb 2022 03:42:37 -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=1644493356; x=1647085357; bh=ZWrSXM1hykW2G2gy5F saq5oKKtBp9OoMP2U/QSrvZ/I=; b=NSe2upmmLwWaXo+879evy89guPu0Ytvrn8 w5bKqDXflRLntI+YA9bjA24E9zV31pDkF+sIWGIOY+bVIDN8FBYuIU7PuzN8oaFD DuUMrBO4MsaQS3scRPGTWYfQ0z0sdR1IMWpZzGSMqlpvAg3BB13GynM5dHtZdYZ8 inZzBi1MeQokSeAMem6hX+GtJntP8RTStAwpRumCPQXbPiCb0aMhCW5abJ7Xy994 TGiAG0ngrU7cAMnAU7Kp9UD/3e4ge9ZPwBFwFBU0Gmqb9VekficWV5XV3Rum76qL kmJvsX8DYmIRopiAplF3ncMWzYwEy+O7m6ongrEWZaY5JZLV35ZQ== 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 Os17nCGU7tEf for ; Thu, 10 Feb 2022 03:42: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 4JvZcC5hHbz1SHwl; Thu, 10 Feb 2022 03:42:35 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 11/20] scsi: pm8001: fix le32 values handling in pm80xx_set_sas_protocol_timer_config() Date: Thu, 10 Feb 2022 20:42:09 +0900 Message-Id: <20220210114218.632725-12-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org All fields of the SASProtocolTimerConfig structure have the __le32 type. As such, use cpu_to_le32() to initialize them. This change suppresses many sparse warnings: warning: incorrect type in assignment (different base types) expected restricted __le32 [addressable] [usertype] pageCode got int Note that the check to limit the value of the STP_IDLE_TMO field is removed as this field is initialized using the fixed (and small) value defined by the STP_IDLE_TIME macro. The pm8001_dbg() calls printing the values of the SASProtocolTimerConfig structure fileds are changed to use le32_to_cpu() to present the values in human readable form. Fixes: a6cb3d012b98 ("[SCSI] pm80xx: thermal, sas controller config and error handling update") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm80xx_hwi.c | 52 +++++++++++++++----------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 9c7383fb4bdc..84322d694391 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1246,43 +1246,41 @@ pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha) circularQ = &pm8001_ha->inbnd_q_tbl[0]; payload.tag = cpu_to_le32(tag); - SASConfigPage.pageCode = SAS_PROTOCOL_TIMER_CONFIG_PAGE; - SASConfigPage.MST_MSI = 3 << 15; - SASConfigPage.STP_SSP_MCT_TMO = (STP_MCT_TMO << 16) | SSP_MCT_TMO; - SASConfigPage.STP_FRM_TMO = (SAS_MAX_OPEN_TIME << 24) | - (SMP_MAX_CONN_TIMER << 16) | STP_FRM_TIMER; - SASConfigPage.STP_IDLE_TMO = STP_IDLE_TIME; - - if (SASConfigPage.STP_IDLE_TMO > 0x3FFFFFF) - SASConfigPage.STP_IDLE_TMO = 0x3FFFFFF; - - - SASConfigPage.OPNRJT_RTRY_INTVL = (SAS_MFD << 16) | - SAS_OPNRJT_RTRY_INTVL; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (SAS_DOPNRJT_RTRY_TMO << 16) - | SAS_COPNRJT_RTRY_TMO; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (SAS_DOPNRJT_RTRY_THR << 16) - | SAS_COPNRJT_RTRY_THR; - SASConfigPage.MAX_AIP = SAS_MAX_AIP; + SASConfigPage.pageCode = cpu_to_le32(SAS_PROTOCOL_TIMER_CONFIG_PAGE); + SASConfigPage.MST_MSI = cpu_to_le32(3 << 15); + SASConfigPage.STP_SSP_MCT_TMO = + cpu_to_le32((STP_MCT_TMO << 16) | SSP_MCT_TMO); + SASConfigPage.STP_FRM_TMO = + cpu_to_le32((SAS_MAX_OPEN_TIME << 24) | + (SMP_MAX_CONN_TIMER << 16) | STP_FRM_TIMER); + SASConfigPage.STP_IDLE_TMO = cpu_to_le32(STP_IDLE_TIME); + + SASConfigPage.OPNRJT_RTRY_INTVL = + cpu_to_le32((SAS_MFD << 16) | SAS_OPNRJT_RTRY_INTVL); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = + cpu_to_le32((SAS_DOPNRJT_RTRY_TMO << 16) | SAS_COPNRJT_RTRY_TMO); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = + cpu_to_le32((SAS_DOPNRJT_RTRY_THR << 16) | SAS_COPNRJT_RTRY_THR); + SASConfigPage.MAX_AIP = cpu_to_le32(SAS_MAX_AIP); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.pageCode 0x%08x\n", - SASConfigPage.pageCode); + le32_to_cpu(SASConfigPage.pageCode)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.MST_MSI 0x%08x\n", - SASConfigPage.MST_MSI); + le32_to_cpu(SASConfigPage.MST_MSI)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n", - SASConfigPage.STP_SSP_MCT_TMO); + le32_to_cpu(SASConfigPage.STP_SSP_MCT_TMO)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.STP_FRM_TMO 0x%08x\n", - SASConfigPage.STP_FRM_TMO); + le32_to_cpu(SASConfigPage.STP_FRM_TMO)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.STP_IDLE_TMO 0x%08x\n", - SASConfigPage.STP_IDLE_TMO); + le32_to_cpu(SASConfigPage.STP_IDLE_TMO)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n", - SASConfigPage.OPNRJT_RTRY_INTVL); + le32_to_cpu(SASConfigPage.OPNRJT_RTRY_INTVL)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n", - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO); + le32_to_cpu(SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n", - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR); + le32_to_cpu(SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR)); pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.MAX_AIP 0x%08x\n", - SASConfigPage.MAX_AIP); + le32_to_cpu(SASConfigPage.MAX_AIP)); memcpy(&payload.cfg_pg, &SASConfigPage, sizeof(SASProtocolTimerConfig_t)); From patchwork Thu Feb 10 11:42:10 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: 542329 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 D2CFBC433EF for ; Thu, 10 Feb 2022 11:42:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241162AbiBJLmq (ORCPT ); Thu, 10 Feb 2022 06:42:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241145AbiBJLml (ORCPT ); Thu, 10 Feb 2022 06:42:41 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DAE13B for ; Thu, 10 Feb 2022 03:42: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=1644493360; x=1676029360; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=IDp1iLLUHH7ab3+nq5Z7yLB/vbG5eCYWsAByfVoKrUs=; b=aVrOVQ87Jy9ai+aGezkliTg1BhXLIlQYogg/163TkhEcqhP12CDdNmXP zyyoo3eXleVKtOjauxvi1xSS9PgnY8qgbBJZE2xUCfTymJ8hBgxXV7XRo 5tu9bVNs9vR1DjwfvigRGlsj7NyeZcMRR8VSC6yKAGgtUBeOuFWnDxN0e E+Xrh1MIqHM3/RI/jji0d0ocSOIhvQIJqB2teq1LU9E5vp1ayTOA9aHWG TiNJMcHK++QoHV0hwon1CUre2PsjkGSjAsHv2Vg6vRI5CmYVu+GZ2DBVN 5TkDhhJU+1Tem97duG5S4Ad/qNbuiWYDh4JtM1S9i1w7ytBv3iU9XVrEy Q==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575652" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:40 +0800 IronPort-SDR: MHuvEKje3qxCdfhPH+qycVwKx2+N5Fd39zZrDe9bzzvin3iFG8WkSRHtb8cB5wdQWrFe7DKmR1 q+szucwj2+I98+tuyyA+nlLvNneN2caPu7mD1MJ9SUe3ldVoBVkb1jWWP/DuVQ61LgEnRuUwlM u8npBPhWG+NUHmApF6i9xSLxOSpa8uo1oL+u/0MvMqjvQ2JA/yiUY5K0GpffadEhY1DYfOcczF pbBF0E3Cd3pFXN9Zew58/Scw0aP4yEpfGBuQlUTMYpRIDbyegEPB7LZkDLVPaGlPFXYNM+857k 4ur4654RjEtz8FP0XTdyV28h Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:35 -0800 IronPort-SDR: piPFkLQ1lPi/iRNOi2F6ONAVxotphakxEUWrjuV47hDFN0i0b/VHFaJY5I+falKogNBTT8qBP8 UdkV/VEM0meRQKMtNc0BhoDW27dYejebKp0s9yfM5ooWRzSJazloOc/QjZlv3UHoBcpEjaLbdF ZICxWGDU0168BDgA26+377LfYhau8lmEtFEU/cnUnM46I11pAYktHzu52yso62TPRHB6m5T7/3 tHMzJYYmYXC2bI7aZkW/lBhF5wWkTkMp+C/wMRMI+t1Iinrf2mWbkc9ow3sr9kp7kBstXomzEx ErI= 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; 10 Feb 2022 03:42: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 4JvZcG3bgmz1SVp1 for ; Thu, 10 Feb 2022 03:42: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=1644493358; x=1647085359; bh=IDp1iLLUHH7ab3+nq5 Z7yLB/vbG5eCYWsAByfVoKrUs=; b=Pz8g5JnPPe5g+WOYqyeRVxKX3S8OWq/eBj dR+R/KCuRxiLcMMq50VPaaREyialVKkSyslsPVhMXMEhdyAGGHKkvEcaf7Y9L3HA opQuYXs/l16Pubsmnzcn+fhZtTLqS/03DoEMaWCrZCRIryCGzXzxch59iDIwyWCF tE68EXFaKGjlmPQrmSn8wkPWznIUlWwjB7Tg+Jo02ZQMj/8DV7cjme7rba34qBGZ 7k4u8NuTqMVlD5GN3IyA9dWoyNZZMu0/8sV1KiTcdYDnL+pnG8Rv398NZhrardxq W+cEsQor2gSxY1+HtCafPGoYHmx3GDE8x3a3pmQO+9Sy86BEHxTA== 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 NtTto2umYdBi for ; Thu, 10 Feb 2022 03:42: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 4JvZcF0SJ1z1Rwrw; Thu, 10 Feb 2022 03:42:36 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 12/20] scsi: pm8001: fix payload initialization in pm80xx_encrypt_update() Date: Thu, 10 Feb 2022 20:42:10 +0900 Message-Id: <20220210114218.632725-13-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org All fields of the kek_mgmt_req structure have the type __le32. So make sure to use cpu_to_le32() to initialize them. This suppresses the sparse warning: warning: incorrect type in assignment (different base types) expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop got int Fixes: 5860992db55c ("[SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 84322d694391..d37599a94003 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1406,12 +1406,13 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha) /* Currently only one key is used. New KEK index is 1. * Current KEK index is 1. Store KEK to NVRAM is 1. */ - payload.new_curidx_ksop = ((1 << 24) | (1 << 16) | (1 << 8) | - KEK_MGMT_SUBOP_KEYCARDUPDATE); + payload.new_curidx_ksop = + cpu_to_le32(((1 << 24) | (1 << 16) | (1 << 8) | + KEK_MGMT_SUBOP_KEYCARDUPDATE)); pm8001_dbg(pm8001_ha, DEV, "Saving Encryption info to flash. payload 0x%x\n", - payload.new_curidx_ksop); + le32_to_cpu(payload.new_curidx_ksop)); rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, sizeof(payload), 0); From patchwork Thu Feb 10 11:42:11 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: 541674 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 F3162C4332F for ; Thu, 10 Feb 2022 11:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241156AbiBJLmp (ORCPT ); Thu, 10 Feb 2022 06:42:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241149AbiBJLml (ORCPT ); Thu, 10 Feb 2022 06:42:41 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADAA4102D for ; Thu, 10 Feb 2022 03:42: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=1644493361; x=1676029361; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ugKyb7hkIOssRuWPir3Jh4P16cy0F+mxWtGhQtN+3Uk=; b=UkHrjBPVAPDHpWiD6p0KhVyM0XASaaxCdgAUBVklAXtSjn9hRN1JW8yX RkqEfTHm2owF4eMeJu49kl7e8b3bMnx6yPkSXu3nS74yBi10bWCTl+WeP jpLR7ewoZsS2uBQs/Y6OgE+IzKLmLQjQmu3mg4Uvj/YBBAYBbhqupFiuq y8YZQoPeHTucuVbbrvpra1tlNPSd29s1EvC12TZZdW1DIsA3+pghjwwJu s1ed+cUs0g8ffr02TjvTKwgyNgw3lGFnxw8uvzeTZxfsQbhx0vhieeNYo OzwB48cB8FQuLf55mCz484nQwHrBEEHn3LBDfmHPXT7wRZ9OyaQzu2i39 Q==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575654" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:41 +0800 IronPort-SDR: KBUAnZfYzDleOxQ6MA3C7F1YtSy5RDK8YLU2rG+fnegAHQivr8VnlU6IeDNcnyZa8Xw7VUt+tl 4Wgw3K0tPusaylFXyGMMue15OmKmoH924q874a52TIQ2BrzB4SLjNnXBcy22kVKxwG3NnT2LuH CnK/rY4TOQvDm+d6Mjqm0M6C6gYdV7srWsK3JV5psFdu3L0yVCLfXf5LP5aOgiLHIqb5ymUTxb 25Ac6/hMMwLzUo6QeL+mOvFXCEm1BHww+bCkthsBF3ow+Fp2fJwt2vAbUnURQ64DFwZgTzjum0 ++9AJWIS3ixl6+fqDNcs4mNe Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:37 -0800 IronPort-SDR: 48c+UBb0mzCo4Mpz3MdOvvmZYU7cb2QAf3p3rqTtUnWwk1+Z8mMFRegnzRzXsiq/e5ra8ZYKgr B7dGUxR/pTov5yD0EJBsxlJA2baWEDf39yqM9yUgp2/nwTvOC+ZFQqDhphH/b8ENf6gXujzwFt 3ToTzPNuY2lYYmo6DvA9fZl0SYAJouA9FwLfOWDYvjWxHYGv7jnDTaCk7QoWeJfy8CLRsca7Os PktvBdq7e17ijmatmDZCJZ8Wg6sO0ibGIcuvT4OtE3wPmwIkP35WmkZTD0uK0FoDo+G53Rf9TS g3Q= 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; 10 Feb 2022 03:42:41 -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 4JvZcH6sG4z1SVp2 for ; Thu, 10 Feb 2022 03:42: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=1644493359; x=1647085360; bh=ugKyb7hkIOssRuWPir 3Jh4P16cy0F+mxWtGhQtN+3Uk=; b=GU9+1PRSsFW+cAORDOIc+d+q4hTpctB5qd vN4Dv2zXBylUTGRHR3c7Qp4PH0IKqJbIUxA1ACrBlVt2v6mR2Q4a7yCupKXpF081 292QSdve0/SqCw401+5TVIBF1gSY8DIwTKfmHMlwcQCqTSnqf1uKjlMyGhXfVibY x/ndruj4joVa6h4QQa4krSM7hsdBQFX6uWzUqdts42BC8O/sBTye8WWcuhRvw5h+ EQ7eLc3UCf92CDVNbw3zXyONmxJHhA8YajhAmYjabxrAaYa7KpeBkC/8cV9sgvv2 5YTs3nqFLbMTSmoaA1p5BVQdpFGZgWX3j/ehfeVB4EvdREI0Wffg== 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 tmXrC6Sp2sqQ for ; Thu, 10 Feb 2022 03:42:39 -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 4JvZcG2Ljxz1SVny; Thu, 10 Feb 2022 03:42:38 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 13/20] scsi: pm8001: fix le32 values handling in pm80xx_chip_ssp_io_req() Date: Thu, 10 Feb 2022 20:42:11 +0900 Message-Id: <20220210114218.632725-14-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make sure that the __le32 fields of struct ssp_ini_io_start_req are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed. While at it, add blank lines after variable declarations and in some other places to make this code more readable. Fixes: 0ecdf00ba6e5 ("[SCSI] pm80xx: 4G boundary fix.") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm80xx_hwi.c | 41 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index d37599a94003..2626a5bb0e4c 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -4379,13 +4379,15 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, struct ssp_ini_io_start_req ssp_cmd; u32 tag = ccb->ccb_tag; int ret; - u64 phys_addr, start_addr, end_addr; + u64 phys_addr, end_addr; u32 end_addr_high, end_addr_low; struct inbound_queue_table *circularQ; u32 q_index, cpu_id; u32 opc = OPC_INB_SSPINIIOSTART; + memset(&ssp_cmd, 0, sizeof(ssp_cmd)); memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); + /* data address domain added for spcv; set to 0 by host, * used internally by controller * 0 for SAS 1.1 and SAS 2.0 compatible TLR @@ -4396,7 +4398,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id); ssp_cmd.tag = cpu_to_le32(tag); if (task->ssp_task.enable_first_burst) - ssp_cmd.ssp_iu.efb_prio_attr |= 0x80; + ssp_cmd.ssp_iu.efb_prio_attr = 0x80; ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio << 3); ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, @@ -4428,21 +4430,24 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_esgl = cpu_to_le32(1<<31); } else if (task->num_scatter == 1) { u64 dma_addr = sg_dma_address(task->scatter); + ssp_cmd.enc_addr_low = cpu_to_le32(lower_32_bits(dma_addr)); ssp_cmd.enc_addr_high = cpu_to_le32(upper_32_bits(dma_addr)); ssp_cmd.enc_len = cpu_to_le32(task->total_xfer_len); ssp_cmd.enc_esgl = 0; + /* Check 4G Boundary */ - start_addr = cpu_to_le64(dma_addr); - end_addr = (start_addr + ssp_cmd.enc_len) - 1; - end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); - end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); - if (end_addr_high != ssp_cmd.enc_addr_high) { + end_addr = dma_addr + le32_to_cpu(ssp_cmd.enc_len) - 1; + end_addr_low = lower_32_bits(end_addr); + end_addr_high = upper_32_bits(end_addr); + + if (end_addr_high != le32_to_cpu(ssp_cmd.enc_addr_high)) { pm8001_dbg(pm8001_ha, FAIL, "The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", - start_addr, ssp_cmd.enc_len, + dma_addr, + le32_to_cpu(ssp_cmd.enc_len), end_addr_high, end_addr_low); pm8001_chip_make_sg(task->scatter, 1, ccb->buf_prd); @@ -4451,7 +4456,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, cpu_to_le32(lower_32_bits(phys_addr)); ssp_cmd.enc_addr_high = cpu_to_le32(upper_32_bits(phys_addr)); - ssp_cmd.enc_esgl = cpu_to_le32(1<<31); + ssp_cmd.enc_esgl = cpu_to_le32(1U<<31); } } else if (task->num_scatter == 0) { ssp_cmd.enc_addr_low = 0; @@ -4459,8 +4464,10 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_len = cpu_to_le32(task->total_xfer_len); ssp_cmd.enc_esgl = 0; } + /* XTS mode. All other fields are 0 */ - ssp_cmd.key_cmode = 0x6 << 4; + ssp_cmd.key_cmode = cpu_to_le32(0x6 << 4); + /* set tweak values. Should be the start lba */ ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | (task->ssp_task.cmd->cmnd[3] << 16) | @@ -4482,20 +4489,22 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.esgl = cpu_to_le32(1<<31); } else if (task->num_scatter == 1) { u64 dma_addr = sg_dma_address(task->scatter); + ssp_cmd.addr_low = cpu_to_le32(lower_32_bits(dma_addr)); ssp_cmd.addr_high = cpu_to_le32(upper_32_bits(dma_addr)); ssp_cmd.len = cpu_to_le32(task->total_xfer_len); ssp_cmd.esgl = 0; + /* Check 4G Boundary */ - start_addr = cpu_to_le64(dma_addr); - end_addr = (start_addr + ssp_cmd.len) - 1; - end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); - end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); - if (end_addr_high != ssp_cmd.addr_high) { + end_addr = dma_addr + le32_to_cpu(ssp_cmd.len) - 1; + end_addr_low = lower_32_bits(end_addr); + end_addr_high = upper_32_bits(end_addr); + if (end_addr_high != le32_to_cpu(ssp_cmd.addr_high)) { pm8001_dbg(pm8001_ha, FAIL, "The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", - start_addr, ssp_cmd.len, + dma_addr, + le32_to_cpu(ssp_cmd.len), end_addr_high, end_addr_low); pm8001_chip_make_sg(task->scatter, 1, ccb->buf_prd); From patchwork Thu Feb 10 11:42:12 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: 541673 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 80DD3C433FE for ; Thu, 10 Feb 2022 11:42:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241169AbiBJLms (ORCPT ); Thu, 10 Feb 2022 06:42:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241153AbiBJLml (ORCPT ); Thu, 10 Feb 2022 06:42:41 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D2B1035 for ; Thu, 10 Feb 2022 03:42:41 -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=1644493362; x=1676029362; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Wr5ZYY0zPt1PAFBy8hWO0m0Gx4QV/QzSPJL5V8CADbk=; b=gdiBPbE2lLCNxpY9HJ1O1h0S4UZdZYxvCjQentMZTvrTSqV9+l5RVq0M ZcTwpBcUQXaH+nptBGXCvW17Qg7QVW0lxT04puHGY1K9zAx0CiC2ob4Di 5iAv5149aY4ETdEvGKZbp6BbjTMrYewzHzts3HAb0yfkqEYHK3BxIRaT4 d+8XVIzk816fYw0arlMt6E2icAhj+jDZCld1Jjznsfrs6o/bA9tN1ZUYX ocdGAlp5LRKpw0DQbytKg98443xr5Rwqsa7ZrB9F+jI7tfvkeTqOEXpdK zmyt9GzJUC1TMjAbCpJM5PE9p6yQ7afVsptE1j3sHIECbj1UESxmQ5LQR A==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575656" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:42 +0800 IronPort-SDR: CVlZbu8XRfNTc6pBJHxRmSgi61msDCXch0r6Sy1mb2dbgGie9iuy8jiiSJcGGvkd8hAigqcsFg 9SNnXNPwvKCq3/47EgM6hi51gHDFtkyr0jWY4sKK+35r6g2PNvPBfKkyPWlQ/fI8FWsGMU4DHr sAVGSk1w/URnwIMGXzHPoEZfe3rqWPJveXtxYFKOcjQW23zoqURWW4J2Uwd9beFExc5xqXJEzz e12W3Tb9KSwVW+Wt53JHKGq7PGnfMne3F/On+A0L1RDVJ4KARtQyBdE/1IgpLuAPdq6BlUxFuq +4ZNOFpYYV79KTrpx1RqTPA5 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:38 -0800 IronPort-SDR: YYZCP6nPGkKXx9ALhSvQ1Z4R1m/H93pieXdlYoW1OXTKo2x/kBzygP6knBxhpkEmyCW7MctQSy VNdJjGa+FF4LC7DeTU+sivRNNBiqLWxbd0IDMjR4pFTrTgqMa+OQem3YAoDv/bz7SqO4jThqg1 pr/BV9stUGkCP5D/m4e3NFjNOP4N2eJST0pLqr8l2VXI/cGfJoy6UmxsfLBj/nM/TiPXbIQf4B IQO8n4FeWiPnn4vE0KXAneWiuSajITxgfzRhtP75sIyiIqhDVbxfIRShodmS+p08t+Xh2d/qtb D44= 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; 10 Feb 2022 03:42:42 -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 4JvZcK2zgFz1SVp3 for ; Thu, 10 Feb 2022 03:42:41 -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=1644493360; x=1647085361; bh=Wr5ZYY0zPt1PAFBy8h WO0m0Gx4QV/QzSPJL5V8CADbk=; b=rASL6aT/6B/xDvQPwKQrvsUWQ90rffXTDZ 8pBjyaeLTo0Rz71RhnsUWnoqL9Jr/KlIiM/dCXxmqMJSyQtMi3twqxExKdbsjFS6 +/OYPuRiiGOIMWRAz+g0lde5bfEJxH07VbXY6EBdYwFAZreHEKc7+50MzDAuDpWB PsiGwHhyy4McQlfxP192lK8d9euvZmkbHQzT0yv9xudRWs/YikwPwRJISypZSNML nG6Oy3U9u4lgxe8sutPfwgXL19RNzvH+k6vKELtWFxDQ32Lae1KYNm2F3f8uorqw bH3gU4A7zjU9/rmEEYSvmKXdWgjn6TeK129+U6WF8Yz8nrC/e+bg== 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 xpHDNOOSjm8s for ; Thu, 10 Feb 2022 03:42: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 4JvZcH42y2z1Rwrw; Thu, 10 Feb 2022 03:42:39 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 14/20] scsi: pm8001: fix le32 values handling in pm80xx_chip_sata_req() Date: Thu, 10 Feb 2022 20:42:12 +0900 Message-Id: <20220210114218.632725-15-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make sure that the __le32 fields of struct sata_cmd are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed. While at it, fix some code identation and add blank lines after variable declarations and in some other places to make this code more readable. Fixes: 0ecdf00ba6e5 ("[SCSI] pm80xx: 4G boundary fix.") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm80xx_hwi.c | 82 ++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 2626a5bb0e4c..fbdc56351901 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -4539,7 +4539,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, u32 q_index, cpu_id; struct sata_start_req sata_cmd; u32 hdr_tag, ncg_tag = 0; - u64 phys_addr, start_addr, end_addr; + u64 phys_addr, end_addr; u32 end_addr_high, end_addr_low; u32 ATAP = 0x0; u32 dir; @@ -4600,32 +4600,38 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.enc_addr_low = lower_32_bits(phys_addr); - sata_cmd.enc_addr_high = upper_32_bits(phys_addr); + sata_cmd.enc_addr_low = + cpu_to_le32(lower_32_bits(phys_addr)); + sata_cmd.enc_addr_high = + cpu_to_le32(upper_32_bits(phys_addr)); sata_cmd.enc_esgl = cpu_to_le32(1 << 31); } else if (task->num_scatter == 1) { u64 dma_addr = sg_dma_address(task->scatter); - sata_cmd.enc_addr_low = lower_32_bits(dma_addr); - sata_cmd.enc_addr_high = upper_32_bits(dma_addr); + + sata_cmd.enc_addr_low = + cpu_to_le32(lower_32_bits(dma_addr)); + sata_cmd.enc_addr_high = + cpu_to_le32(upper_32_bits(dma_addr)); sata_cmd.enc_len = cpu_to_le32(task->total_xfer_len); sata_cmd.enc_esgl = 0; + /* Check 4G Boundary */ - start_addr = cpu_to_le64(dma_addr); - end_addr = (start_addr + sata_cmd.enc_len) - 1; - end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); - end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); - if (end_addr_high != sata_cmd.enc_addr_high) { + end_addr = dma_addr + le32_to_cpu(sata_cmd.enc_len) - 1; + end_addr_low = lower_32_bits(end_addr); + end_addr_high = upper_32_bits(end_addr); + if (end_addr_high != le32_to_cpu(sata_cmd.enc_addr_high)) { pm8001_dbg(pm8001_ha, FAIL, "The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", - start_addr, sata_cmd.enc_len, + dma_addr, + le32_to_cpu(sata_cmd.enc_len), end_addr_high, end_addr_low); pm8001_chip_make_sg(task->scatter, 1, ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; sata_cmd.enc_addr_low = - lower_32_bits(phys_addr); + cpu_to_le32(lower_32_bits(phys_addr)); sata_cmd.enc_addr_high = - upper_32_bits(phys_addr); + cpu_to_le32(upper_32_bits(phys_addr)); sata_cmd.enc_esgl = cpu_to_le32(1 << 31); } @@ -4636,7 +4642,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.enc_esgl = 0; } /* XTS mode. All other fields are 0 */ - sata_cmd.key_index_mode = 0x6 << 4; + sata_cmd.key_index_mode = cpu_to_le32(0x6 << 4); + /* set tweak values. Should be the start lba */ sata_cmd.twk_val0 = cpu_to_le32((sata_cmd.sata_fis.lbal_exp << 24) | @@ -4662,31 +4669,31 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, phys_addr = ccb->ccb_dma_handle; sata_cmd.addr_low = lower_32_bits(phys_addr); sata_cmd.addr_high = upper_32_bits(phys_addr); - sata_cmd.esgl = cpu_to_le32(1 << 31); + sata_cmd.esgl = cpu_to_le32(1U << 31); } else if (task->num_scatter == 1) { u64 dma_addr = sg_dma_address(task->scatter); + sata_cmd.addr_low = lower_32_bits(dma_addr); sata_cmd.addr_high = upper_32_bits(dma_addr); sata_cmd.len = cpu_to_le32(task->total_xfer_len); sata_cmd.esgl = 0; + /* Check 4G Boundary */ - start_addr = cpu_to_le64(dma_addr); - end_addr = (start_addr + sata_cmd.len) - 1; - end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); - end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); + end_addr = dma_addr + le32_to_cpu(sata_cmd.len) - 1; + end_addr_low = lower_32_bits(end_addr); + end_addr_high = upper_32_bits(end_addr); if (end_addr_high != sata_cmd.addr_high) { pm8001_dbg(pm8001_ha, FAIL, "The sg list address start_addr=0x%016llx data_len=0x%xend_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", - start_addr, sata_cmd.len, + dma_addr, + le32_to_cpu(sata_cmd.len), end_addr_high, end_addr_low); pm8001_chip_make_sg(task->scatter, 1, ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.addr_low = - lower_32_bits(phys_addr); - sata_cmd.addr_high = - upper_32_bits(phys_addr); - sata_cmd.esgl = cpu_to_le32(1 << 31); + sata_cmd.addr_low = lower_32_bits(phys_addr); + sata_cmd.addr_high = upper_32_bits(phys_addr); + sata_cmd.esgl = cpu_to_le32(1U << 31); } } else if (task->num_scatter == 0) { sata_cmd.addr_low = 0; @@ -4694,27 +4701,28 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.len = cpu_to_le32(task->total_xfer_len); sata_cmd.esgl = 0; } + /* scsi cdb */ sata_cmd.atapi_scsi_cdb[0] = cpu_to_le32(((task->ata_task.atapi_packet[0]) | - (task->ata_task.atapi_packet[1] << 8) | - (task->ata_task.atapi_packet[2] << 16) | - (task->ata_task.atapi_packet[3] << 24))); + (task->ata_task.atapi_packet[1] << 8) | + (task->ata_task.atapi_packet[2] << 16) | + (task->ata_task.atapi_packet[3] << 24))); sata_cmd.atapi_scsi_cdb[1] = cpu_to_le32(((task->ata_task.atapi_packet[4]) | - (task->ata_task.atapi_packet[5] << 8) | - (task->ata_task.atapi_packet[6] << 16) | - (task->ata_task.atapi_packet[7] << 24))); + (task->ata_task.atapi_packet[5] << 8) | + (task->ata_task.atapi_packet[6] << 16) | + (task->ata_task.atapi_packet[7] << 24))); sata_cmd.atapi_scsi_cdb[2] = cpu_to_le32(((task->ata_task.atapi_packet[8]) | - (task->ata_task.atapi_packet[9] << 8) | - (task->ata_task.atapi_packet[10] << 16) | - (task->ata_task.atapi_packet[11] << 24))); + (task->ata_task.atapi_packet[9] << 8) | + (task->ata_task.atapi_packet[10] << 16) | + (task->ata_task.atapi_packet[11] << 24))); sata_cmd.atapi_scsi_cdb[3] = cpu_to_le32(((task->ata_task.atapi_packet[12]) | - (task->ata_task.atapi_packet[13] << 8) | - (task->ata_task.atapi_packet[14] << 16) | - (task->ata_task.atapi_packet[15] << 24))); + (task->ata_task.atapi_packet[13] << 8) | + (task->ata_task.atapi_packet[14] << 16) | + (task->ata_task.atapi_packet[15] << 24))); } /* Check for read log for failed drive and return */ From patchwork Thu Feb 10 11:42:13 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: 542328 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 8FF0AC433F5 for ; Thu, 10 Feb 2022 11:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241172AbiBJLmt (ORCPT ); Thu, 10 Feb 2022 06:42:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241158AbiBJLml (ORCPT ); Thu, 10 Feb 2022 06:42:41 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 204FD1081 for ; Thu, 10 Feb 2022 03:42:43 -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=1644493363; x=1676029363; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=pPRaxLs4RU6X97Z7l3OroNrE2jwzr56AM3rErLhNkhs=; b=XgNbCsjXCTU1UtvyH78Gz26WNWkqqMDzW6ofw5mbm1AL+Qw3ALnChk6F 8JgljDmdbPbXkUb1Ti5j86HzsdFMP63wUr9Y6LB8smo02FpgXEOKLxJHZ xV136Yh1IMxjKuWNFYcMxC4cpMP43Qm02osOt7E5tNPdD5BVX3bCrPT7X OUpa6aJolsW7mwqGDeYLOWwUCN8+er6flqRG2YtrE0cpTA3xDfN2JK2/B PmmNe33whAbAMSrq5ApoS6v2InBjPABH2GWqg8ZcTrHWVGSSuDY5ou5ih 2scYNXPP9XdRrhWoC/+5uxWG/WRIBC06/DV68OQ3JuSLN2tNapi60XkU8 g==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575658" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:43 +0800 IronPort-SDR: 7CrE4VIYOC7KL9A4HKb7LyFeLPXTB3xrWjzSzLJcTJJOOx2nI0nfUtjBLXYTy9lf5kArKNRtaY N1al8yseSCRV8uftAkiSiSw9KOcQKQrTqhtm9fZDBOnIa/NNx9eJBNTLCceYg5PTGgIYtTFhjj 19Eju/MuxzTFYbfdjFXlQcnnI8dBm/XY/OioqMkvP/y/03fWcv8vh/NgAF0d67yDQECIH0mXTf sJCxRts8CDLKhDXPJFsfzTPciEhJGsDIZEs1gJT4oTMryDbRQ2IuesurX82NSttk5CHaFbLfrd 5Q1K/U6nFsmxSxeuWVfYG7HP Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:40 -0800 IronPort-SDR: yI3sV23UnLR6UdQoXSuOvcadg3tl9TN98GMjO7CDTXoe2vjZcFKERoe4yCJ4OUONJYuJi14bn8 q4wO707kmNO2ID0wfzffuBhUQlcWvVGDZTBETo7PAgJsRhwZK7ct3pjBwmOK6dWrS1kcaYmBwL Hb6X2U6FD/aBMHYjNk0zDMn0D61khPI6QsOq5OUF9C7AlLLaQceWEbpE9fHUYjzIcKK1m2UpcA BFjsXa3XAVIRBg704FjA95ScFAJZyqe5XHaFJRIi9o9fRtySQiNFt9dJgla/QaotLQPQhm9H+y mPY= 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; 10 Feb 2022 03:42:43 -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 4JvZcL5092z1SVp1 for ; Thu, 10 Feb 2022 03:42:42 -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=1644493362; x=1647085363; bh=pPRaxLs4RU6X97Z7l3 OroNrE2jwzr56AM3rErLhNkhs=; b=sPGyNXDRHqsgCGYS2wo9YzIlfn4Xp7IWDr S83Ey+gFrXjG3GHPOxU/WvPQrcivbSxs+VFo2MtftxRh5vOpO+PhPZ7RMmGRqEk7 9WudyFalR0YWv9qxR+6b/9B+UiwTrpPl4iUodCxWmPMhbp4/Wn+zh93NNQ8iMuUv p94Eq2TiBDb88HSN1LDDv/v3RZVo99+bOSRrxNk+ybeXQbyg7bZ1IiICv9aaHZ6A xX81cg0ejneUay1bwO0z/sjQlYMI0HWjCQtWR2Kp6w2kdDBC54iKVT9r8jyBchPV KolOHS3ZgEOgqT5k8Ucynu0m543TXQTCCO/RgxlqvJgTW04OVjqw== 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 mZJ40LutlipQ for ; Thu, 10 Feb 2022 03:42:42 -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 4JvZcK1bHbz1SVp0; Thu, 10 Feb 2022 03:42:40 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 15/20] scsi: pm8001: fix use of struct set_phy_profile_req fields Date: Thu, 10 Feb 2022 20:42:13 +0900 Message-Id: <20220210114218.632725-16-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In mpi_set_phy_profile_req() and pm8001_set_phy_profile_single(), use cpu_to_le32() to initialize the ppc_phyid field of struct set_phy_profile_req. Furthermore, fix the definition of the reserved field of this structure to be an array of __le32, to match the use of cpu_to_le32() when assigning values. These changes remove several sparse type warnings. Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm80xx_hwi.c | 12 +++++++----- drivers/scsi/pm8001/pm80xx_hwi.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index fbdc56351901..dc0a84c81189 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -4976,12 +4976,13 @@ static void mpi_set_phy_profile_req(struct pm8001_hba_info *pm8001_ha, pm8001_dbg(pm8001_ha, FAIL, "Invalid tag\n"); circularQ = &pm8001_ha->inbnd_q_tbl[0]; payload.tag = cpu_to_le32(tag); - payload.ppc_phyid = (((operation & 0xF) << 8) | (phyid & 0xFF)); + payload.ppc_phyid = + cpu_to_le32(((operation & 0xF) << 8) | (phyid & 0xFF)); pm8001_dbg(pm8001_ha, INIT, " phy profile command for phy %x ,length is %d\n", - payload.ppc_phyid, length); + le32_to_cpu(payload.ppc_phyid), length); for (i = length; i < (length + PHY_DWORD_LENGTH - 1); i++) { - payload.reserved[j] = cpu_to_le32(*((u32 *)buf + i)); + payload.reserved[j] = cpu_to_le32(*((u32 *)buf + i)); j++; } rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, @@ -5021,8 +5022,9 @@ void pm8001_set_phy_profile_single(struct pm8001_hba_info *pm8001_ha, opc = OPC_INB_SET_PHY_PROFILE; payload.tag = cpu_to_le32(tag); - payload.ppc_phyid = (((SAS_PHY_ANALOG_SETTINGS_PAGE & 0xF) << 8) - | (phy & 0xFF)); + payload.ppc_phyid = + cpu_to_le32(((SAS_PHY_ANALOG_SETTINGS_PAGE & 0xF) << 8) + | (phy & 0xFF)); for (i = 0; i < length; i++) payload.reserved[i] = cpu_to_le32(*(buf + i)); diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h index c41ed039c92a..d66b49323d49 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h @@ -972,7 +972,7 @@ struct dek_mgmt_req { struct set_phy_profile_req { __le32 tag; __le32 ppc_phyid; - u32 reserved[29]; + __le32 reserved[29]; } __attribute__((packed, aligned(4))); /** From patchwork Thu Feb 10 11:42:14 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: 541672 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 1EA69C433F5 for ; Thu, 10 Feb 2022 11:43:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241111AbiBJLm7 (ORCPT ); Thu, 10 Feb 2022 06:42:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241118AbiBJLmn (ORCPT ); Thu, 10 Feb 2022 06:42:43 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6328A13A for ; Thu, 10 Feb 2022 03:42:44 -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=1644493365; x=1676029365; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=DJmm9qwWl1xzoMpoCIv+1lIuCBbSqqCn4azkj1DgYrw=; b=aHErv7Wkjmm2aAg4clC6zFVtpFuhoQTr8g8KzqqlbP6nRpz9JsOgW7BZ ZhN8oq6FPnjKtIxZv03aR79p4rB7w6+NaGC2MnH28hbfAZISju3xT60ON PvS+VRsQ4qTlO60qT2/NEBMX8OEYPjHfFy15m0nQ9Wk2sI+HvTLCFfnfa W21q5b4z6Va0BgSR/tFDmrinMEayEOp2m/8TpvFni4ukm9P5B4Qu7IHWv ykGfhv78iEcOm44HmqU27PBZnAVdTmqEZvJLtTxf88ZzR7uhpIo7aNVJS d1foMFkxDz0mDlGCKzW+DCGLaCZ1dQHS8w0rquKcOn5IQixg+5T2qpMGz A==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575660" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:44 +0800 IronPort-SDR: 8ihg0tqI/e1sBotdqKdLJmOJO+gHmt7IKh4/6k+u7NeTpexJjQkPkL1p5BV506xQrEnjW0Szkb Uj1xJ1azZQyHwnO8Q05/78uX0KU019W4Z8IM03lLs1Jiep/Uu7tUsZxiWmYAC13WpAKjH/OZLg mBqOtN1fnh6mU0nt2OJWHJp0wXq7zMOZFIiSLkhLx1bd1QeCtK4QphuJ/708IJgpJwmJtQ1mBG QNNrtNocZOWon2CPVEzBAL+llDpsrkmsdv3fmfNgw7i3BWGzQAcrONHHJNKEYmC+2USDvVQGcD itArvi5nlh7EKVtZJKQsLzTG Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:41 -0800 IronPort-SDR: CpQae64Gg1w8NIhjgp71ISXV9hxFiZYlYFJxlSAhML/L/WSgGWK2LNdjx/JMOOwBJUecBychm6 13ATxVL9TjvFWGKnrBkm8oy/ohoS9P/ADQgFcRh7iae8Wem65BuynZq0BRLhek+yF0ViUOUJ6K C2Z7Rc6cFtyrdGZ+Jl4s7RqvePL3x3zw6vlpNCg1n+DemOWgIpz8Oym8RctI2X/PmSZm+5rvEA qJ3heNkq5FU33U3kv6rtjeCMQzxw1CfEkAja+EcB8y+i8ZApF3VgUlF+rmCkTJcD3aI/KuGCQJ CEU= 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; 10 Feb 2022 03:42:45 -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 4JvZcM6QbFz1SVp0 for ; Thu, 10 Feb 2022 03:42:43 -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=1644493363; x=1647085364; bh=DJmm9qwWl1xzoMpoCI v+1lIuCBbSqqCn4azkj1DgYrw=; b=nP5I/DNAchVUvTtRv2A0N7nsgP9mK4LPUI 1GVi/Q1kUW7+HRWSoluf11BK53945BOhzq3JHoFGS0Ac+wlxjetf1S/JIc/7kZP8 zzQhzSYSJdHTvmexjCJ2a0FUBBQIhgZLcbFpji/vUInDU3fdvfTjXMdhCbhRbAas fVn1lPGtnJbCCGbE68+RyC3GsZZHr/bMmtMECVCFnfl9/zxcXJAYJQylLQbqse4J cPt22R0Q/1QaNpZ0tRllpTB7UijiFjIwzy8Z2zzjHFbyXzXQZOHGKH5gxwDDk7Bf m2HRtWSNgdQacL5cZ/QCD0qORFzY7hLN+nec7DOfdEevcK8WBpoQ== 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 mkVqFc704fpo for ; Thu, 10 Feb 2022 03:42:43 -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 4JvZcL3t48z1SHwl; Thu, 10 Feb 2022 03:42:42 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 16/20] scsi: pm8001: simplify pm8001_get_ncq_tag() Date: Thu, 10 Feb 2022 20:42:14 +0900 Message-Id: <20220210114218.632725-17-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To detect if a command is NCQ, there is no need to test all possible NCQ command codes. Instead, use ata_is_ncq() to test the command protocol. Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_sas.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 6805c7f43e41..711eaf81f546 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -306,16 +306,12 @@ static int pm8001_task_prep_smp(struct pm8001_hba_info *pm8001_ha, u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag) { struct ata_queued_cmd *qc = task->uldd_task; - if (qc) { - if (qc->tf.command == ATA_CMD_FPDMA_WRITE || - qc->tf.command == ATA_CMD_FPDMA_READ || - qc->tf.command == ATA_CMD_FPDMA_RECV || - qc->tf.command == ATA_CMD_FPDMA_SEND || - qc->tf.command == ATA_CMD_NCQ_NON_DATA) { - *tag = qc->tag; - return 1; - } + + if (qc && ata_is_ncq(qc->tf.protocol)) { + *tag = qc->tag; + return 1; } + return 0; } From patchwork Thu Feb 10 11:42:15 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: 542326 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 F2FD6C433F5 for ; Thu, 10 Feb 2022 11:43:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241124AbiBJLnC (ORCPT ); Thu, 10 Feb 2022 06:43:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241152AbiBJLmo (ORCPT ); Thu, 10 Feb 2022 06:42:44 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8644C60 for ; Thu, 10 Feb 2022 03:42:45 -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=1644493366; x=1676029366; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=rlXxGp033QXTb1RelNIInaFL24iqKoMEzE7qeVpmiTw=; b=nNlb+ecqM3Tg8CZWMSP2amPZU3cV+f7dD1Gx4/Tob+0dejwUAj1tjpQ2 Owcm+hFChnaht/57PgsfrZb5CNWuvC0ZVTDmPIw3yLPS5UEWGlgdRLVT/ bCWIkdKI2rRz7fWKENfPpsP4E1+xfafaeaP9j3PYjFuPLcEZIKQ/dvl8z 1DaTSQ8KRV1zmtrFRklyO0yZ0JX8/7wpmuScfnnQXQ1HRtuPVr6fP3EV5 uU6RwAA2vg4Qx90JkvvvNFwZH7c5tSjEcwRZxGss2zo0CpSw1L0yohIBq E1rvymxshwODuSeDsd22s73C2hoe6c/Jtce9wAfYkSoAinmAqDoP2CwHS w==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575664" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:46 +0800 IronPort-SDR: wnQrJhxSnuRD16GcQIqE/IVrdib/KRn+Sr/qhIbNK49oG5d6ynBVG6ldy+wJqafLJYZ5213vQD vP6q1jGNGRlAEtYhWV/TjyJ3NvaF3az8siOYZ5cD0OPMFZ9k0hOzEvtBObR733DceXJgYfsYyL 8Z4xk3lZbv3/ivGI7gF8/GTEwvFgSanvf+fFv0QO7jfIpcy2ph3r7P6H06ZnpfPLGhgE83wD9z tYLQRTHGi65Bp1610S3TBQvi0uw/CqHRnHfO+cUCk5RNgm2ya66j6Yo7vQKjGb5LJiDghtTgRn 4mfZYTMxW7UPqMbaXr6ot/eT Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:42 -0800 IronPort-SDR: bbd31btjjbh4UzV2PNTKi04v/A8EdaB225HhJRZkFDjp9p/WGV6wy4rgtlTKcUUkEb7n2o8JNH 0FGiTlz7PC/44x9tiQMgyLfFKP0gnwaN7H+UQqTLT3zo39tL3V2Xy9WVSAynUvaw77AyafU9q2 S9ckaz5jCxXVN3Z8iNdzQLwyIp01gIRWM8iSrLKEt97SJ7f9ADPb/eGv9R+RGHGKqfq/DiBnUb X7+ZtFRDDZyIT3Z4BGTvYgY8NitpBxu2vfEyh44o1hUbTujRoGsasao36ClNjEUCBnpnLlJ6FS 1rA= 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; 10 Feb 2022 03:42:46 -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 4JvZcP1qMtz1SVnx for ; Thu, 10 Feb 2022 03:42:45 -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=1644493364; x=1647085365; bh=rlXxGp033QXTb1RelN IInaFL24iqKoMEzE7qeVpmiTw=; b=qEPWu9hzNQt9kjdOxruiOyZ4H6g4/r89/l ZzjMftffBL2BcXfNxGulSkK6J1rR3Ke45lkYn9XwlnWRiHk+robsDa0Sk8y683rW dn2/eLcg7bwErVyuCTMqQqe7h2aYW+3xSZl0j9xpUmHleMnJ3qnVLy6oXHJ3KPTw WPUMb/SR7s6K/MLwdS+PNO6LsJ26OnT+5+TPqJFrdjHGvFjfeYndyHIslU6Lz56k KVIlHwTgISfbZl5hwF11FHHgX9B4KngmiS2+UA+TxbHA6YbKutWj7iYlet4ATWhR GDJ/FkOR+HvfNuZLCpoKOYghN8bFMZUFoaywg92IgvGMD72UVyfg== 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 KY4Qn7q_gvMi for ; Thu, 10 Feb 2022 03:42:44 -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 4JvZcM5Rw1z1Rwrw; Thu, 10 Feb 2022 03:42:43 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 17/20] scsi: pm8001: fix NCQ NON DATA command task initialization Date: Thu, 10 Feb 2022 20:42:15 +0900 Message-Id: <20220210114218.632725-18-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In the pm8001_chip_sata_req() and pm80xx_chip_sata_req() functions, all tasks with a DMA direction of DMA_NONE (no data transfer) are initialized using the ATAP value 0x04. However, NCQ NON DATA commands, while being DMA_NONE commands are NCQ commands and need to be initialized using the value 0x07 for ATAP, similarly to other NCQ commands. Make sure that NCQ NON DATA command tasks are initialized similarly to other NCQ commands by also testing the task "use_ncq" field in addition to the DMA direction. While at it, reorganize the code into a chain of if - else if - else to avoid useless affectations and debug messages. Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_hwi.c | 14 +++++++------- drivers/scsi/pm8001/pm80xx_hwi.c | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 43c2ab90f711..9d982eb970fe 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -4271,22 +4271,22 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, u32 opc = OPC_INB_SATA_HOST_OPSTART; memset(&sata_cmd, 0, sizeof(sata_cmd)); circularQ = &pm8001_ha->inbnd_q_tbl[0]; - if (task->data_dir == DMA_NONE) { + + if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { ATAP = 0x04; /* no data*/ pm8001_dbg(pm8001_ha, IO, "no data\n"); } else if (likely(!task->ata_task.device_control_reg_update)) { - if (task->ata_task.dma_xfer) { + if (task->ata_task.use_ncq && + dev->sata_dev.class != ATA_DEV_ATAPI) { + ATAP = 0x07; /* FPDMA */ + pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); + } else if (task->ata_task.dma_xfer) { ATAP = 0x06; /* DMA */ pm8001_dbg(pm8001_ha, IO, "DMA\n"); } else { ATAP = 0x05; /* PIO*/ pm8001_dbg(pm8001_ha, IO, "PIO\n"); } - if (task->ata_task.use_ncq && - dev->sata_dev.class != ATA_DEV_ATAPI) { - ATAP = 0x07; /* FPDMA */ - pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); - } } if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index dc0a84c81189..44071a97d23b 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -4551,22 +4551,21 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; - if (task->data_dir == DMA_NONE) { + if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { ATAP = 0x04; /* no data*/ pm8001_dbg(pm8001_ha, IO, "no data\n"); } else if (likely(!task->ata_task.device_control_reg_update)) { - if (task->ata_task.dma_xfer) { + if (task->ata_task.use_ncq && + dev->sata_dev.class != ATA_DEV_ATAPI) { + ATAP = 0x07; /* FPDMA */ + pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); + } else if (task->ata_task.dma_xfer) { ATAP = 0x06; /* DMA */ pm8001_dbg(pm8001_ha, IO, "DMA\n"); } else { ATAP = 0x05; /* PIO*/ pm8001_dbg(pm8001_ha, IO, "PIO\n"); } - if (task->ata_task.use_ncq && - dev->sata_dev.class != ATA_DEV_ATAPI) { - ATAP = 0x07; /* FPDMA */ - pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); - } } if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); From patchwork Thu Feb 10 11:42:16 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: 541671 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 7F4B4C433EF for ; Thu, 10 Feb 2022 11:43:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241084AbiBJLnB (ORCPT ); Thu, 10 Feb 2022 06:43:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241154AbiBJLmp (ORCPT ); Thu, 10 Feb 2022 06:42:45 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E444C1019 for ; Thu, 10 Feb 2022 03:42:46 -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=1644493367; x=1676029367; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=q29mMJqlbDLunlNIuDMRbjAb6cPg/7LfvEGK91gjkoQ=; b=F8v7vvlr1jtQ5/4K/yVlStHg9GPyjo7KRJEnD6Imlf/2o7RGZ01VjIPb Af8mdPe0Ea20jGwld1VnAli8V4T/1GYMsfPEE297UcGVWiAV2o7H+TbBX SzZzYueb+tLWDBOXiYfayguAG/d646avwIXSCZyZ4k+ukDlce0yhmK6I3 ED5D7CBGbkuoLEEa7BBt92LFQefT9EmiKdtmatmmRYh3ABWnx4qV01bnw W3k0Q9OD2vaIf3qQL3tEeSaeXQTfiglgHV0s3pHkKWgTYY2MbanCg7Uoy LI+pm66aDN/ZH0dBJWSZu/aRsAT26CY806zLvFV1Jta/6Yxvna7A9R4uu g==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575665" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:47 +0800 IronPort-SDR: f7Sc/hwBlP1qBRI8SQeQJAytklw/MsOzyyc9V+3u1iNFMOZGpnCN/7AL+jaxdawfr34jSyLz9b JfhdW82OuyB9YNTn8FKw8M7KLYU8RL2QtZnMU2Dbb18s1sdljlSj4h+gQugl1OUz+bf56upUHI rwic7XnIbXHFpCrm5Q4/AA2bil+0jqxpb6geCEtXDCdzfrN/f2KoRR4qkRux1NIjpC+7sYPi+r uhjptALafCegkCKjTEHuEiPojXUrza1dEfDCOBxRl7dru/iIT1s7/TJjIGKQb+a2DVVJ7fRGRd qCDj+XhXTUk6bDQcokuy8iNd Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:43 -0800 IronPort-SDR: qSKaA2RuqO/yfxwLRQdYsvZqxSXRN1NccyI+upChv8M79ZtWUIlHcHDBr40GZYE1sqTW9wMcA4 CXXN1O2bc9mL/TwyR70a5rIhjEcBjZflJB9zmhTik2zLtylbdOznMoQ0ftmbhTa/0oGJq8IJn4 kYJwBdXfHiDmXNba0ixYfPu6priJGkXrUeE8iiGEZg0wVGc/1EH9Y0fkMPALC104Vy3JG97zYo NNZWzyJBnChitEA14rNS9Z+eKztFoe2WrGGdzNBAsM559p2lxSiG8T7rT79ZxDnWalv5vqx6CY LCc= 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; 10 Feb 2022 03:42:47 -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 4JvZcQ3kBcz1SVny for ; Thu, 10 Feb 2022 03:42:46 -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=1644493366; x=1647085367; bh=q29mMJqlbDLunlNIuD MRbjAb6cPg/7LfvEGK91gjkoQ=; b=UOwD3gqHVpke8O4siGF+E+CWKKt6+US6rx 7r9VZpzQzk4arrLRYX/MtOxlRp2wB+qgj/KPXizpkHjxMNAHhxBw08anwRpweQvD VmzuKKVza6GvSY1wjnaeUvjik2Wkcf/N40ueINvCWfPMpFsmVyuAFuGE3qVjD8g+ WGxMoHDz9eO9SeQOfuJpHbT6k1AF6FREANOLwm2vLK5ACEMGY3CSdnnMwafA2XqV cZCdJoeJMZB7vxTetJvaSCiwqKwVBlCsl5lDfgb5mlC9wpNUM3mDC6Zg0q4/wOKD 4XaGRhrLfIZ4Fw+S4T5X58uL6HyplyOMQ7M8qPRoyaZOWPiejJ2w== 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 xYAFKWVTL-y5 for ; Thu, 10 Feb 2022 03:42:46 -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 4JvZcP11w3z1SHwl; Thu, 10 Feb 2022 03:42:44 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 18/20] scsi: pm8001: fix NCQ NON DATA command completion handling Date: Thu, 10 Feb 2022 20:42:16 +0900 Message-Id: <20220210114218.632725-19-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a register-device-to-host-FIS response is expected for it. However, for an IO_SUCCESS case, mpi_sata_completion() expects a set-device-bits-FIS for any ata task with an use_ncq field true, which includes NCQ NON DATA commands. Fix this to correctly treat NCQ NON DATA commands as non-data by also testing for the DMA_NONE DMA direction. Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_hwi.c | 3 ++- drivers/scsi/pm8001/pm80xx_hwi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 9d982eb970fe..8095eb0b04f7 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -2418,7 +2418,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) len = sizeof(struct pio_setup_fis); pm8001_dbg(pm8001_ha, IO, "PIO read len = %d\n", len); - } else if (t->ata_task.use_ncq) { + } else if (t->ata_task.use_ncq && + t->data_dir != DMA_NONE) { len = sizeof(struct set_dev_bits_fis); pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", len); diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 44071a97d23b..4d88c0dbcefc 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -2510,7 +2510,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, len = sizeof(struct pio_setup_fis); pm8001_dbg(pm8001_ha, IO, "PIO read len = %d\n", len); - } else if (t->ata_task.use_ncq) { + } else if (t->ata_task.use_ncq && + t->data_dir != DMA_NONE) { len = sizeof(struct set_dev_bits_fis); pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", len); From patchwork Thu Feb 10 11:42:17 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: 541670 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 A45B7C433EF for ; Thu, 10 Feb 2022 11:43:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241152AbiBJLnD (ORCPT ); Thu, 10 Feb 2022 06:43:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241164AbiBJLmr (ORCPT ); Thu, 10 Feb 2022 06:42:47 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464611022 for ; Thu, 10 Feb 2022 03:42:48 -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=1644493369; x=1676029369; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=35QePzbOKeA+/Ffi5CHtsZ5USOZqrahcT8z3vAl3Wv8=; b=Pe93bV537hAl7DjfMmC2+lL/tCsfrgUFu8AnFi5XH4GE7uv/+GpqUJMY H5hWvCT5Q/ilKFfBnqpltUozAzVblzOaIAN0V0AI1EDfJREaxPvFA6xek Axc+B+hMvBTwzUa3OsFnu0aLd5c3IjGRomz0ih4OzYftSC0J+WSVJe6am C6ntmD0+OlFitpLl8w4HQotV/F1cIZTuYFDuG+BDEn2yfYRNolOQ3v7of dEnDSN5bHpK/LHjXRiENygBsYLKa1YEmXZsGoB/yjyGhntxb4LTOIrTtS yfjaLgxvTJZVIBJwpqPZGxT3tF6gVeeuSqlMobUuJZXZelsFDwrg4mznM A==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575669" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:48 +0800 IronPort-SDR: XAWCeaJmptwjKCituU5oUwpZ1GAgEAF1wdoHY01II45KgtzGf92O6e9nACeBjuRrM4H4MK/A8z xaEM8QRUwHCvlzwJFg2Y6erq4yKJMaYI+SowgRyDhwPVmo8fB9IZRZWDBB1+n6j9oesu8cbbJb 48IjvlJpnKH5jNLncsdDLLjo0f6fRkGyYLzxRg5AQ15UnI+9Ut+jLDFzCDb9zmnwkia6orbTYm X31RgmRo0gAW3LespLTM7dUhvlBM2Hb6nDL+u36fe1aQPtMjNRCYHwUDUcSTCnYSMkYzFv0GAL SSJixAoyaVwyslcWTXke7JaL Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:45 -0800 IronPort-SDR: BdNkxjJ0ZpvF0twW8Ce0kzHCxOFKVOsDMNNyCRjJXjKDH2IsejJ7jJm/xkp+upmViDarGReVH4 cGV/JhWn1CZuhly7UJl3iGyHwOirck/pZ5RuTunmKp5QX1zXpwmVVpdezKFpEF3QaADFSR+SMI okbFFnml3OD0OEHE0fNcdFWRBOifyaPlXlKNFUOwqfJ+AB/UArc/inXnqznH8fcD7qFsFHy2gQ gnFq/PQ0Z3WJmSKKIFeuYnFls7u3aaanqKcklCttJKg13LlRbnWjlCURtOk/tbS9r6D0JESmhu H1Y= 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; 10 Feb 2022 03:42:48 -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 4JvZcR5mTLz1SVny for ; Thu, 10 Feb 2022 03:42:47 -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=1644493367; x=1647085368; bh=35QePzbOKeA+/Ffi5C HtsZ5USOZqrahcT8z3vAl3Wv8=; b=IvsgSWQS/0PFm1cTVJ4J+MhtirTpMesnvE waCGTg0zmdFVBv7QxfcuVEHCpdXRYipxCy8bUSk65/2UhCaCrjX7Ck+pIf9azNKs hSb8l5MAXy+brdLh39XCIQZxffovQ2JN0y8S8igljMHh8rM693GmzcRdA0Y+hJOU 6R5GQkL4LGyznTWm13095P7FpzrT9u0NTmQrlG29cQfXeqLTqETtEuSaRMP1K+oC bH3GxHtLaorfT9a6eiSsbjrLFN51uxgo8X73xZ2jwWjR9S+Qok4xEQ+j1/UX0Agk Pcie/R5znW3AL3F1Xf4UX1JmxlU0YwtQY/UoS0LbDHNnDzSjxiQQ== 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 dRI-Lglc76we for ; Thu, 10 Feb 2022 03:42:47 -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 4JvZcQ2lWLz1Rwrw; Thu, 10 Feb 2022 03:42:46 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 19/20] scsi: pm8001: cleanup pm8001_queue_command() Date: Thu, 10 Feb 2022 20:42:17 +0900 Message-Id: <20220210114218.632725-20-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Avoid repeatedly declaring "struct task_status_struct *ts" to handle error cases by declaring this variable for the entire function scope. This allows simplifying the error cases, and together with the addition of blank lines make the code more readable. Signed-off-by: Damien Le Moal Reviewed-by: John Garry --- drivers/scsi/pm8001/pm8001_sas.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 711eaf81f546..929d3d3c9d3b 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -383,54 +383,53 @@ static int pm8001_task_exec(struct sas_task *task, struct pm8001_device *pm8001_dev; struct pm8001_port *port = NULL; struct sas_task *t = task; + struct task_status_struct *ts = &t->task_status; struct pm8001_ccb_info *ccb; u32 tag = 0xdeadbeef, rc = 0, n_elem = 0; unsigned long flags = 0; enum sas_protocol task_proto = t->task_proto; if (!dev->port) { - struct task_status_struct *tsm = &t->task_status; - tsm->resp = SAS_TASK_UNDELIVERED; - tsm->stat = SAS_PHY_DOWN; + ts->resp = SAS_TASK_UNDELIVERED; + ts->stat = SAS_PHY_DOWN; if (dev->dev_type != SAS_SATA_DEV) t->task_done(t); return 0; } + pm8001_ha = pm8001_find_ha_by_dev(task->dev); if (pm8001_ha->controller_fatal_error) { - struct task_status_struct *ts = &t->task_status; - ts->resp = SAS_TASK_UNDELIVERED; t->task_done(t); return 0; } + pm8001_dbg(pm8001_ha, IO, "pm8001_task_exec device\n"); + spin_lock_irqsave(&pm8001_ha->lock, flags); + do { dev = t->dev; pm8001_dev = dev->lldd_dev; port = &pm8001_ha->port[sas_find_local_port_id(dev)]; + if (DEV_IS_GONE(pm8001_dev) || !port->port_attached) { + ts->resp = SAS_TASK_UNDELIVERED; + ts->stat = SAS_PHY_DOWN; if (sas_protocol_ata(task_proto)) { - struct task_status_struct *ts = &t->task_status; - ts->resp = SAS_TASK_UNDELIVERED; - ts->stat = SAS_PHY_DOWN; - spin_unlock_irqrestore(&pm8001_ha->lock, flags); t->task_done(t); spin_lock_irqsave(&pm8001_ha->lock, flags); - continue; } else { - struct task_status_struct *ts = &t->task_status; - ts->resp = SAS_TASK_UNDELIVERED; - ts->stat = SAS_PHY_DOWN; t->task_done(t); - continue; } + continue; } + rc = pm8001_tag_alloc(pm8001_ha, &tag); if (rc) goto err_out; + ccb = &pm8001_ha->ccb_info[tag]; if (!sas_protocol_ata(task_proto)) { From patchwork Thu Feb 10 11:42:18 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: 542327 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 7D272C433EF for ; Thu, 10 Feb 2022 11:43:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241116AbiBJLnA (ORCPT ); Thu, 10 Feb 2022 06:43:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241167AbiBJLms (ORCPT ); Thu, 10 Feb 2022 06:42:48 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849EA102D for ; Thu, 10 Feb 2022 03:42:49 -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=1644493370; x=1676029370; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+J8FxMhXR8JWNegw+xYbyFv9L2V5iQzskG8x+OQmcLU=; b=ag4Dnl9Z42CH74xPsgpJggRiQiWL6XR3v8OuxyXkvWg0G9NBEWBxXBDd Ww4DcCVI+1L9LcAtul5ILDcARpDHK7LGt7Gl0M5luWfVfC9Rihb0wnJ12 mRg3GIkDDM66FHyy7iUF0jf51QuN5+8AFmL3Q9/ng1fLzLYrjppV40IDR rKxh71KDmOhi5cXFc3AP0gITSJSMxQiiah5WtWcGKuChOsR49c3TFNRRv s7wWHX38HVfvL0BhlfjSA6Tq3XdUbB8ZMlQgG7mVEHkrnhPMqOFiQ1MF0 UhJyPHX8iGLUGAvA/6TFg1ElXY5Ubs8/r3Auje40/E/2yKD+LHAEUG2or w==; X-IronPort-AV: E=Sophos;i="5.88,358,1635177600"; d="scan'208";a="193575672" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2022 19:42:50 +0800 IronPort-SDR: gJ0WNMk5OiUGjMMRaxMNF3LjhmjiyAdoBwNePOxpclsQLSXiRyXgBPzueB1WM7NaAn7v3JVm39 8kN9tbFoSO3LDHAKeb3LLiERWMlP1cK+HDdJPmaYonAmNf+dGesEHbUcoJKVzFQCaObrfHUgRi 7+hqlTpKF/0lm/2GCfO2Ock7jtHK7s5NUOP9ocuPP28hAIF8Nb/as+lDMW1BmEKCIDl2pW7X4v /qRUu2hLtbaMqBaU1uLr4Bx+j0mQI/PGcMrnhk3BofeeuNOdWaA6RDK0nzLT5f0tSgotj2DW7/ TUhpAIx7J2cffBarcz76djat Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:15:46 -0800 IronPort-SDR: f5VHWXWV9TqF2h/fTktrGMy6s2FoKPpEEKdiKKDvarGkoKAbqTSlR6LKHtWMVP9i8Zv6on4A5T 1tzNgiC6Lv/jpSNauhB2I1I7H7do6M15A/odoACjmj3TTrh4sdm4B8FdhbhvqQ0k7Vm7kEEcAT uikazlotwD5LPfvIv7Um8p7ZWmV3Fc27TypxSQI30DgAG81eU3p7XrKDPhB1P9TqevsQ3QYYen DxHD2Uf7krNOLT3YJgtmdCgJcfu9glpqkduFvjUD0Seiu3cCpE28/fMisuYQIw7f11jq8jRSN4 5YY= 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; 10 Feb 2022 03:42:50 -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 4JvZcT0X3Pz1Rwrw for ; Thu, 10 Feb 2022 03:42:49 -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=1644493368; x=1647085369; bh=+J8FxMhXR8JWNegw+x YbyFv9L2V5iQzskG8x+OQmcLU=; b=eYG9CiXWVd1RTjEbwsuo7cVvhpnWoRydVN Dckd/KipAzXxGeU2ZFilTrL1rHNcTlwq5PKO7nKqkaFewmZFR4VqGlFaIX2wu2NI yiYNqnkSBWQB0emaYKRlzOZv7RvmAcXLnq02Ki3uv40pClmKfrIafzsk/dON3RY0 1ZYmGaW88ppW5tTe2sggQZVL86XfsOtfDZ1ZWx/TSuOFnnEiqi/7TEJ6y7Xkl1wc tmlsOwtpRG4YPOr13vYN2Q47OOeSQkO1si9D1gN2UkXzWM/c91ZH92odnLQZR+ea rPAOqVFX/UElE0Naahjj9wAZHQZaKWsaIMtZB7r3nVeq6rTffvfg== 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 fpaiGLRrjPyT for ; Thu, 10 Feb 2022 03:42:48 -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 4JvZcR4htyz1SHwl; Thu, 10 Feb 2022 03:42:47 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Xiang Chen , Jason Yan , Luo Jiaxing Subject: [PATCH 20/20] scsi: pm8001: fix abort all task initialization Date: Thu, 10 Feb 2022 20:42:18 +0900 Message-Id: <20220210114218.632725-21-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> References: <20220210114218.632725-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In pm80xx_send_abort_all(), the n_elem field of the ccb used is not initialized to 0. This missing initialization sometimes lead to the task completion path seeing the ccb with a non-zero n_elem resulting in the execution of invalid dma_unmap_sg() calls in pm8001_ccb_task_free(), causing a crash such as: [ 197.676341] RIP: 0010:iommu_dma_unmap_sg+0x6d/0x280 [ 197.700204] RSP: 0018:ffff889bbcf89c88 EFLAGS: 00010012 [ 197.705485] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83d0bda0 [ 197.712687] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff88810dffc0d0 [ 197.719887] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff8881c790098b [ 197.727089] R10: ffffed1038f20131 R11: 0000000000000001 R12: 0000000000000000 [ 197.734296] R13: ffff88810dffc0d0 R14: 0000000000000010 R15: 0000000000000000 [ 197.741493] FS: 0000000000000000(0000) GS:ffff889bbcf80000(0000) knlGS:0000000000000000 [ 197.749659] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 197.755459] CR2: 00007f16c1b42734 CR3: 0000000004814000 CR4: 0000000000350ee0 [ 197.762656] Call Trace: [ 197.765127] [ 197.767162] pm8001_ccb_task_free+0x5f1/0x820 [pm80xx] [ 197.772364] ? do_raw_spin_unlock+0x54/0x220 [ 197.776680] pm8001_mpi_task_abort_resp+0x2ce/0x4f0 [pm80xx] [ 197.782406] process_oq+0xe85/0x7890 [pm80xx] [ 197.786817] ? lock_acquire+0x194/0x490 [ 197.790697] ? handle_irq_event+0x10e/0x1b0 [ 197.794920] ? mpi_sata_completion+0x2d70/0x2d70 [pm80xx] [ 197.800378] ? __wake_up_bit+0x100/0x100 [ 197.804340] ? lock_is_held_type+0x98/0x110 [ 197.808565] pm80xx_chip_isr+0x94/0x130 [pm80xx] [ 197.813243] tasklet_action_common.constprop.0+0x24b/0x2f0 [ 197.818785] __do_softirq+0x1b5/0x82d [ 197.822485] ? do_raw_spin_unlock+0x54/0x220 [ 197.826799] __irq_exit_rcu+0x17e/0x1e0 [ 197.830678] irq_exit_rcu+0xa/0x20 [ 197.834114] common_interrupt+0x78/0x90 [ 197.840051] [ 197.844236] [ 197.848397] asm_common_interrupt+0x1e/0x40 Avoid this issue by always initializing the ccb n_elem field to 0 in pm8001_send_abort_all(), pm8001_send_read_log() and pm80xx_send_abort_all(). Fixes: c6b9ef5779c3 ("[SCSI] pm80xx: NCQ error handling changes") Signed-off-by: Damien Le Moal --- drivers/scsi/pm8001/pm8001_hwi.c | 2 ++ drivers/scsi/pm8001/pm80xx_hwi.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 8095eb0b04f7..d853e8d0195a 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1788,6 +1788,7 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem = 0; circularQ = &pm8001_ha->inbnd_q_tbl[0]; @@ -1849,6 +1850,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem = 0; pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG; pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 4d88c0dbcefc..902af4eefa26 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1801,6 +1801,7 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem = 0; circularQ = &pm8001_ha->inbnd_q_tbl[0];