Commit graph

291696 commits

Author SHA1 Message Date
Warner Losh 5e7b0cd93a i386/nullconsole: Use C99 initializers
Sponsored by:		Netflix
2024-05-19 22:05:41 -06:00
Warner Losh 803060b217 i386/spinconsole: Use C99 initializers
Sponsored by:		Netflix
2024-05-19 22:05:41 -06:00
Warner Losh a578e2b896 boot/i386: Use C99 initializer for textvidc
Sponsored by:		Netflix
2024-05-19 22:05:41 -06:00
Warner Losh f989ebd4de kboot: Use C99 initialiers for hostconsole.
Sponsored by:		Netflix
2024-05-19 22:05:41 -06:00
Warner Losh 0111f09ca6 kboot: Initialize hostfs_root sooner (and remove kboot.conf)
Move the initialization of hostfs_root to be a bit sooner. While it
doesn't matter for the default case, we may want to use hostfs files
sooner.

Also, while we're here, remove kboot.conf. It duplicates the command
line and has proven difficult to use. It will be replaced by an early
script that can influence the state of the boot loader before we select
a device to boot from (including strongly suggesting which one to boot
from).

Sponsored by:		Netflix
2024-05-19 22:05:41 -06:00
Warner Losh 68344c9c6c loader: separate lang init from scripting init
Create interp_preinit() to initialize the scripting language to run
scripts. Make sure you can call it multiple times, but only the first
one has effect, After it's call, you can run scripts in the scripting
language. At the moment, no functional change.

Sponsored by:		Netflix
2024-05-19 22:05:40 -06:00
Warner Losh 1d7bdae9ca kboot: Move console, acpi and smbios init
Move the console probing to as early as possible. There's no real
support for anything but hostcons, and setting it up early will show
other error messages.

ACPI and SMBIOS probing can be done just after we have the console, so
move it there. This allows other parts of the early code to use info
from that, as well as overriding and env vars set by these things on the
command line (smbios data may be wrong during initial development phases
as the automated way to populate per-board data may not be established,
etc).

Sponsored by:		Netflix
2024-05-19 22:05:40 -06:00
Zhenlei Huang 68c890b443 linux(4): Add const qualifier to the value parameter of function handle_string()
The content that `value` point to is not going to be altered by function
handle_string().

MFC after:	1 week
2024-05-20 12:02:33 +08:00
Zhenlei Huang 92f2a4c820 compat_freebsd4: Add const qualifier to the local variable s inside function freebsd4_uname()
This local variable s is for iterating characters of global variable
`version`. The content of `version` is not going to be altered by
function freebsd4_uname().

MFC after:	1 week
2024-05-20 12:02:32 +08:00
Konstantin Belousov 6cba29c09a acpidump IVRS table format: change 'IOMMUId' into 'IOMMU DeviceId'
and apply the consistent format for device ids used in other IVRS
elements.  The field seems to be the PCI Device ID of the IOMMU itself,
instead of an abstract unit ID.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-20 02:04:45 +03:00
Alan Cox 4f77144279 arm64 pmap: eliminate a redundant variable
Moreover, if we attempt an L2 promotion on the kernel pmap from
pmap_enter_quick_locked(), this change eliminates the recomputation of
the L2 entry's address.

MFC after:	1 week
2024-05-19 14:33:19 -05:00
Alan Somers 3cc1b35bc1 vfs_getopt(9): fix typo
[skip ci]

Reported by:	Claudiu <mscotty@protomail.ch>
MFC after:	2 weeks
2024-05-19 09:49:03 -06:00
Mariusz Zaborski 838d5ae6d8 geli: fix indentation
no functional changes
2024-05-19 15:37:07 +02:00
Mariusz Zaborski 4b3141f5d5 geli: allocate a UMA pool earlier
The functions g_eli_init_uma and g_eli_fini_uma are used to trace
the number of devices in GELI. There is an issue where the g_eli_create
function may fail before g_eli_init_uma is called, however
g_eli_fini_uma is still executed in the fail path. This can
incorrectly decrease the device count to zero, potentially leading to
the UMA pool being freed. Accessing the device after the pool has been
freed causes a system panic.

This commit resolves the issue by ensuring devices count is increassed
eariler.

PR:		278828
Reported by:	Andre Albsmeier <mail@fbsd2.e4m.org>
Reviewed by:	asomers
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45225
2024-05-19 14:53:17 +02:00
Konstantin Belousov ff4480baf6 nfs client comment typo fix
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-05-19 01:49:59 +03:00
Alan Somers 3bb5428ad6 rc.conf.5: remove obsolete advice about kld_list
Loading modules via kld_list is no longer substantially faster than via
loader.conf.

[skip ci]

MFC after:	2 weeks
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D45242
2024-05-18 09:51:15 -06:00
Randall Stewart ea916b6412 Remove TCP_SAD optional code now that the sack filter performs this function.
With the commit of D44903 we no longer need the SAD option. Instead all stacks that
use the sack filter inherit its protection against sack-attack.

Reviewed by: tuexen@
 Differential Revision:https://reviews.freebsd.org/D45216
2024-05-18 10:57:04 -04:00
Warner Losh 97aedd3395 devctl: Disable the boottime optimization of suppressing NOMATCH
The usb bus code (uhub) doens't present the same information to devctl
as it does to the NOMATCH events it generats. As such, devmatch fails to
find USB devices on boot when NOMATCH events are optimized out. Since
the savings of boot time is relatively trivial for all but the most
demanding boot environments, disable it by default until this issue is
fixed.

Fixes: 6437872c1d
MFC After: 1 minute
Sponsored by:		Netflix
2024-05-18 07:07:16 -06:00
Ed Maste fb623aab39 diff: honour -B flag with -q
PR:		278988
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45220
2024-05-17 20:03:56 -04:00
Navdeep Parhar 64a00f877f cxgbe(4): Consolidate all mk_set_tcb_field_ulp in one place.
MFC after:      1 week
Sponsored by:   Chelsio Communications
2024-05-17 15:52:33 -07:00
Navdeep Parhar cca3506dc1 cxgbe(4): sc->port is indexed by port_id and not tx_chan.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-05-17 15:42:23 -07:00
Brooks Davis 61ad1ddc5a Improve broken-on-gcc checks
Mark powerpc* and riscv broken.

Refactor and add a TRY_GCC_BROKEN option to build anyway.  This
simplifies things for people trying to get gcc builds working
while letting other developers know that they aren't expected to work.

Reviewed by:	jhb, emaste
Improves:	4c0dfd5959 arm: fail early on gcc builds
Differential Revision:	https://reviews.freebsd.org/D45230
2024-05-17 21:50:57 +01:00
Brooks Davis 1062db3070 libcxxrt: allow build with gcc13 and --no-undefined-version
GCC 13 supports _Float16 and __int128 on fewer architectures than clang
and thus libcxxrt compiled with gcc13 is sometimes missing related
symbols.  Hack around this by explicitly appending --undefined-version
to LDFLAGS in problematic cases.

Reviewed by:	theraven, dim
Differential Revision:	https://reviews.freebsd.org/D45233
2024-05-17 21:50:57 +01:00
Pierre Pronchery f7d45c5443 bhyve: avoid side effect in assertion
An assert() was setting the error variable instead of checking it.

Reported by:	Coverity Scan
CID:		1521431
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1244
2024-05-17 15:45:18 -04:00
Brooks Davis 25db7bd2fa libgcc_s: fix nonsense defines
These symbols are present on amd64 or i386.

Reported by:	kaktus, jhibbits
Fixes:		98c8caafff libgcc_s: 80-bit long double function are x86-only
2024-05-17 20:05:36 +01:00
Marko Zec 42b3c16e30 fib_dxr: code hygiene, prune old code, no functional changes
The !DXR2 code corresponds to the original DXR encoding proposal from
2012 with a single direct-lookup stage, which is inferior to the more
recent (DXR2) variant with two-stage trie both in terms of memory
footprint of the lookup structures, and in terms of overall lookup
througput.

I'm axing the old code chunks to (hopefully) somewhat improve readability,
as well as to simplify future maintenance and updates.

MFC after:	1 week
2024-05-17 18:57:25 +02:00
Marko Zec 19bd24caa4 fib_dxr: do not leak memory if FIB constellation hits structural limit
DXR lookup table encoding has an inherent structural limit on the amount
of binary search ranges it can accomodate.  With the current IPv4 BGP views
(circa 1 M prefixes) and default DXR encoding we are only at around 5% of
that limit, so far, far away from hitting it.  Just in case it ever gets
hit, make sure we free the allocated structures, instead of leaking it.

MFC after:	1 week
2024-05-17 18:46:41 +02:00
Pierre Pronchery e9806d2128 bhyve: avoid resource leak in error path
In e820_finalize(), the e820_fwcfg_item variable, containing the
etc/e820 file (for the e820 table from the BIOS) is not free()'d when it
could not be added to the QEMU firmware configuration device (fw_cfg).

Reported by:	Coverity Scan
CID:		1522761
Reviewed by:	corvink, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45223
2024-05-17 12:26:27 -04:00
Marko Zec 4ab122e8ef fib_dxr: check if cached fib_data matches the new request in dxr_init()
When calling dxr_init(), the FIB_ALGO infrastructure may provide a
pointer to a previous dxr instance, which permits reuse of auxiliary
dxr structures, i.e. incremental lookup structure updates.  For dxr this
is a crucial feature provided by FIB_ALGO, since dxr incremental updates
are typically several orders of magnitude faster than full lookup table
rebuilds.

However, the auxiliary dxr structure caches a pointer to struct fib_data and
relies upon it for performing incremental updates.  Apparently, incremental
rebuild requests from FIB_ALGO, i.e. a calls to dxr_init() with a pointer
old_data set, may (under not yet fully understood circumstances) be invoked
within a different fib_data context than the one cached in the previous
version of dxr auxiliary structures.  In such (rare) events, we ignore the
offered old dxr context, and proceed with a full lookup structure rebuild
instead of attempting an incremental one using a fib_data context which
may or may not no longer be valid, and thus lead to a system crash.

PR:		278422
MFC after:	1 week
2024-05-17 18:21:54 +02:00
Andrew Turner 457fa0f69c arm64: Support break and watch points in VHE
When booting the kernel with VHE it will be running at EL2. The current
config register values only enable the reaces at EL1 when tracing the
kernel.

Set the HMC flag to also trap from EL2.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45121
2024-05-17 16:07:16 +00:00
Andrew Turner e72c417723 arm: Use the correct irq when in the hypervisor
When booting in the hypervisor state we need to use the hypervisor
interrupt in the generic timer. In this case the registers we access
in the kernel are remapped to the EL2 versions, however this causes
an unexpected interrupt to trigger.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43975
2024-05-17 16:07:16 +00:00
Andrew Turner f715e95461 arm: Add a missing interrupt to the generic timer
The ACPI generic timer attachment added 3 interrupts, but missed the
hypervisor physical interrupt. As the field is present in all versions
of the GTDT ACPI table and isn't an optional interrupts we can add it
to the interrupts provided to the driver.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D43974
2024-05-17 16:07:15 +00:00
Andrew Turner 097bd33dd7 uart: DBG2 support to find the debug uart
The Debug Port Table 2 (DBG2) contains information on which devices
can be used for debugging purposes.

Add support to the uart driver to use the DBG2 table when enabled from
loader.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44359
2024-05-17 16:07:15 +00:00
Brooks Davis d316de24fa zfs: Avoid a gcc -Wint-to-pointer-cast warning
On 32-bit platforms long long is generally 64-bits.  Sufficiently modern
versions of gcc (13 in my testing) complains when casting a pointer to
an integer of a different width so cast to uintptr_t first to avoid the
warning.

Fix i386 gcc builds while we wait for this to be merged to OpenZFS.

Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/openzfs/zfs/pull/16203
2024-05-17 17:01:19 +01:00
Brooks Davis 4c0dfd5959 arm: fail early on gcc builds
Since at least 2022 (see https://reviews.freebsd.org/D36754), it has
not been possible to build armv6/armv7 with gcc due to atomics macros
gcc doesn't like.  Prevent developers doing due diligance from wasting
time and CPU cycles on this combination as it just fails to build in
libc.

Reviewed by:	imp, andrew
Differential Revision:	https://reviews.freebsd.org/D45193
2024-05-17 17:01:19 +01:00
Brooks Davis 16d8dfde0c aarch64: disable LIB32 with gcc
gcc doesn't have -m32 support on aarch64 so mark LIB32 broken there.

We have to check both COMPILER_TYPE and X_COMPILER_TYPE becuase
X_COMPILER_TYPE is only conditionally set and COMPILER_TYPE is the host
compiler in Makefile.inc1.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45089
2024-05-17 17:01:18 +01:00
Zachary Leaf 4f8ba1c9dd arm64: add CONTEXTIDR_EL1 reg
CONTEXTIDR_EL1 is used in debug and trace features to identify the
current process or context.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45173
2024-05-17 15:46:27 +01:00
Zachary Leaf 10b3eac88d arm64: add PMBSR_MSS_{BSC,FSC} status code field
Bits [5:0] of PMBSR_MSS encodes either Buffer Status Code (BSC) or Fault
Status Code (FSC) depending on PMBSR_EC value.

Add PMBSR_MSS_{BSC,FSC} to cover this field.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45172
2024-05-17 15:46:00 +01:00
Zachary Leaf f7bdaa103e arm64: make SPE regs use ALT_NAME macro
When the register is not defined in Armv8.0 i.e. added in a later
extension, like SPE added in v8.2, the alternative name format of:
    S<op0>_<op1>_C<crn>_C<crm>_<op2>
should be used; otherwise, calls to {READ,WRITE}_SPECIALREG() will
fail.

Use the MRS_REG_ALT_NAME() macro for SPE changing hex to decimal as
required by the macro.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45171
2024-05-17 15:45:44 +01:00
Andrew Turner 2790ff2145 dev/psci: Fix a function name
dd a missing underscore to arm_smccc_1_2_* to fix the GCC build.

Sponsored by:	Arm Ltd
2024-05-17 13:19:59 +00:00
Andrew Turner 4660d96587 arm64/vmm: Fix the build with GCC
- Fix the spelling of handle_el2_el1_irq64
- Add .section before .rodata as the GCC build needs it

Sponsored by:	Arm Ltd
2024-05-17 13:19:45 +00:00
Justin Hibbits 62adeb92df tpm: Add new tpm_bus.c to module Makefile
Reported by:	eduardo@
Fixes:		c2e9c5bbf0 ("tpm: Refactor TIS and add a SPI attachment")
2024-05-17 12:57:38 -04:00
Andrew Turner 2228d7c599 Revert "rtld: Add arm64 variant pcs tests"
It's missing an mtree update

This reverts commit 9e48c30e25.
2024-05-17 11:19:24 +00:00
Andrew Turner cd36810110 arm64: Use the _REG macros to read ID registers
To build with old toolchains use the *_REG macros to access the ID
registers. These become a name in the form S?_?_C?_C?_? where the '?'
values encode the op and CR values needed to access the register.

For consistency use these macros for all ID registers, even if most
toolchains understand them.

Reviewed by:	Zachary Leaf <zachary.leaf@arm.com>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45177
2024-05-17 09:38:38 +00:00
Andrew Turner d6d860c7ff arm64: Add MRS_REG_ALT_NAME ID register macros
These can be used even when the compiler is too old for the register
to be included.

Reviewed by:	Zachary Leaf <zachary.leaf@arm.com>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45176
2024-05-17 09:38:17 +00:00
Andrew Turner 1cd90a2c16 rtld: Move powerpc specific code to powerpc files
There are two variables set by dynamic tags in the powerpc runtime
linker. Now we have a way to split out architecture-specific dynamic
tags use it to handle these.

Reviewed by:	kib, jhibbits
Obtained from:	jhibbits (earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45182
2024-05-17 09:37:23 +00:00
Andrew Turner 9e48c30e25 rtld: Add arm64 variant pcs tests
When marking a function as variant pcs we can use registers not normally
used in procedure calls. Add a test that uses this and stores all
general purpose registers to a buffer and compare this buffer with the
expected value later.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44870
2024-05-17 09:37:23 +00:00
Andrew Turner d51fa0a9b1 rtld: Add support for arm64 variant pcs
The aarch64 ELF spec has support for a variant of the normal procedure
call standard that doesn't follow the normal register convention, e.g.
using more registers as arguments, or different register state is
preserved.

Add support to rtld to handle this. As we don't know which registers
need to be preserved disable lazy binding for these functions.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44869
2024-05-17 09:37:23 +00:00
Andrew Turner dd4155bec7 rtld: Add arch_digest_dynamic
This will be used to handle the DT_AARCH64_VARIANT_PCS tag.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45117
2024-05-17 09:37:12 +00:00
Andrew Turner 06db20ffec rtld: Add MD_OBJ_ENTRY to extend Struct_Obj_Entry
Add a macro the architectures can use to add per-arch fields to
Struct_Obj_Entry.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45116
2024-05-17 09:36:08 +00:00