From 0078f0d25287f05d6fdc6157fccabca00baae296 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Wed, 2 Dec 2026 21:02:59 -0500 Subject: [PATCH] drm/apple: audio: make the legacy test's DMA channel private The kernel-release smoke on main fails in apple-dcpaud-legacy: dcpaud_legacy_plugged_close_unplug_reopen_vmalloc: ASSERTION FAILED at drivers/gpu/drm/apple/audio-legacy-test.c:698 Expected dcpaud->chan == &t->channel, but dcpaud->chan == NULL __dma_async_device_channel_unregister called while 1 clients hold a reference The case registers a fake DMA device without DMA_PRIVATE. The dmaengine core hands the channels of such a device to dmaengine_get() users: if there is one, dma_async_device_register() takes a reference on every channel for it. async_tx is such a user, so once async_tx.ko is loaded the channel is busy before the case can request it, and the reference is still there when the device is unregistered. apple-sio, the DMA controller the driver really uses, sets DMA_PRIVATE, so the DP audio driver never sees this. Set it in the test as well. This is the order the modules are loaded in, not a race: in each of the six main runs checked, the case fails in the smoke guest that loads async_tx before appledrm, and passes in the one that loads it later and in the one that does not load it. Fixes: 9f33c3f95939 ("drm/apple: select DP audio buffer ownership per PCM open") Signed-off-by: DjDeveloperr --- drivers/gpu/drm/apple/audio-legacy-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/apple/audio-legacy-test.c b/drivers/gpu/drm/apple/audio-legacy-test.c index 66e55737b877a..0808fb4a5c6fb 100644 --- a/drivers/gpu/drm/apple/audio-legacy-test.c +++ b/drivers/gpu/drm/apple/audio-legacy-test.c @@ -682,6 +682,8 @@ static void dcpaud_legacy_plugged_close_unplug_reopen_vmalloc(struct kunit *test #if IS_ENABLED(CONFIG_DMADEVICES) KUNIT_ASSERT_EQ(test, kunit_platform_driver_register(test, &dcpaud_legacy_dma_driver), 0); KUNIT_ASSERT_EQ(test, kunit_platform_device_add(test, dma_pdev), 0); + /* As on apple-sio: keeps dmaengine_get() users (async_tx) off the channel */ + dma_cap_set(DMA_PRIVATE, t->dma.cap_mask); dma_cap_set(DMA_SLAVE, t->dma.cap_mask); dma_cap_set(DMA_CYCLIC, t->dma.cap_mask); t->dma.directions = BIT(DMA_MEM_TO_DEV);