Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp3163859qtb; Mon, 24 Oct 2022 07:10:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VS4GRu3mz8A4o7bsCfHUNAK8qJj1HQERWXXDWTQrOWBgjlg/JCgkyvLD0q03fLBJKT48f X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr31121567edb.249.1666620489745; Mon, 24 Oct 2022 07:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666620489; cv=none; d=google.com; s=arc-20160816; b=GbUNIP6buwNmK5m0ZyaytGfUywpyWXa5A2PHN5UNPcq3jhuqmi28EKWTdJEwB9TUDD dQ00qx4CNQ2eZultiuCRMz2mVqSbAFQE+toimNtovRWz7MnAxUwtCImZbQ7LU63Axchp zYTbvTXgvb6F8o+uUFW71QfcbJLDamO6eyP/gjo0NOXXL2RAEoEwUqtmM04MR6je9VgT TtVLYFATL/KLuA2uxrdYYw4aiStGU+bwotpgh0MZeYoGZqbehDSn4yHifnjx7GS3rcJx yVUcDcIWEvN8stG1x5hLb5KoICb/wVbn5bkUBgipTRUkD0uWlrxCHRBuFUSOWeJ2Ijg4 nVcA== 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=lsToZmSSmxrrFoFRgZa6HF1gkBKBpkryyzz73loL2lY=; b=iMm9olpZCjN9e5tHqwoSmJAMnrKY/7Gx1Io2dPM3rSp4bN7HGbkU0kQ13ZjdLRlV3A TLCV6D8mjoRgjaURYCcplFp73fTO9zIvCVwpmFnrPLDv1/F9yUwIIP8IFB3wOQhLfc/y c2a1ZTlfIrOW7371zvquLOb6jupsJ0tqsMSo9H/4PJ490QlkRhMUIsh+hDthWhE3ot24 jAOqy85reK3xE6bqs0Y8cp57qQK4Dg2xriW+1RgGr+XBcHd/wAALensSrceoVaMLW2ke YwFrOirzwDJUoAsfCGnYyK/NIQtV917Ry30hQEwfeCoh3UsTTXnetG9JSk1Mc045lpnB AFKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qyYDQn2w; 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 t8-20020a056402524800b00461f0d84ee1si891189edd.228.2022.10.24.07.07.44; Mon, 24 Oct 2022 07:08:09 -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=qyYDQn2w; 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 S234071AbiJXMde (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234101AbiJXM3T (ORCPT ); Mon, 24 Oct 2022 08:29:19 -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 3EE9E87FA3; Mon, 24 Oct 2022 05:03:08 -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 0A1F261218; Mon, 24 Oct 2022 12:00:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14DF8C433D6; Mon, 24 Oct 2022 12:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612838; bh=CeT01rwLGLjkl4e/fWPUskf9NHJHNfiQIznTZ/SXcKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qyYDQn2wqkdg5eoMmEn5tukil0Ubr2J5/livMDNVGYCf1CdKLnmYwRY6KPNrzisL/ mNM1PjItz0G234+7Sf7tFoeh1dSEOhp9IeTCk4b6V8GXabpimbbk1AePe3ttyNit2X MnXASXffj/vfatmnkGHYsOwWigINubkT8fvRIQvI= 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.19 138/229] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024113003.482595323@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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.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 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 e9d24a23c0aa..cfdaa08c45c9 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -585,6 +585,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) \ @@ -597,8 +601,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