diff mbox series

[2/2] efi_loader: remove non vital devices first

Message ID 20241031-iommu_apple_dart_ordering-v1-2-8a6877946d6b@jannau.net
State Needs Review / ACK
Delegated to: Tom Rini
Headers show
Series Fix device removal order for Apple dart iommu | expand

Commit Message

Janne Grunau Oct. 31, 2024, 10:48 p.m. UTC
DM_FLAG_VITAL marks devices which are essential for the operation of
other devices. Removing these devices before their users can result in
hangs or crashes.
This potentially fixes EFI boot of Renesas rcar3 devices. Their clock
devices (and with this series the dart iommu) are the only devices
markes as vital.
The arm boot code already handles devioce removal in this way.

Signed-off-by: Janne Grunau <j@jannau.net>
---
 lib/efi_loader/efi_boottime.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Kettenis Nov. 1, 2024, 8:29 p.m. UTC | #1
> From: Janne Grunau <j@jannau.net>
> Date: Thu, 31 Oct 2024 23:48:02 +0100
> 
> DM_FLAG_VITAL marks devices which are essential for the operation of
> other devices. Removing these devices before their users can result in
> hangs or crashes.
> This potentially fixes EFI boot of Renesas rcar3 devices. Their clock
> devices (and with this series the dart iommu) are the only devices
> markes as vital.
> The arm boot code already handles devioce removal in this way.

There is a typo in that last sentence of the commit message (devioce).
Otherwise:

> Signed-off-by: Janne Grunau <j@jannau.net>

Reviewed-by: Mark Kettenis <kettenis@openbsd.org>

> ---
>  lib/efi_loader/efi_boottime.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 4f52284b4c653c252b0ed6c0c87da8901448d4b4..7db3c95782970f8c06a970a8ee86b1804cd848b6 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -2234,6 +2234,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
>  		if (IS_ENABLED(CONFIG_USB_DEVICE))
>  			udc_disconnect();
>  		board_quiesce_devices();
> +		dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL);
>  		dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
>  	}
>  
> 
> -- 
> 2.47.0
> 
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 4f52284b4c653c252b0ed6c0c87da8901448d4b4..7db3c95782970f8c06a970a8ee86b1804cd848b6 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2234,6 +2234,7 @@  static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 		if (IS_ENABLED(CONFIG_USB_DEVICE))
 			udc_disconnect();
 		board_quiesce_devices();
+		dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL);
 		dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
 	}