From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D154C04AB5 for ; Thu, 6 Jun 2019 13:44:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 817BF2067C for ; Thu, 6 Jun 2019 13:44:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728460AbfFFNoY (ORCPT ); Thu, 6 Jun 2019 09:44:24 -0400 Received: from mga17.intel.com ([192.55.52.151]:19713 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727082AbfFFNoY (ORCPT ); Thu, 6 Jun 2019 09:44:24 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2019 06:44:23 -0700 X-ExtLoop1: 1 Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 06 Jun 2019 06:44:20 -0700 Received: by lahna (sSMTP sendmail emulation); Thu, 06 Jun 2019 16:44:19 +0300 Date: Thu, 6 Jun 2019 16:44:19 +0300 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Lukas Wunner , Keith Busch , Alex Williamson , Alexandru Gagniuc , ACPI Devel Maling List , Linux PCI Subject: Re: [PATCH 3/3] PCI / ACPI: Handle sibling devices sharing power resources Message-ID: <20190606134419.GL2781@lahna.fi.intel.com> References: <20190605145820.37169-1-mika.westerberg@linux.intel.com> <20190605145820.37169-4-mika.westerberg@linux.intel.com> <20190606112640.GA2781@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190606112640.GA2781@lahna.fi.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, Jun 06, 2019 at 02:26:40PM +0300, Mika Westerberg wrote: > On Thu, Jun 06, 2019 at 10:54:40AM +0200, Rafael J. Wysocki wrote: > > On Wed, Jun 5, 2019 at 4:58 PM Mika Westerberg > > wrote: > > > > > > Intel Ice Lake has an interated Thunderbolt controller which means that > > > > integrated > > Right :) > > > > the PCIe topology is extended directly from the two root ports (RP0 and > > > RP1). Power management is handled by ACPI power resources that are > > > shared between the root ports, Thunderbolt controller (NHI) and xHCI > > > controller. > > > > > > The topology with the power resources (marked with []) looks like: > > > > > > Host bridge > > > | > > > +- RP0 ---\ > > > +- RP1 ---|--+--> [TBT] > > > +- NHI --/ | > > > | | > > > | v > > > +- xHCI --> [D3C] > > > > > > Here TBT and D3C are the shared ACPI power resources. ACPI _PR3() method > > > returns either TBT or D3C or both. > > > > > > Say we runtime suspend first the root ports RP0 and RP1, then NHI. Now > > > since the TBT power resource is still on when the root ports are runtime > > > suspended their dev->current_state is set to D3hot. When NHI is runtime > > > suspended TBT is finally turned off but state of the root ports remain > > > to be D3hot. > > > > It looks like this problem will affect all ACPI devices using power > > resources and _PR3 in general, so fixing it just for PCI is not > > sufficient IMO. > > Fair enough. > > > An alternative approach may be to set the state of a device that > > dropped its references to power resources listed in _PR3 to D3cold > > even though those power resources may be physically "on" at that time. > > Everything else (including this patch AFAICS) will be racy this way or > > another. > > OK, thanks for the comment. I'll try to look into this approach then. One additional question. How about the other direction when shared power resource(s) gets turned on? We would need to wake up all the sharing devices so that their state gets restored back from D0uninitialized.