From 76525e43252b1d6744103e857d505d62b7ba117f Mon Sep 17 00:00:00 2001 From: Naveen Kumar Parna Date: Tue, 25 Feb 2025 12:18:35 +0530 Subject: [PATCH 1/2] added more debug logs in hotplug_event() & acpiphp_check_bridge() --- drivers/pci/hotplug/acpiphp_glue.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 5b1f271c6..b6a57f101 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -697,6 +697,8 @@ static void trim_stale_devices(struct pci_dev *dev) static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) { struct acpiphp_slot *slot; + struct acpiphp_context *context = bridge->context; // Get the context from the bridge + acpi_handle handle = context->hp.self->handle; // Get the handle from the context /* Bail out if the bridge is going away. */ if (bridge->is_going_away) @@ -710,6 +712,7 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) struct pci_dev *dev, *tmp; if (slot_no_hotplug(slot)) { + acpi_handle_debug(handle, "Slot is not hotplug capable in %s()\n", __func__); ; /* do nothing */ } else if (device_status_valid(get_slot_status(slot))) { /* remove stale devices if any */ @@ -719,8 +722,10 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) trim_stale_devices(dev); /* configure all functions */ + acpi_handle_debug(handle, "Enabling slot in %s()\n", __func__); enable_slot(slot, true); } else { + acpi_handle_debug(handle, "Slot has an invalid device status, disabling in %s()\n", __func__); disable_slot(slot); } } @@ -789,8 +794,10 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) acpi_lock_hp_context(); bridge = context->bridge; - if (bridge) + if (bridge) { get_bridge(bridge); + acpi_handle_debug(handle, "Bridge acquired in %s()\n", __func__); + } acpi_unlock_hp_context(); @@ -800,10 +807,13 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) case ACPI_NOTIFY_BUS_CHECK: /* bus re-enumerate */ acpi_handle_debug(handle, "Bus check in %s()\n", __func__); - if (bridge) + if (bridge) { + acpi_handle_debug(handle, "Checking bridge in %s()\n", __func__); acpiphp_check_bridge(bridge); - else if (!(slot->flags & SLOT_IS_GOING_AWAY)) + } else if (!(slot->flags & SLOT_IS_GOING_AWAY)) { + acpi_handle_debug(handle, "Enabling slot in %s()\n", __func__); enable_slot(slot, false); + } break; @@ -811,14 +821,18 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) /* device check */ acpi_handle_debug(handle, "Device check in %s()\n", __func__); if (bridge) { + acpi_handle_debug(handle, "Checking bridge in %s()\n", __func__); acpiphp_check_bridge(bridge); } else if (!(slot->flags & SLOT_IS_GOING_AWAY)) { + acpi_handle_debug(handle, "Rescanning slot in %s()\n", __func__); /* * Check if anything has changed in the slot and rescan * from the parent if that's the case. */ - if (acpiphp_rescan_slot(slot)) + if (acpiphp_rescan_slot(slot)) { + acpi_handle_debug(handle, "Checking parent bridge in %s()\n", __func__); acpiphp_check_bridge(func->parent); + } } break; @@ -830,8 +844,10 @@ static void hotplug_event(u32 type, struct acpiphp_context *context) } pci_unlock_rescan_remove(); - if (bridge) + if (bridge) { + acpi_handle_debug(handle, "Releasing bridge in %s()\n", __func__); put_bridge(bridge); + } } static int acpiphp_hotplug_notify(struct acpi_device *adev, u32 type) -- 2.25.1