Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp676430pxb; Tue, 5 Apr 2022 18:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPnrzqNjwEKDc7CnNpZ4TSfmB8BKFAf2ZuN3A/ynrUS9EOjGy9NJv2IoS8m7iXcR+jePLE X-Received: by 2002:a05:6a00:2392:b0:4fa:dcd2:5bc1 with SMTP id f18-20020a056a00239200b004fadcd25bc1mr6303054pfc.8.1649208011629; Tue, 05 Apr 2022 18:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208011; cv=none; d=google.com; s=arc-20160816; b=rM+x/631hmzHHYiP4Sr0txWA5asp3oO4Qtsc0Wx6TYqSW01pvgEtCvv4Y2EoatqdfM 92Gk7QqSlmt5vtVoQ5LkEd9Yr05kUZ4qo965Mr71efe5dJI6x9n+jBsv9hjggTfnykEz yOCDb7trBZ0AjC/37Cw9GNe1Si7L5kjEh0gqHeTv/c1UTwcbDYe2+nbs5uQ6W+UkbNnQ FeJMVw45x6Uu2xNdoTNm751ftM2Q+OQilRgLBt2x8H15Rw+mMrYpgMwT8I9RLKkXlR4z DmbOf4wkm9T/P0wIOE1/lHmL24HAxQ1bIcMfdygpjoD3fiWCaeZMel0/S0BMk+oX8Qe+ /nHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7PDnA12rLHEvdNS/tYAl3N11EcAe95ZETnu6s+SxQOw=; b=mZKBn3xFqAJ/Ux5FtLS+AFB0qVIDLEoD2n1PHiQiNYuDn9QY0PURP+tuQLBvO2AhDs YosC3Uq085Irz0VS16B1wtNtOtD+214IE297jDBDEHSZ0E/6cBD+EnKLn+mzK1j0E8cQ 5KxYIPxT40N/mv0opSr2YrRJmCUfQf6cg1T+PNxjZHvoV578+xhzTHZZVySghnsUcSMe esxCUZ+QpHkQ6zg5Ab9305AEiWl8zB4kjPufBW0AHkEs7/jYWYHQQoAdZMPRNeAZn2AG Do35PyrUagUCXp1T6DDZEbD18sjqLblOuBlx5n2XVSepAdg3uwqsqbCxnXbcUQG/Cr0l 9SsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0Uzp4a7/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a634547000000b0039845840ff2si14395447pgk.41.2022.04.05.18.19.57; Tue, 05 Apr 2022 18:20:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0Uzp4a7/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386278AbiDEMkw (ORCPT + 99 others); Tue, 5 Apr 2022 08:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237947AbiDEJE2 (ORCPT ); Tue, 5 Apr 2022 05:04:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEE0E13F3F; Tue, 5 Apr 2022 01:55:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9EFF5B81C84; Tue, 5 Apr 2022 08:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1209CC385A1; Tue, 5 Apr 2022 08:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148949; bh=NSm4cXzaYVKISJmzrhEGmW7kbB0t373onYfKAu8jDTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Uzp4a7/k0vHr5O35x8laPFa5lGffvFR1/MJSubY1Nc++ksoeQLjcwEtBFW/9cg2X 8dkjlwXcOTTtThX11nYsbOuRTOxLXDwrnn9DfPvodkhAjMsJ5CAgrra//JqaYYzxX+ D3zXQGK7E/kkQ0QLClPlKZ8ui79tsdN5EufX0ORI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Damien Le Moal , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 0538/1017] scsi: pm8001: Fix NCQ NON DATA command completion handling Date: Tue, 5 Apr 2022 09:24:11 +0200 Message-Id: <20220405070410.259833134@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Damien Le Moal [ Upstream commit 1d6736c3e162061dc811c76e605f35ef3234bffa ] 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. Link: https://lore.kernel.org/r/20220220031810.738362-16-damien.lemoal@opensource.wdc.com Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver") Reviewed-by: Jack Wang Signed-off-by: Damien Le Moal Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 183c72547229..97c08afd2dcf 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -2421,7 +2421,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 8eef2c51e432..414cd4b67c90 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -2518,7 +2518,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); -- 2.34.1