[Mips] Support reserving GPRs with -ffixed-N (#217013)
NetBSD dedicates GPR $24 to mips_curlwp and passes -ffixed-24 when
building the MIPS kernel.
Add Clang driver options for numeric MIPS GPRs and lower them to
reserve-gprN target features. Teach the backend to reserve the
corresponding 32-bit register and its 64-bit super-register, and require
named-register accesses to refer to reserved registers.
Also replace the regex-based numeric register parsing with
StringRef::getAsInteger and add driver, allocation, and global-register
regression coverage.
tpm20: Move user copies outside the lifecycle lock
The TPM 2.0 character-device methods held the global device lock
while uiomove() accessed user memory. User page faults could therefore
delay suspend or detach even though the read response was already
buffered.
Add a per-open sleepable lock to serialize operations on each response
buffer. Stage commands under that lock before acquiring the device
lock, and copy them into the response buffer only after the lifecycle
checks succeed. This preserves an unread response when suspend or
detach rejects a write. Release the device lock before copying buffered
responses out. Also advance the response offset by the bytes actually
copied when uiomove() returns after a partial transfer.
Validated on an Intel TPM 2.0 TIS device. PCR reads and GetRandom
passed under 16-process mixed command load. A response was consumed
correctly in 5-byte, 7-byte, and remainder reads. Module unload/reload
recreated the device and entropy source without lock diagnostics.
[6 lines not shown]
tpm20: Correct 32-bit register helpers
OR4() reads only the low byte before writing the complete 32-bit
register. Preserve all register bits by using a matching 32-bit read.
Make BIT() produce an unsigned value so masks containing bit 31 do not
rely on a signed left shift into the sign bit. OpenBSD carries the
same change.
Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59244
[libc][cmake] Introduce add_type_header for OS/arch-specific types. (#220750)
* Follow the existing model of `add_macro_header` and introduce
`add_type_header` which implicitly adds OS-specific and arch-specific
dependencies for type definitions;
* Since arch-specific definitions may depend on other types (e.g.
`ucontext_t` depends on `sigset_t`),
move arch-specific folder inclusion and types to the bottom of the list;
* Use `add_type_header` for only four types (so far) that require it -
`mcontext_t`, `ucontext_t`,
`loff_t`, and `struct sysinfo`. We can bulk-update everyone else, but
that might be easier to do once
we have CMake formatter in place.
tpm20: Release transport state after command failures
Once a transport acquires locality, several TIS and CRB error paths
return without relinquishing it. They can also leave a partial FIFO
transaction or an active CRB command for the next operation to inherit.
Route post-locality exits through common cleanup. Reset the TIS command
state on every attempt. For CRB, cancel an active failed command when
necessary, request the idle state, and relinquish locality even when the
state transition itself fails.
Successful command handling is unchanged apart from sharing the same
cleanup path.
Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59243
tpm_tis: Close interrupt wait races
The TIS interrupt handler can acknowledge and signal an event after
the waiter checks the device status but before it enters tsleep().
Since the handler is MPSAFE, the command lock does not close this
window. A lost wakeup can delay a completed command for its full
timeout, up to 40 seconds for long TPM 2.0 operations.
Publish the expected event under an interrupt mutex and use a generation
counter to record matching interrupts. Recheck the device predicate
without the mutex because register access may sleep on a SPI transport,
then compare the generation before atomically waiting on a condition
variable. This closes the check-to-sleep race without placing sleeping
bus operations under a mutex.
Use an absolute deadline while retrying the predicate after wakeups.
Apply the same scheme to locality acquisition, which had an equivalent
race. Leave the expected event published while polling so the
attach-time test can still prove that an advertised interrupt arrived.
[10 lines not shown]
[SimplifyCFG] Handle switch-to-select remapping correctly (#213302)
Simplifed `switch`es whose input a select that maps one value to
another. Handles both equal and non equal forms and also avoids a
pointless case when it would not change anything.
Fixes #202212.
tpm20: Harden the common device lifecycle
Mark the device as dying before teardown and destroy the character
device before freeing its private state or lock. This prevents cdev
methods from entering with a freed internal buffer or a destroyed sx.
Check the teardown state in command paths, honor failures from the cdev
private data interface, and publish teardown before waiting for the
lifecycle lock. Keep that lock across TPM retry delays so commands
cannot interpose and private state remains pinned, but abort before the
next retry once teardown begins.
Block new cdev operations after a successful Shutdown(STATE). Keep the
suspend gate and the TPM command under the same lock so a userspace
command cannot invalidate the saved state before S3 entry. Clear the
gate only after Startup(STATE) succeeds.
Keep entropy harvesting scheduled after a transient command or suspend
failure, but stop it while suspended or once teardown begins. Queue the
[14 lines not shown]
tpm_tis: Restore validated interrupts after resume
TIS interrupt routing and enable registers may lose their state across
S3, while the driver retains its software indication that interrupts
work. A subsequent locality or command wait can then sleep for an
interrupt that cannot arrive.
Remember whether interrupts worked before suspend and restore the
vector, pending status, and enable mask before TPM2_Startup. Put the
transport in polling mode first; the interrupt handler promotes it back
to interrupt waits only after observing an interrupt from the restored
configuration. If register restoration fails, Startup and subsequent
commands continue using polling.
Preserve the initial interrupt-enable mask, including the firmware's
trigger and polarity selection proven by the attach time interrupt test,
and restore that exact mask rather than accepting post-S3 defaults.
Program the same safe baseline for polling devices during attach and
[16 lines not shown]
[MIPS] Fix GP-relative selection after select/add combine (#215414)
## Summary
- Rewrite `$gp + select(...)` before MIPS instruction selection when a
select
arm contains a GP-relative relocation.
- Keep each `MipsISD::GPRel` attached to a selectable add operation.
- Add MIPS32 regression coverage and update the resulting MIPS64 checks.
## Background
The generic DAG combiner can transform:
select C, (add $gp, %gp_rel(A)), (add $gp, %gp_rel(B))
into:
add $gp, (select C, %gp_rel(A), %gp_rel(B))
[31 lines not shown]
tpm20: Initialize common state before testing TIS interrupts
The TIS attach path tested its interrupt by transmitting GetRandom
before tpm20_init() allocated the internal command buffer. A TPM2 FIFO
device with a usable IRQ could therefore dereference a null
internal_priv.
Initialize the common TPM2 state before running the interrupt test.
Make common cleanup safe for partially initialized devices and leave
cleanup to the attachment after tpm20_init() fails, avoiding duplicate
release of the lock, command buffer, and random-source state.
Clear the IRQ resource pointer after releasing it when interrupt handler
setup fails so the later polling-mode detach does not release it twice.
Free the internal command allocation through its object pointer rather
than relying on its embedded buffer being the first structure member.
Reviewed by: kevans
[3 lines not shown]
[SLP] Handle InsertValueInst in getVectorElementSize. (#215473)
When given an `InsertValueInst`, the `getVectorElementSize()` function
was falling back to measuring the bit width of the instruction's result
type (the aggregate type, e.g. { i64, i64 } -> 128 bits) instead of
inspecting the scalar element value being inserted (operand(1) -> 64
bits).
This leads to an overestimated element bit-width, which restricts the
calculated maximum vectorization factor and can prevent valid SLP
vectorization of chains of insertvalue instructions.
---------
Co-authored-by: Aditya-Chaudhary1 <aditya.chaudhary1 at ibm.com>
tpm20: Validate suspend and resume commands
The internal TPM2_Shutdown and TPM2_Startup paths ignored both transport
failures and the TPM response. Suspend could therefore enter S3 without
saved TPM state, while resume could restart entropy harvesting after a
failed state restoration.
Build both commands through one helper, validate their response framing
and TPM return codes, and propagate failures. Retry the standard RETRY
and TESTING responses with bounded exponential backoff. Accept
TPM_RC_INITIALIZE from Startup because firmware may already have started
the TPM during resume.
Do not enter S3 after an unsuccessful state save, and do not restart the
entropy task when TPM state restoration failed. If Shutdown fails after
the entropy task was drained, requeue it before returning so an aborted
suspend does not permanently stop harvesting.
Reviewed by: kevans
[3 lines not shown]
[flang][PPC] Implement ieee_set_status and ieee_get_status for AIX (#215618)
This patch implements the ieee_set_status and ieee_get_status for AIX
PPC. On AIX, the trap-enable bits are needed to have the correct round-trip.
Assisted-by: IBM Bob
dns/wdns: Upgrade to 0.13.0
0.13.0:
* Remove strict aliasing violations.
* Replace Python dependency with shell script.
* Fix various off-by-one errors in bounds checking.
* Various small build and test fixes.
MFH: 2026Q3
Sponsored by: DomainTools LLC
ixl: Route suspend and resume through iflib
Register the iflib device suspend and resume methods. Remove the
direct initialization from the driver resume callback because
iflib_device_resume() performs the datapath restart after the callback
returns.
MFC after: 2 weeks
Sponsored by: BBOX.io
ixv: Wire iflib suspend and resume methods
Register the standard iflib device suspend and resume methods so the
framework reinitializes the VF datapath after a system power
transition.
MFC after: 2 weeks
Sponsored by: BBOX.io
iavf: Wire iflib suspend and resume methods
Register the iflib device suspend and resume methods so the existing
driver callbacks run during system power transitions. This stops
mailbox retry work before suspend and lets iflib reinitialize the
datapath after resume.
MFC after: 2 weeks
Sponsored by: BBOX.io
axgbe: Wire iflib power management methods
Register the standard iflib device methods for shutdown, suspend, and
resume. This gives axgbe the framework managed reinitialization used by
other iflib drivers after a power transition.
MFC after: 2 weeks
Sponsored by: BBOX.io
enic: Route resets through iflib lifecycle
Mark the driver stopped after attach so its first IFDI_STOP() call
does not repeat hardware shutdown.
Defer error interrupt recovery through iflib instead of calling
driver stop and init methods from interrupt context. Let iflib own
the stop and restart around MTU changes as well, avoiding duplicate
lifecycle operations.
MFC after: 2 weeks
Sponsored by: BBOX.io
OS-8766 load_sdc_sysinfo forks cut and sed per line, adding ~850ms to every zone boot
The loop forked a subshell, cut and sed for each line of sysinfo
output, about 71 processes per call. The function runs from the zone
brand statechange hook, so every zone boot paid for it.
Measured on a compute node with an Intel Xeon Gold 6240:
load_sdc_sysinfo 842 ms -> 33 ms
statechange hook 1012 ms -> 161 ms
vmadm start to guest ready 2631 ms -> 1721 ms
Output verified identical under both bash and ksh93: 69 variables,
byte for byte.
load_sdc_bootparams and sdc_bootparams_keys below have the same
pattern and are left alone here; they were not on the path measured.
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsuxyuVvHe6ro76LWLs8GP
[flang][Semantics] Accept multiple initialization of a COMMON block (#218529)
…as a GNU extension
Some compilers accept a named COMMON block variable being redundantly
initialized (via DATA statements or declaration initializers) in more
than one program unit, as a nonstandard extension, so long as every
appearance that initializes the block does so identically: the same
members are initialized to the same values everywhere the block appears.
flang currently rejects this unconditionally as a hard error, whether or
not the appearances agree.
Downgrade this to a portability warning enabled by default (matching the
behavior of the other compilers) when the initializations are
duplicates. A conflicting initialization -- a different value for a
shared member, or a member initialized in one appearance but not another
-- remains a hard error, as it has no defined, portable behavior
(compilers that accept it disagree on which appearance wins). A member
that is only indirectly initialized via an equivalenced object (rather
[24 lines not shown]
[BOLT][RISCV] Handle static IFUNC calls through .iplt (#207733)
Teach BOLT to recognize RISC-V `.iplt` as a PLT-like section and make
the RISC-V `.plt` entry size explicit. Static RISC-V binaries can use
`.iplt` entries together with `R_RISCV_IRELATIVE` relocations for GNU
IFUNC calls, while call sites reference the IFUNC symbol through
`R_RISCV_CALL_PLT`.
Allow default arguments deduction from the return type of the underlying deduction guide.
This change ensures that template parameters that cannot be deduced from constructor arguments receive appropriate default values.
[AMDGPU] Expose LDS block features to TargetParser (#220717)
Add `FeatureHalfAddressablePhysicalLocalMemory` to
`AMDGPUFrontendVisibleFeatures` so TargetParser carries them in its
per-GPU feature bitset.
18295 Add header tests to cover 18293 18294
Reviewed by: Toomas Soome <tsoome at me.com>
Reviewed by: Bill Sommerfeld <sommerfeld at hamachi.org>
Approved by: Robert Mustacchi <rm at fingolfin.org>
nfscl: A few more fixes for the NFS over RDMA client glue
A couple of additional fixes for the NFS client side RDMA glue:
- For Readdirplus, the reply needs to be a large chunk, so set
M_PROTO9 instead of M_PROTO8.
- The nfsclrdma.ko module now uses xprt_rdma_unmap_chunk()
instead of xprt_rdma_rekey_chunk().
Hopefully, this is it for the NFS over RDMA client glue changes.
MFC after: 3 months
Fixes: 884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")