mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
cxl/acpi: Move rescan to the workqueue
[ Upstream commit 4029c32fb6 ]
Now that the cxl_mem driver has a need to take the root device lock, the
cxl_bus_rescan() needs to run outside of the root lock context. That
need arises from RCH topologies and the locking that the cxl_mem driver
does to attach a descendant to an upstream port. In the RCH case the
lock needed is the CXL root device lock [1].
Link: http://lore.kernel.org/r/166993045621.1882361.1730100141527044744.stgit@dwillia2-xfh.jf.intel.com [1]
Tested-by: Robert Richter <rrichter@amd.com>
Link: http://lore.kernel.org/r/166993042884.1882361.5633723613683058881.stgit@dwillia2-xfh.jf.intel.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Stable-dep-of: 3d6ebf16438d ("cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
24aed1b462
commit
f70f795227
@@ -509,7 +509,8 @@ static int cxl_acpi_probe(struct platform_device *pdev)
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* In case PCI is scanned before ACPI re-trigger memdev attach */
|
/* In case PCI is scanned before ACPI re-trigger memdev attach */
|
||||||
return cxl_bus_rescan();
|
cxl_bus_rescan();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct acpi_device_id cxl_acpi_ids[] = {
|
static const struct acpi_device_id cxl_acpi_ids[] = {
|
||||||
@@ -533,7 +534,19 @@ static struct platform_driver cxl_acpi_driver = {
|
|||||||
.id_table = cxl_test_ids,
|
.id_table = cxl_test_ids,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(cxl_acpi_driver);
|
static int __init cxl_acpi_init(void)
|
||||||
|
{
|
||||||
|
return platform_driver_register(&cxl_acpi_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit cxl_acpi_exit(void)
|
||||||
|
{
|
||||||
|
platform_driver_unregister(&cxl_acpi_driver);
|
||||||
|
cxl_bus_drain();
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(cxl_acpi_init);
|
||||||
|
module_exit(cxl_acpi_exit);
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
MODULE_IMPORT_NS(CXL);
|
MODULE_IMPORT_NS(CXL);
|
||||||
MODULE_IMPORT_NS(ACPI);
|
MODULE_IMPORT_NS(ACPI);
|
||||||
|
|||||||
@@ -1786,12 +1786,27 @@ static void cxl_bus_remove(struct device *dev)
|
|||||||
|
|
||||||
static struct workqueue_struct *cxl_bus_wq;
|
static struct workqueue_struct *cxl_bus_wq;
|
||||||
|
|
||||||
int cxl_bus_rescan(void)
|
static void cxl_bus_rescan_queue(struct work_struct *w)
|
||||||
{
|
{
|
||||||
return bus_rescan_devices(&cxl_bus_type);
|
int rc = bus_rescan_devices(&cxl_bus_type);
|
||||||
|
|
||||||
|
pr_debug("CXL bus rescan result: %d\n", rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cxl_bus_rescan(void)
|
||||||
|
{
|
||||||
|
static DECLARE_WORK(rescan_work, cxl_bus_rescan_queue);
|
||||||
|
|
||||||
|
queue_work(cxl_bus_wq, &rescan_work);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_NS_GPL(cxl_bus_rescan, CXL);
|
EXPORT_SYMBOL_NS_GPL(cxl_bus_rescan, CXL);
|
||||||
|
|
||||||
|
void cxl_bus_drain(void)
|
||||||
|
{
|
||||||
|
drain_workqueue(cxl_bus_wq);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_NS_GPL(cxl_bus_drain, CXL);
|
||||||
|
|
||||||
bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd)
|
bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd)
|
||||||
{
|
{
|
||||||
return queue_work(cxl_bus_wq, &cxlmd->detach_work);
|
return queue_work(cxl_bus_wq, &cxlmd->detach_work);
|
||||||
|
|||||||
@@ -564,7 +564,8 @@ struct cxl_port *devm_cxl_add_port(struct device *host, struct device *uport,
|
|||||||
struct cxl_dport *parent_dport);
|
struct cxl_dport *parent_dport);
|
||||||
struct cxl_port *find_cxl_root(struct device *dev);
|
struct cxl_port *find_cxl_root(struct device *dev);
|
||||||
int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
|
int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
|
||||||
int cxl_bus_rescan(void);
|
void cxl_bus_rescan(void);
|
||||||
|
void cxl_bus_drain(void);
|
||||||
struct cxl_port *cxl_mem_find_port(struct cxl_memdev *cxlmd,
|
struct cxl_port *cxl_mem_find_port(struct cxl_memdev *cxlmd,
|
||||||
struct cxl_dport **dport);
|
struct cxl_dport **dport);
|
||||||
bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd);
|
bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user