Reviewed and applied.  Thanks!

Alex

On Tue, Nov 10, 2026 at 10:14 AM Jiaming Fan <[email protected]> wrote:
>
> amdgpu_init() does not undo its earlier steps when KFD init or PCI
> driver registration fails. v1 [1] added that unwinding. While checking
> it against amdgpu_exit(), two more things came up, so this is now a
> series:
>
> 1. amdgpu_unregister_atpx_handler() clears the vga_switcheroo handler
>    even when amdgpu did not register it, e.g. when apple-gmux holds the
>    slot. amdgpu_exit() has always done this; v1 would also have done it
>    on a failed module init. Patch 1 fixes it and goes first so that
>    patch 3 does not add a new path to it.
>
> 2. amdgpu_exit() does not undo amdgpu_init() in reverse order. For the
>    ATPX handler and the ACPI info that is only historical, so patch 2
>    swaps them. For KFD and the PCI driver it is required, so patch 2
>    keeps that order and adds a comment explaining why.
>
> Patch 3 is v1 rebased on top: the error path of amdgpu_init() now
> undoes the steps in reverse order, the same order amdgpu_exit() uses
> after patch 2.
>
> Changes since v1:
> - New patches 1 and 2.
> - Patch 3: commit message updated to refer to the order in
>   amdgpu_exit(); no code change.
> - Patches 1 and 3 carry Cc: stable. Patch 3 depends on patch 1 and
>   should not be backported without it.
>
> Only build-tested, on the ROCm amdgpu tree with W=1, LLVM=1 and
> CONFIG_VGA_SWITCHEROO=y; I have no hardware with ATPX or apple-gmux to
> run it on.
>
> [1] https://lists.freedesktop.org/archives/amd-gfx/2026-November/157013.html
>
> Jiaming Fan (3):
>   drm/amdgpu: only unregister the ATPX handler if we registered it
>   drm/amdgpu: undo module init in reverse order in module exit
>   drm/amdgpu: unwind module init on failure
>
>  .../gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c  | 13 +++++++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       | 24 +++++++++++++++----
>  2 files changed, 32 insertions(+), 5 deletions(-)
>
> --
> 2.56.0
>
>

Reply via email to