Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp316855qtb; Wed, 19 Oct 2022 02:44:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UDZBd9NGKX7Brk21ZAMbVZKBM94aDGqRGSE3HxLaq2xHJpiT4k2+Cu9wifkIu78/YEyps X-Received: by 2002:a17:907:dac:b0:78e:17a0:d1cb with SMTP id go44-20020a1709070dac00b0078e17a0d1cbmr6021639ejc.618.1666172673952; Wed, 19 Oct 2022 02:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172673; cv=none; d=google.com; s=arc-20160816; b=UA2F3udxkBOxtORB8t8Q7uKpVzhqqrYaRKgy52MYaEnlioZf8a5o+j/sIubyGpJxq3 aDJKquHm4qslxY02k/OPnJr2Mp9xIZbGYbHZdTjMDlsbzQ0r+4vIT5LymvxXq3bjjdrm v5vrLU/jkxuOR5RVPweDbctL55IKfYjo+Li/AFoG5atReM7C23llvt3uSkL8JaDPYTkw zblGqAfloUJpUMEx2/84+WiYZ3VWIjh3pqilVToIvfTP+fFIrimwsG/6rvnUeOJuOOCr A9ljFWQ6wsrI9s+XT8eZUX9FXODyT1FMDa1i2L2x+v6YqhDhnoGbwNUctLAfSYtu4ju+ 3A7A== 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=KucS0PJCbxzmoWo5epAI7T4wCyJniyBlf7Q7H4X+xieJk99efSDyutKSZ3GKPQkFTL UWK79hE7jR7pGd409y/8eDoSMN5FgkXpZT17DNGasznaNHEhquKTRyTCildXHy8hYvv0 4Z3k6b8O74TWJxDXxQ7o+sXP2tz+EzE6YGMJMVOKN6Ogs8i7z2MedsjfKwm/unfCBeDc n3yOF+X5Dsavx2yp8/XAHxNcPVyBmQICgi03iYRwb8g1yTfmYuQtaWf0FP+24HXgwvhy zuaDre3xUs3zUiQeTFQmYYN+mNBth6xq3kJmN0QNbd1G0c8+EEez5quQastaGb69/dVc e4zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rjPsJYtm; 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 v7-20020aa7d647000000b0044eb6f979d7si11145600edr.152.2022.10.19.02.43.54; Wed, 19 Oct 2022 02:44:33 -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=rjPsJYtm; 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 S233889AbiJSJdw (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbiJSJ3Y (ORCPT ); Wed, 19 Oct 2022 05:29:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA4E267C9F; Wed, 19 Oct 2022 02:12:47 -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 DB04E6183C; Wed, 19 Oct 2022 09:02:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E99D0C433C1; Wed, 19 Oct 2022 09:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170138; bh=RqMptm6VErJfkdlk9lLnznG/cTGLaJPV5tVwTLdwaP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjPsJYtmb7AmL6Ss2dlNct7Q/nuMHWOMjqeE/HPcyKMTWO+ikSXDYUiIPueCoQrFH 2/XqIPJLg0HH4lhiZ+Qe4ghQgN7APoLmv5BxlvQMg9GHBQaCTPehfcFWvNF7x+sfVk FhPqrsVdD16z4J8jz+g6hvnh5mLM2Wz9at0b1tsY= 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 6.0 541/862] ata: fix ata_id_has_ncq_autosense() Date: Wed, 19 Oct 2022 10:30:28 +0200 Message-Id: <20221019083313.873459729@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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