All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
	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: [PATCH v1 1/2] PCI/portdrv: Set PCIE_PORT_SERVICE_HP for Root and Downstream Ports only
Date: Mon, 21 Nov 2022 19:15:18 +0100	[thread overview]
Message-ID: <4786090.31r3eYUQgx@kreacher> (raw)
In-Reply-To: <5623410.DvuYhMxLoT@kreacher>

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) without consulting the PCIe type which
should be either Root Port or Downstream Port for the hotplug capability
to be present.

Make get_port_device_capability() more robust by adding a PCIe type
check to it before adding PCIE_PORT_SERVICE_HP to Port services which
helps to avoid the problem.

Reported-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/pcie/portdrv_core.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-pm/drivers/pci/pcie/portdrv_core.c
===================================================================
--- linux-pm.orig/drivers/pci/pcie/portdrv_core.c
+++ linux-pm/drivers/pci/pcie/portdrv_core.c
@@ -209,6 +209,8 @@ static int get_port_device_capability(st
 	int services = 0;
 
 	if (dev->is_hotplug_bridge &&
+	    (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
+	     pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) &&
 	    (pcie_ports_native || host->native_pcie_hotplug)) {
 		services |= PCIE_PORT_SERVICE_HP;
 




  reply	other threads:[~2022-11-21 18:18 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 ` Rafael J. Wysocki [this message]
2022-11-21 18:16 ` [PATCH v1 2/2] ACPI: PCI: hotplug: Avoid setting is_hotplug_bridge for " Rafael J. Wysocki
2022-11-21 18:48   ` Rodrigo Vivi
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=4786090.31r3eYUQgx@kreacher \
    --to=rjw@rjwysocki.net \
    --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=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.