mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
tools/testing/cxl: Add a physical_node link
Emulate what ACPI does to link a host bridge platform firmware device to device node on the PCI bus. In this case it's just self referencing link, but it otherwise lets the tooling test out its lookup code. Link: https://lore.kernel.org/r/164298433209.3018233.18101085948127163720.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
@@ -641,7 +641,12 @@ static __init int cxl_test_init(void)
|
||||
platform_device_put(pdev);
|
||||
goto err_bridge;
|
||||
}
|
||||
|
||||
cxl_host_bridge[i] = pdev;
|
||||
rc = sysfs_create_link(&pdev->dev.kobj, &pdev->dev.kobj,
|
||||
"physical_node");
|
||||
if (rc)
|
||||
goto err_bridge;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxl_root_port); i++) {
|
||||
@@ -745,8 +750,14 @@ err_port:
|
||||
for (i = ARRAY_SIZE(cxl_root_port) - 1; i >= 0; i--)
|
||||
platform_device_unregister(cxl_root_port[i]);
|
||||
err_bridge:
|
||||
for (i = ARRAY_SIZE(cxl_host_bridge) - 1; i >= 0; i--)
|
||||
for (i = ARRAY_SIZE(cxl_host_bridge) - 1; i >= 0; i--) {
|
||||
struct platform_device *pdev = cxl_host_bridge[i];
|
||||
|
||||
if (!pdev)
|
||||
continue;
|
||||
sysfs_remove_link(&pdev->dev.kobj, "physical_node");
|
||||
platform_device_unregister(cxl_host_bridge[i]);
|
||||
}
|
||||
err_populate:
|
||||
depopulate_all_mock_resources();
|
||||
err_gen_pool_add:
|
||||
@@ -769,8 +780,14 @@ static __exit void cxl_test_exit(void)
|
||||
platform_device_unregister(cxl_switch_uport[i]);
|
||||
for (i = ARRAY_SIZE(cxl_root_port) - 1; i >= 0; i--)
|
||||
platform_device_unregister(cxl_root_port[i]);
|
||||
for (i = ARRAY_SIZE(cxl_host_bridge) - 1; i >= 0; i--)
|
||||
for (i = ARRAY_SIZE(cxl_host_bridge) - 1; i >= 0; i--) {
|
||||
struct platform_device *pdev = cxl_host_bridge[i];
|
||||
|
||||
if (!pdev)
|
||||
continue;
|
||||
sysfs_remove_link(&pdev->dev.kobj, "physical_node");
|
||||
platform_device_unregister(cxl_host_bridge[i]);
|
||||
}
|
||||
depopulate_all_mock_resources();
|
||||
gen_pool_destroy(cxl_mock_pool);
|
||||
unregister_cxl_mock_ops(&cxl_mock_ops);
|
||||
|
||||
Reference in New Issue
Block a user