Commit Graph

4622 Commits

Author SHA1 Message Date
Bjoern A. Zeeb
fd1a2f3dfc LinuxKPI: pci: add more functions
Add a dummy pci_assign_resource() and an implementation of
pci_irq_vector() returning the irq for MSI-X, MSI, and legacy interrupt.
Both are needed by wirless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D38237
2023-02-05 20:31:40 +00:00
Bjoern A. Zeeb
70b97048a0 LinuxKPI: mm.h: implement virt_to_head_page()
Implement virt_to_head_page().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D38240
2023-02-05 20:29:56 +00:00
Dmitry Chagin
edfc7d6e5b linux(4): Add the forgotten in the 6f8439db opt_compat include.
MFC after:		1 week
2023-02-05 18:25:10 +03:00
Dmitry Chagin
eb08932156 linux(4): Microoptimize linux_ipc code to unindent else blocks.
No functional change.

MFC after:		1 week
2023-02-03 19:17:34 +03:00
Dmitry Chagin
3e0c56a717 linux(4): Use designated initializers.
MFC after:		1 week
2023-02-03 19:17:15 +03:00
Justin Hibbits
c50f70b5a9 linsysfs: Use IfAPI accessors
Replace the only two ifnet member accesses with IfAPI accessor calls.

Sponsored by:	Juniper Networks, Inc.
2023-02-03 09:38:03 -05:00
Justin Hibbits
5243598927 linprocfs: Migrate to IfAPI
Summary:
Migrate linprocfs to use the IfAPI interfaces instead of direct ifnet
accesses.

Reviewed by:	dchagin
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38358
2023-02-03 09:38:03 -05:00
Dmitry Chagin
95b8603427 linux(4): Deduplicate linux_trans_osrel().
MFC after:		1 week
2023-02-02 17:58:07 +03:00
Dmitry Chagin
6039e966ff linux(4): Deduplicate linux_copyout_strings().
It is still present in the 32-bit Linuxulator on amd64.

MFC after:		1 week
2023-02-02 17:58:07 +03:00
Dmitry Chagin
6f8439db24 linux(4): Use COMPAT_LINUX32 enstead of __ELF_WORD_SIZE.
COMPAT_LINUX32 option is defined for case when building 32-bit Linuxulator
for the 64-bit host. Usage of __ELF_WORD_SIZE is wrong here as it is equal to 32
on i386 too.

MFC after:		1 week
2023-02-02 17:58:06 +03:00
Dmitry Chagin
7446514533 linux(4): Microoptimize linux_elf.h for future use.
In order to reduce code duplication move coredump support definitions
into the appropriate header and hide private definitions.

MFC after:		1 week
2023-02-02 17:58:06 +03:00
Dmitry Chagin
575e48f1c4 linux(4): Deduplicate MI futex structures.
MFC after:	1 week
2023-02-01 21:57:04 +03:00
Bjoern A. Zeeb
b0ddb44fd4 LinuxKPI: 802.11: fix indent in lkpi_wake_tx_queues()
Fix indentation in lkpi_wake_tx_queues().
No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 23:12:30 +00:00
Bjoern A. Zeeb
3dd980267f LinuxKPI: 802.11: enhance lkpi_scan_ies_add() for HT and VHT
Add code (currently disabled by #ifdef) for HT and VHT to
lkpi_scan_ies_add().  Switch to a local variable for ic given
the new code also needs the value.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 23:00:28 +00:00
Jean-Sébastien Pédron
a83b3ec719
linuxkpi: list_sort()'s callback now takes list arguments
This change breaks the API of `list_sort()`. `LINUXKPI_VERSION >= 51300`
is used to keep the header compatible with both versions of the
prototype.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38082
2023-01-31 23:36:33 +01:00
Bjoern A. Zeeb
2336248a8b LinuxKPI: 802.11: fix ff76cbc81d (pspoll)
Add the lost "inline".

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC with:	ff76cbc81d
2023-01-31 16:41:41 +00:00
Bjoern A. Zeeb
ff76cbc81d LinuxKPI: 802.11: implement ieee80211_is_pspoll()
Implement ieee80211_is_pspoll() and move it up to the set of implemented
ieee80211_is_*() functions.

There are no further changes (git diff just looks weird).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 16:36:24 +00:00
Bjoern A. Zeeb
5a9a0d7803 LinuxKPI: 802.11: basic implementation of *queue(s)/*txq*
Very basic implementations of ieee80211_{wake,stop}_queue[s],
as well as ieee80211_txq_schedule_start(), ieee80211_next_txq(),
and ieee80211_schedule_txq().
Various combinations of these are used by different wireless
drivers, incl. iwlwifi.

Sponsored by:	The FreeBSD Foundation (parts of this work)
MFC after:	3 days
2023-01-31 16:17:14 +00:00
Bjoern A. Zeeb
a839757109 LinuxKPI: 802.11: implement ieee80211_tx_status_ext()
Add an implementation of ieee80211_tx_status_ext() extending the
internal linuxkpi_ieee80211_tx_status() implementation.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 15:35:59 +00:00
Bjoern A. Zeeb
e30e05d3ab LinuxKPI: 802.11: extend linuxkpi_ieee80211_rx()
Extend linuxkpi_ieee80211_rx() by another argument for
the ieee80211_rx_list() implementation (even though the argument
is currently ignored).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 15:05:30 +00:00
Bjoern A. Zeeb
a3baca22d0 LinuxKPI: 802.11: fix types and whitespace
Correct struct member types, fix whitespace, and remove superfluous
return statements in void functions.

No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-31 13:39:04 +00:00
Jean-Sébastien Pédron
b9ef068943
linuxkpi: Define dev_is_platform() and to_platform_device()
The former returns false and the latter returns NULL.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38163
2023-01-30 23:10:03 +01:00
Jean-Sébastien Pédron
11aaefc9ca
linuxkpi: Try to solve headers dependencies
I'm sure I got it wrong but at least the DRM drivers compile.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38157
2023-01-30 23:09:52 +01:00
Jean-Sébastien Pédron
29d0c85c86
linuxkpi: Add io_mapping_map_local_wc() and io_mapping_unmap_local()
`io_mapping_map_local_wc()` is synonymous to `io_mapping_map_atomic_wc()`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38156
2023-01-30 23:09:38 +01:00
Jean-Sébastien Pédron
9dafbd0c69
linuxkpi: Add kmap_local_page_prot() and kunmap_local()
They are synonymous to `kmap_atomic_prot()` and `kunmap_atomic()`
respectively.

While here, fix several style(9) issues.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38155
2023-01-30 23:09:22 +01:00
Jean-Sébastien Pédron
7649b89cc1
linuxkpi: Add <linux/pgtable.h>
For now, it's empty. It is included by the DRM drivers but nothing is
missing otherwise. Perhaps something we already defined should be in
`pgtable.h` instead of another header.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38153
2023-01-30 23:09:13 +01:00
Jean-Sébastien Pédron
25faccaaca
linuxkpi: Add <linux/limits.h>
For now, it's empty. It is included by the DRM drivers but nothing is
missing otherwise. Perhaps something we already defined should be in
`limits.h` instead of another header.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38147
2023-01-30 23:08:59 +01:00
Jean-Sébastien Pédron
19be627cfd
linuxkpi: Define might_alloc()
... as a no-op.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38146
2023-01-30 23:08:45 +01:00
Jean-Sébastien Pédron
e400b69599
linuxkpi: Add freeram and freehigh to struct sysinfo
The struct layout is modified with this commit because new fields are
added in the middle, keeping original Linux order.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D37932
2023-01-30 23:08:32 +01:00
Bjoern A. Zeeb
dbbf46ebba LinuxKPI: skbuff: implement skb_free_frag()
Using the work from 55038a6306 implement
skb_free_frag() calling page_frag_free().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-28 15:33:12 +00:00
Dmitry Chagin
9922bccbc9 linux(4): Convert mount exported flags for statfs system calls.
MFC after:		1 week
2023-01-28 13:20:27 +03:00
Dmitry Chagin
953688e823 linux(4): Rework statfs conversion routine.
Rework the routines to convert a native statfs structure (with fixed-size 64-bit
counters) to a Linux statfs structure (with long-sized counters) for 32-bit apps.

Instead of following Linux and return an EOVERFLOW error from statfs() family of
syscalls when actual fs stat value(s) are large enough to not fit into 32 bits,
apply scale logics used by FreeBSD to convert a 5.x statfs structure to a 4.x
statfs structure.

For more details see cc479dda.

Tested by:		glebius
MFC after:		1 week
2023-01-28 13:19:41 +03:00
John Baldwin
4d77927e2a linuxkpi: Use a proper declaration for pm_suspend_via_firmware.
Reported by:	GCC -Wstrict-prototypes
2023-01-27 19:41:35 -08:00
Jean-Sébastien Pédron
3d751b7a71
linuxkpi: Add pin_user_pages*() functions
They were defined in the i915 DRM driver. I move the code in linuxkpi so
it can benefit other drivers.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38078
2023-01-27 21:54:39 +01:00
Jean-Sébastien Pédron
3e0856b63f
linuxkpi: Fix sg_alloc_table_from_pages() to have the same API as Linux
It now returns a `struct scatterlist *` pointer instead of an error
code only.

The implementation is incomplete because it doesn't use the `prv`
argument.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38077
2023-01-27 21:53:59 +01:00
Jean-Sébastien Pédron
8c46bd9f86
linuxkpi: Include linux/sched/mm.h from linux/sched.h
At least one file in the DRM drivers benefits from some namespace
pollution to use `fs_reclaim_acquire()`/`fs_reclaim_release()`. They are
defined in `linux/sched/mm.h` and this header must be included
indirectly into the DRM drivers' source file.

I couldn't find how it was included. Therefore this commit includes
`linux/sched/mm.h` from `linux/sched.h`. This is not the case in Linux
but fixes the issue with the DRM drivers.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D37912
2023-01-27 21:53:44 +01:00
Bjoern A. Zeeb
68b1d16250 LinuxKPI: linux_pci.c: fix whitespace
Properly indent a line.  No functional change.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-27 15:27:42 +00:00
Bjoern A. Zeeb
0d0ca120a7 LinuxKPI: pci.h move function declaration to top of file.
No functional changes.

X-MFC-with:	49b6d5ed14
Sponsored by:	The FreeBSD Foundation
2023-01-26 14:33:31 +00:00
Jean-Sébastien Pédron
a04aa80e77
lindebugfs: Add debugfs_create_file_size()
This is the same as `debugfs_create_file()` but takes the initial size
of the file. In FreeBSD, the given size is ignored and
`debugfs_create_file()` is called.

Reviewed by:	emaste, manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D37914
2023-01-25 23:23:16 +01:00
Jean-Sébastien Pédron
66cc55a041
linuxkpi: Define PCI_STD_NUM_BARS in <linux/pci.h>
Reviewed by:	emaste, manu
Approved by:	emaste, manu
Differential Revision:	https://reviews.freebsd.org/D38162
2023-01-25 22:57:32 +01:00
Jean-Sébastien Pédron
ccd31b4645
linuxkpi: Define pm_suspend_target_state in <linux/suspend.h>
It is set to `PM_SUSPEND_ON`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38161
2023-01-25 22:57:21 +01:00
Jean-Sébastien Pédron
4152ce2139
linuxkpi: Add msix_cap to struct pci_dev
At the same time, define `PCI_MSIX_FLAGS`and `PCI_MSIX_FLAGS_ENABLE`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38160
2023-01-25 22:57:08 +01:00
Jean-Sébastien Pédron
e64afbc215
linuxkpi: Add sysfs_emit_at() in <linux/sysfs.h>
Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38159
2023-01-25 22:56:56 +01:00
Jean-Sébastien Pédron
47877d61af
linuxkpi: Define is_cow_mapping(flags) as false
Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38158
2023-01-25 22:56:40 +01:00
Jean-Sébastien Pédron
3d47e3bf7b
linuxkpi: Include <linux/vmalloc.h> from <linux/pagemap.h>
I'm not sure this is correct, but it gives access to the definition of
`PAGE_KERNEL` in `ttm_tt.c` in the DRM drivers.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38154
2023-01-25 22:50:52 +01:00
Jean-Sébastien Pédron
b34cd67243
linuxkpi: Add seqcount_ww_mutex_t in <linux/seqlock.h>
It is defined as a synonymous to `seqcount_mutex_t`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38152
2023-01-25 22:50:38 +01:00
Jean-Sébastien Pédron
d9f1cb6774
linuxkpi: Define DEFINE_WD_CLASS(name) in <linux/ww_mutex.h>
It is defined as a synonymous to `DEFINE_WW_CLASS(name)`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38151
2023-01-25 22:50:27 +01:00
Jean-Sébastien Pédron
04cbeeb597
linuxkpi: Adds more SZ_* macros
`SZ_2K` and `SZ_1G` were defined in irdma. They are removed from this
driver.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38150
2023-01-25 22:50:07 +01:00
Jean-Sébastien Pédron
f27b1399d6
linuxkpi: Define ENOKEY to 126.
This is the same error code as Linux. This value is unused on FreeBSD.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38149
2023-01-25 22:49:53 +01:00
Jean-Sébastien Pédron
49b6d5ed14
linuxkpi: Add pci_device_is_present()
This calls bus_child_present(9) internally.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D38148
2023-01-25 22:49:38 +01:00