mbox series

[0/2] Fix device removal order for Apple dart iommu

Message ID 20241031-iommu_apple_dart_ordering-v1-0-8a6877946d6b@jannau.net
Headers show
Series Fix device removal order for Apple dart iommu | expand

Message

Janne Grunau Oct. 31, 2024, 10:48 p.m. UTC
Starting with v2024.10 dev_iommu_dma_unmap calls during device removal
trigger a NULL pointer dereference since the the iommu device is removed
before its user. The sparsely used DM_FLAG_VITAL flag is intended for
this dependency.
This series adds it to the Apple dart iommu driver and implements the
two phased device removal to the EFI loader.

Signed-off-by: Janne Grunau <j@jannau.net>
---
Janne Grunau (2):
      iommu: apple: Mark device with DM_FLAG_VITAL
      efi_loader: remove non vital devices first

 drivers/iommu/apple_dart.c    | 2 +-
 lib/efi_loader/efi_boottime.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
---
base-commit: 1d147b74f437fb0e85821e8271fe52bc5fd30194
change-id: 20241031-iommu_apple_dart_ordering-558e62671512

Best regards,

Comments

Sughosh Ganu Nov. 1, 2024, 6:22 a.m. UTC | #1
On Fri, 1 Nov 2024 at 04:37, Janne Grunau <j@jannau.net> wrote:
>
> Starting with v2024.10 dev_iommu_dma_unmap calls during device removal
> trigger a NULL pointer dereference since the the iommu device is removed
> before its user. The sparsely used DM_FLAG_VITAL flag is intended for
> this dependency.
> This series adds it to the Apple dart iommu driver and implements the
> two phased device removal to the EFI loader.

Is this also the cause of the crash that you were observing with the
RFC patches that I had posted earlier?

-sughosh

>
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> Janne Grunau (2):
>       iommu: apple: Mark device with DM_FLAG_VITAL
>       efi_loader: remove non vital devices first
>
>  drivers/iommu/apple_dart.c    | 2 +-
>  lib/efi_loader/efi_boottime.c | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> ---
> base-commit: 1d147b74f437fb0e85821e8271fe52bc5fd30194
> change-id: 20241031-iommu_apple_dart_ordering-558e62671512
>
> Best regards,
> --
> Janne Grunau <j@jannau.net>
>
Janne Grunau Nov. 1, 2024, 8:09 a.m. UTC | #2
On Fri, Nov 01, 2024 at 11:52:26AM +0530, Sughosh Ganu wrote:
> On Fri, 1 Nov 2024 at 04:37, Janne Grunau <j@jannau.net> wrote:
> >
> > Starting with v2024.10 dev_iommu_dma_unmap calls during device removal
> > trigger a NULL pointer dereference since the the iommu device is removed
> > before its user. The sparsely used DM_FLAG_VITAL flag is intended for
> > this dependency.
> > This series adds it to the Apple dart iommu driver and implements the
> > two phased device removal to the EFI loader.
> 
> Is this also the cause of the crash that you were observing with the
> RFC patches that I had posted earlier?

It shouldn't as I applied those patches on top of this. This is a
separate issue already present in v2024.10. I discovered the LMB changes
while investigating this.

Janne