Commit graph

42936 commits

Author SHA1 Message Date
Warner Losh
d40fc35f93 nvme: Make is_initialized a bool
is_initialized is used as a bool everywhere, and we never do any atomics
with it, so make it really a bool.

Sponsored by:		Netflix
2024-08-13 16:46:41 -06:00
Ed Maste
2777a32588 iommu: disable dma by default
APIC ID 255 and above require x2APIC and DMAR interrupt remapping.
FreeBSD is starting to be tested on high core count Intel systems that
meet this criteria.  We're going to enable DMAR by default to support
this, so default hw.iommu.dma to 0 to avoid a significant performance
regression.

Reviewed by:	kib, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42435
2024-08-13 16:00:47 -04:00
SHENG-YI HONG
d3b05d0ea1
Add smbus and i2c device IDs for Meteor Lake
Reviewed by:	emaste, Daniel Schaefer <dhs@frame.work>
MFC after:	3 days
Sponsored by:	Framework Computer Inc
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46249
2024-08-13 20:52:19 +08:00
Mark Johnston
27211b7998 mlx5: Remove a less than helpful debug print
Reviewed by:	khng
Fixes:	e23731db48 ("mlx5en: add IPSEC_OFFLOAD support")
Differential Revision:	https://reviews.freebsd.org/D46273
2024-08-12 23:06:01 +00:00
Doug Moore
b70247df0b axgbe: use bit_foreach
bitstring.h includes a definition of bit_foreach, for iterating over
the set bits of a bitstring. axgbe implements its own version of this
for bitstrings. Drop it, and use the bitstring method.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D46037
2024-08-12 16:04:32 -05:00
Li-Wen Hsu
6ea4d95f6c
Move support of Realtek 8156/8156B from cdce(4) to ure(4)
Reviewed by:	kevlo, imp, hrs
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45088
2024-08-12 14:56:28 +08:00
Jessica Clarke
104ee24349 pci: Renove #ifdef PCI_IOV from declarations now used unconditionally
Fixes:	971c9f57d7 ("pci: Narrow the scope of recently-added PCI_IOV #ifdefs")
2024-08-08 23:35:09 +01:00
John Baldwin
971c9f57d7 pci: Narrow the scope of recently-added PCI_IOV #ifdefs
Push the #ifdefs down into the function body instead of defining
functions conditionally for ease of readability.  These aren't
critical paths, so one extra branch in the !PCI_IOV case is not a big
deal.

Requested by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D45877
2024-08-08 15:05:23 -04:00
Keith Reynolds
792226e530 qlnxe: Allow MAC address override
The qlnxe driver always sets the NIC's rx mac address to the card's
default MAC, ignoring any MAC address set via ifconfig.

PR:		278085
MFC after:	1 week
2024-08-05 12:10:18 -07:00
Andrew Gallatin
1f628be888 tcp_ratelimit: provide an api for drivers to release ratesets at detach
When the kernel is compiled with options RATELIMIT, the
mlx5en driver cannot detach. It gets stuck waiting for all
kernel users of its rates to drop to zero before finally calling
ether_ifdetach.

The tcp ratelimit code has an eventhandler for ifnet departure
which causes rates to be released. However, this is called as an
ifnet departure eventhandler, which is invoked as part of
ifdetach(), via either_ifdetach(). This means that the tcp
ratelimit code holds down many hw rates when the mlx5en driver
is waiting for the rate count to go to 0. Thus devctl detach
will deadlock on mlx5 with this stack:
mi_switch+0xcf sleepq_timedwait+0x2f _sleep+0x1a3 pause_sbt+0x77 mlx5e_destroy_ifp+0xaf mlx5_remove_device+0xa7 mlx5_unregister_device+0x78 mlx5_unload_one+0x10a remove_one+0x1e linux_pci_detach_device+0x36 linux_pci_detach+0x24 device_detach+0x180 devctl2_ioctl+0x3dc devfs_ioctl+0xbb vn_ioctl+0xca devfs_ioctl_f+0x1e kern_ioctl+0x1c3 sys_ioctl+0x10a

To fix this, provide an explicit API for a driver to call the tcp
ratelimit code telling it to detach itself from an ifnet. This
allows the mlx5 driver to unload cleanly. I considered adding an
ifnet pre-departure eventhandler. However, that would need to be
invoked by the driver, so a simple function call seemed better.

The mlx5en driver has been updated to call this function.

Reviewed by: kib, rrs

Differential Revision:	https://reviews.freebsd.org/D46221
Sponsored by: Netflix
2024-08-05 12:51:35 -04:00
Navdeep Parhar
fef0e39f64 cxgbe/t4_tom: bugfixes in stop/restart.
1. Remove toepcb from the toep_list on active open failure.
2. Purge the wr_list for an L2T entry on an adpater stop.

Fixes:	c1c524852f cxgbe/t4_tom: Implement uld_stop and uld_restart for ULD_TOM.
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2024-08-05 05:56:22 -07:00
Mark Johnston
2e4781cb12 xen/netfront: Decouple XENNET tags from mbuf lifetimes
netmap's generic mode tries to improve performance by minimizing mbuf
allocations.  In service of this goal, it maintains an extra reference
to the mbuf and polls the counter to see if the driver has released its
reference by calling m_freem().  As a result, the extref destructor is
not called when expected by the netfront driver, and mbufs tags are not
freed.

Modify the tx path to release its mbuf tags promptly when reclaiming tx
descriptors.  They are drawn from a fixed-size pool, so otherwise are
quickly exhausted when a netfront interface is in netmap generic mode.

Co-authored by:	royger
MFC after:	2 weeks
Fixes:	dabb3db7a8 ("xen/netfront: deal with mbuf data crossing a page boundary")
Sponsored by:	Cloud Software Group
Sponsored by:	Klara, Inc.
Sponsored by:	Zenarmor
2024-08-02 18:05:37 +00:00
Christos Margiolis
b58d9db4d7 sound: Fix VCHANs' starting and ending points in feeder chain
sndstat(4) falsely reports "hardware" as the starting point of
recording, and ending point of playback VCHANs. Recording VCHANs get
their input from the primary recording channel, and playback VCHANs send
their input to the primary playback channel.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D46177
2024-08-02 15:53:16 +03:00
Dimitry Andric
357378bbde Fix enum warnings in qat
This fixes a number of clang 19 warnings:

    sys/dev/qat/qat_api/common/compression/dc_session.c:154:15: error: comparison of different enumeration types ('enum _CpaBoolean' and 'icp_qat_hw_compression_delayed_match_t') [-Werror,-Wenum-compare]
      154 |         if (CPA_TRUE == pService->comp_device_data.enableDmm) {
          |             ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/dev/qat/qat_api/common/compression/dc_session.c:285:17: error: comparison of different enumeration types ('enum _CpaBoolean' and 'icp_qat_hw_compression_delayed_match_t') [-Werror,-Wenum-compare]
      285 |                     (CPA_TRUE == pService->comp_device_data.enableDmm) ?
          |                      ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The `enableDmm` field of variable `comp_device_data` is of type
`icp_qat_hw_compression_delayed_match_t`, not `CpaBoolean`. In this
case, we can seamlessly replace the value with
`ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_ENABLED`, which is numerically
equal to `CPA_TRUE`.

MFC after:	3 days
2024-07-31 21:31:55 +02:00
Dimitry Andric
1bd66fac35 Fix enum warning in isci
This fixes a clang 19 warning:

    sys/dev/isci/scil/scif_sas_smp_remote_device.c:197:26: error: comparison of different enumeration types ('SCI_IO_STATUS' (aka 'enum _SCI_IO_STATUS') and 'enum _SCI_STATUS') [-Werror,-Wenum-compare]
      197 |    if (completion_status == SCI_FAILURE_RETRY_REQUIRED)
          |        ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~

The `completion_status` variable is of type `SCI_IO_STATUS`, not
`SCI_STATUS`. In this case, we can seamlessly replace the value with
`SCI_IO_FAILURE_RETRY_REQUIRED`, which is numerically equal to
`SCI_FAILURE_RETRY_REQUIRED`.

MFC after:	3 days
2024-07-31 21:31:50 +02:00
Dimitry Andric
67be1e195a Fix enum warning in iavf
This fixes a clang 19 warning:

    sys/dev/iavf/iavf_lib.c:514:39: error: comparison of different enumeration types ('enum virtchnl_vsi_type' and 'enum iavf_vsi_type') [-Werror,-Wenum-compare]
      514 |                 if (sc->vf_res->vsi_res[i].vsi_type == IAVF_VSI_SRIOV)
          |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~

The `vsi_type` field of `struct virtchnl_vsi_resource` is of type `enum
virtchnl_vsi_type`, not `enum iavf_vsi_type`. In this case, we can
seamlessly replace the value with `VIRTCHNL_VSI_SRIOV`, which is
numerically equal to `IAVF_VSI_SRIOV`.

MFC after:	3 days
2024-07-31 21:31:46 +02:00
Konstantin Belousov
2204a48290 mlx5en: limit reporting eeprom read failure due to unplugged module to verboseboot
Requested by:	gallatin
Sponsored by:	NVIDIA networking
MFC after:	1 week
2024-07-30 18:00:04 +03:00
Konstantin Belousov
e23731db48 mlx5en: add IPSEC_OFFLOAD support
Right now, only IPv4 transport mode, with aes-gcm ESP, is supported.
Driver also cooperates with NAT-T, and obeys socket policies, which
makes IKEd like StrongSwan working.

Sponsored by:	NVIDIA networking
2024-07-30 18:00:04 +03:00
John Baldwin
8ebacb9daa nvmf_tcp: Correct calculation of number of TTAGs to allocate
The increment of 1 was intended to convert qp->maxr2t from 0's based
to 1 based before multiplying by the queue length.

Sponsored by:	Chelsio Communications
2024-07-30 10:28:54 -04:00
John Baldwin
19c15e41c6 nvmf_tcp: Update R2T accounting stats when aborting command buffers
If a queue pair is destroyed (e.g. due to the TCP connection dropping)
while a host to controller data transfer is in progress, the
pending_r2ts counter can be non-zero.  This can later trigger an
assertion failure when the capsule is freed.  To fix, update the
relevant R2T accounting stats when aborting active command buffers
during queue pair destruction.

Sponsored by:	Chelsio Communications
2024-07-30 10:28:19 -04:00
John Baldwin
6df040ea6e nvmf_tcp: Avoid setting some unused parameters in tcp_allocate_qpair
Specifically, some parameters only apply to either controller or host
queue pairs but not both.

Sponsored by:	Chelsio Communications
2024-07-30 10:27:47 -04:00
John Baldwin
a14de491e0 nvmf_tcp: Use min() to simplify a few statements
Sponsored by:	Chelsio Communications
2024-07-30 10:26:14 -04:00
Roger Pau Monné
baa006f342 xen: introduce a per-arch scratch mapping ranges
The current approach is to create foreign mappings in any unpopulated address
on the memory map.  This however can cause issues, as late-loaded drivers could
then found their MMIO region has been stolen to be used as foreign mapping
scratch space (due to the Xen drivers having started first).

Add a local resource manager to the xenpv bus driver, architectures can add
suitable resources to that resource manager at boot in order to be used in
preference of the generic MMIO resource allocator.

No functional change, as the introduced scratch mapping range is not yet
populated.

Sponsored by: Cloud Software Group
MFC after: 1 week
Reviewed by: Elliott Mitchell <ehem+freebsd@m5p.com>
Differential revision: https://reviews.freebsd.org/D46122
2024-07-30 09:39:38 +02:00
Ahmad Khalifa
969484b532 bytgpio: expose PNP info
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1349
2024-07-29 14:09:08 -06:00
Mark Johnston
01518f5eed sleepqueue: Remove kernel stack swapping support, part 10
- Remove kick_proc0().
- Make the return type of sleepq_broadcast(), sleepq_signal(), etc.,
  void.
- Fix up callers.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46128
2024-07-29 01:43:59 +00:00
Mark Johnston
d37286b9bf proc: Remove kernel stack swapping support, part 7
Remove some uses of PHOLD which were there only to prevent the process'
threads from being swapped out.

Tested by:	pho
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D46118
2024-07-29 01:43:49 +00:00
Christos Margiolis
00172d2007 sound: Simplify feeder_remove()
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D46100
2024-07-27 14:55:57 +03:00
Christos Margiolis
f477d41253 sound: Remove unused defines from pcm/sound.h
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D45986
2024-07-27 14:55:52 +03:00
Christos Margiolis
5b209e153b sound: Simplify chn_init()
- Remove unnecessary CHN_[UN]LOCKs.
- Improve device_printf() messages.
- Remove redundant checks.
- Remove 0 assignments, since the channel is allocated with M_ZERO.
- Re-organize sections in a more coherent way.
- Remove "out1" label, just return NULL directly.
- Rename "out2" to "fail" and simplify logic.
- Do not check the return value of dsp_unit2name(), as it is guaranteed
  not to fail (we pass a valid channel type).

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45985
2024-07-27 14:55:47 +03:00
Christos Margiolis
c55f995502 sound: Remove unused FEEDER_DEBUG
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45984
2024-07-27 14:55:42 +03:00
Christos Margiolis
29ff7b08be sound: Rename chn_* feeder functions to feeder_*
Avoid layering violation. No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45983
2024-07-27 14:55:37 +03:00
Christos Margiolis
85d1c84c24 snd_hdsp*: Free up channel resources in case of CHANNEL_INIT() failure
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45982
2024-07-27 14:55:32 +03:00
Christos Margiolis
16329b7b32 sound: Fix memory leak in chn_init()
In case chn_init() fails, we are leaking memory by not freeing the
feeder.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45979
2024-07-27 14:55:19 +03:00
Christos Margiolis
c15c9315b2 sound: Implement dummy driver
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45967
2024-07-27 14:54:45 +03:00
Christos Margiolis
bd5bcc848c sound: Add OSS channel capabilities to sndstat nvlist
Assignment taken from dsp_oss_engineinfo().

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46166
2024-07-27 14:54:27 +03:00
Christos Margiolis
a628371757 sound: Add *vchanrate and *vchanformat to sndstat nvlist
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46164
2024-07-27 14:54:21 +03:00
Christos Margiolis
810530aa26 sound: Add device status string to sndstat nvlist
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46163
2024-07-27 14:54:14 +03:00
Warner Losh
56ecc8a932 pci_user: Rename _old to _freebsd6
The pre-freebsd7 stuff is labeled _old right now. Relabel it as
_freebsd6 instead. No functional change intended. I selected freebsd6
because that's the last version to have the ioctls, although I know
there were changes in the interface for 4, 5 and 6. This broadly batches
what we do with system calls that accumulate changes until we break and
use a new one, we use the last major the system call was in.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D45867
2024-07-26 17:21:22 -06:00
Bjoern A. Zeeb
d1bdc2821f Deprecate contigfree(9) in favour of free(9)
As of 9e6544dd6e contigfree(9) is no longer
needed and should not be used anymore.  We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e and is handled in D45813 (to be committed
seperately later).

Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj, kib
Tested by:	pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099
2024-07-26 10:45:01 +00:00
John Baldwin
5d0498db47 nvmf_tcp: Rename max_c2hdata sysctl to max_transmit_data
This sysctl sets a cap on the maximum payload of transmitted data PDUs
including both C2H_DATA and H2C_DATA PDUs, not just C2H_DATA PDUs.

Sponsored by:	Chelsio Communications
2024-07-25 15:29:43 -04:00
Warner Losh
06326613af smbios: Add length sanity checking
D28743 was commited, reverted and then f689cb23b2 landed before it
was recommitted. However, D28743 included an extra length check. Redo
that functionality so we check both the number of entries as well as the
length checks for wacky data.

Sponsored by:		Netflix
Reviewed by:		gallatin
Differential Revision:	https://reviews.freebsd.org/D45763
2024-07-24 23:09:57 -06:00
Warner Losh
ce41bee0b4 ipmi_smbios: Only search for the BIOS signature on x86
Sponsored by:		Netflix
2024-07-24 23:09:57 -06:00
Warner Losh
a05a680469 newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANY
Sponsored by:		Netflix
2024-07-24 22:23:02 -06:00
Warner Losh
5b56413d04 newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY
Sponsored by:		Netflix
2024-07-24 22:22:58 -06:00
Warner Losh
f68c4b4746 nvme: Add bit names for nvme 2.0 for Async Events
NVME 2.0 has defined a number of new bits for async events. Add
defines for them.

Sponsored by:		Netflix
2024-07-24 20:47:26 -06:00
Warner Losh
bb7f7d5b52 nvme: Warn if there's system interrupt issues.
Issue a warning if we have system interrupt issues. If you get this
warning, then we submitted a request, it timed out without an interrupt
being posted, but when we polled the card's completion, we found
completion events. This indicates that we're missing interrupts, and to
date all the times I've helped people track issues like this down it has
been a system issue, not an NVMe driver isseue.

Sponsored by:		Netflix
Reviewed by:		gallatin
Differential Revision:	https://reviews.freebsd.org/D46031
2024-07-23 17:04:03 -06:00
Warner Losh
aa41354349 nvme: Optimize timeout code further
Optimize timeout code based on three observations.

(1) The tr queues are sorted in order of submission, so the first one
    that could time out is the first "real" one on the list.
(2) Timeouts for a given queue are all the same length (well, except
    at startup, where timeout doesn't matter, and when you change it
    at runtime, where timeouts will still happen eventually and the
    difference isn't worth optimizing for).
(3) Calling the ISR races the real ISR and we should avoid that better.

So now, after checking to see if the card is there and working, the
timeout routine scans the pending tracker list until it finds a non-AER
tracker. If the deadline hasn't passed, we return, doing nothing
further.  Otherwise, we call poll completions and then process the list
looking for timed out items.

This should move the timeout routine to touching hardware only when it's
really necessary. It thus avoids racing the normal ISR, while still
timig out stuck transactions quickly enough.

There was also some minor code motion to make all of the above flow more
nicely for the reader.

When interrupts aren't working at all, then this will increase latency
somewhat. But when interrupts aren't working at all, there's bigger
problems and we should poll quite often in that case. That will be
handled in future commits.

Sponsored by: Netflix
Differential Revision:	https://reviews.freebsd.org/D46026
2024-07-23 17:04:02 -06:00
Warner Losh
e6d3ba4be2 nvme: Lock when processing an abort completion command.
When processing an abort completion command, we have to lock. But we
have to lock the qpair of the original transaction (not the abort we're
completing). We do this to avoid races with checking the completion id
to tr mapping array, as well as to manually complete it.

Note: we don't handle the completion status of 'Asked to abort too many
transactions at once.' That will be fixed on subsequent commits. Add a
note to that effect for now since it's a harder problem to solve.

Sponsored by: Netflix
Differential Revision:	https://reviews.freebsd.org/D46025
2024-07-23 17:04:02 -06:00
Warner Losh
86909f7aeb nvme: Always lock and only avoid processing for recovery state
When we lose a race with the timeout code, shift towards waiting for
that timeout code to complete so we can acquire the lock. This way we
can make sure we're in 'normal' mode before processing I/O
completions. If we're not in 'normal' mode, then we're resetting and we
should avoid completions.

Sponsored by: Netflix
Reviewed by: gallatin
Differential Revision:	https://reviews.freebsd.org/D46024
2024-07-23 17:04:02 -06:00
Ed Maste
0ac6cc3fd7 iichid: Soften "Interrupt setup failed" message
Users may interpret the message as a possible hardware error, but the
issue is in fact unimplemented functionality.  Reword the message to
avoid implying it is an error.

Reviewed by:	wulf
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46092
2024-07-23 16:38:16 -04:00