acpica: Fix SRAT memory region insertion sort
The SRAT table can list memory regions in any order, but we need them
sorted. There is an insertion sort to accomplish this when building
the mem_info array, but instead of inserting the new region before
the *first* higher-base-address region, it was inserting the new
region before the *last* higher-base-address region; i.e. if the array
already held "1 3 4" then inserting "2" would produce "1 3 2 4".
Break out of the insertion-location-finding loop when we find the right
spot to insert the new memory region into the list, rather than looking
further.
Reviewed by: jhb
Fixes: dd540b46236b ("Add a parser for the ACPI SRAT table...")
MFC after: 1 day
Sponsored by: Amazon
Tested on: c5n.9xlarge, c6a.24xlarge, c6a.metal, c7a.metal-48xl
c7i.metal-24xl, c7i.metal-48xl, c8a.metal-24xl
[5 lines not shown]
EC2: Set hw.dmar.enable="1"
Large EC2 "bare metal" instances route interrupts to APIC IDs > 255,
and unlike the "virtualized" instances, don't support extended APIC
destination IDs (since that's a hypervisor feature, and bare metal
instances have no hypervisor).
Enable the IOMMU for interrupt remapping; this unbreaks booting on
m8i.metal-96xl and variants thereof (e.g. c8in).
MFC after: 1 day
Sponsored by: Amazon
Tested on: c5n.9xlarge, c6a.24xlarge, c8in.96xlarge, c5.metal,
c6in.metal, c6a.metal, c7a.metal-48xl, c7i.metal-24xl,
c7i.metal-48xl, c8a.metal-24xl, c8a.metal-48xl,
c8i.metal-48xl, c8i.metal-96xl, c8in.metal-48xl,
c8in.metal-96xl, m5.metal, m8azn.metal-24xl
(cherry picked from commit 3c03ab02cf312d4fdf37ce3ff90b901722c4b3cb)
bhyve: disable SIGPIPE for IPC connections
Currently, if an IPC client (e.g. bhyvectl --get-vm-pid) exits
before reading the response, the VM crashes with SIGPIPE.
Set SO_NOSIGPIPE on a socket to prevent that.
While here, update other error paths in init_ipc_thread()
to return -1 on error instead of an error number to make error
handling consistent.
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D62000
pf: fix memory leak on failure in DIOCADDETHRULE
If we fail pf_nveth_rule_to_keth_rule() we jumped to
DIOCADDETHRULE_error, which doesn't free the rule.
Free the rule directly, because pf_free_eth_rule() expects the rules
lock to be held, and at this point we've only allocated the rule itself,
not any of the child objects.
Reported by: llm-postcr
Fixes: e732e742b37f ("pf: Initial Ethernet level filtering code")
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf: fix NULL dereference on failure in DIOCADDETHRULE
If the ticket or anchor check in DIOCADDETHRULE fails
we pf_free_eth_rule() on a struct pf_keth_rule with NULL
ipsrc.addr.p.tbl/ipdst.addr.p.tbl. That ends up dereferencing that NULL
pointer.
Teach pf_free_eth_rule() to check for NULL in those fields so it's safe
to free a rule we're in the process of creating.
Reported by: llm-postcr
Sponsored by: Rubicon Communications, LLC ("Netgate")
bhyve: fix bootorder for PCI slots >= 10
Currently, bhyve writes slots as decimals. Firmware such as EDK2
interprets them as hexadecimals, so slot 10 becomes 16, breaking
the configured boot order.
Reviewed by: markj
Fixes: 6632a0a4e3ab ("bhyve: add helper to create a bootorder")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61997
databases/qdrant: fix build on powerpc64*
The 1.20.1 update dropped the patches from qdrant PR #11321, which is
still open, so the build fails again in lib/quantization/build.rs.
Bring them back. The telemetry fix and the sysinfo patch stay gone,
1.20.1 and sysinfo 0.40.1 have them.
math/sdpa: fix build with CPUTYPE
The bundled MUMPS reads the compiler flags with cut -f2 -d=, which stops
at the next '='. With CPUTYPE=power9 it ends up calling cc with a bare
-mcpu. Use cut -f2- like etc/Makefile already does.
Approved by: portmgr (blanket)
biology/bifrost: fix build with CPUTYPE
COMPILATION_ARCH ends up as -march=, so the build breaks when CPUTYPE
isn't a valid -march value, like power9 on powerpc64le. CPUTYPE is
already in CFLAGS through bsd.cpu.mk, so just turn it off.
security/snort3: fix plist without HYPERSCAN
The 3.13.2.0 update lost the %%HYPERSCAN%% markers on the hyper_* headers.
They are only installed with Hyperscan, so packaging fails when the option
is off, which is the default everywhere except amd64.
Fixes: eaab43165ef2 ("security/snort3: Update version 3.12.4.0=>3.13.2.0")
devel/libunwind-devel: fix build on powerpc64*
Pull in the upstream fixes for the ppc64 build and for unwinding from
core files, which didn't work on FreeBSD at all. Coredump support now
builds on powerpc64* too, only powerpc keeps it disabled.
Approved by: portmgr (blanket)
games/anki: fix build on powerpc64le
Since 92401c33b734 the node modules archive has the architecture in its
name, so the one for powerpc64le is missing from distinfo. It's the same
file as the amd64 one, so add it under its own name.
Approved by: portmgr (blanket)
net-im/tuwunel: enable on powerpc64*
tuwunel sizes its database thread pool by the number of CPUs and fails to
start when that goes over FreeBSD's per-process thread limit, which
happens on bigger machines, amd64 included. Cap it at
kern.threads.max_threads_per_proc. Also drop a little-endian assert from a
rocksdb test helper that breaks the build on powerpc64.
Approved by: portmgr (blanket)
devel/llvm20: backport fix for crashes on half freeze
LLVM 20 aborts with "Do not know how to promote this operator's result!"
when it has to promote a freeze of a half value, which happens on targets
without native half support like powerpc64. Julia's Float16 code runs
into it.
Approved by: portmgr (blanket)
Obtained from: https://github.com/llvm/llvm-project/commit/5b6b4fdb4b07e1d0d9a647f40a30d47f26178e09
mmc: Allow HS400ES with HS400 at a single I/O voltage
mmc_host_timing() allows HS400ES only if the host supports HS400 at
both 1.2 V and 1.8 V. A host with only 1.8 V I/O, such as the Zhihe
A210, gets plain HS400 instead, which needs tuning in HS200 first.
Accept HS400 at either voltage, as the plain HS400 check does, and use
the same rule in the sdhci capability printout.
Signed-off-by: Han Gao <gaohan at iscas.ac.cn>
Reviewed by: imp
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2523
riscv: Add the T-Head C908 and C920v2 marchid values
Older T-Head cores report a zero marchid, but the C908 and C920v2 have
their own: 0x8000000009140d00 and 0x80000000090c0d00, as read on the
Zhihe A210, whose firmware also uses them to tell its two clusters
apart. Add them so that these cores are named instead of "Unknown".
Signed-off-by: Han Gao <gaohan at iscas.ac.cn>
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2584
riscv: Fence after enabling the MMU in locore
Writing satp doesn't flush cached translations. If the kernel is entered
with translation already on, the hart may keep using the firmware's
mappings after locore switches page tables if they share an ASID.
Add an sfence.vma after each satp write in locore.
Signed-off-by: Han Gao <gaohan at iscas.ac.cn>
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2522
riscv: Apply the T-HEAD errata only to early cores
The XTheadMae page attributes and the vendor cache operations are needed
by the early T-HEAD cores (C906, C910, C920), which report zero marchid
and mimpid. Later cores such as the C908 and C920v2 report non-zero
values and implement the standard Svpbmt and Zicbom extensions instead.
Setting the T-HEAD memory attribute bits there makes the early page
tables use reserved PBMT encodings.
Check marchid and mimpid before applying the quirks, both in
handle_thead_quirks() and in the early PTE setup in locore.
Signed-off-by: Han Gao <gaohan at iscas.ac.cn>
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2522