Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3886376rwi; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sUaGVct2lwYbnv0IwRxNQrIsS03Qf3G+An5QtjsjGgdpbWierraDCFSw556ZLdv5sIBVj X-Received: by 2002:a65:42c7:0:b0:462:7158:c863 with SMTP id l7-20020a6542c7000000b004627158c863mr20034824pgp.590.1666427630886; Sat, 22 Oct 2022 01:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427630; cv=none; d=google.com; s=arc-20160816; b=AtaAnsQyRLJraHrcVE410od5i32tw6qjhNZahIkMlyeiUCS37P4+S5jehOXHgF/LWS P3fjVOV15eEot3fUDy2Pmjbh6vUymPaiB3T8kTIzBiF9Tnh9WzFNurse5Z5jbFUSnmpA 4QL8MVLjDoI/OesKq1YhTwD0HjMWsKkLUEgR+zEK0MsROTlg8EKXGec5v6Zmb+5DTzpF mvW4DNgnI0YLHmNBD0r4xJxqDiJQBK8IGattsuERf6ub5M7D722pf4w4OsmPaWkCXkl4 CqphI5ThdyJX8tH3Kb+bqG2NJZrP8uB1vziRALTuCCRizNyGLjrE8T0jaxmpkOz830u2 4OFA== 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=6bGb9xh0CMBPZSOqD/eybkKkp+mExbT9ishSmmm8tUM=; b=huaTMhn6QbWIYWNXolnl8LS5QI2ukIwZ7hdOD8A1oNjIwRBq3SDBzi4uSHaTtRZaCU k0DvksPXgP+UgXo5mWOtRFho7fZ330JYq1OeIAhEQERCFJGy9w3Y6YJJE7xRkjmpG0c6 yMDRIsvHCCa/t0VwM4Suf8d/xrdoe4ixkK553+hakwbSykHSF/UeDv0OFYOgDHXlWdYc nO0umhyj7bsgIDUu+iN+HY3LS4FK8yl5j9rtEpJTC9jXwn5O+SmfJDWY01ZvqltWkULI WOTTwM5YF1fn4vT/CymueALjOQZ+mGVoqQSZBCLfr+KB6X2gw62+2ECbPHjVrstIK8wX kYJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TZBb+rGS; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170903024e00b0018280f67482si33243013plh.113.2022.10.22.01.33.37; Sat, 22 Oct 2022 01:33:50 -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=TZBb+rGS; 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 S233468AbiJVIRC (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233798AbiJVIPL (ORCPT ); Sat, 22 Oct 2022 04:15:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E38302CA7E2; Sat, 22 Oct 2022 00:56:19 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 79E5860AC3; Sat, 22 Oct 2022 07:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 708F8C433D6; Sat, 22 Oct 2022 07:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425235; bh=RqMptm6VErJfkdlk9lLnznG/cTGLaJPV5tVwTLdwaP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZBb+rGSFDAJfp+L/OoWpQNb7WndHj0lnZDmBKY8X2Z2NeI7AC6XOUUIwinFw9Iw0 aj33mK/sEO0MS3I0SECxkyuw7h0pKTwZTyyUCC9sPLAdXPnqALz0UJ4DuL0J4lgw6Y cCQhZoZ6yLWr7m4ZvbwrWdNpqNMjp6X0V8z3DFUM= 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.19 436/717] ata: fix ata_id_has_ncq_autosense() Date: Sat, 22 Oct 2022 09:25:15 +0200 Message-Id: <20221022072517.671033784@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 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 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 bc136a43689f..4845443e0f08 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -570,6 +570,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) \ @@ -582,8 +586,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) { -- 2.35.1