From patchwork Fri Apr 18 07:55:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 2074500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Gzp7/2OW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-ide+bounces-3476-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Zf6X33LJTz1yJW for ; Fri, 18 Apr 2025 17:56:03 +1000 (AEST) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A46C37B3650 for ; Fri, 18 Apr 2025 07:55:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F1CE26AAAF; Fri, 18 Apr 2025 07:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gzp7/2OW" X-Original-To: linux-ide@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C48426AA93; Fri, 18 Apr 2025 07:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962969; cv=none; b=p9zaeCk1GcdDbWteqJ09t8kQf9kDeSuLyiu66rSccsDg4frarXACdbXsDELexvoezReERwSlIbxyPyBcW77RwfrlmEa3XjArLu4aSlbPNDrsBShO0AdFUkM+AV8x5WGe16yuatvXxF0JJDAemseYlH05PjkThSq65ah+1M71XfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744962969; c=relaxed/simple; bh=G6q4Hp+wvfNJ64ikYUG8gWnNsxL66dJDVyKDX0EVSLI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ne71uUDfYgG7Z9Vp3LS22XBK707CPFkiARkm2zEfIY00RHLiSxRWZm3T7wXLUXqvPSy6YbpPtMtqQt8RXzFd3Qh6XjuPlH40HwCgvik/jhIHw9wgc2Koe7uMPrhPaw+NMhuADkJEVx5bexfArfH4fwEpz1Hi1Sl2IAHTM+nRe9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gzp7/2OW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E7A0C4CEE2; Fri, 18 Apr 2025 07:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744962969; bh=G6q4Hp+wvfNJ64ikYUG8gWnNsxL66dJDVyKDX0EVSLI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gzp7/2OWBY3RA4D0XxezJZ0epxxfAs/Qvme9CSrl3ZkzK6tJBYMChvgc02qjzi81D T+zMmEm7pz877TBBNleAQyNzDihc5nC2GcP/azjt1CpxM31EYP5BB4JgSvG/JOXCOY rqal5TU1c+6dP5QfoQZgclEb7KbLQQH1WEAfn0zWIDn+geKrehq/AdrCLT7lLkwYmH 9uP6Es03E5SK+k2E0lOo4i1ZPNZlFDCtpgOQF9WzC8bxmYNTElOFfhqgYbHBiF2CVC k2SBOjvkD/miXUuvuaTv6CVWizSqxpeS5jz0yqUNlmRNaf8z+qTjWJ36HStcRmdNX6 DBSPzENnTAu1A== From: Damien Le Moal To: linux-ide@vger.kernel.org, Niklas Cassel , linux-scsi@vger.kernel.org, "Martin K . Petersen" Subject: [PATCH v2 3/5] ata: libata-scsi: Fix ata_msense_control_ata_feature() Date: Fri, 18 Apr 2025 16:55:15 +0900 Message-ID: <20250418075517.369098-4-dlemoal@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250418075517.369098-1-dlemoal@kernel.org> References: <20250418075517.369098-1-dlemoal@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the ATA features subpage of the control mode page, the T10 SAT-6 specifications state that: For a MODE SENSE command, the SATL shall return the CDL_CTRL field value that was last set by an application client. However, the function ata_msense_control_ata_feature() always sets the CDL_CTRL field to the 0x02 value to indicate support for the CDL T2A and T2B pages. This is thus incorrect and the value 0x02 must be reported only after the user enables the CDL feature, which is indicated with the ATA_DFLAG_CDL_ENABLED device flag. When this flag is not set, the CDL_CTRL field of the ATA feature subpage of the control mode page must report a value of 0x00. Fix ata_msense_control_ata_feature() to report the correct values for the CDL_CTRL field, according to the enable/disable state of the device CDL feature. Fixes: df60f9c64576 ("scsi: ata: libata: Add ATA feature control sub-page translation") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Reviewed-by: Niklas Cassel Reviewed-by: Igor Pylypiv --- drivers/ata/libata-scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 15661b05cb48..f54e8a3dc46d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2453,8 +2453,8 @@ static unsigned int ata_msense_control_ata_feature(struct ata_device *dev, */ put_unaligned_be16(ATA_FEATURE_SUB_MPAGE_LEN - 4, &buf[2]); - if (dev->flags & ATA_DFLAG_CDL) - buf[4] = 0x02; /* Support T2A and T2B pages */ + if (dev->flags & ATA_DFLAG_CDL_ENABLED) + buf[4] = 0x02; /* T2A and T2B pages enabled */ else buf[4] = 0;