Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3720859pxt; Tue, 10 Aug 2021 09:47:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfdhdZFhtmZdo4jSLoTZob3xURwhoq+XZ9ZzNB4sBSw/KNtWEylTVlH2lyeaFgLnlGALl3 X-Received: by 2002:a05:6402:1591:: with SMTP id c17mr5976130edv.15.1628614045491; Tue, 10 Aug 2021 09:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628614045; cv=none; d=google.com; s=arc-20160816; b=0FsBvHVfk7k5Wqrxu4G4fDorS/ToModuxWiZa/BHgCKSmLqsk0A6a2i63O8+iVBuVR 4Ym7z96IB7CFHoLuCW5r/Hdp5wkJWEFm1PMt9ggd2T0tgoIqlUR62RWwHn1vuP6yDGyz xwzc/X8l8sfuD+v1zWRd6qiKyE6Vv46LsR6pml+0xGipuUVFEL19z4Ptejirf7fOfX34 NcxonGOx63dIjxc4mZzYXwi6eah9jB2hWZ2hRFhQZaf7Je13j8FT4h4i4Ia/4Cn6RfmZ FxZipLm4GoAJ9yP7RGxNell831wq8c2bYLTbyrn4yVyS8ue4GsjEdjxCc6jm+XibhlhH hTig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=1wqWqD8UljklNU0T3qpgCeVyEUUkJdPcyUGKFebyyRQ=; b=OHxuNN/c+7PchiGSBMXDnD2EAsBw2bTy+kSr4h4j8XQJRN+TedKJOiPntxIc2+FyWW IshwC3ue0lQVpv+ZXZFX9ZWgyL58kRy9FGbZwopKLz7ECDhBBoCGl08clLgLPSubKTmR j1VZXvwUpz55ptpwLGy6NQBwnAcp4/HJCwI1NtnkyjhVazTLmmcDgP53UiwbcPnGASvn 3TxRK2QOaZxOjc8TrhPYv7f03RQ9E9oVqcTHIqrdHwugRajndD13cqirTMbX7lIc0W/o TzWZ3PHn5unK1a3I9dTQ4NzzMqS1i3Dx0xtoYO6NUXszCJsixul5i+JSAmnSVNzOnF+f yd3g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si22360170edd.62.2021.08.10.09.47.01; Tue, 10 Aug 2021 09:47:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235708AbhHJQbr (ORCPT + 99 others); Tue, 10 Aug 2021 12:31:47 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:50073 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbhHJQbq (ORCPT ); Tue, 10 Aug 2021 12:31:46 -0400 X-Greylist: delayed 576 seconds by postgrey-1.27 at vger.kernel.org; Tue, 10 Aug 2021 12:31:45 EDT Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 6E5D9300002A0; Tue, 10 Aug 2021 18:21:44 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 57C13260B31; Tue, 10 Aug 2021 18:21:44 +0200 (CEST) Date: Tue, 10 Aug 2021 18:21:44 +0200 From: Lukas Wunner To: Kai-Heng Feng 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" Subject: Re: [PATCH] PCI/portdrv: Disallow runtime suspend when waekup is required but PME service isn't supported Message-ID: <20210810162144.GA24713@wunner.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. 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. 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? If that doesn't work and thus a kernel patch is necessary, the next question is whether changing core code is the right approach. 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. An alternative would be a quirk for this specific laptop which clears pdev->pme_support. Thanks, Lukas