From patchwork Mon Oct 24 11:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403859wru; Mon, 24 Oct 2022 04:53:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qYQwwzapxMEBCjZWNJTsiGaNP2Bfe/qFHlrBmvp+fmx4lCp2NR4sepRswuGvpTIEe7qU9 X-Received: by 2002:a17:902:edc3:b0:172:8ae3:9778 with SMTP id q3-20020a170902edc300b001728ae39778mr32992786plk.72.1666612417347; Mon, 24 Oct 2022 04:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612417; cv=none; d=google.com; s=arc-20160816; b=0brg/z3Q1kzeR5t9SHWaqb/ucgbSJMKfbg/S+oVBOVKwmWCuAy/Mg8mP9H8sDJ/ErQ j2E3QzJPeWy/jI3tLluqLv8dMxrfLybOIhHHv8W+PhHgusrOZ2SsogTmB/SeNx+gczOi XvA9nT/BRf3DusNYgyzcwI3UQo8ahXgYMuBXs0m0ADPlgtS8txj8XikOqwJ88kbMeYbz 26wL+twLWuxHshQx2xYhKrSLUswsSCO5PkBTcjiu4ybfjo2aXXx+g6K9qRVJBkmMxUgi hSqGYSCG6Lp85k8MSjn7g4V6koVz8/yM8yaHD8SSofXUQWQCVYctLmToT7fdYf0UEcOw q7OA== 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=w9v3w/M1R1qgCXE9OiKgsWEi6wTK+XTB31tAi6dxrOs=; b=aBXY73daSiAeGZsBUaFRT0Ck+JFdrwbMBCER8cIOwvLtyVt9TXpMMcTUK6ZW/FYgE6 HoHmBhJHbHmkyrZcf616MCHcOnzAWUEyqpXGmZ2EoofctUDmqzyTxlTMXcTe6QAyTRwA DKvDwfDr8E5Zr7P1gSyvx7asp9oN2jfueAJuwI5dRIHr8V6lr4C7HeuXDyXW4zK6hxjT pCH/CNaBCW4qYaMWHczoHuKfGutnOxmzqk2LrRZCupkAjeE7oSzvn+nnkp1nDluqUwzz rOGkGee4Cc4F5hjyuYXE4fjzZzKsj6ACgNXmokGymgHCV15ldHvCJqUU5j2UjVSyt3Q2 KgHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XBx9rBSB; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a63b554000000b0046ec7b397e1si11381005pgo.759.2022.10.24.04.53.23; Mon, 24 Oct 2022 04:53:37 -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=XBx9rBSB; 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 S232022AbiJXLw4 (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiJXLwJ (ORCPT ); Mon, 24 Oct 2022 07:52:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89A62167DB; Mon, 24 Oct 2022 04:44:40 -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 sin.source.kernel.org (Postfix) with ESMTPS id B4888CE134A; Mon, 24 Oct 2022 11:42:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3608C433C1; Mon, 24 Oct 2022 11:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611776; bh=TpwTRIOKomp6fLntnC/D7Ulvdbvpg63zN54xdtBFiGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XBx9rBSBPIGsuTnnoIk4Yr6T/tce+kqk/+VVUfXZNFePMzv8VKChS8ox+y8AkVJbY uliqP6U1/z3FPKv9m1R8ISx9aoNQZjnTJI7jB1RSzWHedYKWycoWqedcPmoFFSzCzT spHO6wxu7ghCHbLRvacL0MH+9Zl3TxhfMoNJlsfY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.9 106/159] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024112953.321733178@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569782142642340?= X-GMAIL-MSGID: =?utf-8?q?1747569782142642340?= From: Niklas Cassel [ Upstream commit a5fb6bf853148974dbde092ec1bde553bea5e49f ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: 5b01e4b9efa0 ("libata: Implement NCQ autosense") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index 315a7eaba655..33e0786c3c51 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -576,6 +576,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) +#define ata_id_has_ncq_autosense(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -588,8 +592,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_ncq_autosense(id) \ - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) static inline bool ata_id_has_hipm(const u16 *id) {