iwm: mask closed_rb_num to the RX ring size
iwm_notif_intr() reads hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff and
loops while (sc->rxq.cur != hw) without masking hw to the ring size (512 entries
for 9000-series MQ RX, 256 for legacy). If the hardware reports a value at or
above the ring size, cur never equals hw: the loop walks stale ring entries
indefinitely and the write-pointer update uses a bogus index. Linux iwlwifi
masks the value (5eae443eb5e2) and OpenBSD has done the same since 9000-series
support was added (3287dca4fa10).
This was found while debugging an iwm crash on another BSD using the same
driver lineage (DragonFly, upstream bug 3449)
Locally tested:
* 7260, 9260, STA mode
PR: kern/299427
Submitted by: David Bidner <david at crap.solutions>
[2 lines not shown]
iwm: ensure NIC is alive during txq enable
I broke this in a previous commit. OpenBSD already has the NIC
nailed alive but FreeBSD's codebase currently does not.
Locally tested:
* 7260, 9260, STA mode
Fixes: 0a12ff65b9647a6e31471e5d27a8692b4adb6803
Differential Revision: https://reviews.freebsd.org/D60823
iwm: fix incorrect mutex / crash use during error detach path
My previous commit (b3ef4013a4) added a couple of lock assertions.
However, the detach assertion is wrong - if the driver hasn't
attached then detach needs to be a no-op and this includes
not touching a deinit'ed mutex.
So, move the mutex check and use until after the attached check.
This fixes the driver crash I saw when another bit of in-flight
work caused attach to fail, and thus iwm_detach() -> iwm_detach_local()
ended up trying to use a deinit'ed mutex, leading to a crash.
Fixes: b3ef4013a4fa75063930d0221a0bc50f95af0527
Differential Revision: https://reviews.freebsd.org/D60821
[LV] Don't emit duplicate negative stride runtime checks
This speeds up x264 by 2.15% on RISC-V by avoiding a duplicate hoisted runtime check.
When hoisting runtime checks we need to check that any strides are non negative. But for a loop like
```c
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
dst[(i * stride1) + j] = src1[(i * stride2) + j] + src2[(i * stride2) + j];
```
We have the pairs [dst, src1] and [dst, src2]. Both pairs end up checking that stride1 and stride2 are non-negative in IsConflict, and because there's other values between the two checks in the chain of ors InstCombine can't deduplicate it. This PR deduplicates the stride checks.
I'm aware some of this memory check stuff is being moved into VPlan but I'm not sure what the plan is with hoisted runtime checks, so it seemed better to just fix it here first.
This helps all targets but the motivating case is this loop in x264:
```c
[82 lines not shown]
[ExecutionEngine] Set mlir-runner's library options in the LLVMContext (#233131)
Since #233044, the LLVMContext that ExecutionEngine creates reads the
defaults instead, so LowerMatrixIntrinsics ignores
-matrix-default-layout=row-major and
Integration/Dialect/Vector/CPU/*-row.mlir fail.
Parse the options into a cl::LibraryOptionsContext and add
ExecutionEngineOptions::libraryOptions.
lean4: update to 4.35.0.
The main new feature of Lean 4.35.0 is vcgen, a faster and more
general successor of mvcgen. It also adds lake check and lake
comparator, which check a project with Lean's kernel and, if
requested, with several independent kernels that now come with the
toolchain. On the tactic side, rwa has been redesigned, constructor
now warns when it has to choose between constructors, and grind
proves more goals about BitVec and fixed-width integers by translating
them into Nat and Int arithmetic. Decidable has a new definition
based on Bool, which makes many more equations hold by rfl.
sysrc: Be quiet when changing values
Make it easier for the rc group to facilitate having an option to fully
boot muted (à la OmniOS) without resorting to /dev/null redirections.
Reviewed by: imp, dteske
Differential Revision: https://reviews.freebsd.org/D46120
cpufreq_dt: communicate full voltage range to regulators
In the last commit, fdtbus_regulator_set_voltage got changed to accept the voltage as a target, min, max triple from a min, max pair. This commit switched the cpufreq code over to sending the full voltage triple to regulators if it is available in the device tree.
This fixes PR 60671
fdtbus_regulator_set_voltage_triple: support target/min/max
Some dt-bindings specify voltages as target/min/max, while the NetBSD fdt subsystem only supported min/max.
This PR introduces fdtbus_regulator_set_voltage_triple that tries to set the voltage to an optimal value before falling back to the full range.
See PR 60671
[LV] Add test duplicate negative stride checks in hoisted runtime checks. NFC (#233130)
In this test we have [dst, src1], [dst, src2] as pointer pairs, and for
hoisted
runtime checks both pairs need to check that stride1 and stride2 are
non-negative. But we end up emitting duplicate `icmp slt i64
stride{1,2}, 0`
checks across the two pairs when we only need to check them once.
Extracted from pixel_avg in x264.
Import math/HiGHS from wip, update to version 1.15.1.
HiGHS is a high performance serial and parallel solver for large
scale sparse linear programming (LP) problems of the form:
Minimize c^Tx subject to L <= Ax <= U; l <= x <= u
[Support] Remove the T::Global fallback in LibraryOptionsContext::get<T>() (#233044)
A context's values for T start as a copy of T::Global, which
cl::ParseCommandLineOptions sets, and get<T>() returns T::Global for a
context without values for T. Use a new constant T::Default instead, so
a tool must parse library options with
`cl::parseCommandLineOptions(LibraryOptionsContext &, ...)`.
LLM-aided
[mlir][scf] Test forall promotion with multiple inserts (#232920)
Cover #231826 by checking that disjoint insertions into one shared
output are chained into a single result.
Assisted-by: Codex / GPT-6
linuxkpi: add uuid_t and helpers
linux/uuid.h has only the guid_t family. Add uuid_t, next to guid_t,
with uuid_equal(), uuid_copy(), import_uuid() and export_uuid(),
mirroring the guid_ versions.
Used by drm/virtio for dma-buf UUID export.
Signed-off-by: Denis Borovikov <denis.borovikov at gmail.com>
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D60199
linuxkpi: add pci_is_vga()
Returns true for a VGA-compatible display controller and for the
pre-PCI 2.0 VGA class (base 0x00, subclass 0x01), as Linux's
pci_is_vga() does. Used by drm/virtio to decide whether to remove
the firmware framebuffer on virtio-vga.
Signed-off-by: Denis Borovikov <denis.borovikov at gmail.com>
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D60200
linuxkpi: add strncpy_from_user()
Same semantics as Linux: returns the string length without the NUL,
count if the string was truncated, or -EFAULT. Implemented with
copyinstr(9). Unlike linux_copyin() it does not translate the remapped
ioctl argument window; its user, drm/virtio, passes a pointer taken
from the ioctl payload, so that is not needed.
Signed-off-by: Denis Borovikov <denis.borovikov at gmail.com>
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D60198
acpi_apple: make the device mode a typed enum
The two mode values were spelled as bit flags, but a device is exactly
one of the two and the dispatch compared the field for equality.
Turned them into an enum, type the softc field with it, and dispatch with
a switch that lists every value
No functional change.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D60793