diff options
author | Tom Rini <trini@konsulko.com> | 2024-11-24 15:41:32 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-24 15:41:32 -0600 |
commit | 880fcc49eb40a78ed27ff575aa02034d7bd74e80 (patch) | |
tree | f31c80f6079688c879048751172e305100c37eb9 /drivers/core/root.c | |
parent | 6c791b6646c101b5bed6537dafbe7361185466ea (diff) | |
parent | dabaa4ae32062cb3f3d995e5c63e6cef54ad079b (diff) |
Merge patch series "Fix device removal order for Apple dart iommu"
Janne Grunau <j@jannau.net> says:
Starting with v2024.10 dev_iommu_dma_unmap calls during device removal
trigger a NULL pointer dereference in the Apple dart iommu driver. The
iommu device is removed before its user. The sparsely used DM_FLAG_VITAL
flag is intended to describe this dependency. Add it to the driver.
Adding this flag is unfortunately not enough since the boot routines
except the arm one simply remove all drivers. Add and use a new function
which calls
dm_remove_devioce_flags(DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL);
dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
to ensure this order dependency is head consistently.
Link: https://lore.kernel.org/r/20241123-iommu_apple_dart_ordering-v2-0-cc2ade6dde97@jannau.net
Diffstat (limited to 'drivers/core/root.c')
-rw-r--r-- | drivers/core/root.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c index 7a714f5478a..c7fb58285ca 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -147,6 +147,13 @@ int dm_remove_devices_flags(uint flags) return 0; } + +void dm_remove_devices_active(void) +{ + /* Remove non-vital devices first */ + device_remove(dm_root(), DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL); + device_remove(dm_root(), DM_REMOVE_ACTIVE_ALL); +} #endif int dm_scan_plat(bool pre_reloc_only) |