Commit Graph

283688 Commits

Author SHA1 Message Date
Simon J. Gerraty
2b519b1707 Update description of WITH_DIRDEPS_BUILD 2023-05-12 09:42:21 -07:00
Simon J. Gerraty
df9974197e Add description of WITH_META_ERROR_TARGET 2023-05-12 09:21:30 -07:00
Ed Maste
74674fef3c kern.opts.mk: rationalize i386 EFI default with src.opts.mk
PR: 269994
Fixes: ad9d10a859 ("efi: mark as broken on i386")
Sponsored by: The FreeBSD Foundation
2023-05-12 11:04:00 -04:00
Ed Maste
d1fdf357ae src.conf.5: regen
Fixes: ad9d10a859 ("efi: mark as broken on i386")
Fixes: bee3d4bf8e ("Move DIRDEPS_BUILD settings to sys.dirdeps.mk")
Sponsored by: The FreeBSD Foundation
2023-05-12 10:55:08 -04:00
Kristof Provost
fa554de774 netlink: reduce default log levels
Reduce the default log level for netlink to LOG_INFO. This removes a
number of messages such as

> [nl_iface] dump_sa: unsupported family: 0, skipping
or
> [nl_iface] get_operstate_ether: error calling SIOCGIFMEDIA on vlan0: 22

that are useful for debugging, but not for most users.

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40062
2023-05-12 14:32:57 +02:00
Bjoern A. Zeeb
dd4f32ae62 ath11k: import ath11k driver
Import BSD-3-Clause-Clear ath11k driver assumed to be
based on Linux kvalo/ath.git master at
6bae9de622d3ef4805aba40e763eb4b0975c4f6d.

Complement the driver to make compile on FreeBSD
using LinuxKPI with changes covered by #ifdef (__FreeBSD__).
Further select updates were applied since the initial import
in order to keep compiling along with other LinuxKPI based
drivers.

Add the module build framework but keep disconnected from the
build for now.
The current driver (or rather LinuxKPI) lacks support for some
"qcom" bits needed in order to get things working.
There was interest by various people to enhance support further.

We initially only plan to support PCI parts but it would be great
to further enhance qcom SoC support to run on several (cheap) APs.

The firmware is provided by port net/wifi-firmware-ath11k-kmod.

Given the lack of full license texts on most files this is
imported under the draft policy for handling SPDX files (D29226)
and with approval for BSD-3-Clause-Clear. [1]

Approved by:    core (jhb, 2023-05-11) [1]
MFC after:      2 months
2023-05-12 11:21:16 +00:00
Bjoern A. Zeeb
d544b53cb0 LinuxKPI: add dummy hash.h and kernel_connect()
Add crypto/hash.h and a dummy kernel_connect() needed to compile
the ath11k wireless driver.  While I hope we will not actually need
the hash.h fallbacks, kernel_connect() we will have to deal with once
we sort out more QMI bits.

MFC after:	10 days
2023-05-12 11:21:10 +00:00
Bjoern A. Zeeb
721b44ba5f amd64: pmap.h put a guard around a pcpu.h function
pmap_get_pcid() calls zpcpu_get() which is defined in pcpu.h.
It is unclear why we do not include that header but like right
above the change add another guard around pmap_get_pcid().
This allows some LinuxKPI headers to compile again.

Suggested by:	markj
MFC after:	10 days
2023-05-12 11:14:54 +00:00
Martin Matuska
e639e0d27c zfs: merge openzfs/zfs@e61076683
Notable upstream pull request merges:
  #14744 Optimize check_filesystem() and process_error_log()
  #14773 Allow zhack label repair to restore detached devices
  #14794 zpool import -m also removing spare and cache when log device
         is missing
  #14805 Simplify and optimize random_int_between()
  #14813 Enable the head_errlog feature to remove errors
  #14816 Fix two abd_gang_add_gang() issues
  #14817 Verify block pointers before writing them out
  #14819 Add dmu_tx_hold_append() interface
  #14823 Remove single parent assertion from zio_nowait()
  #14824 Plug memory leak in zfsdev_state
  #14825 Block cloning dbuf fixes
  #14828 Remove duplicate code in l2arc_evict()
  #14837 Fixes in head_errlog feature with encryption
  #14839 Prevent panic during concurrent snapshot rollback and zvol read
  #14853 zil: Don't expect zio_shrink() to succeed

Obtained from:	OpenZFS
OpenZFS commit:	e610766838
2023-05-12 13:13:33 +02:00
Kristof Provost
92c23f6d9c vlan: fix setting flags on a QinQ interface
Setting vlan flags needlessly takes the exclusive VLAN_XLOCK().

If we have stacked vlan devices (i.e. QinQ) and we set vlan flags (e.g.
IFF_PROMISC) we call rtnl_handle_ifevent() to send a notification about
the interface.
This ends up calling SIOCGIFMEDIA, which requires the VLAN_SLOCK().
Trying to take that one with the VLAN_XLOCK() held deadlocks us.

There's no need for the exclusive lock though, as we're only accessing
parent/trunk information, not modifying it, so a shared lock is
sufficient.

While here also add a test case for this issue.

Backtrace:
	shared lock of (sx) vlan_sx @ /usr/src/sys/net/if_vlan.c:2192
	while exclusively locked from /usr/src/sys/net/if_vlan.c:2307
	panic: excl->share
	cpuid = 29
	time = 1683873033
	KDB: stack backtrace:
	db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe015d4ad4b0
	vpanic() at vpanic+0x152/frame 0xfffffe015d4ad500
	panic() at panic+0x43/frame 0xfffffe015d4ad560
	witness_checkorder() at witness_checkorder+0xcb5/frame 0xfffffe015d4ad720
	_sx_slock_int() at _sx_slock_int+0x67/frame 0xfffffe015d4ad760
	vlan_ioctl() at vlan_ioctl+0xf8/frame 0xfffffe015d4ad7c0
	dump_iface() at dump_iface+0x12f/frame 0xfffffe015d4ad840
	rtnl_handle_ifevent() at rtnl_handle_ifevent+0xab/frame 0xfffffe015d4ad8c0
	if_setflag() at if_setflag+0xf6/frame 0xfffffe015d4ad930
	ifpromisc() at ifpromisc+0x2a/frame 0xfffffe015d4ad960
	vlan_setflags() at vlan_setflags+0x60/frame 0xfffffe015d4ad990
	vlan_ioctl() at vlan_ioctl+0x216/frame 0xfffffe015d4ad9f0
	if_setflag() at if_setflag+0xe4/frame 0xfffffe015d4ada60
	ifpromisc() at ifpromisc+0x2a/frame 0xfffffe015d4ada90
	bridge_ioctl_add() at bridge_ioctl_add+0x499/frame 0xfffffe015d4adb10
	bridge_ioctl() at bridge_ioctl+0x328/frame 0xfffffe015d4adbc0
	ifioctl() at ifioctl+0x972/frame 0xfffffe015d4adcc0
	kern_ioctl() at kern_ioctl+0x1fe/frame 0xfffffe015d4add30
	sys_ioctl() at sys_ioctl+0x154/frame 0xfffffe015d4ade00
	amd64_syscall() at amd64_syscall+0x140/frame 0xfffffe015d4adf30
	fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe015d4adf30
	--- syscall (54, FreeBSD ELF64, ioctl), rip = 0x22b0f0ef8d8a, rsp = 0x22b0ec63f2c8, rbp = 0x22b0ec63f380 ---
	KDB: enter: panic
	[ thread pid 5715 tid 101132 ]

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-12 11:12:51 +02:00
Gordon Bergling
cbe88c6f3c arm64: Fix a typo in a source code comment
- s/inferface/interface/

MFC after: 3 days
2023-05-12 10:45:46 +02:00
Corvin Köhne
b67f0d360b
bhyve: import OpRegion definitions
Those definitions are required for the GVT-d emulation to parse the
OpRegion.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40037
2023-05-12 09:29:51 +02:00
Corvin Köhne
93cf93179c
bhyve: add helper for passthru specific mmio ranges
Intel GPUs have two special memory regions. They are called Graphics
Stolen Memory and OpRegion. bhyve has to emulate both of them. In order
to keep track of those special regions, add generic mmio ranges to the
passthru emulation.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40036
2023-05-12 09:29:44 +02:00
Corvin Köhne
99aeb28b2f
bhyve: don't panic if e820 finds no available memory
The GVT-d emulation tries to allocate some specific memory. It could
happen that this address doesn't exist. In that case, GVT-d will fall
back to allocate any address. Nevertheless, this only works if the e820
fails with an error instead of exiting on an assertion.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40034
2023-05-12 09:29:39 +02:00
Simon J. Gerraty
bee3d4bf8e Move DIRDEPS_BUILD settings to sys.dirdeps.mk
When originally implemented, there was no distinction between
DIRDEPS_BUILD and META_MODE, they were one and the same.

META_MODE however is useful by itself, but since meta.sys.mk
had lots of settings related to DIRDEPS_BUILD its use was limited
to DIRDEPS_BUILD.

Move (most) DIRDEPS_BUILD related items to sys.dirdeps.mk
so that meta.sys.mk can be used for just META_MODE.
There is of course some bluring of the lines, so settings remain
in meta.sys.mk

Add MK_META_ERROR_TARGET to enable the META_MODE .ERROR target
independent of DIRDEPS_BUILD, it copies failed .meta files to ${SB}/error
to make it easier to identify the cause of build failures.

Since sys.dirdeps.mk should be included first, most of
local.meta.sys.mk becomes local.sys.dirdeps.mk
and some other bits need to move to local.sys.dirdeps.env.mk

Also fix dirdeps.mk to not add CURDIR to DIRDEPS when it is SRCTOP.

Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D40053
2023-05-11 16:15:04 -07:00
Pawel Jakub Dawidek
e610766838 Make sure we are not trying to clone a spill block.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:07:15 -07:00
Pawel Jakub Dawidek
fbbe5e96ef Correct comment.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:07:11 -07:00
Pawel Jakub Dawidek
9879930f7a Remove badly placed comment.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:07:07 -07:00
Pawel Jakub Dawidek
b6d7370b9d Don't call zfs_exit_two() before zfs_enter_two().
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:07:02 -07:00
Pawel Jakub Dawidek
d0d91f185e Don't use dmu_buf_is_dirty() for unassigned transaction.
The dmu_buf_is_dirty() call doesn't make sense here for two reasons:
1. txg is 0 for unassigned tx, so it was a no-op.
2. It is equivalent of checking if we have dirty records and we are doing
   this few lines earlier.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:06:57 -07:00
Pawel Jakub Dawidek
bd8c6bd66f Deny block cloning is dbuf size doesn't match BP size.
I don't know an easy way to shrink down dbuf size, so just deny block cloning
into dbufs that don't match our BP's size.

This fixes the following situation:
1. Create a small file, eg. 1kB of random bytes. Its dbuf will be 1kB.
2. Create a larger file, eg. 2kB of random bytes. Its dbuf will be 2kB.
3. Truncate the large file to 0. Its dbuf will remain 2kB.
4. Clone the small file into the large file. Small file's BP lsize is
   1kB, but the large file's dbuf is 2kB.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:06:52 -07:00
Pawel Jakub Dawidek
555ef90c5c Additional block cloning fixes.
Reimplement some of the block cloning vs dbuf logic, mostly to fix
situation where we clone a block and in the same transaction group
we want to partially overwrite the clone.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825
2023-05-11 16:06:36 -07:00
Pierre Pronchery
bdf6dee2a9 dma: specify OpenSSL 1.1 API
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-05-11 19:03:34 -04:00
Ed Maste
692b19255c dma: use OpenSSL 1.1 init API
> The SSL_library_init() and OpenSSL_add_ssl_algorithms() functions were
> deprecated in OpenSSL 1.1.0 by OPENSSL_init_ssl().

and

> The ERR_load_crypto_strings(), SSL_load_error_strings(), and
> ERR_free_strings() functions were deprecated in OpenSSL 1.1.0 by
> OPENSSL_init_crypto() and OPENSSL_init_ssl() and should not be used.

Reviewed by:	ngie
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40065
2023-05-11 19:03:34 -04:00
Bjoern A. Zeeb
910a834383 LinuxKPI: 802.11: fix IEEE80211_TX_INFO_DRIVER_DATA_SIZE
Fix the sizing of IEEE80211_TX_INFO_DRIVER_DATA_SIZE so that it
also works on 32bit platforms.  Otherwise it triggers a compile-time
assertion in ath10k for i386.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-05-11 21:36:59 +00:00
Alexander Motin
469019fb0b
zil: Don't expect zio_shrink() to succeed.
At least for RAIDZ zio_shrink() does not reduce zio size, but reduced
wsz in that case likely results in writing uninitialized memory.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:  Alexander Motin <mav@FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #14853
2023-05-11 14:27:12 -07:00
Ceri Davies
620b5bfaef rc.conf.5: document name_cpuset, introduced in rev 0661f93892 2023-05-11 22:06:56 +01:00
Warner Losh
c16e08e5f3 stand/efi: Retire i386 support
Remove the i386 ifdefs and files. It never worked.

Sponsored by:		Netflix
Reviewed by:		manu, tsoome, kevans
Differential Revision:	https://reviews.freebsd.org/D40012
2023-05-11 14:06:03 -06:00
Warner Losh
ad9d10a859 efi: mark as broken on i386
We're never going to support EFI booting on i386 (32-bit). Start to
decommission it, since it's never worked.

Sponsored by:		Netflix
Reviewed by:		tsoome, emaste
Differential Revision:	https://reviews.freebsd.org/D40011
2023-05-11 14:06:03 -06:00
Warner Losh
8c3d6917c1 stand: eficom: Only set baudrate when it changes
Only set the baudrate when it is different than what the device has
reported. In addition, pass in the args to effect no change to the other
parameters to the serial port. Some EFI firmware gets cranky when you
set them to the same value, so avoid doing so (we likely can remove the
HyperV workaround with this fix, but I kept it in place). Add comments
to the code for why we do this too.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D40010
2023-05-11 14:06:03 -06:00
Warner Losh
cb2da74905 stand: eficom: Don't preemtively assume flow control
Remove rtsdtr_off. It's basically unused. Expand its meaning, but put
changing flow control to under an ifdef. We shouldn't set it unless
we're sure we need to do so. UEFI normally initializes the device
correctly, and we should avoid needless changes that aren't user
requested.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D40009
2023-05-11 14:06:03 -06:00
Warner Losh
66826fd54a stand: eficom : remove unused ignore_cd
Sponsored by:		Netflix
Reviewed by:	tsoome
Differential Revision:	https://reviews.freebsd.org/D40008
2023-05-11 14:06:03 -06:00
Warner Losh
bab80c12a8 stand: Move eficom to libefi
Rename efiserialc to eficom.c and move it to libefi. Remove
loader.efi.h, since it's not needed. It's architecture independent
(though how we use it might vary). Drivers also belong in libfoo
in the boot loader: all the BIOS drivers are in i386/libi386 and
the console driver is in efi/libefi.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D40007
2023-05-11 14:06:03 -06:00
Warner Losh
82cf061eba stand: Make non-matching console names OKer
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D39984
2023-05-11 14:06:03 -06:00
Warner Losh
f93416d677 stand: add comconsole backwards compatibility shim for aarch64
Add a compat shim for the "comconsole" name so that people with a
"console=comconsole" in their loader.conf on aarch64 will continue to
work (though with a warning).

This is only aarch64: it will never be there for amd64 (where comconsole
always means talk to the hardware directly). To do that is too hard.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D39983
2023-05-11 14:06:03 -06:00
Warner Losh
2f131435bc stand: efi create eficom console device.
Fix the 'renaming kludge' that we absolutely cannot do going forward
(it's cost us days of engineering time).

console=comconsole talks to the hardware directly. This is available
only on amd64. It is not available anywhere else (and so requires
changes for people doing comconsole on aarch64)

console=eficom talks to the console via EFI protocols.  It's available
on amd64, aarch64 and riscv64. It's the first port that we find, though
it can be overriden by efi_com_port (which should be set to the UID of
the serial port, not the I/O port, despite the name). devinfo -v
will give the UID to uartX mapping.

This is an incompatible change for HYPER-V on amd64. It only works with
eficom console, so you'll need to change your configuration in
loader.conf. No compatibility hack will ever be provided for this (since
it requires renamig, which the loader cannot reliably do).

It's also an incompatible change for aarch64. comconsole will need to
change to eficom. There might be a comconsole "shim" for this.

All the interlock to keep only eficom and comconsole from both attaching
have been removed.

RelNotes:		Yes
Sponsored by:		Netflix
Discussed with:		kevans
Differential Revision:	https://reviews.freebsd.org/D39982
2023-05-11 14:06:03 -06:00
Kyle Evans
86c31aca33 arm64: add swapueword8/32
Much like casueword*, except just a plain old swap.  Maintains a similar
interface to casu(9)- return value -1 (fault), 0 (success), or 1 (fail),
and also both ll/sc and LSE variants are implemented.

These will be used to implement 32-bit swp/swpb emulation on aarch64.

Reveiwed by:	andrew
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D39837
2023-05-11 13:23:14 -05:00
Ed Maste
9244506a1b Cirrus-CI: hide manual tasks from official runs
Sponsored by:	The FreeBSD Foundation
2023-05-11 14:20:43 -04:00
Chuck Silvers
9095169520 fbt/x86: update FBT_AFRAMES to match the trap handlers
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D40054
2023-05-11 10:50:15 -07:00
Dmitry Salychev
718bdb6a71
dpaa2: Simplify addresses translation with PHYS_TO_DMAP
Approved by:		bz (mentor)
Reviewed by:		bz (mentor), mhorne
Differential Revision:	https://reviews.freebsd.org/D39946
MFC after:		3 weeks
2023-05-11 17:38:35 +02:00
Pierre Pronchery
74192f9b2d ktls_test: specify OpenSSL 1.1 API
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-05-11 10:30:51 -04:00
Corvin Köhne
60793cee27
bhyve: make passthru sel public available
The GVT-d emulation requires access to this selector to read from the
device.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40035
2023-05-11 14:30:19 +02:00
Corvin Köhne
ca14781c81
bhyve: add cmdline option for user defined fw_cfg items
Some guest allow to configure themself by fw_cfg. E.g. Fedora CoreOs can
be provisioned by adding a JSON file as fw_cfg item.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38338
2023-05-11 14:20:32 +02:00
Li-Wen Hsu
fec7422037
Complete removing twe(4)
Fixes:	062a7b918f twe: Remove driver
2023-05-11 16:28:23 +08:00
Kristof Provost
0229fab2fe e1000: fix VLAN 0
VLAN 0 essentially means "Treat as untagged, but with priority bits",
and is used by some ISPs.

On igb/em interfaces we did not receive packets with VLAN tag 0 unless
vlanhwfilter was disabled.

This can be fixed by explicitly listing VLAN 0 in the hardware VLAN
filter (VFTA). Do this from em_setup_vlan_hw_support(), where we already
(re-)write the VFTA.

Reviewed by:	kbowling
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40046
2023-05-11 09:48:50 +02:00
Dag-Erling Smørgrav
27e74c8fff md5: Add missing <errno.h>.
Sponsored by:	Klara, Inc.
Reviewed by:	yuripv
Differential Revision:	https://reviews.freebsd.org/D40051
2023-05-11 06:24:02 +00:00
Enji Cooper
4e9041a786 rc.subr(8): run trailing-whitespace-fixer
This change deletes benign trailing whitespace from rc.subr, making
future non-stylistic changes easier to spot.

MFC after:	1 week
2023-05-10 22:39:32 -07:00
Miroslav Lachman
0661f93892 rc: add support for cpuset(1)
If ${name}_cpuset is specified (and /usr is mounted), cpuset(1) will be
run to limit the service to the configured cpuset.

PR:		142434
Reviewed by:	kevans
2023-05-10 23:40:18 -05:00
Warner Losh
062a7b918f twe: Remove driver
Sponsored by:		Netflix
2023-05-10 22:24:12 -06:00
Kyle Evans
3cb2f5f369 lualoader: add support for .lua configuration files
If a file is specified in loader_conf_files that ends in '.lua', lualoader
will now load and execute that file. These may be used in place of a
traditional loader.conf to use more complicated logic, where some values
may be set based on others or based on the environment that the C bits has
left us with.

Lua scripts are run in a limited environment. In particular, it does not get
access to any modules or, in-fact, anything except environment variable.

A config.buildenv hook has been added so that a local module can add
whatever it may need to to the environment.

When a global var is set in the lua script, it does not immediately alter
the loader environment. Instead, the script's environment is initially
empty and processed only if the whole script executes successfully.
Effectively, a lua configuration file either takes effect or it does not,
an error will not leave it in a half-baked state.

Reviewed by:	bcr (manpages), imp
Differential Revision:	https://reviews.freebsd.org/D28450
2023-05-10 23:10:53 -05:00