From patchwork Mon Oct 24 11:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430914wru; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cL7nDJbfsuyLrUSXlcGVDbSTzyiLLN/z5SfkkgW9exCGwA9ueP0zqmNJ/O3FYSgrgX6Jq X-Received: by 2002:a17:90a:fe6:b0:212:bfc3:31f5 with SMTP id 93-20020a17090a0fe600b00212bfc331f5mr23997989pjz.215.1666615351459; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615351; cv=none; d=google.com; s=arc-20160816; b=jB+NWirynQoA2NYf4RA1Z/bHocBI6rrxU3WBGLG/eEQ7nLzrJcyjnq+J+8Cxprb7le MDr/buRlNtv7Cxaz+/KxsAQdMNAImeg+eZDPFv1qnhC1BCDR6IJSLlvZy8hfan71c7ZZ F9OJNEydiBXKDz+3sUwJZ5G0t1BbjPqPOyUlvDM1dA4msO6QuHJx5QRrRga9z1o9ExsY oWjIMouuvrR/XonB8wMT3GOJzSgLwkUXaV5whaZtf6epHNxJ4jypNVEAicRnbifRvbKb OntjxUP1qa18aK/ZFrdGbfZxX/qcuFABZgeJbgZfviuDQ1i6ZLvpdSepItAWxJP62j/H 6nQw== 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=4UwYpnG62vg8GRnuQckq3GkN06hKul0rE+6bpRvbKKE=; b=fAl5YNPAdj8PkZMUmkjZUE7lg8XMnxaScH0dcG/4bNGF44v7nhu26as3Xccjb+UDMx 6dxqxrH2IiECgCBJyH1oC1Qto4tW+m4bGWD4dRSVoGiyCnrovfPA/xr7B0FCMyuRVjKh efy1WnRCBUXE5rmbDktv72/U+nZlzeH1sp2wn5R69A1YLPX8gKzrLmhqmIqTcASykGoN uARq8ihGDHujkNIgHvIvFovsuCtivQVdacAbDx+oev63lkzqwMDSUqa7hzzq4BdFFiF5 k/eg5UipZCvmsh7yaOpD13W6EsdYshAHhxz4H0KDHCG5LEfgYnZ6iUSf2UTS17pxZ+aF Oq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o+qSPsNO; 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 k30-20020a63ff1e000000b004600ab82237si35201634pgi.293.2022.10.24.05.42.18; Mon, 24 Oct 2022 05:42:31 -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=o+qSPsNO; 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 S234289AbiJXMen (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbiJXM3i (ORCPT ); Mon, 24 Oct 2022 08:29:38 -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 86197FF2; Mon, 24 Oct 2022 05:03:37 -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 F3248612CA; Mon, 24 Oct 2022 11:51:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12CACC4314D; Mon, 24 Oct 2022 11:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612268; bh=/AwGkdnNk5NaqZP67LHlYM5+TteTg5wF/F0cltxUsYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+qSPsNOk1yYFv1HLjkQmczRusBfw8palr7oGgGlq0oz5Vyc8OaSUnWnKdE8a2Y2j 843eNq89gQTkFcpfD+8NxPbvYkU+Ga23Izv5tHEb2O+0Rhh9fWKWsaAGnGpBK9fxBy S5m6Ut6rE4sx+b2LwmgIvlj3sRbSFI9MQIhcfoUw= 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.14 132/210] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113001.278988772@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747572858736281771?= X-GMAIL-MSGID: =?utf-8?q?1747572858736281771?= 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 c2beacc9e522..641545929efb 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -583,6 +583,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) \ @@ -595,8 +599,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) {