Commit graph

43993 commits

Author SHA1 Message Date
Mark Johnston
5286b96c56 md: Use a larger buffer for the ident string
With the old size, the string could easily be truncated, resulting in
non-unique identifiers.

PR:		287679
Reported by:	Phil Krylov <phil@krylov.eu>
Reviewed by:	kib
MFC after:	2 weeks
2025-06-25 21:20:45 +00:00
Justin Hibbits
0d7abc6e1f IfAPI: Finish etherswitch driver conversions
These drivers are not compiled by default, so were missed in the
conversion.

Sponsored by:	Juniper Networks, Inc.
2025-06-25 15:53:13 -04:00
Andrew Turner
5ec268d09a dev/psci: Use the correct SMCCC TRNG field
The TRNG service will return random data in x3. Use the correct field
when filling the buffer in trng_read.

This driver has not been in any release, so no security advisory is
needed.

Reviewed by:	bz
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D50979
2025-06-24 18:45:42 +01:00
Andrew Turner
288ba78edc dev/psci: Check for functions before calling
In the SMCCC TRNG and Errata ABI drivers check if the version
functions are implemented before calling them. Without this the firmware
may complain about an unimplemented function being called.

Reported by:	bz
Reviewed by:	bz
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D50978
2025-06-24 18:45:42 +01:00
Andrew Turner
4e17c5fc50 dev/psci: Use an SMCCC return value
Switch to the SMCCC not supported macro in smccc_arch_features. This
shouldn't be a functional change as the value is identical to the PSCI
value it replaces.

Reviewed by:	bz, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D50977
2025-06-24 18:45:41 +01:00
Kevin Lo
1395712cab uchcom: add support for CH9102 and CH343 uarts
The CH343 devices support any baud rate up to 6 Mbps.
PR:	272803
Reviewed by:	imp
Tested by:	joerg, Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
Differential Revision:	https://reviews.freebsd.org/D46290
2025-06-25 09:33:35 +08:00
Gleb Smirnoff
01addd846c gone_in: make it __printflike()
Provide flexibility to use format strings for gone_in().  As a side
effect, this removes hardcoded string "Obsolete code will be removed
soon:" from the message, so now it is obligation of the deprecated code to
provide a meaningful message.  This required a small adoption of the
existing users: midi, drm2 and le(4).  Note that gone_in() is not a public
KPI as it has no sense to use it outside of the FreeBSD tree.

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D50783
2025-06-24 15:23:47 -07:00
Andrew Turner
cbc2e34613 virtio_blk: Limit use of indirect descriptors
Pass 0 as the number of indirect descriptors when they are not
supported.

This fixes an issue on the Arm FVP model where we don't negotiate
them, however pass a number of segments greater than
VIRTIO_MAX_INDIRECT. This leads to virtqueue_alloc failing and
virtio_blk failing to attach.

Reviewed by:	Harry Moulton <harry.moulton@arm.com>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D50909
2025-06-23 13:55:24 +01:00
Ahmad Khalifa
b2e0dfc808 vt_fb: account for endianness
Account for endianness when writing to 24bpp framebuffers. Also create a
vt_fb_mem_wr3 function to avoid code duplication.

Reviewed by:	manu, imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50843
2025-06-23 09:23:21 +03:00
Ahmad Khalifa
3146c8fa19 vt_fb: fix KASSERTs
Make sure there is enough room to write more than one byte.

Reviewed by:	manu, imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50842
2025-06-23 09:23:21 +03:00
Ahmad Khalifa
b670c9bafc newbus: replace leftover device unit wildcards
Reviewed by:	imp, jhb
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50913
2025-06-21 05:57:45 +03:00
Bjoern A. Zeeb
8d51f2aba9 iwx: correct rx status reporting
We are currently not reporting any per-chain S:N values so remove
IEEE80211_R_C_RSSI and IEEE80211_R_RSSI along with it as it is set
already in the line above.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	thj
Differential Revision: https://reviews.freebsd.org/D50927
2025-06-19 16:32:28 +00:00
Bjoern A. Zeeb
be57603c46 iwx: correct chain number reporting
There is no point in assigning the channel index to the number of
chains for the RX status reporting.  The value was not tagged as
being used.  Rather than simply removing it try to fix it and
set the flag if we get a value.

Sposnored by:	The FreeBSD Foundation
Reviewed by:	thj
Differential Revision: https://reviews.freebsd.org/D50926
2025-06-19 16:32:28 +00:00
Kevin Lo
19d0dd8718 mtw: fix display of the MAC revision
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D50542
2025-06-19 13:42:39 +08:00
Mark Johnston
9d0d55e398 ufshci: Remove an unneeded variable definition
Reported by:	gcc
Fixes:		1349a733cf ("ufshci: Introduce the ufshci(4) driver")
2025-06-18 13:13:08 +00:00
Olivier Certner
8ecc419180
Internal scheduling priorities: Always use symbolic ones
Replace priorities specified by a base priority and some hardcoded
offset value by symbolic constants.  Hardcoded offsets prevent changing
the difference between priorities without changing their relative
ordering, and is generally a dangerous practice since the resulting
priority may inadvertently belong to a different selection policy's
range.

Since RQ_PPQ is 4, differences of less than 4 are insignificant, so just
remove them.  These small differences have not been changed for years,
so it is likely they have no real meaning (besides having no practical
effect).  One can still consult the changes history to recover them if
ever needed.

No functional change (intended).

MFC after:      1 month
Event:          Kitchener-Waterloo Hackathon 202506
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45390
2025-06-17 22:08:02 -04:00
Olivier Certner
c21c24adde
runq: More selective includes of <sys/runq.h> to reduce pollution
<sys/proc.h> doesn't need <sys/runq.h>.  Remove this include and add it
back for kernel files that relied on the pollution.

Reviewed by:    kib
MFC after:      1 month
Event:          Kitchener-Waterloo Hackathon 202506
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45387
2025-06-17 22:07:57 -04:00
Krzysztof Galazka
7ffe1a1f63 pci: Save MSIX ctrl value before pci_mask_msix call
Function pci_mask_msix uses cached value of MSI-X CTRL
register to verify if vector index is valid. Update
that value in pci_alloc_msix_method before it is
used to avoid kernel panic.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>

Reviewed by:	jhb
Approved by:	kbowling (mentor)
Sponsored by:   Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D49484
2025-06-17 21:17:21 +02:00
Jaeyoon Choi
1349a733cf ufshci: Introduce the ufshci(4) driver
This commit adds a storage driver that supports the Universal Flash
Storage Host Controller Interface (UFSHCI) on FreeBSD.

Universal Flash Storage (UFS) is a flash-based mobile storage device
that replaces eMMC, aiming for high performance with low power. The UFS
Host Controller Interface (UFSHCI) is the host side controller and
connects UFS device to a system bus, such as PCIe.

The code targets the latest standards:
- UFS 4.1: https://www.jedec.org/standards-documents/docs/jesd220g
- UFSHCI 4.1: https://www.jedec.org/standards-documents/docs/jesd223f

The ufshci(4) driver implements controller/device initialization,
interrupt, single-doorbell(SDB) queue based IO requests. Support for
multi-queue (MCQ) IO requests is planned for a later commit.

Implemented features:
- PCIe bus support
- legacy(INTx) Interrupt Handling
- UIC command support
- UTP Transfer Request (UTR) support
- UTP Task Management Request (UTMR) support
- single doorbell queue (SDB) with multiple queue depth
- SCSI command set support
- sysctl

Work in progress:
- multi-Circular Queue (per-CPU IO queues)
- MSI-X interrupt Support
- write booster
- write Protect
- Host Performance Booster (HPB)
- interrupt aggregation
- ARM based system bus support
- ufs-utils port

Tests were performed on QEMU and an Intel-based laptop.
Since QEMU has an emulated UFS device, I tested on QEMU.

How to test on QEMU:
1. Run QEMU
    $ qemu-system-x86_64 ... -device ufs -drive file=blk1g.bin,format=raw,if=none,id=luimg -device ufs-lu,drive=luimg,lun=0
2. Loading/unloading the ufshci module on QEMU
    $ kldload /usr/obj/usr/src/amd64.amd64/sys/modules/ufshci/ufshci.ko
    $ kldunload ufshci

Testing on real hardware:
- Samsung Galaxy Book S (Intel Lakefield) with UFS 3.0
- Lenovo duet 3 11ian8 (Intel N100) with UFS 2.1

Sponsored by:		Samsung Electronics
Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D50370
2025-06-15 00:08:56 -06:00
Kevin Bowling
5e6e4f7528 bnxt: Fix BASE-T, 40G AOC, 1G-CX, autoneg and unknown media lists
This was broken in c63d67e137, the early returns prevent building the
media lists as expected.

The BASE-T parts of the patch were suggested by "cyric@mm.st", while I
am adding the additional 40G AOC, 1CX, autoneg and unknown PHY fixes
based on code inspection.  There may be additional work left here for
Broadcom but this is certainly better than the returns.

PR:		287395

Reported by:	mickael.maillot@gmail.com, cyric@mm.st
Tested by:	Einar Bjarni Halldórsson <einar@isnic.is>
MFC after:	1 week
2025-06-14 16:54:22 -07:00
Mark Johnston
3b4bc5d70e gve: Relax a static assertion
It's okay if MCLBYTES is larger than the default receive buffer size.

Fixes:	71702df612 ("gve: Add support for 4k RX Buffers when using DQO queue formats")
2025-06-14 12:17:49 +00:00
Vee Agarwal
71702df612 gve: Add support for 4k RX Buffers when using DQO queue formats
This change adds support for using 4K RX Buffers when using DQO queue
formats when a boot-time tunable flag is set to true by the user.
When this flag is enabled, the driver will use 4K RX Buffer size either
when HW LRO is enabled or mtu > 2048.

Signed-off-by: Vee Agarwal <veethebee@google.com>

Reviewed by:	markj, ziaee
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D50786
2025-06-13 18:53:51 +00:00
Kristof Provost
4f7473d18a qlnx: fix panic at startup
While attaching the qlnx driver we can end up trying to call ifmedia functions
before those are set up (through ether_ifattach() -> rtnl_handle_ifattach()
-> dump_iface() -> get_operstate_ether() -> ifmedia_ioctl()). Postpone the
ether_ifattach() until after the ifmedia setup.

Reviewed by:	markj,zlei
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D50819
2025-06-13 16:48:51 +02:00
Christos Margiolis
84e7307441 snd_hda: Patch Lenovo T420s
PR:		222636
Tested by:	vermaden@interia.pl
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
2025-06-13 01:02:15 +02:00
Stefan Eßer
dab9ef5448 snd_hda: fix attaching to some AMD Radeon GPUs
HDMI audio did not work on my older Radeon GPU, the error message
during attach was:

hdac0: hdac_get_capabilities: Invalid corb size (0)

This is fixed by calling hdac_reset() before the HDA device
capabilities are retrieved. This solution was proposed by Andriy Gapon
in 2010, but apparently did not solve the problem reported at the time.

Approved by:	christos
Differential Revision:	https://reviews.freebsd.org/D50737
2025-06-12 10:15:59 +02:00
Jan Biedermann
50461a68e0 Add USB quirk for Creative Stage SE mini
Note: The commit in main was modified for the new macros in main.
stable merge will need to use the version originally in #1715

MFC After: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1715
Closes: https://github.com/freebsd/freebsd-src/pull/1715
2025-06-11 17:16:21 -06:00
Jan Biedermann
c2794499be usb: Don't call usb_msc_auto_quirk for UQ_MSC_IGNORE devices
usb_msc_auto_quirk() potentially crashes usb devices with a hidden
storage (see bug 287333). These devices may still operate normally if
usb_msc_auto_quirk() would not be called all and the hidden storage is
ignored. This patch makes sure, that usb_msc_auto_quirk() is not called
when the UQ_MSC_IGNORE quirk is set for a device. It shouldn't be called
anyway if the hidden storage supposed to be ignored. This gives users a
chance to get their devices working by using

'usbconfig add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> UQ_MSC_IGNORE'.

Reviewed by: imp
MFC After: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1716
Closes: https://github.com/freebsd/freebsd-src/pull/1716
2025-06-11 17:16:21 -06:00
Christos Margiolis
4a7b8cd705 sound: Add AFMT_FLOAT to feed_volume_info_tab
Fixes:		e1bbaa71d6 ("sound: Implement AFMT_FLOAT support")
Reported by:	bz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D50793
2025-06-11 13:10:54 -04:00
Brooks Davis
e453e498cb machine/stdarg.h -> sys/stdarg.h
Switch to using sys/stdarg.h for va_list type and va_* builtins.

Make an attempt to insert the include in a sensible place.  Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Andrew Turner
d41a2ba73c scmi: Avoid a use-after-free
Use LIST_FOREACH_SAFE to avoid a use-after-free in scmi_reqs_pool_free.
The next pointer will be invalid after the call to free meaning
LIST_FOREACH will dereference a freed struct to move to the next item.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D50753
2025-06-09 23:32:11 +01:00
Cristian Marussi
5a54d768e1 scmi: Add sysctl transport properties
Expose as read-only the configured transport properties.

Tested on:      Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47428
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
d5778530d1 scmi: Add SDT traces to the core stack
Add a few basic traces to track SCMI messages lifecycle.

Tested on:      Arm Morello Board
Reviewed by:	Andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47427
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
e478b80556 scmi: Add optional asynchronous handling of replies
Add the core logic to handle the replies to pending command in an
asynchronous manner.

Tested on:      Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47426
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
8f70662928 scmi: Refactor scmi_request internal logic
Split scmi_request internals into a TX and an RX phase, which will be
called, anyway, in sequence as before when a normal transmission is
requested.

No functional change.

Tested on:      Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47425
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
35ec332f34 scmi: Add scmi_token_reserve helper
During normal operation, the SCMI stack, upon each transmission attempt,
takes care to automatically pick an appropriate, monotonically increasing,
sequence number to fill-in the token field in the egressing message.

This does not cope well with the alternative scenario in which, instead,
a complete and fully formed message is provided upfront: in such a case the
SCMI stack will have to use the already provided sequence number, embedded
in the message, to track such transaction.

Add a method to attempt to reserve a specific sequence number to be used
when a fully firmed (raw) message is handled.

Tested on:      Arm Morello Board
Reported by:	andrew
Sponsored by:	Arm ltd
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
f700da1c20 scmi: Add helper to manipulate scmi_msg descriptors
Refactor allocation logic for scmi_req and introduce new helpers to be able
to obtain an scmi_msg reference to a freshly allocated request.

Tested on:      Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47423
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
ba510513e8 scmi: Add devicetree transport properties
SCMI transport characteristics can be optionally described in the
devicetree to override the default build-time values.

Tested on:      Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47422
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
a14428c69b scmi: Redefine max message payload size
The defined maximum payload size should not include header and status
field. Fix the definition accordingly, so that it matches the
definitions as can be found in the Linux SCMI stack.
The semantic of this define is important since it will then be possible
to override such values from devicetree, like in Linux.

Tested on:	Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47421
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:40 +01:00
Cristian Marussi
c758208373 scmi: Make transports report the effective length of the received messages
Once a message is received that fits into the RX buffer, update the
msg.rx_len field with the effective length of the message received.

Tested on:      Arm Morello Board
Reviewed by:	andrew
Sponsored by:	Arm Ltd
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
2025-06-04 02:32:39 +01:00
Andrew Turner
d49ed36080 Revert "scmi: Make transports report the effective length of the received messages"
Revert to reapply series as some patches were incorrect versions

This reverts commit 9342829d57.
2025-06-04 02:32:39 +01:00
Andrew Turner
3550c47a96 Revert "scmi: Redefine max message payload size"
Revert to reapply series as some patches were incorrect versions

This reverts commit f021623949.
2025-06-04 02:32:39 +01:00
Andrew Turner
04a83b8b5e Revert "scmi: Add devicetree transport properties"
Revert to reapply series as some patches were incorrect versions

This reverts commit 103ea03e67.
2025-06-04 02:32:39 +01:00
Andrew Turner
ed57f6e6fd Revert "scmi: Add helper to manipulate scmi_msg descriptors"
Revert to reapply series as some patches were incorrect versions

This reverts commit e887179d4b.
2025-06-04 02:32:39 +01:00
Andrew Turner
b0be4172f5 Revert "scmi: Add scmi_token_reserve helper"
Revert to reapply series as some patches were incorrect versions

This reverts commit c508841dfc.
2025-06-04 02:32:39 +01:00
Andrew Turner
b65172cb9e Revert "scmi: Refactor scmi_request internal logic"
Revert to reapply series as some patches were incorrect versions

This reverts commit 341d8fd90f.
2025-06-04 02:32:39 +01:00
Andrew Turner
35fee38c77 Revert "scmi: Add optional asynchronous handling of replies"
Revert to reapply series as some patches were incorrect versions

This reverts commit b802926b7b.
2025-06-04 02:32:39 +01:00
Andrew Turner
c4629b0f2b Revert "scmi: Add SDT traces to the core stack"
Revert to reapply series as some patches were incorrect versions

This reverts commit 984f9fb81a.
2025-06-04 02:32:38 +01:00
Andrew Turner
ea334b9794 Revert "scmi: Add sysctl transport properties"
Revert to reapply series as some patches were incorrect versions

This reverts commit e6d0edd2fe.
2025-06-04 02:32:38 +01:00
Hareshx Sankar Raj
2542189532 qat: update API files to use SPDX identifier
API files are updated to have SPDX identifier and remove
longer form of license to ensure consistency with the
license format across all files.

Reviewed by:	markj, ziaee
MFC after:	2 weeks
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D50379
2025-06-06 13:50:00 +00:00
Hareshx Sankar Raj
ae1dc27639 qat: refactor error handling and add mutex locks
Error handling in qat driver code has been refactored.
Mutex lock handling has also been added during driver
attach and detach. Also pci_disable_busmaster() is called in
adf_detach() to ensure proper cleanup during device detachment.

Reviewed by:	markj, ziaee
MFC after:	2 weeks
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D50379
2025-06-06 13:49:51 +00:00