Commit Graph

269631 Commits

Author SHA1 Message Date
Rick Macklem
0c276dee03 param.h: Bump __FreeBSD_version for commit f0c9847a6c
Commit f0c9847a6c changed the arguments for VOP_ALLOCATE.
Bump __FreeBSD_version to 1400041.
2021-11-06 13:34:56 -07:00
Rick Macklem
f0c9847a6c vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE
When the NFSv4.2 server does a VOP_ALLOCATE(), it needs
the operation to be done for the RPC's credential and not
td_ucred. It also needs the writing to be done synchronously.

This patch adds "ioflag" and "cred" arguments to VOP_ALLOCATE()
and modifies vop_stdallocate() to use these arguments.

The VOP_ALLOCATE.9 man page will be patched separately.

Reviewed by:	khng, kib
Differential Revision:	https://reviews.freebsd.org/D32865
2021-11-06 13:26:43 -07:00
Andriy Gapon
cc0b35259a rk805: add system poweroff support
On my Rock64 neither EFI nor PSCI shutdown actually power off the board.
RK805 does the job.

Reviewed by:	manu, peterj
Differential Revision:	https://reviews.freebsd.org/D30786
2021-11-06 19:58:43 +02:00
Andriy Gapon
2d1de2d553 rk3328_codec: set output gain to the value found in linux
According to Linux code the new value should correspond to 0dB gain
while the original value corresponded to 6dB gain which may be
uncomfortable for some output types.

MFC after:	1 month
2021-11-06 19:52:00 +02:00
Andriy Gapon
507fdedd83 rk3328_codec: add delays between register writes in the initial setup
MFC after:	1 month
2021-11-06 19:51:50 +02:00
Andriy Gapon
69d202f224 rk3328_codec: bump delays in set_power and set_mute
According to Linux they should be 10 ms, not 10 us.
Also, add a read before the second write in set_power.

MFC after:	1 month
2021-11-06 19:51:44 +02:00
Andriy Gapon
5d1a2edeec rk_i2s: modify GRF_SOC_CON8 only for rk3399
The register definition has nothing to do with, e.g., rk3328.

MFC after:	1 month
2021-11-06 19:51:36 +02:00
Andriy Gapon
8c9bdaf227 rk3328_codec: fix a problem with the enable value
The previous value contained only the mask bit ("twice"),
but not the value bit.

While here, make a couple of lines a little bit prettier.

MFC after:	1 month
2021-11-06 19:51:14 +02:00
Oleksandr Tymoshenko
aa917184a9 add rk3328_codec and rk_i2s from gonzoua/socaudio
Not sure why these haven't been committed with the rest of the SoC Audio
project.  They work sufficiently well for me.

Discussed with:	manu
MFC after:	1 month
2021-11-06 19:47:10 +02:00
Andriy Gapon
24f567bb0e files.arm64: fix sort order for aw_i2s.c 2021-11-06 19:45:49 +02:00
Andriy Gapon
43b031a371 htu21: don't needlessly bother hardware when measurements are not needed
sysctl(8) first queries a sysctl to get a size of its value even if the
sysctl is of a fixed size, e.g. it has an integer type.
Only after that sysctl(8) queries an actual value of the sysctl.

Previosuly the driver would needlessly read a sensor in the first step.

MFC after:	1 week
2021-11-06 19:39:52 +02:00
Andriy Gapon
c01a46d4ac camcontrol: dump received data for MMC command even if it is unknown
For example, EXT_CSD can be read like this:
    # camcontrol mmcsdcmd 2:0:0 -c 8 -a 0 -f 0x35 -l 512
    CMD 8 arg 0 flags 35
    MMCIO: error 0, 00000900 00000000 00000000 00000000
    No command-specific decoder for CMD 8
    0000   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
    0010   39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |9...............|
    ...
    0100   00 00 00 00 00 00 00 00 01 08 00 01 02 02 00 00  |................|
    ...
    01e0   00 00 00 00 00 00 00 00 00 81 c7 00 00 01 03 07  |................|
    01f0   05 00 03 01 3f 3f 01 01 01 00 00 00 00 00 00 00  |....??..........|

MFC after:	2 weeks
2021-11-06 19:25:57 +02:00
Andriy Gapon
a75159eabc htu21: allow configuration via hints on FDT-based systems
On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

MFC after:	1 week
2021-11-06 19:24:44 +02:00
Andriy Gapon
6354154ef5 pcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C
MFC after:	2 weeks
2021-11-06 19:23:27 +02:00
Andriy Gapon
832503063e gpioled: allow the driver to be disabled via fdt 2021-11-06 19:21:05 +02:00
Andriy Gapon
ff6fe29835 driver for MAX44009 I2C illuminance sensor 2021-11-06 19:19:04 +02:00
Andriy Gapon
a60b304697 pcf8591: driver for adc/dac with i2c interface 2021-11-06 19:14:50 +02:00
Wojciech Macek
200bc58953 Revert "ossl: Add support for AES-CBC cipher"
This reverts commit 849faf4e0b.
2021-11-06 17:46:01 +01:00
Wojciech Macek
0dedcdaa1a Revert "ossl: Add support for ETA mode"
This reverts commit 048a71b46e.
2021-11-06 17:45:50 +01:00
Jason A. Harmening
5f73b3338e unionfs: Improve vnode validation
Instead of validating that a vnode belongs to unionfs only when the
caller attempts to extract the upper or lower vnode pointers, do this
validation any time the caller tries to extract a unionfs_node from
the vnode private data.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D32629
2021-11-06 07:08:34 -07:00
Jason A. Harmening
fb273fe70f unionfs: replace zero-length read check with KASSERT
The lower FS VOP_READDIR() shouldn't return an empty read without
setting EOF; don't try to handle this case only for non-DIAGNOSTIC
builds.

Noted by:	kib
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D32629
2021-11-06 07:08:34 -07:00
Jason A. Harmening
66191a76ac unionfs: Improve locking assertions
Add an assertion to unionfs_node_update() that the upper vnode is
exclusively locked; we already make the same assertion for the lower
vnode.
Also, assert in unionfs_noderem() that the vnode lock is not recursed
and acquire v_lock with LK_NOWAIT.  Since v_lock is not the active
lock for the vnode at this point, it should not be contended.
Finally, remove VDIR assertions from unionfs_get_cached_vnode().
lvp/uvp will be referenced but not locked at this point, so v_type
may concurrently change due to vgonel().  The cached unionfs node,
if one exists, would only have made it into the cache if lvp/uvp
were of type VDIR at the time of insertion; the corresponding
VDIR assert in unionfs_ins_cached_vnode() should be safe because
lvp/uvp will be locked by that time and will not be used if either
is doomed.

Noted by:	kib
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D32629
2021-11-06 07:08:33 -07:00
Jason A. Harmening
3ecefc4a61 unionfs: assorted style fixes
No functional change intended, beyond slightly different panic strings

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D32629
2021-11-06 07:08:33 -07:00
Jason A. Harmening
866dd6335a unionfs: various locking fixes
--Clearing cached subdirectories in unionfs_noderem() should be done
  under the vnode interlock

--When preparing to switch the vnode lock in both unionfs_node_update()
  and unionfs_noderem(), the incoming lock should be acquired before
  updating the v_vnlock field to point to it.  Otherwise we effectively
  break the locking contract for a brief window.

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D32629
2021-11-06 07:08:33 -07:00
Wojciech Macek
acdfc09639 lagg: update capabilites on SIOCSIFMTU
Some NICs might have limited capabilities when Jumbo frames are used.
For exampe some neta interfaces only support TX csum offload when the
packet size is lower than a value specified in DT.
Fix it by re-reading capabilities of children interfaces after MTU
has been successfully changed.

Found by: Jerome Tomczyk <jerome.tomczyk@stormshield.eu>
Reviewed by: jhb
Obtained from: Semihalf
Sponsored by: Stormshield
Differential revision: https://reviews.freebsd.org/D32724
2021-11-06 10:43:08 +01:00
Edward Tomasz Napierala
6f397bc0fb linux: Implement linux_to_bsd_regset() on arm64
This will be used by ptrace.

Sponsored By:	EPSRC
2021-11-06 08:35:04 +00:00
Edward Tomasz Napierala
3be6e606d7 linux: Fix another amd64-specific piece of linux_ptrace.c
This was missed in c91d0e59be.  No functional changes.

Sponsored By:	EPSRC
2021-11-06 08:28:11 +00:00
Kornel Duleba
4b843e7f03 mii_fdt: Add support for switch PHY node lookup
Previously we would only search for a PHY xref in node of the miibus
parent.
That didn't work very well with switches.
Fix that by searching through "ports" subnode, checking if any of its
children have a valid PHY xref.
Since switches tend to have multiple ports we also have multiple
candidates.
Use the PHY address read from mii_attach_args to find the right one.

Obtained from: Semihalf
Sponsored by: Alstom Group
Reviewed by: mw
Differential revision: https://reviews.freebsd.org/D32690
2021-11-06 09:08:45 +01:00
Kornel Duleba
463b6ba05a Introduce qoriq_gpio_pic driver
It adds the PIC functionality on top of qoriq_gpio driver.
We need a separate module since the powerpc PIC API is completely
different than on other architectures.

Two types of intr_map_data are supported:
INTR_MAP_DATA_GPIO and INTR_MAP_DATA_FDT.

This way interrupts can be allocated using the userspace gpio
interrupt allocation method, as well as directly from simplebus.
The latter can be used by devices that have its irq routed to a GPIO pin.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-11-06 09:08:45 +01:00
Kornel Duleba
b8b7c0dda9 qoriq_gpio: Add support for driver inheritance
Expose softc and other necessary things in a separate header.
This is needed for an armv8 specific driver, that will inherit from this
one. Driver mutex was converted to a spin lock, so that it can be later
used in interrupt filter context.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32587
2021-11-06 09:08:45 +01:00
Kornel Duleba
048a71b46e ossl: Add support for ETA mode
Now that the AES-CBC is supported we can handle ETA requests.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Reviewed by:		jhb(previous version)
Differential revision:	https://reviews.freebsd.org/D32100
2021-11-06 09:08:44 +01:00
Kornel Duleba
849faf4e0b ossl: Add support for AES-CBC cipher
AES-CBC OpenSSL assembly is used underneath.
The glue layer(ossl_aes.c) is based on CHACHA20 implementation.
Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic
does not have a fallback implementation in case CPU doesn't
support required instructions.
Because of that CPU caps are checked during initialization and AES
support is advertised only if available.
The feature is available on all architectures that ossl supports:
i386, amd64, arm64.

The biggest advantage of this patch over existing solutions
(aesni(4) and armv8crypto(4)) is that it supports SHA,
allowing for ETA operations.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D32099
2021-11-06 09:08:44 +01:00
Alexander Motin
6badb512a9 Prefer CPUID leaf 1Fh for Intel CPU topology detection.
Leaf 1Fh is a prefered extended version of 0Bh.  It is supported by
new Lader Lake CPUs, though does not report anything new so far.

MFC after:	2 weeks
2021-11-06 00:53:52 -04:00
Konstantin Belousov
74aec9618f rtld: style adjustments
Consistently use `return ()'.
Fix some spacing issues with types formatting, and around binary ops.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-06 06:40:18 +02:00
Konstantin Belousov
c5637b8be8 rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag
File descriptor we operate on might reference something that is not a
file, e.g. shmfd.  In this case, we cannot check MNT_NOEXEC in
principle.

If fstatfs(2) caused some failure on normal filesystem, then typical
expectation is that read or mmap of this file would also fail.  If not,
mmap(2) PROT_EXEC on MNT_NOEXEC filesystem returns EACCES.

Reported by:	obiwac@gmail.com
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-06 06:40:17 +02:00
Konstantin Belousov
8363963a8f rtld: fix dangerous_ld_env calculation for ld_dynamic_weak
Default value for ld_dynamic_weak is true, non-default settings should
be activated for the false value.

Reported by:	obiwac@gmail.com
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-11-06 06:40:17 +02:00
Alexander Motin
dc238358f9 Add some of Intel Alder Lake device IDs.
MFC after:	1 week
2021-11-05 23:06:59 -04:00
John Baldwin
e900338c09 Move the ICL_CONN_*LOCK* macros to <dev/iscsi/icl.h>.
These macros are not backend-specific but reference a
backend-independent field in struct icl_conn.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32858
2021-11-05 16:38:25 -07:00
Rick Macklem
f5d5164fb6 nfscl: Fix two more cases for forced dismount
Although I was not able to cause a failure during testing, there
are places in nfscl_removedeleg() and nfscl_renamedeleg() where
I think a forced dismount could get hung.  This patch fixes those.

This patch only affects forced dismount and only if the NFSv4
server is issuing delegations to the client.

Found by code inspection.

MFC after:	2 weeks
2021-11-05 15:33:19 -07:00
Dimitry Andric
e2157cd000 Partially revert ac76bc1145 because it is no longer necessary
In ac76bc1145, I added a few volatiles to work around ctrig_test
failures with {inf,inf}. This is not necessary anymore now, since in
3b00222f15 we added -fp-exception-behavior=maytrap for clang >= 10 in
libm's Makefile. (The flag tells clang to use stricter floating point
semantics, which libm depends on.)

PR:		244732, 254911
Fixes:		ac76bc1145
MFC after:	3 days
2021-11-05 22:27:20 +01:00
Kyle Evans
6a8ea6d174 sched: split sched_ap_entry() out of sched_throw()
sched_throw() can no longer take a NULL thread, APs enter through
sched_ap_entry() instead.  This completely removes branching in the
common case and cleans up both paths.  No functional change intended.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D32829
2021-11-05 15:45:51 -05:00
Warner Losh
15d4459cb2 scsi.4: Document serial numbers
You can wire da, ada and nda device units to serial numbers. sdda cannot
be wired like this because SD and MMC cards lack serial numbers (or at
the very least CAMMMC does not query or retain them).

Sponsored by:		Netflix
Reviewed by:		bcr
Differential Revision:	https://reviews.freebsd.org/D32825
2021-11-05 08:57:05 -06:00
Warner Losh
c688a2eb2f scsi.4: Remove untrue paragraph
Unwired units start with the first avaialble unit that hasn't been
wired, not one greater than the largest wired unit. wired units are
skipped when assigning unwired units a number.

Sponsored by:		Netflix
Reviewed by:		bcr
Differential Revision:	https://reviews.freebsd.org/D32824
2021-11-05 08:56:57 -06:00
Warner Losh
d836c48e71 cam_periph: wired is really a bool, update it to a bool.
Sponsored by:		Netflix
Reviewed by:		scottl
Differential Revision:	https://reviews.freebsd.org/D32823
2021-11-05 08:56:48 -06:00
Warner Losh
bd82711aff cam: Remove trailing spaces from serial numbers too
The SanDisk SD8SB8U1 and likely others pad their serial number with
spaces on the end rather than the start (at least when connected to a
SAS3008). This makes them difficult to wire unit numbers to with the
serial because you have to specify the trailing spaces. Instead, strip
out the trailing spaces.

We already strip leading spaces both here. In addition, when glabel
creates the devfs device nodes, leading and trailing spaces are removed
already (so there will be no change there either).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32684
2021-11-05 08:56:41 -06:00
Warner Losh
577f9aa266 cam_periph: Add ability to wire units to a serial number
For scsi, ata and nvme, at least, we read a serial number from the
device (if the device supports it, some scsi drives do not) and record
it during the *_xpt probe device state machine before it posts the
AC_FOUND_DEVICE async event. For mmc, no serial number is ever
retrieved, so it's always NULL. Add the ability to match this serial
number during device wiring.

This mechanism is competely optional, and often times using a label
and/or some other attribute of the device is easier. However, other
times wiring a unit to a serial number simplifies management as most
monitoring tools require the *daX device and having it stable from boot
to boot helps with data continuity. It can be especially helpful for
nvme where no other means exists to reliably tie a ndaX device to an
underlying nvme drive and namespace.

A similar mechanism exists in Linux to mange device unit numbers with
udev.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32683
2021-11-05 08:56:33 -06:00
Warner Losh
710a519ebb cam_periph: fix bug in camperiphunitnext logic
If we assigned just a lun as a wired unit (something that camperiphunit
will accept), we failed to properly skip over that unit when computing a
next unit number. Add lun so the code matches the comments that we have
to skip all the same criteria that camperiphunit uses to select wired
units for a driver.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32682
2021-11-05 08:56:27 -06:00
Warner Losh
bee0133fb9 cam_periph: switch from negative logic to positive logic
When scanning the resources that are wired for this driver, skip any
that whose number doesn't match newunit. They aren't relevant. Switch to
positive logic to break out of the loop (and thus go to the next unit)
if we find either a target resource or an at resource. This makes the
code easier to read and modify.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32681
2021-11-05 08:56:22 -06:00
Warner Losh
00f79c97a4 cam_periph: Remove vestigial "scbus" comparison
The code in camperiphunit rejects "scbus" as an 'at' location that would
allow any other wiring to use that unit number. Yet in
camperiphunitnext, if we have a no target and the 'at' location of
'scbus' it would be excluded on the basis that it's a wiring
cadidate. This is improper and appears to be a hold-over of the
pre-hints / pre-newbus config system, so remove it.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32680
2021-11-05 08:56:13 -06:00
Warner Losh
517e52b6c2 awk: Move to using two sets of tests
Upstream one-true-awk has two sets of tests. These are in addition to
NetBSD's tests we're using. The 'bugs-fixed' tests from upstream are
ready to use as-is (more or less). However, the 'tests' from upstream
are not, so for now we'll just use the netbsd and bugs-fixed tests.
They provide an OK workout and are better than nothing, though the tests
themselves are for specific esoteric things.

The upstream bugs-fixed tests are *ALMOST* a drop in. However, 3 test
for errors and the upstream test jig mashes stdout and stderr together,
which atf doesn't do, so make a tiny tweak to the upstream tests that I
hope to upstream. Plus upstream has ../a.out: instead of awk: in the
output. Not sure how to deal with this yet, so I've not proposed
anything upstream and have changed the test locally.

In addition, the system-status.awk test is not suitable to run in ATF.
It wants to force sh to dump core, but kyua doesn't seem to allow that
sometimes so the test will fail or pass based on whether or not a core
dump can be created. Since it's unstable, remove it.

This required moving the netbsd tests to a new direcotry, so update
mtree files as well. The change is useless for 'make check' without it.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31376
2021-11-05 08:53:36 -06:00