From patchwork Thu Jun 13 05:42:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13696143 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2054.outbound.protection.outlook.com [40.107.100.54]) (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 81CB213698E; Thu, 13 Jun 2024 05:42:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257369; cv=fail; b=IaaqqaX4q//2MdKFRd7Il+jI+meWShY90WUy5r/65Qaxo14bo6IzmHu7gG0i6NhZ5lP+KGIyrmYhRa9RWIuAtiEDHKYPUIPCuTMpoIYsu4iPeVimxKm3jId7QsoO6j6VdRWytlxTDi2N1UcoUGO1v97D4sqbmW024bgRvycGytA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257369; c=relaxed/simple; bh=Dc7fpULQmfMuKBnCfk95qpC5rQUO319FIEnAwKPpWcQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y3UvgSj2YVfvNTxhD+cgcqAmFi5fEe71tnHprUO3Xm+4zfct4qHVG9aQVMjVg1VgNIex8sonPqnvxFyl6Z2QEcnIPO3UGlQef/I2GZvB2rqVml61TAEhJHAf7zlCZVOj90C0f1fEsDqW+7xbDHmtsN8lKNG8CzmMFNOPLHxmT3A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=No38GzsA; arc=fail smtp.client-ip=40.107.100.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="No38GzsA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BFP+PrAKN7xlWQvRurmMMbcynz7a+iKZT/4hT7T+8OkDuNVMjlrNSUtO2ukGGFulkUTurciInaqbYDh6InBYH60dbN4VTRCCUAPPEHlhQ//X6vPKtmkc1tUbW0C87wKoh4u6+P6kV/ALqq8jEXRqe4rjMG8cQCa5o9o6MBVZtqs0rkTun3MENqQi0lRTU8+np618h3+5BJVgTg90aPIdLF8fvYIsqbikZZKRNPst7veoDN12jmDnqU8HXyIHjOIQuo/gpPcYGoOnhOyQ3Qeven6/08rYAsTOAaLExNJRVTRgladFMUD4CPrZw7ZwlmFFZwgmkL4dqIqSZQrODvj7Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3rs8T5c63sm0wncwtwBR0Sq14oq3H/A0RwZOMXr6IlQ=; b=NN30fqN+ZKeeIBPfurtXzpMJqCEyNM6N58QVwA5B0PVIyc4j00EGSyEq/5wKUp0Vi0FQFTMii64iAt8yV37169FVMn/tkVBoDt86kFNEXePZkIZ4Y1X2kEq8SEUkMJePLvjeE+WpSbePUsjyJy0MJjW4cfuhMZktlSq8WZF2B9/FbJtSeZA4y1T1dbfyfge/sysrYYMoOqSwNVxft7wNxa3WimjNVNADvQncYscP3UzorCxiHH9t56vPL7NCG4aYxtajSwqesOwGZww1EyMYQh7iWlwM9gnBrCM9VrXzo/uX93/swufeZu+T8e0Qfz8eyqmgzX++RUtW+Ydn9JiuJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3rs8T5c63sm0wncwtwBR0Sq14oq3H/A0RwZOMXr6IlQ=; b=No38GzsAr4l4EZR4yVgNsrlbnM5HyfQLK9UB87pp+8PaAVF1PKXHuSpSolTSHbItDNVbznIRleAiJnPZ5PqYXLtv18Nr/E83pxx5E5xRy3sXDn27mf26H5LCpSCk+mB0XwolmRI7pl68PUAmFjEcNPTS+BXI3E3GO/Od8mtnU+U= Received: from PH7PR03CA0025.namprd03.prod.outlook.com (2603:10b6:510:339::17) by LV3PR12MB9120.namprd12.prod.outlook.com (2603:10b6:408:1a3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.37; Thu, 13 Jun 2024 05:42:44 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:510:339:cafe::f1) by PH7PR03CA0025.outlook.office365.com (2603:10b6:510:339::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.24 via Frontend Transport; Thu, 13 Jun 2024 05:42:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Thu, 13 Jun 2024 05:42:43 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 13 Jun 2024 00:42:41 -0500 From: Mario Limonciello To: Bjorn Helgaas , Mathias Nyman , Greg Kroah-Hartman CC: "open list:PCI SUBSYSTEM" , open list , "open list:USB XHCI DRIVER" , Daniel Drake , Gary Li , Mika Westerberg , "Mario Limonciello" Subject: [PATCH 1/4] PCI: Check PCI_PM_CTRL in pci_dev_wait() Date: Thu, 13 Jun 2024 00:42:01 -0500 Message-ID: <20240613054204.5850-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613054204.5850-1-mario.limonciello@amd.com> References: <20240613054204.5850-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|LV3PR12MB9120:EE_ X-MS-Office365-Filtering-Correlation-Id: e21549a5-0634-40bd-d504-08dc8b6ba5d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230034|376008|1800799018|82310400020|36860700007; X-Microsoft-Antispam-Message-Info: 0quFrxkHT24bE2trO7g3ojhZ56/uOp1fDgWVraPZZM6GNa1dImW3U44YcWREZ+p+8y66joxNKwsn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kL4eAHOtsY0Mskom5sLg/bBtlzU3gSBQA8ND6rMJfxYpE7nlohsr90f1YAKnH6eb0A7npqVOfio+AV6pClKdnpmYhWfjTDoG99ny9fyzsK0rX7PWce9nLL/pl7C+qMBRW28eiBCHz3aUzhYAgz/9WAt2oJQktt8lyyQhwqrwVz8quFA0hZC07olTPzzQjMc1sTmFLj6+RHX7Jq7JPk7Ad30BtkZMEYGbmSXAiOFrdx0WRB8HUYYnKFjmpSXL3d0y+evPQ2r8tJgg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230034)(376008)(1800799018)(82310400020)(36860700007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 05:42:43.6683 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e21549a5-0634-40bd-d504-08dc8b6ba5d3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9120 A device that has gone through a reset may return a value in PCI_COMMAND but that doesn't mean it's finished transitioning to D0. On devices that support power management explicitly check PCI_PM_CTRL to ensure the transition happened. Devicees that don't support power management will continue to use PCI_COMMAND. Signed-off-by: Mario Limonciello --- drivers/pci/pci.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 59e0949fb079..41961e28a86c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1270,21 +1270,33 @@ static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout) * the read (except when CRS SV is enabled and the read was for the * Vendor ID; in that case it synthesizes 0x0001 data). * - * Wait for the device to return a non-CRS completion. Read the - * Command register instead of Vendor ID so we don't have to - * contend with the CRS SV value. + * Wait for the device to return a non-CRS completion. On devices + * that support PM control read the PM control register to ensure + * the device has transitioned to D0. On devices that don't support + * PM control, read the command register to instead of Vendor ID so + * we don't have to contend with the CRS SV value. */ for (;;) { - u32 id; if (pci_dev_is_disconnected(dev)) { pci_dbg(dev, "disconnected; not waiting\n"); return -ENOTTY; } - pci_read_config_dword(dev, PCI_COMMAND, &id); - if (!PCI_POSSIBLE_ERROR(id)) - break; + if (dev->pm_cap) { + u16 pmcsr; + + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); + if (!PCI_POSSIBLE_ERROR(pmcsr) && + (pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D0) + break; + } else { + u32 id; + + pci_read_config_dword(dev, PCI_COMMAND, &id); + if (!PCI_POSSIBLE_ERROR(id)) + break; + } if (delay > timeout) { pci_warn(dev, "not ready %dms after %s; giving up\n", From patchwork Thu Jun 13 05:42:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13696144 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) (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 86D741369A5; Thu, 13 Jun 2024 05:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257370; cv=fail; b=JlDBeAEC9YYuEoifDfPaSVXntEGtLVyVqS/aYxEblvcIKpgqSySw+0m9utmMgC65cIZNQI7F+6gjalLISVflEZf0646Cn+tFrdObzgLbo6FsPclCRuneCdmHLfS95LvqNWNcEveDy8f83JYEQbyGRi8HCeAwTc5URfhONdKYZcs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257370; c=relaxed/simple; bh=pRVjKIJGALJ6M5iK/kB6RyzC6HZmWUj2WFH25gwfIVc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n/mITFj9bEbaAnHFDQAJbl16Lc0mR8usz6D/bQFSg4UkwMHO8kII/0isHEELnweR3YfiZX7U+ruH91uWeSyEygaUg8uZp18ef2aLG+FkoXjvPm+QuH/nM5lOoI91ZrkN25DGTgSiV82fJ3Gx0ysUCYDxpttW2j/Th5vUkOpcklk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=nBlHpOnf; arc=fail smtp.client-ip=40.107.243.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="nBlHpOnf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDXjPm1mWuUVcqfhfhwUyb4QuBud5Pg1dmX3AR1ya1daIeJ2YxEQANQDuquFpWZWsrmAGR0mtw7Lxa/9hmaR0NJRg53Ln0V0O+zYxLyIjuTIJQIMQIm9v0nbtFHYDEDqrRvcOlDmJUOvAE3cjMLMDK4BlrdMD8scd6T2YEWdta+zLDIALJwJY+Arg+p7qc7W43j6+sbQ4ku2WB6buRdhos8kW08F1PUpPsp5Ogx77I+MML5TKLXJ49+Sh7d+ra6YgTM3pL6OYxrBmFjAvs2Jgq3+Vz7zfm9LQ2SHW3NX9X6M6qoN9dfT4FvQRSIMZ6ahBxesUfrakDZ1E4GRiGOWjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4vn1vebuzNfIWvPy14bk9ZTF1ZTEtYT1OoAf+ZclpxM=; b=NJlEnggldpGijJHE1jmfkgqpmrMiGQkWahiVWsnVU1f+W6CShg/nCI+d1zEZmEY5Ergz6QD/1Fisj5J9cQ+zuNsgn8LQi9lXHaxiSfZYeI7phMKCWT4T2z4FXgfymL1sDu0i2QE4j2XKpj1OtU1SnR01gcP3mD5PWoUGOPZ310Lu9IyMH3rJ2fgIJkNRY0QxmSUD0barBAv38fKgve40R9cPP9pqnGfZuCkW5dsPIbrjitLe5YR7BzQKKlYSVMNEyZiReH4pEinOjHUy8+xpfETK2pL3LW8K1+BwZxH/LPBU8lWY3mjM9LEHdnutjA0OOa4xKGSVXw5LPjZHnPrHZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4vn1vebuzNfIWvPy14bk9ZTF1ZTEtYT1OoAf+ZclpxM=; b=nBlHpOnfGdOtU8zKy/uPozzmxJbgXlnzvt1aKRsjlCi0/ZxZEJ6ZNpLmTFy7/nyg6lHl+7OSxZHWqQGqgebAroNMPyK9jS0PE8vZkkyQhWiCW1TRRPyBc1lqlQdiJxHNZyb933TbY2RnTOMx6SNl+++2pInFuVPWVe65QyI5/sE= Received: from PH7PR03CA0012.namprd03.prod.outlook.com (2603:10b6:510:339::24) by PH0PR12MB8821.namprd12.prod.outlook.com (2603:10b6:510:28d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 05:42:45 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:510:339:cafe::e3) by PH7PR03CA0012.outlook.office365.com (2603:10b6:510:339::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.21 via Frontend Transport; Thu, 13 Jun 2024 05:42:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Thu, 13 Jun 2024 05:42:45 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 13 Jun 2024 00:42:42 -0500 From: Mario Limonciello To: Bjorn Helgaas , Mathias Nyman , Greg Kroah-Hartman CC: "open list:PCI SUBSYSTEM" , open list , "open list:USB XHCI DRIVER" , Daniel Drake , Gary Li , Mika Westerberg , "Mario Limonciello" Subject: [PATCH 2/4] PCI: Verify functions currently in D3cold have entered D0 Date: Thu, 13 Jun 2024 00:42:02 -0500 Message-ID: <20240613054204.5850-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613054204.5850-1-mario.limonciello@amd.com> References: <20240613054204.5850-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|PH0PR12MB8821:EE_ X-MS-Office365-Filtering-Correlation-Id: aeb381eb-3c59-433b-2d97-08dc8b6ba6af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230034|376008|1800799018|82310400020|36860700007; X-Microsoft-Antispam-Message-Info: Adp1qeqc2zYztbwR0ajh+vcqaK64/2K+HYUAo4b30UR54mvoYgVGTpcX5RMk4kEbwP7u7cZ8WlsV5MqrGXLSR/2XnBGa9wHN28TuELCe5SmN6cOK7xV4FthekoMklei6IRRJu8B7njG9svMfiFaX7V4M290c6R0tmlQFf6alrffc/7mzZdZABaHm7tKrK0PNnOnVwCThRPKEg8tppYda4U/1sJZfi4vo5JkAtnQMhCTfzGWwUmRwsoNSXbO3zXpa4SQNqFExgCuK9y9Q2q/IzIhB4Le+3RP6xMc8X7HkRov6hDN+zYBZAMBvEr0bjNCJScScVoZOYFuSUfsP+fX4u3UjAhrM8DnQwqE42yVK9RAYuUJb7Y0uD8/LH/eOY9+aCjbb9C9GPLVFuipgVHjRKPhqRKKMNJ4XUMIcVDu6D0h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.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230034)(376008)(1800799018)(82310400020)(36860700007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 05:42:45.1371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aeb381eb-3c59-433b-2d97-08dc8b6ba6af X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8821 It is reported that USB4 routers and downstream devices may behave incorrectly if a dock cable is plugged in at approximately the time that the autosuspend_delay is configured. In this situation the device has attempted to enter D3cold, but didn't finish D3cold entry when the PCI core tried to transition it back to D0. Empirically measuring this situation an "aborted" D3cold exit takes ~60ms and a "normal" D3cold exit takes ~10ms. The PCI-PM 1.2 spec specifies that the restore time for functions in D3cold is either 'Full context restore or boot latency'. As PCIe r6.0 sec 5.8 specifies that the device will have gone through a conventional reset it may take some time for the device to be ready. Wait up to 1 sec as specified in PCIe r6.0 sec 6.6.1 for a device in D3cold to return to D0. Signed-off-by: Mario Limonciello --- drivers/pci/pci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 41961e28a86c..a6ed85dd8d92 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1387,6 +1387,17 @@ int pci_power_up(struct pci_dev *dev) else if (state == PCI_D2) udelay(PCI_PM_D2_DELAY); + /* + * D3cold -> D0 will have gone through a conventional reset and may need + * time to be ready. + */ + if (dev->current_state == PCI_D3cold) { + int ret; + + ret = pci_dev_wait(dev, "D3cold->D0", PCI_RESET_WAIT); + if (ret) + return ret; + } end: dev->current_state = PCI_D0; if (need_restore) From patchwork Thu Jun 13 05:42:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13696146 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2074.outbound.protection.outlook.com [40.107.236.74]) (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 5997D136E3A; Thu, 13 Jun 2024 05:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257372; cv=fail; b=Mte09zXQsNPEZRybrRg5yyrQyyBIyWQpQeRNVbu9f5PKpQReAc0rU8bxd64tdoQ13NzHYdpanulkagwo4vvH02uYb9S+jdMNgleUe4nnnweH32Xzw6XF5SGHI+7TnUeqppScLmAddd4OmlqC7IPCO1JWziMfkvexM4p3vA84UKU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257372; c=relaxed/simple; bh=BIWtnfvMwFhza1IpWLfkDcPvVVJ0VnMEgUXFdQ9s4pI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eBa1qweMsnN8VtqKk9tOItVfmVnoFe+82FARdETwO0eA5+e6P/ctuDO6wp5vyrx92epenBYBvmjjNBddv+FEyxGmUxnOThXfLjyQxB+/eiHHO876ktDOcuYrVr7xdSaQUPIsMelH/IYWWvLth4fLAgtxTQaf+eeeQWz0yz+HOC4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=NIIcwVQ9; arc=fail smtp.client-ip=40.107.236.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="NIIcwVQ9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X1V94Zyc5UrIn0V8XkUw1DmhthaD6KYfocOqq5neOPrcDrzyGFPO6fkKfnPluT3VjPPq3VO4RMO/NbJbO9HN8kvjZ1+z9XGAg+wRsANiJEKSdNxV41uBEk1GTcWW5KGUs5++mDdXtO3At5AhWmytpqJYXp7utPTIDRfajpMACQpcLZna+ZErF9Mw4pYQpu99CjQg0602ezopidqO6JU1PrXOqEXMMolRG9TnEzeYT3d8lMw0OFidV2jLUBpwMo/sKZjXfzJ3ZHvk340D20o2aMTEUUtFwTF4zb3dzjwDZ9Qgs656YaQg2Wrx2o1DqvRcbb0IIn+4JsPOiKB060xaJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3Y8LrCtQGg2zUiTkHiOpl/2FOTu8eIkcZpCcb+HmIYM=; b=miDTfpgXu6EKsZ+kDEVF5aECEYjSytZBeuPgRQIJB10oipRqiBM2zctoG9yAmB2haM9nTchVGoSmDwR5FTmjpKX+/kZhT1Dmyz4l3hXmPQmDWzEs7FlCq7Lu8jw1vbPTXAMhzwyeS50G8uhq7wNr0GknE73NqK5NdJcFmg6tnWFdTMEwE/eEBjQ1LfNcZO5ImWX5z9qAJnOb6+6W8gbpwYVCy0EB59aKBzs/8GBeL+FbmLumsjbdTPvTnhRO6LKnG0KTjNFq4cp6kZ2QFhTyonBX8UtMOEkZeMt8nbMXfv/pOGpOHzfxqyTUKTWkKdAYVDhhz9xdR0uRWV+1XiqdcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3Y8LrCtQGg2zUiTkHiOpl/2FOTu8eIkcZpCcb+HmIYM=; b=NIIcwVQ94jC7VXldCwzwRxThavHxmRJRZnQR7EYwQqE4U5N1oJsCxQ6gl8ON9cf5fBZNZZHhMmM6pa33XzF942buDUsB6GYFHur4amw2vVabCHuZWwUPhTKoC6XdfIyZa4jAXP8S70AXO1qylSoh0YpM17AozsmYk9HA+5i4w94= Received: from PH7PR03CA0004.namprd03.prod.outlook.com (2603:10b6:510:339::30) by DS0PR12MB6392.namprd12.prod.outlook.com (2603:10b6:8:cc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Thu, 13 Jun 2024 05:42:46 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:510:339:cafe::c) by PH7PR03CA0004.outlook.office365.com (2603:10b6:510:339::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.24 via Frontend Transport; Thu, 13 Jun 2024 05:42:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Thu, 13 Jun 2024 05:42:45 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 13 Jun 2024 00:42:43 -0500 From: Mario Limonciello To: Bjorn Helgaas , Mathias Nyman , Greg Kroah-Hartman CC: "open list:PCI SUBSYSTEM" , open list , "open list:USB XHCI DRIVER" , Daniel Drake , Gary Li , Mika Westerberg , "Mario Limonciello" Subject: [PATCH 3/4] PCI: Allow Ryzen XHCI controllers into D3cold and drop delays Date: Thu, 13 Jun 2024 00:42:03 -0500 Message-ID: <20240613054204.5850-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613054204.5850-1-mario.limonciello@amd.com> References: <20240613054204.5850-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|DS0PR12MB6392:EE_ X-MS-Office365-Filtering-Correlation-Id: 96c80735-630b-4164-8a53-08dc8b6ba72d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam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1XbkrOZ0RAYDsdNepOWnuWTvClemCO07hDsX7qZeMqHwzxYxDPk13pZAg2fl4+4XSQb8gazjt2+4RS1Soa9GJkP85cOQKta6FHqn/XHiBRchHBIWWXzKFdZPofp6FGnEXjVLqYzfZf/5db+OTHfeUW2PyNpiNi3FBEaPob5ZSjYx5wVo105mR1bOvqshkfGEg1siMbVIoEYoV6WAJqxZXzam8PQad6WNbTc8FRDW3PhtoIhHiTcu7V0ZxO7PZnY7X+Q/E2ulWl2rnIvJofBvVwmII9Jva1Brx3YHW+GRH86m9cxo2+ptw15mAeSc7xY/Qh5uiwYlGXE+9aFi3T0u1tMLU6Nv+RnIDzXwlMnZAU1q9TCu4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230034)(376008)(1800799018)(82310400020)(36860700007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 05:42:45.8871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96c80735-630b-4164-8a53-08dc8b6ba72d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6392 As the PCI core now waits for D0 after D3cold exit, the Ryzen XHCI controllers that were quirked to not use D3cold and to add a delay on D3hot no longer need these quirks. Drop both the PCI and XHCI sets of quirks. Signed-off-by: Mario Limonciello --- drivers/pci/quirks.c | 17 ----------------- drivers/usb/host/xhci-pci.c | 11 ----------- drivers/usb/host/xhci.h | 11 +++++------ 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 568410e64ce6..942d0fe12cb1 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2059,23 +2059,6 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_nvidia_hda_pm); -/* - * Ryzen5/7 XHCI controllers fail upon resume from runtime suspend or s2idle. - * https://bugzilla.kernel.org/show_bug.cgi?id=205587 - * - * The kernel attempts to transition these devices to D3cold, but that seems - * to be ineffective on the platforms in question; the PCI device appears to - * remain on in D3hot state. The D3hot-to-D0 transition then requires an - * extended delay in order to succeed. - */ -static void quirk_ryzen_xhci_d3hot(struct pci_dev *dev) -{ - quirk_d3hot_delay(dev, 20); -} -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15e0, quirk_ryzen_xhci_d3hot); -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15e1, quirk_ryzen_xhci_d3hot); -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1639, quirk_ryzen_xhci_d3hot); - #ifdef CONFIG_X86_IO_APIC static int dmi_disable_ioapicreroute(const struct dmi_system_id *d) { diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 0614d002aba1..ae330d3df6de 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -314,10 +314,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; - if (pdev->vendor == PCI_VENDOR_ID_AMD && - pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI) - xhci->quirks |= XHCI_BROKEN_D3COLD_S2I; - if (pdev->vendor == PCI_VENDOR_ID_INTEL) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_INTEL_HOST; @@ -743,13 +739,6 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) if (xhci->quirks & XHCI_COMP_MODE_QUIRK) pci_d3cold_disable(pdev); -#ifdef CONFIG_SUSPEND - /* d3cold is broken, but only when s2idle is used */ - if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE && - xhci->quirks & (XHCI_BROKEN_D3COLD_S2I)) - pci_d3cold_disable(pdev); -#endif - if (xhci->quirks & XHCI_PME_STUCK_QUIRK) xhci_pme_quirk(hcd); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 30415158ed3c..b84b1c48c517 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1621,12 +1621,11 @@ struct xhci_hcd { #define XHCI_DISABLE_SPARSE BIT_ULL(38) #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) #define XHCI_NO_SOFT_RETRY BIT_ULL(40) -#define XHCI_BROKEN_D3COLD_S2I BIT_ULL(41) -#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) -#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) -#define XHCI_RESET_TO_DEFAULT BIT_ULL(44) -#define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) -#define XHCI_ZHAOXIN_HOST BIT_ULL(46) +#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(41) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(42) +#define XHCI_RESET_TO_DEFAULT BIT_ULL(43) +#define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(44) +#define XHCI_ZHAOXIN_HOST BIT_ULL(45) unsigned int num_active_eps; unsigned int limit_active_eps; From patchwork Thu Jun 13 05:42:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13696145 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2048.outbound.protection.outlook.com [40.107.102.48]) (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 1D991136E27; Thu, 13 Jun 2024 05:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257371; cv=fail; b=mTFzpQYVHP7H1TpRcs9+fbkBcnuR0IJnDHXCc5dG0F05Ba1JyCCRBIeywCENvyyaaqcxmSVBgG2Io0+T1H3H1YjlaIun27+7vOz9vO5N5abmSI/4lo41tGyxOaUEGBc1Bu9UlsNdiKwQ9zw3l6UU7Ew7L0fW6hEHCB/OldFh+Sw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718257371; c=relaxed/simple; bh=C2kPEeUrO93MSjn7Ny0iWuHbFheDIMKmnDA+pCiXwB8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=M3/vsmiLRkWjRVp8oKAkghJBE/7Hoj3X+hebQF4VJvW18awInQpM5O4n6vGoPHvThHxUnl6EOB1v/LxOqJ93dzGrhcw2t0kTuh5ygvmVfDD4mZelPHcIPX48o0MdAWyTgeN+FZuW0BrRPwaRtPNzO6B0Zbyk4DuR2JDyK3hcmnw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=OaGpFckU; arc=fail smtp.client-ip=40.107.102.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="OaGpFckU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TOtTKAKjfeKm6zr7oJZzQoEwnbrJdrObj8DjLDDNmNOl5+XEiBlgu+tzTHt+NXb/kdFywijbq9PlId7n7xQlqcQAn2vFgfGNp//aZCskcHEyqyUI3rjWyb4PIq8n6+q/mHCyKDLNVwbLnFdU9TY0QtYzEwU8oqDzxdKq8okrG1RhXED8tFBmu518dUjjW4LGC6ghGweH58/wrdoaynn2jvl+arHLwTAHmY/tQoEVrZaQo/hnoBDi+68Lz3dNuY4i0HfZfHrMRfcaaPgchwd6cknVFbpzLLU1YJjhpnsF/wBrTmIeVJsBQavhrBNoitQJbXqDw+yKTnmRWwyRRNxOug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5p4THujH1L2H9U0QBonyDPLu9QLPMKypgE/r1FjQv0I=; b=cJLP8X+8+o8DS3zjGIG1RtBiV+OUKyU2NjwlBG65nwDFL3rCG+vZ70yF/n/4ojH+YpAAUdgccTI2/Ckt3YL5U88S4jPdEgqBgns0rV2pHhVZPEeT6j/DniFjdYWmak8237GJFBt3hNsIKNLMI2Oga3L6cZslSoa9XGsqE1gMRAQCy+AFrucPZuqnUBdTgq1TdjW7SDmYi4ETVpeyfFe4b22vV/sDaQPzs78XtvWdc4GIm4QCz3e/Hdwzc1ByWjl4Vu/OnosYhDjvnVCQ5FFX3l1aD3sfS3vE/jfC2RI2Rvten29kYPzFp41MuknN1nbKnwZKQB+ZwpqWjyTp8aNQIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5p4THujH1L2H9U0QBonyDPLu9QLPMKypgE/r1FjQv0I=; b=OaGpFckU80ZM+Q0cdpJGHuwGTCKnIpFVF6tbz2YKnORyXPARLqP36lBv+RUNziMAx2zt0eA2VNKbbNUDDSycdqfhGiSVZ70Jl4AQsMuIMYjobn3IvTMSNzcKMCDNisb3qgszNGmZS7m1sHFCTAP9JziW+69QGDpl8oJkYma5ygg= Received: from PH7PR03CA0011.namprd03.prod.outlook.com (2603:10b6:510:339::12) by DM6PR12MB4449.namprd12.prod.outlook.com (2603:10b6:5:2a5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.21; Thu, 13 Jun 2024 05:42:47 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:510:339:cafe::d3) by PH7PR03CA0011.outlook.office365.com (2603:10b6:510:339::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.24 via Frontend Transport; Thu, 13 Jun 2024 05:42:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Thu, 13 Jun 2024 05:42:46 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 13 Jun 2024 00:42:44 -0500 From: Mario Limonciello To: Bjorn Helgaas , Mathias Nyman , Greg Kroah-Hartman CC: "open list:PCI SUBSYSTEM" , open list , "open list:USB XHCI DRIVER" , Daniel Drake , Gary Li , Mika Westerberg , "Mario Limonciello" Subject: [PATCH 4/4] PCI: Drop Radeon quirk for Macbook Pro 8.2 Date: Thu, 13 Jun 2024 00:42:04 -0500 Message-ID: <20240613054204.5850-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613054204.5850-1-mario.limonciello@amd.com> References: <20240613054204.5850-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|DM6PR12MB4449:EE_ X-MS-Office365-Filtering-Correlation-Id: 899f18a8-73b4-450a-8343-08dc8b6ba7c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230034|376008|1800799018|82310400020|36860700007; X-Microsoft-Antispam-Message-Info: AbmvffzSqcswaQ0oo6Ari7HBF19Tibl0AGInS3UwI1IH19Dm2kFQo62oTDBtUkGFxDA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KHx3sHcJ7U9ABeGoZ+Y0YCpnaJ0N/QYYnjMACY+5sX/jmlr8ji/Mhqi+DBKqcujK2B/HDg+fP10ox3dNthARG83udpPhxCTTfl7C7dsdFCjNwZ3LXU6cdmKCf0Z2KlcgEl5KP6jl9+KGOmS14JFXMsKPR0+S67fkiO0RIcPs3jVfEfhPSkbsq2v86HuixLG+PNDweYNrCsRG2DAes0zaIga2MKh+LWqGn62Ynr0RY8wYYek01dNXM5KHLtH37iyIAE7fA20DkSNsUewUVeY0g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230034)(376008)(1800799018)(82310400020)(36860700007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 05:42:46.9340 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 899f18a8-73b4-450a-8343-08dc8b6ba7c8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4449 commit 5938628c51a7 ("drm/radeon: make MacBook Pro d3_delay quirk more generic") introduced a generic quirk for Macbook Pro 8.2s that contain Radeon graphics to ensure that enough time had past when the device was powered on. As the PCI core now verifies the device is in D0 during power on this extra artificial delay is no longer necessary. Signed-off-by: Mario Limonciello --- drivers/pci/quirks.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 942d0fe12cb1..19be953c9f37 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2038,14 +2038,6 @@ static void quirk_d3hot_delay(struct pci_dev *dev, unsigned int delay) dev->d3hot_delay); } -static void quirk_radeon_pm(struct pci_dev *dev) -{ - if (dev->subsystem_vendor == PCI_VENDOR_ID_APPLE && - dev->subsystem_device == 0x00e2) - quirk_d3hot_delay(dev, 20); -} -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6741, quirk_radeon_pm); - /* * NVIDIA Ampere-based HDA controllers can wedge the whole device if a bus * reset is performed too soon after transition to D0, extend d3hot_delay