linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: bhelgaas@google.com, Sean V Kelley <sean.v.kelley@intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Qiuxu Zhuo <qiuxu.zhuo@intel.com>,
	Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Keith Busch <kbusch@kernel.org>,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH] PCI/portdrv: Disallow runtime suspend when waekup is required but PME service isn't supported
Date: Mon, 9 Aug 2021 11:47:31 +0200	[thread overview]
Message-ID: <20210809094731.GA16595@wunner.de> (raw)
In-Reply-To: <20210809042414.107430-1-kai.heng.feng@canonical.com>

[cc += Mika]

On Mon, Aug 09, 2021 at 12:24:12PM +0800, Kai-Heng Feng wrote:
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213873

The last comment on this bugzilla says "BIOS will fix this."
and the status is RESOLVED WILL_NOT_FIX.

Why is the patch still necessary?


> Some platforms cannot detect ethernet hotplug once its upstream port is
> runtime suspended because PME isn't enabled in _OSC.

If PME is not handled natively, why does the NIC runtime suspend?
Shouldn't this be fixed in the NIC driver by keeping the device
runtime active if PME cannot be used?


> Disallow port runtime suspend when any child device requires wakeup, so
> pci_pme_list_scan() can still read the PME status from the devices
> behind the port.

pci_pme_list_scan() is for broken devices which fail to signal PME.
Is this NIC really among them or does PME fail merely because it's not
granted to OSPM?


> --- a/drivers/pci/pcie/portdrv_pci.c
> +++ b/drivers/pci/pcie/portdrv_pci.c
> @@ -59,14 +59,30 @@ static int pcie_port_runtime_suspend(struct device *dev)
>  	return pcie_port_device_runtime_suspend(dev);
>  }
>  
> +static int pcie_port_wakeup_check(struct device *dev, void *data)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +
> +	if (!pdev)
> +		return 0;
> +
> +	return pdev->wakeup_prepared;
> +}
> +
>  static int pcie_port_runtime_idle(struct device *dev)
>  {
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +
> +	if (!pcie_port_find_device(pdev, PCIE_PORT_SERVICE_PME) &&
> +	    device_for_each_child(dev, NULL, pcie_port_wakeup_check))
> +		return -EBUSY;
> +
>  	/*
>  	 * Assume the PCI core has set bridge_d3 whenever it thinks the port
>  	 * should be good to go to D3.  Everything else, including moving
>  	 * the port to D3, is handled by the PCI core.
>  	 */
> -	return to_pci_dev(dev)->bridge_d3 ? 0 : -EBUSY;
> +	return pdev->bridge_d3 ? 0 : -EBUSY;

If an additional check is necessary for this issue, it should be
integrated into pci_dev_check_d3cold() instead of pcie_port_runtime_idle().

Thanks,

Lukas

  reply	other threads:[~2021-08-09  9:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  7:57 [PATCH 1/1] PCI: Coalesce host bridge contiguous apertures without sorting Kai-Heng Feng
2021-07-13  8:45 ` Guenter Roeck
2021-07-13  8:49   ` Kai-Heng Feng
2021-07-13  9:06     ` Guenter Roeck
2021-07-13 12:50 ` [PATCH v2] PCI: Reinstate "PCI: Coalesce host bridge contiguous apertures" Kai-Heng Feng
2021-09-29 21:25   ` Bjorn Helgaas
2021-11-17 14:12   ` Johannes Berg
2022-07-13  9:36     ` Geert Uytterhoeven
2021-08-09  4:24 ` [PATCH] PCI/portdrv: Disallow runtime suspend when waekup is required but PME service isn't supported Kai-Heng Feng
2021-08-09  9:47   ` Lukas Wunner [this message]
2021-08-09 10:40     ` Kai-Heng Feng
2021-08-09 15:00       ` Lukas Wunner
2021-08-10 15:37         ` Kai-Heng Feng
2021-08-10 16:21           ` Lukas Wunner
2021-08-11  5:06             ` Kai-Heng Feng
2021-08-11  7:11               ` Lukas Wunner
2021-08-12  5:20                 ` Kai-Heng Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210809094731.GA16595@wunner.de \
    --to=lukas@wunner.de \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sean.v.kelley@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).