Re: [PATCH v3 40/40] tools/testing/cxl: Add a physical_node link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 23 Jan 2022 16:32:12 -0800
Dan Williams <dan.j.williams@xxxxxxxxx> wrote:

> 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.
> 
> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>

FWIW the last 5 patches all look good to me, but I'm not familiar
enough with the mocking code to be able to do a detailed review,
so I'll leave that for others.

Thanks,

Jonathan

> ---
>  tools/testing/cxl/test/cxl.c |   21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index 1b36e67dcd7e..431f2bddf6c8 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -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 @@ static __init int cxl_test_init(void)
>  	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);
> 




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux