From patchwork Mon Oct 24 11:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp530875wru; Mon, 24 Oct 2022 09:05:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54q4QWCC7/92Ssp1YwoEjtwX44INpiL3HdWUKk2zV7/z6WhSKhtddC2BoZJgUkjUPGzyHf X-Received: by 2002:a17:90a:5e03:b0:210:d4b3:4c98 with SMTP id w3-20020a17090a5e0300b00210d4b34c98mr30542758pjf.63.1666627539117; Mon, 24 Oct 2022 09:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627539; cv=none; d=google.com; s=arc-20160816; b=0G04rjOSk6iZGAkVk+2gZ7QSauwUFWsjH6Rqzp1QsoCaWMoNIhUkykrgXiwbybShoI VVAsCO0s6zkvqryx4PdqH89BC4qTuQEaPm9R4zFPglpmkVJiNNsrSFkdx+Aus7X/4uEn HrE+6FKYsNAte1rO/0Ab+2oxqbVDHxEEcp3SNoLFeQWz10G6CNd+B6UfIkY7mpWYedF4 +6nXzmfuVXQpN1m6dHtTR+RhESevsVwl3WDW+pQZ3kmh3faHl0nkiKb9NjtjwyrmDX++ dhUzh4Qnto1rFomI1cSwlhiFjwODk/YOR5zFDuICbaFxGcqV/g663QzTHxjrEG56CkiC 6Ptg== 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=8SmK+dC9X1WKK6XBB5logJ8chux93+70D0FuD7TFs2E=; b=OE3QJY0WQCWVnsOKoYsREc1mU3pBsk+0m7KnvOY+JZ7RyO0BA8nQVOEvEz7AsaLoqK SIwdVaYttxii3Q6oMuDwAO4P56UOwvkei7c3rr01H/VZNFEhRFzM0f4Sjyz9V8+gCWaf w/w7m2sy3jYvKL3sNUKTmfNSuWm3L0kp5wX0l9/5WLJb7Vnl0sso4KE6WWDwe1wf7Qpl WI8A1mcclUB5WVHu5OLo/ewkuaRsLXLxhCTHMpiwuX/ZWBDfERmT3gn5Lw/f3nIOUAyN oMDCsdZqtZxMAsERW3wZNJwupCNQ8+QuuCI+ybmSKV5Ku5KfXRNaea7zVx41BCLp7e4/ Dfog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRWCaJA8; 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 q18-20020a631f52000000b0043447486c84si35025949pgm.875.2022.10.24.09.05.23; Mon, 24 Oct 2022 09:05:39 -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=HRWCaJA8; 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 S232779AbiJXQDX (ORCPT + 99 others); Mon, 24 Oct 2022 12:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiJXQC2 (ORCPT ); Mon, 24 Oct 2022 12:02:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7658115408; Mon, 24 Oct 2022 07:55:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id AD99AB815F3; Mon, 24 Oct 2022 12:27:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 156C9C433D6; Mon, 24 Oct 2022 12:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614426; bh=xPThxkg/kWjmznk8UoQBVXx8Q5wQiDakS3AeMMjacOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRWCaJA8ZsE4QvSrvJrnUd9gC7Qsmo0AerJXG6lwoswVCA61mhAZwuFOdyQe1Hk4I MHhDoSvQeukc87qUUZuW1RNsQPT3JOg1MNL+Zfw+/mZ+QJw4DFfExAhAQb+sVGgu3K xtB/61dEBsAH66SshydNEKkSk0gLgTr2fFspIFv0= 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 5.10 226/390] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024113032.408434574@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747585638787969361?= X-GMAIL-MSGID: =?utf-8?q?1747585638787969361?= 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 8b884cd3a232..94f7872da983 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -569,6 +569,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) \ @@ -581,8 +585,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) {