xe_kunit_he...oc_xe_device(9)
π xe_kunit_he...oc_xe_device(9) β Kernel API Manual π
okay so bestie, welcome to the Kernel API Manual entry for xe_kunit_he...oc_xe_device(9) β yes the title got truncated by the terminal, no that's not a you problem, it's an everyone problem β¨. Anyway. Sit down, grab a strawberry π, and let me tell you about the little function that spins up a whole &xe_device just for your KUnit test. it's giving "test fixture but make it graphics driver" and honestly? obsessed.
β¨ NAME β¨
xe_kunit_helper_alloc_xe_device β it allocates a &xe_device for a KUnit test. that's it. that's the whole job. main character energy, minimal responsibilities π«Ά
πΈ SYNOPSIS πΈ
struct xe_device * xe_kunit_helper_alloc_xe_device (struct kunit *test ,
struct device *dev );
look at her. two args, returns a pointer. clean. iconic. no notes π
π¦ ARGUMENTS π¦
testβ the kunit where thisxe_devicewill be used. like, this is the test that's gonna own it and be responsible for it, so pls treat it right π₯Ίdevβ The parent device object. the literal parent. the mother device. the one who birthed this whole situation π
π DESCRIPTION π
so here's the tea, bestie: this function allocates xe_device using drm_kunit_helper_alloc_device. that's the helper doing the helper things π₯
the xe_device allocation is managed by the test. lowkey the most important sentence here β the test is the one holding the leash, so nobody's leaking anything on your watch, periodt.
also, dev should be allocated using drm_kunit_helper_alloc_device. not optional. not "eh whatever". do it properly or don't do it at all, iykyk π
and!! this function uses KUNIT_ASSERT to detect any allocation failures. so if the allocation flops, it does not quietly return NULL and let you figure it out six stack frames later like some kind of coward. it asserts. loudly. in front of everyone. π
ngl if you're not ready for a hard assert the moment something fails to allocate, you're not ready for this function, bestie. but you are. i believe in you π
β RETURN β
a pointer to the new xe_device. brand new. fresh out the box. a whole little device for your test to play with π
π§ SEE ALSO π§
- Kernel file
./drivers/gpu/drm/xe/tests/xe_kunit_helpers.cβ go read the source, it's right there, it's free real estate π xe_kunit_helper_xe_device_test_init(9)xe_kunit_helper_xe_device_live_test_init(9)
and that's the page!! fr fr you now know everything this manpage knows, no cap, nothing skipped π«Ά
shoutout to ./drivers/gpu/drm/xe/tests for housing all this β she's been holding it down since October 2026 and she ate ππ
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms