From patchwork Fri Mar 1 15:06:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 208969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp35389dyc; Fri, 1 Mar 2024 09:36:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUiUpNr0ek+GP0RpezIWlApyRrX5j0BE2pxKRicxUm1IvZXNzn4BDp/DyGU6l5DCOMXTVvXdRnpGPJF3jIFvR5lBq38pQ== X-Google-Smtp-Source: AGHT+IHWMeMSxKpBZS8gbZWexKTni5WO9tHLvjZxJ9AmZeZzQkqwcMedUlm1EEPcp1x3fKwa8ZSP X-Received: by 2002:a50:c8cd:0:b0:566:115c:b822 with SMTP id k13-20020a50c8cd000000b00566115cb822mr1801856edh.27.1709314609869; Fri, 01 Mar 2024 09:36:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709314609; cv=pass; d=google.com; s=arc-20160816; b=ImvL341PAjEAHYgLjZbbMw6mthz+VIuoFwTXDubRD5RdLaocLs/eyzDNTmtN1WCERH NCHU0NgJdaSBQzx6iRWIb7n5J9HmukZ9jvHaCPNh40ZcMo2KH5DVssBTZiCSj1MDUaCo van+/lvKY6miPipuCvaJsYQs38YyrBtcHi1ZmvmCuT52VbR9m+XUdJXANF59EkiUHbBk aAo8IA3Qdm8ZTZbRHbY8N6jvGiDbb2RT/I96WNmd5rmCIZdaggP4mSDpHT/YQXffqBKI ZUOQb7ttg86eU3Ehl5kJITJG+7EdfSRJibs9rye2hZmCQUADY9UJsoOB33tZwBI8Yh4e GzDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=n9KogBdCDX8wlzQ94ly7DW/8V3/z32QF9GKWD3vHJ6c=; fh=P59FCMouOCp6CMNGkFsCDI2QbWiTgzS/afWZDHIiE8U=; b=LoBCUpHO1pLZmrWWhxztF9WYRGHhEO4Rq5aZ/lofL3tdYX3URWM2nLoAMscRtHInki VPSrzd5yDW0BTXCRdgKRKzIjBWCe9sQ+R7jTAeey7GxrYn1Z4/e4B0lKZwWZdNcAqe8C FCEe3uTZ408p3kMiR+QAdmfAin3YYKAIhLRO8gx+q/pMe2R1WJZ9VuF83PF/tMz1wXeQ yt6EtGsyja9QkbVs0O1z/Ua5Ebc6cjNUHyc33WDHi7sbI77kjTLYGz5UhPnuPyXtvLMV HAcTJdTUOkqepAIGZBk2cTZZmmBzFbcBFAZ/4dT4UjQuibfZaj91K///Mm4AVbpdE9Q7 p46A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GJS1yyVt; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-88602-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88602-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v1-20020aa7d9c1000000b0056466b22074si1638263eds.245.2024.03.01.09.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:36:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88602-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GJS1yyVt; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-88602-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88602-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 96CAB1F2627E for ; Fri, 1 Mar 2024 15:07:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D52C460DF2; Fri, 1 Mar 2024 15:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GJS1yyVt" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DD543987B; Fri, 1 Mar 2024 15:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709305616; cv=none; b=jZlAZoeKBqOtLwS7HwYdi/j3VF7Zh05J7Roz/qRu+aJDNG9x1VjfAoveZtRzrC/8FGeGS8QvagAQiA9yPV01oorwjdL12w0CT9ViurZbrn2qdney7wnM3dW8VcuM01WjNVp6sFuUK0tCPiXFkoF/oSf3qDCFwgVC7MFDDWGyawE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709305616; c=relaxed/simple; bh=klUhEQf+5iLq5itvvFsd/lwIyvrv5Jo42w7y/66wJTE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=deL0wUW9IAUW6II5xwnSxYftEf4AbAbLbeejihdcPtxdOMqPL5DTQRzA+tKq3dbm/G5V/Dln4iDvp1A6dEjeSUm3Gs29oScQjOf6IAOwiEgMebh+sZhvWFXg5UIAd90BqVILBgAbyBy6nt55TCH6m+hppjiDx0X4jrgi+WtKKWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GJS1yyVt; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709305615; x=1740841615; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=klUhEQf+5iLq5itvvFsd/lwIyvrv5Jo42w7y/66wJTE=; b=GJS1yyVtCuZjQOntjEmzmoBQRtwG8TSYApn9cRqAEm8xIdsV+Ec9K1C7 ngm+aKpIfkTFw4r5+QekX1yqOkOEX4Xut+Mt6fBU8XaWJqkFqQ/AxaEgS 2GvX198Fo9ShLT8N+nlr6ouP1Qfw1p75ewgzzvWeHPOS/3Q6CdUgg760T aTLDENhsrtBmhhdyNbwItLxUdSbvldxahfMXHTtebBNpY7KpKcnFFFNIR aeT/WDxkchMSB0j2ZgMRrj8xzqVJoIJ5TxcHh7snaKzdkYVljyTLkCuwe wO+dpegsBoKftJT3ihE+fSC0bp5LExqtw3xF5K9+1DdMLY968gCkGeTOy g==; X-IronPort-AV: E=McAfee;i="6600,9927,11000"; a="7659659" X-IronPort-AV: E=Sophos;i="6.06,196,1705392000"; d="scan'208";a="7659659" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2024 07:06:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,196,1705392000"; d="scan'208";a="8279225" Received: from ybaron-mobl.ger.corp.intel.com (HELO localhost) ([10.94.249.66]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2024 07:06:51 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: "Maciej W . Rozycki" , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 1/1] PCI: Use the correct bit in Link Training not active check Date: Fri, 1 Mar 2024 17:06:41 +0200 Message-Id: <20240301150641.4037-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792345445690395992 X-GMAIL-MSGID: 1792346276605924050 Besides Link Training bit, pcie_retrain_link() can also be asked to wait for Data Link Layer Link Active bit (PCIe r6.1 sec 7.5.3.8) using 'use_lt' parameter since the merge commit 1abb47390350 ("Merge branch 'pci/enumeration'"). pcie_retrain_link() first tries to ensure Link Training is not currently active (see Implementation Note in PCIe r6.1 sec 7.5.3.7) which must always check Link Training bit regardless of 'use_lt'. Correct the pcie_wait_for_link_status() parameters to only wait for the correct bit to ensure there is no ongoing Link Training. Since waiting for Data Link Layer Link Active bit is only used for the Target Speed quirk, this only impacts the case when the quirk attempts to restore speed to higher than 2.5 GT/s (The link is Up at that point so pcie_retrain_link() will fail). Fixes: 1abb47390350 ("Merge branch 'pci/enumeration'") Signed-off-by: Ilpo Järvinen --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d8f11a078924..251a0c66c8cb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5016,7 +5016,7 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt) * avoid LTSSM race as recommended in Implementation Note at the * end of PCIe r6.0.1 sec 7.5.3.7. */ - rc = pcie_wait_for_link_status(pdev, use_lt, !use_lt); + rc = pcie_wait_for_link_status(pdev, true, false); if (rc) return rc;