path: root/sys/dev
Commit message (Collapse)AuthorAgeFilesLines
* ofw_pci: Fix incorrectly sized softc causing pci(4) out-of-bounds readsJessica Clarke3 days1-0/+1
| | | | | | | | | | | | | | | | We do not include sys/rman.h and so machine/resource.h ends up not being included by the time pci_private.h is included. This means PCI_RES_BUS is never defined, and so the sc_bus member of pci_softc is not present when compiling ofw_pci, resulting in the wrong softc size being passed to DEFINE_CLASS_1 and thus any attempts by pci(4) to access that member are out-of-bounds reads or writes. This is pretty fragile; arguably pci_private.h should be including sys/rman.h, but this is the minimal needed change to fix the bug whilst maintaining the status quo. Found by: CHERI Reported by: andrew
* cxgbe(4): Fix bad races between sysctl and driver detach.Navdeep Parhar3 days4-40/+23
| | | | | | | | | | | | | | | | | | | The default sysctl context setup by newbus for a device is eventually freed by device_sysctl_fini, which runs after the device driver's detach routine. sysctl nodes associated with this context must not use any resources (like driver locks, hardware access, counters, etc.) that are released by driver detach. There are a lot of sysctl nodes like this in cxgbe(4) and the fix is to hang them off a context that is explicitly freed by the driver before it releases any resource that might be used by a sysctl. This fixes panics when running "sysctl dev.t6nex dev.cc" in a tight loop and loading/unloading the driver in parallel. Reported by: Suhas Lokesha MFC after: 1 week Sponsored by: Chelsio Communications
* snd_hda: restore pin patch for headphones on Lenovo X1 7th GenEd Maste3 days1-0/+15
| | | | | | Fixes: ef790cc7407e ("hdaa: update pin patch configurations") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33900
* mana: Add RX fencingWei Hu4 days2-5/+68
| | | | | | | | | | | | | RX fencing allows the driver to know that any prior change to the RQs has finished, e.g. when the RQs are disabled/enabled or the hashkey/indirection table are changed, RX fencing is required. Remove the previous 'sleep' workaround and add the real support for RX fencing as the PF driver supports the MANA_FENCE_RQ request now (any old PF driver not supporting the request won't be used in production). MFC after: 2 weeks Sponsored by: Microsoft
* xen: use an hypercall for shutdown and rebootRoger Pau Monné5 days1-12/+6
| | | | | | | | | | | | | | | When running as a Xen guest it's easier to use an hypercall in order to do power management operations (power off, power cycle). Do this for all supported guest types (HVM and PVH). Note that for HVM the power operation could also be done using ACPI, but there's no reason to differentiate between PVH and HVM. While there fix the shutdown handler to properly differentiate between power cycle and power off requests. Reported by: Freddy DISSAUX MFC: 1 week Sponsored by: Citrix Systems R&D
* mana: fix misc minor handlding issues when error happens.Wei Hu5 days3-9/+17
| | | | | | | | | | | | | | | | | - In mana_create_txq(), if test fails we must free some resources as in all the other handling paths of this function. - In mana_gd_read_cqe(), add warning log in case of CQE read overflow, instead of failing silently. - Fix error handling in mana_create_rxq() when cq->gdma_id >= gc->max_num_cqs. - In mana_init_port(), use the correct port index rather than 0. - In mana_hwc_create_wq(), If allocating the DMA buffer fails, mana_hwc_destroy_wq was called without previously storing the pointer to the queue. In order to avoid leaking the pointer to the queue, store it as soon as it is allocated. MFC after: 2 weeks Sponsored by: Microsoft
* mana: Improve the HWC error handlingWei Hu5 days2-45/+33
| | | | | | | | | | | | Currently when the HWC creation fails, the error handling is flawed, e.g. if mana_hwc_create_channel() -> mana_hwc_establish_channel() fails, the resources acquired in mana_hwc_init_queues() is not released. Enhance mana_hwc_destroy_channel() to do the proper cleanup work and call it accordingly. MFC after: 2 weeks Sponsored by: Microsoft
* ixl(4): Remove unused function declarationEric Joyner5 days1-1/+0
| | | | | | Signed-off-by: Eric Joyner <erj@FreeBSD.org> Sponsored by: Intel Corporation
* Fix undefined behaviour in the USB controllersAndrew Turner6 days6-16/+11
| | | | | | | | | | | | | | | | The USB controller drivers assume they can cast a NULL pointer to a struct and find the address of a member. KUBSan complains about this so replace with the __offsetof and __containerof macros that use either a builtin function where available, or the same NULL pointer on older compilers without the builtin. Reviewers: hselasky Subscribers: imp Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33865
* mmc_da: implement d_dump method, sddadumpAndriy Gapon6 days1-0/+15
| | | | | | | | | | | | | | | | | | | | sddadump has been derived from sddastart. mmc_sim interface has grown a new method, cam_poll, to support polled operation. mmc_sim code has been changed to provide a sim_poll hook only if the controller implements the new method. The hooks is implemented in terms of the new mmc_sim_cam_poll method. Additionally, in-progress CCB-s now have CAM_REQ_INPROG status to satisfy xpt_pollwait(). mmc_sim_cam_poll method has been implemented in dwmmc host controller. Reviewed by: manu, mav, imp MFC after: 2 weeks Relnotes: perhaps Differential Revision: https://reviews.freebsd.org/D33843
* rtwn(4): Add new USB ID.Hans Petter Selasky7 days2-0/+5
| | | | | | | Submitted by: Wensi <supdrewin@outlook.com> PR: 261098 MFC after: 1 week Sponsored by: NVIDIA Networking
* rk805 / rk808: re-add system poweroff supportAndriy Gapon7 days5-1/+51
| | | | | | | | This was lost by accident in 98c60dc31f. Reviewed by: manu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33844
* dwwdt: make it actually usefulAndriy Gapon7 days1-11/+20
| | | | | | | | | | | | | | | | | | | | | | | Flip dwwdt_prevent_restart to false. What's the use of a watchdog if it does not restart a hung system? Add a knob for panic-ing on the first timeout, resetting on the second one. This can be useful if interrupts can still work, otherwise a reset recovers a system without any aid for debugging the hang. The change also doubles the timeout that's programmed into the hardware. The previous version of the code always had the interrupt on the first timeout enabled, but it took no action on it. Only the second timeout could be configured to reset the system. So, the hardware timeout was set to a half of the user requested timeout. But now,we can take a corrective action on the first timeout, so we use the user requested timeout. While here, define boolean sysctl-s as such. Reviewed by: manu MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D33534
* cxgbe(4): Fix regression in previous attempt to fix FEC selection.Navdeep Parhar7 days1-6/+7
| | | | | | Fixes: f3c2987f2f5c91f0801fa8bbf9e1bc09d91aeb46 MFC after: 3 days Sponsored by: Chelsio Communications
* cxgbe(4): Do not ignore the return value of ifmedia_ioctl.Navdeep Parhar7 days1-1/+1
| | | | | | | | | This ensures that the driver reports an error instead of failing silently when an invalid media is requested. Reported by: Suhas Lokesha @ Chelsio MFC after: 1 week Sponsored by: Chelsio Communications
* cxgbe(4): Fix build warning for LINT-NOIP.Navdeep Parhar7 days1-0/+2
| | | | | MFC after: 1 week Sponsored by: Chelsio Communications
* cxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.Navdeep Parhar8 days11-31/+72
| | | | | MFC after: 1 week Sponsored by: Chelsio Communications
* cxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.Navdeep Parhar8 days5-49/+12
| | | | | MFC after: 1 week Sponsored by: Chelsio Communications
* hwpmc: Fix amd/arm64/armv7/uncore sampling overflow raceJessica Clarke8 days4-21/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a counter more than overflows just as we read it on switch out then, if using sampling mode, we will negate this small value to give a huge reload count, and if we later switch back in that context we will validate that value against pm_reloadcount and panic an INVARIANTS kernel with: panic: [pmc,1470] pmcval outside of expected range cpu=2 ri=16 pmcval=fffff292 pm_reloadcount=10000 or similar. Presumably in a non-INVARIANTS kernel we will instead just use the provided value as the reload count, which would lead to the overflow not happing for a very long time (e.g. 78 minutes for a 48-bit counter incrementing at an averate rate of 1GHz). Instead, clamp the reload count to 0 (which corresponds precisely to the value we would compute if it had just overflowed and no more), which will result in hwpmc using the full original reload count again. This is the approach used by core for Intel (for both fixed and programmable counters). As part of this, armv7 and arm64 are made conceptually simpler; rather than skipping modifying the overflow count for sampling mode counters so it's always kept as ~0, those special cases are removed so it's always applicable and the concatentation of it and the hardware counter can always be viewed as a 64-bit counter, which also makes them look more like other architectures. Whilst here, fix an instance of UB (shifting a 1 into the sign bit) for amd in its sign-extension code. Reviewed by: andrew, mhorne, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33654
* Mana: report OS info to PF driverWei Hu8 days1-0/+11
| | | | | | | The PF driver might use the OS info for statistical purposes. MFC after: 2 weeks Sponsored by: Microsoft
* tws: fix "set but not used" in the tws driverRobert Wing8 days3-2/+4
| | | | | | | | With __diagused, these warnings were still emitted since INVARIANTS was defined but TWS_DEBUG was not. Fixes: a21f086a3316 ("Fix "set but not used" in the tws driver") Differential Revision: https://reviews.freebsd.org/D33784
* mps/mpr: Relax doorbell polling precision.Alexander Motin10 days2-2/+4
| | | | | | It does not matter how often do we check firmware for crashes. MFC after: 2 weeks
* nvme: Do not rearm timeout for commands without one.Alexander Motin11 days1-6/+9
| | | | | | | | | | | | | | Admin queues almost always have several ASYNC_EVENT_REQUEST outstanding. They have no timeouts, but their presence in qpair->outstanding_tr caused useless timeout callout rearming twice a second. While there, relax timeout callout period from 0.5s to 0.5-1s to improve aggregation. Command timeouts are measured in seconds, so we don't need to be precise here. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33781
* wbwd: Move set but not used variable test under notyetWarner Losh11 days1-2/+3
| | | | Sponsored by: Netflix
* rtwn(4): Add new USB ID.Hans Petter Selasky11 days2-0/+2
| | | | | | | Submitted by: arved@ PR: 260952 MFC after: 1 week Sponsored by: NVIDIA Networking
* uchcom(4): Add new USB ID.Hans Petter Selasky11 days2-0/+2
| | | | | | | Submitted by: darius@dons.net.au PR: 260783 MFC after: 1 week Sponsored by: NVIDIA Networking
* ocs_fc: Remove giant lock usage in sysctl.Ram Kishore Vegesna12 days1-14/+12
| | | | | | | | | | | | Summary: Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE. Reviewers: ken, mav Subscribers: imp Approved by: mav Differential Revision: https://reviews.freebsd.org/D33752
* atkbd: Disable periodic polling by default.Alexander Motin13 days1-1/+1
| | | | | | | | | | It is one of the few remaining Giant-locked callouts. It would be good to remove it, not mentioning that polling itself is not good. If this cause keyboard/mouse freezes on some hardware, please set loader tunable hw.atkbd.hz=1 as workaround and report the issue. Submitted by: imp, jhb
* cxgbe(4): Do not request an FEC that is invalid for the requested speed.Navdeep Parhar13 days1-0/+16
| | | | | | | | | | | | | This eliminates error messages like this from the driver when running at 50Gbps with 100G cables: [3726] cc0: l1cfg failed: 71 [4407] cc0: l1cfg failed: 71 Note that link comes up anyway with or without this change. Reported by: Suhas Lokesha @ Chelsio MFC after: 1 week Sponsored by: Chelsio Communications
* atkbd: Reduce polling rate from 10Hz to ~1Hz.Alexander Motin13 days1-2/+13
| | | | | | | | | | In my understanding this is only needed to workaround lost interrupts. I was thinking to remove it completely, but the comment about edge- triggered interrupt may be true and needs deeper investigation. ~1Hz should be often enough to handle the supposedly rare loss cases, but rare enough to not appear in top. Add sysctl hw.atkbd.hz to tune it. MFC after: 1 month
* vtnet: don't leak pfil(9) data on detachGleb Smirnoff13 days1-0/+5
| | | | | PR: 260667 Submitted by: <ghuckriede blackberry.com>
* neta: clk code ifdef'd aarch64Warner Losh13 days1-0/+2
| | | | | | | So #ifdef the clk.h include aarch64. Otherwise the right kernel options aren't always present. Sponsored by: Netflix
* mips: remove saf1761Warner Losh13 days5-4515/+0
| | | | | | | | The saf1761 OTG support was only for mips targets (BERI?). Retire it. Sponsored by: Netflix Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D33706
* iscsi: Pass the request PDU to icl_conn_transfer_setup().John Baldwin13 days4-10/+8
| | | | | | | | | | This matches icl_conn_task_setup() which passes the PDU and avoids the need for a layering violation in cxgbei to fetch the request PDU from the ctl_io. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D33746
* ccr: Use a software OCF session for requests which fallback to software.John Baldwin13 days1-343/+50
| | | | | | | | | | | | | | | | | | | | | | | | | Previously the driver duplicated code from cryptosoft.c to handle certain edge case AES-CCM and AES-GCM requests. However, this approach has a few downsides: 1) It only uses "plain" software and not accelerated software since it uses enc_xform directly. 2) It performs the operation synchronously even though the caller believes it is invoking an async driver. This was fine for the original use case of requests with only AAD and no payload that execute quickly, but is a bit more disingenuous for large requests which fall back due to exceeding the size of a firmware work request (e.g. due to large scatter/gather lists). 3) It has required several updates since ccr(4) was added to the tree. Instead, allocate a software session for AES-CCM and AES-GCM sessions and dispatch a cloned request asynchronusly to the software session. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D33608
* mvneta: Unconditionally print an error message if mii_attach() failsMark Johnston14 days1-4/+2
| | | | | | The error message is useful for diagnosing mvneta_attach() failures. MFC after: 1 week
* if_mvneta: Use clock frequencyHubert Mazur14 days2-18/+31
| | | | | | | | | | | Make neta use frequency obtained from clock, instead of hardcoded one. Use default frequency in case of clock device failure. Remove unnecessary function calls to obtain frequency and use cached one instead. Reviewed by: manu Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D32336
* cxgbe(4): Update firmwares to Parhar2022-01-037-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CHANGES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Version : Date : 01/03/2022 ================================================================================ Fixes ----- BASE: - Fixed one module eeprom read failure. - Fixed an issue with speed selection when 40G and 25G are advertised and supported. - Fixed a random traffic hang when T5 receives invalid ets BW in dcbx messages from a switch. - Fixed very long link up time with few switches. ================================================================================ Obtained from: Chelsio Communications MFC after: 2 weeks Sponsored by: Chelsio Communications
* cxgbe(4): Fix stats collection for ports with port_id != tx_chanNavdeep Parhar2022-01-032-3/+3
| | | | | | | | | | This fixes a driver panic during stats collection when a port's id does not match its tx channel. The bug affected only the T580 card running with a non-default VPD. Reported by: Suhas Lokesha @ Chelsio MFC after: 1 week Sponsored by: Chelsio Communications
* domains: make domain_init() initialize only global stateGleb Smirnoff2022-01-031-1/+1
| | | | | | | Now that each module handles its global and VNET initialization itself, there is no VNET related stuff left to do in domain_init(). Differential revision: https://reviews.freebsd.org/D33541
* protocols: init with standard SYSINIT(9) or VNET_SYSINITGleb Smirnoff2022-01-032-7/+4
| | | | | | | | | | | | | | | The historical BSD network stack loop that rolls over domains and over protocols has no advantages over more modern SYSINIT(9). While doing the sweep, split global and per-VNET initializers. Getting rid of pr_init allows to achieve several things: o Get rid of ifdef's that protect against double foo_init() when both INET and INET6 are compiled in. o Isolate initializers statically to the module they init. o Makes code easier to understand and maintain. Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D33537
* netfpga10: mips only, removeWarner Losh2021-12-313-1245/+0
| | | | Sponsored by: Netflix
* iommu_gas: Rename a function missed earlierDoug Moore2021-12-311-1/+1
| | | | | Reported by: jenkins Fixes: c606ab59e7f9 vm_extern: use standard address checkers everywhere
* hwpmc: deorbit mips supportWarner Losh2021-12-316-2143/+0
| | | | Sponsored by: Netflix
* vm_extern: use standard address checkers everywhereDoug Moore2021-12-313-14/+4
| | | | | | | | | | Define simple functions for alignment and boundary checks and use them everywhere instead of having slightly different implementations scattered about. Define them in vm_extern.h and use them where possible where vm_extern.h is included. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D33685
* Make CPU_SET macros compliant with other implementationsStefan Eßer2021-12-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The introduction of <sched.h> improved compatibility with some 3rd party software, but caused the configure scripts of some ports to assume that they were run in a GLIBC compatible environment. Parts of sched.h were made conditional on -D_WITH_CPU_SET_T being added to ports, but there still were compatibility issues due to invalid assumptions made in autoconfigure scripts. The differences between the FreeBSD version of macros like CPU_AND, CPU_OR, etc. and the GLIBC versions was in the number of arguments: FreeBSD used a 2-address scheme (one source argument is also used as the destination of the operation), while GLIBC uses a 3-adderess scheme (2 source operands and a separately passed destination). The GLIBC scheme provides a super-set of the functionality of the FreeBSD macros, since it does not prevent passing the same variable as source and destination arguments. In code that wanted to preserve both source arguments, the FreeBSD macros required a temporary copy of one of the source arguments. This patch set allows to unconditionally provide functions and macros expected by 3rd party software written for GLIBC based systems, but breaks builds of externally maintained sources that use any of the following macros: CPU_AND, CPU_ANDNOT, CPU_OR, CPU_XOR. One contributed driver (contrib/ofed/libmlx5) has been patched to support both the old and the new CPU_OR signatures. If this commit is merged to -STABLE, the version test will have to be extended to cover more ranges. Ports that have added -D_WITH_CPU_SET_T to build on -CURRENT do no longer require that option. The FreeBSD version has been bumped to 1400046 to reflect this incompatible change. Reviewed by: kib MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D33451
* igc: Remove redundant IFCAP_VLAN_HWTAGGING checkKevin Bowling2021-12-291-2/+1
| | | | | | | | | | | Match igb(4) as in f7926a6d0c10. From Vincenzo, this check is redundant to setup providing us an IGC_RXD_STAT_VP bit and would make for an unexpected condition if IFCAP_VLAN_HWTAGGING were not set but the tag was stripped, which would be passed up the stack breaking isolation. PR: 260068 Approved by: vmaffione MFC after: 1 month
* cxgbe(4): Fix panic on driver detach after a partially failed attach.Navdeep Parhar2021-12-291-1/+2
| | | | | | | | sge->ctrlq is not always allocated during attach (eg. if firmware initialization fails) and detach should be able to deal with this. MFC after: 1 week Sponsored by: Chelsio Communications
* net: iflib: fix vlan processing in the driversVincenzo Maffione2021-12-287-58/+36
| | | | | | | | | | | | | | The logic that sets iri_vtag and M_VLANTAG does not handle the case where the 802.11q VLAN tag is 0. Fix this issue across the iflib drivers. While there, also improve and align the VLAN tag check extraction, by moving it outside the RX descriptor loop, eliminating a local variable and additional checks. PR: 260068 Reviewed by: kbowling, gallatin Reported by: erj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33156
* net: iflib: let the drivers use isc_capenableVincenzo Maffione2021-12-285-7/+10
| | | | | | | | | | | | | Since isc_capenable (private copy of ifp->if_capenable) is now synchronized to if_capenable, use it in the drivers when checking the IFCAP_* bits. This results in better cache usage and avoids indirection through the ifp pointer. PR: 260068 Reviewed by: kbowling, gallatin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33156