Commit graph

138964 commits

Author SHA1 Message Date
Bjoern A. Zeeb
ccda5ec945 LinuxKPI: 802.11 handle connection loss differently
Rather than just bouncing back to SCAN bounce to INIT on connection
loss.  This is should be refined in the future as the comment already
indicates but we need to tie two different worlds together.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f3229b62a1)
2022-01-20 14:05:17 +00:00
Michal Meloun
d6529c0d12 pci_dw_mv: Don't enable unhandled interrupts.
Mainly link errors interrupts should only be activated on fully linked port,
otherwise noise on lanes can cause livelock. But we don't have error
counters yet, so leave these interrupts disabled.

(cherry picked from commit ce5a4083de)
2022-01-20 11:35:51 +01:00
Michal Meloun
139afdb172 simple_mfd: switch to controllable locking for syscon provider.
MFC after	3 weeks

(cherry picked from commit f97f57b518)
2022-01-20 11:34:28 +01:00
Michal Meloun
40a0633862 mvebu_gpio: Fix settings of gpio pin direction.
Data Output Enable Control register is inverted – 0 means output direction.
Reflect this fact in code.

MFC after:	3 weeks

(cherry picked from commit 01c6d79189)
2022-01-20 11:22:30 +01:00
Michal Meloun
9ddb35ef1f mvebu_gpio: Multiple fixes.
- gpio register access primitives
- locking in interrupt path
- cleanup

In cooperation with: mw
Reviewed by:	mw (initial version)
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D29044
Differential Revision:	https://reviews.freebsd.org/D28911

(cherry picked from commit a5dce53b75)
2022-01-20 11:22:04 +01:00
Marcin Wojtas
8c12f9dea1 mvebu_gpio: fix interrupt cause register configuration
According to Armada 8k documentation, the interrupt cause register
(at offset 0x14) is RW0C. Update the configuration in attach and
the mvebu_gpio_isrc_eoi() to follow the description.

Reviewed by: mmel
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D29013

(cherry picked from commit 819760b35f)
2022-01-20 11:21:42 +01:00
Michal Meloun
f84b424eaf tegra/ahci: do not advertise enclosure management facility
It is not implemented in HW.

MFC after:	1 week

(cherry picked from commit 6e9119768d)
2022-01-20 11:15:47 +01:00
Michal Meloun
7a647bb045 tegra124: Implement new get_gate method for tegra124 clocks.
MFC after:	1 week

(cherry picked from commit be01656fa4)
2022-01-20 11:15:15 +01:00
Michal Meloun
6f63b227bd tegra210: Implement new get_gate method for tegra210 clocks.
MFC after:	1 week

(cherry picked from commit 7c0ec66385)
2022-01-20 11:14:53 +01:00
Michal Meloun
f277be277d extres/clk: Add a method to detect the HW state of the clock gate.
- add method to read gate enable/disable staust from HW
- show gate status in sysctl clock dump

MFC after:	1 week

(cherry picked from commit 1a74d77f85)
2022-01-20 11:14:22 +01:00
Michal Meloun
3d4b9e5fa1 extres/clk: Improve sysctl dump of clocks.
Always recalculate the frequency, the cache is lazily initialized so it is not always up to date.
While I'm in mark sysctl as MPSAFE.

Discussed with:	manu, adrian
MFC after:	1 week

(cherry picked from commit 72a2f3b5e2)
2022-01-20 11:14:04 +01:00
Michal Meloun
79631b49ee arm: Fix handling of undefined instruction aborts in THUMB2 mode.
Correctly recognize NEON/SIMD and VFP instructions in THUMB2 mode and pass
these to the appropriate handler. Note that it is not necessary to filter
all undefined instruction variant or register combinations, this is a job
for given handler.

Reported by:	Robert Clausecker <fuz@fuz.su>
PR:		259187
MFC after:	2 weks

(cherry picked from commit a670e1c13a)
2022-01-20 11:12:36 +01:00
Michal Meloun
a5e76683b2 dwmmc: Calculate the maximum transaction length correctly.
We should reserve two descriptors (not MMC_SECTORS) for potentially
unaligned (so bounced) buffer fragments, one for the starting fragment
and one for the ending fragment.

Submitted by:	kjopek@gmail.com
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30387

(cherry picked from commit dfb7360222)
2022-01-20 11:11:17 +01:00
Michal Meloun
8e3cc69a4e booti: Enable loading the kernel image to any address aligned to 2 MB
We've supported this for a long time, plus most u-boot setups quietly expect

MFC after:	2 weeks

(cherry picked from commit b07a6bd15a)
2022-01-20 11:10:21 +01:00
Michal Meloun
2ace1585b0 intrng: remove now redundant shadow variable.
Should not be a functional change.

Submitted by: 	ehem_freebsd@m5p.com
Discussed in:	https://reviews.freebsd.org/D29310
MFC after:	4 weeks

(cherry picked from commit e88c3b1b02)
2022-01-20 11:08:45 +01:00
Michal Meloun
a3ccd06dd9 intrng: Releasing interrupt source should clear interrupt table full state.
The first release of an interrupt in a situation where the interrupt table
is full should schedule a full table check the next time an interrupt is
allocated. A full check is necessary to ensure maximum separation between
the order of allocation and the order of release.

Submitted by:	ehem_freebsd@m5p.com (initial version)
Discussed in:	https://reviews.freebsd.org/D29310
MFC after:	4 weeks

(cherry picked from commit a49f208d94)
2022-01-20 11:07:44 +01:00
Michal Meloun
57dd17dd60 Fix error value returned by ofw_bus_gen_get_node().
By definition ofw_bus_get_node() should  consistently return -1 when there
is no associated OF node.

MFC after:	4 weeks
Discussed with:	nwhitehorn
Analyzed in: 	https://reviews.freebsd.org/D30761

(cherry picked from commit 3eae4e106a)
2022-01-20 11:00:55 +01:00
Mitchell Horne
d25147c01a riscv: gdb(4) support
Add the MD portion required for the gdb stub.

Reviewed by:	jhb (earlier version)
Discussed with:	jrtc27
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33734

(cherry picked from commit d72e944812)
2022-01-19 14:30:31 -04:00
Cy Schubert
d600d25179 ipfilter: Fixup comment
Fix comment documenting checksum block in ip_nat.c. Fastforward doesn't
perform checksum.

(cherry picked from commit 896a015319)
2022-01-19 06:19:24 -08:00
Cy Schubert
e4b354592f ipfilter: Fix whitespace errors
(cherry picked from commit 6af38b34e4)
2022-01-19 06:19:24 -08:00
Cy Schubert
d9bb426ca0 ipfilter: Fix IP header checksums post ftp proxy
Don't assume checksums will be calculated later in fastforward.

(cherry picked from commit 2a6465245f)
2022-01-19 06:19:24 -08:00
Cy Schubert
27f33d90b7 ipfilter: Correct function description
Correct the parameters descriptions for ipf_fix_outcksum and
ipf_fix_incksum.

(cherry picked from commit 4b5c0c9b81)
2022-01-19 06:19:24 -08:00
Andriy Gapon
08956b8362 mmc_da: remove write-only local variables
(cherry picked from commit dfb1c97ab9)
2022-01-19 08:57:31 +02:00
Kirk McKusick
d78723738b When doing a read-only mount of a UFS filesystem using gjournal(8),
suppress error message about a missing gjournal provider.

Submitted by: Andreas Longwitz
Sponsored by: Netflix

(cherry picked from commit 1fbcaa13b0)
2022-01-18 15:13:42 -08:00
Mark Johnston
3f85c51824 swap_pager: uma_zcreate() doesn't fail
Remove always-false checks for UMA zone creation failure.  No functional
change intended.

Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 43b3b8e52d)
2022-01-18 08:36:13 -05:00
Mark Johnston
d41768d5c1 vm_pageout: Group sysctl variables together with sysctl definitions
Fix some style bugs while here.  No functional change intended.

Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c4a25e0713)
2022-01-18 08:36:04 -05:00
Alan Somers
eccfee8330 fusefs: implement VOP_ALLOCATE
Now posix_fallocate will be correctly forwarded to fuse file system
servers, for those that support it.

Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33389

(cherry picked from commit 398c88c758)
2022-01-17 18:13:28 -07:00
Alan Somers
bfffd35108 fusefs: in the tests, always assume debug.try_reclaim_vnode is available
In an earlier version of the revision that created that sysctl (D20519)
the sysctl was gated by INVARIANTS, so the test had to check for it.
But in the committed version it is always available.

(cherry picked from commit 19ab361045)

fusefs: move common code from forget.cc to utils.cc

(cherry picked from commit 8d99a6b91b)

fusefs: fix .. lookups when the parent has been reclaimed.

By default, FUSE file systems are assumed not to support lookups for "."
and "..".  They must opt-in to that.  To cope with this limitation, the
fusefs kernel module caches every fuse vnode's parent's inode number,
and uses that during VOP_LOOKUP for "..".  But if the parent's vnode has
been reclaimed that won't be possible.  Previously we paniced in this
situation.  Now, we'll return ESTALE instead.  Or, if the file system
has opted into ".." lookups, we'll just do that instead.

This commit also fixes VOP_LOOKUP to respect the cache timeout for ".."
lookups, if the FUSE file system specified a finite timeout.

PR:		259974
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33239

(cherry picked from commit 1613087a81)
2022-01-17 18:08:25 -07:00
Alan Somers
449d02a12e fusefs: copy_file_range must update file timestamps
If FUSE_COPY_FILE_RANGE returns successfully, update the atime of the
source and the mtime and ctime of the destination.

Reviewers:	pfg
Differential Revision: https://reviews.freebsd.org/D33159

(cherry picked from commit 5169832c96)
2022-01-17 18:02:55 -07:00
Alan Somers
36ba360558 Fix a race in fusefs that can corrupt a file's size.
VOPs like VOP_SETATTR can change a file's size, with the vnode
exclusively locked.  But VOPs like VOP_LOOKUP look up the file size from
the server without the vnode locked.  So a race is possible.  For
example:

1) One thread calls VOP_SETATTR to truncate a file.  It locks the vnode
   and sends FUSE_SETATTR to the server.
2) A second thread calls VOP_LOOKUP and fetches the file's attributes from
   the server.  Then it blocks trying to acquire the vnode lock.
3) FUSE_SETATTR returns and the first thread releases the vnode lock.
4) The second thread acquires the vnode lock and caches the file's
   attributes, which are now out-of-date.

Fix this race by recording a timestamp in the vnode of the last time
that its filesize was modified.  Check that timestamp during VOP_LOOKUP
and VFS_VGET.  If it's newer than the time at which FUSE_LOOKUP was
issued to the server, ignore the attributes returned by FUSE_LOOKUP.

PR:		259071
Reported by:	Agata <chogata@moosefs.pro>
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33158

(cherry picked from commit 13d593a5b0)
2022-01-17 17:59:03 -07:00
Ruslan Makhmatkhanov
a22fd09343 LinuxKPI: 802.11 correctly spell queues
PR:		261078
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 312ba38a9b)
2022-01-16 22:39:37 +00:00
Bjoern A. Zeeb
82a6a8c294 LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()
In lkpi_stop_hw_scan() we have to unlock around cancelling the
hardware scan and an msleep to wait for the confirmation that the
scan ended.  Otherwise we are sleeping with the non-sleepable
net80211 com lock held.  At the same time we need to hold the lhw
lock for the msleep().
This lock change got lost in the refactoring of lkpi_iv_newstate().

Reported by:	ambrisko, delphij
PR:		261075
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit bec766282f)
2022-01-16 22:39:28 +00:00
Bjoern A. Zeeb
d12ea01e39 LinuxKPI: 802.11 update compat code for driver updates
Add more (dummy in case of HE) defines, structs, functions and another
mac80211 function pointer needed to update and support recent drivers.

(cherry picked from commit 51b461b3db)
2022-01-16 22:39:23 +00:00
Bjoern A. Zeeb
cb6bb87184 LinuxKPI / iwlwifi: fix spelling of constants
Fix the spelling of IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_*
(was "NOMIMAL").  The original version came from iwlwifi
in iwlwifi-next.  Other drivers (from wireless-testing) already
use the correct spelling and need this change in LinuxKPI.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e200809190)
2022-01-16 22:39:16 +00:00
Bjoern A. Zeeb
b7277a762c LinuxKPI: 802.11 handle IEEE80211_CONF_IDLE better
We never initialized hw->conf.flags for IEEE80211_CONF_IDLE but
on set_channel we would clear it and announce a change.
This lead to a problem that drivers may do some work every time
which was not needed and may lead to unexpected behaviour (for no
better driver code).

Properly initialize conf.flags with IEEE80211_CONF_IDLE.
Factor out the toggling into a function and clear IDLE while
sw scanning and when associated and set again when scan ends
or we are bouncing out of assoc.

(cherry picked from commit 086be6a809)
2022-01-16 22:39:10 +00:00
Bjoern A. Zeeb
ed802474d4 LinuxKPI: ip.h add #include
Also include netinet/in.h so that in_addr in known for ip.h.
Found by compiling a new piece of code which complained.

(cherry picked from commit 4ddc0079ea)
2022-01-16 22:39:04 +00:00
Bjoern A. Zeeb
2f6e37eded LinuxKPI: bitfields add more *replace_bits()
Add or extend the already existing *_replace_bits() implementations
using macros as we do for the other parts in the file for
le<n>p_replace_bits(), u<n>p_replace_bits(), and _u<n>_replace_bits().

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

(cherry picked from commit 2fb0569f1f)
2022-01-16 22:38:57 +00:00
Bjoern A. Zeeb
f88fcc52d8 LinuxKPI: add hex2bin()
Add a hex2bin() implementation needed by a driver's debugfs code.

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

(cherry picked from commit deb9bfbd5b)
2022-01-16 22:38:48 +00:00
Mark Johnston
af30714ff4 fd: Avoid truncating output buffers for KERN_PROC_{CWD,FILEDESC}
These sysctls failed to return an error if the caller had provided too
short an output buffer.  Change them to return ENOMEM instead, to ensure
that callers can detect truncation in the face of a concurrently
changing fd table.

PR:		228432
Discussed with:	cem, jhb

(cherry picked from commit 36bd49ac4d)
2022-01-16 10:40:25 -05:00
Colin Percival
a04376045d Fix variable name: freq_khz -> freq
An earlier version of this code computed the TSC frequency in kHz.
When the code was changed to compute the frequency more accurately,
the variable name was not updated.

Reviewed by:	markj
Fixes:		22875f8879 x86: Implement deferred TSC calibration
Differential Revision:	https://reviews.freebsd.org/D33696

(cherry picked from commit 698727d637)
2022-01-15 21:33:48 -08:00
Colin Percival
7299cefe39 Skip TSC calibration if exact value known
It's possible that the "early" TSC calibration gave us a value which
is known to be exact; in that case, skip the later re-calibration.

Differential Revision:	https://reviews.freebsd.org/D33695

(cherry picked from commit 9cb3288287)
2022-01-15 21:33:33 -08:00
Konstantin Belousov
a5f6985995 Ignore debugger-injected signals left after detaching
PR:	261010

(cherry picked from commit a24afbb4e6)
2022-01-15 14:55:32 +02:00
Konstantin Belousov
7e61cd7995 amd64 pmap: preset A and M bits for pmap_qenter() and pmap_kenter() mappings
(cherry picked from commit 15964f1cb3)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
fa8285570b amd64 pmap: simplify vtopte() and vtopde()
(cherry picked from commit 720a892ac6)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
b6f37637d8 msdosfs: use mntfs vnode for pm_devvp
(cherry picked from commit aaaa4fb54e)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
1e74922c68 msdosfs: on integrity error, fire a task to remount filesystem to ro
(cherry picked from commit 41e85eeab9)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
171b75b0ef msdosfs: add msdosfs_integrity_error()
(cherry picked from commit b2e4b63584)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
b4889992d7 Add vfs_remount_ro()
(cherry picked from commit 4a4b059a97)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
c5c1537dc7 msdosfs: sanity check sector count from BPB
(cherry picked from commit ba2c98389b)
2022-01-14 20:11:02 +02:00
Konstantin Belousov
c1df4eef12 msdosfs: clusterfree() is used only in error handling cases
(cherry picked from commit 65990b68a2)
2022-01-14 20:11:02 +02:00