From patchwork Tue Jun 25 10:29:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 11015241 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 0000A1575 for ; Tue, 25 Jun 2019 10:30:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E842F28BC6 for ; Tue, 25 Jun 2019 10:30:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC6D928BE1; Tue, 25 Jun 2019 10:30:10 +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 7AD8C28BDA for ; Tue, 25 Jun 2019 10:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727735AbfFYKaJ (ORCPT ); Tue, 25 Jun 2019 06:30:09 -0400 Received: from mga11.intel.com ([192.55.52.93]:39954 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731972AbfFYK3q (ORCPT ); Tue, 25 Jun 2019 06:29:46 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 03:29:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,415,1557212400"; d="scan'208";a="169741352" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 25 Jun 2019 03:29:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 2ED35162; Tue, 25 Jun 2019 13:29:42 +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 v3 0/3] PCI / ACPI: Handle sibling devices sharing power resources Date: Tue, 25 Jun 2019 13:29:39 +0300 Message-Id: <20190625102942.27740-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, This is third iteration of the patch series addressing issues around sibling PCI devices sharing ACPI power resources. As a concrete example in Intel Ice Lake the Thunderbolt controller, PCIe root ports and xHCI all share the same ACPI 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 . Previous version of the series can be found here: v2: https://lore.kernel.org/linux-pci/20190618161858.77834-1-mika.westerberg@linux.intel.com/T/#m7a41d0b745400054543324ce84125040dbfed912 v1: https://www.spinics.net/lists/linux-pci/msg83583.html Changes from v2: * Updated changelog of patch [1/3] according to comments I got. I left the D3C power resource and xHCI there because it shows that we can have multiple shared power resources. * Added link to the discussion around v2. * Use adev->flags.power_manageable in patch [2/3]. 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 | 135 ++++++++++++++++++++++++++++++++++++++++ drivers/pci/pci-acpi.c | 5 +- include/acpi/acpi_bus.h | 4 ++ 3 files changed, 143 insertions(+), 1 deletion(-)