Commit graph

42282 commits

Author SHA1 Message Date
Mark Johnston
14148b5c5c wg: Use ENETUNREACH when transmitting to a non-existent peer
The old errno value used is specifically for Capsicum and shouldn't be
co-opted in this way.  It has special handling in the generic syscall
layer (see syscallret()).  OpenBSD returns ENETUNREACH in this case;
let's do the same thing.

Reviewed by:	kevans, imp
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44582

(cherry picked from commit 63613e3ba1)
2024-04-15 10:05:13 -04:00
John Baldwin
bf5956c185 cxgbe: Support TCP_USE_DDP on offloaded TOE connections
When this socket option is enabled, relatively large contiguous
buffers are allocated and used to receive data from the remote
connection.  When data is received a wrapper M_EXT mbuf is queued to
the socket's receive buffer.  This reduces the length of the linked
list of received mbufs and allows consumers to consume receive data in
larger chunks.

To minimize reprogramming the page pods in the adapter, receive
buffers for a given connection are recycled.  When a buffer has been
fully consumed by the receiver and freed, the buffer is placed on a
per-connection free buffers list.

The size of the receive buffers defaults to 256k and can be set via
the hw.cxgbe.toe.ddp_rcvbuf_len sysctl.  The
hw.cxgbe.toe.ddp_rcvbuf_cache sysctl (defaults to 4) determines the
maximum number of free buffers cached per connection.  Note that this
limit does not apply to "in-flight" receive buffers that are
associated with mbufs in the socket's receive buffer.

Co-authored-by:	Navdeep Parhar <np@FreeBSD.org>
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44001

(cherry picked from commit eba13bbc37)
2024-04-12 12:25:17 -07:00
Konstantin Belousov
fd02cfeb9a pcireg.h: Add AMD IOMMU Base Cap definitions
(cherry picked from commit 33adb388c7)
2024-04-12 04:18:32 +03:00
Konstantin Belousov
83fe75d6c1 pcireg.h: add include guard
(cherry picked from commit 1cd9868f04)
2024-04-12 04:18:32 +03:00
Christos Margiolis
7e0c6e00b3 sound: Remove unused SND_DEV_LAST and SND_DEV_MAX constants
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44554

(cherry picked from commit b5e55dbf35)
2024-04-12 03:09:51 +02:00
Christos Margiolis
578a8fb50c sound: Fix SND_DIAGNOSTIC ifdef comment
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44555

(cherry picked from commit c136e6180e)
2024-04-12 03:09:51 +02:00
Christos Margiolis
4dfb88f3de sound: Get rid of pcm/sndstat.h and turn macros into regular code
There is no reason to have macros for this. Putting the code in
sndstat_prepare_pcm() directly makes it easier to work with it.

No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44545

(cherry picked from commit 6d1cee1640)
2024-04-12 03:09:51 +02:00
Christos Margiolis
ea2275e72c sound: Drain buffer selinfo in sndbuf_free()
Prevent a use-after-free in kern_poll() by making sure the buffer's
selinfo is drained. This is required for a subsequent patch that
implements asynchronous audio device detach.

Reported by:	KASAN
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44544

(cherry picked from commit fba54d0179)
2024-04-12 03:09:51 +02:00
John Baldwin
7748f70561 cxgbe tom: Handle a race condition when enabling TLS offload
Use a separate state for when a request to set RX_QUIESCE has been
sent but the resulting TCB reply has not been received.  In
particular, this correctly handles the case where data has been
received and queued in the receive queue before the quiesce request
takes effect.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44435

(cherry picked from commit 9978c6289d)
2024-04-08 11:07:13 -07:00
John Baldwin
d4ad8432aa ddp: Clear active DDP buffer members to NULL to pacify an assertion
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43999

(cherry picked from commit 25429e2743)
2024-04-08 11:06:53 -07:00
John Baldwin
1608990524 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings
In particular, don't try to byteswap the values as 64-bit integers and
always print a non-empty version as a string.

Reviewed by:	chuck, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44121

(cherry picked from commit 7485926e09)
2024-04-08 11:01:02 -07:00
John Baldwin
0090752521 vmd: Use bus_read/write_* instead of bus_space_read/write_*
Using an explicit bus space tag and handle is deprecated.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D43885

(cherry picked from commit 76c6786886)
2024-04-08 10:57:24 -07:00
John Baldwin
cfb8cc9c5f acpi: Don't assume a resource is reserved in acpi_delete_resource
This fixes a panic if a driver uses bus_set_resource to add a resource
that fails to reserve and then deletes the resource via
bus_delete_resource.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43891

(cherry picked from commit e05436d577)
2024-04-08 10:55:58 -07:00
John Baldwin
13926bcb97 pci_host_generic_fdt: Remove duplicate DEVMETHOD entries
These are already inherited from generic_pcie_core_driver.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43888

(cherry picked from commit 93923685d3)
2024-04-08 10:55:37 -07:00
John Baldwin
9c69985001 pci_host_generic: Include the bridge's device name in rman descriptions
The rman description strings now match those used in the PCI-PCI
bridge driver.  Using more specific names removes ambiguity in devinfo -u
output on systems with multiple host to PCI bridges.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43890

(cherry picked from commit 51f8ac224f)
2024-04-08 10:54:50 -07:00
John Baldwin
75a63c968a acpi: Allow child drivers to use bus_set_resource for more resources
acpi_set_resource excludes certain types of resources for certain
devices.  The intention of this is to avoid adding resource entries
for bogus resources enumerated via _CRS.  However, this also prevents
drivers from adding those resources explicitly if needed.  To fix
this, move the logic to exclude these resources into an ignore hook
used when parsing _CRS to create the initial set of resources for each
device.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43892

(cherry picked from commit 055c1fe230)
2024-04-08 10:54:35 -07:00
John Baldwin
00dbe607b3 acpi: Use bus_generic_alloc_resource instead of duplicating it
No functional change, but it is cleaner to use the existing generic
wrappers rather than KOBJ methods directly.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43686

(cherry picked from commit 1fb5445206)
2024-04-08 10:53:25 -07:00
John Baldwin
93d2cc3088 pcib: Make various bus methods private to pci_pci.c
These functions are not used by pcib subclasses so do not need to
be exposed in pcib_private.h.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43688

(cherry picked from commit 03719c6514)
2024-04-08 10:52:43 -07:00
John Baldwin
cbc47b31cc acpi: Use kobj typedefs for new-bus method prototypes
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43685

(cherry picked from commit 0e72b8d365)
2024-04-08 10:51:56 -07:00
John Baldwin
b680e6da13 cxgbe tom: Enable ULP_MODE_TCPDDP on demand
Most ULP modes in cxgbe's TOE are enabled on the fly when a protocol
is needed (e.g. ULP_MODE_ISCSI is enabled by cxgbei when offloading a
connection using iSCSI, and ULP_MODE_TLS is enabled when RX TLS keys
are programmed for a TOE connection).  The one exception to this is
ULP_MODE_TCPDDP.

Currently the cxgbe driver enables ULP_MODE_TCPDDP when a TOE
connection is first created.  However, since DDP connections cannot be
converted to other connection types, this requires some special
handling in the driver.  For example, iSCSI daemons use the SO_NO_DDP
socket option to ensure TOE connections use ULP_MODE_NONE so they can
be converted to ULP_MODE_ISCSI.  Similarly, using TLS receive offload
(ULP_MODE_TLS) requires disabling TCP DDP for new connections by
default.

This commit changes cxgbe to instead switch a connection from
ULP_MODE_NONE to ULP_MODE_TCPDDP when a connection first attempts to
use TCP DDP via aio_read(2).  This permits connections to always start
as ULP_MODE_NONE and switch to a protocol-specific mode as needed.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43670

(cherry picked from commit a5a965d759)
2024-04-08 10:49:51 -07:00
John Baldwin
2b410bace4 cxgbe tom: Limit TOE connections to 2 reassembly islands always
Previously this was only limited on T6 cards to support switching from
ULP_MODE_NONE to ULP_MODE_TLS.  To support switching to
ULP_MODE_TCPDDP, enable this for all adapters.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43669

(cherry picked from commit afaefb7737)
2024-04-08 10:39:31 -07:00
John Baldwin
138ed6fee2 cxgbe: Add counters for POSIX async I/O requests handled by the driver
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43668

(cherry picked from commit c3d4aea6c5)
2024-04-08 10:39:16 -07:00
Pierre-Luc Drouin
4197e21ed3 vf_i2c: update I2C controller logic
Update the I2C controller logic to be more consistent with the
newer version of the controller reference manual.
This makes it work better on modern LS/LX platforms and avoids
unnecessary delays.  Also fixes a lock leak.

Tested by:	bz (LS1088a FDT), Pierre-Luc Drouin (Honeycomb, ACPI)

(cherry picked from commit 44847114bd)
2024-04-01 23:46:11 +00:00
Pierre-Luc Drouin
d1aff35566 vf_i2c: split up and add ACPI attachments in addition to FDT
Move the code from the arm specific to the iicbus controller directory.
Split up between general logic and bus attachment code.
Add support for ACPI attachment in addition to FDT.

Tested by:	bz (LS1088a FDT), Pierre-Luc Drouin (Honeycomb, ACPI)
Based on:	D24917 by Val Packett (initial early version)

(cherry picked from commit 5ca8e32633)
2024-04-01 23:46:10 +00:00
Bjoern A. Zeeb
4bce8178af iicbus/mux/pca954x: add support for PCA9546 I2C Switch
Add support for the 4 channel I2C switch from NXP by adding a new
description struct and the list entries.  Compared to x=[2345] which
require code to support the INT, for this one no further changes are
needed.

Tested on:	WHLE-LS1088A using a SPF+
Reviewed by:	imp

(cherry picked from commit c81df1c112)
2024-04-01 23:46:10 +00:00
Bjoern A. Zeeb
faf66c373a ath(4): always enable 11n
Enabling 11n for ath(4) so far was handled by a kernel option, which
was only enabled for certain kernel configurations.
In order to allow loading ath(4) as a module with 11n support on
all platforms, remove the kernel option and unconditionally enable
11n in ath(4).

Reported by:	pkubaj
Reviewed by:	adrian, imp

(cherry picked from commit 89c1e54a71)
2024-04-01 23:46:10 +00:00
Mark Peek
a1f89082dc hyperv/hn: Don't return error when setting media to autoselect
Setting media to autoselect would always return EOPNOTSUPP.
As autoselect is the only valid media, this change now returns
success instead.

PR:		264253
Reported by:	Prakash Shiva <prakashs0234@gmail.com>
Reviewed by:	Dexuan Cui <decui microsoft com>, whu
Approved by:	whu
MFC after:	2 weeks

(cherry picked from commit 63a7c4be4a)
2024-03-31 16:51:02 +00:00
Zhenlei Huang
ddd779a062 acpi_hpet: Make use of enum for vm_guest to improve readability
No functional change intended.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44402

(cherry picked from commit 579cb41b13)
2024-03-31 23:54:48 +08:00
Florian Walpen
602ea0ced1 sound: Fix OSS API requests for more than 8 channels
Audio devices with more than 8 channels need bitperfect mode to operate,
the vchan processing chain is limited to 8 channels. For these devices,
let applications properly select a certain number of channels supported
by the driver, instead of mapping the request to a vchan format.

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/914

(cherry picked from commit 61c8316796)
2024-03-25 18:28:30 -04:00
Kyle Evans
590e02d3c0 if_wg: use proper barriers around pkt->p_state
Without appropriate load-synchronization to pair with store barriers in
wg_encrypt() and wg_decrypt(), the compiler and hardware are often
allowed to reorder these loads in wg_deliver_out() and wg_deliver_in()
such that we end up with a garbage or intermediate mbuf that we try to
pass on.  The issue is particularly prevalent with the weaker
memory models of !x86 platforms.

Switch from the big-hammer wmb() to more explicit acq/rel atomics to
both make it obvious what we're syncing up with, and to avoid somewhat
hefty fences on platforms that don't necessarily need this.

With this patch, my dual-iperf3 reproducer is dramatically more stable
than it is without on aarch64.

PR:		264115
Reviewed by:	andrew, zlei

(cherry picked from commit 3705d679a6)
2024-03-22 10:21:39 -05:00
Andriy Gapon
0cb72c25b0 psci: split off psci_reboot from psci_shutdown
Priority of psci_reboot set so that it is run after shutdown_panic is
executed.  This is to provide uniform experience with other platforms.

(cherry picked from commit 0f354b2b58)
2024-03-16 17:14:41 +02:00
Andriy Gapon
721b91d171 syscon_power: do reboot after shutdown_panic is executed
A syscon_power instance can handle either poweroff or reboot, but not
both.  If the instance handles reboot then set its priority to be after
shutdown_panic.

This is to provide uniform experience with other platforms.

(cherry picked from commit 5f7312a0d7)
2024-03-16 17:14:09 +02:00
Andriy Gapon
1269b00203 rk8xx_poweroff: enable power-cycling on support hardware
Previously, the function would return early if RB_POWERCYCLE was
specified without RB_POWEROFF.  Those flags are exclusive at the moment,
that is, they are never set together.

Søren Schmidt (sos) uses a similar but extended patch locally.

(cherry picked from commit 8b408fc6f2)
(cherry picked from commit a044cf60bd)
2024-03-16 17:11:50 +02:00
Andriy Gapon
98ee1305b6 ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached.  That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by:	markj

(cherry picked from commit 8f374fa528)
2024-03-16 17:11:37 +02:00
Gleb Smirnoff
a15b8e3294 snd_hda: add 32-bit memory quirk for Creative Sound Blaster Audigy FX
Despite still being in production the device appeared not able to use
memory above BUS_SPACE_MAXADDR_32BIT, and if your desktop has a lot of
memory there is a high chance driver would allocate inaccessible memory.

Submitted by:	wulf
Reviewed by:	mav

(cherry picked from commit 89189224ad)
2024-03-11 09:18:42 -07:00
Wei Hu
0010132dbd Hyper-V: vPCI: fix cpu id mis-mapping in vmbus_pcib_map_msi()
The msi address contains apic id. The code in vmbus_pcib_map_msi()
treats it as cpu id, which could cause mis-configuration of msix
IRQs, leading to missing interrupts for SRIOV devices. This happens
when apic id is not the same as cpu id on certain large VM sizes
with multiple numa domains in Azure. Fix this issue by correctly
mapping apic ids to cpu ids.

On vPCI version before 1.4, it only supports up to 64 vcpus
for msi/msix interrupt. This change also adds a check and returns
error if the vcpu_id is greater than 63.

Reported by:	NetApp
Tested by:	whu
Sponsored by:	Microsoft

(cherry picked from commit 999174ba03)
2024-03-11 04:23:18 +00:00
Florian Walpen
ebe18cb1a5 snd_uaudio(4): Fix sample rate selection after 42fdcd9fd9.
The sample rate selection of snd_uaudio(4) at runtime was implicitly
relying on a specific order in the device config list. In case a default
was set through the hw.usb.uaudio.default_rate sysctl tunable, commit
42fdcd9fd9 removed a duplicate sample rate entry from that list, which
inadvertently broke sample rate selection at runtime. Implement sample
rate selection in a way that works for any order in the device config
list.

Reported by:	Lexi Winter <lexi@le-fay.org>
MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D44051

(cherry picked from commit a9341f0f0a)
2024-03-04 01:38:58 +01:00
Gordon Bergling
4d8cc5b78f bxe(4): Fix two typos in a kernel messages
- s/successfull/successful/

MFC after:	3 days

(cherry picked from commit e2f3649613)
2024-03-03 18:47:24 +01:00
Gordon Bergling
61408fbd36 vge(4): Fix a typo in a source code comment
- s/opration/operation/

(cherry picked from commit 04d5a8ae04)
2024-03-03 18:47:06 +01:00
Dmitry Lukhtionov
2d694deca9 snd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230
PR:		259640
MFC after:	2 weeks
Reviewed by:	delphij, markj
Differential Revision:	https://reviews.freebsd.org/D43804

(cherry picked from commit 5968e477a5)
2024-03-03 14:18:02 +01:00
Wei Hu
dda1c30ffe mana: fix leaking pci resource problem detaching mana deivces
Fixing the error messages when detaching the mana gdma devices
showed in dmesg: "Device leaked memory resources".

Reported by:	NetApp
MFC after:	3 days
Sponsored by:	Microsoft

(cherry picked from commit 47e99e5bc5)
2024-02-29 06:37:23 +00:00
Gordon Bergling
8bafcf60ef if_hn: Fix two typos in source code comments
- s/managment/management/
- s/transacion/transaction/

Obtained from:	NetBSD

(cherry picked from commit 61b88a230b)
2024-02-27 09:24:34 +01:00
Christos Margiolis
80da975b55 snd_uaudio: mark selected configurations
snd_uaudio(4) selects the first maching rate/channel/bit/format/buffer
configuration for use during attach, even though it will print the rest
of the supported configurations detected. To make this clear, mark the
selected playback and recording configurations with a "selected" string.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D43766

(cherry picked from commit f60e99f45e)
2024-02-27 00:22:31 +01:00
Christos Margiolis
6f2d6237fe sound: remove snddev_info->inprog and pcm_inprog()
No longer used.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43737

(cherry picked from commit 883b8ed582)
2024-02-27 00:22:31 +01:00
Florian Walpen
4c6b20d4b3 snd_uaudio(4): Fix config detection with defaults set.
Let the USB audio descriptor iteration detect configurations with more
channels and larger sample size, even when the following global sysctl
tunables are set to a lower value:

hw.usb.uaudio.default_channels hw.usb.uaudio.default_bits

This improves utility and is closer to the meaning of default.

Also, do not create duplicate sample rate entries.

MFC after:	2 weeks
Reviewed by:    christos
Differential Revision:	https://reviews.freebsd.org/D43679

(cherry picked from commit 42fdcd9fd9)
2024-02-27 00:22:31 +01:00
Florian Walpen
75358ca4fb snd_uaudio(4): Adapt buffer length to buffer_ms tunable.
Adapt the length of the driver side audio buffer to the USB transfer
interval, which is adjustable through the buffer_ms tunable. This
eliminates unnecessary latency in USB audio playback.

To reduce power consumption caused by frequent CPU wakeups, increase the
default buffer_ms value to 4ms. In combination with adaptive buffer
length, this still results in less roundtrip latency compared to the
previous 2ms default.

Extend the buffer_ms value range to 1ms for low latency applications.

MFC after:	2 weeks
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D41942

(cherry picked from commit b2e97edffd)
2024-02-27 00:22:31 +01:00
Gordon Bergling
ff9794844f umcs(4): Fix two typos in source code comments
- s/frequences/frequencies/

(cherry picked from commit 059fd69e74)
2024-02-25 08:43:54 +01:00
Gordon Bergling
324f8ce49a sk(4): Fix a typo in a source code comment
- /integeated/integrated/
- s/extented/extended/

Obtained from:	NetBSD

(cherry picked from commit a53204c227)
2024-02-25 08:43:38 +01:00
Gordon Bergling
a7a0875d27 bge(4): Fix some typos in source code comments
- s/firwmare/firmware/
- s/recue/reduce/
- s/throughpout/throughput/
- s/hardwares/hardware/

Obtainted from:	NetBSD

(cherry picked from commit d646dca3bc)
2024-02-25 08:43:21 +01:00
Gordon Bergling
f7d2a1d2dc random(4): Fix a typo in a source code comment
- s/parmeter/parameter/

(cherry picked from commit 5e89e34f84)
2024-02-25 08:43:02 +01:00