All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ACPI / hotplug / PCI: Work along with PCIe native hotplug
@ 2014-02-11  0:17 Rafael J. Wysocki
  2014-02-11  0:17 ` [PATCH 1/2] ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context() Rafael J. Wysocki
  2014-02-11  0:18 ` [PATCH 2/2] ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2014-02-11  0:17 UTC (permalink / raw)
  To: Linux PCI
  Cc: ACPI Devel Maling List, Linux Kernel Mailing List, Bjorn Helgaas

Hi All,

Patch [2/2] in this series makes ACPIPHP add its hotplug contexts to devices
that should be handler by PCIeHP (the changelog explains why that should be
safe now).  Patch [1/2] is just a function rename.

Both are on top of the current linux-next branch of linux-pm.git.

Thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context()
  2014-02-11  0:17 [PATCH 0/2] ACPI / hotplug / PCI: Work along with PCIe native hotplug Rafael J. Wysocki
@ 2014-02-11  0:17 ` Rafael J. Wysocki
  2014-02-11  0:18 ` [PATCH 2/2] ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2014-02-11  0:17 UTC (permalink / raw)
  To: Linux PCI
  Cc: ACPI Devel Maling List, Linux Kernel Mailing List, Bjorn Helgaas

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The name of register_slot() doesn't really reflect what the function
is does, so rename it to acpiphp_add_context() and add a proper
kerneldoc comment to it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

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
@@ -255,9 +255,15 @@ static void acpiphp_dock_release(void *d
 	put_bridge(context->func.parent);
 }
 
-/* callback routine to register each ACPI PCI slot object */
-static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data,
-				 void **rv)
+/**
+ * acpiphp_add_context - Add ACPIPHP context to an ACPI device object.
+ * @handle: ACPI handle of the object to add a context to.
+ * @lvl: Not used.
+ * @data: The object's parent ACPIPHP bridge.
+ * @rv: Not used.
+ */
+static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
+				       void **rv)
 {
 	struct acpiphp_bridge *bridge = data;
 	struct acpiphp_context *context;
@@ -919,14 +925,14 @@ void acpiphp_enumerate_slots(struct pci_
 		acpi_unlock_hp_context();
 	}
 
-	/* must be added to the list prior to calling register_slot */
+	/* Must be added to the list prior to calling acpiphp_add_context(). */
 	mutex_lock(&bridge_mutex);
 	list_add(&bridge->list, &bridge_list);
 	mutex_unlock(&bridge_mutex);
 
 	/* register all slot objects under this bridge */
 	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
-				     register_slot, NULL, bridge, NULL);
+				     acpiphp_add_context, NULL, bridge, NULL);
 	if (ACPI_FAILURE(status)) {
 		acpi_handle_err(handle, "failed to register slots\n");
 		cleanup_bridge(bridge);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP
  2014-02-11  0:17 [PATCH 0/2] ACPI / hotplug / PCI: Work along with PCIe native hotplug Rafael J. Wysocki
  2014-02-11  0:17 ` [PATCH 1/2] ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context() Rafael J. Wysocki
@ 2014-02-11  0:18 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2014-02-11  0:18 UTC (permalink / raw)
  To: Linux PCI
  Cc: ACPI Devel Maling List, Linux Kernel Mailing List, Bjorn Helgaas

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Currently, ACPIPHP does not add hotplug context to devices that
should be handled by the native PCI hotplug (PCIeHP) code.  The
reason why was because PCIeHP didn't know about the devices'
connections with ACPI and would not clean up things properly
during an eject of an ACPI-backed device, for example.

However, after recent changes that made the ACPI core create struct
acpi_device objects for all namespace nodes regardless of the
underlying devices' status and added PCI rescan-remove locking to
both ACPIPHP and PCIeHP, that concern is not valid any more.
Namely, after those changes PCIeHP need not care about the ACPI
side of things any more and it should be serialized with respect to
ACPIPHP and they won't be running concurrently with each other in
any case.

For this reason, make ACPIPHP to add its hotplug context to
all devices with ACPI companions, even the ones that should be
handled by PCIeHP in principle.  That may work around hotplug
issues on some systems where PCIeHP is supposed to work, but it
doesn't and the ACPI hotplug signaling works instead.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

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
@@ -277,9 +277,6 @@ static acpi_status acpiphp_add_context(a
 	struct pci_dev *pdev = bridge->pci_dev;
 	u32 val;
 
-	if (pdev && device_is_managed_by_native_pciehp(pdev))
-		return AE_OK;
-
 	status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
 	if (ACPI_FAILURE(status)) {
 		if (status != AE_NOT_FOUND)
@@ -338,8 +335,14 @@ static acpi_status acpiphp_add_context(a
 
 	list_add_tail(&slot->node, &bridge->slots);
 
-	/* Register slots for ejectable functions only. */
-	if (acpi_pci_check_ejectable(pbus, handle)  || is_dock_device(handle)) {
+	/*
+	 * Expose slots to user space for functions that have _EJ0 or _RMV or
+	 * are located in dock stations.  Do not expose them for devices handled
+	 * by the native PCIe hotplug (PCIeHP), becuase that code is supposed to
+	 * expose slots to user space in those cases.
+	 */
+	if ((acpi_pci_check_ejectable(pbus, handle) || is_dock_device(handle))
+	    && !(pdev && device_is_managed_by_native_pciehp(pdev))) {
 		unsigned long long sun;
 		int retval;
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-11  0:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11  0:17 [PATCH 0/2] ACPI / hotplug / PCI: Work along with PCIe native hotplug Rafael J. Wysocki
2014-02-11  0:17 ` [PATCH 1/2] ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context() Rafael J. Wysocki
2014-02-11  0:18 ` [PATCH 2/2] ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP Rafael J. Wysocki

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.