Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4219717pxt; Wed, 11 Aug 2021 00:16:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo0lInvtjMWj6R/TheBJNqphycsZIUENB6cqxy2jEjHtDpxOvDEimjHc11UWeLyqUc+hHz X-Received: by 2002:a17:906:3693:: with SMTP id a19mr2348832ejc.237.1628666190744; Wed, 11 Aug 2021 00:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628666190; cv=none; d=google.com; s=arc-20160816; b=MMAPhnZuLdD4XHNc8igHS5oh8P3W8eGfkJ23NQaP8Fq1uYJhU3vEBS9XqB7l/Aroe4 2WtymEx2RsyrIf/0F+xMV3ImFpr/5h35Q5OoOiWlukvkshv63mUY0erewM8oz+GOk1bW 0WwQBOWo98+DAdqzb5QuR8+13Rzb7cj9jh08wXDcGqD0beWlmxzEdsiRT38/6ttx68JY vfwYtwDmP49lMcCAFWz3lTT+kgMZblNvt3GqbsXjF7bmiX8WJDQ4OCuXYQzkGyx1sL5I zDBahjj3eDH2VlfUwwI5gWxAsF2bAZw5wn1tzK8lgwNDnEWeJjBIiyKp5+55RhnOY3zu z9lA== 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=dPBhe08uF2G3A8AtAKKQrOztjqUAmg1hNmCH+eW9j+4=; b=PcGkCrNUlMswr84ytkhOGFye/Top9Le6BX8zQ2zC6h7XXYPyngUgvD//DdAi5XPFhq abgLFM2IFmIMUtJi7+I0s1Sj3xTOY96M0ZXpcsVC503f+hN8CrMsMXkjxM36qXx7aK1v kC1lZh5oJMC/Xzb/xArxrXCiyk/yEk3yK5sLNxRsDOTs70upKCxegHonSGsr1VSdmI4o Np6P+4iwxTCkzfBsJ4Sn+bPgB3ntW+YORQ9nxRC3u17/gN+90QYsJ9viBSEQnVxww8gS x2CvlUl08RydPuh/YG15dpVbKIsFtmj9ozEIWz4P0Q7EAXzJ8X+JjxmBU9+ZF2rLopDF I/rw== 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 v10si7666148edr.564.2021.08.11.00.16.08; Wed, 11 Aug 2021 00:16:30 -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 S235109AbhHKHM1 (ORCPT + 99 others); Wed, 11 Aug 2021 03:12:27 -0400 Received: from bmailout2.hostsharing.net ([83.223.78.240]:37307 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235458AbhHKHMY (ORCPT ); Wed, 11 Aug 2021 03:12:24 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (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 bmailout2.hostsharing.net (Postfix) with ESMTPS id 98E9F28015488; Wed, 11 Aug 2021 09:11:58 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 8BFB835897; Wed, 11 Aug 2021 09:11:58 +0200 (CEST) Date: Wed, 11 Aug 2021 09:11:58 +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: <20210811071158.GB6104@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> <20210810162144.GA24713@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 Wed, Aug 11, 2021 at 01:06:27PM +0800, Kai-Heng Feng wrote: > 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: > > 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? Apparently not, according to the "lspci-bridge-after-hotplug" you've attached to the bugzilla, the PME Interrupt Enable bit wasn't set in the Root Control register. The kernel doesn't register an IRQ handler for PME because firmware doesn't grant it control, so it's firmware's job to enable and handle the IRQ (or poll the relevant register or whatever). RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible- ^^^^^^^^^^ > 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. Including the endpoint device, i.e. the NIC? > > 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? Check whether PCI_EXP_RTCTL_PMEIE was set by firmware in the Root Control register. > > An alternative would be a quirk for this specific laptop which clears > > pdev->pme_support. > > This won't scale, because many models are affected. We already have quirks which clear pdev->pme_support, e.g. pci_fixup_no_d0_pme() and pci_fixup_no_msi_no_pme(). Perhaps something like that would be appropriate here. Thanks, Lukas