Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3301512pxk; Mon, 21 Sep 2020 10:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGKW2C/F/sK6UzjN5hqG2K937eHYV0NTeeVE6n9XJRpaNuOjSoax22di2XMl9ZbBDVN2bx X-Received: by 2002:a50:bb62:: with SMTP id y89mr620125ede.261.1600707890171; Mon, 21 Sep 2020 10:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707890; cv=none; d=google.com; s=arc-20160816; b=V5o/PgOIsurRBimaoyYtm4ohUGw98HAv/y6Bxxml/n22QtJKU8S/JGR07EX+pSsJHQ y3OgoNvBQb1oEBtlyCNLAwbA0CY7N/ARSvHvX+q7OIqehxIxSjJU9kP97KqSuY3W9SWb S7Hkn/fWeNc866secPGN3p7l8TFY0hDYUUnmXM6wSW3ixBLc7HfCR/XO0pPz5uoaI3rG X6x+lN+bsr2KDy5dF0JwfM+lVX8GTboSRRaxrbppvOXkdpwWDY7SZRGK89pP6Ajm6owz 22SEtFSA0X5QqzXSlIXxomcIlb5GFRR2yJ23x4YBTnSuM8f+HRuW1deUI30az2lYGW4w cjCQ== 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=Qhv6iNp6X2JfgyFj879aACQaROMYt+5Y2Zyduj+Wci8=; b=q/0ZF2HjY1TbFtrhTDcG83pcIwLW6TN/1PToI/8u2Xurz7qJYpYddNN1BOCsrqGznn Bz2aYDS2x9iBydWiyGDiGaHS4yJsGutfw3BmxsqIyyluhxKyjURaei7JwsZomXKA8A5P av0poOFCyxq2NN1Th+pV8kZnq1PjSNlEN4An0lTipA5rHqpBFOPTL0/c6yiyrBQc2/Vy ftxccPQcLZYEwxB6H02d4SElTFp2wUsQFhKfyOcaHBa3orUv/gdb4mkegdn9XHZKMwbS r3lbUixzYzvyjTncMY+fNJ88hwe+BrRiDTJVvzZBCYr2XxxKoLTV/T2tYhNs6G83QBkE 9gBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J55tidmC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y25si9079661edm.176.2020.09.21.10.04.25; Mon, 21 Sep 2020 10:04:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J55tidmC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730284AbgIURD0 (ORCPT + 99 others); Mon, 21 Sep 2020 13:03:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729048AbgIUQhW (ORCPT ); Mon, 21 Sep 2020 12:37:22 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D0979206DC; Mon, 21 Sep 2020 16:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706241; bh=Qk1F+8T1O/m6aOES3ena+I+4B8zXgQcdetoovsw0sro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J55tidmCLzPnyp87EMCWtF0TlJCEKK7AKut3WJTmoYio9l1mzmdU+RRjWR20V7RwX WwsNtCE75YGKqyVJx6NxIzfZkZECj089/QLIa9nyYEP4ju+whXkaP6UNJCpCmYLgOk v2dOePmZ1enqL6YbmH0/Xg7Ke6OoEjUxpM0E4d7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Jason Yan , Luo Jiaxing , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 04/94] scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA Date: Mon, 21 Sep 2020 18:26:51 +0200 Message-Id: <20200921162035.743513463@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luo Jiaxing [ Upstream commit 53de092f47ff40e8d4d78d590d95819d391bf2e0 ] It was discovered that sdparm will fail when attempting to disable write cache on a SATA disk connected via libsas. In the ATA command set the write cache state is controlled through the SET FEATURES operation. This is roughly corresponds to MODE SELECT in SCSI and the latter command is what is used in the SCSI-ATA translation layer. A subtle difference is that a MODE SELECT carries data whereas SET FEATURES is defined as a non-data command in ATA. Set the DMA data direction to DMA_NONE if the requested ATA command is identified as non-data. [mkp: commit desc] Fixes: fa1c1e8f1ece ("[SCSI] Add SATA support to libsas") Link: https://lore.kernel.org/r/1598426666-54544-1-git-send-email-luojiaxing@huawei.com Reviewed-by: John Garry Reviewed-by: Jason Yan Signed-off-by: Luo Jiaxing Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_ata.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 70be4425ae0be..470e11b428208 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -227,7 +227,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) task->num_scatter = si; } - task->data_dir = qc->dma_dir; + if (qc->tf.protocol == ATA_PROT_NODATA) + task->data_dir = DMA_NONE; + else + task->data_dir = qc->dma_dir; task->scatter = qc->sg; task->ata_task.retry_count = 1; task->task_state_flags = SAS_TASK_STATE_PENDING; -- 2.25.1