Commit Graph

142362 Commits

Author SHA1 Message Date
Warner Losh
875145ffd4 rx8803_settime: remove write only variable bus
Sponsored by:		Netflix
2022-04-04 22:29:38 -06:00
Warner Losh
22127c7c1b tca6416: remove write only sc
Sponsored by:		Netflix
2022-04-04 22:29:36 -06:00
Warner Losh
8a46fc9a9b armv7_allocate_pmc: remove write only variable pac
Sponsored by:		Netflix
2022-04-04 22:29:34 -06:00
Warner Losh
6ca6b8ea52 pmc_save_user_callchain: eliminate write only td variable
Sponsored by:		Netflix
2022-04-04 22:29:33 -06:00
Warner Losh
92ec9782ac hpen_battery_strenght_cb: eliminate write only data variable
Sponsored by:		Netflix
2022-04-04 22:29:31 -06:00
Warner Losh
edcced8ab7 mx25l_task: eliminate dev write only variable
Sponsored by:		Netflix
2022-04-04 22:29:29 -06:00
Warner Losh
05d3c5fd18 fd_probe: only define unit on x86, other platforms don't use this code
Sponsored by:		Netflix
2022-04-04 22:29:28 -06:00
Warner Losh
9a2e6ca6ef e6000sw_set_atustat: eliminate write only ret variable
Sponsored by:		Netflix
2022-04-04 22:29:26 -06:00
Warner Losh
3ca3bb576b cyapa_raw_input: elimmminate write only k variable
Sponsored by:		Netflix
2022-04-04 22:29:25 -06:00
Warner Losh
a9e022d3d7 bwn_lo_measure_gain_values: eliminate write only trsw_rx variable
Sponsored by:		Netflix
2022-04-04 22:29:23 -06:00
Warner Losh
87a4328651 bhnd_nvram_store_export_child: eliminate num_props write only variable
Sponsored by:		Netflix
2022-04-04 22:29:21 -06:00
Warner Losh
5466363900 bhnd_pmu_sdiod_drive_strength_init: eliminate write only intr_val variable
Sponsored by:		Netflix
2022-04-04 22:29:20 -06:00
Warner Losh
9af048a0b1 bhnd_pwrctl_attach: eliminate write only bus variable
Sponsored by:		Netflix
2022-04-04 22:29:18 -06:00
Warner Losh
e10ac1ed2c fdt_win_process_child: eliminate write only size variable
Sponsored by:		Netflix
2022-04-04 22:29:16 -06:00
Warner Losh
624f60ca03 platform_mpp_init: eliminate write only tuples variable
Sponsored by:		Netflix
2022-04-04 22:29:15 -06:00
Warner Losh
b20f0f7247 mv_rtc_attach: eliminate write only unit variable
Sponsored by:		Netflix
2022-04-04 22:29:13 -06:00
Warner Losh
feb08ab0cf vfp_init: eliminate fpexc write only variable
Sponsored by:		Netflix
2022-04-04 22:29:12 -06:00
Warner Losh
80f33a69a8 sendsig: eliminate write only code variable
Sponsored by:		Netflix
2022-04-04 22:29:10 -06:00
Warner Losh
97663c8d9e get_cachetype_cp15: eliminate write only multilier
Sponsored by:		Netflix
2022-04-04 22:29:06 -06:00
Warner Losh
04bb568fdc ARMADAXP: Add extres pseudo devices to some kernel
Add extres and related pseudo devices to allow this to compile.

Sponsored by:		Netflix
PR:			262417
2022-04-04 22:29:02 -06:00
Robert Wing
f3f6e0ebe9 geom_vinum: fix set but not used warnings 2022-04-04 13:23:47 -08:00
Robert Wing
8f7878e3e1 geom_eli: fix set but not used warning 2022-04-04 13:20:27 -08:00
Navdeep Parhar
08c7f1b6d4 Fix typo (interrups -> interrupts) in a sysctl description in tcp_lro.c.
MFC after:	3 days
2022-04-04 13:48:32 -07:00
Ed Maste
ab5c7dff95 zlib: replace CRLF line endings in zlib.map
MFC after:	3 days
2022-04-04 15:10:03 -04:00
Bjoern A. Zeeb
e86707418c LinuxKPI: PCI: add counter for linux_dma_map_phys_common() errors
LinuxKPI is asking for single-segment mappings.  Some (wireless) drivers
are using this to map multi-pages and our busdma framework is not very
friendly to that as single-segments [D31823].  Add a counter so we can
track when this happens to gather more information.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	hselasky
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34715
2022-04-03 23:05:47 +00:00
Xin LI
0a21252adf sys/contrib/zlib: Always define Z_U8 and Z_U4
This is a temporary hack for zlib to make sure that the library
still builds when building with Z_SOLO (used in kernel and loader),
as zlib is depending on limits.h which is only available in STDC
case.

PR:		kern/262977
MFC after:	3 days
2022-04-03 14:38:31 -07:00
Mitchell Horne
823b5cfbab mii_fdt: fix a set-but-not-used warning 2022-04-03 12:28:37 -03:00
Milan Obuch
517ea731d4 mii: include missing sources in loadable module
As of today, using 'kldload miibus' is not equivalent to using 'device
miibus' in a kernel config. Newly introduced PHY drivers (DP83822,
DP83867, VSCPHY) and source files/PHY driver for FDT-enabled kernels
are missing. Without including them, kernel modules using any function
from dev/mii/mii_fdt.c refuse to load. Additionally, miivar.h directly
includes opt_platform.h.

Add the missing sources to the module build, with the FDT-only files
gated behind an OPT_FDT check. Maintain the alphabetical listing of
SRCS, but move the required header files to a separate line to improve
readability.

Reviewed by:	mhorne, mindal@semihalf.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34256
2022-04-03 12:28:37 -03:00
Milan Obuch
242cd60a0a cgem: Support building as a loadable kernel module
For development, building a driver as kernel module is both convenient
and a time saver (no need for reboot on some change, testing it requires
just kldunload and kldload, a matter of seconds). For some special
cases, it may be even desirable to postpone initializing the network
interface after some action is done (loading a FPGA bitstream may be
required for Zynq/ZynqMP based hardware as an example).

Building is limited to ARM, ARM64 and RISC-V architectures (for Zynq,
ZynqMP, PolarFire Soc based boards, and HiFive based boards are known to
use CGEM at the moment).

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34687
2022-04-03 12:28:37 -03:00
Gordon Bergling
756220b515 isci(4): Remove a double word in an error message
- s/is is/is/

MFC after:	1 week
2022-04-03 16:07:20 +02:00
Michael Tuexen
52106f072f sctp: don't refer to a potentially outdated stream
Reported by:	syzbot+1593381019112e5bb35c@syzkaller.appspotmail.com
MFC after:	3 days
2022-04-02 23:26:27 +02:00
Michael Tuexen
b30b7a140c sctp: cleanup, no functional change
MFC after:	3 days
2022-04-02 23:02:16 +02:00
Mateusz Guzik
b7262756e2 vfs: fixup WANTIOCTLCAPS on open
In some cases vn_open_cred overwrites cn_flags, effectively nullifying
initialisation done in NDINIT. This will have to be fixed.

In the meantime make sure the flag is passed.

Reported by:	jenkins
Noted by:	Mathieu <sigsys@gmail.com>
2022-04-02 20:49:01 +02:00
Michael Tuexen
0f31631620 sctp: remove a test, which isn't safe
We can't ensure the stcb is still around. This issue was found
 by syzkaller.

MFC after:	3 days
2022-04-02 15:09:50 +02:00
Gordon Bergling
882d3b24fe smartpqi(4): Fix a typo in a source code comment
- s/commmand/command/

MFC after:	3 days
2022-04-02 15:21:45 +02:00
Gordon Bergling
01d74e5c7a iscsi(4): Fix a typo in a source code comment
- s/commmand/command/

MFC after:	3 days
2022-04-02 15:20:59 +02:00
Gordon Bergling
5ee87525a8 cxgbe(4): Fix a typo in a source code comment
- s/commmand/command/

MFC after:	3 days
2022-04-02 15:19:59 +02:00
Gordon Bergling
d792dc7ebb net(4): Fix a typo in a source code comment
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:57:06 +02:00
Gordon Bergling
ef1534cad8 fusefs(5): Fix a typo in a source code comment
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:56:21 +02:00
Gordon Bergling
c9b04ee4f8 kern: Fix two typos in source code comments
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:52:49 +02:00
Gordon Bergling
9097d2f5d1 etherswitch(4): Fix a few common typos in source code comments
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:51:57 +02:00
Gordon Bergling
b34f7568d1 NOTES: Fix a typo in a comments
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:50:04 +02:00
Michael Tuexen
d4290f7e62 Revert "sctp: remove a test, which isn't safe"
It included unrelated changes still under review.
This reverts commit b1fe92b28b.
2022-04-02 14:49:14 +02:00
Michael Tuexen
b1fe92b28b sctp: remove a test, which isn't safe
We can't ensure the stcb is still around. This issue was found
by syzkaller.

MFC after:	3 days
2022-04-02 14:44:06 +02:00
Gordon Bergling
24926c487b bce(4): Fix a typo in a source code comment
- s/exisitng/existing/

MFC after:	3 days
2022-04-02 14:40:34 +02:00
Gordon Bergling
0ce9617620 sound(4): Fix a typo in a source code comment
- s/exisitng/existing/

MFC after:	3 days
2022-04-02 14:40:10 +02:00
Gordon Bergling
942e8cab8c netinet: Fix a typo in a source code comment
- s/exisitng/existing/

MFC after:	3 days
2022-04-02 14:39:32 +02:00
Gordon Bergling
b61c7c2dfb isci(4): Fix a typo in a source code comment
- s/initialzied/initialized/

MFC after:	3 days
2022-04-02 14:29:34 +02:00
Gordon Bergling
cededdff9b ocs_fc(4): Fix a typo in a source code comment
- s/initialzied/initialized/

MFC after:	3 days
2022-04-02 14:28:30 +02:00
Gordon Bergling
f70fc4377f netpfil: Fix two typo in source code comments
- s/measurment/measurement/

While here, also fix some whitespace issues.

MFC after:	3 days
2022-04-02 14:18:11 +02:00
Gordon Bergling
7181887e82 kern: Fix two typos in source code comments
- s/measurment/measurement/

MFC after:	3 days
2022-04-02 14:15:27 +02:00
Luiz Amaral
654c1b8ef3 pfsync: Add CTLFLAG_VNET to carp_demotion_factor sysctl
When trying to avoid a CARP demotion during a pfsync service restart, I
noticed that a non-default value for the net.pfsync.carp_demotion_factor
sysctl was not being applied during the demotion. The CARP was always
demoted by 240.

After investigating, I realized that the sysctl was using VNET_NAME()
without the CTLFLAG_VNET.

PR:		262983
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34737
2022-04-02 12:11:32 +02:00
Gordon Bergling
8d30ef92d5 khelp(9): Fix a typo in a source code comment
- s/measurment/measurement/

MFC after:	3 days
2022-04-02 14:10:59 +02:00
Mateusz Guzik
0c805718cb vfs: fix memory leak on lookup with fds with ioctl caps
Reviewed by:	markj
PR:		262515
Noted by:	firk@cantconnect.ru
Differential Revision:	https://reviews.freebsd.org/D34667
2022-04-02 12:09:07 +00:00
Gordon Bergling
17628f1b79 cc_vegas(4): Fix a typo in a source code comment
- s/measurment/measurement/

MFC after:	3 days
2022-04-02 14:07:44 +02:00
Gordon Bergling
81d4309f9b safe(4): Fix a typo in a source code comment
- s/multple/multiple/

MFC after:	3 days
2022-04-02 14:03:17 +02:00
Gordon Bergling
f9254cc6ca enetc(4): Fix a typo in a source code comment
- s/multple/multiple/

MFC after:	3 days
2022-04-02 14:02:46 +02:00
Gordon Bergling
32c601b6cf mrsas(4): Fix a typo in a source code comment
- s/alloction/allocation/

MFC after:	3 days
2022-04-02 13:59:11 +02:00
Gordon Bergling
7fc0ffda35 ng_pppoe(4): Fix a typo in a source code comment
- s/asychronous/asynchronous/

MFC after:	3 days
2022-04-02 13:54:36 +02:00
Gordon Bergling
f167c46e79 memguard(9): Fix two typos in source code comments
- s/comparsion/comparison/

MFC after:	3 days
2022-04-02 13:51:27 +02:00
Gordon Bergling
011e6016d0 isci(4): Fix a typo in a source code comment
- s/differnt/different/

MFC after:	3 days
2022-04-02 13:35:30 +02:00
Gordon Bergling
6039e38f93 mlx4en(4): Fix two in source code comments
- s/differnt/different/
- s/differntly/differently/

MFC after:	3 days
2022-04-02 13:33:57 +02:00
Gordon Bergling
2543276943 iwm(4): Remove a whitespace
In 9f4dc7fd97 I accidentally added a whitespace at the
end of the line. Remove it.

Reported by:	Jose Luis Duran (via github)
MFC with:	9f4dc7fd97
2022-04-02 13:09:26 +02:00
Peter Jeremy
9a89977bf6
kern: Fix typo in kassert message.
- s/unepxected/unexpected/
MFC after:	3 days
2022-04-02 21:36:17 +11:00
Gordon Bergling
9f4dc7fd97 iwm(4): Fix a typo in a source code comment
- s/coresponding/corresponding/

Obtained from:	NetBSD
MFC after:	3 days
2022-04-02 11:50:38 +02:00
Gordon Bergling
13bf578c25 jme(4): Fix a typo in a source code comment
- s/verion/version/

MFC after:	3 days
2022-04-02 10:54:43 +02:00
Gordon Bergling
cba46da538 net(3): Fix a typo in a source code comment
- s/verion/version/

MFC after:	3 days
2022-04-02 10:53:40 +02:00
Gordon Bergling
24498b53ef sound(4): Fix a typo in a source code comment
- s/immediatly/immediately/

MFC after:	3 days
2022-04-02 10:50:03 +02:00
Gordon Bergling
5c0b62dcfc tsec: Fix a typo in a source code comment
- s/immediatly/immediately/

MFC after:	3 days
2022-04-02 10:48:37 +02:00
Gordon Bergling
592fcf6c45 neta: Fix a typo in a source code comment
- s/immediatly/immediately/

MFC after:	3 days
2022-04-02 10:46:13 +02:00
Gordon Bergling
dc8d33b368 snd_csa(4): Fix a few common typos in source code comments
- s/hander/handler/

MFC after:	3 days
2022-04-02 10:30:52 +02:00
Gordon Bergling
6efd2e3e51 neta: Fix a few common typos in a source code comment
- s/hander/handler/

MFC after:	3 days
2022-04-02 10:29:23 +02:00
Gordon Bergling
be83eecf5a jme(4): Fix a typo in a source code comment
- s/watchog/watchdog

MFC after:	3 days
2022-04-02 10:22:28 +02:00
Gordon Bergling
1cba6077be viawd(4): Fix a typo in a kernel message
- s/watchog/watchdog

MFC after:	5 days
2022-04-02 10:21:37 +02:00
Gordon Bergling
669d5ea4e3 kern: Fix a typo in a source code comment
- s/paniced/panicked/

MFC after:	3 days
2022-04-02 10:15:02 +02:00
Gordon Bergling
9094c3a71b usb(3): Fix a few typos in source code comments
- s/paniced/panicked/

MFC after:	3 days
2022-04-02 10:14:32 +02:00
Gordon Bergling
49dace1d46 cam: Fix typos in source code comments
- s/paniced/panicked/

MFC after:	3 days
2022-04-02 10:13:35 +02:00
Gordon Bergling
f8d292b665 net(3): Fix a typo in a source code comment
- s/Multilik/Multilink/

Obtained from:	NetBSD
MFC after:	3 days
2022-04-02 09:41:10 +02:00
Gordon Bergling
5c49e1cbea rpc(3): Fix two typos in source code comments
- s/alloctaed/allocated/

Obtained from:	NetBSD
MFC after:	3 days
2022-04-02 09:33:24 +02:00
Gordon Bergling
23677398ca net(3): Fix a typo in a source code comment
- s/paramenters/parameters/

MFC after:	3 days
2022-04-02 09:24:48 +02:00
Gordon Bergling
c748efcd94 risc-v: Fix two typos in a source code comment
- s/interger/integer/
- s/manupilate/manipulate/

MFC after:	3 days
2022-04-02 08:58:45 +02:00
Gordon Bergling
e443f2102e bxe(4): Fix a typo in an error message
- s/intergers/integers/

MFC after:	3 days
2022-04-02 08:56:06 +02:00
Hans Petter Selasky
88162f7abd ulpt(4): Add support for Epson TM-U220B.
Submitted by:		Archimedes Gaviola <archimedes.gaviola@gmail.com>
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-04-02 02:29:05 +02:00
Michael Tuexen
39a22011bb sctp: clear pointer to stack when returning from function.
Reported by:    syzbot+04cee5d8805dfbb63c06@syzkaller.appspotmail.com
Reported by:    syzbot+71e7e33dfc3cc39a6bd0@syzkaller.appspotmail.com
Reported by:    syzbot+6c36fc3c1bd03ed96107@syzkaller.appspotmail.com
Reported by:    syzbot+198b3751c158181c47de@syzkaller.appspotmail.com
2022-04-02 00:54:49 +02:00
Bjoern A. Zeeb
60970a328e LinuxKPI: 802.11: fix RSSI (and NF)
As in 4a22cd6c4e nf and rss should be
signed and not unsigned.  Change the types in the header and while
here change a magic number to a define as done elsewhere (value does
not change).

When calculating c_rssi we need to make it relative so subtract nf.
And while here improve the debug output.

This will hopefully fix ifconfig wlanN list scan S:N output which
tools use to chose a BSSID and help net80211 internal calculations.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-04-01 22:31:23 +00:00
Bjoern A. Zeeb
4a22cd6c4e net80211: correct types for nf and rssi
NF and RSSI should be signed and not unsigned to avoid problems.
Change the type accordingly.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-04-01 22:30:02 +00:00
Navdeep Parhar
d6226d6adb cxgbe/iw_cxgbe: Initialize the vma correctly in c4iw_mmap.
This fixes userspace RDMA applications that would fail due to mmap
failure.  The driver's mmap routine would succeed but later the
linux_compat.c mmap routine would fail because vma->vm_private_data
wasn't set properly.

This is catch-up with b633e08c70.

Reported by:	Veeresh @ Chelsio
Sponsored by:	Chelsio Communications
2022-04-01 13:09:40 -07:00
Mateusz Guzik
c4a08ef2af pf: handle duplicate rules gracefully
Reviewed by:	kp
Reported by:	dch
PR:		262971
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-01 18:01:48 +00:00
Randall Stewart
e88412d89b Opps sorry, typo in the cc_cubic fix when morphing it from nreno. 2022-04-01 08:37:04 -04:00
Randall Stewart
653cf466f0 hystart++ may not properly exit CSS back to slowstart.
In the changes to get hystart++ into cubic an inadvertent line
was removed in the conditional to figure out if you need to exit
hystart++ back to slowstart. The line of course is the most crucial
one (the others are valid but not critical) i.e. is the new rtt
less than the point where we entered hystart++. Without the line
we end up bouncing in and out of CSS.

Reported By: Reese Enghardt
Sponsored By: Netflix Inc.
2022-04-01 08:33:44 -04:00
Randall Stewart
ee1a08b8da rack may end up with a stuck connectin fi the rwnd is colapsed on sent data.
There is a case where rack will get stuck when it has outstanding data and
the peer collapses the rwnd down to 0. This leaves the session hung if
the rwnd update is not received. You can test this with the packet drill script
below. Without this fix it will be stuck and hang. With it we retransmit everything.
This also fixes the mtu retransmit case so we don't go into recovery when
the mtu is changed to a smaller value.

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D34573
2022-04-01 08:29:27 -04:00
Warner Losh
161fcf7994 nvme: Publish the drive's capabilities
Add cap_lo and cap_hi sysctl to each nvme drive. This publishes the raw
capabilities of the drive. Now we can only discover these with
bootverbose.

Sponsored by:		Netflix
2022-03-31 21:13:16 -06:00
Warner Losh
6af6a52ee4 nvme: Save cap_lo and cap_hi
Save the capabilities for the drive.

Sponsored by:		Netflix
2022-03-31 21:12:38 -06:00
Warner Losh
a70b5660f3 nvme: MPS is a power of two, not a size / 8k
Setting MPS in the CC should be a power of 2 number (it specifies the
page size of the host is 2^(12+MPS)), so adjust the calcuation. There is
no functional change because we do not support any architecutres != 4k
pages (yet). Other changes are needed for architectures with 16k or 64k
pages, especially when the underlying NVMe drive doesn't support that
page size (Most drives support a range that's small, and many only
support 4k), but let's at least do this calculation correctly. 12 - 12
is just as much 0 as 4096 >> 13 is :)

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D34707
2022-03-31 21:12:38 -06:00
Jung-uk Kim
ab71bbb75a acpica: Import ACPICA 20220331
(cherry picked from commit ca1c95cc699a25d891e62ef863c8268c93b35cf8)
2022-03-31 21:59:23 -04:00
Bjoern A. Zeeb
20eeed6844 rtw88: add man pages and hook up to build
Add man pages for rtw88 and rtw88fw.  Install a copy of the firmware
license file and hook up the driver and firmware modules to the build.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Relnotes:	yes
2022-04-01 00:07:24 +00:00
Bjoern A. Zeeb
73d4ebea35 rtw88: import firmware for Realtek's rtw88 supported chipsets.
Import the most recent versions of the firmware images for the
rtw88 driver.

This is based on linux-firmware at 681281e49fb6778831370e5d94e6e1d97f0752d6.

The license of the firmware matches the previous rtwnfw(4) firmware
files (modulo a Copyright year) and you can find a copy in
sys/contrib/dev/rtw88fw/LICENCE.rtlwifi_firmware.txt.

Add build infrastructure to create the .ko files but do not yet hook
it up to the build until all parts are in the tree.

Approved by:	core (imp)
MFC after:	2 weeks
2022-04-01 00:07:24 +00:00
Bjoern A. Zeeb
2774f20680 rtw88: import Realtek's rtw88 driver
Import rtw88 based on wireless-testing at
5d5d68bcff1f7ff27ba0b938a4df5849849b47e3 with adjustments for FreeBSD.

While our version of the driver has knowledge about the incapablity
of DMA above 4GB we do see errors if people have more than that
often already showing when laoding firmware.
The problem for that is currently believed to be outside this driver
so importing it anyway for now.

Given the lack of full license texts on non-local files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by:	core (imp) [1]
MFC after:	2 weeks
2022-04-01 00:07:24 +00:00
Colin Percival
ad93649d23 uart(4): Add a concept of "unique" serial devices
FreeBSD detects serial ports twice: First, very early in the boot
process, in order to obtain a usable console; and second, during
the device probe/attach process.  When a UART is discovered during
device probing, FreeBSD attempts to determine whether it is a
device which was already being used as a console; without this,
the console doesn't work in userland.

Unfortunately it's possible for a UART to be mapped to a different
location in memory when it is discovered on a bus than it has when
it is announced via the ACPI SPCR table; this breaks the matching
process, which relies on comparing bus addresses.

To address this, we introduce a concept of "unique" serial devices,
i.e. devices which are guaranteed to be present *only once* on any
system.  If we discover one of these during device probing, we can
match it to a same-PCI-vendor-and-device-numbers console which was
announced via the ACPI SPCR table, regardless of the differing bus
addresses.

At present, the only unique serial device is the "Amazon PCI serial
device" (vendor 0x1d0f, device 0x8250) found in some EC2 instances.
This unbreaks the serial console on those systems.

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D34703
2022-03-31 16:02:24 -07:00
Xin LI
c61bc1110c MFV 7b495a2a7a (zlib): Correct incorrect inputs provided to the CRC
functions.

MFC after:	3 days
2022-03-31 15:35:58 -07:00
Doug Moore
557dc337e6 vm_phys: check small blocks to finish allocation
In vm_phys_alloc_queues_contig, in the case that a sequence of
max-order blocks are sought to fulfill an allocation, a sequence is
ruled out if it does not have enough max-order blocks to satisfy the
allocation. However, there may be smaller blocks of free memory that
follow the last max-order block in the sequence, and they may be big
enough to complete the allocation request, so check for that
possibility before giving up on that block sequence.

Reviewed by:	markj
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D34724
2022-03-31 16:19:55 -05:00
Dmitry Chagin
bafe3b8804 linsysfs: plug set-but-not-used vars.
MFC after:	2 weeks
2022-03-31 23:49:26 +03:00
Tong Zhang
2108cc7290 stge: fix null pointer dereference
stge_attach() could fail at line 464, sc->sc_spec remains NULL when
calling stge_detach(), thus bus_release_resources() at line 704 will
trigger null pointer dereference. We need to check the nulliness before
calling bus_release_resources().

PR:		258420
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34629
2022-03-31 15:54:56 -04:00
Dmitry Chagin
09d60bfae5 linux(4): Cleanup empty lines.
MFC after:		2 weeks
2022-03-31 21:23:12 +03:00
Dmitry Chagin
4e1e83461b linux(4): Fix KASSERT message.
MFC after:		2 weeks
2022-03-31 21:22:31 +03:00
Dmitry Chagin
d6ccce0aa2 linux(4): readlink should fail if bufzis <= 0.
MFC after:		2 weeks
2022-03-31 21:21:41 +03:00
Dmitry Chagin
b7df7b987e linprocfs: Add /proc/self/oom_score_adj.
To avoid annoyng messages from LTP test suites add the simple
implementation of /proc/self/oom_score_adj which is do nothing.

Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D34710
MFC after:		2 weeks
2022-03-31 21:04:44 +03:00
Dmitry Chagin
d5dc757e84 linux(4): Add compat.linux32.emulate_i386 knob.
Historically 32-bit Linuxulator under amd64 emulated the real i386
behavior. Since 3d8dd983 the old i386 Linux world can't be used under
amd64 Linuxulator as it don't know anything about amd64 machine (which
is returned now by newuname() syscall). So, add a knob to allow to swith
the behavior and use i386 Linux binaries on amd64.
Set knob to the new behavior as I think this is common to the modern
Linux distros.

Reviewed by:		Pau Amma (doc), emaste
Differential revision:	https://reviews.freebsd.org/D34708
MFC after:		2 weeks
2022-03-31 21:01:09 +03:00
Dmitry Chagin
099fa2feb3 linux(4): Fixup miscalculation of d_off of struct dirent in getdents() syscalls.
Avoid calculating d_off value as it is specific to the underlying filesystem
and can be used by others API, like lseek(), seekdir() as input offset.

Differential revision:  https://reviews.freebsd.org/D31551
MFC after:		2 weeks
2022-03-31 20:50:09 +03:00
Dmitry Chagin
9103c5582a linux(4): wait4() returns ESRCH if pid is INT_MIN.
Weird and undocumented patch was added to the Linux kernel in 2017,
fixes wait403 LTP test.

MFC after:	2 weeks
2022-03-31 20:49:39 +03:00
Dmitry Chagin
5bcf0f7cd7 linux(4): Rid unused defines from linux_mib.
Reviewed by:		trasz
Differential revision:  https://reviews.freebsd.org/D31591
MFC after:		2 weeks
2022-03-31 20:45:12 +03:00
Dmitry Chagin
4e3aefb923 linux(4): Fixup waitid handling P_PGID idtype.
Since Linux 5.4, if id is zero, then wait for any child that is in the same
process grop as the caller's process group.

Differential revision:  https://reviews.freebsd.org/D31567
MFC after:		2 weeks
2022-03-31 20:44:00 +03:00
Dmitry Chagin
be1e4a0bdf linux(4): Return ENOSYS for unsupported P_PIDFD waitid idtype.
Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D31559
MFC after:		2 weeks
2022-03-31 20:42:42 +03:00
Dmitry Chagin
c7ef7c3fac linux(4): Add support for __WALL wait option bit.
As FreeBSD does not have __WALL option bit analogue explicitly set all
possible option bits to emulate Linux __WALL wait option bit.

Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D31555
MFC after:		2 weeks
2022-03-31 20:42:03 +03:00
Dmitry Chagin
d7e1e138ec linux(4): Fixup options value validation in linux_waitid().
Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D31554
MFC after:		2 weeks
2022-03-31 20:41:19 +03:00
Dmitry Chagin
2fd480b318 linux(4): Eliminate bogus options value check validation.
The kernel do it for us.

Reviewed by:		emaste
Differential revision:  https://reviews.freebsd.org/D31553
MFC after:		2 weeks
2022-03-31 20:41:02 +03:00
Dmitry Chagin
0c6b1ff7de linux(4): Consolidate wait* facility into linux_common_wait().
Also fix bug in waitid() implementation, use wru_self not wru_children.

Differential revision:  https://reviews.freebsd.org/D31552
MFC after:		2 weeks
2022-03-31 20:40:22 +03:00
Bjoern A. Zeeb
86220d3cbd LinuxKPI: 802.11: fix compat code for i386
Compiling another driver on i386 revealed two problems:
- ieee80211_tx_info.status.status_driver_data space needs to be
  calculated.  While a pointer is 32bit vm_paddr_t is 64 bit on i386
  so we didn't fit more than one of these in but needed more space.
- the arguments to ieee80211_txq_get_depth() are expected to
  unsigned long and not uint64_t.

No user noticable changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-31 17:29:53 +00:00
George V. Neville-Neil
ca4cd20c4a Address issue pointed out in CVE-2020-25705
Add jitter to the ICMP bandwidth limit to deny a side-channel port scan.

Reviewed by:	kp, philip, cy, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27354
2022-03-31 16:45:50 +02:00
Xin LI
ab8ac4c285 Bump __FreeBSD_version for zlib upgrade. 2022-03-31 07:30:42 -07:00
Xin LI
cd8822075a MFV c144cc5479: zlib 1.2.12.
MFC after:	3 days
Relnotes:	yes
2022-03-31 07:25:53 -07:00
Doug Moore
342056fa1c vm_phys: alloc pages without duplicating searches.
In the search for contiguous pages, as each page segment is examined,
check to see if the free list set for the next page segment differs
from the set for the current segment, and avoid a pointless search if
they do not differ.

Discussed with:	alc
Reviewed by:	markj
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D33947
2022-03-31 01:40:46 -05:00
Ed Maste
27ac4281fd mpr: add \n in diagnostic printf
Diff reduction between mpr and mps.

Fixes:		e2997a03b7 ("Diagnostic buffer fixes for the mps(4)...")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-03-30 20:14:07 -04:00
Mark Johnston
d53927b0ba uma: Don't allow a limit to be set in a warm zone
The limit accounting in UMA does not tolerate this.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-03-30 15:42:18 -04:00
Mark Johnston
54361f9020 uma: Use the correct type for a return value
zone_alloc_bucket() returns a pointer, not a bool.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-03-30 15:42:05 -04:00
Mark Johnston
7d1ab86691 pf: Initialize the table entry zone limit at initialization time
The limit may later be updated by the "set limit" directive in pf.conf.
UMA does not permit a limit to be set on a zone after any items have
been allocated from a zone.

Other UMA zones used by pf do not appear to be susceptible to this
problem: they either set a limit at zone creation time or never set one
at all.

PR:		260406
Reviewed by:	kp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34713
2022-03-30 15:41:44 -04:00
Ed Maste
8299f9a5c1 compat32: add size CTASSERTs for non-amd64 cases
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34712
2022-03-30 13:25:25 -04:00
Ed Maste
e5821a2156 syscalls.master: remove obsolete comment about compatibility tables
Compatibility ABIs no longer use a separate syscalls.master.

Fixes:		be67ea40c5 ("freebsd32: generate from ...")
Sponsored by:	The FreeBSD Foundation
2022-03-30 11:07:00 -04:00
Kristof Provost
d27c9f5bc3 pf: fixup match rules
Ensure that we can set and print match rules in ethernet rules.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Kristof Provost
81cac0d2f6 pf: add missing input/error validation for DIOCGETETHRULE
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Kristof Provost
9bb06778f8 pf: support listing ethernet anchors
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Wei Hu
5473dee730 Hyper-V: vPCI: Write back original BAR values after prepopulating bars
In vmbus_pcib_prepopulate_bars(), after writing all 1's to the
avialable device bars, those without being configured by device driver
are also set to its initialized values. However, this could cause
weird problem which results to device failure. The issue has been
reported to happen on LSI 9211-8i HBA card for DDA access on Hyper-V.
Writing back the orignal BAR values seem to work around this problem.

Reported by:	Alexander Motin <mavbsd@gmail.com>
Tested by:	Mathias Kraut <krautmaster@gmail.com>
Fixes:		75412a521f Hyper-V: vPCI: Prepopulate device bars
MFC after:	1 month
2022-03-30 06:56:09 +00:00
Michael Tuexen
218e463b85 sctp: ensure that ASCONF chunks are not too large
MFC after:	3 days
2022-03-30 01:22:20 +02:00
Michael Tuexen
e7e65008ff sctp: fix typos
Thanks to David Sanders for fixing the typos in the userland stack.

MFC after:	3 days
2022-03-29 21:09:51 +02:00
Ed Maste
f90cd1ae30 Clear non-x86 compat stat syscall kernel stack memory disclosure
32-bit architectures other than i386 have 64-bit time_t which results
in a struct timespec with 12 bytes for tv_sec and tv_nsec, and 4 bytes
of padding.  Zero the padding holes in struct stat32 and struct
freebsd11_stat32.

i386 has 32-bit time_t; struct timespec is 8 bytes and has no padding.

Found by inspection, prompted by a report by Reno Robert of Trend Micro
Zero Day Initiative.  The originally reported issue (ZDI-CAN-14538) is
already fixed in all supported FreeBSD versions (it was addressed
incidentally as part of the 64-bit inode project).

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34709
2022-03-29 16:10:04 -04:00
Mateusz Guzik
e123e2294c pf: guard against DIOCADDRULE without DIOCXBEGIN
Possibility to do it was always a bug, but it runs into crashes
since recent introduction of a per-ruleset RB tree.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Reported by:	syzbot+665b700afc6f69f1766a@syzkaller.appspotmail.com
2022-03-29 19:00:55 +00:00
Gordon Bergling
277d3e855d Revert "drm2: Fix a typo in a source code comment"
The comment about 'mmaping' was actually correct since
the comment was referencing to mmap(2).

Reported by:	alc

This reverts commit 22ba115b49.
2022-03-29 20:47:52 +02:00
Michael Tuexen
5d0c76c730 sctp: don't lock an already locked stcb.
Reported by:	syzbot+e8dca84da3b4b82f4400@syzkaller.appspotmail.com
MFC after:	3 days
2022-03-29 16:33:53 +02:00
Emmanuel Vadot
d69af4758b Bump __FreeBSD_version after linuxkpi updates 2022-03-29 13:19:32 +02:00
Emmanuel Vadot
1aca8a6ec6 linuxkpi: Add for_each_sgtable_dma_sg and for_each_sgtable_dma_page
Variants of for_each_sg/for_each_sg_dma_page but they operate on sgtable
structs.
Needed by drm v5.10

MFC after:	1 week
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-03-29 13:19:32 +02:00
Emmanuel Vadot
1acf9b2770 linuxkpi: Implement dma_max_mapping_size
Simply returns SCATTERLIST_MAX_SEGMENT.
Needed by drm v5.10

MFC after:	1 week
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-03-29 13:19:32 +02:00
Mateusz Guzik
40c911e8da zfs: use zero_region instead of allocating a dedicated page 2022-03-29 11:18:55 +00:00
Martin Matuska
8d0b6a7d49 zfs: update zfs_config.h and zfs_gitrev.h
Update zfs_config.h and zfs_gitrev.h as missed in da5137abd
2022-03-29 12:40:41 +02:00
Martin Matuska
da5137abdf zfs: merge openzfs/zfs@bc3f12bfa (master) into main
Notable upstream pull request merges:
  #12083 libzfs: FreeBSD doesn't resize partitions for you
  #13106 add physical device size to SIZE column in 'zpool list -v'
  #13158 Allow zfs send to exclude datasets
  #13190 module: zfs: zio_inject: zio_match_handler: don't << -1
  #13219 FreeBSD: add missing replay check to an assert in zfs_xvattr_set
  #13220 module: freebsd: avoid a taking a destroyed lock in zfs_zevent bits
  #13221 Fix ACL checks for NFS kernel server

Obtained from:	OpenZFS
OpenZFS commit:	bc3f12bfac
2022-03-29 12:07:34 +02:00
Ed Maste
8276c4149b mpr/mps/mpt: verify cfg page ioctl lengths
*_CFG_PAGE ioctl handlers in the mpr, mps, and mpt drivers allocated a
buffer of a caller-specified size, but copied to it a fixed size header.
Add checks that the size is at least the required minimum.

Note that the device nodes are owned by root:operator with 0640
permissions so the ioctls are not available to unprivileged users.

This change includes suggestions from scottl, markj and mav.

Two of the mpt cases were reported by Lucas Leong (@_wmliang_) of
Trend Micro Zero Day Initiative; scottl reported the third case in mpt.
Same issue found in mpr and mps after discussion with imp.

Reported by:	Lucas Leong (@_wmliang_), Trend Micro Zero Day Initiative
Reviewed by:	imp, mav
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34692
2022-03-28 20:35:47 -04:00
Michael Tuexen
5ac91821f5 sctp: get rid of stcb send lock
Just use the stcb lock instead to simplify locking.

Reported by:	syzbot+d00b202063150f85b110@syzkaller.appspotmail.com
Reported by:	syzbot+87f268a0a6d2d6383306@syzkaller.appspotmail.com
MFC after:	3 days
2022-03-29 01:50:17 +02:00
Rick Macklem
c1970a7eba nfscl: Fix IO_APPEND writes from kernel space
Commit 867c27c23a modified the NFS client so that
it did IO_APPEND writes directly to the NFS server
bypassing the buffer cache, via a call to
nfs_directio_write().  Unfortunately, this (very old)
function assumed that the uio iov was for user space
addresses.  As such, a IO_APPEND VOP_WRITE() that
was for system space, such as ktrace(1) does, would
write bogus data.

This patch fixes nfs_directio_write() so that it
handles kernel space uio iovs.

Reported by:	bz
Tested by:	bz
MFC after:	2 weeks
2022-03-28 15:11:52 -07:00
Brooks Davis
8601fca789 sysent: regen for syscallarg_t 2022-03-28 19:43:03 +01:00
Brooks Davis
b1ad6a9000 syscallarg_t: Add a type for system call arguments
This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from:	CheriBSD

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D33780
2022-03-28 19:43:03 +01:00
Gordon Bergling
bba12ee453 xen(4): Fix a few typos in source code comments
- s/querried/queried/

MFC after:	3 days
2022-03-28 19:37:20 +02:00
Gordon Bergling
2733b242e4 ffs(3): Fix a common typo in source code comments
- s/quadradically/quadratically/

Obtained from:	NetBSD
MFC after:	3 days
2022-03-28 19:37:03 +02:00
Gordon Bergling
81ed3cae69 gpart(8): Fix two typos in source code comments
- s/partiton/partition/

MFC after:	3 days
2022-03-28 19:36:48 +02:00
Gordon Bergling
4a87beeccb mlx5en(4): Fix a few typos in source code comments
- s/persistant/persistent/

MFC after:	3 days
2022-03-28 19:36:32 +02:00
Gordon Bergling
f697fe65e6 bfe(4): Fix a typo in a comment 2022-03-28 19:36:18 +02:00
Gordon Bergling
bef80a7285 vxlan(4): Fix two typos in sysctl descriptions
- s/fowarding/forwarding/

MFC after:	3 days
2022-03-28 19:35:34 +02:00
Gordon Bergling
75fdc440c8 extra_tcp_stacks: Fix two typos in source code comments
- s/recusive/recursive/

MFC after:	3 days
2022-03-28 19:34:45 +02:00
Gordon Bergling
982015d2d2 xen(3): Fix a typo in a source code comment
- s/mmaping/mapping/

MFC after:	3 days
2022-03-28 19:32:53 +02:00
Gordon Bergling
c55ecce1c1 netinet6: Fix a typo in a source code comment
- s/maping/mapping/

MFC after:	3 days
2022-03-28 19:32:10 +02:00
Gordon Bergling
79438267b3 netgraph(3): Fix a typo in a source code comment
- s/failes/fails/

MFC after:	3 days
2022-03-28 19:31:50 +02:00
Gordon Bergling
a216b9c2e0 qlnxe(4): Fix a typo in a source code comment
- s/existance/existence/

MFC after:	3 days
2022-03-28 19:31:18 +02:00
Gordon Bergling
e4c1b3f060 isci(4): Fix a typo in a source code comment
- s/recored/recorded/

MFC after:	3 days
2022-03-28 19:30:31 +02:00
Gordon Bergling
9a9d901bf2 exca(4): Fix a typo in a source code comment
- s/maping/mapping/

MFC after:	3 days
2022-03-28 19:30:10 +02:00
Gordon Bergling
22ba115b49 drm2: Fix a typo in a source code comment
- s/mmaping/mapping/

MFC after:	3 days
2022-03-28 19:29:27 +02:00
Gordon Bergling
fc48cc124c ipfilter(4): Fix a typo in a source code comment
- s/existance/existence/

MFC after:	3 days
2022-03-28 19:29:06 +02:00
Gordon Bergling
c9023cf7fe cxgbe(4): Fix a typo in a source code comment
- s/begining/beginning/

MFC after:	3 days
2022-03-28 19:28:15 +02:00
Emmanuel Vadot
50bb3a33d8 Bump __FreeBSD_version after linuxkpi updates 2022-03-28 18:31:31 +02:00
Emmanuel Vadot
2192bc3255 linuxkpi: Change irq_work_queue to return a bool
This was changed in Linux v5.10

MFC after:	1 week
Sponsored by:	Beckhoff Automation GmbH & Co .KG
2022-03-28 18:31:31 +02:00
Mark Johnston
ecd764b0ea audit: Initialize vattr fields before calling VOP_GETATTR
Some filesystems do not fill out certain optional vattr fields.  To
ensure that they do not get copied out to userspace uninitialized, use
VATTR_NULL to provide default values.

Reported by:	KMSAN
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-03-28 11:23:45 -04:00
John F. Carr
964bf2f902 hpet: Allow a MMIO window smaller than 1K
Some new AMD systems provide a HPET MMIO region smaller than the 1KB
specified, and a correspondingly small number of timers.  Handle this in
the HPET driver rather than requiring a 1KB window.  This allows the
HPET driver to attach on such systems.

PR:		262638
Reviewed by:	markj
MFC after:	1 month
2022-03-28 11:23:45 -04:00
Emmanuel Vadot
17ee6aca65 linuxkpi: Add llnode member in struct irq_work
This was added in Linux v5.8 and started to be used in drm code in v5.9

MFC after:	1 week
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-03-28 14:49:39 +02:00
Mateusz Guzik
bd7762c869 pf: add a rule rb tree
with md5 sum used as key.

This gets rid of the quadratic rule traversal when "keep_counters" is
set.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-28 11:45:03 +00:00
Mateusz Guzik
1a3e98a5b8 pf: pre-compute rule hash
Makes it cheaper to compare rules when "keep_counters" is set.
This also sets up keeping them in a RB tree.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-28 11:44:52 +00:00
Mateusz Guzik
93f8c38c03 pf: add pf_config_lock
For now only protects rule creation/destruction, but will allow
gradually reducing the scope of rules lock when changing the
rules.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-28 11:44:46 +00:00
Mateusz Guzik
2f968abce5 pf: include anchor path when hashing a rule
Otherwise all anchors hash to the same value.

Note this can result in checksum mismatches between pfsynced hosts,
but it has to be sorted out as the previously computed checksum
would fail to indicate changed anchors.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-28 11:44:39 +00:00
Alexander V. Chernikov
1b8b69508b routing: copy nexthop fib when changing existing nexthop
MFC after:	1 day
2022-03-28 11:32:30 +00:00
Andrew Turner
f461b95561 Fix a sign mismatch warning in the physmem code
Make sure both sides of a comparison are unsigned. As the values being
compared are size_t make the the value in the for loop size_t too.

Sponsored by:	The FreeBSD Foundation
2022-03-28 11:51:09 +01:00
Andrew Turner
029c1c4828 Treat cache write as a read in arm64 data faults
On arm64 we can ask the hardware to perform cache operations from
userspace. These require read permission however when the memory is
unmapped the kernel will receive a write exception. Add a check to
see if the cause of the exception is from the cache and pass a memory
read fault type to the vm subsystem.

PR:		262836
Reported by:	dch
Sponsored by:	The FreeBSD Foundation
2022-03-28 10:10:15 +01:00
Konstantin Belousov
c1a24b9dbe sys/stdatomic.h: be nicer to c++
Use of stdatomic.h is undefined in C++, even the C++ 2020 standard does not
list stdatomic.h as a C library header supported by the language.  More,
there are some subtle differences between the <atomic> C++ header, and
C11+ stdatomic.h provided features.

Nonetheless, it is a quality of the implementation aspect, so let mis-users
mis-use stdatomic.h as they want, by making a compat shim for _Bool.

PR:	262683
Reported by:	yuri
Reviewed by:	dim, emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34686
2022-03-28 03:16:02 +03:00
Gordon Bergling
1dc2c71ed8 netgraph(4): Fix a typo in a source code comment
- s/shapshot/snapshot/

MFC after:	3 days
2022-03-27 20:08:44 +02:00
Gordon Bergling
ef88adc527 pf(4): Fix a typo in a source code comment
- s/seaching/searching/

MFC after:	3 days
2022-03-27 19:57:49 +02:00
Gordon Bergling
1920133d8f mac_veriexec: Fix a typo in a source code comment
- s/seach/search/

MFC after:	3 days
2022-03-27 19:56:15 +02:00
Gordon Bergling
8eb774fe54 ath: Fix a typo in a source code comment
- s/ony/only/

MFC after:	3 days
2022-03-27 19:28:49 +02:00
Gordon Bergling
c1ad8a39a1 nfsclient: Fix a typos in source code comments
- s/ony/only/

Obtained from:	NetBSD
MFC after:	3 days
2022-03-27 19:27:05 +02:00
Mateusz Guzik
2533b5dc82 vfs: add missing bits to vdropl_impl
This completes the patch which was originally meant to go in.

Spotted by:	mhorne
Fixes: c35ec1efdc ("vfs: [1/2] fix stalls in vnode reclaim by not
requeieing from vnlru")
2022-03-27 14:35:37 +00:00
Mateusz Guzik
a4032e2a69 vfs: assorted tidy ups to lookup
No functional changes.
2022-03-26 17:06:09 +00:00
Alexander Leidinger
aeb91e95cf Log euid, rgid and jail on listen queue overflow
If you have numerous jails with multiple similar services running,
this helps to narrow down which services this log is referring to.
2022-03-26 11:17:55 +01:00
Eric van Gyzen
490b09f240 uma_zalloc_domain: call uma_zalloc_debug in multi-domain path
It was only called in the non-NUMA and single-domain paths.
Some of its assertions were duplicated in uma_zalloc_domain,
but some things were missed, especially memguard.

Reviewed by:	markj, rstone
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34472
2022-03-25 20:10:38 -05:00
Eric van Gyzen
aca2a7faca stack_zero is not needed before stack_save
The man page was recently clarified to commit to this contract.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2022-03-25 20:10:38 -05:00
Eric van Gyzen
a8cbb835bf uma_zalloc: assert M_NOWAIT ^ M_WAITOK
The uma_zalloc functions expect exactly one of [M_NOWAIT, M_WAITOK].
If neither or both are passed, print an error and a stack dump.
Only do this ten times, to prevent livelock.  In the future, after
this exposes enough bad callers, this will be changed to a KASSERT().

Reviewed by:	rstone, markj
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34452
2022-03-25 20:10:37 -05:00
Eric van Gyzen
863070bbf6 ksiginfo_alloc: pass M_WAITOK or M_NOWAIT to uma_zalloc
It expects exactly one of those flags.  A future commit will assert this.

Reviewed by:	rstone
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34451
2022-03-25 20:10:37 -05:00
Eric van Gyzen
cfbb5f8ce0 vm_ksubmap_init: pass M_WAITOK to vmem_init -> uma_zalloc_arg
uma_zalloc_arg expects exactly one of the two WAIT flags.  A future
commit will assert this.

Reviewed by:	rstone
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34450
2022-03-25 20:10:37 -05:00
Henri Hennebert
2e88306786 rtsx: Remove update of softc during probe and some var rename.
MFC after:	1 week
2022-03-25 15:24:49 -04:00
Mateusz Guzik
0f60088399 vfs: set cn_namelen when handling degenerate lookups
Turns out execve looks at it to store binary name, but in order to
trigger the problem one has to be trying to exec '/'. As is the value
would be left uninitialized (or rather set to -1 on debug kernels).

Fixes:	56244d3574 ("vfs: hoist degenerate path lookups out of the
loop")
2022-03-25 18:19:36 +00:00
John Baldwin
a7eb8afe9a Drop an OBE MP safe comment. 2022-03-25 10:01:39 -07:00
John Baldwin
b234b8d911 arm: Zero padding in mcontext_vfp_t in get_vfpcontext().
This can leak kernel stack data otherwise.

Reviewed by:	imp, markj
Sponsored by:	The University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34594
2022-03-25 09:57:20 -07:00
D Scott Phillips
220c48e2d9 Add the Ampere and Fujitsu arm64 implementer IDs
Reviewed By:	andrew, emaste
MFC after:	3 days
Sponsored by:	Ampere Computing
Differential Revision:	https://reviews.freebsd.org/D34666
2022-03-25 09:49:33 -07:00
D Scott Phillips
7be7bd6775 arm64: Add explicit barrier after address translation instruction
Following ARMARM sec D5.2.11, which says:

> Where an instruction results in an update to a System register,
> as is the case with the AT * address translation instructions,
> explicit synchronization must be performed before the result is
> guaranteed to be visible to subsequent direct reads of the
> PAR_EL1.

Reviewed By:	andrew
MFC after:	3 weeks
Sponsored by:	Ampere Computing
Differential Revision:	https://reviews.freebsd.org/D34665
2022-03-25 09:49:33 -07:00
D Scott Phillips
a693a30038 arm64: pmap: Mask VA operand in TLBI instructions
Bits 43:0 of the TLBI operand are bits 55:12 of the VA.  Leaving
bits 63:55 of the VA in bits 51:44 of the operand might wind up
setting the TTL field (47:44) and accidentally restricting which
translation levels are flushed in the TLB.

Reviewed By:	andrew
MFC after:	3 days
Sponsored by:	Ampere Computing
Differential Revision:	https://reviews.freebsd.org/D34664
2022-03-25 09:49:33 -07:00
Dmitry Chagin
ff39d74aa9 linux(4): Add AT_NO_AUTOMOUNT to statx.
Specific to Linux AT_NO_AUTOMOUNT flag tells the kernel to not automount the
terminal component of pathname if it is a directory that is an automount point.
As it is the default for FreeBSD silencly ignore this flag.

glibc-2.34 uses this flag in the stat64 system calls which is used by i386.

Reviewed by:		trasz
Differential revision:  https://reviews.freebsd.org/D31524
MFC after:		2 weeks
2022-03-25 17:54:23 +03:00
Dmitry Chagin
aae8ae5ea5 linprocfs: Eliminate bogus comment (KSE).
Reviewed by:		trasz, emaste
Differential revision:	https://reviews.freebsd.org/D31525
MFC after:		2 weeks
2022-03-25 17:53:08 +03:00
Kristof Provost
3468cd95ca pf: ether l3 rules can only use addresses
Disallow the use of tables in ethernet rules. Using tables requires
taking the PF_RULES lock. Moreover, the current table code isn't ready
to deal with ethernet rules.

Disallow their use for now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-25 11:13:47 +01:00
Navdeep Parhar
231f211240 cxgbe(4): Handle FORCE_FEC in pcaps correctly.
The firmware doesn't report FORCE_FEC in pcaps if the transceiver
plugged in at that time does not support a speed that may use FEC.  It
is incorrect for the driver to assume that the FORCE_FEC value it read
during attach (in init_link_config) is permanent.  Instead, it should
check pcaps just before issuing the L1CFG command.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-03-25 00:39:00 -07:00
Bjoern A. Zeeb
9d9ba2b79b LinuxKPI: 802.11: cleanup debugging
Cleanup some debugging.  Rename the global variable to be less
generic.  Hide all debugging behind #ifdef for now and turn off.
Rename the debugging sysctl so we can start adding more to the
subtree.

There is a need to change that wildly grown infrastructure into
something more homogenic soon but this should do for 13.1.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 19:13:45 +00:00
John Baldwin
931983ee08 x86: Add a NT_X86_SEGBASES register set.
This register set contains the values of the fsbase and gsbase
registers.  Note that these registers can already be controlled
individually via ptrace(2) via MD operations, so the main reason for
adding this is to include these register values in core dumps.  In
particular, this will enable looking up the value of TLS variables
from core dumps in gdb.

The value of NT_X86_SEGBASES was chosen to match the value of
NT_386_TLS on Linux.  The notes serve similar purposes, but FreeBSD
will never dump a note equivalent to NT_386_TLS (which dumps a single
segment descriptor rather than a pair of addresses) and picking a
currently-unused value in the NT_X86_* range could result in a future
conflict.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D34650
2022-03-24 11:36:19 -07:00
Bjoern A. Zeeb
196cfd0b2e LinuxKPI: 802.11: improve hw_scan fallback to sw_scan
Extending what was started in d3ef7fb459,
when a driver signals that hw_scan is not possible and expects a sw_scan
to be preformed we triggered a sw_scan towards the driver but did not
let net80211 know.
Cancel the initial scan towards net80211.  If we we defer to sw_scan
then clear IEEE80211_FEXT_SCAN_OFFLOAD so net80211 will send probe
requests, and actively start a new scan with net80211.
This may have to be further refined in the future but seems to work
for the moment.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 18:00:54 +00:00
Bjoern A. Zeeb
321735f451 LinuxKPI: 802.11: remove special handling for (*ic_scan_curchan)
Remove the originally disabling of (*ic_scan_curchan), which for iwlwifi
was not needed.  The condition always only was approximate.

A set IEEE80211_FEXT_SCAN_OFFLOAD will still prevent net80211 from sending
probe_reqs if handled by driver/firmware.
ic_scan_curchan will re-arm the timer to switch channels for drivers which
need it (e.g., rtw88, but that again is a NOP for iwlwifi).

So enabling ic_scan_curchan should not have further side effects for iwlwifi
but allow other drivers to work better.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 17:32:07 +00:00
Bjoern A. Zeeb
768dd32a16 LinuxKPI: 802.11: check IEEE80211_FEXT_SCAN_OFFLOAD on vap
When checking for IEEE80211_FEXT_SCAN_OFFLOAD, do so on the vap rather
than ic.  This brings us in line with what net80211 does.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 17:24:47 +00:00
Bjoern A. Zeeb
b2cf3c2125 LinuxKPI: 802.11: make lkpi_ic_set_channel() unconditional
For (*config)() based drivers not using chanctx we need to use
ic_set_channel() to switch channels.  So far this was disabled
based on scanning flags (as swscan is one of the initial use cases
for this function).  Now make it only dependent on (*config)()
for the moment to save us the work if (*config)() is not supported.

For iwlwifi (*config)() is a NOP so no functional changes there
but for other drivers such as rtw88 this will allow us to scan and
set the channel (which helps to receive on channels other than 1).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 17:02:44 +00:00
Ed Maste
a0cd78bf2c kbd: replace vestigial spl calls with Giant assertions
The keyboard driver was initially protected via spl* interrupt priority
calls but (as part of a comprehensive effort) migrated to use the Giant
lock (mutex).

The spl calls left behind became NOPs but they can be confusing as they
have no bearing on the actual mutual exclusion that is now present.

Remove them from kbd and add assertions that Giant is held.  markj notes
that there is conflation between the "bus topo" lock (which is Giant
under the hood) and Giant.  The assertions could either be addressed as
a small item along with bus topology locking work or they'll be removed
if kbd is decoupled from Giant.

PR:		206680
Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34645
2022-03-24 12:56:29 -04:00
Bjoern A. Zeeb
4a07abdeb8 LinuxKPI: 802.11: use cfg80211_chandef_create()
Rather than manually setting up a chandef and then effectively forcing
a memcpy, use cfg80211_chandef_create() to do the work for us entirely.
This works here as we do not store the resulting chandef separately
for other use.

While here remove a duplicate assignment in cfg80211_chandef_create().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 15:43:22 +00:00
Bjoern A. Zeeb
878fb1e575 LinuxKPI: 802.11: improve lkpi_80211_mo_sta_state() for non (*sta_state)
If a driver does not support (*sta_state)() we internally in
lkpi_80211_mo_sta_state() fall back to using (*sta_add/*sta_remove)().
In that case add tracking of both added_to_drv and state fields for the
lsta so that our state machine keeps working and assertions do not fire.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-24 15:34:57 +00:00
Bjoern A. Zeeb
246c398145 bhyve: Do not remove guest physical addresses from IOMMU host domain
This permits I/O devices on the host to directly access wired memory
dedicated to guests using passthru devices.  Note that wired memory
belonging to guests that do not use passthru devices has always been
accessible by I/O devices on the host.

bhyve maps guest physical addresses into the user address space of
the bhyve process by mmap'ing /dev/vmm/<vmname>.  Device models pass
pointers derived from this mapping directly to system calls such as
preadv() to minimize copies when emulating DMA.  If the backing store
for a device model is a raw host device (e.g. when exporting a raw disk
device such as /dev/ada<n> as a drive in the guest), the host device
driver (e.g. ahci for /dev/ada<n>) can itself use DMA on the host
directly to the guest's memory.  However, if the guest's memory is
not present in the host IOMMU domain, these DMA requests by the host
device will fail without raising an error visible to the host device
driver or to the guest resulting in non-working I/O in the guest.

It is unclear why guest addresses were removed from the IOMMU host domain
initially, especially only for VM's with a passthru device as the
host IOMMU domain does not affect the permissions of passthru devices,
only devices on the host.

A considered alternative was using bounce buffers instead (D34535
is a proof of concept), but that adds additional overhead for unclear
benefit.

This solves a long-standing problem when using passthru devices and
physical disks in the same VM.

Thanks to:	grehan (patience and help)
Thanks to:	jhb (for improving the commit message)
PR:		260178
Reviewed by:	grehan, jhb
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34607
2022-03-24 15:21:24 +00:00
Bjoern A. Zeeb
81d058df6d LinuxKPI: allow bsddriver name to be set for PCI
Allow a driver to overwrite the bsddriver name (we use for pci and
for wlan parent devices).  This allows us to to set
.bsddriver.name in struct pci_driver passed to module_pci_driver()
and with that set the BSD driver name while retaining the Linux .name
one.

This is helpful for divers which have different parts depending on
chipset and with that would change driver names which is highly
confusing especially for configuration.   One example is an upcoming
rtw88 driver which would be rtw_8822be or rtw_8822ce depending on
chipset.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste, hselasky
Differential Revision: https://reviews.freebsd.org/D34653
2022-03-24 15:19:15 +00:00
Mateusz Guzik
4ef6e56ae8 vfs: hoist trailing slash handling out of the loop 2022-03-24 14:36:31 +00:00
Mateusz Guzik
3b6792d28a vfs: factor symlink traversal out of namei
The intent down the road is to eliminate the loop to begin with,
pushing traversal down to vfs_lookup, all while not allocating the
extra buffer.
2022-03-24 13:11:22 +00:00
Mateusz Guzik
d9ea7e2b1e vfs: factor FAILIFEXISTS handling out of vfs_lookup 2022-03-24 11:22:20 +00:00
Mateusz Guzik
56244d3574 vfs: hoist degenerate path lookups out of the loop 2022-03-24 11:22:12 +00:00
Mateusz Guzik
2587b74c61 vfs: retire the NDF_ONLY_PNBUF flag
Consumers should use NDFREE_PNBUF instead.
2022-03-24 10:20:51 +00:00
Mateusz Guzik
bb92cd7bcd vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd) 2022-03-24 10:20:51 +00:00
Wojciech Macek
6ad638acd1 hardware: added Dell H840 raid support
Obtained from:		Stormshield
Differential revision:	https://reviews.freebsd.org/D34623
2022-03-24 07:13:45 +01:00
Henri Hennebert
9b261d2e0a rtsx: Display error if rtsx_read()/rtsx_write() fail.
MFC after:	1 week
2022-03-23 21:01:00 -04:00
Henri Hennebert
6b7718377b rtsx: Don't detach during shutdown
MFC after:	1 week
2022-03-23 20:58:38 -04:00
Ed Maste
a10c85e0f9 hda: whitespace fix for realtek pin patches 2022-03-23 20:54:51 -04:00
Ed Maste
da03ac41c9 sound: test PCM_REGISTERED before PCM_DETACHING
PCM_REGISTERED(d) tests that d is not NULL, so perform that check first
as we may have cases where devclass_get_softc has a null entry.

PR:		262671
Reviewed by:	hselasky
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34648
2022-03-23 20:10:00 -04:00
John Baldwin
b2cb74c22c arm,arm64: Add a NT_ARM_TLS read-only register set.
This register set exposes the per-thread TLS register.  It matches the
layout used by Linux on arm64.  Linux does not implement this note for
32-bit arm.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34595
2022-03-23 13:33:06 -07:00
John Baldwin
add00c381e Use a regset for NT_ARM_VFP.
This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34448
2022-03-23 13:33:06 -07:00
John Baldwin
a47fd6929f aarch64: Fix get_fpcontext32() to work on non-curthread.
Similar to fill_fpregs(), only invoke vfp_save_state() for curthread.

While here, zero the buffer if FP hasn't been started to avoid leaking
kernel stack memory.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34525
2022-03-23 13:33:06 -07:00
John Baldwin
b1cd03dd29 <sys/reg.h>: Add ELF32_REGSET.
This permits adding a register set for FREEBSD32 ABIs.

While here, include <sys/linker_set.h> to make this header more
self-contained in the kernel.

Reviewed by:	andrew, markj
Sponsored by:	The University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34536
2022-03-23 13:33:06 -07:00
Navdeep Parhar
41c4e1c7f7 cxgbe(4): Allow dump_cimla and dump_devlog to sleep.
This has been safe since e9e7bc8250, which moved parts of error
handling from the ithread to a taskqueue.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2022-03-23 11:18:44 -07:00
Bjoern A. Zeeb
67674c1cb1 LinuxKPI: 802.11: fix lkpi_lsta_dump() debugging
Fix two last-minute changes of d9f59799fc:
(1) for consitency name the debugging function lkpi_lsta_dump()
(2) pass in the original node (ni) rather than taking it from the lsta
    to avoid problems realted to bss_update as mentioned in the above
    commit.

No functional changes for users.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC with:	d9f59799fc
2022-03-23 17:18:00 +00:00
Bjoern A. Zeeb
6a8973c332 LinuxKPI: skbuff: fix skb_queue_splice_init()
In skb_queue_splice_init() we set a next value and then used that new
value to further update the remaining linking rather than the original
value.  Introduce another temporary variable 'n' to hold the original
value and use that.
While here rename q and h to from and to as otherwise it was too
confusing to read.

Also initialize skb->prev and skb->next to point to skb itself if
for nothing else at least to aid debugging.

Reported by:	phk (panic in iwl_txq_reclaim)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-23 17:18:00 +00:00
Mark Johnston
1babcad6bc elf: Avoid dumping uninitialized bytes in PRSTATUS core dump notes
elf_prstatus_t contains pad space.

Reported by:	KMSAN
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34606
2022-03-23 12:53:49 -04:00
Mark Johnston
7524994da0 callout: Remove the CS_EXECUTING flag
It is now unused.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34626
2022-03-23 12:37:02 -04:00
Mark Johnston
b319171861 setitimer: Fix exit race
We use the p_itcallout callout, interlocked by the proc lock, to
schedule timeouts for the setitimer(2) system call.  When a process
exits, the callout must be stopped before the process struct is
recycled.

Currently we attempt to stop the callout in exit1() with the call
_callout_stop_safe(&p->p_itcallout, CS_EXECUTING).  If this call returns
0, then we sleep in order to drain the callout.  However, this happens
only if the callout is not scheduled at all.  If the callout thread is
blocked on the proc lock, then exit1() will not block and the callout
may execute after the process has fully exited, typically resulting in a
panic.

I cannot see a reason to use the CS_EXECUTING flag here.  Instead, use
the regular callout_stop()/callout_drain() dance to halt the callout.

Reported by:	ler
Tested by:	ler, pho
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34625
2022-03-23 12:36:12 -04:00
Andrew Turner
6e1f7b9b38 Remove L2_BLOCK_MASK from arm64
It's unneeded as it was just used to align KERNBASE to a level 2
block start address. KERNBASE was already aligned correctly.

Sponsored by:	The FreeBSD Foundation
2022-03-23 15:33:05 +00:00
Andrew Turner
863f3220d0 Support EFIRT on arm64 with a non 4k page size
When the page size the kernel is built for is not the same as
EFI_PAGE_SIZE we need to increment the page index at a faster rate.

Add this adjustment to the arm64 EFIRT support in preperation for
experimental 16k PAGE_SIZE support.

Sponsored by:	The FreeBSD Foundation
2022-03-23 15:18:30 +00:00
Andrew Turner
16d5f9a164 Add an implementation of .mcount on arm64
To support cc -pg on arm64 we need to implement .mcount. As clang and
gcc think it is function like it just needs to load the arguments
to _mcount and call it.

On gcc the first argument is passed in x0, however this is missing on
clang so we need to load it from the stack. As it's the caller return
address this will be at a known location.

PR:		262709
Reviewed by:	emaste (earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34634
2022-03-23 15:16:59 +00:00
Emmanuel Vadot
f9413897cb linuxkpi: Add down_write_nest_lock
Simply calls down_write like in Linux (when CONFIG_DEBUG_LOCK_ALLOC isn't
specified)
Needed by drm v5.10

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D34642
2022-03-23 14:37:53 +01:00
Emmanuel Vadot
8e587a5f13 linuxkpi: Add kstrtouint_from_user
Like kstrtoint_from_user but for uint.
Needed by drm v5.10

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D34642
2022-03-23 14:37:32 +01:00
Emmanuel Vadot
9b8016548e linuxkpi: Add cond_resched_lock
If we need to resched it takes the lock, resched, release the lock
and returns 1, otherwise simply returns 0.

Needed by drm v5.9

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D34620
2022-03-23 14:36:55 +01:00
Greg Lehey
31e076d70b Add devices and quirks for some Olympus cameras.
Reviewed by:	hps@
Fixes:	   	Problems attaching Olympus cameras.
MFC after:	2 weeks
2022-03-23 12:40:28 +11:00
Bjoern A. Zeeb
d9f59799fc LinuxKPI: 802.11: rework sta state machine compatibility
Rework the state machine parts for various reasons:
(1) to add sta tracing to be able to better follow ni and lsta state
(2) factor out/implement lkpi_lsta_remove() to unlink the lsta and
    free the ni reference.
(3) avoid calling lkpi_disassoc() when you would think you should as
    changing BSS_CHANGED_ASSOC setting vif->bss_conf.assoc to false
    triggers a sta removal from firmware in iwlwifi which then triggers
    follow-up errors.  I do not understand why they use flags and state
    and ?? in parallel (too many options and ways to do things?).
(4) when "roaming" (or being disassoc/deauth) from an AP both net80211
    and apparently so mac80211 re-start with a new node/sta.  This
    results in us losing one or the other state in the compat layer
    or not updating firmware appropriately.  To resolve this make use
    of (a) the newly introduced (*iv_update_bss)() and (b) always tear
    a station down to "State 1" (INIT/SCAN/pre-AUTH) and only if needed
    re-create the new one (if we go to AUTH).
    A slightly earlier version has survived a night of wpa_supplicant
    and hostapd fighting each other over disassoc and deauth and
    re-associating/authorizing.

While there update a few comments and typos and do a few minor auxiliary
changes which are hard or not worth to extract.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
fa8f007de9 LinuxKPI: 802.11: factor out dtim/tsf updates
Factor out dtim/tsf setting/updates into lkpi_update_dtim_tsf()
with tracing and add an extra update call.
This avoids some code duplication and puts maintainance into a
single place.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
4f61ef8b78 LinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc()
Split lkpi_ic_node_alloc() into two functions to make the code simpler
and to allow lkpi_lsta_alloc() to be re-used from another part of the
code related to (*iv_update_bss)().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
bb81db90f7 LinuxKPI: 802.11: implement ieee80211_beacon_loss()
Implement ieee80211_beacon_loss() similar to
ieee80211_connection_loss() with different state handling.
While here leave a comment in connection_loss() about the state
change argument.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
91b4225aa1 net80211: introduce (*iv_update_bss)()
Introduce (*iv_update_bss)() with a default implementation to allow
drivers to overload/intercept the time when we swap iv_bss.

This helps firmware based drivers to synchronize state with firmware.
Otherwise, for some state changes, we begin with one ni (and in
LinuxKPI lsta) and try to finish with another ni (and a new lsta
in different state) and may no longer have access to the previous state.
This also saves us from constantly checking for ni changes complicating
code.

No functional changes intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC:		move (*iv_update_bss) to spare area
2022-03-22 18:51:43 +00:00
Bjoern A. Zeeb
453d1a90f8 net80211: improve one debug logging
When forcing DEUATH in ieee80211_sta_join1() log the current state
we are coming from as well.  Note this isn't always the state we
are expecting as iv_state was updated already, so contrary to the
comment we usually do not see RUN there.
Leave a comment earlier with regards to this as well.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-22 18:51:43 +00:00
Andrew Turner
83961b7ede Remove the unused arm64 kernel profiling code
It's unused. Remove it in preperation for userspace support.

Sponsored by:	The FreeBSD Foundation
2022-03-22 16:07:54 +00:00
Sebastien Bini
231237bbb0 neta: split fixed and in-band link status configuration
Fixed-link mode requires different handling than the in-band
managed connection. Update interrupt, link-up/down and
autonegotiation settings for the former.

Reviewed by: mw
MFC after: 1 week
Obtained from: Stormshield
Differential Revision: https://reviews.freebsd.org/D34394
2022-03-22 16:52:31 +01:00
Mike Karels
04cd74b4cd IPv4 multicast: fix netstat -g
The vif structure includes fields at the end which are #ifdef KERNEL,
causing a mismatch between the structure sizes between kernel and
user level.  netstat -g failed with an ENOMEM on the sysctl to fetch
the vif table.  Change the vif sysctl code in ip_mroute to copy out
only the user-level-visible portion of each table entry.

Reviewed by:	bz, wma
Differential Revision: https://reviews.freebsd.org/D34627
2022-03-22 07:38:01 -05:00