From patchwork Mon Mar 14 02:19:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 8575141 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BEE289F758 for ; Mon, 14 Mar 2016 02:19:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8DDD20460 for ; Mon, 14 Mar 2016 02:19:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B743D2047B for ; Mon, 14 Mar 2016 02:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753413AbcCNCTY (ORCPT ); Sun, 13 Mar 2016 22:19:24 -0400 Received: from mail-lb0-f196.google.com ([209.85.217.196]:35636 "EHLO mail-lb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753012AbcCNCTW (ORCPT ); Sun, 13 Mar 2016 22:19:22 -0400 Received: by mail-lb0-f196.google.com with SMTP id wn5so4467670lbb.2; Sun, 13 Mar 2016 19:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=E6MflySZCN5Aa61K1nLpbc+gf2Kb0Of7zMp6mELmLWM=; b=XZzea0ku4wo4QQdaKrN6RDcSWjkemsb1JuUu1FcGrxxITNhvrKAarsfWE6GkGDyZKT 0Q3oUOdgnet2VTT4j2hOOQmP1fDTaGJCmD3hSmd8Wcyw1K4Iu+1hez3v2ceBZXNsGoEO /g7qIvwyzQili0X5rcfCm1n3mBkyz2rWRc9f9MFZcQfeA4OC3gMFhExXLR2Jgym0pR7e ygNJl7nrUNYE/OGfji+CJmiV6POWcxE7MQS20KNBcTCMxhdqZnupfwEw1fEgtFEBX9Ct WNgOchuV9lhnVps/QMin8/fPLHSJ1eRHhXAUAcBlDthYCkbhT85U/Nsf59xAD5KO5zpl qvZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=E6MflySZCN5Aa61K1nLpbc+gf2Kb0Of7zMp6mELmLWM=; b=ZyPUhCe1dq4140AC7xjxtY8b4cgxQnvh1Wa6Vc4F9jUFssciOqKmg+UGJF65Pr9twC psfJwTzIbTwHZfdnhByK1yYX1uJmhmj21aEBXybwekYYw5qSOp/hGo/nzfOZYxELtYdy mlTX0ZHmlAU+MyXJqBl8oGSHPFLiNOiXAMXKK4sbltTUI3BPcxdLzq5esqdG/l37y2GK uGJDqGQh7Br5/VN6q836SViDnq8GN3j1iGaIxgdt5BWkm5YjBMxAwUdMh5EWFNs1Y6GI v4vZRZlaNUwVvT3KKLh+l21rfUi+1tWv/tz2sqOgNwQzq/x2wSSeOJ63r0YR0VSA42EY 27YA== X-Gm-Message-State: AD7BkJLcOgrOpYvga8LKDhp9KVnlXWGB/mCCYFS+eDOPn7ATNr3GlFqQkQmyASTk3q3kq8JV4bppVB6EEnnNqA== MIME-Version: 1.0 X-Received: by 10.112.12.233 with SMTP id b9mr5629105lbc.63.1457921954911; Sun, 13 Mar 2016 19:19:14 -0700 (PDT) Received: by 10.112.141.138 with HTTP; Sun, 13 Mar 2016 19:19:14 -0700 (PDT) In-Reply-To: <2759763.dR5D0KopkA@vostro.rjw.lan> References: <1457504045-12738-1-git-send-email-airlied@gmail.com> <2736217.utxPzJExd5@vostro.rjw.lan> <20160311105815.GS1796@lahna.fi.intel.com> <2759763.dR5D0KopkA@vostro.rjw.lan> Date: Mon, 14 Mar 2016 12:19:14 +1000 Message-ID: Subject: Re: [PATCH 1/2] vga_switcheroo: add power support for windows 10 machines. From: Dave Airlie To: "Rafael J. Wysocki" Cc: Mika Westerberg , "Rafael J. Wysocki" , dri-devel , "linux-pm@vger.kernel.org" , ACPI Devel Maling List , Linux PCI , Linux Kernel Mailing List Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 11 March 2016 at 23:45, Rafael J. Wysocki wrote: > On Friday, March 11, 2016 12:58:15 PM Mika Westerberg wrote: >> On Thu, Mar 10, 2016 at 09:57:09PM +0100, Rafael J. Wysocki wrote: >> > > It doesn't seem to do any runtime PM, >> > > I do wonder if pcieport should be doing it's own runtime PM handling, >> > > but that is a >> > > larger task than I'm thinking to tackle here. >> > >> > PCIe ports don't do PM - yet. Mika has posted a series of patches to implement >> > that, however, that are waiting for comments now: >> > >> > https://patchwork.kernel.org/patch/8453311/ >> > https://patchwork.kernel.org/patch/8453381/ >> > https://patchwork.kernel.org/patch/8453391/ >> > https://patchwork.kernel.org/patch/8453411/ >> > https://patchwork.kernel.org/patch/8453371/ >> > https://patchwork.kernel.org/patch/8453351/ >> > >> > > Maybe I should be doing >> > > >> > > pci_set_power_state(pdev->bus->self, PCI_D3cold) ? I'm not really sure. >> > >> > Using pci_set_power_state() would be more appropriate IMO, but you can get >> > to the bridge via dev->parent too, can't you? >> > >> > In any case, it looks like you and Mika need to talk. :-) >> >> When the vga_switcheroo device gets runtime suspended (with the above >> runtime PM patchs for PCIe root ports) the root port should also be >> runtime suspended by the PM core. > > Right, after your patches have been applied, the additional handling > won't be needed. > > So Dave, maybe you can check if the Mika's patches help? Hi Mika, I tested your patches with a couple of changes on the Lenovo W541. The attached patch contains the two things I needed to get the same functionality as my patches. I'm really not in love with the per-chipset enablement for this, really any chipsets after a certain year should probably be better, as we'll constantly be adding PCI Ids for every chipset ever made, and I expect we'll forget some. Dave. From eea412076c9d24262ebd4811f766d5379b728045 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 14 Mar 2016 23:37:43 +1000 Subject: [PATCH] [RFC] PCI: enable runtime PM on pcieports to let secondary GPUs powerdown. With secondary GPUs in Windows 10 laptops we need to use runtime PM to power down the PCIe ports after the devices goes to D3Cold. This patch adds the PCI ID for the Haswell 16x PCIE slot found in the W541 laptops. I should probably try and gather the PCI IDs, for broadwell/skylake variants as well if we can't find them. This fixes a regression on W541 laptops on top of Mika's PCIE patches since we started advertising Windows 2013 ACPI. [probably should be two patches - hence RFC] Signed-off-by: Dave Airlie --- drivers/pci/pcie/portdrv_pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 43dd23e..1405de8 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -278,8 +278,10 @@ static int pcie_portdrv_probe(struct pci_dev *dev, pci_save_state(dev); - if (pcie_port_runtime_suspend_allowed(dev)) + if (pcie_port_runtime_suspend_allowed(dev)) { + pm_runtime_allow(&dev->dev); pm_runtime_put_noidle(&dev->dev); + } return 0; } @@ -436,6 +438,8 @@ static void pcie_portdrv_err_resume(struct pci_dev *dev) * LINUX Device Driver Model */ static const struct pci_device_id port_pci_ids[] = { + /* Intel Skylake PCIE graphics port */ + { PCI_VDEVICE(INTEL, 0x0c01), .driver_data = PCIE_PORT_SPT }, /* Intel Broxton */ { PCI_VDEVICE(INTEL, 0x1ad6), .driver_data = PCIE_PORT_SPT }, { PCI_VDEVICE(INTEL, 0x1ad7), .driver_data = PCIE_PORT_SPT }, -- 2.5.0