linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	Lukas Wunner <lukas@wunner.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH v1 2/2] ACPI: PCI: hotplug: Avoid setting is_hotplug_bridge for PCIe Upstream Ports
Date: Mon, 21 Nov 2022 13:48:00 -0500	[thread overview]
Message-ID: <Y3vH4GzKYoXqC2Af@intel.com> (raw)
In-Reply-To: <2262230.ElGaqSPkdT@kreacher>

On Mon, Nov 21, 2022 at 07:16:57PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> It is reported that on some systems pciehp binds to an Upstream Port and
> attempts to operate it which causes devices below the Port to disappear
> from the bus.
> 
> This happens because acpiphp sets is_hotplug_bridge for that Port (after
> receiving a Device Check notification on it from the platform firmware
> via ACPI) during the enumeration of PCI devices and so when
> get_port_device_capability() runs, it sees that is_hotplug_bridge is
> set and adds PCIE_PORT_SERVICE_HP to Port services (which allows pciehp
> to bind to the Port in question).
> 
> Even though this particular problem can be addressed by making the
> portdrv_core checks more robust, it also causes power management to
> work differently on the affected systems which generally is not
> desirable (PCIe Ports with is_hotplug_bridge set have to pass
> additional tests to be allowed to go into the D3hot/cold power
> states which affects runtime PM of devices below these Ports).
> 
> For this reason, amend check_hotplug_bridge() with a PCIe type check
> to prevent it from setting is_hotplug_bridge for Upstream Ports.
> 
> Reported-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

for the series:

Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Based on all the explanations you gave and docs you showed to me
recently this makes total sense and the double protection seems
good to me.

Let's see if Lukas agree, but feel free to also use if needed:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> Suggested-by: Lukas Wunner <lukas@wunner.de>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/pci/hotplug/acpiphp_glue.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c
> +++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c
> @@ -411,6 +411,14 @@ static void check_hotplug_bridge(struct
>  	if (dev->is_hotplug_bridge)
>  		return;
>  
> +	/*
> +	 * In the PCIe case, only Root Ports and Downstream Ports are capable of
> +	 * accommodating hotplug devices, so avoid marking Upstream Ports as
> +	 * "hotplug bridges".
> +	 */
> +	if (pci_is_pcie(dev) && pci_pcie_type(dev) == PCI_EXP_TYPE_UPSTREAM)
> +		return;
> +
>  	list_for_each_entry(func, &slot->funcs, sibling) {
>  		if (PCI_FUNC(dev->devfn) == func->function) {
>  			dev->is_hotplug_bridge = 1;
> 
> 
> 

  reply	other threads:[~2022-11-21 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 18:13 [PATCH v1 0/2] PCI: hotplug: Add checks to avoid doing hotplug on PCIe Upstream Ports Rafael J. Wysocki
2022-11-21 18:15 ` [PATCH v1 1/2] PCI/portdrv: Set PCIE_PORT_SERVICE_HP for Root and Downstream Ports only Rafael J. Wysocki
2022-11-21 18:16 ` [PATCH v1 2/2] ACPI: PCI: hotplug: Avoid setting is_hotplug_bridge for PCIe Upstream Ports Rafael J. Wysocki
2022-11-21 18:48   ` Rodrigo Vivi [this message]
2022-11-22  8:04 ` [PATCH v1 0/2] PCI: hotplug: Add checks to avoid doing hotplug on " Lukas Wunner
2022-11-22 18:06 ` Bjorn Helgaas
2022-11-22 18:34   ` Lukas Wunner

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=Y3vH4GzKYoXqC2Af@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=helgaas@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /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).