Commit Graph

273564 Commits

Author SHA1 Message Date
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
Piotr Kubaj
18f71c9b27 riscv: fix riscv64sf build
The library needs to have sf suffix cut off.

MFC after:	3 days
X-MFC with:	3781e77995
Differential revision:	https://reviews.freebsd.org/D34561
Reviewed by:	dim
2022-03-24 15:25:41 +01: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
Piotr Kubaj
9b597132ae Merge LLVM commit c03fdd340356 to fix lang/rust on powerpc
Summary:
Without it building rust fails with:
ld: error: CallSiteSplitting.cpp:(function llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<std::__1::pair<llvm::ICmpInst*, unsigned int>, 2u> > >::operator=(llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<std::__1::pair<llvm::ICmpInst*, unsigned int>, 2u> > >&&): .text._ZN4llvm15SmallVectorImplINSt3__14pairIPNS_10BasicBlockENS_11SmallVectorINS2_IPNS_8ICmpInstEjEELj2EEEEEEaSEOSB_+0xB0): relocation R_PPC_PLTREL24 out of range: -33582208 is not in [-33554432, 33554431]

This will need to be merged to releng/13.1.

Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D34652
MFC after:	3 days
2022-03-24 09:06:12 +01: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
Li-Wen Hsu
0088bc444e
DTrace test: skip flakey common.misc.t_dtrace_contrib.tst_dynopt_d in CI
PR:		237641
Sponsored by:	The FreeBSD Foundation
2022-03-24 11:37:50 +08:00
Li-Wen Hsu
e62aee66b0
DTrace test: Add a new keyword SKIPCI to gentest.sh
This is for marking a test case is flakey and should not be executed in
the CI environment.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34635
2022-03-24 11:30:27 +08: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
Farhan Khan
4b1e2c2f77 bsdinstall(8): Usage example of tar doesn't work
The order of arguments in the example does not work, because tar thinks
the directory is named -C, which does not exist and reports:
tar: Error opening archive: Failed to open '-C'

Approved by:	rpokala@ (src) on IRC
Differential Revision:	https://reviews.freebsd.org/D34649
2022-03-23 21:59:53 +01: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
Alfonso S. Siciliano
0e5c72c3cc
bsdinstall time: Replace dialog with bsddialog
Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility,
'dialog --calendar' is replaced by 'bsddialog --datebox' with same
features but different User Interface.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34583
2022-03-23 16:56:37 +01: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
Alfonso S. Siciliano
4d1ba6febf
bsdinstall hardening: Replace dialog with bsddialog
bsdinstall/scripts/hardening: Replace (LGPL) dialog utility with
(BSD-2-CLAUSE) dialog utility.

Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34102
2022-03-23 00:58:48 +01:00
Brooks Davis
44b36b80f5 test-includes: improve portability
FreeBSD's shell permits [^bar] to match characters not in [bar] like
common regular expressions. This is non-portable and '!' should be
used in place of '^' for portability.

Reported by:	Nathaniel Wesley Filardo
Issue:		https://github.com/CTSRD-CHERI/cheribsd/issues/1321
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34597
2022-03-22 20:23:22 +00:00
Jens Schweikhardt
8422d54f40 Correct a handful of typos and grammos. 2022-03-22 21:12:42 +01: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