Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp821694pxb; Wed, 6 Apr 2022 00:45:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJqnGe1FtAxyPiTGnlcNIq0hbf7DrdPnZDAKowiqnWFPaoFZJ2qWk2fg2oQBFzD2SaaF44 X-Received: by 2002:a17:90b:1d08:b0:1c7:3b51:8b41 with SMTP id on8-20020a17090b1d0800b001c73b518b41mr8383272pjb.210.1649231101794; Wed, 06 Apr 2022 00:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649231101; cv=none; d=google.com; s=arc-20160816; b=010c0Efndi0t3At+f8d7WIeEfnVZ18v5IQMMaSd1EjjStYZZsiK75Fp/eZ/SGu+0sp Wyit3OuxvCmGMEDKv6HB2UpY7lndo5s2OoWCIBcDcX3eBVd4IcCaq6jouBZ2ItfnbVpz 2Jq5PnYa+DCCjjAtzmLGjBqMrQpVdAEWS28zb+VZ3jmfLXa7GAkf4sjHkJ18pYTsOcIQ l6mr+snvzORspfjZ06cOuKIqF/bjurPabAVnCmOY7s1xg2zCUZkuIE1TANpKvGCcPSqy aS75OV9uUg0JfBKxUKP259Cl09cXL1npHqt93xhsk9/T7A/aIOKE0GnjzRytwz3MPH47 FdkQ== 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=F6Fzam+l+OOQCQyHBemRL2wdp3wiIKyjH2IFQTTtb3Y=; b=ihKyBZqtCzrNsxfxiLARqndbGH/7DChvCp7q9yXD+InHkVtF4VjuILwnbXb+7C7JpG Ir6+/fboffi4ltga4V8g3LB1rHj0l3IZTBo786Qs17BpELsE2bWc7dhugkng4C+HjrXC 7prgydoNWN9mZQqLEuI+ExvhN1pxgQlaOOOcVKznP0eXaJazorvkKm4No12Reaan2xvi 9kyFLI5qE5GHYR+HfPBzCRKVds+utENsEHyAgCZBbFNz1jPXdO9fdnw/F/g2WPQItvh2 203+5HxOKqgFKhE6/zKwbhkYWsJ+TgBzvYDkJzdjyeuvosLB91Cg/ME4s2g4qw8NPh3a +cXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D4TT/QQ4"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g11-20020a65580b000000b003842921930bsi15737720pgr.808.2022.04.06.00.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 00:45:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D4TT/QQ4"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 03B2735FCF7; Wed, 6 Apr 2022 00:13:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1844572AbiDFBty (ORCPT + 99 others); Tue, 5 Apr 2022 21:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349093AbiDEJtH (ORCPT ); Tue, 5 Apr 2022 05:49:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E48D5A997B; Tue, 5 Apr 2022 02:40:43 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 7ED47615E5; Tue, 5 Apr 2022 09:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CB81C385A1; Tue, 5 Apr 2022 09:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151642; bh=DwB2ZYIjRLq6uHjl6PjkyIYEq5MCOtS3jKxUxecKv2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4TT/QQ43G82QBJd/iOQJqDhOHht0CNkYcIybMo7ten6uKy9XCa+CInjBUD+zsdIL XTOKcy4Fe3SnodapQ5lCDCh3cIU1JLgKnDaOh4Uo8dMS0GmZXSFSW/y8EqqBEJqgp5 dwJkYowf3FjXmb8TRpnlxQyrVh/Vl0BfH0EoDwfg= 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.15 488/913] scsi: pm8001: Fix NCQ NON DATA command completion handling Date: Tue, 5 Apr 2022 09:25:50 +0200 Message-Id: <20220405070354.483151646@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 e9c77c945752..d50eb22b2506 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 043a2cc4d4de..3c2f2fbdb432 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