Page MenuHomeFreeBSD

linuxkpi: Add `int_sqrt()`
Needs RevisionPublic

Authored by dumbbell on Jul 15 2026, 8:17 AM.
Referenced Files
F170783681: D58251.id182021.diff
Sun, Sep 6, 2:52 PM
F170773624: D58251.id182021.diff
Sun, Sep 6, 1:37 PM
Unknown Object (File)
Sat, Sep 5, 4:04 PM
Unknown Object (File)
Sat, Sep 5, 1:44 PM
Unknown Object (File)
Thu, Sep 3, 5:48 PM
Unknown Object (File)
Thu, Sep 3, 2:53 PM
Unknown Object (File)
Thu, Sep 3, 1:51 PM
Unknown Object (File)
Tue, Sep 1, 8:19 PM
Subscribers

Details

Reviewers
bz
Group Reviewers
linuxkpi
Summary

The implementation comes from isqrt64() in sys/cam/cam_iosched.c. It is modified to take an unsigned long and return an unsigned int.

The i915 DRM driver started to use it in Linux 6.15.

Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

bz requested changes to this revision.Sat, Sep 5, 9:28 AM
bz added a subscriber: bz.
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/math.h
67

I believe int_sqrt returns an unsigned long in Linux.

sys/compat/linuxkpi/common/src/linux_math.c
9

Based on? instead of copied as it's not a 1:1 copy thought it may become if we do return the unsigned long? Otherwise also credit @imp in the (c)?

Also do you want to fix style for LinuxKPI?

This revision now requires changes to proceed.Sat, Sep 5, 9:28 AM