Re: git: 863fe7ae5152 - main - LinuxKPI: re-implement pm_runtime.h

From: Bjoern A. Zeeb <bz_at_freebsd.org>
Date: Mon, 19 Oct 2026 21:41:01 UTC
On Mon, 19 Oct 2026, Mark Johnston wrote:

> On Sat, Oct 10, 2026 at 06:29:02PM +0000, Bjoern A. Zeeb wrote:
>> The branch main has been updated by bz:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=863fe7ae5152926fab0380a78ba26b6ba4a2d65f
>>
>> commit 863fe7ae5152926fab0380a78ba26b6ba4a2d65f
>> Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
>> AuthorDate: 2026-07-11 14:36:06 +0000
>> Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
>> CommitDate: 2026-10-10 18:28:32 +0000
>>
>>     LinuxKPI: re-implement pm_runtime.h
>>
>>     The original implementation was based on OpenBSD under public domain
>>     but just defined the functions to void.
>>     FreeBSD later extended the file with more inline functions or dealing
>>     with differences in Linux versions.
>>
>>     This rework tries to group some functions, adds properly typed arguments
>>     and return values in some cases.
>>     It further adjusts return values based on the !CONFIG_PM expectations.
>>
>>     Lastly pr_debug() calls are added so we could see if/how much these
>>     functions are used in new/other works rather than code just compiling
>>     but the functions entirely being ignored without the knowledge of the
>>     person porting code.
>>
>>     Sponsored by:   The FreeBSD Foundation
>>     MFC after:      3 days
>>     Reviewed by:    dumbbell
>>     Differential Revision: https://reviews.freebsd.org/D58169
>
> This commit makes Xorg+i915 unusable for me.  All text on my desktop is
> corrupted.
>
> I traced this down to the change to pm_runtime_get_if_active(): if it
> goes back to returning 1, then the problem goes away.

Can you tell me which drm-kmod version you are using?

I am asking as in drm-kmod master, 6.12-lts, and 6.6-lts the only use
for i915 is behind a `if (IS_ENABLED(CONFIG_PM)) { }` check.

Oh doh, PM gets set in drm-kmod kconfig.mk.  That's very likely not
intentional for the pm_runtime parts as LinuxKPI has no notion of
dev->power state tracking (apart from device_set_wakeup_capable() which
was simple enough to implement as a start).

The question then is pm_runtime_get_if_active() returns no PM support,
why does the driver not do the right thing?  It would have to assume
that PM runtime support is enabled for the device based on ???

I assume the cleanest and easiest solution would be to put
pm_runtime_get_if_active() under #ifdef CONFIG_PM in the file and leave
a comment for that case returning 1 not being the proper implementation?

I wonder what effect that will have on drivers/gpu/drm/amd/pm/amdgpu_pm.c
in drm-kmod master?

Can you test/review D60878?

/bz

-- 
For there shall arise false Christs, and false prophets, and shall shew
great signs and wonders; insomuch that, if it were possible, they shall
deceive the very elect. Behold, I have told you before. [Mat. 24:24-25]