Commit Graph

42828 Commits

Author SHA1 Message Date
Alexander Motin
87085c12ba Fix SATA NCQ error recovery after 25375b1415
Since that commit ahci(4), siis(4) and mvs(4) drivers ended up
using wrong command to fetch error information for NCQ commands.
Since ATA errors are not very informative to begin with, the only
noticeable effect is a lack of retries on those errors by CAM.

MFC after:	1 week
PR:		279978
2024-06-27 09:29:23 -04:00
Andriy Gapon
a743e280ea rk_i2c: use the register read mode even if the read ends with IIC_M_NOSTOP
Tested with max44009(4).

MFC after:	2 weeks
2024-06-27 13:32:47 +03:00
Andriy Gapon
0deaf4be34 rk_i2c: emulate repeated start
rk_i2c_send_stop is modified so that it sends a stop condition, like it
always did, if there is no IIC_M_NOSTOP flag.
But if the flag is set then the function completely resets the control
register and sets the driver state to transfer completed.
Something like this was previously done for a write with IIC_M_NOSTOP.
Now it is done for a read with IIC_M_NOSTOP as well.

Linux code says that the hardware does not support the repeated start
condition and the documentation, indeed, does not mention it.
But according to the Linux driver clearing the control register and then
sending a start condition acts as if it were a repeated start.

While here, add braces around a single-line 'if' branch to balance it
with a multi-line 'else' branch.

Tested with max44009(4).

MFC after:	2 weeks
2024-06-27 13:32:15 +03:00
Ryan Libby
b195d7498b nvme: avoid gcc -Werror=int-to-pointer-cast on 32-bit arch
Reviewed by:	chuck (previous version), imp
Differential Revision:	https://reviews.freebsd.org/D45750
2024-06-26 20:50:04 -07:00
Mitchell Horne
609cdb12b9 ofw: convert boolean_t to bool
Most of these already treat it as a proper bool, i.e. using true/false.
Also fix-up callers of OF_install().

No functional change intended.

Reviewed by:	andrew, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45733
2024-06-26 11:14:36 -03:00
Doug Moore
7d37fcbf52 cxgbe: replace a loop with rounddown_pow_of_two
Replace a loop with a function call.

Reviewed by:	np, alc
Differential Revision:	https://reviews.freebsd.org/D45716
2024-06-26 03:19:16 -05:00
Mariusz Zaborski
8aa9192ce9 isp: fix ISPCTL_ABORT_CMD switch case
Prevent kernel panic by not running ISPCTL_FCLINK_TEST after a
failed ISPCTL_ABORT_CMD.

Reviewed by:	mav
Tested by:	Arne Steinkamm <arne@steinkamm.com>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45718
2024-06-25 16:56:12 +02:00
Andrew Turner
c36fa8d502 hwpmc/arm64: Support the kernel booting to VHE
When booting to VHE we need to handle using the PMU at either EL1 or
EL2. WE already support EL1 so add support for EL2.

Reviewed by:	mhorne
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45527
2024-06-25 09:07:19 +00:00
Andrew Turner
915161b3d3 hwpmc/arm64: fix the type for pm_arm64_evsel
It holds a 64-bit register, use a uint64_t.

Reviewed by:	mhorne
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45526
2024-06-25 09:07:19 +00:00
Warner Losh
bbecd3148a tpm: Fix acpi attachment
The third arg of the DRIVER_MODULE arg is the driver to use. We want to
use the acpi bus version rather than the generic one. Otherwise, the
ACPI specific probe and attach functions aren't used and we don't see
the device.

Sponsored by:		Netflix
2024-06-24 23:35:30 -06:00
Ed Maste
e6b88237c6 p9fs: use M_WAITOK where appropriate
device_attach routines are allowed to sleep, and this routine already
has other M_WAITOK allocations.

Reported by:	markj
Reviewed by:	markj
Fixes: 1efd69f933 ("p9fs: move NULL check immediately after alloc...")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45721
2024-06-24 22:02:13 -04:00
Kenneth D. Merry
31354813f3 Add an isp(4) tunable to default to ispfw(4) firmware.
ispfw(4) recently gained firmware for Qlogic 27XX and 28XX
FC controllers, and isp(4) now selects the newer of firmware in
flash or in ispfw(4) to load for those controllers.

This differs from the previous behavior (which remains for older
controllers), which was to always load the ispfw(4) firmware if it
is available.

This adds a loader tunable, hint.isp.N.fwload_force to default to
loading the ispfw(4) firmware, whether or not it is newer than the
firmware in flash.  This allows the user to always use the known
firmware version included with the kernel.

Note that there is an existing fwload_disable tunable that tells
the driver to always load the firmware from flash and ignore
ispfw(4).  If fwload_disable is set, fwload_force will be ignored.
So users with existing fwload_disable tunables will have the same
behavior.

If a user specifies both fwload_force and fwload_disable for the
same controller, the isp(4) driver prints a warning message,
and fwload_disable will be honored.

The user can see which firmware is active through the
dev.isp.N.fw_version* sysctl variables.

share/man/man4/isp.4:
	Document the new loader tunable.

sys/dev/isp/isp.c:
	In isp_load_risc_flash(), changet the decision logic to
	also consider ISP_CFG_FWLOAD_ONLY.  Load the flash firmware
	and get the version, so the user knows what it is, but if
	the user set fwload_force, honor that.  If the user didn't
	set fwload_force, the behavior remains to select the newer
	firmware version.

sys/dev/isp/isp_pci.c:
	Add a new fwload_force tunable.  Print out a warning if the
	user sets both fwload_disable and fwload_force.

sys/dev/isp/ispvar.h:
	Add a new ISP_CFG_FWLOAD_FORCE configuration bit.

Reviewed by:	mav
MFC after:	1 week
Sponsored by:	Spectra Logic
Differential Revision:	<https://reviews.freebsd.org/D45688>
2024-06-24 16:47:55 -04:00
Kenneth D. Merry
137b004e2b Fix the isp(4) driver with 9.x firmware.
The isp(4) driver (and ispfw(4) firmware) previously only included
firmware for Qlogic controllers up to 8Gb.  It recently gained
firmware for the 27XX and 28XX series controllers along with
improved firmware loading capabilities.

The 9.x firmware available for the 27XX and 28XX controllers in
ispfw(4) adds login state for NVMe devices in the top nibble of
the login state in the port database (isp_pdb_24xx_t in ispmbox.h).

This breaks the check at the end of isp_getpdb() to make sure the
device is in the right login state.  As a result, it breaks device
discovery for many (perhaps all?) FC devices.  In my testing with
IBM LTO-6 drives attached to a quad port 16Gb Qlogic 2714, they
don't show up when they are directly connected (and in loop mode)
or connected via a switch (and in fabric mode).

So, mask off the top bits of of the login state before checking it.
This shouldn't break anything, because all of the existing login
states defined in ispmbox.h are in the low nibble.

sys/dev/isp/ispmbox.h:
	Add a FCP login state mask define, and a NVMe login state
	shift.

sys/dev/isp/isp.c:
	In isp_getpdb(), make sure we're only looking at the FCP
	login state bits when we try to determine whether a device
	is in the right login state.

MFC after:	1 week
Sponsored by:	Spectra Logic
Reviewed by:	mav
Differential Revision:	<https://reviews.freebsd.org/D45660>
2024-06-24 16:47:55 -04:00
Ed Maste
1efd69f933 p9fs: move NULL check immediately after allocation
Reported by:	Shawn Webb (HardenedBSD)
Reviewed by:	dfr
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45719
2024-06-24 15:36:11 -04:00
Doug Moore
dc048255b3 mlx5: use roundup_pow_of_two
Use roundup_pow_of_two in place of an expression.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:22:52 -05:00
Doug Moore
87177ce3aa irdma: Use round{up,down}_pow_of_two
Use roundup_pow_of_two and rounddown_pow_of_two in place of expressions.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:20:49 -05:00
Doug Moore
5fc42387d7 cxgbe: use order_base_2
Use order_base_2 in place of an expression.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:18:42 -05:00
Doug Moore
7bb73f7315 cxgb: use rounddown_pow_of_two
In two places, use the rounddown_pow_of_two macro in place of expressions.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:17:02 -05:00
Doug Moore
4bbdabc2bd aic7xxx: use rounddown_pow_of_two
Use the roundown_pow_of_two macro in place of an expression.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:14:55 -05:00
Doug Moore
c8b0c33b03 log2: move log2 functions from linuxkpi to libkern
Linux has a header file that defines an ilog2 function and some simple
functions/macros that use it: roundup_pow_of_two, is_power_of_2,
rounddown_pow_of_two, and order_base_2.  This change moves three of
those simple functions (all but is_power_of_2) from linuxkpi to
libkern.  It also deletes a few implementations of these functions
that have previously been copied into code for various device drivers,
so that they can use the libkern version.  The is_power_of_2 macro was
not moved because powerof2 in param.h provides almost the same service
already (except that they disagree about whether 0 is a power of two).

Since the linux definitions of these functions were copied into
FreeBSD 11 years ago, linux has improved them, and this change
provides those improvements.  In particular, a giant table of log
values for evaluating ilog2 for constant values is no longer
necessary.

Reviewed by:	alc, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:00:31 -05:00
Doug Moore
a94ed493b5 dev/mana: replace power2 function
Replace is_power_of_2(length) with power2(length).  When length != 0, as in
this case, they produce the same result.  This will allow an implementation
of is_power_of_two to be dropped.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 01:55:01 -05:00
Baptiste Daroussin
3fdf11fe8f acpi_timer: remove leftovers from Garbage-collect ACPI-safe timer and friends
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D45669
2024-06-21 14:06:26 +02:00
Baptiste Daroussin
2933c05c56 acpi_timer: remove unused variable
the fixes kernel building after 00d061855d
2024-06-21 09:53:42 +02:00
Colin Percival
00d061855d Garbage-collect ACPI-safe timer and friends
In 2001 when the ACPI timer was introduced, it included code to check
for a bug present in some Pentium II and Pentium III chipsets; if the
bug was found to be present, ACPI-safe (which was slower but had a
workaround for the bug) would be used rather than ACPI-fast (which
read the same timer but without the workaround).

In a8b89dff6a (September 2021) I disabled this check by default,
with a loader tunable available to re-enable it; I announced at the
time that it would go away in FreeBSD 15 if I didn't receive any
reports of problems.  I have received no such problems, so this code
is now going away.

The debug.acpi.timer_test loader variable triggered a lengthy (in fact,
infinitely long) test of the ACPI timer and appears to have been
introduced as part of the process of writing the ACPI timer (and the
associated ACPI-safe workaround) in 2001; since we are dropping support
for systems with this ACPI bug, there is no need to keep that test code
either.
2024-06-21 00:19:08 -07:00
Doug Rabson
e97ad33a89 Add an implementation of the 9P filesystem
This is derived from swills@ fork of the Juniper virtfs with many
changes by me including bug fixes, style improvements, clearer layering
and more consistent logging. The filesystem is renamed to p9fs to better
reflect its function and to prevent possible future confusion with
virtio-fs.

Several updates and fixes from Juniper have been integrated into this
version by Val Packett and these contributions along with the original
Juniper authors are credited below.

To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf. The
bhyve virtio-9p device allows access from the guest to files on the host
by mapping a 'sharename' to a host path. It is possible to use p9fs as a
root filesystem by adding this to /boot/loader.conf:

	vfs.root.mountfrom="p9fs:sharename"

for non-root filesystems add something like this to /etc/fstab:

	sharename /mnt p9fs rw 0 0

In both examples, substitute the share name used on the bhyve command
line.

The 9P filesystem protocol relies on stateful file opens which map
protocol-level FIDs to host file descriptors. The FreeBSD vnode
interface doesn't really support this and we use heuristics to guess the
right FID to use for file operations.  This can be confused by privilege
lowering and does not guarantee that the FID created for a given file
open is always used for file operations, even if the calling process is
using the file descriptor from the original open call. Improving this
would involve changes to the vnode interface which is out-of-scope for
this import.

Differential Revision: https://reviews.freebsd.org/D41844
Reviewed by: kib, emaste, dch
MFC after: 3 months
Co-authored-by: Val Packett <val@packett.cool>
Co-authored-by: Ka Ho Ng <kahon@juniper.net>
Co-authored-by: joyu <joyul@juniper.net>
Co-authored-by: Kumara Babu Narayanaswamy <bkumara@juniper.net>
2024-06-19 13:12:04 +01:00
Christos Margiolis
914c2b3314 sound: Remove outdated comment in dsp_oss_engineinfo()
Since we e07f917850 ("sound: Separate implementations for
SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO") support more than
mono/stereo.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D45605
2024-06-18 15:19:16 +02:00
Christos Margiolis
0f878cdfc5 sound: Fix oss_audioinfo's card_number, port_number and legacy_device
Although the docs advise against using them, it doesn't hurt to fill
them out correctly.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45604
2024-06-18 15:19:07 +02:00
Christos Margiolis
8e36d21259 sound: Support oss_audioinfo->cmd
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45603
2024-06-18 15:18:58 +02:00
Shailend Chand
b81cbb1241 gve: Make gve_free_qpls idempotent
This fixes a panic caused by double free.

PR:	kern/279410
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D45489
2024-06-17 23:08:31 -07:00
Kristof Provost
1389314d53 cxgbe: handle vlan PF restrictions
Co-Authored-by:	Navdeep Parhar <np@FreeBSD.org>
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45428
2024-06-17 23:42:08 +02:00
Navdeep Parhar
2d0a012712 cxgbev(4): Pay attention to the VLAN configuration for the VF.
Make sure that the transmit traffic is tagged correctly or else the
firmware will refuse to transmit and will report an ACL violation.

On receive the hardware will make sure that tagged traffic is delivered
to the appropriate VM.  The driver only asserts that the VLAN id that
was extracted from the wire traffic matches the VF's configuration.

All this works when associating a specific VLAN id with a VF.  The
'trunk' setting likely needs more work.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-06-17 10:35:14 -07:00
Navdeep Parhar
4471ff1196 cxgbev(4): Shared code for the VF driver to query a VF's VLAN config.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-06-17 10:29:17 -07:00
Kristof Provost
7deadea2eb mlx5: handle vlan PF restrictions
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45427
2024-06-17 10:50:16 +02:00
Kristof Provost
c57c261790 iovctl: allow vlan restrictions to be passed to the driver
Allow iovctl to create VFs that are restricted to specific VLAN IDs.

Reviewed by:	kib, np
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45402
2024-06-17 10:50:15 +02:00
Navdeep Parhar
ba95b4aea7 cxgbe(4): New knob to limit driver to the specified types of doorbells.
hw.cxgbe.doorbells_allowed="0xf"

The adapter's doorbells bitmap is clipped to the value specified in the
tunable, which is meant for debug and workarounds only.  There is no
change in default behavior.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-06-16 18:54:02 -07:00
Navdeep Parhar
d72db09005 cxgbe(4): Do not issue an L1CFG command from a VF.
It is pointless to attempt an operation that is not permitted.  It spams
the firmware devlog with "insufficient caps" errors that distract from
real errors.

78 2463625358 ERR CORE insufficient caps to process mailbox cmd: pfn 0x0 vfn 0x1; r_caps 0x86 wx_caps 0x82 required r_caps 0x81 w_caps 0x5

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-06-16 18:54:02 -07:00
Navdeep Parhar
d0fdafdb0e cxgbev(4): Use the correct source pf for T6 in the VF driver.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-06-16 18:54:02 -07:00
Mark Johnston
83caa244bc jedec_dimm: Use device_set_descf()
Note that it is ok to use device_get_desc() as one of the format string
parameters because it is set using device_set_desc() (not
device_set_desc_copy()) and so won't be freed when the description is
updated.

No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
89848b3445 mana: Use device_set_desc()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
c704b87ba6 oce: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
2ef1f61df2 cfi: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
76a7917818 superio: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
3f795763e4 hidbus: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
9da1b6dc16 bxe: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
50505c853c bge: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
c0bd6ec3bb bce: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
1794a0a87e liquidio: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
443f33481e msk: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston
eb634b9f4f wbwd: Use device_set_descf()
No functional change intended.
2024-06-16 16:37:26 -04:00
Mark Johnston
48f5a429c9 iicbus: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00