History log of /freebsd/sys/compat/linuxkpi/common/src/linux_compat.c (Results 1 – 25 of 169)
Revision Date Author Comments
# e3cf2321 01-Jan-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add `get_file_active()`

[Why]
This is used by the i915 DRM driver starting from Linux 6.7.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.fr

linuxkpi: Add `get_file_active()`

[Why]
This is used by the i915 DRM driver starting from Linux 6.7.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48757

show more ...


# 1de8fcf4 01-Jan-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add Linux 6.7 `get_file_rcu()` variant

[Why]
In Linux 6.7, the signature of `get_file_rcu()` changed significantly,
going from:

bool get_file_rcu(struct linux_file *f);

... to:

linuxkpi: Add Linux 6.7 `get_file_rcu()` variant

[Why]
In Linux 6.7, the signature of `get_file_rcu()` changed significantly,
going from:

bool get_file_rcu(struct linux_file *f);

... to:

struct linux_file * get_file_rcu(struct linux_file **f);

I.e., both the argument and the return value changed in an incompatible
way.

This is used by the i915 DRM driver.

[How]
This patch introduces the variant and hide the new prototype behind
`LINUXKPI_VERSION >= 60700`.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48756

show more ...


# 2bb0efbb 08-Jan-2025 Bjoern A. Zeeb <bz@FreeBSD.org>

Revert: LinuxKPI: switch jiffies and timer->expire to unsigned long

There are possible problems when jiffies (ticks) which still are int
wrap around. Also given this did not touch every single plac

Revert: LinuxKPI: switch jiffies and timer->expire to unsigned long

There are possible problems when jiffies (ticks) which still are int
wrap around. Also given this did not touch every single place some
checks may be broken now.

Reported by: markj
This reverts commit fd27f86dd71b7ff1df6981297095b88d1d29652e.

show more ...


# fd27f86d 28-Dec-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: switch jiffies and timer->expire to unsigned long

It seems these functions work with unsigned long and not int in Linux.
Start simply replacing the int where I came across it while debuggi

LinuxKPI: switch jiffies and timer->expire to unsigned long

It seems these functions work with unsigned long and not int in Linux.
Start simply replacing the int where I came across it while debugging
a wireless driver timer modification. Also sprinkle in some "const".

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D48318

show more ...


# ef9ffb85 25-Nov-2024 Mark Johnston <markj@FreeBSD.org>

kern: Make fileops and filterops tables const where possible

No functional change intended.

MFC after: 1 week


# fc595a6b 13-Nov-2024 Edward Tomasz Napierala <trasz@FreeBSD.org>

Fix "vrefact: wrong use count 0" with DRM

Bump the vnode use count, not its hold count. This fixes a panic triggered
by fstatat(..., AT_EMPTY_PATH) on DRM device nodes, which happens to be
what glxi

Fix "vrefact: wrong use count 0" with DRM

Bump the vnode use count, not its hold count. This fixes a panic triggered
by fstatat(..., AT_EMPTY_PATH) on DRM device nodes, which happens to be
what glxinfo(1) from Ubuntu Jammy is doing.

PR: kern/274538
Reviewed By: kib (earlier version), olce
Differential Revision: https://reviews.freebsd.org/D47391

show more ...


# 5c92f84b 29-Sep-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: update rcu_dereference_*() and lockdep_is_held()

Update rcu_dereference_{check,protected}() to call the check and log
once if it fails and if the RCU debug sysctl is turned on.
Also add pr

LinuxKPI: update rcu_dereference_*() and lockdep_is_held()

Update rcu_dereference_{check,protected}() to call the check and log
once if it fails and if the RCU debug sysctl is turned on.
Also add proper checks for conditions passed in to these functions.
For that implement linux_rcu_read_lock_held() (lots of help from wulf).

(While here also remove extraneous extern for function prototypes).

Update lockdep_is_held() to always be an inline function with argument
annotation so that we do no longer have unused variables
in callers which only call lockdep_is_held().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D46842

show more ...


# 01518f5e 29-Jul-2024 Mark Johnston <markj@FreeBSD.org>

sleepqueue: Remove kernel stack swapping support, part 10

- Remove kick_proc0().
- Make the return type of sleepq_broadcast(), sleepq_signal(), etc.,
void.
- Fix up callers.

Tested by: pho
Review

sleepqueue: Remove kernel stack swapping support, part 10

- Remove kick_proc0().
- Make the return type of sleepq_broadcast(), sleepq_signal(), etc.,
void.
- Fix up callers.

Tested by: pho
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D46128

show more ...


# 1fe7cd02 21-Jul-2024 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Remove owner argument from class_create function on KBI layer

To chase Linux 6.4

Sponsored by: Serenity Cyber Security, LLC
Differential Revision: https://reviews.freebsd.org/D45849


# a1181662 21-Jul-2024 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Add devm_device_add_group to linux/device.h

devm_device_add_group creates a managed attribute group for a device.

Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by:

LinuxKPI: Add devm_device_add_group to linux/device.h

devm_device_add_group creates a managed attribute group for a device.

Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D45845

show more ...


# 3753988c 06-Apr-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: pm: add SET_SYSTEM_SLEEP_PM_OPS() and device_can_wakeup()

Add the SET_SYSTEM_SLEEP_PM_OPS() by factoring some other macro code
out in order to set the suspend/resume functions when the str

LinuxKPI: pm: add SET_SYSTEM_SLEEP_PM_OPS() and device_can_wakeup()

Add the SET_SYSTEM_SLEEP_PM_OPS() by factoring some other macro code
out in order to set the suspend/resume functions when the struct is
already given. Such is the case in iwlwifi d3.

Also add an initial implementation of device_can_wakeup(). Though
this is likely all we need we have no way of setting the flag for it
yet so leave a pr_debug() and a comment there as well. Until we want
to support WoWLAN this is likely not needed for wireless.
Doing it the proper way checking a bool in 'struct dev_pm_info' would
change 'struct device' and with that 'struct pci_dev' and break the
KBI. In favour of mergeability this version does not implement the
full functionality yet.

Both help to make an updated iwlwifi d3 compile.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45358

show more ...


# ae38a1a1 15-May-2024 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: spinlock: Simplify code

Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by: bz, emaste
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Re

linuxkpi: spinlock: Simplify code

Just use a typedef for spinlock_t, no need to create a useless
structure.

Reviewed by: bz, emaste
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D45205

show more ...


# 61fb195e 08-Apr-2024 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Improve timer_shutdown_sync

timer_shutdown_sync not only shutdowns a timer but prevents it rearming.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week


# 41fb6dc3 19-Jan-2024 Konstantin Belousov <kib@FreeBSD.org>

kcmp(2): implement for linuxkpi cdevs

Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518


# b8c88a61 24-Dec-2023 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Add x86_vendor field to struct cpuinfo_x86

and initialize it at linuxkpi module load.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu
MFC after: 1 week
Differential Revision:

LinuxKPI: Add x86_vendor field to struct cpuinfo_x86

and initialize it at linuxkpi module load.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42820

show more ...


# c612e3c2 24-Dec-2023 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Add xen/xen.h header

It contains proxy-implementation of xen_initial_domain() and
xen_pv_domain() required by latest drm-kmod.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu

LinuxKPI: Add xen/xen.h header

It contains proxy-implementation of xen_initial_domain() and
xen_pv_domain() required by latest drm-kmod.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42797

show more ...


# 488e8a7f 24-Oct-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: reduce impact of large MAXCPU

Start scaling arrays dynamically instead of using MAXCPU, resulting in
extra allocations on startup but reducing the overall memory footprint.
For the static

LinuxKPI: reduce impact of large MAXCPU

Start scaling arrays dynamically instead of using MAXCPU, resulting in
extra allocations on startup but reducing the overall memory footprint.
For the static single CPU mask we provide two versions to further save
memory depending on a low or high CPU count system. The threshold to
switch is currently at 128 CPUs on 64bit platforms.
More detailed comments on the implementations can be found in the code.

If I am not wrong on a MAXCPU=65536 system the memory footprint should
roughly go down from 512M to 1.5M for the static single CPU mask.

Submitted by: olce (most of this final version)
Sponsored by: The FreeBSD Foundation
PR: 274316
Differential Revision: https://reviews.freebsd.org/D42345

show more ...


# 80446fc7 08-Dec-2023 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Move `struct kobject` code to `linux_kobject.c`

[Why]
`linux_compat.c` is already too long. I will need to add `struct kset`
in a follow-up commit, so let's move the existing `struct kobje

linuxkpi: Move `struct kobject` code to `linux_kobject.c`

[Why]
`linux_compat.c` is already too long. I will need to add `struct kset`
in a follow-up commit, so let's move the existing `struct kobject` code
to its own file.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43019

show more ...


# 8a8e86b8 07-Dec-2023 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Revert "linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now"

This change seems to break some drivers such as the mlx5*(4) drivers.

As kib@ says:
> According to the 'official' Linux kernel documentation, t

Revert "linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now"

This change seems to break some drivers such as the mlx5*(4) drivers.

As kib@ says:
> According to the 'official' Linux kernel documentation, the GFP_KERNEL
> flag implies sleepable context.

It was introduced while working on the new vt(4)/DRM integration [1].
During this work, doing sleepable allocations broke vt(4) and the DRM
drivers. However, I made further improvements and some locking-related
fixed to the new integration without revisiting the need for it.

After more testing, the improvements to the integration mentionned above
seems to make the change to `GFP_KERNEL` unneeded now. I can thus
revert it to restore expectations of other drivers.

This reverts commit 14dcd40983748596d116d91acb934a8a95ac76bc.

[1] https://github.com/freebsd/drm-kmod/pull/243

Reviewed by: kib
Approved by: kib
Differential Revision: https://reviews.freebsd.org/D42962

show more ...


# 14dcd409 24-Nov-2023 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now

... instead of `M_WAITOK`.

[Why]
The reason is that in some places in the DRM drivers (in particular, the
framebuffer management code), kmalloc() is cal

linuxkpi: `GFP_KERNEL` equals `M_NOWAIT` now

... instead of `M_WAITOK`.

[Why]
The reason is that in some places in the DRM drivers (in particular, the
framebuffer management code), kmalloc() is called from a non-sleepable
context, such as after a call to mtx_lock(8) with an MTX_DEF mutex.

If `GFP_KERNEL` is defined as `M_WAITOK`, we hit an assertion from
witness(4).

[How]
The definition of `GFP_KERNEL` is changed to `M_NOWAIT`. This means that
callers should verify the return value of kmalloc(). Fortunately, this
is always the case in Linux.

Reviewed by: bz, emaste, manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42054

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 2e07e885 16-May-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: implement timer_{delete,shutdown}_sync()

Implement timer_{delete,shutdown}_sync(), which do not seem to require
anything additional to the already existing del_timer_sync().

Sponsored by:

LinuxKPI: implement timer_{delete,shutdown}_sync()

Implement timer_{delete,shutdown}_sync(), which do not seem to require
anything additional to the already existing del_timer_sync().

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40124

show more ...


# ad513b4d 24-May-2023 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add utsname for init_utsname() with release

A wireless dirver is requesting release from the result of
init_utsname(). Populate the field on startup.

MFC after: 10 days
Reviewed by: emas

LinuxKPI: add utsname for init_utsname() with release

A wireless dirver is requesting release from the result of
init_utsname(). Populate the field on startup.

MFC after: 10 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40248

show more ...


# a27902c1 10-Feb-2023 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Define `cpu_data(cpu)`

`cpu_data(cpu)` evaluates to a `struct cpuinfo_x86` filled with
attributes of the given CPU number. The CPU number is an index in the
`__cpu_data[]` array with MAXCP

linuxkpi: Define `cpu_data(cpu)`

`cpu_data(cpu)` evaluates to a `struct cpuinfo_x86` filled with
attributes of the given CPU number. The CPU number is an index in the
`__cpu_data[]` array with MAXCPU entries. On FreeBSD, we simply
initialize all of them like we do with `boot_cpu_data`.

While here, we add the `x86_model` field to the `struct cpuinfo_x86`. We
use `CPUID_TO_MODEL()` to set it.

At the same time, we fix the value of `x86` which should have been set
to the CPU family. It was using the same implementation as
`CPUID_TO_MODEL()` before. It now uses `CPUID_TO_FAMILY()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38542

show more ...


# 58cf3a69 11-Nov-2022 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Define `boot_cpu_data.x86_max_cores`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D36971


1234567