Commit graph

43070 commits

Author SHA1 Message Date
Konstantin Belousov
e6a470ffcb efirt: add a tunable to disable printing faults during EFIRT calls
PR:	285797

(cherry picked from commit fd748c7d5b7aefbeda604403f203637b12ae89df)
2025-04-09 03:53:17 +03:00
Andrew Turner
ddf0b5666b acpi: Pass the correct device to acpi_pcib_osc
Fix a copy-and-paste error in acpi_pcib_request_feature where the
child device was passed into acpi_pcib_osc rather than the pcib
device.

Reviewed by:	garga, jhb
Fixes:	ba1904937d9a ("acpica: Extract _OSC parsing to a common file")
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48285

(cherry picked from commit b714eacb790551f35de03831b88ad7b7e1502102)
2025-04-08 17:35:45 +00:00
Olivier Certner
cc1cb8e376
smbios: style(9): smbios_cksum()
Reduce some variables' lifecycle.  Remove useless casts.  Remove
superfluous braces.  Add some consts.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit ef446a8065ac0228a5da15f233cd2f964e4d7433)
2025-04-08 15:38:25 +02:00
Olivier Certner
55e8cdff14
smbios: Harden decoding of the BCD revision
bcd2bin() must not be called with a value greater or equal to
LIBKERN_LEN_BCD2BIN.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 516e24e57987d184cce70e7f31443653aa1a5e63)
2025-04-08 15:38:25 +02:00
Olivier Certner
5d9f1bf830
smbios: Carefully print wrong entry point signature on identify
Using printf() with '%s' can lead to arbitrary long printing (although,
usually, a NUL byte should appear quite quickly) and trying to print
unprintable characters.

Instead, print in hexadecimal the exact bytes that are compared to the
expected signature.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit bb04712e37723d112b2fad28af4b035ef35a25be)
2025-04-08 15:38:24 +02:00
Olivier Certner
7dffa9db45
smbios: Print an error on unexpected entry point length on identify
This helps figuring out quickly why no SMBIOS device appears in this case.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit fdf08ac1e9f9baac4fcf4af8f3bf7a34d3ea0009)
2025-04-08 15:38:24 +02:00
Olivier Certner
8c9b142b38
smbios: Apply the v2.1's length fixup only on a 32-bit entry point
Only allow the length tolerance (0x1e instead of 0x1f) for a 32-bit
entry point, as there was no 64-bit entry point in the erroneous SMBIOS
v2.1 standard and assigning the length with 0x1f does not make sense in
this case.

While here, fix accessing the major/minor versions via 'eps' even in the
64-bit entry point case (not causing any practical problem thus far as
the entry point length is greater than any SMBIOS revisions in
existence, so the comparison guarding the fixup would not pass).

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit f6cbd6b6d2ccd672e4807128ce0d07db333d4335)
2025-04-08 15:38:24 +02:00
Olivier Certner
62b6d8c625
smbios: Print an error on memory map failure on identify
Consistently with what the probe and attach methods are doing.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 3907feff7ab732b918ba3f5993e7a6718fffea14)
2025-04-08 15:38:24 +02:00
Olivier Certner
07b84d1f3f
smbios: Unmap memory on error on identify
While here, de-indent most of the code by simply bailing out if 'addr'
is still 0 after the various detection methods have been tried.

Reviewed by:    emaste, imp
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49180

(cherry picked from commit 67d510f0c07afd89e51e337e5abec47f4483ecd9)
2025-04-08 15:38:23 +02:00
Olivier Certner
5e385079d3
smbios: On attach, print the entry point version and revision
Additionally, on verbose boot, print the entry point revision as
a diagnostic/debugging help.

PR:             284460
Reviewed by:    markj, imp (both older version)
MFC after:      2 weeks
Event:          February src bug-busting session
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49179

(cherry picked from commit e421a6615dc257b71ac5255336dddf5c99cd12aa)
2025-04-08 15:38:23 +02:00
Olivier Certner
145ef4af15
smbios: Search for v3 (64-bit) entry point first on BIOS boot
When booted from BIOS (i.e., not EFI), also search for a 64-bit version
of the SMBIOS Entry Point.

This allows us to detect and report the proper SMBIOS version with
BIOSes that only provide the v3 table, as happens on Hetzner virtual
machines.

For machines that provide both, leverage the v3 table in priority
consistently with the EFI case.

PR:             284460
Reviewed by:    markj, imp (both older version)
MFC after:      2 weeks
Relnotes:       yes
Event:          February src bug-busting session
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49179

(cherry picked from commit bc7f6508363c5cf4544044e00bbaf71de8f0168d)
2025-04-08 15:38:23 +02:00
Olivier Certner
e69052efa1
smbios: style(9): sizeof(): No space before the parenthesis
No functional change.

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 69cf9e9a451df3b0bff92f879365f604811e394b)
2025-04-08 15:38:23 +02:00
Andrew Gallatin
fb8bea55a5
smbios: handle smbios3 for arm64
Get smbios working on arm64 where it seems to be
exclusively smbios version 3.x

The "interesting" thing here is that the smbios table seems to be
RAM in the EFI runtime services table. This makes it owned by "ram0",
and not io memory. That prevents bus_alloc_resource() from being able
to claim it, since ram0 already owns it. According to jhb, this is
how things are supposed to work.  Eg, bus_alloc_resource() is meant
to be used with IO memory, not physical memory.  Following his
suggestion, I converted the driver to simply use pmap_mapbios().

This is a prerequisite for getting IPMI to attach via the SSIF
attachment on arm64 servers, where all IPMI that I've seen
uses SSIF.

Note that this change is based on initial work by Allan Jude in
https://reviews.freebsd.org/D28739.

Reviewed by: imp
Sponsored by: Netflix, Ampere Computing LLC (D28739)
Differential Revision: https://reviews.freebsd.org/D42592

(cherry picked from commit ba0e4d7971e05ee64281a4fc49a2fb408c8ad816)
2025-04-08 15:38:22 +02:00
Konstantin Belousov
477c394ce1 mlx5en: sync channel close with the rq completion processing
(cherry picked from commit f0adc907fc7d3eebfc692fd5f4987c97e61b103d)
2025-04-07 04:28:23 +03:00
Christos Margiolis
8c991c4b06 sound: Fix regression in pcm/feeder_mixer.c
This call was meant to be the default case in the first place, but
somehow missed this.

Reported by:	glebius
Fixes:		4021fa32d92d ("sound: Simplify pcm/feeder_mixer.c")
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b6420b5ea5bcdeb859a2b3357e5dbaafe7aaff88)
2025-04-06 02:28:15 +02:00
Christos Margiolis
2254bef61b sound: Use bus_topo_lock() where appropriate
Lock around uses of devclass_*() and replace leftover
CTLFLAG_NEEDGIANTs with CTLFLAG_MPSAFE.

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

(cherry picked from commit 35400672df83e337f8792df1972a15003b603930)
2025-04-06 02:28:14 +02:00
Christos Margiolis
831c30f09e sound: Improve afmt_tab
Reduce ifdefs, and add aliases for the unsigned formats.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D48009

(cherry picked from commit a4aff024fd53a38ba08bbf5309589e1865ffe024)
2025-04-06 02:28:14 +02:00
Christos Margiolis
1728d26682 sound: Implement AFMT_FLOAT support
Even though the OSS manual [1] advises against using AFMT_FLOAT, there
are applications that expect the sound driver to support it, and might
not work properly without it.

This patch adds AFMT_F32_LE|BE (as well as AFMT_FLOAT for OSS
compatibility) in sys/soundcard.h and implements AFMT_F32_LE|BE <->
AFMT_S32_LE|BE conversion functions. As a result, applications can
write/read floats to/from sound(4), but internally, because sound(4)
works with integers, we convert floating point samples to integer ones,
before doing any processing.

The reason for encoding/decoding IEEE754s manually, instead of using
fpu_kern(9), is that fpu_kern(9) is not supported by all architectures,
and also introduces significant overhead.

The IEEE754 encoding/decoding implementation has been written by Ariff
Abdullah [2].

[1] http://manuals.opensound.com/developer/AFMT_FLOAT.html
[2] https://people.freebsd.org/~ariff/utils/ieee754.c

PR:		157050, 184380, 264973, 280612, 281390
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D47638

(cherry picked from commit e1bbaa71d62c8681a576f9f5bedf475c7541bd35)
2025-04-06 02:28:14 +02:00
Christos Margiolis
e4c0d79614 sound: Fix vchanrate and vchanformat
Make vchanrate and vchanformat reflect the primary channel's software
buffer's rate and format respectively. Fix previous inconsistencies.

Get rid of the initializations in vchan_create() and move them to
chn_init().

Without the feeder_rate_round check in sysctl_dev_pcm_vchanrate(), we
can set the software rate to anything between feeder_rate_min and
feeder_rate_max. If we keep the check, however, the rate is limited to
whatever the driver's min/max is, which can be a problem if, for
example, the driver supports only a single rate, in which case we won't
be able to set anything other than the driver rate.

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

(cherry picked from commit e372211be5c56e218e974a4478be9aa80bfca064)
2025-04-06 02:28:14 +02:00
Norbert Ciosek
6e510d8fba ixgbe: fix mailbox ack handling
Check if CTS bit is set in the mailbox message before waiting for ACK.
Otherwise ACK will never be received causing the function to timeout. Add
a note for ixgbe_write_mbx that it should be called while holding a lock.

Fixes: 6d243d2 ("net/ixgbe/base: introduce new mailbox API")
Cc: stable@dpdk.org

Signed-off-by: Norbert Ciosek <norbertx.ciosek@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Obtained from:	DPDK (1f119e4)

(cherry picked from commit 1580f8d9c1740e0c54554e6c185573d34f2dcf76)
2025-04-04 20:43:39 -07:00
Konstantin Belousov
b01d15abba iommu_gas_map_region(): add comment explaining the ma array shift
(cherry picked from commit 45f70f98fc55b753b1e7a7374b4a061aa1f27392)
2025-04-04 03:54:06 +03:00
Eric Joyner
f034ddd2fa
igc(4): Fix attach for I226-K and LMVP devices
Summary:
The device IDs for these were in the driver's list of PCI ids to attach
to, but igc_set_mac_type() had never been setup to set the correct mac
type for these devices. Fix this by adding these IDs to the switch block
in order for them to be recognized by the driver instead of returning an
error.

This fixes the igc(4) attach for the I226-K LOM on the ASRock Z790
PG-ITX/TB4 motherboard, allowing it to be recognized and used.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	kbowling@
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D49147

(cherry picked from commit 7ee310c80ea7b336972f53cc48b8c3d03029941e)
2025-04-03 12:59:47 -07:00
Piotr Kubaj
1e84a6ba21 ipmi: fix runtime on powerpc64le
Differential Revision: https://reviews.freebsd.org/D49530

(cherry picked from commit 2e16618fe789f110bd8d297b1c65b166fa60c2fe)
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 d70bac252d30adec4feba0c866dabe2c16a756d9)
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 143dff0f9ce9a6f03ae5701368c7144b30e2dc39)
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 1f5c50a8617355758510675cb9412f56fed12efc)
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 deb36d0c65436d16b04f99cc2a27bd0f3980a6f0)
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 7cafe75c8c52deffcb3e64200eb4187a52cf202d)
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 fafb43abd0dcaf2d36ec7344f46e7e19c42be888)
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 ba1904937d9ae0539e39001467a1519b17177118)
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 2f1f523a45fb7f9fddd36a3402edbf7b111996c3)
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 c21f5751ef0932796676e55953461e0679020e28)
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 dc95228d98474aba940e3885164912b419c5579d)
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 fc40132603f5133037a35e2c14ac1356a0128c50)
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 d3b1dcb408e2f63845aee5508fe4c73db1f94b58)
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 e152944f1a16a4ff33b4e20b813ce4a54b884b90)
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 969484b53217cee65d6802f1954f0431cbfc6b45)
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 67677a654aa7456f18077ccbaa9c40f39a36d21a)
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 d0cc25f770aee068bcbaee89aa2f52cc5dd79dd5)
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 b0375f78e32acd7947d28126a5e165f8139a5a23)
2025-03-24 21:01:56 -06:00
Konstantin Belousov
772390b6da mlx5en: bump MLX5E_MAX_BUSDMA_RX_SEGS
(cherry picked from commit 480fc5b8e5dee2f111623eaec95c76575d876aa7)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
466623f29d mlx5en: fix rq->wqe_sz usage
(cherry picked from commit 016f40466afc029df28d699650237b182aa88211)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
f38e9a31ba mlx5: bump the max LRO packet size
(cherry picked from commit c2987d7876a04c292d29c74cd6f9c02a82689ed5)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
c083ab4c8b mlx5en: stop arbitrary limiting max wqe size
(cherry picked from commit 89491b1edb3438ebce84e17fdb6c1acab35df601)
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 bc1023849256b786fd21aad06a1a1b577c5dbd9d)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
f6e15b6620 mlx5: assert CQE structure size
(cherry picked from commit 7560ed3a6b9deff85b2e865b6db74eb5e0f5f64b)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
ec55118821 mlx5: correct the predicate asserted in __predict_true()
(cherry picked from commit 903996760d1903a7bb594b7f2ed8072e9e6cef9f)
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 efe9a3996ee319358c51681a6d9da8b4bf608b03)
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 3eb6d4b4a25a13b9ea9d825ee44c641b91669d06)
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 dd1bd0ec5c91c21f1f60bb8bc58b2f5e794df43f)
2025-03-20 05:13:37 +02:00