From patchwork Tue Jun 18 16:18:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 11002159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 200AA112C for ; Tue, 18 Jun 2019 16:19:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F58428A62 for ; Tue, 18 Jun 2019 16:19:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0377128AD7; Tue, 18 Jun 2019 16:19:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D40428A62 for ; Tue, 18 Jun 2019 16:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729507AbfFRQTC (ORCPT ); Tue, 18 Jun 2019 12:19:02 -0400 Received: from mga14.intel.com ([192.55.52.115]:20115 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729295AbfFRQTB (ORCPT ); Tue, 18 Jun 2019 12:19:01 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2019 09:19:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,389,1557212400"; d="scan'208";a="160105167" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 18 Jun 2019 09:18:59 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 736AE14B; Tue, 18 Jun 2019 19:18:58 +0300 (EEST) From: Mika Westerberg To: "Rafael J. Wysocki" , Bjorn Helgaas Cc: Len Brown , Lukas Wunner , Keith Busch , Alex Williamson , Alexandru Gagniuc , Mika Westerberg , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 0/3] PCI / ACPI: Handle sibling devices sharing power resources Date: Tue, 18 Jun 2019 19:18:55 +0300 Message-Id: <20190618161858.77834-1-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, Based on a discussion regarding patch series I sent previously [1] to deal with sibling devices sharing ACPI power resources, I prepared a new reworked version according to the comments I got. To summarize, in Intel Ice Lake the Thunderbolt controller, PCIe root ports and xHCI all share power resources. When they are all in D3hot power resources (returned by _PR3) can be turned off powering off the whole block. However, there are two issues around this. Firstly the PCI core sets the device power state by asking what the real ACPI power state is. This results that all but last device sharing the power resources are in D3hot when the power resources are turned off. This causes issues if user runs for example 'lspci' because the device is really in D3cold so what user gets back is all ones (0xffffffff). Secondly if any of the device is runtime resumed the power resources are turned on bringing all other devices sharing the resources to D0uninitialized losing their wakeup configuration. This series aims to fix the two issues by: 1. Using the ACPI cached power state when PCI devices are transitioned into low power states instead of reading back the "real" power state. 2. Introducing concept of "_PR0 dependent devices" that get runtime resumed whenever their power resource (which they might share with other sibling devices) gets turned on. The series is based on the idea of Rafael J. Wysocki . [1] https://www.spinics.net/lists/linux-pci/msg83583.html Mika Westerberg (3): PCI / ACPI: Use cached ACPI device state to get PCI device power state ACPI / PM: Introduce concept of a _PR0 dependent device PCI / ACPI: Add _PR0 dependent devices drivers/acpi/power.c | 139 ++++++++++++++++++++++++++++++++++++++++ drivers/pci/pci-acpi.c | 5 +- include/acpi/acpi_bus.h | 4 ++ 3 files changed, 147 insertions(+), 1 deletion(-)