Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4154528pxt; Tue, 10 Aug 2021 22:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyirCrLEWC4AfCBiRSmpO8/nucuADj6kT65AMa021D3T4vHemUuQX/rfY6Iehknq4N5hepB X-Received: by 2002:a05:6402:111a:: with SMTP id u26mr9122429edv.260.1628658732288; Tue, 10 Aug 2021 22:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628658732; cv=none; d=google.com; s=arc-20160816; b=qSu9q18/mu3HDHPgQB0w9TeClo5UefTDS9VD8J/0G7Jh3dvvRd+B3h428QjST5RPOL auvpTa0qWSBZtNlXG+JDKHeYPuDPXHXNqFdLb1DC94i+Ccep3NL7kM685dFwOFyxJva1 5KLQfbTvtr2qjG62nXf2nGOPko4wLjXLdzrELOWJDiPZ+H9f5eNedQ4ZYDVM9Up8lmuO T8uHjtuXGyRNLUD+2yBKpnGF483SOGyLhuq+MOO+JwAkacSnF8z06sAIvGett8nfTlS0 O3lKf94QV+1xg4H6mXYXUs1yPQEcuxsEGmITNUhT6Ei52zCsi8hNwd3EIkSi1q0zfSBP ZErw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TotvfBcP1kbMjZh8i1BQ1gZcG+xBW5bAWGmpNSwCNpM=; b=NeejLwLScseRDdHBuJQfUcixZwiVDio6oW+dx8PUnHIeKvH1uFRSiWvn6yAVcjtZsU IDb/HEtpTYFoGas762Jb3VC2az6e4Vq0n5pO+4IzTV1zBhXW3G4UBFYD62N7doQPu6NX gOTRRaSKoP7QY0qUGYGralrJvWmKLNUH3ZJnM8ZJ5ippFm749uXuZj9jevSuRJzsJPU8 eY2wGiAuHtzAfXKAyHeei6/j1lGdVXbwORhTphANqaV0p+6SCNlsqvK9wKrlLng6BMqa SVg/qBvQPSPhtvjofppVA4ISZC+4+sh+e0ohMnWCUL13VbRGNVBCeZ3DUDnvpSFJT0kY rG+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=MaxgNhH5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l33si27092498ede.457.2021.08.10.22.11.45; Tue, 10 Aug 2021 22:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=MaxgNhH5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234155AbhHKFHE (ORCPT + 99 others); Wed, 11 Aug 2021 01:07:04 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:49664 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234105AbhHKFHE (ORCPT ); Wed, 11 Aug 2021 01:07:04 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id BC67C3F36D for ; Wed, 11 Aug 2021 05:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628658399; bh=TotvfBcP1kbMjZh8i1BQ1gZcG+xBW5bAWGmpNSwCNpM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MaxgNhH5g/cUUNLHZHshJ2LxVqSOKLnzT8XA/oZ/Ngqh3z8S+wdTHTjne6m1tUBBv fWQHusnVTW7iWjY5Kufd3Qt1RGwmm44EREuTxyRGQwtxSwy1DlPls8mtUvWYVfJsl5 tNI/PGIOxhmPuXNCPrwXxP5vGQ0fabuk+AD5lRaFwC+BzFFUwC0dfNl9IHWMY9xLF3 Da2XWANv/Z/HCgRLhqd+zpK2ARSAahZrDux251hOt7kUFfnsNqnHA6uvWBxnyv177L TLDwJrYiovUF3XYAtejaD19yCQqJ+nvt9SPOYz/Ar7z7+MuOxy6CZ7mGZt8txXfx7D VnSHnS14mFg+A== Received: by mail-ed1-f70.google.com with SMTP id p2-20020a50c9420000b02903a12bbba1ebso614776edh.6 for ; Tue, 10 Aug 2021 22:06:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TotvfBcP1kbMjZh8i1BQ1gZcG+xBW5bAWGmpNSwCNpM=; b=IYrSCdQVYlrTwAumnaOAPdtIrJkLfNG/F6fQSdvOI6GLG7hHnxgTSqynQu8Lard4Rn nT5iP28hrPDjz5M0SF8ZgHknS+cSbMC5Ey5UeArg2loDxoeXDDgAp+szdC94UBzQWzAO WMTubFF8qIv1Ev+ZZapI7Bb6lEskCojh/NOG1wrol/EejG8VHXsJxDSAu4fMkA07MboF D3Fz7sX2W35wVbIocSYqZeMP4aYgQ6dyi74XCWVT4SB/lfZbrCvAOmFC/pqEioqC1xpp /o6nWDtKD/zDxP1DbecLe4nrejEmITlr8OaJH++ssE6/ExgMVaZeVlb1OIhz/tOFhUAH SQPw== X-Gm-Message-State: AOAM530LxYRvl9Vii/jZXK8jk0Cx8oFk7/chsiO8doeyJAcvbIAjTkA4 iwdUMLqi19rErglNfmn0mWWrAXCUIxXR3/UIdib+NXHw4izRRaxZXZQPGxJI9Bp2OguitrUQgPY IcrGx1tsGvUUpBcemo791U/1db7zgLBDcWY5LAJDdE7Ao0pWLTJRABnr9NQ== X-Received: by 2002:a17:906:1fd5:: with SMTP id e21mr1818193ejt.78.1628658399261; Tue, 10 Aug 2021 22:06:39 -0700 (PDT) X-Received: by 2002:a17:906:1fd5:: with SMTP id e21mr1818176ejt.78.1628658399029; Tue, 10 Aug 2021 22:06:39 -0700 (PDT) MIME-Version: 1.0 References: <20210713075726.1232938-1-kai.heng.feng@canonical.com> <20210809042414.107430-1-kai.heng.feng@canonical.com> <20210809094731.GA16595@wunner.de> <20210809150005.GA6916@wunner.de> <20210810162144.GA24713@wunner.de> In-Reply-To: <20210810162144.GA24713@wunner.de> From: Kai-Heng Feng Date: Wed, 11 Aug 2021 13:06:27 +0800 Message-ID: Subject: Re: [PATCH] PCI/portdrv: Disallow runtime suspend when waekup is required but PME service isn't supported To: Lukas Wunner Cc: Bjorn Helgaas , Sean V Kelley , Jonathan Cameron , Qiuxu Zhuo , Kuppuswamy Sathyanarayanan , Keith Busch , "open list:PCI SUBSYSTEM" , open list , Mika Westerberg , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 11, 2021 at 12:21 AM Lukas Wunner wrote: > > On Tue, Aug 10, 2021 at 11:37:12PM +0800, Kai-Heng Feng wrote: > > On Mon, Aug 9, 2021 at 11:00 PM Lukas Wunner wrote: > > > If PME is not granted to the OS, the only consequence is that the PME > > > port service is not instantiated at the root port. But PME is still > > > enabled for downstream devices. Maybe that's a mistake? I think the > > > ACPI spec is a little unclear what to do if PME control is *not* granted. > > > It only specifies what to do if PME control is *granted*: > > > > So do you prefer to just disable runtime PM for the downstream device? > > I honestly don't know. I was just wondering whether it is okay > to enable PME on devices if control is not granted by the firmware. > The spec is fairly vague. But I guess the idea is that enabling PME > on devices is correct, just handling the interrupts is done by firmware > instead of the OS. Does this imply that current ACPI doesn't handle this part? > > In your case, the endpoint device claims it can signal PME from D3cold, > which is why we allow the root port above to runtime suspend to D3hot. > The lspci output you've attached to the bugzilla indicates that yes, > signaling PME in D3cold does work, but the PME interrupt is neither > handled by the OS (because it's not allowed to) nor by firmware. > > So you would like to rely on PME polling instead, which only works if the > root port remains in D0. Otherwise config space of the endpoint device > is inaccessible. The Windows approach is to make the entire hierarchy stays at D0, I think maybe it's a better way than relying on PME polling. > > I think the proper solution is that firmware should handle the PME > interrupt. You've said the vendor objects because they found PME > doesn't work reliably. The PME works, what vendor said is that enabling PME makes the system "unstable". > Well in that case the endpoint device shouldn't > indicate that it can signal PME, at least not from D3cold. Perhaps > the vendor is able to change the endpoint device's config space so > that it doesn't claim to support PME? This is not an viable option, and we have to consider that BIOS from different vendors can exhibit the same behavior. > > If that doesn't work and thus a kernel patch is necessary, the next > question is whether changing core code is the right approach. I really don't see other way because non-granted PME is a system-wide thing... > > If you do want to change core code, I'd suggest modifying > pci_dev_check_d3cold() so that it blocks runtime PM on upstream > bridges if PME is not handled natively AND firmware failed to enable > the PME interrupt at the root port. The rationale is that upstream > bridges need to remain in D0 so that PME polling is possible. How do I know that firmware failed to enable PME IRQ? And let me see how to make pci_dev_check_d3cold() work for this case. > > An alternative would be a quirk for this specific laptop which clears > pdev->pme_support. This won't scale, because many models are affected. Kai-Heng > > Thanks, > > Lukas