1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00
Commit Graph

138847 Commits

Author SHA1 Message Date
Andrew Turner
bc98adaf6a Check cpu_softc is not NULL before dereferencing
In the acpi_cpu_postattach SYSINIT function cpu_softc may be NULL, e.g.
on arm64 when booting from FDT. Check it is not NULL at the start of
the function so we don't try to dereference a NULL pointer.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4e50efb194)
2022-01-04 13:08:58 -05:00
Alexander Motin
6b06f8a792 amdtemp: Revert related part of "Make CPU children" commit.
While it still looks like previous code worked by coincidence, this
change broke things even more instead of fixing.

Reported by:	avg@
MFC after:	1 week

(cherry picked from commit 94a72c5ac4)
2022-01-04 12:21:49 -05:00
Alexander Motin
a77188ffd3 acpi_cpu: Fix panic if some CPU devices are disabled.
While there, remove couple unneeded global variables.

(cherry picked from commit 695323ae88)
2022-01-04 12:21:46 -05:00
Alexander Motin
b7668d009e Make CPU children explicitly share parent unit numbers.
Before this device unit number match was coincidental and broke if I
disabled some CPU device(s).  Aside of cosmetics, for some drivers
(may be considered broken) it caused talking to wrong CPUs.

(cherry picked from commit d3a8f98acb)
2022-01-04 12:21:42 -05:00
Alexander Motin
083a2ff0f0 acpi_cpu: Make device unit numbers match OS CPU IDs.
There are already APIC ID, ACPI ID and OS ID for each CPU.  In perfect
world all of those may match, but at least for SuperMicro server boards
none of them do.  Plus none of them match the CPU devices listing order
by ACPI.  Previous code used the ACPI device listing order to number
cpuX devices.  It looked nice from NewBus perspective, but introduced
4th different set of IDs. Extremely confusing one, since in some places
the device unit numbers were treated as OS CPU IDs (coretemp), but not
in others (sysctl dev.cpu.X.%location).

(cherry picked from commit c8077ccd70)
2022-01-04 12:21:35 -05:00
Alexander Motin
d97bfe3ff8 bus: Cleanup device_probe_child()
When device driver probe method returns 0, i.e. absolute priority, do
not remove its class from the device just to set it back few lines
later, that may change the device unit number, etc. and after which
we'd better call the probe again.

If during search we found some driver with absolute priority, we do
not need to set device driver and class since we haven't removed them
before.

It should not happen, but if second probe method call failed, remove
the driver and possibly the class from the device as it was when we
started.

Reviewed by:	imp, jhb
Differential Revision:	https://reviews.freebsd.org/D32125

(cherry picked from commit f73c2bbf81)
2022-01-04 12:10:55 -05:00
Warner Losh
dd39806d1d bus: Fix LINT / BUS_DEBUG build
Fix 0389e9be63 for LINT built. Removed an arg only from code
under BUS_DEBUG w/o rebuilding LINT...

Sponsored by:		Netflix
Fixes: 0389e9be63

(cherry picked from commit 67a9e76da6)
2022-01-04 12:10:42 -05:00
Warner Losh
7be46aeea1 bus: retire DF_REBID
I did DF_REBID to allow for 'hoover' drivers that would attach to
otherwise unattached devices in the tree. This notion didn't catch on as
it was tricky to make work well and it was easier to just publish a /dev
node of some flavor by the parent device. It's been nothing but dead
weight for a long time.

Reviewed by:		mav
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32056

(cherry picked from commit 0389e9be63)
2022-01-04 12:00:53 -05:00
Andrew Turner
7b7f391db4 Allow ddb and dtrace use the DMAP region on arm64
When writing to memory on arm64 we may be trying to be accessing a
read-only page. In this case try to access via the DMAP region to
get a writable location.

While here simplify writing data in DDB and stop trashing the size as
it is passed into the cache handling functions.

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

(cherry picked from commit 3d2533f5c2)
2022-01-04 10:49:51 +00:00
Andrew Turner
713b7f1a3b Add atomic_testandset_acq_* on arm64
We only need to include sys/_atomic_subword.h on arm64 to provide
atomic_testandset_acq_long. Add an implementation in the arm64 atomic.h
based on the existing atomic_testandset macro.

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

(cherry picked from commit 02c16e2174)
2022-01-04 10:08:32 +00:00
Andriy Gapon
2de6637133 aw_spi: improve I/O stability
This driver does not use DMA at the moment, so some care is needed to
prevent TX FIFO underruns and RX FIFO overflows.
Several improvements are done in oder to minimize chances of those.

First, the interrupt handling is moved to a filter to minimize latency.
Second, FIFO trigger thresholds are configured for both FIFOs.
The TX FIFO threshold is set to 3/4-th of its size and the RX FIFO
threshold is set to 1/4-th of its size.
The interrupt conditions are changed from the empty FIFO and full FIFO
for the TX and RX correspondingly to going below and above the thresholds.

While here I renamed AW_SPI_IER_RF_ERQ to AW_SPI_IER_RF_RDY which is
closer to what the documentation uses, RF_RDY_INT_EN in the interrupt
control register and RX_RDY in the interrupt status register.

(cherry picked from commit 08ff54dc5b)
2022-01-03 10:47:59 +02:00
Alan Somers
8ec62f0614 nfs: don't truncate directory cookies to 32-bits in the NFS server
In NFSv2, the directory cookie was 32-bits.  NFSv3 widened it to
64-bits and SVN r22521 widened the corresponding argument in
VOP_READDIR, but FreeBSD's NFS server continued to treat the cookies as
32-bits, and 0-extended to fill the field on the wire.  Nobody ever
noticed, because every in-tree file system generates cookies that fit
comfortably within 32-bits.

Also, have better type safety for txdr_hyper.  Turn it into an inline
function that type-checks its arguments.  Prevents warnings about
shift-count-overflow.

PR:		260375
Reviewed by:	rmacklem
Differential Revision: https://reviews.freebsd.org/D33404

(cherry picked from commit 32fbc5d824)
2022-01-02 20:09:15 -07:00
Alan Somers
642399932d fusefs: invalidate the cache during copy_file_range
FUSE_COPY_FILE_RANGE instructs the server to write data to a file.
fusefs must invalidate any cached data within the written range.

PR:		260242
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33280

(cherry picked from commit 41ae9f9e64)
2022-01-02 20:03:54 -07:00
Alan Somers
d056bc6f40 fusefs: inline fuse_io_dispatch
This function was always confusing, because it created an H-shaped
callgraph: two functions called in and left via different paths based on
which which called.

(cherry picked from commit dc433e1530)
2022-01-02 19:54:39 -07:00
Alan Somers
139764c461 fusefs: correctly handle an inode that changes file types
Correctly handle the situation where a FUSE server unlinks a file, then
creates a new file of a different type but with the same inode number.
Previously fuse_vnop_lookup in this situation would return EAGAIN.  But
since it didn't call vgone(), the vnode couldn't be reused right away.
Fix this by immediately calling vgone() and reallocating a new vnode.

This problem can occur in three code paths, during VOP_LOOKUP,
VOP_SETATTR, or following FUSE_GETATTR, which usually happens during
VOP_GETATTR but can occur during other vops, too.  Note that the correct
response actually doesn't depend on whether the entry cache has expired.
In fact, during VOP_LOOKUP, we can't even tell.  Either it has expired
already, or else the vnode got reclaimed by vnlru.

Also, correct the error code during the VOP_SETATTR path.

PR:		258022
Reported by:	chogata@moosefs.pro
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33283

(cherry picked from commit 25927e068f)
2022-01-02 19:36:38 -07:00
Alexander Motin
2572b6bd6b xen/blkfront: Remove CTLFLAG_NEEDGIANT from sysctl.
It only converts bit field into string.  It does not need locking.

MFC after:	1 week

(cherry picked from commit 54daceab55)
2022-01-02 16:39:28 -05:00
Konstantin Belousov
682886d111 amd64 sigtramp: comment-out annotations for registers with DWARF number >= 32
(cherry picked from commit 642f77be1d)
2022-01-02 21:03:01 +02:00
Konstantin Belousov
75d7ca8a10 Enforce that vdso does not contain runtime relocations
(cherry picked from commit d49b75d0d6)
2022-01-02 18:43:02 +02:00
Konstantin Belousov
4d0b07d001 Enforce that vdso does not consume too much from the shared page
(cherry picked from commit b0e0b4e7b3)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
9cbd1c32b1 amd64 ia32 vdso: add unwind annotations to the signal trampoline
(cherry picked from commit 8a4bd7f818)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
0510df0ea4 amd64 native vdso: add unwind annotations to the signal trampoline
(cherry picked from commit 5b8918fac6)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
e163ee6ef5 Add kern.elf{32,64}.vdso knobs to enable/disable vdso preloading
(cherry picked from commit eb02958748)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
e85becdf19 vdso for ia32 on amd64
(cherry picked from commit 98c8b62524)
2022-01-02 18:43:01 +02:00
Justin Hibbits
8851242d9d Fix assert check for SV_DSO_SIG in exec_sysvec_init_secondary()
(cherry picked from commit d2de68811a)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
d00ebd9b9c Pass vdso address to userspace
(cherry picked from commit 01c77a436e)
2022-01-02 18:43:01 +02:00
Konstantin Belousov
203bcad731 amd64: wrap 64bit sigtramp into vdso
(cherry picked from commit ab4524b3d7)
2022-01-02 18:43:01 +02:00
Dmitry Chagin
25904983e8 Remove bogus cast from exec_sysvec_init().
(cherry picked from commit b39fa4770d)
2022-01-02 18:43:01 +02:00
Dmitry Chagin
0ceca7923f Modify exec_sysvec_init() to allow non-native abi to setup their sysentvecs.
(cherry picked from commit 21629e2a45)
2022-01-02 18:43:00 +02:00
Konstantin Belousov
7d71f45927 amd64 get_mcontext(): third argument to get_fpcontext() is a pointer
(cherry picked from commit 76ef4f6348)
2022-01-02 18:43:00 +02:00
Konstantin Belousov
0af1cbb038 itimers: strip unused bits from struct itimer and struct itimers
(cherry picked from commit 23ba59fbfb)
2022-01-02 18:43:00 +02:00
Konstantin Belousov
840b422b7c itimers_alloc: no need to initialize its_timers array
(cherry picked from commit 3f15708478)
2022-01-02 18:43:00 +02:00
Mark Johnston
2f9116e480 fd: Initialize more export_fd_buf fields in kern_proc_cwd_out()
In particular, we need to initialize efbuf->flags, since
export_vnode_to_sb() loads that field.  This was mostly harmless since
the flag only determines whether the output kinfo_file is packed, and
KERN_PROC_CWD only ever emits a single kinfo_file anyway.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 327060bd77)
2021-12-31 09:26:07 -05:00
Mark Johnston
7a06849669 unix: Increase the default datagram recv buffer size
syslog(3) was recently change to support larger messages, up to 8KB.
Our syslogd handles this fine, as it adjusts /dev/log's recv buffer to a
large size.  rsyslog, however, uses the system default of 4KB.  This
leads to problems since our syslog(3) retries indefinitely when a send()
returns ENOBUFS, but if the message is large enough this will never
succeed.

Increase the default recv buffer size for datagram sockets to support
8KB syslog messages without requiring the logging daemon to adjust its
buffers.

PR:		260126
Reviewed by:	asomers
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d157f2627b)
2021-12-31 09:25:54 -05:00
Bjoern A. Zeeb
9d96f4d349 iwlwifi: attach to the build
Add iwlwifi and iwlwififw to the module builds.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7d4394cbe7)
2021-12-30 18:29:01 +00:00
Bjoern A. Zeeb
eaa27f02da iwlwifi: plug memory modified after free
In certain situations we saw a memory modified after free.  This was
tracked down to a pointer not NULLed after free and used in a different
code path.  It is unclear how the race happens pending further
investigation but setting the pointer to NULL after free and adding a
check in the 2nd code path handling the case gracefully helps for now.

While here improve another debug messge in sta handling.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 586c8e3233)
2021-12-30 18:28:51 +00:00
Bjoern A. Zeeb
96e43f01b7 iwlwifi: cherry-pick fixes from upstream iwlwifi-next
Cherry-pick f973795a8d19cbf3d03807704eb7c6ff65788d5a (Fix a double free
in iwl_txq_dyn_alloc_dma), db66abeea3aefed481391ecc564fb7b7fb31d742
(synchronize with FW after multicast commands),
d5d8ee526d1401173ad1261c3b6388a4f947e0a3 (remove session protection
upon station removal), and 8e967c137df3b236d2075f9538cb888129425d1a
(avoid clearing a just saved session protection id).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8f06a2b550)
2021-12-30 18:28:42 +00:00
Bjoern A. Zeeb
fde1b5236f iwlwifi: turn off broadcast filtering for now
Turn off broadcast filtering in iwlwifi for now as it gives me
or rather the firmware headaches.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c6ea5aed79)
2021-12-30 18:28:21 +00:00
Bjoern A. Zeeb
8099a895d9 iwlwifi: also depend on linuxkpi_wlan
The 802.11 compat code is split off linuxkpi.ko into linuxkpi_wlan.ko
in case it is built as a module.  Depend on that.
While here adjust our module to a longer version to avoid conflicts.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 81ff67ffbe)
2021-12-30 18:28:11 +00:00
Bjoern A. Zeeb
f4290ef2a3 iwlwifi: remove copyright and license from Makefiles
We do not generally protect the Makefiles like this.
Remove the details and go with project style.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ca8bf0e8d6)
2021-12-30 18:27:56 +00:00
Bjoern A. Zeeb
f8612fa7e0 LinuxKPI: add 802.11 compat code
Add 802.11 compat code for mac80211 and to a minimal degree cfg80211.
This allows us to compile and use basic functionality of wireless
drivers such as iwlwifi.

This is a constant work in progress but having it in the tree will
allow others to test and more easy to track changes and avoid having
snapshots no longer applying to branches.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6b4cac814e)
2021-12-30 18:27:45 +00:00
Bjoern A. Zeeb
fb3c236a4b LinuxKPI: import beginning of a new version of netdevice.h
Import a netdevice update complementing the last remaining bits of
the old ifnet derived implementation.  Along add a (for now) task
based NAPI implementation.

This is the minimal set of chnages which are needed for the initial
support of wireless drivers.  The NAPI implementation has an option to
still switch to "direct dispatch" as it had been used by these drivers
before not relying on a deferred context along with some printf tracing.
This has been helpful in the last weeks for debugging and will be
cleaned once we have had broader testing and are sure this is fine as-is.
Should we need a more time-sensitive or load-sensitive response
in the future we can always switch to something more sophisticated.

Sponsored by:		The FreeBSD Foundation
X-Differential Revision: D33075 (abandoned without feedback a while ago)

(cherry picked from commit d105895844)
2021-12-30 18:27:31 +00:00
Bjoern A. Zeeb
508c4fb4c3 LinuxKPI: add a work-in-progress skbuff implementation
This is a work-in-progress implementation of sk_buff compat code
used for wireless drivers only currently.
Bring in this version of the code as it has proven to be good enough
to have packets going for a few months.

The current implementation has several drawbacks including the need
for us to copy data between sk_buffs and mbufs.
Do not rely on the internals of this implementation.  They are highly
likely to change as we will improve the integration to FreeBSD mbufs.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 49ed6e979c)
2021-12-30 18:27:19 +00:00
Bjoern A. Zeeb
e56099769d net80211: adjust a printf to toeee80211_note
Throughout net80211 there are multiple ways to log (debugging)
information.  Start to clenaup one as I kept hitting it to harmonize
the output.  The more we get away from printfs into either wrapper
functions or macros the more likely we can use holistic systematic
tracing in the future.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2e59c9c7f0)
2021-12-30 18:27:02 +00:00
Bjoern A. Zeeb
de4b87bb78 net80211: add debugging information
Add more STATE / DEBUG probes and enhance the output of one in order
to track state changes triggered by "ack" (or not).
This helped to narrow down causes from drivers or the LinuxKPI 802.11
compat framework which kept us in a scan -> auth -> scan loop.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 04efa18f83)
2021-12-30 18:26:53 +00:00
Bjoern A. Zeeb
277ecc2488 net80211: format debug functions as single line
Making use of the debug output was hard given debug lines were run in
parts through vlog (if_printf) and in (multiple) parts through printf(s).

Like some of the functions alreay have, use a local buffer to format
the string and then use a single if_printf;  in addition given these
functions are debug-only, add an extra printf in case we find our
buffers still to be too small so we can adjust for the future.
We already found that 128 characters are to short for some log messages.
Bump the buffer sizes collectively to 256 characters which also is
the maximum of if_vlog() so getting longer would need further changes
elsewhere.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 04435a1b14)
2021-12-30 18:26:42 +00:00
Bjoern A. Zeeb
3fa5cdffcc net80211: fix debug printf
We are printing %p in _db_show_sta(), there is no need to prefix it
with 0x again to get a 0x0x...

Spsonsored by:	The FreeBSD Foundation

(cherry picked from commit e51b46cefb)
2021-12-30 18:26:33 +00:00
Bjoern A. Zeeb
a34668185b modules: increase MAXMODNAME and provide backward compat
With various firmware files used by graphics and wireless drivers
we are exceeding the current 32 character module name (file path
in kldxref) length.
In order to overcome this issue bump it to the maximum path length
for the next version.
To be able to MFC provide backward compat support for another version
of the struct as the offsets for the second half change due to the
array size increase.

MAXMODNAME being defined to MAXPATHLEN needs param.h to be
included first.  With only 7 modules (or LinuxKPI module.h) not
doing that adjust them rather than including param.h in module.h [1].

Reported by:	Greg V (greg unrelenting.technology)
Sponsored by:	The FreeBSD Foundation
Suggested by:	imp [1]
Reviewed by:	imp (and others to different level)
Differential Revision:	https://reviews.freebsd.org/D32383

(cherry picked from commit df38ada293)
2021-12-30 18:26:18 +00:00
Bjoern A. Zeeb
baf6251f27 iwlwifi: import Intel's iwlwifi/mvm driver.
Over the past few months we published multiple snapshots for this
Linux derived driver and it has become fairly stable in terms of
minimal local changes needed for new updates.

The current version is based on iwlwifi-next update at
cbaa6aeedee5f92dafa5982eceea2a1f98ce4f7d with the addition of
a hand full of files replaced for FreeBSD.

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

Do not yet hook this to the build until the remaining compat code
is all in.  Along with the firmware import this will make publishing
the last bits and final testing a lot easier.

Sponsored by:   The FreeBSD Foundation
Approved by:    core (imp) [1]

(cherry picked from commit bfcc09ddd4)
2021-12-30 18:26:05 +00:00
Bjoern A. Zeeb
6e83e1cead iwlwifi: import firmware for Intel iwlwifi/mvm supported chipsets.
Import the most recent versions of the firmware images for iwlwifi
chipsets supported by the "mvm" sub-driver.
This is based on linux-firmware at f5d519563ac9d2d1f382a817aae5ec5473811ac8.
The license of the firmware matches the previous iwnfw(4) and
iwmfw(4) firmware files and you can find a copy in
sys/contrib/dev/iwlwififw/LICENCE.iwlwifi_firmware .

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.
There is an open issue concerning kldxref that we need to resolve
(D32383).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f4c129f5fb)
2021-12-30 18:25:46 +00:00
Bjoern A. Zeeb
2c6ebb7834 LinuxKPI: USB return possible error from suspend/resume
USB suspend/resume cannot fail so we never returned the error which
resulted in a -Wunused-but-set-variable warning.
Initialize the return variable and return a possible error possibly
triggering a printf upstream to at least have a trace of the problem.
This also fixes the warning.

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

(cherry picked from commit 943df073a3)
2021-12-30 18:25:28 +00:00