<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/compat/linuxkpi, branch releng/12.2</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.2</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.2'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2020-09-06T17:40:35Z</updated>
<entry>
<title>MFC r364964: LinuxKPI: Implement ksize() function.</title>
<updated>2020-09-06T17:40:35Z</updated>
<author>
<name>Vladimir Kondratyev</name>
<email>wulf@FreeBSD.org</email>
</author>
<published>2020-09-06T17:40:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=70486dfaf24a3d4a12d3075f210d2c42a0e9c7c2'/>
<id>urn:sha1:70486dfaf24a3d4a12d3075f210d2c42a0e9c7c2</id>
<content type='text'>
In Linux, ksize() gets the actual amount of memory allocated for a given
object. This commit adds malloc_usable_size() to FreeBSD KPI which does
the same. It also maps LinuxKPI ksize() to newly created function.

ksize() function is used by drm-kmod.

Reviewed by:	hselasky, kib
Differential Revision:	https://reviews.freebsd.org/D26215
</content>
</entry>
<entry>
<title>MFC r363564-r363567, r363575, r363835-r363837, r363842-r363843, r364232</title>
<updated>2020-08-24T13:19:16Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T13:19:16Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d76753928054af3f8e228442c15889d6469e3ab0'/>
<id>urn:sha1:d76753928054af3f8e228442c15889d6469e3ab0</id>
<content type='text'>
r363564:
linuxkpi: Include linux/sizes.h in dma-mapping.h

Linux does the same, this avoids ifdef or extra includes in ported drivers.

Reviewed by:	emaste, hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25701

r363565:
linuxkpi: Include hardirq.h in preempt.h and lockdep.h in hardirq.h

Linux does the same, this avoids ifdef or extra includes in ported drivers.

Reviewed by:	emaste, hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25702

r363566:
linuxkpi: Add taint* defines

This isn't used for us but allow us to port drivers more easily.

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25703

r363567:
Revert r363564

linux/sizes.h doesn't exists in base ... sorry.

r363575:
Fix r363565

lockdep.h needs sys/lock.h for LOCK_CLASS

r363835:
linuxkpi: Add linux/sizes.h

This file contain some defines for common sizes.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D25941

r363836:
linuxkpi: Add kref_put_lock

Same as kref_put but in addition to calling the rel function it will
acquire the lock first.

Sponsored by: The FreeBSD Foundation
Reviewed by:	hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D25942

r363837:
linuxkpi: Add nested variant of mutex_lock_interruptible

We don't do anything with the _nesteds variant so just call mutex_lock_interruptible

Sponsoredby: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D25944

r363842:
linuxkpi: Add clear_bit_unlock

This calls clear_bit and adds a memory barrier.

Sponsored by: The FreeBSD Foundation

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D25943

r363843:
linuxkpi: Add time_after32 and time_before32

This compare two 32 bits times

Sponsored by: The FreeBSD Foundation
Reviewed by:	kib, hselasky
Differential Revision:	https://reviews.freebsd.org/D25700

r364232:
linuxkpi: Add a few wait_bit functions

The linux function does a lot more than that as multiple waitqueue could be fetch
from a static table based on the hash of the argument but since in DRM it's only used
in one place just add a single variable.
We will probably need to change that in the futur but it's ok with DRM even with current
linux.

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26054
</content>
</entry>
<entry>
<title>MFC r361450, r361452, r361550-r361551</title>
<updated>2020-08-24T13:14:38Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T13:14:38Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e9a73cd852bd683edcd754b23ef6303655e5402b'/>
<id>urn:sha1:e9a73cd852bd683edcd754b23ef6303655e5402b</id>
<content type='text'>
r361450:
linuxkpi: Add refcount.h

Implement some refcount functions needed by drm.
Just use the atomic_t struct and functions from linuxkpi for simplicity.

Sponsored-by: The FreeBSD Foundation

Reviewed by:	hselsasky
Differential Revision:	https://reviews.freebsd.org/D24985

r361452:
linuxkpi: Fix mod_timer and del_timer_sync

mod_timer is supposed to return 1 if the modified timer was pending, which
is exactly what callout_reset does so return the value after checking
that it's a correct one in case the api change.
del_timer_sync returns int so add a function and handle that.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24983

r361550:
linuxkpi: Add rcu_swap_protected

This macros swap an rcu pointer with a normal pointer.
The condition only seems to be used for debug/warning under linux, ignore
for now.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24954

r361551:
linuxkpi: Add kstrtou16

This function convert a char * to a u16.
Simply use strtoul and cast to compare for ERANGE

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24996
</content>
</entry>
<entry>
<title>MFC r361247, r361343, r361418-r361419, r361422, r361449</title>
<updated>2020-08-24T12:59:55Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T12:59:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b87c9716d25fff3a883933c07950c72f19bc3f86'/>
<id>urn:sha1:b87c9716d25fff3a883933c07950c72f19bc3f86</id>
<content type='text'>
r361247:
linuxkpi: Add irq_work.h

Since handlers are call in a thread context we can simply use a workqueue
to emulate those functions.
The DRM code was patched to do that already, having it in linuxkpi allows us
to not patch the upstream code.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24859

r361343:
linuxkpi: Add rcu_work functions

The rcu_work function helps to queue some work after waiting for a grace
period.
This is needed by DRM drivers.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24942

r361418:
libkern: Add arc4random_uniform

This variant get a random number up to the limit passed as the argument.
This is simply a copy of the libc version.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	cem, hselasky (previous version)
Differential Revision:	https://reviews.freebsd.org/D24962

r361419:
linuxkpi: Add prandom_u32_max

This is just a wrapper around arc4random_uniform
Needed by DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by:	cem, hselasky
Differential Revision:	https://reviews.freebsd.org/D24961

r361422:
bbr: Use arc4random_uniform from libkern.

This unbreak LINT build

Reported by:	jenkins, melifaro

r361449:
linuxkpi: Add __same_type and __must_be_array macros

The same_type macro simply wraps around builtin_types_compatible_p which
exist for both GCC and CLANG, which returns 1 if both types are the same.
The __must_be_array macros returns 1 if the argument is an array.

This is needed for DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24953
</content>
</entry>
<entry>
<title>MFC r361007, r361138-r361140, r361245-r361246</title>
<updated>2020-08-24T10:46:09Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T10:46:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=679efd9537b76884f51f8be2965cd52c72d81423'/>
<id>urn:sha1:679efd9537b76884f51f8be2965cd52c72d81423</id>
<content type='text'>
r361007:
linuxkpi: Add EBADRQC to errno.h

This is used in the amdgpu driver from Linux 5.2

Sponsored-by: The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24807

r361138:
linuxkpi: Add atomic_dec_and_mutex_lock

This function decrement the counter and if the result is 0 it acquires
the mutex and returns 1, if not it simply returns 0.
Needed by DRM from Linux v5.3

Sponsored-by: The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24847

r361139:
linuxkpi: Add __mutex_init

Same as mutex_init, the lock_class_key argument seems to be only used for
debug in Linux, simply ignore it for now.
Needed by DRM in Linux v5.3

Sponsored-by: The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24848

r361140:
linuxkpi: Add offsetofend macro

This calculate the offset of the end of the member in the given struct.
Needed by DRM in Linux v5.3

Sponsored-by: The FreeBSD Foudation
Differential Revision:	https://reviews.freebsd.org/D24849

r361245:
linuxkpi: Add __init_waitqueue_head

The only difference with init_waitqueue_head is that the name and the
lock class key are provided but we don't use those so use init_waitqueue_head
directly.

Sponsored-by: The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24861

r361246:
linuxkpi: add pci_dev_present

pci_dev_present shows if a set of pci ids are present in the system.
It just wraps pci_find_device.
Needed by DRMv5.2

Submitted by:	Austing Shafer (ashafer@badland.io)
Differential Revision:	https://reviews.freebsd.org/D24796
</content>
</entry>
<entry>
<title>MFC r360787, r360851, r360870-r360872</title>
<updated>2020-08-24T10:42:04Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T10:42:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=23468ab2646d6b35e12ceb7cf2db569b2979d52a'/>
<id>urn:sha1:23468ab2646d6b35e12ceb7cf2db569b2979d52a</id>
<content type='text'>
r360787:
linuxkpi: Add pci_iomap and pci_iounmap

Those function are use to map/unmap io region of a pci device.
Different resource can be mapped depending on the bar so use a
tailq to store them all.

Sponsored-by: The FreeBSD Foundation

Reviewed by:	emaste, hselasky
Differential Revision:	https://reviews.freebsd.org/D24696

r360851:
linuxkpi: Add bitmap_copy and bitmap_andnot

bitmap_copy simply copy the bitmaps, no idea why it exists.
bitmap_andnot is similar to bitmap_and but uses !src2.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D24782

r360870:
linuxkpi: Add bitmap_alloc and bitmap_free

This is a simple call to kmallock_array/kfree, therefore include linux/slab.h as
this is where the kmalloc_array/kfree definition is.

Sponsored-by: The FreeBSD Foundation
Reviewed by:	hselsasky
Differential Revision:	https://reviews.freebsd.org/D24794

r360871:
linuxkpi: Really add bitmap_alloc and bitmap_zalloc

This was missing in r360870

Sponsored-by: The FreeBSD Foundation

r360872:
qnlx: Do not redifines types.

r360870 added linux/slab.h into liunx/bitmap.h and this include linux/types.h
The qlnx driver is redefining some of those types so remove them and add an
explicit linux/types.h include.

Pointy hat: manu
Reported by:	Austin Shafer &lt;ashafer@badland.io&gt;
</content>
</entry>
<entry>
<title>MFC r358176-r358177</title>
<updated>2020-08-24T10:28:15Z</updated>
<author>
<name>Emmanuel Vadot</name>
<email>manu@FreeBSD.org</email>
</author>
<published>2020-08-24T10:28:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=5ef761145c4c7f43331b26c272523df256a89a1b'/>
<id>urn:sha1:5ef761145c4c7f43331b26c272523df256a89a1b</id>
<content type='text'>
r358176:
linuxkpi: Add list_is_first function

This function just test if the element is the first of the list.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D23766

r358177:
linuxkpi: Add str_has_prefix

This function test if the string str begins with the string pointed
at by prefix.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D23767
</content>
</entry>
<entry>
<title>MFC r364109:</title>
<updated>2020-08-19T13:32:55Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2020-08-19T13:32:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=38f113fbc4edf3990d699ef6b40a31879d9f3f9f'/>
<id>urn:sha1:38f113fbc4edf3990d699ef6b40a31879d9f3f9f</id>
<content type='text'>
Need to clone the task struct fields related to RCU aswell in the
LinuxKPI after r359727. This fixes a minor regression issue. Else the
priority tracking won't work properly when both sleepable and
non-sleepable RCU is in use on the same thread.

Bump the __FreeBSD_version to force recompilation of external kernel
modules.

PR:		242272
Sponsored by:	Mellanox Technologies
</content>
</entry>
<entry>
<title>MFC r364028:</title>
<updated>2020-08-19T12:25:34Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2020-08-19T12:25:34Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=2578b7791a78df55843988d7df34c1faf1c78af1'/>
<id>urn:sha1:2578b7791a78df55843988d7df34c1faf1c78af1</id>
<content type='text'>
Implement radix_tree_store() in the LinuxKPI for use with the coming
extensible arrays implementation.

While at it add some more comments explaining the current
radix_tree_insert() function and make sure to clean the root node when
the radix tree reaches the maximum height. This can happen if the
index passed is too big when the tree is empty.

The radix_tree_store() function is basically a copy of the
radix_tree_insert() function with some added functionality.

The radix_tree_store() function is local to FreeBSD and does not yet
exist in Linux.

Reviewed by:		kib
Sponsored by:		Mellanox Technologies
</content>
</entry>
<entry>
<title>MFC r363078:</title>
<updated>2020-08-03T09:18:59Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2020-08-03T09:18:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=27d40aacf5bb8ba052ae60c8fb9dfcaf889ffb3c'/>
<id>urn:sha1:27d40aacf5bb8ba052ae60c8fb9dfcaf889ffb3c</id>
<content type='text'>
Implement the bitmap_subset() function in the LinuxKPI. This function
checks if the bitmap pointed to by the first argument is a subset of
the bitmap pointed to by the second argument. The function returns one
on success and zero on failure.

Sponsored by:		Mellanox Technologies
</content>
</entry>
</feed>
