linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v5 00/25] iommu: Make default_domain's mandatory
       [not found] <0-v5-d0a204c678c7+3d16a-iommu_all_defdom_jgg@nvidia.com>
@ 2023-07-31 12:29 ` Jason Gunthorpe
       [not found] ` <15-v5-d0a204c678c7+3d16a-iommu_all_defdom_jgg@nvidia.com>
  1 sibling, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2023-07-31 12:29 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Andy Gross, Alim Akhtar, Bjorn Andersson,
	AngeloGioacchino Del Regno, Baolin Wang, Christophe Leroy,
	Gerald Schaefer, Heiko Stuebner, iommu, Jernej Skrabec,
	Jonathan Hunter, Kevin Tian, Konrad Dybcio, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip,
	linux-s390, linux-samsung-soc, linux-sunxi, linux-tegra,
	Russell King, linuxppc-dev, Matthias Brugger, Matthew Rosato,
	Michael Ellerman, Nicholas Piggin, Orson Zhai, Rob Clark,
	Robin Murphy, Samuel Holland, Thierry Reding, Krishna Reddy,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang, Lu Baolu,
	Dmitry Osipenko, Marek Szyprowski, Nicolin Chen, Niklas Schnelle,
	Steven Price, Thierry Reding

On Mon, Jul 24, 2023 at 02:21:50PM -0300, Jason Gunthorpe wrote:
> [ It would be good to get this in linux-next, we have some good test
> coverage on the ARM side already, thanks! ]
> 
> It has been a long time coming, this series completes the default_domain
> transition and makes it so that the core IOMMU code will always have a
> non-NULL default_domain for every driver on every
> platform. set_platform_dma_ops() turned out to be a bad idea, and so
> completely remove it.

Joerg, I think we are done with this now, it has been two months
since a substantive comment.

Can you take it so we have enough time in linux-next?

There is a small typo in a commit message, patch 15 should have
 s/omap_iommu_set_platform_dma/msm_iommu_set_platform_dma/

Let me know if you want me to resend

Thanks,
Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v5 15/25] iommufd/selftest: Make the mock iommu driver into a real driver
       [not found] ` <15-v5-d0a204c678c7+3d16a-iommu_all_defdom_jgg@nvidia.com>
@ 2023-08-02 23:50   ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2023-08-02 23:50 UTC (permalink / raw)
  To: Andy Gross, Alim Akhtar, Bjorn Andersson,
	AngeloGioacchino Del Regno, Baolin Wang, Christophe Leroy,
	Gerald Schaefer, Heiko Stuebner, iommu, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Konrad Dybcio,
	Krzysztof Kozlowski, linux-arm-kernel, linux-arm-msm,
	linux-mediatek, linux-rockchip, linux-s390, linux-samsung-soc,
	linux-sunxi, linux-tegra, Russell King, linuxppc-dev,
	Matthias Brugger, Matthew Rosato, Michael Ellerman,
	Nicholas Piggin, Orson Zhai, Rob Clark, Robin Murphy,
	Samuel Holland, Thierry Reding, Krishna Reddy, Chen-Yu Tsai,
	Will Deacon, Yong Wu, Chunyan Zhang
  Cc: Lu Baolu, Dmitry Osipenko, Marek Szyprowski, Nicolin Chen,
	Niklas Schnelle, Steven Price, Thierry Reding

On Mon, Jul 24, 2023 at 02:22:05PM -0300, Jason Gunthorpe wrote:

> -void __init iommufd_test_init(void)
> +int __init iommufd_test_init(void)
>  {
> +	struct platform_device_info pdevinfo = {
> +		.name = "iommufd_selftest_iommu",
> +	};
> +	int rc;
> +
>  	dbgfs_root =
>  		fault_create_debugfs_attr("fail_iommufd", NULL, &fail_iommufd);
> -	WARN_ON(bus_register(&iommufd_mock_bus_type));
> +
> +	selftest_iommu_dev = platform_device_register_full(&pdevinfo);
> +	if (IS_ERR(selftest_iommu_dev)) {
> +		rc = PTR_ERR(selftest_iommu_dev);
> +		goto err_dbgfs;
> +	}
> +
> +	rc = bus_register(&iommufd_mock_bus_type.bus);
> +	if (rc)
> +		goto err_platform;
> +
> +	mock_iommu_device.dev = &selftest_iommu_dev->dev;
> +	rc = iommu_device_register_bus(&mock_iommu_device, &mock_ops,
> +				  &iommufd_mock_bus_type.bus,
> +				  &iommufd_mock_bus_type.nb);
> +	if (rc)
> +		goto err_bus;
> +	return 0;
> +
> +err_bus:
> +	bus_unregister(&iommufd_mock_bus_type.bus);
> +err_platform:
> +	platform_device_del(selftest_iommu_dev);
> +err_dbgfs:
> +	debugfs_remove_recursive(dbgfs_root);
> +	return rc;
>  }
>  
>  void iommufd_test_exit(void)
>  {
> +	iommu_device_unregister_bus(&mock_iommu_device,
> +				    &iommufd_mock_bus_type.bus,
> +				    &iommufd_mock_bus_type.nb);
> +	bus_unregister(&iommufd_mock_bus_type.bus);
> +	platform_device_del(selftest_iommu_dev);
>  	debugfs_remove_recursive(dbgfs_root);
> -	bus_unregister(&iommufd_mock_bus_type);
>  }


There is a mistake here that started to become visible after one of
the rebases, it needs to call iommu_device_sysfs_add() prior to
iommu_device_register_bus() otherwise the iommu core stuff does not
fully initialize and weird stuff starts happening.

So, it needs this:

diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 5433c9c545526d..d2b59a1157441c 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -987,14 +987,21 @@ int __init iommufd_test_init(void)
 	if (rc)
 		goto err_platform;
 
-	mock_iommu_device.dev = &selftest_iommu_dev->dev;
+	rc = iommu_device_sysfs_add(&mock_iommu_device,
+				    &selftest_iommu_dev->dev, NULL, "%s",
+				    dev_name(&selftest_iommu_dev->dev));
+	if (rc)
+		goto err_bus;
+
 	rc = iommu_device_register_bus(&mock_iommu_device, &mock_ops,
 				  &iommufd_mock_bus_type.bus,
 				  &iommufd_mock_bus_type.nb);
 	if (rc)
-		goto err_bus;
+		goto err_sysfs;
 	return 0;
 
+err_sysfs:
+	iommu_device_sysfs_remove(&mock_iommu_device);
 err_bus:
 	bus_unregister(&iommufd_mock_bus_type.bus);
 err_platform:
@@ -1006,6 +1013,7 @@ int __init iommufd_test_init(void)
 
 void iommufd_test_exit(void)
 {
+	iommu_device_sysfs_remove(&mock_iommu_device);
 	iommu_device_unregister_bus(&mock_iommu_device,
 				    &iommufd_mock_bus_type.bus,
 				    &iommufd_mock_bus_type.nb);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-02 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0-v5-d0a204c678c7+3d16a-iommu_all_defdom_jgg@nvidia.com>
2023-07-31 12:29 ` [PATCH v5 00/25] iommu: Make default_domain's mandatory Jason Gunthorpe
     [not found] ` <15-v5-d0a204c678c7+3d16a-iommu_all_defdom_jgg@nvidia.com>
2023-08-02 23:50   ` [PATCH v5 15/25] iommufd/selftest: Make the mock iommu driver into a real driver Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).