From patchwork Fri Aug 18 19:40:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13358242 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA178EE499D for ; Fri, 18 Aug 2023 19:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379700AbjHRTlY (ORCPT ); Fri, 18 Aug 2023 15:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379702AbjHRTk4 (ORCPT ); Fri, 18 Aug 2023 15:40:56 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4574222; Fri, 18 Aug 2023 12:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oAu1k7zyRsxY7amxrwEfl16UlIGs4l+l8MZKM2BYvWA5zXXChKGhpkk9ZrV7bHDe3MRRqNAdDbW9SPwEMvIQy51uowVd+xiDLg9bD88d1jM7fNeHzEh/Jn8Ez1rHTtfvGA4d5AWWniJyhVz1Y7CjjWRz5jBXMLjZED27msFFCRw5x1u4gpoghmyDBI3xSozniy3aMN0JUBJq5tjUWJtpqTmXJ2Jk3PL/f4sew3U/7KfIkKsBGdV1iF4TbdOLhN/9vq11NBrxRVnS+xCcXuOlFiBhtfiG2vb1nqAGNkUyAYxlUGhqkt7HicJlhZKf3teGpWBJATX8/G9U/m2SpYlNBw== 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=p8t9dWr3SYEGcReSvoWYqCJ1XUDQSml1FxGQjktYRqU=; b=Y1gMtgUbzgx0DVYstfIp88Gn5kVG0wLMnKItlFLYB2DsJkrihHGe/jgAmMqPX0Ez5dPp7dCz3knRAGP7j14FgkZ7cvbVlCuyS4u4O4TbGavL8oypSX9ugxFSljdE8807EQpIJp5rAYvr81Tvt8fnJuTSmaVpgtDDGKK7A5z5Hpx3doEGmtnAtkY1JZ2JJ4X4Ez5RhoM9JFlhC71WM0l2CrZtz8Fh08jheSVq/aKQPPLsxUjRg0G9BEtQKe2c/NYM6UOU0CcbKvzqEBffqor23A45lDIeqG78E9/ySHPiVJzIj8fl01N/uvBwasdDXSESY5yKen6b++s1FHbP5o4lxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 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=p8t9dWr3SYEGcReSvoWYqCJ1XUDQSml1FxGQjktYRqU=; b=EbpeAg91dy+JuiT8eS8DMA74IGCVW9U9wC1OeyYjzt5/UK96oe7v6QvGdoNbWQeUgSWZ20hxR3fWfOLMK8o7fkHxfkYgmtuX4HfbdqJdYpRSE3boGtnoLN2zqsY4E31VgvuXBfUmB2y0tuIThbngSipkKdfVAe7K0S0ntDAlQNE= Received: from MW4PR03CA0154.namprd03.prod.outlook.com (2603:10b6:303:8d::9) by MN0PR12MB5737.namprd12.prod.outlook.com (2603:10b6:208:370::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.31; Fri, 18 Aug 2023 19:40:47 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:303:8d:cafe::96) by MW4PR03CA0154.outlook.office365.com (2603:10b6:303:8d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20 via Frontend Transport; Fri, 18 Aug 2023 19:40: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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.15 via Frontend Transport; Fri, 18 Aug 2023 19:40:46 +0000 Received: from AUS-LX-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.27; Fri, 18 Aug 2023 14:40:45 -0500 From: Mario Limonciello To: Mika Westerberg , "Rafael J . Wysocki" , Bjorn Helgaas CC: , , , Iain Lane , "Andy Shevchenko" , Kuppuswamy Sathyanarayanan , Mario Limonciello Subject: [PATCH v14.c 1/4] PCI: ACPI: Add helper functions for converting ACPI <-> PCI states Date: Fri, 18 Aug 2023 14:40:24 -0500 Message-ID: <20230818194027.27559-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230818194027.27559-1-mario.limonciello@amd.com> References: <20230818194027.27559-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|MN0PR12MB5737:EE_ X-MS-Office365-Filtering-Correlation-Id: fcb3a66f-658a-40e1-8103-08dba02304fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: veFVNV+UilsZxmdqi3+NzK/4GSFAWt6vYeLTXRh4BFXVENeAtwFX0nXFKEvEQ+EPwBeQaQT6rf48ntMMJvPpQENflOM7jZaUQzBPnqNnQuwv8A5nX74P0pC4qzq8H5eSuip3dngzEMnJ7UNTwR+ru+NjbUE3XMTd2hbH2I0BNvas1U3fHalpLRfpnhNbf61KLYwfJ9TTzHOJkLpniHtQ39w6eOcBkR5uvAjXSuc9Gn9SHAZZtxtCisJ89p0mLc4udSp/1bwOicLZhCXaRBfaYJmjG2rTakCjPnbMHF0pde9tQYZqUsZ7MBEE9jAraZj5W4z5ia/t05mCV2u335MrHDPXjUOsi1UBYGtipndVf5wedyPsGLdepWa3xeJ9Aiq3ssVRCqbmVHYF4GRnU970CdVPnwCb/ePjTw4ttn7v/SHpXofTysdudk1LarWu0P5Axnl1HT8DaxtQ1rsdjR4mm9yLTddx3cifY2u4IcvvDGsuRkNvEw56hmKEYv4JWG1w2Z/sHzg3z7bfzPVyG4+Vvs9xoQYH0nquCqPi6BTwXMF09u4+LdijMaYtNwfrFCoSLD7E/mM7impqpARXAAP//Y7m6BJLwF+D+G1p8/B9M4hkl5SAvliJNzWp4HpFqkzV3srziWog+dXHduFdPJnKlrpBd17va0ilVR1lUJyBKQh5Ce7XSi5Fr5FENv2AVzHEHyV/M8manqaADSMUkxm3TxTV7W+KFwuutGIFVC0bZWTQ1r/zV6vDrj4swoQNTy3orRfBVwxjAYq6BM6NFAe7YQ== 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199024)(1800799009)(82310400011)(186009)(40470700004)(46966006)(36840700001)(40480700001)(83380400001)(40460700003)(70206006)(70586007)(316002)(54906003)(110136005)(478600001)(81166007)(356005)(5660300002)(82740400003)(2906002)(44832011)(41300700001)(4326008)(8936002)(8676002)(426003)(36860700001)(47076005)(2616005)(6666004)(1076003)(26005)(7696005)(336012)(16526019)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2023 19:40:46.9385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcb3a66f-658a-40e1-8103-08dba02304fb 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5737 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Several functions do internal mappings in either direction. Add helpers for this functionality. No intended functional changes. Signed-off-by: Mario Limonciello --- v10->v11: * New patch --- drivers/pci/pci-acpi.c | 87 +++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a05350a4e49cb..b5b65cdfa3b8b 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -884,6 +884,56 @@ acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); } +/** + * map_pci_to_acpi - map a PCI power state to an ACPI D-state + * @state: PCI power state to map + * + * Returns: Corresponding ACPI D-state, otherwise ACPI_STATE_UNKNOWN + */ +static u8 map_pci_to_acpi(pci_power_t state) +{ + switch (state) { + case PCI_D0: + return ACPI_STATE_D0; + case PCI_D1: + return ACPI_STATE_D1; + case PCI_D2: + return ACPI_STATE_D2; + case PCI_D3hot: + return ACPI_STATE_D3_HOT; + case PCI_D3cold: + return ACPI_STATE_D3_COLD; + } + + return ACPI_STATE_UNKNOWN; +} + +/** + * map_acpi_to_pci - map an ACPI D-state to a PCI power state + * @state: ACPI D-state to map + * + * Returns: Corresponding PCI power state, otherwise PCI_POWER_ERROR. + */ +static pci_power_t map_acpi_to_pci(int state) +{ + switch (state) { + case ACPI_STATE_D0: + return PCI_D0; + case ACPI_STATE_D1: + return PCI_D1; + case ACPI_STATE_D2: + return PCI_D2; + case ACPI_STATE_D3_HOT: + return PCI_D3hot; + case ACPI_STATE_D3_COLD: + return PCI_D3cold; + case ACPI_STATE_UNKNOWN: + return PCI_UNKNOWN; + } + + return PCI_POWER_ERROR; +} + /* * _SxD returns the D-state with the highest power * (lowest D-state number) supported in the S-state "x". @@ -919,19 +969,7 @@ pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) if (acpi_state < 0) return PCI_POWER_ERROR; - switch (acpi_state) { - case ACPI_STATE_D0: - return PCI_D0; - case ACPI_STATE_D1: - return PCI_D1; - case ACPI_STATE_D2: - return PCI_D2; - case ACPI_STATE_D3_HOT: - return PCI_D3hot; - case ACPI_STATE_D3_COLD: - return PCI_D3cold; - } - return PCI_POWER_ERROR; + return map_acpi_to_pci(acpi_state); } static struct acpi_device *acpi_pci_find_companion(struct device *dev); @@ -1056,13 +1094,6 @@ static void acpi_pci_config_space_access(struct pci_dev *dev, bool enable) int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) { struct acpi_device *adev = ACPI_COMPANION(&dev->dev); - static const u8 state_conv[] = { - [PCI_D0] = ACPI_STATE_D0, - [PCI_D1] = ACPI_STATE_D1, - [PCI_D2] = ACPI_STATE_D2, - [PCI_D3hot] = ACPI_STATE_D3_HOT, - [PCI_D3cold] = ACPI_STATE_D3_COLD, - }; int error; /* If the ACPI device has _EJ0, ignore the device */ @@ -1089,7 +1120,7 @@ int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) acpi_pci_config_space_access(dev, false); } - error = acpi_device_set_power(adev, state_conv[state]); + error = acpi_device_set_power(adev, map_pci_to_acpi(state)); if (error) return error; @@ -1111,23 +1142,11 @@ int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) pci_power_t acpi_pci_get_power_state(struct pci_dev *dev) { struct acpi_device *adev = ACPI_COMPANION(&dev->dev); - static const pci_power_t state_conv[] = { - [ACPI_STATE_D0] = PCI_D0, - [ACPI_STATE_D1] = PCI_D1, - [ACPI_STATE_D2] = PCI_D2, - [ACPI_STATE_D3_HOT] = PCI_D3hot, - [ACPI_STATE_D3_COLD] = PCI_D3cold, - }; - int state; if (!adev || !acpi_device_power_manageable(adev)) return PCI_UNKNOWN; - state = adev->power.state; - if (state == ACPI_STATE_UNKNOWN) - return PCI_UNKNOWN; - - return state_conv[state]; + return map_acpi_to_pci(adev->power.state); } void acpi_pci_refresh_power_state(struct pci_dev *dev) From patchwork Fri Aug 18 19:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13358241 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C734FEE499B for ; Fri, 18 Aug 2023 19:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379674AbjHRTlZ (ORCPT ); Fri, 18 Aug 2023 15:41:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379715AbjHRTk5 (ORCPT ); Fri, 18 Aug 2023 15:40:57 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2048.outbound.protection.outlook.com [40.107.96.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84EB2422D; Fri, 18 Aug 2023 12:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iOMQkXLck4fNyRH7oQ2P4f2Y/wCLMkCu5x817uCQgXllyDfYhcZfIkf2fBUC1PtPlm1GIF5oAMmpmMCUQOFJ5Up9kqkSwsswnynmGmCdNUVbYC9iVsEQGO1oEGa38HkC0RqmsKZtBkYvUMWnqOPT5Mw84LbXAwjybUXBPCt0lskFSyGQLWZc/2Recgc8ZyFMt3Qp7tpnNPuppqyItRDDXpfYHVQASct5xCYu7iLMkJXH/piTIah/2SYUQ7JU5leaka+SjAcriEib+5Uh+qJK1v+FLlh3hNZLk7dP4B/JKAwJXOaAja842WXGxEAmzzMq3/mBf4Irv9PTKAFZCj2MAQ== 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=xP1wTgpPJf7qJnybftam8oEE8r2YVxmONvPjAQc+B84=; b=hkAFHSodnz9PUILYQxS941vEw53kvCIp7lm5/SH8rFBS5eSumEtLDRWO22eE3tQmAtA6a9XhueY13i8QqxS3VIDVbNnNr/nJTjSiXySa99k3s2vHOpixUUunCk/sYLtHqkmrldajuAWWt/FmPz3N067CIKveXEwYde6Hjck+qSbh2QSRULYh5wjO4jHXwAeMfJKCD/s2NsLLhz/T4yOymqyZ21I1GvnOaUwvzZuTmgf+h8+j5i4yyI3U8cCY6PJgQ3Wbj4Q5/Q360/ek3wNHt9kzYf+Rcv3sXmrr3kn90hS+S0mG44aTtoo6CfkLrzOH+ago1/mY+uZCB3D4bm7KoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 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=xP1wTgpPJf7qJnybftam8oEE8r2YVxmONvPjAQc+B84=; b=gpqTuY7EnW4CH28aEojeWy4CJ16otyHZT6N0TmFzVr+neV6EefXq27x5/Vmp1fc+i3nWCvM8FLOoAUXUbE95IVRs+3ESKXERZKr54Ls+YfzFSGPi2OoXRjFf7EihyCZSRRzKZO5sQx47W+zpIWw4jcfqnvtJK2eX/HvMUdPm1vk= Received: from MW4PR03CA0166.namprd03.prod.outlook.com (2603:10b6:303:8d::21) by SJ1PR12MB6147.namprd12.prod.outlook.com (2603:10b6:a03:45a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.31; Fri, 18 Aug 2023 19:40:48 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:303:8d:cafe::f7) by MW4PR03CA0166.outlook.office365.com (2603:10b6:303:8d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Fri, 18 Aug 2023 19:40:48 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.15 via Frontend Transport; Fri, 18 Aug 2023 19:40:48 +0000 Received: from AUS-LX-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.27; Fri, 18 Aug 2023 14:40:45 -0500 From: Mario Limonciello To: Mika Westerberg , "Rafael J . Wysocki" , Bjorn Helgaas CC: , , , Iain Lane , "Andy Shevchenko" , Kuppuswamy Sathyanarayanan , Mario Limonciello Subject: [PATCH v14.c 2/4] PCI: ACPI: Consider non-hotplug bridges for D3 in acpi_pci_bridge_d3() Date: Fri, 18 Aug 2023 14:40:25 -0500 Message-ID: <20230818194027.27559-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230818194027.27559-1-mario.limonciello@amd.com> References: <20230818194027.27559-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|SJ1PR12MB6147:EE_ X-MS-Office365-Filtering-Correlation-Id: dcc04af6-962f-48fb-15cd-08dba02305b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m8EA87LngqI6NHKGztj818Jb90f7lYgxPum+0okHfJWdec0ucwF/UabIIfsTDfZlcuGSiMIsXuDCd2cfdX1rC+jM1+KEs52cmkLVBFBTH5/WlrXfgQMNUf/Ag5va5zWaj9bPjgpRTrebM23PH8VjR/PTQ/eARiI8Xvs7zitYhO4BWATKZoZnt+5urN6OrYjLIccW6T+17YDu35vFFQnDoEEqOc6xcEUjMX6ZVA1YHO6VkUIm8teI4rcfiUlbPc2tcoCclDwkvTSB/r0po5sFs7ivIWXO/8/6NNtvwZ9PrOo6ykmBZxlKvaoquNFAdeHs+Rbj8krzL+H3xoWPrg9t+u1PDPhIrwigzMOFi0ELspHNG9LeRj8maWY44A+xTvX3Ga0qQP68kivWmnKbJHerxu69SI85ZjYPqv3rjh3b77mTYRa+LtqMGtWMAGyVrHf+FVhT4pg59612IKEcbUFapbzaVh27hGwrLzn+QP8gc5IQhHAf8DZNv8jOnfRCD+FIsmD/771zeG50hYiYq8yuS6mf0hMCx0fJojFLtRzhX+Od6NiH49BjB+LU/LfLICxcZoNjvY7Ec+YzuolbV87InRLUmBREoZA1hXjQXiVVwodSPlvC+4UqiZ+vaeLoV0r9gw2RSoI5VMc6w8gzUpoOKcxanOiU01XiIJaSWh1TCw+GI6SK1Wi2Feh05N7YMmiAI/SUMr7zbtEs84zY13s8iExx68k5SUtTLbq0F3fzhg+jDAlA8cCGCFB45zXf63iFfOg5bLjWKcga716jwv01Pg== 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:(13230031)(4636009)(396003)(346002)(376002)(39860400002)(136003)(451199024)(186009)(82310400011)(1800799009)(40470700004)(36840700001)(46966006)(36756003)(86362001)(40460700003)(5660300002)(40480700001)(83380400001)(8936002)(8676002)(4326008)(2906002)(41300700001)(26005)(336012)(6666004)(7696005)(36860700001)(16526019)(47076005)(1076003)(44832011)(2616005)(426003)(110136005)(478600001)(81166007)(356005)(70206006)(70586007)(316002)(54906003)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2023 19:40:48.1416 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dcc04af6-962f-48fb-15cd-08dba02305b3 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6147 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org acpi_pci_bridge_d3() only runs on hotplug bridges. Two checks are made for _S0W and for whether a device is power manageable contingent upon an ACPI companion being present. These checks also make sense for non-hotplug bridges, so move the check for hotplug bridge after the acpi companion checks. Signed-off-by: Mario Limonciello Acked-by: Rafael J. Wysocki --- drivers/pci/pci-acpi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index b5b65cdfa3b8b..64e6ada024235 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1017,7 +1017,7 @@ bool acpi_pci_bridge_d3(struct pci_dev *dev) struct acpi_device *adev, *rpadev; const union acpi_object *obj; - if (acpi_pci_disabled || !dev->is_hotplug_bridge) + if (acpi_pci_disabled) return false; adev = ACPI_COMPANION(&dev->dev); @@ -1039,6 +1039,9 @@ bool acpi_pci_bridge_d3(struct pci_dev *dev) return true; } + if (!dev->is_hotplug_bridge) + return false; + rpdev = pcie_find_root_port(dev); if (!rpdev) return false; From patchwork Fri Aug 18 19:40:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13358239 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D031EE4998 for ; Fri, 18 Aug 2023 19:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379676AbjHRTlY (ORCPT ); Fri, 18 Aug 2023 15:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379707AbjHRTk4 (ORCPT ); Fri, 18 Aug 2023 15:40:56 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2066.outbound.protection.outlook.com [40.107.100.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DA034225; Fri, 18 Aug 2023 12:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TSew1JGCqImcuUdzCYPZRIgTie2Z1KSXAqdj6DobMqNZx7yvpWtIeJXOnXJnQsak3IdHTsxFoL4y2/n3BU7MSEp5F451v2DW1fdwK0y8CZju7/cL7b/PRCrtaCMSyjtOcrXbIb93otqMgtZWywtumJpYoiMgTPmM7LbTplt9Jl6ferBGDVpCcwsjvFL9JeRWUUrvinUD82yJgF5jv+uD/06hqkd0ZL52FyVO2l/cN0lc3Mk39Cdec4Zv5xh0R9zoOJqO5liNffwt8pSkrjqOjutReL6agioy4MIfxiRYosFjlNobvDkYMmGs/xcaVHMRCR29UaseZz+LyhBD08VT0A== 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=pL0+sK/RovTc+zxBCvYHCivCtW4ghCXnZL0l7uED/KM=; b=SUjcgkHBG1q4D82X1MQWdEH4RtmHiXYEE07qRbkYA8NHENZgg2K08ZCc0LHTFHcpNDUwUNgKvhfL+bi9bejUO2VuQIkYyYYSc7C5h7ncOVcarFaARe/TuoDRftAV7Pz/KzX+3ztI2vWaWYzrGOzvOglkbHN2lvUTYMe1VVzBcfucH2iZjQ6rXdEi7HN13m7nO/fs3AYYVKlROA/4SImnm4qFcfrvrivnNTzCpn9/Mk+WP/hqvB264vyCJs5vcU+oanZfGRc/Flpx0LNh52Vjg7zi5Zei3Wzl6SfLLqNaKhqweUANtS0gBKQOqng0VDuY3k0wTvpXzYMLSSKNfwkF4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 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=pL0+sK/RovTc+zxBCvYHCivCtW4ghCXnZL0l7uED/KM=; b=0ilIWUxl1pM/Oc9Xl5bgHL+8YCZSgn2Fx//cfdxDvLqtjGMxzF5bJi+hPTQAMkFgUuAKPZRg8oEMYEAogpR0gVxNkEuhew8YIB/z/fbDk9WmEYjMeRBTrRXUalPIpoqNxZtAxSsuHuS9FSwH2vRCDk7F3ADKli71LuFX5t9x/Pc= Received: from MW4PR03CA0164.namprd03.prod.outlook.com (2603:10b6:303:8d::19) by MN0PR12MB6293.namprd12.prod.outlook.com (2603:10b6:208:3c2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.31; Fri, 18 Aug 2023 19:40:49 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:303:8d:cafe::91) by MW4PR03CA0164.outlook.office365.com (2603:10b6:303:8d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.17 via Frontend Transport; Fri, 18 Aug 2023 19:40:49 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.15 via Frontend Transport; Fri, 18 Aug 2023 19:40:49 +0000 Received: from AUS-LX-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.27; Fri, 18 Aug 2023 14:40:46 -0500 From: Mario Limonciello To: Mika Westerberg , "Rafael J . Wysocki" , Bjorn Helgaas CC: , , , Iain Lane , "Andy Shevchenko" , Kuppuswamy Sathyanarayanan , Mario Limonciello Subject: [PATCH v14.c 3/4] PCI: ACPI: Use device constraints to opt devices into D3 support Date: Fri, 18 Aug 2023 14:40:26 -0500 Message-ID: <20230818194027.27559-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230818194027.27559-1-mario.limonciello@amd.com> References: <20230818194027.27559-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|MN0PR12MB6293:EE_ X-MS-Office365-Filtering-Correlation-Id: c2cf8a10-add1-4ae2-5e20-08dba023063d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pkGBmr7InCpQqAZ5tevKmrtlR6BK/dSZ3WKOueuSUQvWJSdQR7M58VWYZ69rkbZF/AxazqSg4Ew95dEKeurY+o5JNx9UZTPSbgOoYZopSGYI+XUJQE9vVfaFnmS01nwjV/9s5k7kFZAvgCv5osX+S/vZeBhKrH/4yphWvhzfeSr9JDa675CYxVtLV6KGm6eJ//2qPShyylW+0yN6p7E6XhDA/fOxf/Zb/VLbSVhYZAwrsOCxI6I0p7AJYRY6HB++ONTishgak50gfWWnVcHD0VTa6uwz/gIv6/ntL0ynDVjgr/sjePZhzo3gD0LT31MIgJsqZ0bX4FFAViT4ETtBDlUZ0TsWymutq2I0BnFXLn3zU7KY0dEww2s5OfVNWTwaEjlgv3V9+k4mlfpZuuM2YAZUkRthEhrBSONT+rqGeUyToUH7d6W2Wb1aN9UwiabDlIqNXJausLR+PThyDnTbP5/Ai5Kn2qly2mbo6kZgBQ1ongvgpiuTu7D5mv15ZMLZd7HamyxfRWGuYQseSlzyHIY60B0hBBCbRXp+f28zpm4Q3R3EM4pUmQzh7lfyZwf1zfLGcD20ymezvGbwU7jMxgGyhwofEibtA3d5TPyjtZ3O2oLd8xZrXEp3icmQ22ZziXHPSTJwqnkBo2CWynHuRuiS9ge5oInj4AEE3BLZuMh2LHZlCIlvr5UKAzSisSDJ8xARd06x27vgWHF4AxBjMJ6cAeZeZw1VLstF0cT/kfHP69tKiG6oVCTQ1TdGBSGbGZAu+i/C8IwpUvWpmd1PFEXctty7U04OxGKBcyCiuRU= 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199024)(1800799009)(82310400011)(186009)(40470700004)(46966006)(36840700001)(40480700001)(83380400001)(40460700003)(966005)(70206006)(70586007)(316002)(54906003)(110136005)(478600001)(81166007)(356005)(5660300002)(82740400003)(2906002)(44832011)(41300700001)(4326008)(8936002)(8676002)(426003)(36860700001)(47076005)(2616005)(6666004)(1076003)(26005)(7696005)(336012)(16526019)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2023 19:40:49.0635 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2cf8a10-add1-4ae2-5e20-08dba023063d 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6293 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org In Windows, systems that support Modern Standby specify hardware pre-conditions for the SoC to be able to achieve the lowest power state by using 'device constraints' in a SOC specific "Power Engine Plugin" (PEP) [1] [2]. For each device, the constraint is the minimum (shallowest) power state in which the device can be for the platform to be still able to achieve significant energy conservation in a system-wide low-power idle configuration. Device constraints are specified in the return value for a _DSM of a PNP0D80 device, and Linux enumerates the constraints during probing. For PCI bridges (including PCIe ports), the constraints may be regarded as an additional source of information regarding the power state to put the device into when it is suspended. In particular, if the constraint for a given PCI bridge is D3hot, the platform regards D3hot as a valid power state for the bridge and it is reasonable to expect that there won't be any side effects caused by putting the bridge into that power state. Accordingly, take the low-power S0 idle (LPS0) constraints into account when deciding whether or not to allow a given PCI bridge to be put into D3. Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/platform-design-for-modern-standby#low-power-core-silicon-cpu-soc-dram [1] Link: https://uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf [2] Signed-off-by: Mario Limonciello Reviewed-by: Rafael J. Wysocki --- v13->v14: * Move code as another way to satisfy acpi_pci_bridge_d3() instead * Update commit with Rafael's suggestions v12->v13: * Move back to PCI code * Trim commit message v11->v12: * Adjust for dropped patch 8/9 from v11. * Update comment v10->v11: * Fix kernel kernel build robot errors and various sparse warnings related to new handling of pci_power_t. * Use the new helpers introduced in previous patches --- drivers/pci/pci-acpi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 64e6ada024235..8331aea22d327 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1022,6 +1022,15 @@ bool acpi_pci_bridge_d3(struct pci_dev *dev) adev = ACPI_COMPANION(&dev->dev); if (adev) { + int acpi_state; + + /* Check if the platform specifies an LPS0 constraint of D3. */ + acpi_state = acpi_get_lps0_constraint(adev); + pci_dbg(dev, "LPS0 constraint: %d\n", acpi_state); + if (acpi_state != ACPI_STATE_UNKNOWN && + acpi_state >= ACPI_STATE_D3_HOT) + return true; + /* * If the bridge has _S0W, whether or not it can go into D3 * depends on what is returned by that object. In particular, From patchwork Fri Aug 18 19:40:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13358240 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9910DEE499A for ; Fri, 18 Aug 2023 19:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379673AbjHRTlX (ORCPT ); Fri, 18 Aug 2023 15:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379708AbjHRTk4 (ORCPT ); Fri, 18 Aug 2023 15:40:56 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5696C422A; Fri, 18 Aug 2023 12:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V6BnGn6jfhfCdf0Y5T0HZFpcHyktHGzMVxjK2CmoPM0AGARnrxZMcvA0alK2ML3O3xb1bBXKk9H/F8f1wPP1QRHNSi2uHC1Zsqmm9tfyxca59tyHkLizizv5ief4uHLcLqMLLkrQ0yLYu5E/bTP2u2FDWi8s33lubr9YHnULGWGRqlR/Gk7ERKoXdFO9zYE8dRZsXQ9ydTDGNaZ9I47RjJD1yZLF4ZimzL8hf7/g0dAa0fZf5l44IKq+T6pbO5DGkEL55wIurQMpEGUNXXAfqC8Vfg3wtz2WnEG+FOwj2ybqyMPH0Z3STM90/M+WHmtxFAyIeY/n1vvQwjsLqU6Daw== 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=N4Sayu4PEU9K07ryNQslCaryOHfbIA30KHQDdC6fFVw=; b=Pg6HPpNmBRsZ6i4dDD2gQmlnht8txlv01DmL7gd1hQnMQ3vvXM+INZKIWtnUkf5mMdDtKd2K9bFSZ8Zr2fsFRgvdGrudSTeTSjodYifHrhDRZX0yiO+fhyGrzVNeJmLu9oy1ql7jC+uy6bRt1o0Idtu5w5+9QN026/8GTAkPPXdeYpE2h9LlBG04VFQCcOMQ9pe5RO3uh0Hraxcz4IKOH/QoeyRE+vziJ85vhCHw9fuoOvZOPWW16tYpy2Ux1n+uB8ylCIcpS84XggDL/ocl7raaLsMgYz0WguM26ziEA69FRHj3sIHyiLNAaM05dUwwDMyL+6pcJosuwjfsJjj1IA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.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 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=N4Sayu4PEU9K07ryNQslCaryOHfbIA30KHQDdC6fFVw=; b=ARdzCqsPP+8WBPNPP5bhoaoqR86SbCCuM3ZMjTlX53ExEVB2d1wRFn2DhkWwMwU6nMkKg6B1AvHDBF10jjLfCDtNwNSknjy9hHlh3K62jpkYpXBez3kuO/pvb4b9aMqcgweCHCjkygBSJuochl0oFLn9H7kCi41QUXAOsfvkMZs= Received: from MW4PR03CA0154.namprd03.prod.outlook.com (2603:10b6:303:8d::9) by DS7PR12MB6022.namprd12.prod.outlook.com (2603:10b6:8:86::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20; Fri, 18 Aug 2023 19:40:50 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:303:8d:cafe::80) by MW4PR03CA0154.outlook.office365.com (2603:10b6:303:8d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.20 via Frontend Transport; Fri, 18 Aug 2023 19:40:50 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.15 via Frontend Transport; Fri, 18 Aug 2023 19:40:50 +0000 Received: from AUS-LX-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.27; Fri, 18 Aug 2023 14:40:47 -0500 From: Mario Limonciello To: Mika Westerberg , "Rafael J . Wysocki" , Bjorn Helgaas CC: , , , Iain Lane , "Andy Shevchenko" , Kuppuswamy Sathyanarayanan , Mario Limonciello Subject: [PATCH v14.c 4/4] PCI: ACPI: Limit the Intel specific opt-in to D3 to 2024 Date: Fri, 18 Aug 2023 14:40:27 -0500 Message-ID: <20230818194027.27559-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230818194027.27559-1-mario.limonciello@amd.com> References: <20230818194027.27559-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|DS7PR12MB6022:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f41c213-d296-4309-cbb4-08dba02306ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hZnqqU9Bwopuqsz2FkS4Xdt3JVy9iDlT/k1a7xkLQqiCXRrHYR1tRxWr8LNlqxS0pSJuwiyEsyKGK5LbvrUzTHMfIVKLDni68+odDJaDqkZfmzipJBVzudgc/uOM2KpFDvLcnpH4VCo5x87+BVrHRjAQHjW9hV0ii9/Zt2F8PK2mC/y1+RKrWIwDEnPt4ifxSXQPAGfQB2CI0BSJGwkCUqvfhs/ZMLSEbicGO/g3Mgub0Bs5CsjoUbR1CeLQVDquQDPAud1RcqFH/XNih4HI06ccOqhJo6Hd9YeDUfeKW4RvlfTddC3oxvtzz8YgcnPG2R/f2zz7xywwmZYFcZCL6z1jrmhmWgB6QsyT1XIz+Mv+Ej8nu26KB8P3oV2q+jM2kGhqtUXCEJq1nfihW6HSk4XR5jPGHKE9RQ6HZMfEJeqPc21RKXdQXiZIjU6wlTWhZq2D/hW/XzhBqrTCc75r+sW50lLVDJ5GK4xtIlmX0Nw3D40I8TklM6VbMWlTPon++1StqdsaP05Dm0XmnJyBK3wCGi9DWsG9Ldbztd1Z8bc/XylZVgE7SqqpBwgOPHbYNDGBZ24bXGj+QOJCBOl2mMF1wyEZEMrP0yFmy9yiLiDnkcjdH5TH1fcls6En+41cLVIF1yzNypHZA5ukVRAzEJ8yA75L9sO08TmpGXBSk2BLp4341H6pe4g1kGu/UOWrcu2unM95qEnwucNR0lumUxF9lKDl0l9jp9E8A6Dj+e67a9kWZshHLyqp7ugFVyzlVC2YbWtaF9YZGusXC1ILmQ== 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:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199024)(186009)(1800799009)(82310400011)(36840700001)(40470700004)(46966006)(110136005)(70206006)(70586007)(5660300002)(44832011)(2616005)(41300700001)(2906002)(316002)(54906003)(8936002)(8676002)(4326008)(478600001)(40460700003)(6666004)(7696005)(86362001)(82740400003)(356005)(81166007)(47076005)(36756003)(16526019)(426003)(336012)(36860700001)(83380400001)(1076003)(26005)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2023 19:40:50.2041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f41c213-d296-4309-cbb4-08dba02306ed 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6022 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Intel systems that need to have PCIe ports in D3 for low power idle specify this by constraints on the ACPI PNP0D80 device. As this information is queried by acpi_pci_bridge_d3(), limit the DMI BIOS year check to stop at 2024. This will allow future systems to rely on the constraints check and ACPI checks to set up policy like non-Intel systems do. Signed-off-by: Mario Limonciello --- v13->v14: * Use a variable instead v12->v13: * New patch --- drivers/pci/pci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index bfdad2eb36d13..c8787d898c377 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3037,16 +3037,22 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) return false; /* - * Allow Intel PCIe ports from 2015 onward to go into D3 to + * Allow Intel PCIe ports from 2015 to 2024 to go into D3 to * achieve additional energy conservation on some platforms. * + * Intel systems from 2025 onward that need this are expected + * to specify this in an LPS0 device constraint instead. + * * This is only set for Intel PCIe ports as it causes problems * on both AMD Rembrandt and Phoenix platforms where USB keyboards * can not be used to wake the system from suspend. */ - if (bridge->vendor == PCI_VENDOR_ID_INTEL && - dmi_get_bios_year() >= 2015) - return true; + if (bridge->vendor == PCI_VENDOR_ID_INTEL) { + int year = dmi_get_bios_year(); + + if (year >= 2015 && year <= 2024) + return true; + } break; }