git: b23314ecb99c - main - pcib: Use taskqueue_bus for hot-plug events instead of a private taskqueue
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Mar 2025 17:35:40 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=b23314ecb99cedef1090bdaa486fbd25aa5a9558
commit b23314ecb99cedef1090bdaa486fbd25aa5a9558
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-03-10 17:32:38 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-03-10 17:32:38 +0000
pcib: Use taskqueue_bus for hot-plug events instead of a private taskqueue
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D49269
---
sys/dev/pci/pci_pci.c | 34 ++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 44cbf327868c..10133c0c68d9 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -800,8 +800,6 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN,
&pci_enable_pcie_hp, 0,
"Enable support for native PCI-express HotPlug.");
-TASKQUEUE_DEFINE_THREAD(pci_hp);
-
static void
pcib_probe_hotplug(struct pcib_softc *sc)
{
@@ -888,7 +886,7 @@ pcib_pcie_hotplug_command(struct pcib_softc *sc, uint16_t val, uint16_t mask)
(ctl & new) & PCIEM_SLOT_CTL_CCIE) {
sc->flags |= PCIB_HOTPLUG_CMD_PENDING;
if (!cold)
- taskqueue_enqueue_timeout(taskqueue_pci_hp,
+ taskqueue_enqueue_timeout(taskqueue_bus,
&sc->pcie_cc_task, hz);
}
}
@@ -904,7 +902,7 @@ pcib_pcie_hotplug_command_completed(struct pcib_softc *sc)
device_printf(dev, "Command Completed\n");
if (!(sc->flags & PCIB_HOTPLUG_CMD_PENDING))
return;
- taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_cc_task, NULL);
+ taskqueue_cancel_timeout(taskqueue_bus, &sc->pcie_cc_task, NULL);
sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING;
wakeup(sc);
}
@@ -1023,10 +1021,10 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
device_printf(sc->dev,
"Data Link Layer inactive\n");
else
- taskqueue_enqueue_timeout(taskqueue_pci_hp,
+ taskqueue_enqueue_timeout(taskqueue_bus,
&sc->pcie_dll_task, hz);
} else if (sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)
- taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_dll_task,
+ taskqueue_cancel_timeout(taskqueue_bus, &sc->pcie_dll_task,
NULL);
pcib_pcie_hotplug_command(sc, val, mask);
@@ -1038,7 +1036,7 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
*/
if (schedule_task &&
(pcib_hotplug_present(sc) != 0) != (sc->child != NULL))
- taskqueue_enqueue(taskqueue_pci_hp, &sc->pcie_hp_task);
+ taskqueue_enqueue(taskqueue_bus, &sc->pcie_hp_task);
}
static void
@@ -1066,14 +1064,14 @@ pcib_pcie_intr_hotplug(void *arg)
device_printf(dev,
"Attention Button Pressed: Detach Cancelled\n");
sc->flags &= ~PCIB_DETACH_PENDING;
- taskqueue_cancel_timeout(taskqueue_pci_hp,
+ taskqueue_cancel_timeout(taskqueue_bus,
&sc->pcie_ab_task, NULL);
} else if (old_slot_sta & PCIEM_SLOT_STA_PDS) {
/* Only initiate detach sequence if device present. */
device_printf(dev,
"Attention Button Pressed: Detaching in 5 seconds\n");
sc->flags |= PCIB_DETACH_PENDING;
- taskqueue_enqueue_timeout(taskqueue_pci_hp,
+ taskqueue_enqueue_timeout(taskqueue_bus,
&sc->pcie_ab_task, 5 * hz);
}
}
@@ -1271,11 +1269,11 @@ pcib_setup_hotplug(struct pcib_softc *sc)
dev = sc->dev;
TASK_INIT(&sc->pcie_hp_task, 0, pcib_pcie_hotplug_task, sc);
- TIMEOUT_TASK_INIT(taskqueue_pci_hp, &sc->pcie_ab_task, 0,
+ TIMEOUT_TASK_INIT(taskqueue_bus, &sc->pcie_ab_task, 0,
pcib_pcie_ab_timeout, sc);
- TIMEOUT_TASK_INIT(taskqueue_pci_hp, &sc->pcie_cc_task, 0,
+ TIMEOUT_TASK_INIT(taskqueue_bus, &sc->pcie_cc_task, 0,
pcib_pcie_cc_timeout, sc);
- TIMEOUT_TASK_INIT(taskqueue_pci_hp, &sc->pcie_dll_task, 0,
+ TIMEOUT_TASK_INIT(taskqueue_bus, &sc->pcie_dll_task, 0,
pcib_pcie_dll_timeout, sc);
sc->pcie_hp_lock = bus_topo_mtx();
@@ -1321,13 +1319,13 @@ pcib_detach_hotplug(struct pcib_softc *sc)
/* Disable the card in the slot and force it to detach. */
if (sc->flags & PCIB_DETACH_PENDING) {
sc->flags &= ~PCIB_DETACH_PENDING;
- taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_ab_task,
+ taskqueue_cancel_timeout(taskqueue_bus, &sc->pcie_ab_task,
NULL);
}
sc->flags |= PCIB_DETACHING;
if (sc->flags & PCIB_HOTPLUG_CMD_PENDING) {
- taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_cc_task,
+ taskqueue_cancel_timeout(taskqueue_bus, &sc->pcie_cc_task,
NULL);
tsleep(sc, 0, "hpcmd", hz);
sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING;
@@ -1350,10 +1348,10 @@ pcib_detach_hotplug(struct pcib_softc *sc)
error = pcib_release_pcie_irq(sc);
if (error)
return (error);
- taskqueue_drain(taskqueue_pci_hp, &sc->pcie_hp_task);
- taskqueue_drain_timeout(taskqueue_pci_hp, &sc->pcie_ab_task);
- taskqueue_drain_timeout(taskqueue_pci_hp, &sc->pcie_cc_task);
- taskqueue_drain_timeout(taskqueue_pci_hp, &sc->pcie_dll_task);
+ taskqueue_drain(taskqueue_bus, &sc->pcie_hp_task);
+ taskqueue_drain_timeout(taskqueue_bus, &sc->pcie_ab_task);
+ taskqueue_drain_timeout(taskqueue_bus, &sc->pcie_cc_task);
+ taskqueue_drain_timeout(taskqueue_bus, &sc->pcie_dll_task);
return (0);
}
#endif