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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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