mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
On Linux, root writes power_dpm_force_performance_level and pp_power_profile_mode, and amdgpu_pm.c's store() applies them. This driver had no sysfs write path: its observer client only reads. Selector 89 (SysfsWrite) takes an attribute id and a value and runs that attribute's own store(), through linuxu_sysfs_write (as kernfs, one store() of a NUL-terminated page). It is limited to: - An allowlist in session_state.h: power_dpm_force_performance_level with auto, low, high or profile_peak, and pp_power_profile_mode with a bare profile index, 0-99. Manual, the other profile_* levels and custom profile parameters are not offered. - Observer clients that carry the session-release entitlement, which is the host app's, as for Retire and the quarantine release. - Synchronous and bounded on the observer reads' driver thread, never the delivery thread, with admission as for SysfsRead. store()'s result comes back as the bytes taken or a negative Linux errno. A value outside the allowlist is NotPermitted, a missing entitlement is NotPrivileged, and a store() still running at 250 ms is Timeout. Tests: test-sysfs-read writes through a device attribute's store(), and checks the NUL-terminated buffer, store()'s own errno, and the read-only, missing and empty cases. test-session-shutdown checks the observer policy, that the call is synchronous but not on the delivery thread, the paths, and the value allowlist (every offered level and index, with and without a newline, and the levels, spellings and parameters it refuses).