]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoUSB: add CYUSB330x to usbdevs
Bjoern A. Zeeb [Fri, 15 Oct 2021 10:46:58 +0000 (10:46 +0000)]
USB: add CYUSB330x to usbdevs

Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.

2 years agolinux(4): Fix "set but not used" warnings
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:44:40 +0000 (16:44 +0000)]
linux(4): Fix "set but not used" warnings

No functional changes.

Sponsored By: EPSRC

2 years agocfiscsi(4): Fix "set but not used" warning
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:44:12 +0000 (16:44 +0000)]
cfiscsi(4): Fix "set but not used" warning

No functional changes.

Sponsored By: EPSRC

2 years agocdceem(4): Fix "set but not used" warnings
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:42:59 +0000 (16:42 +0000)]
cdceem(4): Fix "set but not used" warnings

No functional changes.

Sponsored By: EPSRC

2 years agoshutdown: unmount filesystems after swapoff
Konstantin Belousov [Sun, 28 Nov 2021 01:52:46 +0000 (03:52 +0200)]
shutdown: unmount filesystems after swapoff

Swap on file requires operational underlying mount, otherwise
swapoff_all() is guaranteed to panic due to the default strategy VOP for
reclaimed vnodes.

Reported and tested by: peterj
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33147

2 years agoswapoff_one(): only check free pages count manually turning swap off
Konstantin Belousov [Fri, 26 Nov 2021 23:22:27 +0000 (01:22 +0200)]
swapoff_one(): only check free pages count manually turning swap off

When swap is turned off due to system shutdown or reboot, ignore the
check.  Problem is that the check is not accurate by any means, free
page count can legitimately be low while system still able to page in
everything from the swap.  Then, we turn swap off if swapping on
real file or some non-standard geom provider, and typically panic
when system appears to actually need to unavailable page.

For syscall, it is better to be safe than sorry.

Reported and tested by: peterj
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33147

2 years agommc: Fix HS200/HS400 capability check
Kornel Duleba [Sun, 28 Nov 2021 11:24:07 +0000 (12:24 +0100)]
mmc: Fix HS200/HS400 capability check

HS200 and HS400 speeds can be enabled either with 1.2, or 1.8V signaling voltage.
Because of that we have four cabability flags: MMC_CAP_MMC_HS200_120,
MMC_CAP_MMC_HS200_180, MMC_CAP_MMC_HS400_120, MMC_CAP_MMC_HS400_180.

MMC logic only enables HS200/HS400 mode if both flags are set for the corresponding speed.
Fix that by being more permissive in host timing cap check.

Reviewed by: manu, mw
MFC after: 2 weeks
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D33130

2 years agocitrus_prop.c: do not ignore sign
Konstantin Belousov [Sun, 28 Nov 2021 03:03:49 +0000 (05:03 +0200)]
citrus_prop.c: do not ignore sign

In _citrus_prop_read_TYPE_func_ generated functions, do not ignore parsed
'-' sign, negate the value as appropriate.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33146

2 years agolibc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used
Konstantin Belousov [Sun, 28 Nov 2021 03:25:28 +0000 (05:25 +0200)]
libc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used

It receives the malloc() result, and we do not want the malloc() call
to be optimized out, which is allowed for hosted compiler.  Use dummy
for actual write though.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agonetbsd h_raw.c test: fake use of sum to avoid warning
Konstantin Belousov [Sun, 28 Nov 2021 03:35:45 +0000 (05:35 +0200)]
netbsd h_raw.c test: fake use of sum to avoid warning

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agot_mlock.c: Remove null_errno, it is write-only
Konstantin Belousov [Sun, 28 Nov 2021 03:28:29 +0000 (05:28 +0200)]
t_mlock.c: Remove null_errno, it is write-only

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only
Konstantin Belousov [Sun, 28 Nov 2021 03:16:08 +0000 (05:16 +0200)]
libc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only

2 years agolibc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used
Konstantin Belousov [Sun, 28 Nov 2021 03:14:20 +0000 (05:14 +0200)]
libc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoacl_delete_entry(): remove write-only variable
Konstantin Belousov [Sun, 28 Nov 2021 03:12:42 +0000 (05:12 +0200)]
acl_delete_entry(): remove write-only variable

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agosetproctitle_internal(): remove kbuf local, it is write-only
Konstantin Belousov [Sun, 28 Nov 2021 02:51:45 +0000 (04:51 +0200)]
setproctitle_internal(): remove kbuf local, it is write-only

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/rpc/getrpcent.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:53:05 +0000 (05:53 +0200)]
libc/rpc/getrpcent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/nscachedcli.c: remove write-only variables
Konstantin Belousov [Sun, 28 Nov 2021 03:57:12 +0000 (05:57 +0200)]
libc/net/nscachedcli.c: remove write-only variables

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/getservent.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:52:33 +0000 (05:52 +0200)]
libc/net/getservent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/getprotoent.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:48:05 +0000 (05:48 +0200)]
libc/net/getprotoent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/getnetnamadr.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:45:52 +0000 (05:45 +0200)]
libc/net/getnetnamadr.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/gethostnamadr.c: mark write-only variables as __unused
Konstantin Belousov [Sun, 28 Nov 2021 03:22:24 +0000 (05:22 +0200)]
libc/net/gethostnamadr.c: mark write-only variables as __unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/gen/getpwent.c: plug warnings about write-only variables
Konstantin Belousov [Sun, 28 Nov 2021 02:50:18 +0000 (04:50 +0200)]
libc/gen/getpwent.c: plug warnings about write-only variables

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/gen/getgrent.c: plug warnings about write-only variables
Konstantin Belousov [Sun, 28 Nov 2021 02:46:56 +0000 (04:46 +0200)]
libc/gen/getgrent.c: plug warnings about write-only variables

The variables clang13 complains about take the results of var_arg() calls.
I decided to kept variables around, annotating their definitions with
__unused, to keep clear expected types of the varargs.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agorc.subr.8: Document changes to load_rc_config
Mateusz Piotrowski [Mon, 29 Nov 2021 15:02:32 +0000 (16:02 +0100)]
rc.subr.8: Document changes to load_rc_config

Since e27961a496322e2590da29f3c5fe710b269e6754, load_rc_config does not
require a service name as its first argument. This change was documented
in the rc.subr script in 0b9c2e7ac58caac0413aa36749e4c212514d142d. Let's
update the manual page as well.

MFC after: 3 days

2 years agoapic.4: Fix a typo
Mateusz Piotrowski [Sat, 27 Nov 2021 12:25:30 +0000 (13:25 +0100)]
apic.4: Fix a typo

MFC after: 3 days

2 years agotcp: Don't try to upgrade a read lock just for logging
Michael Tuexen [Fri, 26 Nov 2021 10:53:00 +0000 (11:53 +0100)]
tcp: Don't try to upgrade a read lock just for logging

Reviewed by: glebius, lstewart, rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D33098

2 years agopowerpc64le: add LINT64LE kernel config
Alfredo Dal'Ava Junior [Mon, 29 Nov 2021 15:08:26 +0000 (12:08 -0300)]
powerpc64le: add LINT64LE kernel config

Add configuration file to be used by "FreeBSD-<branch>-powerpc64le-LINT"
CI/Jenkins job

Reviewed by: lwhsu
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33136

2 years agofusefs: fix 32-bit build of the tests after 91972cfcddf
Alan Somers [Mon, 29 Nov 2021 03:34:32 +0000 (20:34 -0700)]
fusefs: fix 32-bit build of the tests after 91972cfcddf

MFC after: 2 weeks
MFC with: 91972cfcddf950d7a9c33df5a9171ada1805a144

2 years agoxhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.
Alexander Motin [Mon, 29 Nov 2021 02:29:26 +0000 (21:29 -0500)]
xhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.

MFC after: 2 weeks

2 years agofusefs: update atime on reads when using cached attributes
Alan Somers [Mon, 29 Nov 2021 01:53:31 +0000 (18:53 -0700)]
fusefs: update atime on reads when using cached attributes

When using cached attributes, whether or not the data cache is enabled,
fusefs must update a file's atime whenever it reads from it, so long as
it wasn't mounted with -o noatime.  Update it in-kernel, and flush it to
the server on close or during the next setattr operation.

The downside is that close() will now frequently trigger a FUSE_SETATTR
upcall.  But if you care about performance, you should be using
-o noatime anyway.

MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D33145

2 years agofusefs: fix copy_file_range when extending a file
Alan Somers [Mon, 29 Nov 2021 01:35:58 +0000 (18:35 -0700)]
fusefs: fix copy_file_range when extending a file

When copy_file_range extends a file, it must update the cached file
size.

MFC after: 2 weeks
Reviewed by: rmacklem, pfg
Differential Revision: https://reviews.freebsd.org/D33151

2 years agonfs: Quiet a few "unused" warnings
Rick Macklem [Sun, 28 Nov 2021 23:48:51 +0000 (15:48 -0800)]
nfs: Quiet a few "unused" warnings

For most of these warnings, the variable is loaded
with data parsed out of an RPC messages.  In case
the data is useful in the future, I just marked
these with __unused.

2 years agofusefs: delete a redundant getnanouptime
Alan Somers [Sun, 28 Nov 2021 23:05:30 +0000 (16:05 -0700)]
fusefs: delete a redundant getnanouptime

It's been redundant since SVN r346060 added another getnanouptime just
above.

MFC after: 2 weeks

2 years agomotd: Fix Questions List address
Danilo G. Baio [Wed, 24 Nov 2021 00:49:14 +0000 (21:49 -0300)]
motd: Fix Questions List address

Following mailing lists migration from Mailman to Mlmmj.

https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
-->
https://lists.freebsd.org/subscription/freebsd-questions

Adding a short link (as we already have for Faq and Handbook), so all
links can be indented the same way.

Reviewed by: imp (earlier version)
Approved by: lwhsu
Differential Revision: https://reviews.freebsd.org/D33101

2 years agox86 GENERIC/MINIMAL: group sc(4) devices together
Ed Maste [Sun, 28 Nov 2021 19:11:56 +0000 (14:11 -0500)]
x86 GENERIC/MINIMAL: group sc(4) devices together

The vga and splash devices are part of the sc(4) system console. vt(4)
uses the vt_vga driver instead, and has some limited splash support
directly in vt_core.c.  Leave the sc(4) options in GENERIC/MINIMAL (for
now) but group them together under an sc(4) comment.

Sponsored by: The FreeBSD Foundation

2 years agoRemove options VESA from x86 MINIMAL
Ed Maste [Sun, 28 Nov 2021 19:10:28 +0000 (14:10 -0500)]
Remove options VESA from x86 MINIMAL

Followup to b8cf1c5c30a5, remove from MINIMAL in addition to GENERIC.

options VESA / vesa.ko provides VESA Bios Extensions (VBE) support for
the legacy sc(4) console.  It is not used by the default console, vt(4).

PR: 253733
Fixes: b8cf1c5c30a5 ("Remove options VESA from x86 GENERIC")
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

2 years agoiwlwifi: import Intel's iwlwifi/mvm driver.
Bjoern A. Zeeb [Sun, 28 Nov 2021 18:35:53 +0000 (18:35 +0000)]
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]
MFC after:      10 days

2 years agoiwlwifi: import firmware for Intel iwlwifi/mvm supported chipsets.
Bjoern A. Zeeb [Sun, 28 Nov 2021 18:34:19 +0000 (18:34 +0000)]
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
MFC after: 10 days

2 years agopf: add pf_bcmp_state_key
Mateusz Guzik [Wed, 24 Nov 2021 17:25:18 +0000 (18:25 +0100)]
pf: add pf_bcmp_state_key

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33131

2 years agoOptionalObsoleteFiles: remove ping with INET & INET6 disabled
Ed Maste [Sun, 28 Nov 2021 18:23:29 +0000 (13:23 -0500)]
OptionalObsoleteFiles: remove ping with INET & INET6 disabled

Reported by: kevans
Fixes: a4ef9e58bc0c ("sbin: build ping if at least one of...")
Sponsored by: The FreeBSD Foundation

2 years agosbin: build ping if at least one of INET & INET6 is enabled
Ed Maste [Sun, 28 Nov 2021 17:50:13 +0000 (12:50 -0500)]
sbin: build ping if at least one of INET & INET6 is enabled

It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
in ping to make this case clear.

PR: 260082
Sponsored by: The FreeBSD Foundation

2 years agoRemove options VESA from x86 GENERIC
Ed Maste [Sat, 27 Nov 2021 20:27:45 +0000 (15:27 -0500)]
Remove options VESA from x86 GENERIC

options VESA / vesa.ko provides VESA Bios Extensions (VBE) support for
the legacy sc(4) console.  It is not used by the default console, vt(4).

There is a report[1] of an incompatibility between VESA and the Nvidia
driver breaking suspend/resume.  Since VESA is not used by the default
configuration anyway, just remove options VESA from GENERIC.  The kernel
module is still available and may be loaded by sc(4) users who want to
select a VBE mode.

(Note that vt(4) does not support selecting a VBE mode.  The loader can
set a VBE mode and vt(4) will use it via the vt_vbefb driver.)

[1] https://lists.freebsd.org/archives/freebsd-hackers/2021-November/000469.html

PR: 253733
Reported by: Stefan Blachmann [1]
Reviewed by: imp, manu, tsoome
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33141

2 years agolinker_kldload_busy(): allow recursion
Konstantin Belousov [Fri, 12 Nov 2021 19:45:06 +0000 (21:45 +0200)]
linker_kldload_busy(): allow recursion

Some drivers recursively loads modules by explicit calls to kldload
during initialization, which might occur during kldload.

PR: 259748
Reported and tested by: thj
Reviewed by: markj
Sponsored by: Nvidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32972

2 years agoDisable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack
Li-Wen Hsu [Sun, 28 Nov 2021 06:58:21 +0000 (14:58 +0800)]
Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack

PR: 259969
Sponsored by: The FreeBSD Foundation

2 years agonfscl: Disable use of the LookupOpen RPC
Rick Macklem [Sat, 27 Nov 2021 23:34:45 +0000 (15:34 -0800)]
nfscl: Disable use of the LookupOpen RPC

The LookupOpen RPC reduces the number of Open RPCs
needed.  Unfortunately, it breaks certain software
builds over NFS, so disable it until this is fixed.

The LookupOpen RPC is only used for NFSv4.1/4.2
mounts when the "oneopenown" mount option is
specified, so this should not affect many users.

2 years agovfs: fully lockless v_writecount adjustment
Mateusz Guzik [Fri, 26 Nov 2021 12:33:28 +0000 (13:33 +0100)]
vfs: fully lockless v_writecount adjustment

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D33128

2 years agovfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF
Mateusz Guzik [Tue, 18 May 2021 10:47:21 +0000 (12:47 +0200)]
vfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF

This allows to stop maintaing the VI_TEXT_REF flag and consequently
opens up fully lockless v_writecount adjustment.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D33127

2 years agonfscl: Sanity check the Sequence slotid in reply
Rick Macklem [Sat, 27 Nov 2021 23:02:04 +0000 (15:02 -0800)]
nfscl: Sanity check the Sequence slotid in reply

The slotid in the Sequence reply must be the same as
in the request.  Check that it is the same and log
a console message if it is not, plus set it to the
correct value.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260071
MFC after: 2 weeks

2 years agoCorrect syscons description in i386 and amd64 configs
Ed Maste [Sat, 27 Nov 2021 21:15:41 +0000 (16:15 -0500)]
Correct syscons description in i386 and amd64 configs

Commit 2d6f6d63733d switched to vt(4) as the default console.

Sponsored by: The FreeBSD Foundation

2 years agoKeep running fsck_ffs as long as "WAS MODIFIED" is reported
Peter Holm [Sat, 27 Nov 2021 10:54:53 +0000 (10:54 +0000)]
Keep running fsck_ffs as long as "WAS MODIFIED" is reported

2 years agoHyper-V: vPCI: Prepopulate device bars
Wei Hu [Sat, 27 Nov 2021 06:42:34 +0000 (06:42 +0000)]
Hyper-V: vPCI: Prepopulate device bars

In recent Hyper-V releases on Windows Server 2022, vPCI code does not
initialize the last 4 bit of device bar registers. This behavior change
could result weird problems cuasing PCI code failure when configuring
bars.

Just write all 1's to those bars whose probed values are not the same
as current read ones. This seems to make Hyper-V vPCI and
pci_write_bar() to cooperate correctly on these releases.

Reported by: khng@freebsd.org
Tested by: khng@freebsd.org
MFC after: 2 weeks
Sponsored by: Microsoft

2 years agoxhci: Add PCI IDs from recent Intel CPUs.
Alexander Motin [Sat, 27 Nov 2021 01:35:12 +0000 (20:35 -0500)]
xhci: Add PCI IDs from recent Intel CPUs.

MFC after: 2 weeks

2 years agonfsd: Sanity check the len argument for ListXattr
Rick Macklem [Fri, 26 Nov 2021 23:56:29 +0000 (15:56 -0800)]
nfsd: Sanity check the len argument for ListXattr

The check for the original len being >= retlen needs to
be done before the "if (nd->nd_repstat == 0)" code, so
that it can be reported as too small.

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260046
MFC after: 2 weeks

2 years agonfsd: Add checks for layout errors in LayoutReturn
Rick Macklem [Fri, 26 Nov 2021 23:42:32 +0000 (15:42 -0800)]
nfsd: Add checks for layout errors in LayoutReturn

For a LayoutReturn when using the Flexible File Layout,
error reports may be provided in the request.
Sanity check the size of these error reports and
check that they exist before calling nfsrv_flexlayouterr().

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 260012
MFC after: 2 weeks

2 years agonfscl: Sanity check irdcnt in nfsrpc_createsession
Rick Macklem [Fri, 26 Nov 2021 23:28:40 +0000 (15:28 -0800)]
nfscl: Sanity check irdcnt in nfsrpc_createsession

Reported by: rtm@lcs.mit.edu
Tested by: rtm@lcs.mit.edu
PR: 259996
MFC after: 2 weeks

2 years agotmpfs: add vop_stdadd_writecount_nomsync to fifo vnode ops
Mateusz Guzik [Fri, 26 Nov 2021 19:29:49 +0000 (19:29 +0000)]
tmpfs: add vop_stdadd_writecount_nomsync to fifo vnode ops

Reported by: yasu
Fixes: 3ffcfa599e29686c ("vfs: add vop_stdadd_writecount_nomsync")
2 years agosrc.conf: regenerate
Warner Losh [Fri, 26 Nov 2021 19:22:48 +0000 (12:22 -0700)]
src.conf: regenerate

2 years agoMK_NAND: this option was retired some time ago
Warner Losh [Fri, 26 Nov 2021 19:16:03 +0000 (12:16 -0700)]
MK_NAND: this option was retired some time ago

Remove the now-bogus WITH_NAND and WITHOUT_NAND flags.

Sponsored by: Netflix

2 years agoPer-thread stack canary on arm64
Andrew Turner [Mon, 22 Nov 2021 15:20:51 +0000 (15:20 +0000)]
Per-thread stack canary on arm64

With the update to llvm 13 we are able to tell the compiler it can find
the SSP canary relative to the register that holds the userspace stack
pointer. As this is unused in most of the kernel it can be used here
to point to a per-thread SSP canary.

As the kernel could be built with an old toolchain, e.g. when upgrading
from 13, add a warning that the options was enabled but the compiler
doesn't support it to both the build and kernel boot.

Discussed with: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33079

2 years agoHoist cddl prebuild lib dependency definitions out of a MK_ZFS block
Mark Johnston [Fri, 26 Nov 2021 14:27:19 +0000 (09:27 -0500)]
Hoist cddl prebuild lib dependency definitions out of a MK_ZFS block

The compilation of several libraries under cddl/lib is not conditional
on MK_ZFS = "yes", so their dependency on libspl is not conditional
either.  Unbreak buildworld when WITHOUT_ZFS is set.

Reported by: bz
Fixes: 9e9c651caceb ("cddl: fix missing ZFS library dependencies")
MFC after: 1 week

2 years agotwsi: support more message combinations in transfers
Andriy Gapon [Fri, 26 Nov 2021 09:48:21 +0000 (11:48 +0200)]
twsi: support more message combinations in transfers

Most prominently, add support for a transfer where a write with no-stop
flag is followed by a write with no-start flag.  Logically, it's a
single larger write, but consumers may want to split it like that
because one part can be a register ID and the other part can be data to
be written to (or starting at) that register.

Such a transfer can be created by i2c tool and iic(4) driver, e.g., for
an EEPROM write at specific offset:
    i2c -m tr -a 0x50 -d w -w 16 -o 0 -c 8 -v < /dev/random

This should be fixed by new code that handles the end of data transfer
for both reads and writes.  It handles two existing conditions and one
new.  Namely:
- the last message has been completed -- end of transfer;
- a message has been completed and the next one requires the start
  condition;
- a message has been completed and the next one should be sent without
  the start condition.

In the last case we simply switch to the next message and start sending
its data.  Reads without the start condition are not supported yet,
though.  That's because we NACK the last byte of the previous message,
so the device stops sending data.  To fix this we will need to add a
look-ahead at the next message when handling the penultimate byte of the
current one.

This change also fixed a bug where msg_idx was not incremented after a
read message.  Apparently, typically a read message is a last message in
a transfer, so the bug did not cause much trouble.

PR: 258994
MFC after: 3 weeks

2 years agotwsi: make data receiving code safer
Andriy Gapon [Fri, 26 Nov 2021 08:34:42 +0000 (10:34 +0200)]
twsi: make data receiving code safer

Assert that we are not receiving data beyond the requested length.
Assert that we have not NACK-ed incoming data prematurely.
Abort the current transfer if the incoming data is NACK-ed or not
NACK-ed unexpectedly.

Add debug logging of received data to complement logging of sent data.

MFC after: 3 weeks

2 years agotwsi: remove redundant write of control register
Andriy Gapon [Fri, 26 Nov 2021 08:09:59 +0000 (10:09 +0200)]
twsi: remove redundant write of control register

The write at the end of twsi_intr() already handles all cases, no need
to have another write for TWSI_STATUS_START / TWSI_STATUS_RPTD_START.

MFC after: 3 weeks

2 years agotwsi: move handling of TWSI_CONTROL_ACK into the state machine
Andriy Gapon [Fri, 26 Nov 2021 08:07:27 +0000 (10:07 +0200)]
twsi: move handling of TWSI_CONTROL_ACK into the state machine

Previously the code set TWSI_CONTROL_ACK in twsi_transfer() based on
whether the first message had a length of one.  That was done regardless
of whether the message was a read or write and what kind of messages
followed it.
Now the bit is set or cleared while handling TWSI_STATUS_ADDR_R_ACK
state transition based on the current (read) message.

The old code did not correctly work in a scenario where a single byte
was read from an EEPROM device with two byte addressing.
For example:
    i2c -m tr -a 0x50 -d r -w 16 -o 0 -c 1 -v
The reason is that the first message (a write) has two bytes, so
TWSI_CONTROL_ACK was set and never cleared.
Since the controller did not send NACK the EEPROM sent more data resulting
in a buffer overrun.

While working on TWSI_STATUS_ADDR_R_ACK I also added support for
the zero-length read access and then I did the same for zero-length write
access.
While rare, those types of I2C transactions are completely valid and are
used by some devices.

PR: 258994
MFC after: 3 weeks

2 years agotwsi: unify error handling, explicitly handle more conditions
Andriy Gapon [Fri, 26 Nov 2021 07:44:30 +0000 (09:44 +0200)]
twsi: unify error handling, explicitly handle more conditions

twsi_error() is a new function that stops the current transfer and sets
up softc when an error condition is detected.
TWSI_STATUS_DATA_WR_NACK, TWSI_STATUS_BUS_ERROR and
TWSI_STATUS_ARBITRATION_LOST are now handled explicitly rather than
via the catch-all unknown status.

Also, twsi_intr() now calls wakeup() in a single place when the
transfer is finished.

MFC after: 2 weeks

2 years agotwsi: improve a handful of debug messages
Andriy Gapon [Fri, 26 Nov 2021 07:34:28 +0000 (09:34 +0200)]
twsi: improve a handful of debug messages

- use 0x prefix for hex values
- print indexes and counts as decimals
- break too long lines

MFC after: 2 weeks

2 years agotwsi: do not attempt transfer if bus is not idle
Andriy Gapon [Fri, 26 Nov 2021 07:30:38 +0000 (09:30 +0200)]
twsi: do not attempt transfer if bus is not idle

MFC after: 2 weeks

2 years agotwsi: remove redundant enabling of the controller
Andriy Gapon [Fri, 26 Nov 2021 07:28:18 +0000 (09:28 +0200)]
twsi: remove redundant enabling of the controller

MFC after: 2 weeks

2 years agotwsi: protect interaction between twsi_transfer and twsi_intr
Andriy Gapon [Fri, 26 Nov 2021 07:25:01 +0000 (09:25 +0200)]
twsi: protect interaction between twsi_transfer and twsi_intr

All accesses to softc are now done under a mutex to prevent data races
between the open context and the interrupt handler.
Additionally, the wait time in twsi_transfer is bounded now.
Previously we could get stuck there forever if an interrupt got lost.

MFC after: 2 weeks

2 years agotwsi: compile in support for debug messages, disabled by default
Andriy Gapon [Fri, 26 Nov 2021 06:52:56 +0000 (08:52 +0200)]
twsi: compile in support for debug messages, disabled by default

Debug messages can now be enabled per driver instance via a new sysctl.
Also, debug messages in TWSI_READ and TWSI_WRITE require debug level
greater than 1 as they are mostly redundant because callers of those
functions already log most interesting results.

NB: the twsi drivers call their device iichb, so the new sysctl will
appear under dev.iichb.N.

MFC after: 1 week

2 years agotwsi: remove write-only softc field
Andriy Gapon [Fri, 26 Nov 2021 06:45:12 +0000 (08:45 +0200)]
twsi: remove write-only softc field

MFC after: 1 week

2 years agotwsi: add more of status definitions
Andriy Gapon [Fri, 26 Nov 2021 06:30:22 +0000 (08:30 +0200)]
twsi: add more of status definitions

For completeness and for future use.

MFC after: 1 week

2 years agotwsi: sort headers, remove unneeded
Andriy Gapon [Fri, 26 Nov 2021 06:28:41 +0000 (08:28 +0200)]
twsi: sort headers, remove unneeded

MFC after: 1 week

2 years agosctp: improve consistency, no functional change intended
Michael Tuexen [Fri, 26 Nov 2021 11:53:12 +0000 (12:53 +0100)]
sctp: improve consistency, no functional change intended

2 years agovfs: plug a set-but-not-used var in kern_alternate_path
Mateusz Guzik [Fri, 26 Nov 2021 12:22:09 +0000 (12:22 +0000)]
vfs: plug a set-but-not-used var in kern_alternate_path

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agovfs: add vop_stdadd_writecount_nomsync
Mateusz Guzik [Fri, 26 Nov 2021 09:02:19 +0000 (10:02 +0100)]
vfs: add vop_stdadd_writecount_nomsync

This avoids needing to inspect the mount point every time.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D33125

2 years agoFix build with -DNO_ROOT
Fernando ApesteguĂ­a [Fri, 26 Nov 2021 10:55:50 +0000 (11:55 +0100)]
Fix build with -DNO_ROOT

The inclusion of 0a0f7486413c broke the build with the -DNO_ROOT option.
Specifically, that commit adds some relative paths (with `..`) to METALOG
that make other tools using that log, fail afterwards (tar, makefs...).

It's been argued[1] if this is really something mtree(8) should handle more
graciously. In the meantime, fix the breakage but changing the order in which
the links are created: first in the parent directory, then in the
architecture-specific one.

We keep the architecture-specific directories an the links to the parent
directories. This is something that we might want to change in the future.

This commit is based on a concept patch by avg@.

[1] https://lists.freebsd.org/archives/dev-commits-src-all/2021-November/index.html

Reported by: bapt@, emaste@
Approved by: avg@
Fixes: 0a0f7486413c
Differential Revision: https://reviews.freebsd.org/D33126

2 years agosctp: add some asserts, no functional changes intended
Michael Tuexen [Fri, 26 Nov 2021 11:19:33 +0000 (12:19 +0100)]
sctp: add some asserts, no functional changes intended

This might help in narrowing down
https://syzkaller.appspot.com/bug?id=fbd79abaec55f5aede63937182f4247006ea883b

2 years agopci_vendors: update to 2021-11-24
Baptiste Daroussin [Fri, 26 Nov 2021 07:52:20 +0000 (08:52 +0100)]
pci_vendors: update to 2021-11-24

2 years agoEC2: Turn off IPv6 DAD
Colin Percival [Tue, 23 Nov 2021 04:16:34 +0000 (20:16 -0800)]
EC2: Turn off IPv6 DAD

Disable Duplicate Address Detection in EC2 instances.  The networking
configuration in EC2, with IPv6 addresses assigned by DHCPv6 and
host egress filtering, makes "duplicate addresses" impossible.

This speeds up the boot process in EC2 by 2 seconds.

Reviewed by: kp, imp, bz
MFC after: 2 weeks
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33091

2 years agoetc/defaults/rc.conf: Add -i flag to rtsol/rtsold
Colin Percival [Mon, 22 Nov 2021 21:51:43 +0000 (13:51 -0800)]
etc/defaults/rc.conf: Add -i flag to rtsol/rtsold

This disables the random (between zero and one seconds) delay before
rtsol and rtsold send a a Router Solicitation packet.  This delay is
specified as a SHOULD by RFC 4861 for avoidance of network congestion,
but network speeds have increased enough in the 25 years since this
first appeared (in RFC 1970) that it seems unnecessary as a default
at this point.

This speeds up the FreeBSD boot process by an average of 500 ms.

Reviewed by: kp
MFC after: 1 week
Relnotes: yes
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D33089

2 years agoarch.7: update applicable FreeBSD versions to 12.0 and later
Ed Maste [Thu, 25 Nov 2021 18:50:03 +0000 (13:50 -0500)]
arch.7: update applicable FreeBSD versions to 12.0 and later

Information in this document is unchanged between 11.x and 12.x, but
this is intended to be a quick reference for supported architectures.
Also bump .Dd to cover recent changes including MIPS deprecation.

Sponsored by: The FreeBSD Foundation

2 years agohwpmc: Add IDs for Intel Comet/Ice/Tiger/Rocketlake CPUs.
Alexander Motin [Fri, 26 Nov 2021 00:17:58 +0000 (19:17 -0500)]
hwpmc: Add IDs for Intel Comet/Ice/Tiger/Rocketlake CPUs.

MFC after: 1 month

2 years agovfs: remove the unused thread argument from NDINIT*
Mateusz Guzik [Thu, 25 Nov 2021 21:43:06 +0000 (21:43 +0000)]
vfs: remove the unused thread argument from NDINIT*

See b4a58fbf640409a1 ("vfs: remove cn_thread")

Bump __FreeBSD_version to 1400043.

2 years agovfs: drop the always curthread argument from kern_alternate_path
Mateusz Guzik [Thu, 25 Nov 2021 21:42:42 +0000 (21:42 +0000)]
vfs: drop the always curthread argument from kern_alternate_path

2 years agolinux: remove the always curthread argument from lconvpath
Mateusz Guzik [Thu, 25 Nov 2021 21:42:13 +0000 (21:42 +0000)]
linux: remove the always curthread argument from lconvpath

2 years agolink_elf_obj: Process global ifunc relocs after other global relocs
Mark Johnston [Thu, 25 Nov 2021 21:52:17 +0000 (16:52 -0500)]
link_elf_obj: Process global ifunc relocs after other global relocs

This is needed to ensure that resolvers that reference global symbols
return correct results.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33120

2 years agork_spi: declare support for rk3328
Andriy Gapon [Thu, 25 Nov 2021 21:12:11 +0000 (23:12 +0200)]
rk_spi: declare support for rk3328

Tested on Rock64 using the onboard SPI flash.

MFC after: 1 week

2 years agopowerpc64: make autoboot possible on powernv machines
Alfredo Dal'Ava Junior [Fri, 26 Nov 2021 00:02:53 +0000 (21:02 -0300)]
powerpc64: make autoboot possible on powernv machines

It's required to specify a default boot option in order to make
petitboot's autoboot feature work.

Tested on Raptor Blackbird

Reviewed by: imp, luporl
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D32838

2 years agopowerpc64le: fix boot when using QEMU PowerNV
Leandro Lupori [Thu, 25 Nov 2021 19:41:46 +0000 (16:41 -0300)]
powerpc64le: fix boot when using QEMU PowerNV

When using QEMU PowerNV with latest op-build release (v2.7), its
kexec transfers control to FreeBSD kernel in BE mode, causing an
instant exception on LE kernels. Make kboot able to detect and
swap endian to fix this.

Reviewed by: imp
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33104

2 years agovt: export RGB offsets with FBIO_GETRGBOFFS
Leandro Lupori [Thu, 25 Nov 2021 18:54:11 +0000 (15:54 -0300)]
vt: export RGB offsets with FBIO_GETRGBOFFS

Add a new ioctl to vt to make it possible to export RGB offsets
set by vt drivers. This is needed to fix colors on X and Mesa
on some machines, especially on modern PowerPC64 BE ones.

With the appropriate changes in SCFB, to use this ioctl to find
out the correct RGB offsets, this fixes wrong colors on Talos II
and Blackbird, when used with their built-in video cards.

Reviewed by: alfredo
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D29000

2 years agoswap_pager: lock vnode in swapdev_strategy()
Konstantin Belousov [Wed, 24 Nov 2021 11:26:46 +0000 (13:26 +0200)]
swap_pager: lock vnode in swapdev_strategy()

VOP_STRATEGY() requires locked vnode.  Note that we lock the swap vnode
while pages are busy, but this would only cause real LoR if pages belong
to the swap vnode, which must not be the case for correct use.

Reported and tested by: peterj
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33119

2 years agoswapon: extend the region where the swap vnode is locked
Konstantin Belousov [Wed, 24 Nov 2021 03:06:02 +0000 (05:06 +0200)]
swapon: extend the region where the swap vnode is locked

to cover VOP_GETATTR() call in sys_swapon().  Move locking from inside
swapongeom() and swaponvp() into sys_swapon().

Reported by and tested by: peterj
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33119

2 years agoswap pager: lock vnode around VOP_CLOSE()
Konstantin Belousov [Tue, 23 Nov 2021 09:16:53 +0000 (11:16 +0200)]
swap pager: lock vnode around VOP_CLOSE()

Reported and tested by: peterj
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33119

2 years agoarch.7: move discontinued CPU archs to own table
Ed Maste [Thu, 25 Nov 2021 02:13:04 +0000 (21:13 -0500)]
arch.7: move discontinued CPU archs to own table

With MIPS' retirement we now have more discontinued architectures than
supported ones, making the table somewhat unclear.  Split the table in
two.

Reviewed by: allanjude
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33110

2 years agomake_dev.9: Fix a typo
Mark Johnston [Thu, 25 Nov 2021 16:32:30 +0000 (11:32 -0500)]
make_dev.9: Fix a typo

MFC after: 1 week

2 years agoagp: Handle multiple devices more gracefully
Mark Johnston [Thu, 25 Nov 2021 16:27:49 +0000 (11:27 -0500)]
agp: Handle multiple devices more gracefully

Currently agp(4) effectively assumes that only one driver instance
exists, as the generic attach routine attempts to create /dev/agpgart
and triggers a panic if it already exists.  Instead, handle this
situation by creating /dev/agpgart<unit> and making /dev/agpgart an
alias of /dev/agpgart0 for compatibility.

PR: 187015
Reviewed by: imp, kib
Tested by: Yoshihiro Ota <ota@j.email.ne.jp> (earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33068

2 years agolibpmc: Update some x86 event definitions.
Alexander Motin [Thu, 25 Nov 2021 16:19:26 +0000 (11:19 -0500)]
libpmc: Update some x86 event definitions.

MFC after: 1 month

2 years agousb/u3g: Add support for Quectel EM05.
Hans Petter Selasky [Thu, 25 Nov 2021 14:27:50 +0000 (15:27 +0100)]
usb/u3g: Add support for Quectel EM05.

Pull Request: https://github.com/freebsd/freebsd-src/pull/565
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agommc: plug set-but-not-used vars
Mateusz Guzik [Thu, 25 Nov 2021 12:10:27 +0000 (12:10 +0000)]
mmc: plug set-but-not-used vars

Sponsored by: Rubicon Communications, LLC ("Netgate")