Commit graph

43048 commits

Author SHA1 Message Date
Piotr Kubaj
1e84a6ba21 ipmi: fix runtime on powerpc64le
Differential Revision: https://reviews.freebsd.org/D49530

(cherry picked from commit 2e16618fe7)
2025-04-03 12:21:38 +02:00
Colin Percival
a64357f31b acpi_pci: Add quirk for PSTAT_PME-before-detach
In order to signal to Graviton [123] systems that a device is ready
to be "ejected" (after a detach request is made via the EC2 API) we
need to set PCIM_PSTAT_PME to 1 and PCIM_PSTAT_PMEENABLE to 0.  We are
not aware of any rationale for this requirement beyond "another OS
kernel happens to do this", i.e. this is effectively bug-for-bug
compatibility.

Arguably this should be done by the ACPI _EJ0 method on these systems,
but it is not.

Create a new ACPI_Q_CLEAR_PME_ON_DETACH quirk and set it in EC2 AMIs,
and add the PCI register write to acpi_pci_device_notify_handler when
that quirk is set.

Reviewed by:	jhb
MFC after:	1 month
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D49146

(cherry picked from commit d70bac252d)
2025-04-01 10:43:58 -07:00
Andrew Turner
423362c3d8 pci: Only claim to support PCI ASPM on x86
We claim to support Active State Power Management, but don't appear to
do anything different in the kernel when it's enabled other than tell
the firmware we do.

This breaks VMware Fusion on Apple Silicon when it's enabled as it
expects the kernel to enable the ports. As it is reported to be needed
on some x86 servers keep it enabled there, but disable on non-x86
architectures.

Reported by:	kp, tuexen
Reviewed by:	tuexen, mav, imp, jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48303

(cherry picked from commit 143dff0f9c)
2025-04-01 10:43:58 -07:00
Andrew Turner
3c9eae3c11 pci_host_generic:Add pcib_request_feature on ACPI
In the ACPI attachment add support for the pcib_request_feature method.
This uses the common _OSC handling.

Reviewed by:	imp, jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48048

(cherry picked from commit 1f5c50a861)
2025-04-01 10:43:57 -07:00
Andrew Turner
479872ce91 pci_host_generic: Support ACPI_IVAR_HANDLE
In the ACPI attachment support the ACPI_IVAR_HANDLE ivar. While here
use the common ivar function to support the common ivars.

Reviewed by:	imp, jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48047

(cherry picked from commit deb36d0c65)
2025-04-01 10:43:57 -07:00
Andrew Turner
506e41a151 pci: Make generic_pcie_read_ivar non static
Allow this to be called from attachments to allow more ivars to be
implemented.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48046

(cherry picked from commit 7cafe75c8c)
2025-04-01 10:43:57 -07:00
Andrew Turner
d3916945e4 pci: Use a switch statement when reading ivars
In pci_host_generic.c use a switch statement rather than a series
of if statements.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48045

(cherry picked from commit fafb43abd0)
2025-04-01 10:43:57 -07:00
Andrew Turner
3af851edd0 acpica: Extract _OSC parsing to a common file
This will be used by pci_host_generic_acpi.c so needs to be in a
common location.

Reviewed by:	imp, jhb
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48044

(cherry picked from commit ba1904937d)
2025-04-01 10:43:57 -07:00
Christos Margiolis
e431b38b0f snd_hda: Patch Framework 16 AMD
Reported by:	jrm
Tested by:	jrm
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	jrm
Differential Revision:	https://reviews.freebsd.org/D49416

(cherry picked from commit 2f1f523a45)
2025-04-01 15:20:05 +02:00
Gleb Smirnoff
886fcbde46 acpi_ibm: pass brightness events to evdev(4)
unless the dev.acpi_ibm.0.handlerevents sysctl is set to process
them internally.  The default for the latter is to ignore them,
so passing to evdev(4) is enabled by default.

Reviewed by:		wulf, imp
Tested on:		Lenovo Thinpad X11 Carbon 7Th Gen
Differential Revision:	https://reviews.freebsd.org/D48174

(cherry picked from commit c21f5751ef)
2025-03-31 10:31:21 -07:00
Warner Losh
25df691800 nvme: Fix hotplug on one of the amazon platforms
Amazon EC2 m7i cloud instances use PCI hotplug rather than ACPI
hotplug. The card is removed and detach is called to remove the drive
from the system. The hardware is no longer present at this point, but
the bridge doesn't translate the now-missing hardware reads to all ff's
leading us to conclude the hardware is there and we need to do a proper
shutdown of it. Fix this oversight by asking the bridge if the device is
still present as well. We need both tests since some systems one cane
remove the card w/o a hotplug event and we want to fail-safe in those
cases.

Convert gone to a bool while I'm here and update a comment about
shutting down the controller and why that's important.

Tested by: cperciva
Sponsored by: Netflix

(cherry picked from commit dc95228d98)
2025-03-30 16:44:57 -07:00
Christos Margiolis
a3dfa53bbf snd_hda: Support Intel Raptor Lake 0x7a50
PR:		276379
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste, markj
Differential Revision:	https://reviews.freebsd.org/D49389

(cherry picked from commit fc40132603)
2025-03-26 02:39:23 +01:00
Ahmad Khalifa
38dc6b814a 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

(cherry picked from commit d3b1dcb408)
2025-03-25 19:28:39 -06:00
Ahmad Khalifa
513d89fef9 usb: increase USB_PORT_RESET_RECOVERY
10ms seems to be too strict for some configurations, so increase to
20ms.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1327

(cherry picked from commit e152944f1a)
2025-03-25 19:28:38 -06:00
Ahmad Khalifa
7d042b0af1 bytgpio: expose PNP info
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1349

(cherry picked from commit 969484b532)
2025-03-25 19:28:38 -06:00
Ahmad Khalifa
1a8a24e340 acpi_iicbus: Shift slave address
The address is expected to need shifting.
see https://uefi.org/specs/ACPI/6.5/13_System_Mgmt_Bus_Interface_Specification.html#smbus-slave-addresses

Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125

(cherry picked from commit 67677a654a)
2025-03-25 19:28:37 -06:00
Ahmad Khalifa
4073e53e42 acpi_cmbat: Use nitems instead of sizeof
Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125

(cherry picked from commit d0cc25f770)
2025-03-25 19:28:37 -06:00
Warner Losh
d3a659a338 usb-msctest: Be more conservative setting GETMAXLUN quirk
Only set the GETMAXLUN quirk when it causes an error, but don't set it
when it returns 0. Since we reset the device when we set any quirk, only
set this quirk when it generates an error so umass will avoid it. When
the command works, there's no reason for umass to avoid it at all.

MFC After: 1 week
Sponsored by: Netflix

(cherry picked from commit b0375f78e3)
2025-03-24 21:01:56 -06:00
Konstantin Belousov
772390b6da mlx5en: bump MLX5E_MAX_BUSDMA_RX_SEGS
(cherry picked from commit 480fc5b8e5)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
466623f29d mlx5en: fix rq->wqe_sz usage
(cherry picked from commit 016f40466a)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
f38e9a31ba mlx5: bump the max LRO packet size
(cherry picked from commit c2987d7876)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
c083ab4c8b mlx5en: stop arbitrary limiting max wqe size
(cherry picked from commit 89491b1edb)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
6cb0bd50b5 mlx5: overwrite only the echo reply timestamp from the last packet in LRO
(cherry picked from commit bc10238492)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
f6e15b6620 mlx5: assert CQE structure size
(cherry picked from commit 7560ed3a6b)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
ec55118821 mlx5: correct the predicate asserted in __predict_true()
(cherry picked from commit 903996760d)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
7b64ccdf96 mlx5: recalculate tcp checksum for ipv6 hw lro coalesced packet
(cherry picked from commit efe9a3996e)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
3c5bf8d9d9 mlx5: recalculate tcp checksum for ipv4 hw lro coalesced packet
(cherry picked from commit 3eb6d4b4a2)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
7ebbf9f756 mlx5_en: correct recalculation of the ipv4 checksum for hw lro packet
(cherry picked from commit dd1bd0ec5c)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
17a322cae6 mlx5en: follow PRM for setting the max hw lro segment size
(cherry picked from commit c3555174fd)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
aebeaf151d mlx5en: explain why interface needs to be reopened on hw lro change
(cherry picked from commit 93e70e3a94)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
114a805bef mlx5en: make the hw lro control dynamic
(cherry picked from commit 02fe38b921)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
d0a800a7fc mlx5core: add mlx5_core_modify_tir()
(cherry picked from commit 9807157363)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
9ac8af72a7 mlx5en: control hw LRO with the driver conf sysctl, leaving IFCAP_LRO to sw
(cherry picked from commit 816f27e848)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
cb49625f15 mlx5en: make conf.hw_lro sysctl r/w
(cherry picked from commit bbac54b820)
2025-03-20 05:13:37 +02:00
Christos Margiolis
7e8f29eb1b snd_hda: Patch Framework AMD 13th gen
Redirect sound to headphone jack when plugged in.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D49346

(cherry picked from commit 68b6567d09)
2025-03-20 01:35:59 +01:00
Christos Margiolis
b61c045ff8 sound: Remove redundant check in mixer_clone()
PCM_REGISTERED() does this check through PCM_ALIVE().

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit cabf76fde8)
2025-03-19 15:52:08 +01:00
Wei Hu
64610df593 mana: remove redundant doorbell in mana_poll_rx_cq()
With the last commit to refill the rx mbuf in batch, the doorbell
in mana_poll_rx_cq() becomes redundant. Remove it to save a few
microseconds spent in mmio call.

Reported by:	NetApp
Reviewed by:	Tallamraju, Sai
Tested by:	whu
Fixes:		9b8701b8 ("mana: refill the rx mbuf in batch")
MFC after:	3 days
Sponsored by:	Microsoft

(cherry picked from commit 47f4137e44)
2025-03-18 04:53:56 +00:00
Slava Shwartsman
8a78a9aa99 mlx5: Fix BlueField-4 device description
(cherry picked from commit 7008b9fab5)
2025-03-18 03:41:18 +02:00
Christos Margiolis
4ed0ca91a3 sound: Make feed_mixer_apply() __always_inline
Reported by:	mav
Fixes:		4021fa32d9 ("sound: Simplify pcm/feeder_mixer.c")
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 717adecbbb)
2025-03-17 19:29:17 +01:00
Christos Margiolis
caa06360e6 sound: Update COPYRIGHT notices
Only to files I've currently made significant contributions to.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit c824383b26)
2025-03-17 19:29:17 +01:00
Christos Margiolis
65dec16946 sound: Make dev.pcm.X.mode dynamic
Currently dev.pcm.X.mode is calculated only once in pcm_sysinit(), which
is called by pcm_register() during attach, but this can result in
inconsistencies.

For some context, what pcm_mode_init() does is, it checks if "playcount"
is positive, in which case we assume the device supports playback. The
same is done for "reccount" for recording, and if "mixer_dev" is not
NULL, we know the device has a mixer.

The "playcount" and "reccount" variables correspond to the number of
_primary_ playback/recording channels, so we can assume that the primary
channels have been created before reaching pcm_mode_init(). However, for
the mixer that's not always the case. If the mixer is created _after_
pcm_register(), as is the case for snd_dummy(4) for example,
pcm_mode_init() will see that "mixer_dev" is NULL, and report that the
device does not have a mixer, whereas in reality we just created it
afterwards.

While this could be fixed by simply creating the mixers always before
pcm_register(), it is better to be robust and calculate the mode
dynamically.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D49024

(cherry picked from commit ab95710f30)
2025-03-17 19:29:17 +01:00
Christos Margiolis
31ddfe9d9c sound: Retire SD_F_AUTOVCHAN
This flag is redundant and essentially a no-op, as it is set when the
device supports at least playback or recording, which is almost always
the case. But even if the device is mixer-only (i.e., 0 channels), there
is no reason to keep this flag; it is only used to bail out of the vchan
sysctl handlers, but we already bail out anyway if we try to use the
sysctl in a vchan direction that is not supported.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D49021

(cherry picked from commit b768f2c777)
2025-03-17 19:29:15 +01:00
Christos Margiolis
42889e8e2f sound: Take dsp_cdevsw out of header file
Not used outside of pcm/dsp.c.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D49217

(cherry picked from commit 2fda859711)
2025-03-17 19:28:54 +01:00
Christos Margiolis
a33356100b sound: Simplify pcm/feeder_mixer.c
- Get rid of macro magic.
- Make feed_mixer_info handling similar to most feeders.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48394

(cherry picked from commit 4021fa32d9)
2025-03-17 19:28:54 +01:00
Christos Margiolis
15dc84ba5f sound: Remove feed_matrix_apply_generic()
It does what feed_matrix_apply() already does, so it is redundant.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48036

(cherry picked from commit b73b5f70e9)
2025-03-17 19:28:54 +01:00
Christos Margiolis
a25f84cf09 sound: Remove macro magic from pcm/feeder_matrix.c
Turn the FEEDMATRIX_DECLARE macro into a single inline function
(feed_matrix_apply()). There is no reason to have this as a macro, it
only complicated the code. An advantage of this patch is that, because
we no longer call the functions created by the macro through function
pointers (apply field of feed_matrix_info), we can call
feed_matrix_apply() directly in feed_matrix_feed().

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48035

(cherry picked from commit ac24c9da8b)
2025-03-17 19:28:54 +01:00
Christos Margiolis
b2adb71308 sound: Remove macro magic from pcm/feeder_eq.c
Turn the FEEDEQ_DECLARE macro into a single inline function
(feed_eq_biquad()). There is no reason to have this as a macro, and it
only complicates the code. An advantage of this patch is that, because
we no longer call the functions created by the macro through function
pointers (biquad_op), we can call feed_eq_biquad() directly in
feed_eq_feed().

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48032

(cherry picked from commit e18d66d9c5)
2025-03-17 19:28:54 +01:00
Christos Margiolis
d8c3c6752b sound: Turn clamp macros into a function
This makes some subsequent feeder refactors easier to implement.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48421

(cherry picked from commit 4918fc2e23)
2025-03-17 19:28:54 +01:00
Christos Margiolis
33529d6ad4 sound: Refactor the format conversion framework
Merge the PCM_READ|WRITE_* macros defined in pcm/pcm.h, as well as the
intpcm_read|write_* macros defined in pcm/feeder_format.c, into six
inline functions: pcm_sample_read|write[_norm|calc](). The absence of
macro magic makes the code significantly easier to read, use and modify.

Since these functions take the input/output format as a parameter, get
rid of the read() and write() function pointers defined in struct
feed_format_info, as well as the feeder_format_read|write_op()
functions, and use the new read/write functions directly.

Sponsored by:	The FreeBSD Fondation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D47932

(cherry picked from commit 433e270f34)
2025-03-17 19:28:54 +01:00
Kyle Evans
7215aed797 kern: wg: remove overly-restrictive address family check
IPv4 packets can be routed via an IPv6 nexthop, so the handling of the
parsed address family is more strict than it needs to be.  If we have a
valid header that matches a known peer, then we have no reason to
decline the packet.

Convert it to an assertion that it matches the destination as viewed by
the stack below it, instead.  `dst` may be the gateway instead of the
destination in the case of a nexthop, so the `af` assignment must be
switched to use the destination in all cases.

Add a test case that approximates a setup like in the PR and
demonstrates the issue.

PR:		284857
Reviewed by:	markj (earlier version), zlei

(cherry picked from commit 2bef0d54f7)
2025-03-14 21:52:02 -05:00