Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4738689rwb; Mon, 21 Nov 2022 11:12:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf7lvb0V9dHbuiJGM9IEpbw7YrCzYFwSDx9W/npM9Yg8rn663MUGX4255PHd+mGI6HTeptwO X-Received: by 2002:a17:903:300c:b0:186:aed3:3ab7 with SMTP id o12-20020a170903300c00b00186aed33ab7mr597767pla.88.1669057953837; Mon, 21 Nov 2022 11:12:33 -0800 (PST) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a17090341c900b0018690a76b7dsi12489413ple.359.2022.11.21.11.12.22; Mon, 21 Nov 2022 11:12:33 -0800 (PST) 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=@intel.com header.s=Intel header.b=JoAuTu64; arc=fail (signature failed); 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiKUSsS (ORCPT + 91 others); Mon, 21 Nov 2022 13:48:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbiKUSsJ (ORCPT ); Mon, 21 Nov 2022 13:48:09 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965071CFF9; Mon, 21 Nov 2022 10:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669056487; x=1700592487; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=K8XxAOxk3BUTzoa+sDXswNdyNzWvVBonE/+Jdb3xOgs=; b=JoAuTu64GVn0qol+Or5OsZ1bfbSQF+hzb2LHzsjES0q0NCk/Q+ChFRpe x90er8g8OyLHfq/zWBk0CXvXcRgbMNrTooRIl9PBWzCKm0Z8+zQLCzO7c wiKE6NDaQdjKmG5gosK+OC/7XGaem+MyPnW0ISUUXdGBDYcIzREUH7D60 4+FaqU0KZ4fzxCH7IqVjfrJ+stop6+um7iGVnE0DZfioSTQwUR3qZ0/ZT GeZsdvJnglvPFmyea2BnOyn4dYOgF195sD/ix48jn5RkKPKuT4kkLko7P qcbqXFbhxxeqB+UG6xXtW2h0no8zO8BF9N5pkkCd+310vJ5lE/9/J/EaB Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="294025525" X-IronPort-AV: E=Sophos;i="5.96,182,1665471600"; d="scan'208";a="294025525" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2022 10:48:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="641123799" X-IronPort-AV: E=Sophos;i="5.96,182,1665471600"; d="scan'208";a="641123799" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga002.jf.intel.com with ESMTP; 21 Nov 2022 10:48:07 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 21 Nov 2022 10:48:06 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Mon, 21 Nov 2022 10:48:06 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 21 Nov 2022 10:48:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gNTji4UrrWG0dZV9tPmiKQssLtG2nspUO0fd1iRvTrp45h4ODIsPnS6bM9UPc9XyUtaR2VsYodEwpDi+1XLBHsFfQE0gutBmloFcb57LY8WugLSeI9/6AYW1v1YVUBNclfzUIccVmJ9msxE4M9aM8TPls3cKoqplO/ThbQhMkkiiBHa6ArdPe96ebsc1OYXMGiTMoGx99lTY4JMrvYTLFoWwY2IGQW9W8Hz9I7KFeqAiF+47Ee+L8fdtnkv8AP62EaGWAg4/85OjAcRx6tkfOv2dPiBjzdcrcjBA8VYguG3DZRXINr3WdAS3oceU0RsNdgePCsL6efTaWIqGHuZZOQ== 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=ROy2U+/WBZOaMEt/a9U9US1gIMcPa5ZGaHdrd9giCPo=; b=BGzuyQhswcRI/1Cw8VqRtVWLkdU/nujnxx6wpjXJRmKBxzPX5CFvgLAM+8lYgmuHuZjrIgK/zoVwVTAHZEzAwEPrX6KXKPLzS3uy0tPZiQCfeTGjWYVN28U8puL1Nvw8YMQnx0ivt5UCl12s06n919EbDFMth1thkubFWEBFizhFfLtsCP7ssg0vs/8svF3Vpn1rrm1iRxvF0prHA3MljHJDx4xYjXJoWtreWDJeag5XjSGYcU0wfvBigpbu5PaMTGp/d0Y3yFQs+zpYXH7r4NkyDUyk4eNA5vkuzPmHTAlKjurFzSm/GUU6/fZWcz1dvztSFA5EAgZfeoUYX49T0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA0PR11MB4541.namprd11.prod.outlook.com (2603:10b6:806:94::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Mon, 21 Nov 2022 18:48:05 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::f4b9:901c:6882:c286]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::f4b9:901c:6882:c286%4]) with mapi id 15.20.5834.009; Mon, 21 Nov 2022 18:48:05 +0000 Date: Mon, 21 Nov 2022 13:48:00 -0500 From: Rodrigo Vivi To: "Rafael J. Wysocki" CC: Bjorn Helgaas , Lukas Wunner , LKML , Linux ACPI , Linux PCI , Linux PM , Mika Westerberg Subject: Re: [PATCH v1 2/2] ACPI: PCI: hotplug: Avoid setting is_hotplug_bridge for PCIe Upstream Ports Message-ID: References: <5623410.DvuYhMxLoT@kreacher> <2262230.ElGaqSPkdT@kreacher> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <2262230.ElGaqSPkdT@kreacher> X-ClientProxiedBy: SJ0P220CA0009.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::25) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA0PR11MB4541:EE_ X-MS-Office365-Filtering-Correlation-Id: 100eb6f0-9247-40a7-4f20-08dacbf0ec97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O+JD63a/FVYtf838W56j7Fn51oVx3aj46vXkXAuh/bdKgC7pYt89tIw3q4j9uOz9e/VE/b7VQo3qGYASollW0x6ZkLhQRD8hOOMYUVWztHIkQzC6ETTVJKS1yfDfhpsdQpk69STeWj9EQ5+TFQ5rXJI0mnuqH+IiZqhVUp2/dh4Tn56rPkrW+XyjLkd53I8GnIZGBSDi7YdK9uTrFUJllcO3VBGUhUtDfCsfH0fyrRjTvvJHG8smCejCsnj67x+E6A/RtVXEUFFKEeip82S6hl2jE/5N2uWZO7oAxXlM4ubovqhZ7uKpo+/BxmzMvuBb0dgZKDDvGXvzMPXU7tN3yRdOGvjn64+yI9nOKHNpc9fYH/UiMkUO7C2Io8Rz3hmxeXGLLnQau+g+BynoOkX6YKrVflgsLJeZ7mJWUbFKSuPW79ouN0ThIoGq9a/kUGsK8QEVhl3rUCMYZuwXqBMlvnpI5LsRuFvyW/lOfiPWi750JAxzxUUtnPW2HihtqCapmtH2F0cPiUmXYMpmshrAsYtZAJ8T8K+xo8SpouizL+9HFlMB+OCNtsioCrsF7AJJexjfb+uu4cSLCIvmd+biWp2vSKCgnRpby+4lT4eFGfcrIw2hBAic41a2+RhKfq0qB8G1ri3Ae2ZtY5LX8OzT6M3V5qb7j1li6W58nUrkhDY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6059.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(39860400002)(136003)(366004)(396003)(376002)(451199015)(2906002)(84970400001)(2616005)(66946007)(66556008)(41300700001)(36756003)(86362001)(4326008)(6916009)(38100700002)(54906003)(82960400001)(83380400001)(6506007)(186003)(8936002)(5660300002)(8676002)(66476007)(26005)(6512007)(44832011)(316002)(478600001)(6666004)(6486002);DIR:OUT;SFP:1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Jy0kjY3VP+IMvATfftwacVgWoIeY?= =?us-ascii?Q?RI7G/Z92gRsmVw+wGqc0eoKaBYg+KP6sJd4+vcDWPm04kFhmJD9TGTPNIQxe?= =?us-ascii?Q?8lK+xaYFVVeXe4fwAcQxqllL0xd5PAaIDDUDfenIAPTxfjNJZIFPuXEjnR4x?= =?us-ascii?Q?S+paqQWBCnMGDEX3T8CoMo8GTLZjK3At2Dq69O8arB5ZbfUp76n0jpEnIloC?= =?us-ascii?Q?7WazW3V6jq6qtWC4dnrdgZ65X06nocqg4gn9J5Lz4f2xUlJDey6fGCo0bWg7?= =?us-ascii?Q?yTN0cV9B3jLRKexKzxG2P/66+rSglLSUzu02U/oNOodatnAZMONBnj36rDp/?= =?us-ascii?Q?vCq4CmM79cl+HMyan2zuEIT5+GTQv1rimuzR4JfJ16LouCbDFloNNGdeG/bB?= =?us-ascii?Q?D9ktmsIY7KxAl+JAVfeVouQUHZsn30Xyq5Y7tMF2bCcZ7waga3McqjJbIxdr?= =?us-ascii?Q?8Lky9UOMv+djZ7obNgGt9tYcm001lrEPLGrPXw049opWw77SNKG+C1St8aB3?= =?us-ascii?Q?mqSEb5ncb4HJ68ufiakQGAJ7JBJg+rUaifpFzYZ2vCYPJ9uD1zF3rMCvAnNn?= =?us-ascii?Q?H8R0Aylc1vdNh4M690DjdMbSZ3fIGgJJBQY9IoE97A9tv0YWUT/AgnmNXn9e?= =?us-ascii?Q?bC4vXPqBkqTNyi6VTrF+EZXN21yDBe0tVtdlSTTRoTkroVMrkI88Yx/MNmRE?= =?us-ascii?Q?1LJ400I99ITAxegm5pJgIAMMV/pFJZ8zsWzsx48ZyQ9Nt4gylADc66JPQAaZ?= =?us-ascii?Q?SOY5q17AdXlfWe2kUqGYybPQ5hoO7oiqWPDqNNHU?= X-MS-Exchange-CrossTenant-Network-Message-Id: 100eb6f0-9247-40a7-4f20-08dacbf0ec97 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 18:48:05.0462 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KZocZK1x9/yY5MLSsDwPuw/cQpeWxGD0AJ8mYmfKp1WUFzIGNvyRiJNblA/90IIE+KRpsnkuSkxNLoq5z9pXWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4541 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 On Mon, Nov 21, 2022 at 07:16:57PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > It is reported that on some systems pciehp binds to an Upstream Port and > attempts to operate it which causes devices below the Port to disappear > from the bus. > > This happens because acpiphp sets is_hotplug_bridge for that Port (after > receiving a Device Check notification on it from the platform firmware > via ACPI) during the enumeration of PCI devices and so when > get_port_device_capability() runs, it sees that is_hotplug_bridge is > set and adds PCIE_PORT_SERVICE_HP to Port services (which allows pciehp > to bind to the Port in question). > > Even though this particular problem can be addressed by making the > portdrv_core checks more robust, it also causes power management to > work differently on the affected systems which generally is not > desirable (PCIe Ports with is_hotplug_bridge set have to pass > additional tests to be allowed to go into the D3hot/cold power > states which affects runtime PM of devices below these Ports). > > For this reason, amend check_hotplug_bridge() with a PCIe type check > to prevent it from setting is_hotplug_bridge for Upstream Ports. > > Reported-by: Rodrigo Vivi for the series: Tested-by: Rodrigo Vivi Based on all the explanations you gave and docs you showed to me recently this makes total sense and the double protection seems good to me. Let's see if Lukas agree, but feel free to also use if needed: Reviewed-by: Rodrigo Vivi > Suggested-by: Lukas Wunner > Signed-off-by: Rafael J. Wysocki > --- > drivers/pci/hotplug/acpiphp_glue.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c > =================================================================== > --- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c > +++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c > @@ -411,6 +411,14 @@ static void check_hotplug_bridge(struct > if (dev->is_hotplug_bridge) > return; > > + /* > + * In the PCIe case, only Root Ports and Downstream Ports are capable of > + * accommodating hotplug devices, so avoid marking Upstream Ports as > + * "hotplug bridges". > + */ > + if (pci_is_pcie(dev) && pci_pcie_type(dev) == PCI_EXP_TYPE_UPSTREAM) > + return; > + > list_for_each_entry(func, &slot->funcs, sibling) { > if (PCI_FUNC(dev->devfn) == func->function) { > dev->is_hotplug_bridge = 1; > > >