aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* video(4): wake the kqueue knote when a buffer completesHEADmainBaptiste Daroussin4 hours1-0/+2
| | | | | | selwakeup() only wakes select/poll waiters; it does not notify the kqueue knote registered on the device, so EVFILT_READ never fired when a frame became available.
* video(4): add missing V4L2_CAP_EXT_PIX_FORMAT featureBaptiste Daroussin4 hours1-2/+3
| | | | this fixes, 2 failed v4l2-compliances tests
* nfscl: Yet more fixes for the NFS over RDMA client glueRick Macklem11 hours5-21/+18
| | | | | | | | | | | | | Yet again. I was trying to make the svc_vc_backchannel() operations do double duty and be used by the clnt_rdma.c code as well. It got too messy, so this reverts svc_vc.c back to its pre-glue form and adds the small changes needed to support a separate set of svc_rdma_backchannel_xxx() functions. This commit should not affect non-RDMA behaviour. MFC after: 3 months Fixes: 884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
* acpi_cpu: only report unmapped processor objects enabled in the MADTAbdelkader Boudih14 hours1-3/+62
| | | | | | | | | | Firmware expose a DSDT sized for the largest SKU of the platform, so a verbose boot prints an "ignored" line for every vacant processor slot. A vacant slot has no enabled MADT entry; a CPU that failed to come online does. Reviewed by: olce, adrian Differential Revision: https://reviews.freebsd.org/D59551
* intel/intelpmc: Add Intel PMC Core driverAbdelkader Boudih14 hours4-0/+228
| | | | | | | | | | | | | | | | | | | | | | Add driver for Intel Power Management Controller (PMC) found on Sunrise Point PCH chipsets. This device exposes S0ix sleep state residency counters and power management status. Sysctls provided: dev.intelpmc.0.slp_s0_residency_us - Time in deepest sleep (us) dev.intelpmc.0.ltr_ignore - LTR ignore mask dev.intelpmc.0.pm_cfg - PM configuration register dev.intelpmc.0.pm_sts - PM status register dev.intelpmc.0.access_denied - Firmware lock status Supported devices for now: - Sunrise Point-LP (0x9D21) - Sunrise Point-H (0xA121) Note: Later PCH generations (Cannon Lake, Tiger Lake, ect.) have different PMC register layouts according to the datasheet and would need per-generation tables. I avoided adding untested hardware in case they have a quirk. Reviewed by: olce, adrian Differential Revision: https://reviews.freebsd.org/D54881
* nvme: reject namespaces formatted with metadataAbdelkader Boudih15 hours2-0/+18
| | | | | | | | | | The active LBA format's MS field was never examined. I/O to a metadata-formatted namespace carries neither interleaved metadata nor MPTR, so every command is malformed, yet the namespace attaches as a disk with the wrong sector size. Reviewed by: imp, adrian Differential Revision: https://reviews.freebsd.org/D59625
* tpm_tis: Quiesce interrupts before registering a handlerKevin Bowling16 hours1-23/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current interrupt path uses the IRQ resource value directly as the LPC SIRQ selector in TPM_INT_VECTOR and already restricts it to 1 through 15. This is a driver limitation: a parent interrupt number need not equal an LPC SIRQ channel, and SPI TPMs can use a separate parallel interrupt. On the reported system with ACPI IRQ 45, the existing range check runs after handler registration and returns before disabling firmware interrupt delivery. This can leave a polling device with a handler on an asserted source. Disable and verify interrupt delivery before registering a handler or starting common TPM services. Preserve the existing range policy, using polling without registering a handler for routes rejected by that check, and release their IRQ resources. Keep a failed setup's potentially stale output cookie out of the device state; the interrupt framework may already have removed that handler. Cancel timed-out locality requests in the shared request helper, covering both interrupt programming and commands. Permit attach after a locality timeout if the enable register proves delivery is already off, allowing later command recovery. If delivery remains enabled and cannot be quiesced, fail attach instead of exposing a device node for possible later recovery. Report this as a quiesce failure since locality acquisition as well as register programming can fail. On detach, publish dying and serialize with commands before quiescing TPM interrupt delivery. Do this for polling devices too, since firmware may have re-enabled delivery and resume-time quiescing may have failed. Quiesce before common release destroys the command lock and before removing any handler. Report hardware quiesce failure while completing software cleanup. Reported by: adrian Reviewed by: adrian, imp MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59645
* LinuxKPI: Add dma_length field to struct scatterlistVladimir Kondratyev18 hours2-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | On Linux `dma_length` field of `struct scatterlist` is present on the arches where DMA mapping code is able to coalesce adjacent segments of physical address space. It contains total length of coalesced segments while `length` field contains non-coalesced length of each segment. On other arches `dma_length` is aliased to `length` field with `sg_dma_len` macro. As FreeBSD does not merge scatterlist segments it do not have `dma_length` field. It is appered that at least i915kms driver depends on existence of `dma_length` field. Add the field and disable it by default. To enable add to Makefile .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || \\ ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "powerpc" CFLAGS+= -DCONFIG_NEED_SG_DMA_LENGTH .endif Reported by: Ryan Fahy Reviewed by: bz MFC after: 1 month GHI: https://github.com/freebsd/drm-kmod/issues/315 Differential Revision: https://reviews.freebsd.org/D59630
* libc: Parenthesise qualifier-preserving function definitionsFaraz Vahedi22 hours1-1/+1
| | | | | | | | | | | | | Required to prevent function-like macros with the same name from being expanded in the definitions once they become active in a later C mode. Without the parentheses, the macro would rewrite the declarator, and the file would consequently fail to compile. This style is already used for similar cases such as mempcpy(). Reviewed by: fuz Approved by: fuz (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59600
* graid3: Restore lock acquisitionDag-Erling Smørgrav22 hours1-0/+1
| | | | | | | | | | | | The lock acquisition in g_raid3_ctl_insert() was improperly dropped a while ago, making it impossible to add or replace a device in an existing graid3. This went unnoticed because the tests are broken. MFC after: 1 week Fixes: fcf69f3dbce6 ("Consistently use gctl_get_provider instead of home-grown variants.") Event: EuroBSDcon 2026 DevSummit Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D59563
* evdev: map ChromeOS "Vivaldi" top-row action keysKang Kang25 hours1-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chromebook keyboards driven by the ChromeOS EC emit the top-row action keys as scancode set 1 codes 0xE0 0x11 - 0xE0 0x1E (see the codeset 1 comments on the SCANCODE_* enum in chrome-ec include/keyboard_8042_sharedlib.h). The e0 half of the evdev_scancode2key() translation table leaves eleven of those at NONE, so on FreeBSD those keys emit no evdev event at all and userspace remappers such as keyd have nothing to bind to: e0 11 fullscreen KEY_ZOOM e0 12 overview KEY_SCALE e0 13 screenshot KEY_SYSRQ e0 14 brightness down KEY_BRIGHTNESSDOWN e0 15 brightness up KEY_BRIGHTNESSUP e0 16 privacy screen toggle KEY_PRIVACY_SCREEN_TOGGLE e0 17 kbd backlight down KEY_KBDILLUMDOWN e0 18 kbd backlight up KEY_KBDILLUMUP e0 1a play/pause KEY_PLAYPAUSE e0 1b mic mute KEY_MICMUTE e0 1e kbd backlight toggle KEY_KBDILLUMTOGGLE Fill those in. Only entries that were previously NONE are touched: the EC's remaining top-row codes already have mappings here (e0 10 prev track, e0 19 next track, e0 20 mute, e0 2e / e0 30 volume, e0 67 refresh, e0 69 forward, e0 6a back), as do e0 1c keypad enter and e0 1d right control, and none of them change. Signed-off-by: Kang Kang <kk1987@gmail.com> Tested on: Lenovo ThinkPad C14 Chromebook (Google primus, ChromeOS EC) Reviewed by: wulf MFC after: 2 weeks
* sendfile(2): rework compat implementationBrooks Davis26 hours3-104/+64
| | | | | | | | | | | | | | Rename the sendfile() function to kern_sendfile(), expand the arguments previously passed in struct sendfile_args, and extend with two function pointer arguments to copy in the header/trailer structure and the create uio's for the header and trailer as required. Use this to allow the removal of freebsd32_do_sendfile() which was a nearly identical duplicate of sendfile() with attendant maintenance cost. Reviewed by: kib, markj Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D59034
* linuxkpi: Fix cancel_delayed_work_sync() return valueRyan Fahy27 hours1-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Align behavior between the Linux cancel_delayed_work_sync() function return value and the LinuxKPI equivalent. Linux cancel_delayed_work_sync() returns whether delayed work was pending, even if canceled before executing. This includes the case where the timer fired and work was queued but the callback had not yet started. The LinuxKPI version used the return value from taskqueue_cancel() as the return value of the public facing API, which inverted the behavior of two cases, violating the Linux API contract. Queued work which was removed before running would return false, and work whose callback was already executing would return true. Track the taskqueue pending count separately from the taskqueue_cancel() return value. Use the pending count for the public return value. Use taskqueue_cancel() return value only to decide whether state needs to be re-checked. This fixes behavior in consumers which use the return value of cancel_delayed_work_sync() to distinguish canceled pending work from work that was already running or idle. Signed-off-by: Ryan Fahy <ryan@rfahy.com> Reviewed by: wulf MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2268
* vfs_lookup_cross_mount(): fix missing LK_CANRECURSEJason A. Harmening32 hours1-4/+8
| | | | | | | | | | | | | | | | | | | | | This was a rather dumb miss on my part in commit 42442d7a6e. LK_CANRECURSE is clearly needed in any case in which the covered vnode is held exclusive across the call to VFS_ROOT(), regardless of whether it was initially held exclusive or upgraded. The commit message for that change also noted that unionfs lookup only worked without LK_CANRECURSE due to a coincidence of the then-current unionfs implementation. As it happens, said coincidence was recently removed in commit b952606b4f ("unionfs_lock(): eliminate LK_CANRECURSE special- case"). PR: 298201 Reported by: olivier Fixes: 42442d7a6e "Generalize the VV_CROSSLOCK logic in vfs_lookup" Reviewed by: kib, markj, pho Tested by: pho MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59494
* iwx: fix kernel panic on module unload with assertions enabledAndriy Voskoboinyk32 hours1-0/+4
| | | | | | | | | | | | | | When interface is up and running 'kldunload if_iwx' stops the device and executes RUN -> INIT state transition. Since the device is already stopped iwx_run_stop fails to stop the device again and returns non-zero exit code from iv_newstate callback which triggers 'INIT state change failed' assertion. I reused IWX_FLAG_SHUTDOWN flag to: a) set it in iwx_detach b) check it in iwx_newstate_sub - when it is set all custom state transition logic is skipped Accidentally found while experimenting with iwlwifi / iwx drivers Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D59624
* nfscl: Yet more fixes for the NFS over RDMA client glueRick Macklem36 hours5-5/+48
| | | | | | | | | | | | | This should be it for a while, but there will be another cycle of "glue" updates. I just found out that I'll need to create an alternate code path that uses a contigmalloc() blob instead of scatter/gather of pages, since some NICs cannot do the scatter/gather of pages well. This commit should not affect non-RDMA behaviour. MFC after: 3 months Fixes: 884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
* aq(4): arm PHY thermal shutdown from the admin pollNick Price37 hours6-19/+98
| | | | | | | | | | | | | | move thermal shutdown arming to the admin poll this gives a more reasonable delay prior to the first attempt, and also allows us to retry and make the option runtime-tuneable via a new disable_thermal_arm sysctl Approved by: adrian (mentor) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D59593 Signed-off-by: Nick Price <nprice@FreeBSD.org>
* fdescfs: descend through /dev/fd/N when mounted linrdlnkNick Price37 hours1-1/+15
| | | | | | | | | | | | | | | | | | | | | | Linux resolves a path below /proc/self/fd/N in the directory the descriptor names, and linprocfs makes /proc/<pid>/fd a symlink to /dev/fd. Under linrdlnk the fdescfs node carries only VV_READLINK, which namei will not walk through, so such a path fails with ENOTDIR. Return the underlying vnode from fdesc_lookup for a non-final component, or a trailing slash, reusing the machinery the nodup option already uses. The last component is untouched, so open("/dev/fd/N") keeps its dup(2) semantic; a descriptor with no vnode behind it, such as a pipe, yields ENOTDIR. Add ATF coverage for traversal, descriptor reuse, and preservation of last-component and mount-option semantics. Approved by: adrian (mentor) Reviewed by: kib, adrian Differential Revision: https://reviews.freebsd.org/D59393 Signed-off-by: Nick Price <nprice@FreeBSD.org>
* amd64, powerpc: Enable tpm(4) in supported kernelsKevin Bowling37 hours4-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | tpm(4) was removed from amd64 GENERIC because it broke suspend and resume. The preceding lifecycle, state-save, interrupt, locality, and teardown fixes address those failures for both TPM 1.2 and TPM 2.0. Restore the driver to amd64 GENERIC and MINIMAL, where TPM entropy harvesting remained enabled. Enable the driver and entropy harvesting in the MPC85XX and QORIQ64 configurations, which already provide FDT, spibus, and the platform SPI controller required by FDT-attached TPMs. Leave the generic AIM and POWER configurations unchanged because they have no TPM attachment bus. The TPM 1.2 path completed repeated S3 cycles and command tests on ThinkPad T430 and T440p systems. The TPM 2.0 path completed repeated device and full-system suspend/resume cycles on a ThinkPad P51. The PowerPC configuration matrix was checked to retain tpm(4) only where its FDT SPI attachment path is present. PR: 291067 Reviewed by: kevans Tested by: Marek Zarychta <zarychtam_plan-b.pwste.edu.pl> (tpm1.2) Fixes: 16f8ea6a81b5 ("amd64: Remove tpm(4) from GENERIC for now") MFC after: 1 month Relnotes: yes Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59247
* puc: add the WCH CH382 2S dual serial cardNick Price37 hours1-0/+20
| | | | | | | | | | Two 16850 UARTs in the first I/O BAR at offset 0xc0, 8 bytes apart. Approved by: adrian (mentor) Reviewed by: imp, adrian Differential Revision: https://reviews.freebsd.org/D59512 Signed-off-by: Nick Price <nprice@FreeBSD.org>
* puc: be more careful about using MSINick Price37 hours2-1/+7
| | | | | | | | | | | | | | | | | | puc has preferred MSI for every card since MSI support was added, with only a global tunable to opt out. uart(4) makes the same decision for the serial devices it attaches directly, and has since grown two defences: it skips MSI unless the device advertises exactly one vector, because attaching a single instance to a device offering many has caused problems (PR 235016), and it lets individual devices be flagged when they claim MSI support that does not work. Adopt both. Approved by: adrian (mentor) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D59623 Signed-off-by: Nick Price <nprice@FreeBSD.org>
* superio, ncthwm: add support for the Nuvoton NCT6798DNick Price37 hours2-1/+21
| | | | | | | | | | | | | | The ASUS PRIME X570-P carries a Nuvoton NCT6798D, Super I/O device ID 0xd42b. Add an exact-match entry to both. Exact rather than masked: the neighboring 0xd42a entries are deliberately exact with an extid because that ID is claimed by both NCT6796D-E and NCT5585D, and widening the family would make them collide. The NCT6798D has seven tachometers, so raise NCTHWM_FAN_MAX to seven and describe the two extra ones; existing entries keep fan_count = 5 and are unaffected. Fan names follow the NCT6779 convention and do not map to any board's physical headers. Tested on: ASUS PRIME X570-P, Ryzen 9 5950X, FreeBSD 16.0-CURRENT. Approved by: adrian Reviewed by: stephane.rochoy_stormshield.eu, adrian Differential Revision: https://reviews.freebsd.org/D58291 Signed-off-by: Nick Price <nprice@FreeBSD.org>
* linux: LINUX_PR_SET_THP_DISABLE all non-zero values are disableWarner Losh42 hours1-3/+2
| | | | | | | Linux treats any nonzero value as "disable", so accept them all. Fixes: a8a6eac57091 Sponsored by: Netflix
* powerpc/pmap: Add a minimum TID widthJustin Hibbits44 hours1-0/+2
| | | | | QEMU doesn't appear to emulate the MMUCFG register for Book-E CPUs, so give a sane small default of 7, for an 8 bit PID register.
* powerpc/booke pmap: Adjust TID bits to correct sizeJustin Hibbits44 hours1-1/+1
| | | | | MMUCFG::PIDSIZE is the TID field size less 1, so adjust to get the full width.
* raw ip: clear sin_port on bind(2)Gleb Smirnoff47 hours1-1/+1
| | | | | | | | | | | | Application may set sin_port to some value. Although this value is not used by SOCK_RAW, it breaks a check that the address is available. A perfect fix would be not use sockaddrs for ifaddrs, but that would be a bigger change. PR: 298366 Reviewed by: pouria, bnovkov, adrian Differential Revision: https://reviews.freebsd.org/D59570 Fixes: 948ad32ae1e0811f45e1d38f26636fefed5051f0
* acpi_spmc: Check AMD constraint packagesAymeric Wibo47 hours1-6/+38
| | | | | | | | | | Also match behaviour with Intel constraint parsing by skipping malformed constraints instead of failing hard. Reviewed by: olce Sponsored by: The FreeBSD Foundation Event: EuroBSDCon Devsummit 2026 Differential Revision: https://reviews.freebsd.org/D59568
* acpi_spmc: Check Intel constraint packagesAymeric Wibo47 hours1-5/+45
| | | | | | | | | | | | | | | | | | | | | | | | | Some firmware inexplicably decides to do non-standard and annoying stuff here, e.g. the Fujitsu Futro S940 with an Intel Pentium J5005 sometimes returns the following when calling the DEVICE_CONSTRAINTS function on the Intel DSM: Return (Package (0x01) { Zero }) (Package elements here are supposed to be constraint packages, not just a single value.) First reported in the following forum post: https://forum.netgate.com/topic/201090/2.9.0-beta-leads-to-kernel-panic-on-boot Reported by: TampertK on forum.netgate.com Reviewed by: olce Sponsored by: The FreeBSD Foundation Event: EuroBSDCon Devsummit 2026 Differential Revision: https://reviews.freebsd.org/D59566
* powerpc/booke: Add a machine check stackJustin Hibbits2 days4-17/+35
| | | | | | | | | | | Machine check and critical exceptions are independent of each other, and can interrupt each other. Since they're asynchronous we cannot trust that the existing stack pointer (%r1) is correct at time of entry, so add a private machine check stack separate from the critical exception stack. As part of this, switch to the STANDARD_CRIT_PROLOG() for machine check exceptions, and overload the macro to specify the stack to switch to. Also add a savearea argument to CRIT_SRR_RESTORE() so that we can restore machine check exception state from the right location.
* dpaa/fman: Clean up port config codeJustin Hibbits2 days2-44/+25
| | | | No functional change, just simplify the code flow a little.
* rtwn: add ID for the Edimax EW-7611ULBAhmad Khalifa2 days2-0/+2
| | | | | | The dongle uses the rtl8723bu chip. Also add an entry for it in usbdevs.
* powerpmac_thermal: Improve thermal regulation on G5 quad modelsJustin Hibbits2 days4-8/+10
| | | | | | | | | | Add a new "high temp" threshold below the max temp, in order to ramp the fans (or pump for liquid cooled quads) sooner, and avoid the maximum temperature. From the PR, this makes older G5 quads louder, but usable, instead of hitting max temperature and forcing a thermal shutdown. PR: 209202 Submitted by: gmbroome (PR)
* powerpc/booke64: Remove unused pmap globalJustin Hibbits2 days1-1/+0
|
* ixgbe: Leave run-state publication to iflib during FDIR recoveryKevin Bowling3 days1-3/+0
| | | | | | | | | | | | | | Rebuilding the Flow Director tables does not initialize the interface or restore its queues. Do not set IFF_DRV_RUNNING from that operation: iflib owns the flag, and may have cleared it while a watchdog reset is pending. Restoring it here could admit traffic before the deferred stop and initialization have run. Keep the table rebuild and Flow Director interrupt re-enable unchanged. This path is conditional on IXGBE_FDIR. MFC after: 2 weeks Sponsored by: BBOX.io
* ice: Use the mirror interface softc in PF callbacksKevin Bowling3 days1-8/+12
| | | | | | | | | | | | | PF iflib callbacks receive struct ice_softc, not struct ice_mirr_if. Resolve the mirror interface through sc->mirr_if before checking or resetting subinterface state. Use the same mirror softc when rebuilding its VSI. This records the required subinterface reset in the state consumed by the PF callback, rather than overlaying the PF softc and leaving rebuilt queues stopped. MFC after: 2 weeks Sponsored by: BBOX.io
* ixl: Set critical-error state bits independentlyKevin Bowling3 days1-2/+2
| | | | | | | | | | | | ixl_set_state() takes a bit index, not a bit mask. ORing the reset request and critical error indices produced the global reset index, so a critical interrupt could mask its cause without scheduling the intended PF reset. Set both state bits explicitly. MFC after: 2 weeks Sponsored by: BBOX.io
* vmxnet3: Propagate device-enable failure to iflibKevin Bowling3 days1-1/+4
| | | | | | | | | Do not let iflib publish a running interface when the virtual device rejected its enable command. Mark initialization failed and leave the interface stopped. MFC after: 2 weeks Sponsored by: BBOX.io
* ixgbe: Pause firmware recovery polling in low powerKevin Bowling3 days2-5/+35
| | | | | | | | | | | | | | | | | | | | | | The firmware recovery callout continues polling controller registers after a power transition. An inaccessible E610 GL_MNG_FWSM register reads as all ones in D3, which looks like firmware recovery mode and queues an iflib reset while the device is suspended. A later D0 poll then reports recovery complete and queues another reset. Pause and drain the callout before terminal stop policy is applied, prevent an in-flight callback from rearming it, and restart polling only after resume has cleared the wake state. Track callout initialization so partial attach cleanup does not drain an uninitialized callout. The false transition was reproduced on a dual-port E610 with direct D3 and system S3. Validate the guard with wake-disabled and wake-armed D3, three repeated D3 cycles per port, and an S3 magic-packet wake. Both ports returned to D0 without a false recovery transition. MFC after: 2 weeks Sponsored by: BBOX.io
* iflib: Reject media changes during suspendKevin Bowling3 days1-0/+4
| | | | | | | | | | | | | | | | | | | | | | | iflib gates its built-in administrative and media-status callbacks once a power transition starts, but iflib_media_change() could still invoke a driver while the device was suspending or suspended. Several drivers perform PHY or firmware I/O directly from this callback. Return EBUSY before invoking IFDI_MEDIA_CHANGE() unless the device is active. ifmedia then restores the prior selection, avoiding both suspended hardware access and an unvalidated configuration that would need to be replayed during resume. Validated with device suspend on 82579LM, I210, and I225-IT controllers. Media-selection requests returned EBUSY on every suspended device. Resume restored the linked management interfaces at 1 Gbps with working traffic and no watchdogs; unconfigured interfaces retained their prior admin and link state. Reviewed by: iflib (gallatin) MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59330
* iflib: Own queue quiescence during power transitionsKevin Bowling3 days6-34/+196
| | | | | | | | | | | | | | | | | | | | | | Perform a terminal datapath stop before suspend and shutdown callbacks, then drain the private configuration taskqueue before entering low power. Track power state independently of queue ownership and prevent built-in admin, IOV, LED, and media-status callbacks from accessing a suspended device. Restore driver-specific state while the datapath remains stopped. Initialize it exactly once on resume when the interface is administratively up, and keep an administratively-down interface stopped. Roll back the driver when suspend or child suspension fails. Add ifdi_power_prepare() for policy which must be established before the terminal stop. Use it to snapshot ixgbe(4) wake policy and preserve X550EM PHY ordering, and remove the duplicate stop from aq(4). Reviewed by: iflib (gallatin) MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59329
* iflib: Track queue datapath lifecycleKevin Bowling3 days1-32/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | Track whether iflib queue mappings may still be accessed by the device. Keep the state private to iflib and conservative: an unknown or failed device must pass through IFDI_STOP() before mappings are reused or released, while a device known to be stopped need not receive another hardware stop. Enter the starting state before IFDI_INIT(), publish running only after receive buffers and framework state are ready, and stop hardware if receive-buffer setup fails after driver initialization. Do not initialize an administratively-down interface merely because its MTU, capabilities, VLAN configuration, or media changed. Preserve successful retries for an administratively-up interface whose previous initialization failed. This state describes ownership of iflib datapath mappings only. It deliberately makes no claim about firmware queues, administrative DMA, PCI power state, or whether a driver can safely elide a hardware reset. Reviewed by: iflib (gallatin) MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59328
* if_bridge: count the drops on the fragmentation pathAlexander Leidinger3 days1-1/+9
| | | | | | | | | | | | | | bridge_pfil() returned a fragmentation failure without counting it, and bridge_fragment() dropped a chain on three allocation failures without counting those either. Count the first on the filtered interface and the others with ips_odropped, which is what ip_fragment() uses for the same failure and what bridge_fragment() already uses for its success case. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D59391 Assisted-by: Claude Code (Fable 5, Opus 5)
* if_bridge: pull up only the headers bridge_pfil() inspectsAlexander Leidinger3 days2-10/+27
| | | | | | | | | | | | | | | | | | | bridge_pfil() pulled up min(m_pkthdr.len, max_protohdr) bytes. When the mapped head is shorter than that and followed by an unmapped (M_EXTPG) mbuf -- a sendfile(2) or KTLS segment from a member advertising IFCAP_MEXTPG -- m_pullup() ran into it and dereferenced a NULL mtod(), panicking the kernel. Pull up the Ethernet header first, and the SNAP/LLC header only for an 802.3 frame. This is similar to pf and ip_output(). m_pullup() and m_copyup() asserted only the first mbuf; assert inside both copy loops so the shape trips the check. Fixes: c38abd64dbc1 ("if_epair: support IFCAP_MEXTPG") Suggested by: markj Reviewed by: markj, gallatin Assisted-by: Claude Code (Fable 5, Opus 5)
* sys/kern: Fix a typo in a source code commentGordon Bergling3 days1-1/+1
| | | | | | - s/untill/until/ MFC after: 3 days
* LinuxKPI: Run irq_work callbacks under RCU protectionJustAnotherHumanBeing3 days2-0/+5
| | | | | | | | | | | | | | | Linux executes irq_work callbacks from an interrupt context that provides implicit RCU read-side protection. LinuxKPI dispatches these callbacks through a taskqueue, so provide equivalent protection explicitly. This prevents an RCU grace period from completing while an irq_work callback is still using an RCU-protected object. Suggested by: wulf Tested by: JustAnotherHumanBeing Signed-off-by: JustAnotherHumanBeing <oleglelchuk@gmail.com> Pull Request: https://github.com/freebsd/freebsd-src/pull/2385
* hid: Add Sony DualSense gamepad driverChristos Longros3 days5-0/+483
| | | | | | | | | | | Add a driver for the Sony PS5 DualSense controller (054c:0ce6) providing gamepad input via evdev, lightbar RGB LED control, and player indicator LEDs through sysctl. Signed-off-by: Christos Longros <chris.longros@gmail.com> Reviewed by: ziaee, wulf MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D56345
* sctp: remove unused variableSiva Mahadevan3 days1-5/+2
| | | | | | | | | | | | This fixes the build with gcc 16 after the changes to -Wunused*[0]. [0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused Reviewed by: tuexen MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59590
* kobj: allow multiple inheritance with per-class softcMichal Meloun3 days4-8/+142
| | | | | | | | | | | | | | | | | | Add support for hierarchical softc layout so that a leaf class and each of its base classes owns a private softc region inside a single allocation. device_get_softc_class(dev, cls) returns a pointer to the softc that belongs to the requested class. The classic device_get_softc() still returns the leaf softc and remains fully compatible with existing drivers. Existing drivers are unaffected; they simply obtain a slightly larger softc block when they inherit from base classes. MFC after: 2 months Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D59115
* amd64/pmap: Return la57 in amd nested pageShengYi Hung3 days1-1/+13
| | | | | | | | | | | | AMD doesn't encode page depth in eptp. As a result, the page level is decided by the host la57 value. Without this, it uses 4 level page and therefore cause machine enable la57 have garbage page translation. PR: 291768 Reviewed by: kib Tested by: Antranig Vartanian <antranigv@freebsd.am> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D57978
* linuxkpi: Add compat_ptr_ioctlSourojeet A3 days1-0/+9
| | | | | | | | Adding the `compat_ptr_ioctl` function for amdkfd support it's called by kfd_chardev.c Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D58076