Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp48964pxk; Tue, 15 Sep 2020 17:26:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdzh0jrwVMY3IsCOpK+/z0tQdt/I1q+/+sIFq9FpKaZGKO1QjGp8WR192hRW7Ks1nTUWbG X-Received: by 2002:a05:6402:1d03:: with SMTP id dg3mr24560896edb.249.1600215969433; Tue, 15 Sep 2020 17:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600215969; cv=none; d=google.com; s=arc-20160816; b=vX38Qxjo1AGUQbCeTj2Wq1b5VJ6TcK6whjdwiqiw5gQ28GLNb3EPK1sZwUSIhJjrkf h5uP94Ix9fMr9aTZA4b8GpMQODna1FedcrWEelv/3+MwzWPsl6PAsuDH/zpGmEjBx3PU twn+T9/LyLZFzI/O6b4/+qq6kkqJc8PrbbEq3ubF0oXyuzP8E1cR7qkRUOFUq/BfPZaj vEUHlCCdth3tExkkRbcc7LkieOf+Tb6ypMPoDp1fBgHH3KTxs6cDK13utXNrXuSBe1oV O5h/ZY9NgGrYVmsKnP7pS23WoylpMUI18noiul09hT4kwCBaw85j0WVAEHViPVhqvaPT us2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GN0WCBxgCECNzP6m3a/61s3QvsyoC6ft9eD3X7x4HaE=; b=AL6e/r0TMmOp1nGXGgRsYFZq/TFbeK7UVU2S/zq94XUzoQTJ41s3BM2XWwCLmuhqFK 3oLlFK9XaSTq1uCuo/o1m+WBSQl5A1ldSm/Y79e2lowwnLu7AXYSmS5zC8eeWU1vSAqC Z1ejcMtWGK/AosGPaAyfJzDN5h4OppUiR0+BRwLYbwKkeq2vDdnzYuCxD0StcuXFFE9T /gRbrdHcC5qm+yDyfgiQAG4QLxde85l728poO3SLLulo+rqPklmA4B3HVAoYqDIRxC8p 9/Oadyu6aoVVsJbyLUipN4+TESQVsiNwgOdT4UqQR7McXhj4mH1dHBcdjgZcZxj9pOTP JMhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OegWaQoc; 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 c10si11077742edr.320.2020.09.15.17.25.46; Tue, 15 Sep 2020 17:26:09 -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=OegWaQoc; 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 S1727494AbgIPAZP (ORCPT + 99 others); Tue, 15 Sep 2020 20:25:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:60436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbgIOOQy (ORCPT ); Tue, 15 Sep 2020 10:16:54 -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 89EC021D24; Tue, 15 Sep 2020 14:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600179311; bh=AXx5EQWHDIuOsGqpW581yCd9UcpDsibHJoASnjAdVzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OegWaQoclU17YNwm7Y7xYK9e/47ii0iERdQ/nzpRC96cTNlb+ccg6/slb6iB8H6Y+ WM1Ce8BmnOspJKLi8Taw8AgqVgWLrvxA06ASACImVHJ0t36E4ug75ApsZmyShP+CjS 7R3tlHQyA/niTtwvgSoEqB8Qz6zhbAQ13KgRANtY= 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.19 10/78] scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA Date: Tue, 15 Sep 2020 16:12:35 +0200 Message-Id: <20200915140634.062137774@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200915140633.552502750@linuxfoundation.org> References: <20200915140633.552502750@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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 64a958a99f6a8..d82698b7dfe6c 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -223,7 +223,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