Commit graph

42084 commits

Author SHA1 Message Date
Alexander Motin
129c3aa4b2 Use xpt_path_sbuf() in few drivers
xpt_path_string() is now a wrapper around xpt_path_sbuf().  Using it
to than concatenate result to another sbuf makes no sense.  Just call
xpt_path_sbuf() directly.

MFC after:	1 month

(cherry picked from commit 8c4ee0b22c98fc1e208dd133f617bd329cd10728)
2023-12-22 23:36:56 -05:00
Kenneth D. Merry
504e85ade1 mpr, mps: Establish busdma boundaries for memory pools
Most all of the memory used by the cards in the mpr(4) and mps(4)
drivers is required, according to the specs and Broadcom developers,
to be within a 4GB segment of memory.

This includes:

System Request Message Frames pool
Reply Free Queues pool
ReplyDescriptorPost Queues pool
Chain Segments pool
Sense Buffers pool
SystemReply message pool

We got a bug report from Dwight Engen, who ran into data corruption
in the BAE port of FreeBSD:

> We have a port of the FreeBSD mpr driver to our kernel and recently
> I found an issue under heavy load where a DMA may go to the wrong
> address. The test system is a Supermicro X10SRH-CLN4F with the
> onboard SAS3008 controller setup with 2 enterprise Micron SSDs in
> RAID 0 (striped). I have debugged the issue and narrowed down that
> the errant DMA is one that has a segment that crosses a 4GB
> physical boundary.  There are more details I can provide if you'd
> like, but with the attached patch in place I can no longer
> re-create the issue.

> I'm not sure if this is a known limit of the card (have not found a
> datasheet/programming docs for the chip) or our system is just
> doing something a bit different. Any helpful info or insight would
> be welcome.

> Anyway, just thought this might be helpful info if you want to
> apply a similar fix to FreeBSD. You can ignore/discard the commit
> message as it is my internal commit (blkio is our own tool we use
> to write/read every block of a device with CRC verification which
> is how I found the problem).

The commit message was:

> [PATCH 8/9] mpr: fix memory corrupting DMA when sg segment crosses
> 4GB boundary

> Test case was two SSD's in RAID 0 (stripe). The logical disk was
> then partitioned into two partitions. One partition had lots of
> filesystem I/O and the other was initially filled using blkio with
> CRCable data and then read back with blkio CRC verify in a loop.
> Eventually blkio would report a bad CRC block because the physical
> page being read-ahead into didn't contain the right data. If the
> physical address in the arq/segs was for example 0x500003000 the
> data would actually be DMAed to 0x400003000.

The original patch was against mpr(4) before busdma templates were
introduced, and only affected the buffer pool (sc->buffer_dmat) in
the mpr(4) driver. After some discussion with Dwight and the
LSI/Broadcom developers and looking through the driver, it looks
like most of the queues in the driver are ok, because they limit
the memory used to memory below 4GB. The buffer queue and the chain
frames seem to be the exceptions.

This is pretty much the same between the mpr(4) and mps(4) drivers.

So, apply a 4GB boundary limitation for the buffer and chain frame pools
in the mpr(4) and mps(4) drivers.

Reported by:	Dwight Engen <dwight.engen@gmail.com>
Reviewed by:	imp
Obtained from:	Dwight Engen <dwight.engen@gmail.com>
Differential Revision:	<https://reviews.freebsd.org/D43008>

(cherry picked from commit 264610a86e14f8e123d94c3c3bd9632d75c078a3)
2023-12-20 10:40:42 -05:00
Gordon Bergling
2ad07dc6ce qat: Fix two typos in source code comments
- s/parmeters/parameters/

(cherry picked from commit ada4cd3f7710d9759e391e84ad21b7763062bdbc)
2023-12-20 08:35:25 +01:00
Vladimir Kondratyev
36d6a45654 ig4: Add PCI IDs for Intel Ice Lake I2C controller.
PR:		275115
Tested by:	Sam <sam3423.yntmr_AT_slmail_DOT_me>
2023-12-19 23:34:56 +03:00
Mark Johnston
d264ddb9c7 bhnd: Correct the softc size in the siba_bhndb_driver definition
struct siba_bhndb_softc embeds struct siba_softc and adds an extra
field, "quirks".  In practice, this bug was harmless since "quirks" is
unconditionally initialized during driver attach and would have lived in
the redzone of the softc allocation, but KASAN catches the out-of-bounds
access.

PR:		275515
Reported by:	Frank Hilgendorf <frank.hilgendorf@posteo.de>
MFC after:	1 week

(cherry picked from commit 4c3aa00c0a0093c78f42d138bb9eef9b1a7cbb39)
2023-12-11 19:30:05 -05:00
Mitchell Horne
121656c2b1 pst: improve shutdown_post_sync handler
It is desirable to shut down the raid controller even in the face of a
panic. In the SCHEDULER_STOPPED() case, set the interrupt mask bits so
that we request a polled wait, rather than sleep(), from
iop_queue_wait_msg().

Tweak the function name and signature.

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

(cherry picked from commit c4dacfa7f4b82f23ec0924d9db772860b2066f9b)
(cherry picked from commit f97aab79868cd7d891c52b14bd964523fa56f015)
2023-12-08 18:02:45 -04:00
Mitchell Horne
a8ba64ca91 iscsi: adjust shutdown_pre_sync handler
Don't attempt to service reconnections if RB_NOSYNC is set. More
crucially, don't do it if the scheduler is stopped, as the maintenance
thread will never run again.

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

(cherry picked from commit 2ce1c45b3411410a5d0a4d08198a3b0010d493b7)
2023-12-08 18:02:44 -04:00
Mitchell Horne
c13f564f91 xen: improve shutdown hook
Make better use of the shutdown flags. In particular this now handles
standard reboot where RB_POWERCYCLE is not set, and indicates a crash
when the system has panicked.

While here, give the function a prefix.

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

(cherry picked from commit 9e0b0f5de67fd46bddf0e12ef7b71d76a7ec1667)
2023-12-08 18:02:44 -04:00
Mitchell Horne
951d60ee3a shutdown: audit shutdown_post_sync event callbacks
Ensure they are all panic/debugger safe.

Most handlers for this event are for disk drivers/geom modules. There
are a mix of checks being used here (or not), so let's standardize on
checking the presence of the RB_NOSYNC flag.

This flag is set whenever:
 1. The kernel has panicked and kern.sync_on_panic=0*
 2. We reboot from within the kernel debugger (the "reset" command)
 3. Userspace requested it, e.g. by 'reboot -n'

Name the functions consistently.

*This sysctl is tuned to zero by default, but its existence means that
these handlers can be executed after a panic, at the user's discretion.
IMO this use-case is implicitly understood to be risky, and we'd be
better off eliminating it altogether.

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

(cherry picked from commit 4eb861d362d6a9493df7f77eab8e28f9c826702a)
2023-12-08 18:02:44 -04:00
Mitchell Horne
9af585120d pst-raid.c: sort #includes
Reviewed by:	imp, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42336

(cherry picked from commit 66d9c2f38d2db9e50c0dbf56dca4a2f3e6c3107c)
2023-12-08 18:02:44 -04:00
Mitchell Horne
c154cad532 hptmv: remove vestigial EVENTHANDLER_DEREGISTER()
The registration was removed in favor of DEVICE_SHUTDOWN(). Drop the
unused eventhandler tag from the IAL_ADAPTER_T structure.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Fixes:	cd3ef66680 ("Use DEVICE_SHUTDOWN(9) mechanism...")
Differential Revision:	https://reviews.freebsd.org/D42334

(cherry picked from commit a4b19cf5c76ac66d02a3ef8a549115ba865d630c)
2023-12-08 18:02:44 -04:00
Eugene Grosbein
8c165cbaf0 usbdevs: add quirk for WD MyPassport Ultra External HDD
WD MyPassport Ultra External HDD needs quirk
UQ_MSC_NO_TEST_UNIT_READY to attach.

(cherry picked from commit 970d73856b626a68597de19d37b68c376e2c0491)
2023-12-06 11:21:42 +07:00
Patrisious Haddad
0312449c67 mlx5: Fix HCA cap 2 query
(cherry picked from commit 0cd90ee598cef68cef72db8b912241868d1067d0)
2023-12-06 02:27:14 +02:00
Bjoern A. Zeeb
45000447c1 mii: add Vitesse/Microsemi VSC8514
The VSC8514 Quad-Port 10/100/1000BASE-T PHY seems to match the handling
for the VSC8504 (for the little we support of what we could) and while
it works with our generic ukphy add it as vscphy for porper display of
names in the system message buffer and the like (or in case we decide
to implement some extra features).

Tested on:	Ten64

(cherry picked from commit 1965dd85c3b33ed99cb8ef164dd7c5b20425a85e)
2023-11-30 00:36:56 +00:00
Bjoern A. Zeeb
c3216127bc mii: resort VSC8641 entry in miidevs
VSC8641 is a ciphy not a vscphy.
Sort it with the other entries of ciphy to avoid confusion.

(cherry picked from commit 43324ec770f6b598f0ce25487f69a64b3c9822bd)
2023-11-30 00:36:56 +00:00
Bjoern A. Zeeb
e0910cf2d6 dpaa2: make software VLANs usable on dpni
dpni announces IFCAP_VLAN_MTU but internally does not increase the
maximum frame length.  Createing a vlan interface on top of a dpni
interface will result in full-sized frames not passing.
Extend the maximum frame length by ETHER_VLAN_ENCAP_LEN to allow at
least for one layer of (software) vlans for now

GH-Issue:	https://github.com/mcusim/freebsd-src/issues/22
Reviewed by:	dsl
Differential Revision: https://reviews.freebsd.org/D42645

(cherry picked from commit 0480dccd3f347da0dbccf5917633435d5ce6cb86)
2023-11-30 00:36:56 +00:00
Bjoern A. Zeeb
91987a9597 dpaa2: defer link_state updates until we are up
dpaa2_ni_media_change() was called in early setup stages, before we
were fully setup.  That lead to internal driver state being all synched
and fine but hardware state was lost/never setup corrently.

Introduce dpaa2_ni_media_change_locked() so we can avoid reccursive
locking and call "dpaa2_ni_media_change()" instead of mii_mediachg()
as the latter does not setup our state there either.

In order for this all to work, call if_setdrvflagbits() just before
rather than after the above.

Also remove an unecessary direct call to dpaa2_ni_miibus_statchg()
which mii_mediachg() will trigger anyway.

This all fixes a problem [1] that one had to lose the link (either
unplugging/replugging the cable or using ifconfig media none;
ifconfig media auto) to re-trigger the all updates and get the
full state programmed when hardware expected.

GH-Issue:	https://github.com/mcusim/freebsd-src/issues/21 [1]
Reviewed by:	dsl, dch
Differential Revision: https://reviews.freebsd.org/D42643

(cherry picked from commit 964b3408fa872178aacf58f2d84dc43564ec0aa7)
2023-11-30 00:36:56 +00:00
Bjoern A. Zeeb
9197f220d8 dpaa2: fdt improve detection for dpmac/phys
'pcs-handles' are not mandatory in the device tree here so do not
enforce them.  This allows us to find dpmac entries needed for phys
on the WHLE-LS1 as well.

Reviewed by:	jceel, dsl
Differential Revision: https://reviews.freebsd.org/D42644

(cherry picked from commit 6c46ebb05dccdcee18f64dc122e6685c05180217)
2023-11-30 00:36:56 +00:00
Vladimir Kondratyev
16a379ffde hmt(4): Do not require input report HID usages to be a member of TLC
Some touchpads places button usages (in HID report descriptor) in to
the 2-nd level collection rather than in to the top level one. That
confuses current code. Remove collection level check in HID report
descriptor parser to fix device detection.

Reported by:	Peter Much <pmc@citylink.dinoex.sub.org>
PR:		267094

(cherry picked from commit 1d46c8e5c2702c141c6be982b3ca44e74d1cb8f1)
2023-11-27 18:20:16 +03:00
Vladimir Kondratyev
dad62799f5 evdev: Sync event codes with Linux kernel 6.5
(cherry picked from commit 87a53bef41fe769920f925e74fedddafd5187b93)
2023-11-27 18:19:55 +03:00
Gordon Bergling
ab3a178eb1 ath(4): Fix a typo in a source code comment
- s/mutiple/multiple/

(cherry picked from commit 4e36d081f377ecfa8375e5fe3d0763099f4a780d)
2023-11-26 08:53:44 +01:00
Mazin Fadl
6c22e9fa0c usb: add necessary quirks for the NOREL Systems NS1081 SD reader
Without these, the Norelsys NS1081 is completely defunct.

PR:	263868
Fixes:	7520b88860 ("usb(4): Automagically apply all quirks [...]")
(cherry picked from commit b332adfa96218148dfbb936a9c09d00484c868e3)
2023-11-25 22:07:11 -06:00
Mazin Fadl
93f1302dc6 usb: add quirks for the Genesys GL3220 card reader
Without these, card hotplugging does not work on the GL3220.

PR:	263868
Fixes:	7520b88860 ("usb(4): Automagically apply all quirks [...]")
(cherry picked from commit 94efe9f91be7f3aa501983716db5a4378282a734)
2023-11-25 22:07:11 -06:00
Brad Smith
d0b589b231 re(4): Add support for 8168FP HW rev
(cherry picked from commit 88d2b69c719a20da9eb53f1c58adf6ecb005f8ce)
Differential Revision:	https://reviews.freebsd.org/D42671
2023-11-25 16:38:05 -08:00
Martin Matuska
ac83e415ef mlx5_core: fix deadlock when using RXTLS
If removing a node of type FS_TYPE_FLOW_DEST we lock the flow group too
late. This can lead to a deadlock with fs_add_dst_fg().

PR:		274715
Reviewed by:	kib
Tested by:	mm
Differential Revision: https://reviews.freebsd.org/D42368

(cherry picked from commit a592812327deaf69ab226afc5c8a01af43dc03c2)
2023-11-22 09:00:23 +01:00
Konstantin Belousov
8377dd1c9a mlx5core: add linux/bitops.h include for mlx5_ifc.h use of BIT()
(cherry picked from commit 97beac79edf450851474934199e504e6244a7116)
2023-11-22 03:40:28 +02:00
Patrisious Haddad
588203bfbd mlx5: Introduce new destination type TABLE_TYPE
(cherry picked from commit 7b959396ca6fae5635260131eedb9bc19f2726a3)
2023-11-22 03:40:28 +02:00
Konstantin Belousov
d826188941 mlx5ib: adjust for the mlx5_create_auto_grouped_flow_table() interface change
(cherry picked from commit b94ef2a3bcbb369d85b276a45504d42f2f2cd369)
2023-11-22 03:40:28 +02:00
Mark Bloch
e073fccf14 mlx5: add ability to attach flow counter to steering rule
(cherry picked from commit ad744541311bfddd74ea3c5d49d52a4c366b9762)
2023-11-22 03:40:28 +02:00
Raed Salem
52164cb3bd mlx5: add fs_counters
(cherry picked from commit 35bbcf0916992d77fe1521962db42b3106a701fb)
2023-11-22 03:40:28 +02:00
Mark Bloch
5a2ff1f03a mlx5: Add a no-append flow insertion mode
(cherry picked from commit 6a6af22b6ec42eb0436381fae8dd1b86bc4c6327)
2023-11-22 03:40:28 +02:00
Mark Bloch
67a9c8868a net/mlx5: Allow creating autogroups with reserved entries
(cherry picked from commit 0a5db6bb3a953bd22f53f3607ae6853487548532)
2023-11-22 03:40:28 +02:00
Mark Bloch
4c6a46cea4 net/mlx5: Fix auto group size calculation
(cherry picked from commit 04db54fe4309e896c4c80baadbcc47b171722027)
2023-11-22 03:40:28 +02:00
Mark Bloch
0759f76e57 mlx5: Use software enum in APIs instead of PRM
(cherry picked from commit 76ed99ed8ad259792fea752461e2cd1ed481e8e1)
2023-11-22 03:40:28 +02:00
Mark Bloch
6fb2eebf64 mlx5: Add packet reformat support to flow rules
(cherry picked from commit 45e2e55df665c9b5749c9f2269d1b804147917eb)
2023-11-22 03:40:27 +02:00
Mark Bloch
8895a05096 mlx5: Add modify header support to flow rules
(cherry picked from commit 847542c60c2b3d922d636cc36ce51714032f9825)
2023-11-22 03:40:27 +02:00
Mark Bloch
08e7b322db mlx5: Refactor flow actions into a struct
(cherry picked from commit cb054a493a95cbd5a4b00c693c3924622914c51a)
2023-11-22 03:40:27 +02:00
Mark Bloch
87d86f3733 mlx5: Add packet reformat allocation support
(cherry picked from commit bb4645b95b0b3976decb4e68934b2e5cc002c53d)
2023-11-22 03:40:27 +02:00
Mark Bloch
2b729c222d mlx5: Add modify header support
(cherry picked from commit e4f84168b3c8bf99297dda712b147906d463b20e)
2023-11-22 03:40:27 +02:00
Aaron LI
9ed67f1307 if_wg: Missing radix unlock can cause deadlock
In function 'wg_aip_add()', the error path of returning ENOMEM when
(node == NULL) is forgetting to unlock the radix tree, and thus may lead
to a deadlock.

PR:		275001
Reviewed by:	kp
MFC after:	1 week

(cherry picked from commit dcc4d2939f789a6d1f272ffeab2068ba2b7525ea)
2023-11-18 10:46:21 +01:00
Alexander Motin
7ab9e36fc5 nvme: Introduce longer timeouts for admin queue
KIOXIA CD8 SSDs routinely take ~25 seconds to delete non-empty
namespace.  In some cases like hot-plug it takes longer, triggering
timeout and controller resets after just 30 seconds. Linux for many
years has separate 60 seconds timeout for admin queue.  This patch
does the same.  And it is good to be consistent.

Sponsored by:	iXsystems, Inc.
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42454

(cherry picked from commit 8d6c0743e36e3cff9279c40468711a82db98df23)
2023-11-14 07:54:18 -05:00
Mark Johnston
766cceba19 e6000sw: Fix locking in miibus_{read,write}reg implementations
Commit 4692906480 made e6000sw's
implementation of miibus_(read|write)reg assume that the softc lock is
held.  I presume that is to avoid lock recursion in e6000sw_attach() ->
e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG().

However, the lock assertion in e6000sw_readphy_locked() can fail if a
different driver uses the interface to probe registers.  Work around the
problem by providing implementations which lock the softc if it is not
already locked.

PR:		274795
Fixes:		4692906480 ("e6000sw: add readphy and writephy wrappers")
Reviewed by:	kp, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42466

(cherry picked from commit 725962a9f4c050b21488edd58d317e87c76d6f66)
2023-11-13 09:41:50 -05:00
Doug Rabson
61ba094af4 netfront: fix the support for disabling LRO at boot time
The driver has a tunable hw.xn.enable_lro which is intended to control
whether LRO is enabled. This is currently non-functional - even if its
set to zero, the driver still requests LRO support from the backend.
This change fixes the feature so that if enable_lro is set to zero, LRO
no longer appears in the interface capabilities and LRO is not requested
from the backend.

PR:		273046
MFC after:	1 week
Reviewed by:	royger
Differential Revision: https://reviews.freebsd.org/D41439

(cherry picked from commit da4b0d6eb06d730487d48e15d2d5e10c56266fd9)
2023-11-12 10:37:16 +00:00
Yishai Hadas
f521f9c178 mlx5ib: Fix RSS Toeplitz setup to be aligned with the HW specification
The specification for the Toeplitz function doesn't require to set the key
explicitly to be symmetric. In case a symmetric functionality is required
a symmetric key can be simply used.

Wrongly forcing the algorithm to symmetric causes the wrong packet
distribution and a performance degradation.

Link: https://lore.kernel.org/r/20190723065733.4899-7-leon@kernel.org
Fixes: 28d6137008b2 ("IB/mlx5: Add RSS QP support")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Alex Vainman <alexv@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

[khng: cherry-picked from Linux
b7165bd0d6cbb93732559be6ea8774653b204480]

Sponsored by:	Juniper Networks, Inc.
MFC after:      7 days
Reviewed by:	kib, zlei
Differential Revision:	https://reviews.freebsd.org/D42178

(cherry picked from commit 813d981e1e78daffde4b2a05df35d054fcb4343f)
2023-11-04 15:22:18 -04:00
Ka Ho Ng
83dbc1dc8b mlx5ib: Fix ethertype to be ETH_P_IPV6
Sponsored by:	Juniper Networks, Inc.
MFC after:	7 days
Reviewed by:	ae, kib, zlei
Differential Revision:	https://reviews.freebsd.org/D42184

(cherry picked from commit 3b173281764ba7c02f9de0a67caa1c4eca604413)
2023-11-04 15:22:18 -04:00
Zhenlei Huang
1969d82fcf Hyper-V: vmbus: Add NULL check for vmbus_res
QEMU emulates Hyper-V [1] but lacks the emulation for vmbus_res, thus no
coherence information is available. Add NULL check for it and fallback
to no coherence. This will prevent FreeBSD guests from panic on QEMU
with the Hyper-V enlightenment hv-synic enabled.

For real Hyper-V, both gen1 and gen2 have vmbus_res then they are not
affected by this change.

1. https://www.qemu.org/docs/master/system/i386/hyperv.html

PR:		274810
Reviewed by:	mhorne, emaste, delphij, whu
Diagnosed by:	mhorne
Fixes:		e7a9817b8d32 Hyper-V: vmbus: implementat bus_get_dma_tag in vmbus
Insta-MFC approved by:	re (delphij) for 14.0-RC4
Differential Revision:	https://reviews.freebsd.org/D42414

(cherry picked from commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5)
2023-11-02 17:10:03 +08:00
John Baldwin
cb63a64b8c acpi_pcib: Rename decoded_bus_range to get_decoded_bus_range
While here, change the return value to bool.

Discussed by:	gibbs

(cherry picked from commit f6c2774fe415f3b79c551b8075c159d6a7d4d0bf)
2023-10-24 12:19:59 -07:00
John Baldwin
76b37faac8 acpi_pcib: Trust decoded bus range from _CRS over _BBN
Currently if _BBN doesn't match the first bus in the decoded bus range
from _CRS for a Host to PCI bridge, the driver fails to attach as a
defensive measure.

There is now firmware in the field where these do not match, and the
_BBN values are clearly wrong, so rather than failing attach, trust
the range from _CRS over _BBN.

Co-authored-by:	Justin Gibbs <gibbs@FreeBSD.org>
Reported by:	gibbs
Reviewed by:	imp (earlier version)
Differential Revision:	https://reviews.freebsd.org/D42231

(cherry picked from commit 22a6678b627b39ceb94f7323be1010e928d92494)
2023-10-24 12:00:57 -07:00
John Baldwin
bfa1565246 Trim various $FreeBSD$
Approved by:	markj (cddl/contrib changes)
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41961

(cherry picked from commit f53355131f65d64e7643d734dbcd4fb2a5de20ed)
2023-10-24 11:22:23 -07:00
John Baldwin
efb26b3fe6 Update a couple of tools to not embed __FBSDID in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41955

(cherry picked from commit 99159b076a278d1feb0e18ae99fd866c90443893)
2023-10-24 10:09:55 -07:00