Files
mac_linuxgpu/linuxu/tests/test_platform_policy.c
geramyloveless 953cf0149c mac_linuxgpu: upstream Linux amdgpu on macOS
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple
Silicon Macs inside a DriverKit system extension, for AMD GPUs attached
over Thunderbolt. The Linux sources come from a pinned submodule and are
compiled against linuxu, a userspace implementation of the Linux kernel
APIs they use. Includes the HSA runtime, the host installer app, the
setup and firmware fetch scripts, and the offline test suite.
2026-10-02 18:49:17 -07:00

36 lines
1.1 KiB
C

#include <assert.h>
#include <stdbool.h>
#include <linux/pm_runtime.h>
#include <linux/pm.h>
#include <linux/errno.h>
#include <video/nomodeset.h>
int main(void)
{
assert(!console_suspend_enabled);
assert(!video_firmware_drivers_only());
pm_runtime_allow(0);
pm_runtime_forbid(0);
pm_runtime_use_autosuspend(0);
pm_runtime_set_autosuspend_delay(0, 5000);
assert(pm_runtime_get(0) == 1);
assert(pm_runtime_get_sync(0) == 1);
assert(pm_runtime_resume(0) == 1);
assert(pm_runtime_resume_and_get(0) == 0);
assert(pm_runtime_get_if_active(0) == -EINVAL);
assert(pm_runtime_get_if_in_use(0) == -EINVAL);
assert(pm_runtime_active(0) && !pm_runtime_suspended(0));
assert(!pm_runtime_enabled(0) && pm_runtime_blocked(0));
assert(pm_runtime_block_if_disabled(0));
assert(pm_runtime_suspend(0) == -ENOSYS);
assert(pm_runtime_autosuspend(0) == -ENOSYS);
assert(pm_runtime_idle(0) == -ENOSYS);
assert(pm_runtime_put_autosuspend(0) == -ENOSYS);
assert(pm_runtime_autosuspend_expiration(0) == 0);
assert(pm_runtime_suspended_time(0) == 0);
pm_runtime_get_noresume(0);
pm_runtime_put_noidle(0);
pm_runtime_put(0);
return 0;
}