public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] Consolidate the probe_device path
@ 2023-05-19 18:42 Jason Gunthorpe
  2023-05-19 18:42 ` [PATCH v2 01/10] iommu: Have __iommu_probe_device() check for already probed devices Jason Gunthorpe
                   ` (9 more replies)
  0 siblings, 10 replies; 30+ messages in thread
From: Jason Gunthorpe @ 2023-05-19 18:42 UTC (permalink / raw)
  To: Lu Baolu, David Woodhouse, iommu, Joerg Roedel, Len Brown,
	linux-acpi, Rafael J. Wysocki, Robin Murphy, Will Deacon
  Cc: Kevin Tian, Nicolin Chen

Now that the domain allocation path is less duplicated we can tackle the
probe_device path. Details of this are spread across several functions,
broadly move most of the code into __iommu_probe_device() and organize it
more strictly in terms of paired do/undo functions.

Make the locking simpler by obtaining the group->mutex fewer times and
avoiding adding a half-initialized device to an initialized
group. Previously we would lock/unlock the group three times on these
paths.

This locking change is the primary point of the series, creating the
paired do/undo functions is a path to being able to organize the setup
code under a single lock and still have a logical, not duplicated, error
unwind.

The reorganizing is done with the idea that a following series will
consolidate all of the different places calling arm_iommu_create_mapping()
and iommu_setup_dma_ops() into the new consolidated probe path and get rid
of probe_finalize.

This follows the prior series:

 https://lore.kernel.org/r/0-v5-1b99ae392328+44574-iommu_err_unwind_jgg@nvidia.com

And while it doesn't really depend on, some of the explanations around the
add/remove group logic assume these two:

 https://lore.kernel.org/r/0-v1-1421774b874b+167-ppc_device_group_jgg@nvidia.com
 https://lore.kernel.org/r/0-v2-ce71068deeec+4cf6-fsl_rm_groups_jgg@nvidia.com

This is on github: https://github.com/jgunthorpe/linux/commits/iommu_probe

v2:
 - Rebase to v6.4-rc2
 - Move the POWER cleanup to an independent -rc fix due to the iommu driver
   being merged
 - Update commit messages
 - Rename iommu_init_driver() to iommu_init_device()
 - Simplify __iommu_group_remove_device()
v1: https://lore.kernel.org/r/0-v1-8aecc628b904+2f42-iommu_probe_jgg@nvidia.com

Jason Gunthorpe (10):
  iommu: Have __iommu_probe_device() check for already probed devices
  iommu: Use iommu_group_ref_get/put() for dev->iommu_group
  iommu: Inline iommu_group_get_for_dev() into __iommu_probe_device()
  iommu: Simplify the __iommu_group_remove_device() flow
  iommu: Add iommu_init/deinit_device() paired functions
  iommu: Move the iommu driver sysfs setup into
    iommu_init/deinit_device()
  iommu: Do not export iommu_device_link/unlink()
  iommu: Always destroy the iommu_group during iommu_release_device()
  iommu: Split iommu_group_add_device()
  iommu: Avoid locking/unlocking for iommu_probe_device()

 drivers/acpi/scan.c         |   2 +-
 drivers/iommu/intel/iommu.c |   7 -
 drivers/iommu/iommu-sysfs.c |   8 -
 drivers/iommu/iommu.c       | 462 ++++++++++++++++++------------------
 drivers/iommu/of_iommu.c    |   2 +-
 5 files changed, 239 insertions(+), 242 deletions(-)


base-commit: 8f6c3fcaa76a9222f435230972b4f0f5c3672cad
-- 
2.40.1


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

end of thread, other threads:[~2023-06-02 17:20 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-19 18:42 [PATCH v2 00/10] Consolidate the probe_device path Jason Gunthorpe
2023-05-19 18:42 ` [PATCH v2 01/10] iommu: Have __iommu_probe_device() check for already probed devices Jason Gunthorpe
2023-05-21  8:17   ` Baolu Lu
2023-05-22 12:18   ` Rafael J. Wysocki
2023-05-19 18:42 ` [PATCH v2 02/10] iommu: Use iommu_group_ref_get/put() for dev->iommu_group Jason Gunthorpe
2023-05-21  8:18   ` Baolu Lu
2023-05-19 18:42 ` [PATCH v2 03/10] iommu: Inline iommu_group_get_for_dev() into __iommu_probe_device() Jason Gunthorpe
2023-05-21  8:19   ` Baolu Lu
2023-06-02 17:17     ` Jason Gunthorpe
2023-05-19 18:42 ` [PATCH v2 04/10] iommu: Simplify the __iommu_group_remove_device() flow Jason Gunthorpe
2023-05-21  9:08   ` Baolu Lu
2023-05-22  8:35   ` Niklas Schnelle
2023-05-29 19:33     ` Jason Gunthorpe
2023-05-19 18:42 ` [PATCH v2 05/10] iommu: Add iommu_init/deinit_device() paired functions Jason Gunthorpe
2023-05-21 11:09   ` Baolu Lu
2023-05-21 11:31   ` Baolu Lu
2023-05-22  2:31     ` Baolu Lu
2023-06-02 17:20     ` Jason Gunthorpe
2023-05-19 18:42 ` [PATCH v2 06/10] iommu: Move the iommu driver sysfs setup into iommu_init/deinit_device() Jason Gunthorpe
2023-05-22  0:51   ` Baolu Lu
2023-05-19 18:42 ` [PATCH v2 07/10] iommu: Do not export iommu_device_link/unlink() Jason Gunthorpe
2023-05-22  0:52   ` Baolu Lu
2023-05-19 18:42 ` [PATCH v2 08/10] iommu: Always destroy the iommu_group during iommu_release_device() Jason Gunthorpe
2023-05-22  1:43   ` Baolu Lu
2023-05-19 18:42 ` [PATCH v2 09/10] iommu: Split iommu_group_add_device() Jason Gunthorpe
2023-05-22  2:34   ` Baolu Lu
2023-05-25  5:37   ` Tian, Kevin
2023-05-19 18:42 ` [PATCH v2 10/10] iommu: Avoid locking/unlocking for iommu_probe_device() Jason Gunthorpe
2023-05-22  2:39   ` Baolu Lu
2023-05-25  5:37   ` Tian, Kevin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox