]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Split mailbox channel create function
authorLizhi Hou <lizhi.hou@amd.com>
Thu, 5 Mar 2026 06:20:41 +0000 (22:20 -0800)
committerLizhi Hou <lizhi.hou@amd.com>
Thu, 5 Mar 2026 17:24:33 +0000 (09:24 -0800)
commitd5b8b0347fa8470b751a506fb801797e271d7548
treec015ff454740afe3ff7c7007dc56a1f0eecc16a8
parent76e8173ba92e15eeb0421b7cdbaef20513193b51
accel/amdxdna: Split mailbox channel create function

The management channel used for firmware control command submission is
currently created after the firmware is started. If channel creation
fails (for example, due to memory allocation failure or workqueue
creation interruption), the firmware remains in a pending state and is
unable to receive any control commands.

To avoid leaving the firmware in this inconsistent state, split
xdna_mailbox_create_channel() into two separate functions so that
resource allocation can be completed before interacting with the
hardware.
  xdna_mailbox_alloc_channel()
    Allocates memory and initializes the workqueue. This can be called
    earlier, before interacting with the hardware.
  xdna_mailbox_start_channel()
    Performs the hardware interaction required to start the channel.

Rename xdna_mailbox_destroy_channel() to xdna_mailbox_free_channel().
Ensure that xdna_mailbox_stop_channel() and xdna_mailbox_free_channel()
properly unwind the corresponding start and allocation steps, respectively.

Fixes: b87f920b9344 ("accel/amdxdna: Support hardware mailbox")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260305062041.3954024-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_message.c
drivers/accel/amdxdna/aie2_pci.c
drivers/accel/amdxdna/amdxdna_mailbox.c
drivers/accel/amdxdna/amdxdna_mailbox.h