Skip to content

Commit 065150d

Browse files
povikmarcan
authored andcommitted
iommu: apple-dart: Link to consumers with blanket RPM_ACTIVE
Without the RPM_ACTIVE flag, runtime PM core only seems to consider the link insofar as it prevents the DART from suspending in case of consumers *considered active by runtime PM*. Other devices, like those on which runtime PM has yet to be enabled, or which lack any runtime PM support, are not considered in preventing the DART from suspending. DART going through suspend/resume cycle with active consumers can break the consumers' operation by the DART being reset in its resume path, among other things. Add RPM_ACTIVE flag to the link to have the consumer in the link prevent the DART from being suspended, unless the consumer itself is runtime PM suspended. This supersedes an earlier PCIe-only workaround. (TODO: Does this mean devices without bound drivers will keep their DARTs up indefinitely? This depends on the timing of the iommu probe_device/release_device calls. Investigate.) Signed-off-by: Martin Povišer <[email protected]>
1 parent 59096bb commit 065150d

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

drivers/iommu/apple-dart.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -818,24 +818,15 @@ static struct iommu_device *apple_dart_probe_device(struct device *dev)
818818
{
819819
struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
820820
struct apple_dart_stream_map *stream_map;
821-
u32 dl_flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_SUPPLIER;
822821
int i;
823822

824823
if (!cfg)
825824
return ERR_PTR(-ENODEV);
826825

827-
/*
828-
* Runtime PM behaves strangely with PCIe devices, pm_runtime_enabled()
829-
* returns true here although the devices do not support runtime PM.
830-
* This seems to confuse the PM core and DART is runtime suspended while
831-
* the device is in use. The dart_hw_reset() in the resume path ends up
832-
* breaking PCIe devices eventually.
833-
*/
834-
if (dev_is_pci(dev))
835-
dl_flags |= DL_FLAG_RPM_ACTIVE;
836-
837826
for_each_stream_map(i, cfg, stream_map)
838-
device_link_add(dev, stream_map->dart->dev, dl_flags);
827+
device_link_add(dev, stream_map->dart->dev,
828+
DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_SUPPLIER |
829+
DL_FLAG_RPM_ACTIVE);
839830

840831
return &cfg->stream_maps[0].dart->iommu;
841832
}

0 commit comments

Comments
 (0)