Commit graph

43627 commits

Author SHA1 Message Date
Christos Margiolis
18457e7e25 sound: Bail out early if a format is not supported
If a format is unsupported, the feeder_build_* functions will fail
anyway, so bail out early to avoid unnecessary computation.

This is also needed by a series of upcoming patches to the feeder
framework.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48031
2025-02-18 21:37:22 +02:00
Christos Margiolis
c23d53490e snd_hda: Define ALC898
PR:		207996
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D48940
2025-02-18 21:37:21 +02:00
Christos Margiolis
d4176fdb13 snd_hda: Fix typo (s/owerflow/overflow)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-02-18 21:35:52 +02:00
Mark Johnston
c76c2a19ae vmm: Consolidate code which manages guest memory regions
On all three platforms supported by vmm, we have mostly duplicated code
to manage guest physical memory regions.  Deduplicate much of this code
and move it into sys/dev/vmm/vmm_mem.c.

To avoid exporting struct vm outside of machdep vmm.c, add a new
struct vm_mem to contain the memory segment descriptors, and add a
vm_mem() accessor, akin to vm_vmspace().  This way vmm_mem.c can
implement its routines without needing to see the layout of struct vm.

The handling of the per-VM vmspace is also duplicated but will be moved
to vmm_mem.c in a follow-up patch.

On amd64, move the ppt_is_mmio() check out of vm_mem_allocated() to keep
the code MI, as PPT is only implemented on amd64.  There are only a
couple of callers, so this is not unreasonable.

No functional change intended.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D48270
2025-02-18 16:00:07 +00:00
Bojan Novković
19f202f859 sdhci: Fixes for sdhci_fdt_rockchip.c
This change fixes a couple of issues in the Rockchip SDHCI driver:
 - Fix a panic caused by sdhci_fdt_rockchip_attach not populating the
   softc's dev variable before initializing clocks
 - Fix a bug where sdhci_fdt_rockchip_set_clock fails to call
   sdhci_fdt_set_clock

Fixes:	e17e33f997
Reported by:	Alonso Cárdenas Márquez (acardenas@bsd-peru.org)
2025-02-16 11:41:43 +01:00
Adrian Chadd
0f10a33fc1 ar40xx: fix to compile/run under the new ifnet rules
Locally tested:

* IPQ4018, Asus router, w/ ethernet driver

Differential Revision:	https://reviews.freebsd.org/D49025
Reviewed by:	imp, zlei
2025-02-15 12:43:42 -08:00
Adrian Chadd
89e3c2d27a flash: add w25n (nand flash) support
This adds read only support for the W25N series of flash parts.

Specifically starting with the W25N01GV, a 128MiB SPI NAND flash.

This doesn't currently support writing or erasing, as this requires
a NAND flash layer that we don't currently have.  There are also
plenty of other commands that aren't currently supported - notably
maintaining the on-chip flash translation layer, flash wear statistics,
etc.

But read support is fine enough for now; it at least allows for
reading the boot / config / calibration flash on my ASUS IPQ4018 based
router.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D48979
2025-02-14 19:03:55 -08:00
Jesper Schmitz Mouridsen
b968644127 mtw: Use correct cmd for radio
Approved by:	adrian, wireless
Differential Revision:	https://reviews.freebsd.org/D49003
2025-02-14 16:20:40 +01:00
Jasper Tran O'Leary
73c3fe4db3 gve: Fix qpl_buf_head being initialized improperly
Currently, for DQO QPL our MPASS assertion on qpl_buf_head for available
pending_pkts (i.e. not holding a packet) fails due to incorrect
initialization. The MPASS fails on the first run of packets through the
ring when INVARIANTS is on, and when INVARIANTS is off, things work
without a bug.

The MPASS guards against improper reaping of "pending_pkt" objects,
and thus was failing for the first run through the ring. By correctly
initializing the objects in this patch we make the MPASS not fail on the
first run too.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48968
2025-02-14 15:08:23 +00:00
Jasper Tran O'Leary
031800c786 gve: Do minor cleanup and bump version
This commit fixes several minor issues:

- Removes an unnecessary function pointer parameter on gve_start_tx_ring
- Adds a presubmit check against style(9)
- Replaces mb() and rmb() macros with native
  atomic_thread_fence_seq_cst() and atomic_thread_fence_acq()
  respectively
- Fixes various typos throughout
- Increments the version number to 1.3.2

Co-authored-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48969
2025-02-14 15:08:23 +00:00
Jasper Tran O'Leary
62b2d0c3f4 gve: Fix memory leak during reset
Before this change, during reset we were allocating new memory for
priv->ptype_lut_dqo, irq_db_array and the counter_array over the old
memory. This change ensures we do not allocate new memory during reset
and avoid memory leaks.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48970
2025-02-14 15:08:18 +00:00
Jasper Tran O'Leary
909e2d7b69 gve: Disallow MTUs within a problematic range
If hardware LRO is enabled with GVE, then setting the driver's MTU to a
range of values around 8000 will cause dropped packets and drastically
degraded performance. While this issue is being investigated, we need
to prohibit the driver's MTU being set to a value within this range.

Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48971
2025-02-14 14:57:06 +00:00
Zhenlei Huang
91bae242bc bnxt_en: Improve sysctl handler bnxt_dcb_list_app()
Prefer sbuf_new_for_sysctl() over error-prone manually managed buffer.

No functional change intended.

Reviewed by:	markj
Tested by:	Daniel Porsch <daniel.porsch@loopia.se>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48496
2025-02-14 18:38:30 +08:00
Zhenlei Huang
747fd2db53 bnxt_en: Remove pointless NULL check for sysctl arg1
Those sysctl handlers have been guaranteed to have non-null softc. No
need for NULL check within sysctl handlers.

No functional change intended.

Reviewed by:	markj
Tested by:	Daniel Porsch <daniel.porsch@loopia.se>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48495
2025-02-14 18:38:30 +08:00
Zhenlei Huang
0bc672b38f bnxt_en: Fix the description of sysctl knob dev.bnxt.X.dcb.dcbx_cap
While here, update the description of dev.bnxt.X.dcb to more informative
words "Data Center Bridging".

Reviewed by:	markj
Fixes:	35b53f8c98 bnxt_en: Add PFC, ETS & App TLVs protocols support
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48993
2025-02-14 18:38:30 +08:00
Zhenlei Huang
3de231b4d9 bnxt_en: Retrieve maximum of 128 APP TLVs
It appears that the maximum number of APP TLVs supported by the hardware
is 128 according to D45005. Well Daniel Porsch reported an issue PR284073
which shows that the number can exceed the limit, causing out of bound
write to on-stack allocated variable app[128] and the kernel panics.

Limit to 128 while retrieving APP TLVs.

PR:		284073
Reviewed by:	markj
Tested by:	Daniel Porsch <daniel.porsch@loopia.se>
Fixes:	35b53f8c98 bnxt_en: Add PFC, ETS & App TLVs protocols support
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48589
2025-02-14 18:38:29 +08:00
Navdeep Parhar
04bf43505b cxgbe(4): Use correct priority in begin_synchronized_op.
It was always set to PCATCH because the driver tested (INTR_OK) instead
of (flags & INTR_OK).  Fit a WITNESS_WARN in a single line while here.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 22:15:18 -08:00
Navdeep Parhar
f79fba05a0 cxgbe(4): Remove smt_idx from the L2 table entry structure.
An L2 table entry isn't associated with a particular SMT (Source MAC
Table) entry.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 21:54:59 -08:00
Navdeep Parhar
9d76f6d042 cxgbe(4): Remove some unused PCI routines and associated headers.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 20:52:25 -08:00
Navdeep Parhar
762d32354a cxgb(4): Use routines from pci(9) instead of hand rolled equivalents.
There is no need to include private PCI headers in the driver.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 20:44:23 -08:00
Navdeep Parhar
f4ab14044c cxgbe(4): Make sure suspend/resume works in recovery mode.
The driver does minimal initialization in this mode and suspend/resume
should ignore resources that aren't setup.  This is for debug only.

kenv hw.cxgbe.sos="1"
kldload if_cxgbe
devctl suspend t6nex0
devctl resume t6nex0

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 16:41:50 -08:00
Kevin Bowling
124b7722aa igc: Remove unused register IGC_RXD_SPC_VLAN_MASK
We don't use legacy receive descriptors and masking out the vlan ID
isn't necessary since the tag is in the standard format, so remove it.

MFC after:	3 days
2025-02-13 11:26:35 -07:00
Aurelien Cazuc
4b29599fbb e1000: Fix vlan PCP/DEI on lem(4)
The vlan PCP and CFI/DEI were discarded when receiving vlan tagged
packets on lem(4) interfaces with vlanhwtag.

According to the 82540 SDM[1] (pg. 24), vlan tag is in the standard
format, so there's no reason to discard PCP/DEI.

[1]: http://iommu.com/datasheets/ethernet/controllers-nics/intel/e1000/pci-pci-x-family-gbe-controllers-software-dev-manual.pdf

MFC after:	3 days
Sponsored by:	Stormshield (author)
Differential Revision:	https://reviews.freebsd.org/D48987
2025-02-13 11:20:26 -07:00
Konstantin Belousov
1fbce7deef mlx5 ipsec: return EOPNOTSUPP for unsupported SAs instead of EINVAL
The ipsec offload infra requires the EOPNOTSUPP error from driver to
understand that the SA is valid but offload cannot be performed.

Sponsored by:	NVidia networking
2025-02-13 12:32:32 +02:00
Konstantin Belousov
2e794b7733 mlx5: add synthetic error for MLX5_CMD_OP_QUERY_FLOW_COUNTER when device is down
Sponsored by:	NVidia networking
2025-02-13 12:32:32 +02:00
John Baldwin
d6cce475cb mtw: Pass the right pointer to the constructed command in mtw_mcu_radio
This was just using random stack garbage before.

Reported by:	GCC -Wunused-but-set-variable
2025-02-12 17:17:00 -05:00
Jose Luis Duran
4b77a9a80c
uath: Avoid a NULL dereference
PR:		284643
Reviewed by:	adrian
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48948
2025-02-12 15:33:26 +00:00
John Baldwin
346020138a pci: Don't cache the count of MSI/MSI-X messages before allocation
A device can in theory change the read-only fields in the MSI/MSI-X
control registers that indicate the maximum number of supported
registers in response to changing other device registers.  For
example, certain Intel networking VFs change the number of messages as
a result of changes in the PCI_IOV_ADD_VF callback.

To support this, always read the current value of the relevant control
register in the *_count and *_alloc methods.  Once messages have been
allocated, the control register value remains cached.

Reported by:	Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by:	Krzysztof Galazka <krzysztof.galazka@intel.com>, erj
Differential Revision:	https://reviews.freebsd.org/D48890
2025-02-11 09:11:48 -05:00
John Baldwin
a3835cceb0 pci: Cosmetic cleanups to MSI/MSI-X routines
- Use unsigned integers for various variables.  The count argument
  to the alloc method as well as the IRQ values used with the
  pcib_if.m methods should also be unsigned eventually.

- Use mallocarray to allocate arrays

- Use bool in a few places

Reviewed by:	Krzysztof Galazka <krzysztof.galazka@intel.com>
Differential Revision:	https://reviews.freebsd.org/D48889
2025-02-11 09:11:10 -05:00
Kevin Bowling
bf6f0db8a7 ixgbe: Add ixgbe_dev_from_hw() back
This got lost many years ago in 8eb6488ebb

It is used by the driver's DBG printfs.

MFC after:	3 days
2025-02-10 20:41:51 -07:00
Kevin Bowling
1836216556 ixgbe: x550 support for 1000BASE-BX SFP modules
Add support for 1Gbit BiDi modules to x550 derivatives

MFC after:	1 week
2025-02-10 17:44:28 -07:00
Gleb Smirnoff
4a7f4f289c sockets: make pr_aio_queue the default method
Call it directly instead of each time calling pr_aio_queue_notsupp() and
then doing the actual job.  The only user of non default method was
cxgbe(4).  It calls now into the default method in case of own method
failure.  This preserves existing behavior.

Reviewed by:		markj, jhb
Differential Revision:	https://reviews.freebsd.org/D48863
2025-02-10 11:30:45 -08:00
Konstantin Belousov
4c2795340e mlx5 ipsec: fix typo in the message
Sponsored by:	NVidia networking
2025-02-09 02:19:32 +02:00
Tore Amundsen
89d4096950 ixgbe: Add support for 1000BASE-BX SFP modules
Add support for 1Gbit BiDi modules

Signed-off-by:	Tore Amundsen <tore@amundsen.org>
MFC after:	1 week
Relnotes:	yes
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1518
2025-02-08 17:06:33 -07:00
Ahmad Khalifa
d3b1dcb408 acpi_iicbus: install the address space handler by default
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>

Reviewed by:	wulf
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1583
2025-02-07 18:20:00 +00:00
Bojan Novković
e17e33f997 sdhci: Refactor the generic FDT driver
This patch refactors the 'sdhci_fdt.c' driver by moving all vendor
specific routines into separate files and making the base 'sdhci_fdt'
driver subclassable. The goal is to make adding new FDT-based drivers
easier and more maintainable. No functional change intended.

Reviewed by:	manu, imp
Differential Revision:	https://reviews.freebsd.org/D48527
2025-02-07 10:06:07 +01:00
Gordon Bergling
84e3ffac12 mlx4ib(4): Fix some typos in device messages
- s/availible/available/

MFC after:	5 days
2025-02-05 11:31:12 +01:00
Warner Losh
f52154a204 hptrr: Better error recovery
This bug and https://www.mail-archive.com/freebsd-stable@freebsd.org/msg124458.html
both have this fix. It turns unknown errors into an autosense failure, which causes
us to grab the sense buffer manually. It also sets a condition that we use to retry
timed out commands that jmg reports as being helpful.

I'm torn on committing it. The code seems fine in terms of fixing
things. But this is a 10-year-old bug with few other bugs and a short CC
list for a driver that might go away in 15 anyway. I'm going to commit
and close the bug, and MFC it in a week, unless someone complains (which
seems unliekly, given the age of this hardware, I susepct most of it is
out of service).

Suggested by: jmg, Scott Long
PR: 191135
MFC After: 1 week
Reviewed by: imp
2025-02-04 18:38:02 -07:00
Fuqian Huang
5b900bd26a mpt: replace mpt_prt with mpt_lprt in mpt_cam.c
Replace mpt_prt with mpt_lprt with DEBUG level to print kernel pointers
only at the debug level.

PR: 238662
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed-by: imp
2025-02-04 17:47:21 -07:00
Fuqian Huang
d9beef938a mpt: print req->index rather than the pointer itself in mpt.c
Print req->index instead of printing the pointer itself to avoid kernel
pointer leakage.

PR: 238661
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Reviewed-by: imp
2025-02-04 17:47:21 -07:00
Wei Hu
da1deb784d Hyper-V: hn: rewrite hn rsc swtich to avoid sysctl hang
Changing the rsc_switch flag using sysctl to turn rsc on or off
could hang. The orignal code sends request to host to get the
mtu setting. Sometimes the host fails to reply, causing
the thread to sleep forever waiting for the host response.

Use existing cached mtu from hn device instead to avoid calling
host.

Reported by:	whu
Tested by:	whu
MFC after:	1 week
2025-02-04 13:39:14 +00:00
Jesper Schmitz Mouridsen
c14b016242 mt7601U: Importing if_mtw from OpenBSD
Added ht20 mode, based on if_run from FreeBSD, and if_mtw.c
from OpenBSD.

PR: 247545
Approved by:	adrian, wireless
Differential Revision: https://reviews.freebsd.org/D45179
2025-02-03 20:20:52 +01:00
Warner Losh
fdaf7d0fe1 umass: Print quirks with %b
Print the quirks in a more human-readable form. When testing a dozen
different removeable devices, the hex numbers quickly blur...

Sponsored by:		Netflix
2025-02-03 10:25:27 -07:00
Warner Losh
6f659c9a49 pci: Change device to function
It's functions that are placed into D3 for these value, not the device.

PR: 259703
Sponsored by:		Netflix
2025-02-02 10:26:04 -07:00
Warner Losh
d889926162 isci: Remove dead code
This code hasn't compiled for years, so just remove it.

PR: 229954
Sponsored by: Netflix
2025-02-02 10:18:35 -07:00
Warner Losh
5a8caf9bfa bce: make compile with BCE_DEBUG
Builds now with BCE_DEBUG defined. All bets are of as to whether or not
it works though. This is not the default, and likely quite a rare config
given (a) it's been broken for years and (b) this is an old card people
aren't actively debugging anymore. I don't have the hardware to test it,
though I've not changed anything in the BCE_DEBUG undefined case.

Sponsored by:		Netflix
2025-02-02 09:57:01 -07:00
Warner Losh
5deab77bb6 bce: Fix register dumping to skip blank area
When compiling with debug enabled, this produces an always false
warning. It's clear that this was to skip ranges that aren't used when
dumping the registers, so change the && to || to skip things properly.

PR: 200984
Sponsored by:		Netflix
2025-02-02 09:49:15 -07:00
Svyatoslav
ead758a67a pms: Fix always true condition
Although this is vendor code, and apparently abandoned vendor code at
that, this is clearly a mistake and always true. It's unclear how to
contribute back to the upstream at this point, alas.

PR: 217745
Reviewed by: imp
2025-02-02 09:35:51 -07:00
Dmitry Luhtionov
64dcfa2593 ig4(4): Add Intel ACPI HID
MFC after:	1 month
2025-02-02 10:25:18 +03:00
Bjoern A. Zeeb
95ea57c856 LinnuxKPI: drm2: retire timespec_to_jiffies()
Linux has removed timespec_to_jiffies() half a decade ago [1].
I cannot find any use of it anymore in recent drm-kmod branches
or in the tree so retire it.

While here also retire it from drm2.

Reported by:	emaste (D48318) [1].
Sponsored by:	The freeBSD Foundation
MFC after:	2 weeks
Reviewed by:	emaste, dumbbell (tested all drm-kmod versions, thanks!)
Differential Revision: https://reviews.freebsd.org/D48379
2025-02-01 00:47:30 +00:00