]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoigc: Use hardware routine for PHY reset
Peter Grehan [Mon, 1 Nov 2021 13:35:43 +0000 (23:35 +1000)]
igc: Use hardware routine for PHY reset

Summary:
The previously used software reset routine wasn't sufficient
to reset the PHY if the bootloader hadn't left the device in
an initialized state. This was seen with the onboard igc port
on an 11th-gen Intel NUC.

The software reset isn't used in the Linux driver so all related
code has been removed.

Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card,
and an 11th-gen Intel NUC.

Reported by: woodsb02
Tested by: woodsb02 (NUC)
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Reviewed by: kbowling
Differential Revision: https://reviews.freebsd.org/D32772

2 years agonet tests: basic if_gif(4) test case
Kristof Provost [Thu, 4 Nov 2021 16:15:19 +0000 (17:15 +0100)]
net tests: basic if_gif(4) test case

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32836

2 years agoif_gif: fix vnet shutdown panic
Kristof Provost [Thu, 4 Nov 2021 17:05:58 +0000 (18:05 +0100)]
if_gif: fix vnet shutdown panic

If an if_gif exists and has an address assigned inside a vnet when the
vnet is shut down we failed to clean up the address, leading to a panic
when we ip_destroy() and the V_in_ifaddrhashtbl is not empty.

This happens because of the VNET_SYS(UN)INIT order, which means we
destroy the if_gif interface before the addresses can be purged (and
if_detach() does not remove addresses, it assumes this will be done by
the stack teardown code).

Set subsystem SI_SUB_PSEUDO just like if_bridge so the cleanup
operations happen in the correct order.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32835

2 years agoifconfig.8: Add the missing option -vlanhwcsum
Zhenlei Huang [Mon, 8 Nov 2021 10:10:11 +0000 (11:10 +0100)]
ifconfig.8: Add the missing option -vlanhwcsum

Commit 9b776960c3276c47528435f343b3b6d0143113a8 documented a new option
vlanhwcsum but missed the opposite one -vlanhwcsum.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D32887

2 years agoossl: Add support for ETA mode
Kornel Duleba [Tue, 2 Nov 2021 11:57:20 +0000 (12:57 +0100)]
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
Differential revision: https://reviews.freebsd.org/D32100

2 years agoossl: Add support for AES-CBC cipher
Kornel Duleba [Tue, 2 Nov 2021 11:53:22 +0000 (12:53 +0100)]
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 (previous version)
Differential revision: https://reviews.freebsd.org/D32099

2 years agofind(1): Update date format reference and remove cvs(1) references
Felix Johnson [Mon, 8 Nov 2021 06:14:58 +0000 (01:14 -0500)]
find(1): Update date format reference and remove cvs(1) references

cvs(1) is not installed by default. Change the date format reference to
note that find(1) understands ISO8601 and RFC822 date formats. Also
remove references to cvs(1).

PR: 254894
MFC after: 3 days
Reported by: danielsh@apache.org

2 years agonfsd: Fix the NFSv4 pNFS MDS server for DS NFSERR_NOSPC
Rick Macklem [Sun, 7 Nov 2021 19:43:03 +0000 (11:43 -0800)]
nfsd: Fix the NFSv4 pNFS MDS server for DS NFSERR_NOSPC

If a pNFS server's DS runs out of disk space, it replies
NFSERR_NOSPC to the client doing writing.  For the Linux
client, it then sends a LayoutError RPC to the server to
tell it about the error and keeps retrying, doing repeated
LayoutGet and Write RPCs to the DS.  The Linux client is
"stuck" until disk space on the DS is free'd up.
For a mirrored server configuration, the first mirror that
ran out of space was taken offline.  This does not make
much sense, since the other mirror(s) will run out of space
soon and the fix is a manual cleanup up disk space.

This patch changes the pNFS server to not disable a mirror
for the mirrored case when this occurs.

Further work is needed, since the Linux client expects the
MDS to reply NFSERR_NOSPC to LayoutGets once the DS is out
of space.  Without this further change, the above mentioned
looping occurs.

Found during a recent IEFT NFSv4 working group testing event.

MFC after: 2 weeks

2 years agolibc: add clearenv function
Mariusz Zaborski [Sun, 7 Nov 2021 15:15:28 +0000 (16:15 +0100)]
libc: add clearenv function

The clearenv(3) function allows us to clear all environment
variable in one shot. This may be useful for security programs that
want to control the environment or what variables are passed to new
spawned programs.

Reviewed by: scf, markj (secteam), 0mp (manpages)
Differential Revision: https://reviews.freebsd.org/D28223

2 years agoe1000: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:12:23 +0000 (14:12 +0100)]
e1000: Fix a typo in a source code comment

- s/overwritting/overwriting/

MFC after: 3 days

2 years agoefi(8): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:07:24 +0000 (14:07 +0100)]
efi(8): Fix a typo in a source code comment

- s/writting/writing/

MFC after: 3 days

2 years agousb_audio: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:04:26 +0000 (14:04 +0100)]
usb_audio: Fix a typo in a source code comment

- s/maxium/maximum/

MFC after: 3 days

2 years agolinux: Add ptrace(2) support on arm64
Edward Tomasz Napierala [Sun, 7 Nov 2021 08:22:41 +0000 (08:22 +0000)]
linux: Add ptrace(2) support on arm64

This moves linux_ptrace.c from sys/amd64/linux/ to sys/compat/linux/,
making it possible to use it on architectures other than amd64.
It also enables Linux ptrace(2) on arm64.

Relnotes: yes
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32868

2 years agopowerd(8): Add rc.conf(5) to see also
Felix Johnson [Sun, 7 Nov 2021 02:39:23 +0000 (22:39 -0400)]
powerd(8): Add rc.conf(5) to see also

powerd_flags is mentioned in rc.conf(5) and can be set there and pass to
powerd.

PR: 258320
MFC after: 3 days
Reported by: Michael <michael.hmich@gmail.com>

2 years agoAwk: Add error file
Warner Losh [Sat, 6 Nov 2021 22:24:36 +0000 (16:24 -0600)]
Awk: Add error file

Add the expected output on stderr file.

Sponsored by: Netflix

2 years agoUPDATING: Add entry for commit f0c9847a6c47
Rick Macklem [Sat, 6 Nov 2021 20:40:50 +0000 (13:40 -0700)]
UPDATING: Add entry for commit f0c9847a6c47

2 years agoparam.h: Bump __FreeBSD_version for commit f0c9847a6c47
Rick Macklem [Sat, 6 Nov 2021 20:34:56 +0000 (13:34 -0700)]
param.h: Bump __FreeBSD_version for commit f0c9847a6c47

Commit f0c9847a6c47 changed the arguments for VOP_ALLOCATE.
Bump __FreeBSD_version to 1400041.

2 years agovfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE
Rick Macklem [Sat, 6 Nov 2021 20:26:43 +0000 (13:26 -0700)]
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

2 years agork805: add system poweroff support
Andriy Gapon [Sat, 6 Nov 2021 17:58:43 +0000 (19:58 +0200)]
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

2 years agork3328_codec: set output gain to the value found in linux
Andriy Gapon [Wed, 9 Jun 2021 08:50:55 +0000 (11:50 +0300)]
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

2 years agork3328_codec: add delays between register writes in the initial setup
Andriy Gapon [Wed, 9 Jun 2021 09:10:50 +0000 (12:10 +0300)]
rk3328_codec: add delays between register writes in the initial setup

MFC after: 1 month

2 years agork3328_codec: bump delays in set_power and set_mute
Andriy Gapon [Wed, 9 Jun 2021 08:58:42 +0000 (11:58 +0300)]
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

2 years agork_i2s: modify GRF_SOC_CON8 only for rk3399
Andriy Gapon [Wed, 9 Jun 2021 08:02:36 +0000 (11:02 +0300)]
rk_i2s: modify GRF_SOC_CON8 only for rk3399

The register definition has nothing to do with, e.g., rk3328.

MFC after: 1 month

2 years agork3328_codec: fix a problem with the enable value
Andriy Gapon [Wed, 9 Jun 2021 07:51:00 +0000 (10:51 +0300)]
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

2 years agoadd rk3328_codec and rk_i2s from gonzoua/socaudio
Oleksandr Tymoshenko [Fri, 4 Jun 2021 12:18:06 +0000 (15:18 +0300)]
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

2 years agofiles.arm64: fix sort order for aw_i2s.c
Andriy Gapon [Fri, 24 Sep 2021 17:26:07 +0000 (20:26 +0300)]
files.arm64: fix sort order for aw_i2s.c

2 years agohtu21: don't needlessly bother hardware when measurements are not needed
Andriy Gapon [Sat, 6 Nov 2021 16:47:32 +0000 (18:47 +0200)]
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

2 years agocamcontrol: dump received data for MMC command even if it is unknown
Andriy Gapon [Sat, 6 Nov 2021 10:23:55 +0000 (12:23 +0200)]
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

2 years agohtu21: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:56:12 +0000 (13:56 +0200)]
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

2 years agopcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C
Andriy Gapon [Thu, 1 Oct 2020 09:48:56 +0000 (12:48 +0300)]
pcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C

MFC after: 2 weeks

2 years agogpioled: allow the driver to be disabled via fdt
Andriy Gapon [Fri, 25 Sep 2020 07:32:47 +0000 (10:32 +0300)]
gpioled: allow the driver to be disabled via fdt

2 years agodriver for MAX44009 I2C illuminance sensor
Andriy Gapon [Thu, 20 Aug 2020 08:11:31 +0000 (11:11 +0300)]
driver for MAX44009 I2C illuminance sensor

2 years agopcf8591: driver for adc/dac with i2c interface
Andriy Gapon [Mon, 17 Aug 2020 10:05:11 +0000 (13:05 +0300)]
pcf8591: driver for adc/dac with i2c interface

2 years agoRevert "ossl: Add support for AES-CBC cipher"
Wojciech Macek [Sat, 6 Nov 2021 16:46:01 +0000 (17:46 +0100)]
Revert "ossl: Add support for AES-CBC cipher"

This reverts commit 849faf4e0ba9a8b8f24ff34da93a0fd46c14eda9.

2 years agoRevert "ossl: Add support for ETA mode"
Wojciech Macek [Sat, 6 Nov 2021 16:45:50 +0000 (17:45 +0100)]
Revert "ossl: Add support for ETA mode"

This reverts commit 048a71b46e816de8fb95b553a8ad0e98c0d51e12.

2 years agounionfs: Improve vnode validation
Jason A. Harmening [Thu, 28 Oct 2021 05:37:48 +0000 (22:37 -0700)]
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

2 years agounionfs: replace zero-length read check with KASSERT
Jason A. Harmening [Thu, 28 Oct 2021 05:31:52 +0000 (22:31 -0700)]
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

2 years agounionfs: Improve locking assertions
Jason A. Harmening [Thu, 28 Oct 2021 05:31:16 +0000 (22:31 -0700)]
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

2 years agounionfs: assorted style fixes
Jason A. Harmening [Sun, 24 Oct 2021 20:26:49 +0000 (13:26 -0700)]
unionfs: assorted style fixes

No functional change intended, beyond slightly different panic strings

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D32629

2 years agounionfs: various locking fixes
Jason A. Harmening [Sun, 24 Oct 2021 17:24:18 +0000 (10:24 -0700)]
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

2 years agolagg: update capabilites on SIOCSIFMTU
Wojciech Macek [Sat, 6 Nov 2021 09:41:43 +0000 (10:41 +0100)]
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

2 years agolinux: Implement linux_to_bsd_regset() on arm64
Edward Tomasz Napierala [Sat, 6 Nov 2021 08:35:04 +0000 (08:35 +0000)]
linux: Implement linux_to_bsd_regset() on arm64

This will be used by ptrace.

Sponsored By: EPSRC

2 years agolinux: Fix another amd64-specific piece of linux_ptrace.c
Edward Tomasz Napierala [Sat, 6 Nov 2021 07:56:51 +0000 (07:56 +0000)]
linux: Fix another amd64-specific piece of linux_ptrace.c

This was missed in c91d0e59be1.  No functional changes.

Sponsored By: EPSRC

2 years agomii_fdt: Add support for switch PHY node lookup
Kornel Duleba [Wed, 27 Oct 2021 08:34:17 +0000 (10:34 +0200)]
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

2 years agoIntroduce qoriq_gpio_pic driver
Kornel Duleba [Tue, 2 Nov 2021 10:30:01 +0000 (11:30 +0100)]
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

2 years agoqoriq_gpio: Add support for driver inheritance
Kornel Duleba [Fri, 29 Oct 2021 14:06:35 +0000 (16:06 +0200)]
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

2 years agoossl: Add support for ETA mode
Kornel Duleba [Tue, 2 Nov 2021 11:57:20 +0000 (12:57 +0100)]
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

2 years agoossl: Add support for AES-CBC cipher
Kornel Duleba [Tue, 2 Nov 2021 11:53:22 +0000 (12:53 +0100)]
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

2 years agoPrefer CPUID leaf 1Fh for Intel CPU topology detection.
Alexander Motin [Sat, 6 Nov 2021 04:48:37 +0000 (00:48 -0400)]
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

2 years agortld: style adjustments
Konstantin Belousov [Sat, 6 Nov 2021 03:20:39 +0000 (05:20 +0200)]
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

2 years agortld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag
Konstantin Belousov [Sat, 6 Nov 2021 03:06:34 +0000 (05:06 +0200)]
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

2 years agortld: fix dangerous_ld_env calculation for ld_dynamic_weak
Konstantin Belousov [Sat, 6 Nov 2021 03:00:52 +0000 (05:00 +0200)]
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

2 years agoAdd some of Intel Alder Lake device IDs.
Alexander Motin [Sat, 6 Nov 2021 03:05:15 +0000 (23:05 -0400)]
Add some of Intel Alder Lake device IDs.

MFC after: 1 week

2 years agoMove the ICL_CONN_*LOCK* macros to <dev/iscsi/icl.h>.
John Baldwin [Fri, 5 Nov 2021 23:38:25 +0000 (16:38 -0700)]
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

2 years agonfscl: Fix two more cases for forced dismount
Rick Macklem [Fri, 5 Nov 2021 22:33:19 +0000 (15:33 -0700)]
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

2 years agoPartially revert ac76bc1145dd because it is no longer necessary
Dimitry Andric [Fri, 5 Nov 2021 21:26:16 +0000 (22:26 +0100)]
Partially revert ac76bc1145dd because it is no longer necessary

In ac76bc1145dd, I added a few volatiles to work around ctrig_test
failures with {inf,inf}. This is not necessary anymore now, since in
3b00222f156d 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: ac76bc1145dd
MFC after: 3 days

2 years agosched: split sched_ap_entry() out of sched_throw()
Kyle Evans [Thu, 4 Nov 2021 00:09:56 +0000 (19:09 -0500)]
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

2 years agoscsi.4: Document serial numbers
Warner Losh [Fri, 5 Nov 2021 14:57:05 +0000 (08:57 -0600)]
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

2 years agoscsi.4: Remove untrue paragraph
Warner Losh [Fri, 5 Nov 2021 14:56:57 +0000 (08:56 -0600)]
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

2 years agocam_periph: wired is really a bool, update it to a bool.
Warner Losh [Fri, 5 Nov 2021 14:56:48 +0000 (08:56 -0600)]
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

2 years agocam: Remove trailing spaces from serial numbers too
Warner Losh [Fri, 5 Nov 2021 14:56:41 +0000 (08:56 -0600)]
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

2 years agocam_periph: Add ability to wire units to a serial number
Warner Losh [Fri, 5 Nov 2021 14:56:33 +0000 (08:56 -0600)]
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

2 years agocam_periph: fix bug in camperiphunitnext logic
Warner Losh [Fri, 5 Nov 2021 14:56:27 +0000 (08:56 -0600)]
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

2 years agocam_periph: switch from negative logic to positive logic
Warner Losh [Fri, 5 Nov 2021 14:56:22 +0000 (08:56 -0600)]
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

2 years agocam_periph: Remove vestigial "scbus" comparison
Warner Losh [Fri, 5 Nov 2021 14:56:13 +0000 (08:56 -0600)]
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

2 years agoawk: Move to using two sets of tests
Warner Losh [Thu, 4 Nov 2021 16:09:16 +0000 (10:09 -0600)]
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

2 years agoImplementations of cexpl()
Steve Kargl [Fri, 5 Nov 2021 02:04:01 +0000 (04:04 +0200)]
Implementations of cexpl()

The change implements cexpl() for both ld80 and ld128 architectures.
Testing was done on x86_64 and aarch64 systems.

Along the way sincos[fl]() use an optimization that reduces the argument
to being done one rather than twice.  This optimization actually pointed
to a bug in the ld128 version of sincosl(), which is now fixed.  In
addition, the minmax polynomial coefficients for sincosl() have been
updated.

A concise log of the file-by-file changes follows.

* include/complex.h:
  . Add a prototype for cexpl().

* lib/msun/Makefile:
  . Add s_cexpl.c to the build.
  . Setup a link for cexpl.3 to cexp.3.

* lib/msun/Symbol.map:
  . Expose cexpl symbol in libm shared library.

* lib/msun/ld128/s_cexpl.c:
  * Implementation of cexpl() for 128-bit long double architectures.
    Tested on an aarch64 system.

* lib/msun/ld80/s_cexpl.c:
  * Implementation of cexpl() for Intel 80-bit long double.

* lib/msun/man/cexp.3:
  . Document cexpl().

* lib/msun/man/complex.3:
  . Add a BUGS section about cpow[fl].

* lib/msun/src/s_cexp.c:
  . Include float.h for weak references on 53-bit long double targets.
  . Use sincos() to reduce argument reduction cost.

* lib/msun/src/s_cexpf.c:
  . Use sincosf() to reduce argument reduction cost.

* lib/msun/src/k_sincosl.h:
  . Catch up with the new minmax polynomial coefficients for the kernel for
    the 128-bit cosl() implementation.
  . BUG FIX: *cs was used where *sn should have been.  This means that sinl()
    was no computed correctly when iy != 0.

* lib/msun/src/s_cosl.c:
  . Include fpmath.h to get access to IEEEl2bits.
  . Replace M_PI_4 with pio4,  a 64-bit or 113-bit approximation for pi / 4.

PR: 216862
MFC after: 1 week

2 years agosdhci_fsl_fdt: Provide more accurate clk calculation
Artur Rojek [Fri, 5 Nov 2021 09:17:49 +0000 (10:17 +0100)]
sdhci_fsl_fdt: Provide more accurate clk calculation

SDHCI controllers found in the QorIQ SoCs offer improved accuracy of
the clock frequency selection, compared to the SDHCI standard. Frequency
selection is performed using two divider registers, named prescaler and
divisor, according to the following formula:
frequency = base clock / (prescaler * divisor), where prescaler can be
bypassed (set to 1) and divisor permitted to take odd values.

Rather than depend on clock division precalculated by sdhci core, make
use of this property of the divider registers and achieve frequencies
closer to the ones requested.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32706

2 years agosdhci_fsl_fdt: Add full support for software reset
Artur Rojek [Fri, 5 Nov 2021 09:16:30 +0000 (10:16 +0100)]
sdhci_fsl_fdt: Add full support for software reset

When performing software reset, this controller does not clear all the
required hw registers. In particular, tuning block is left in enabled
state, inhibiting operation of some eMMC cards. The existing solution
was to disable the ability to call SDHCI_RESET_ALL.

As this issue is now better understood, enable the SDHCI_RESET_ALL flag,
provide a custom reset devmethod and clear selected registers by hand.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32705

2 years agosdhci: Provide devmethod for software reset
Artur Rojek [Fri, 5 Nov 2021 09:14:25 +0000 (10:14 +0100)]
sdhci: Provide devmethod for software reset

Some sdhci controllers require custom software reset logic. Accommodate
this need by introducing a new SDHCI_RESET devmethod. Move the existing
reset logic into sdhci_generic_reset and use it as a default for the
aforementioned method.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differeential revision: https://reviews.freebsd.org/D32704

2 years agolibpfct: be consistent with u_int vs. uint
Kristof Provost [Fri, 5 Nov 2021 08:37:56 +0000 (09:37 +0100)]
libpfct: be consistent with u_int vs. uint

Always use uint64_t over u_int64_t, for the sake of consistency.

No functional change.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf tests: basic test for ridentifier
Kristof Provost [Fri, 29 Oct 2021 15:52:59 +0000 (17:52 +0200)]
pf tests: basic test for ridentifier

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32751

2 years agopf: Introduce ridentifier
Kristof Provost [Fri, 29 Oct 2021 15:40:53 +0000 (17:40 +0200)]
pf: Introduce ridentifier

Allow users to set a number on rules which will be exposed as part of
the pflog header.
The intent behind this is to allow users to correlate rules across
updates (remember that pf rules continue to exist and match existing
states, even if they're removed from the active ruleset) and pflog.

Obtained from: pfSense
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32750

2 years agonfscl: Fix NFSv4.1/4.2 pnfs mounts using nconnect
Rick Macklem [Fri, 5 Nov 2021 00:06:34 +0000 (17:06 -0700)]
nfscl: Fix NFSv4.1/4.2 pnfs mounts using nconnect

When a mount with the "pnfs" and "nconnect" options specified
does an I/O operation, it erroneously uses a TCP connection
to the MDS when it is meant to be a DS operation and, as such,
needs to use a TCP connection to the DS.  This patch fixes this.

When the "pnfs" and "nconnect" options are specified for a
NFSv4.1/4.2 mount, there probably should be N connections
established to each DS for I/O RPCs.  This is a fair amount
of work and may be done in a future commit.

This problem was found during a recent IETF NFSv4 working
group testing event.

MFC after: 2 weeks

2 years agoFactor out flags preserved during mbuf demote into a separate define.
Hans Petter Selasky [Thu, 4 Nov 2021 17:48:23 +0000 (18:48 +0100)]
Factor out flags preserved during mbuf demote into a separate define.

This define will later on be used by coming TLS RX hardware offload patches.

No functional change intended.

Reviewed by: jhb@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoUse layer five checksum flags in the mbuf packet header to pass on crypto state.
Hans Petter Selasky [Thu, 4 Nov 2021 17:43:24 +0000 (18:43 +0100)]
Use layer five checksum flags in the mbuf packet header to pass on crypto state.

The mbuf protocol flags get cleared between layers, and also it was discovered
that M_DECRYPTED conflicts with M_HASFCS when receiving ethernet patckets.

Add the proper CSUM_TLS_MASK and CSUM_TLS_DECRYPTED defines, and start using
these instead of M_DECRYPTED inside the TCP LRO code.

This change is needed by coming TLS RX hardware offload support patches.

Suggested by: kib@
Reviewed by: jhb@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoRemove unused ocf_operation structure from stack.
Hans Petter Selasky [Thu, 4 Nov 2021 17:30:57 +0000 (18:30 +0100)]
Remove unused ocf_operation structure from stack.

Reviewed by: jhb@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agossh: enable FIDO/U2F keys
Ed Maste [Thu, 7 Oct 2021 03:31:17 +0000 (23:31 -0400)]
ssh: enable FIDO/U2F keys

Description of FIDO/U2F support (from OpenSSH 8.2 release notes,
https://www.openssh.com/txt/release-8.2):

  This release adds support for FIDO/U2F hardware authenticators to
  OpenSSH. U2F/FIDO are open standards for inexpensive two-factor
  authentication hardware that are widely used for website
  authentication.  In OpenSSH FIDO devices are supported by new public
  key types "ecdsa-sk" and "ed25519-sk", along with corresponding
  certificate types.

  ssh-keygen(1) may be used to generate a FIDO token-backed key, after
  which they may be used much like any other key type supported by
  OpenSSH, so long as the hardware token is attached when the keys are
  used. FIDO tokens also generally require the user explicitly
  authorise operations by touching or tapping them.

  Generating a FIDO key requires the token be attached, and will
  usually require the user tap the token to confirm the operation:

    $ ssh-keygen -t ecdsa-sk -f ~/.ssh/id_ecdsa_sk
    Generating public/private ecdsa-sk key pair.
    You may need to touch your security key to authorize key generation.
    Enter file in which to save the key (/home/djm/.ssh/id_ecdsa_sk):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/djm/.ssh/id_ecdsa_sk
    Your public key has been saved in /home/djm/.ssh/id_ecdsa_sk.pub

  This will yield a public and private key-pair. The private key file
  should be useless to an attacker who does not have access to the
  physical token. After generation, this key may be used like any
  other supported key in OpenSSH and may be listed in authorized_keys,
  added to ssh-agent(1), etc. The only additional stipulation is that
  the FIDO token that the key belongs to must be attached when the key
  is used.

To enable FIDO/U2F support, this change regenerates ssh_namespace.h,
adds ssh-sk-helper, and sets ENABLE_SK_INTERNAL (unless building
WITHOUT_USB).

devd integration is not included in this change, and is under
investigation for the base system.  In the interim the security/u2f-devd
port can be installed to provide appropriate devd rules.

Reviewed by: delphij, kevans
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32509

2 years agoefi: switch boot_services_gone to boot_services_active
Warner Losh [Thu, 4 Nov 2021 15:34:20 +0000 (09:34 -0600)]
efi: switch boot_services_gone to boot_services_active

Turn the presence or absence of boot services into a positive bool (and
change its type to bool). Move declaration to efi.h in the global
variables section.

Sponsored by: Netflix

Reviewed by: tsoome, kib
Differential Revision: https://reviews.freebsd.org/D31814

2 years agoipq4018: add qcom-gcc-ipq4018 and dependencies into the build
Adrian Chadd [Sun, 31 Oct 2021 03:45:17 +0000 (20:45 -0700)]
ipq4018: add qcom-gcc-ipq4018 and dependencies into the build

* add the extres stuff into the build, I'm going to end up leveraging
  all of it

* include the qcom-gcc-ipq4018 driver which currently implements the hwreset
  side of the API.

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

2 years agoipq4018: add initial reset driver support for the clock/reset controller.
Adrian Chadd [Sun, 31 Oct 2021 03:43:27 +0000 (20:43 -0700)]
ipq4018: add initial reset driver support for the clock/reset controller.

This implements the "reset controller" side of the clock/reset controller.
It's a simple array of registers and bits to set.

The register table itself comes from Linux; the rest of the code is a
reimplementation.

It doesn't yet implement or expose the clock side - I have a lot of
reverse engineering to do before that!

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

Obtained from: Linux (registers)

2 years agoipq401x: flip on SMP for the ASUS AC1300
Adrian Chadd [Sat, 30 Oct 2021 04:31:50 +0000 (21:31 -0700)]
ipq401x: flip on SMP for the ASUS AC1300

This actually enables SMP and yes it boots.

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

2 years agoipq401x: add MP core start-up path for the CPU regulator/clock gate used
Adrian Chadd [Sat, 30 Oct 2021 04:27:02 +0000 (21:27 -0700)]
ipq401x: add MP core start-up path for the CPU regulator/clock gate used

This code implements the "kpssv2" flavour of CPU regulator/clock gating
in Linux.  It's used by at least the ipq4018/4019 to power on and off
CPU cores.

This is based on the Linux implementation - the register definitions
and values are from Linux and I've reverse engineered the sequencing
requirements.

The MP bring-up is:

* set cold boot address via an SCM call - this is the address used
  by the bootloader/TZ firmware to jump to when the CPUs boot

* power down the LDO feeding the CPU core and wait for it to settle

* program in the right set of LDO and power tree configuration for
  the CPU regulator to power up the core.  Unfortunately these are
  magic numbers that I've not found documented anywhere.

* (I think) power up the shared L2 cache connect if it isn't.

* Clamp the power into the core down; put the core into reset

* Unclamp the power rail; release reset; and then set the core to boot.

The MP core will then boot the bootloader/TZ firmware and then
will wait until an incoming interrupt kicks it to start @ mpentry.

Tested:

* IPQ4019, 4 CPUs

Release APs
CPU(3) applied BP hardening: not necessary
CPU(1) applied BP hardening: not necessary
CPU(2) applied BP hardening: not necessary

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

2 years agoqcom: add initial SCM legacy API
Adrian Chadd [Sat, 30 Oct 2021 03:34:08 +0000 (20:34 -0700)]
qcom: add initial SCM legacy API

This is a very simple implementation of Qualcomm's SCM API.

It is just the structure/field definitions and the atomic SCM
call which doesn't use the structs yet - it uses the field
definitions inside registers.

I've tested that setting the cold boot address via the atomic
API is fine - Linux does the same thing.  But not all SCM calls
can be done via the legacy API.

This is a reimplementation based on the Linux qualcomm SCM legacy
code and definitions.

Tested:

* Qualcomm IPQ4018 AP, as part of other changes for doing SMP bring-up

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

2 years agoipq4018: add SoC reset and qcom_rnd driver
Adrian Chadd [Thu, 21 Oct 2021 03:08:56 +0000 (20:08 -0700)]
ipq4018: add SoC reset and qcom_rnd driver

Summary:
This is enough to allow this ASUS router to reboot successfully.
I tried the watchdog path and although it fires, it isn't rebooting!
It's just hanging, likely somewhere in TZ.

This is the MVP required to initialise and consume random data from
the QCA PRNG hardware found on the IPQ401x.

Test Plan: * ASUS RT-AC58U router, IPQ4019

Subscribers: imp, andrew

Differential Revision: https://reviews.freebsd.org/D32723

2 years agoqcom_rnd: add initial qualcomm prng driver.
Adrian Chadd [Thu, 21 Oct 2021 03:05:10 +0000 (20:05 -0700)]
qcom_rnd: add initial qualcomm prng driver.

This is the MVP required to initialise and consume random data from
the QCA PRNG hardware found on the IPQ401x.

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

2 years agoipq4018: toggle ps-hold to allow SoC reset
Adrian Chadd [Wed, 20 Oct 2021 05:33:27 +0000 (22:33 -0700)]
ipq4018: toggle ps-hold to allow SoC reset

This is enough to allow this ASUS router to reboot successfully.
I tried the watchdog path and although it fires, it isn't rebooting!
It's just hanging, likely somewhere in TZ.

Tested:

* ASUS RT-AC58U router, IPQ4019

Reviewed by: andrew, manu, imp
Differential Revision: https://reviews.freebsd.org/D32723

2 years agoAdd notes about vt beeping
Warner Losh [Thu, 4 Nov 2021 15:15:38 +0000 (09:15 -0600)]
Add notes about vt beeping

Sponsored by: Netflix

2 years agoAllow kern.ipc.maxsockets to be set to current value without error
Allan Jude [Thu, 4 Nov 2021 12:55:33 +0000 (12:55 +0000)]
Allow kern.ipc.maxsockets to be set to current value without error

Normally setting kern.ipc.maxsockets returns EINVAL if the new value
is not greater than the previous value. This can cause spurious
error messages when sysctl.conf is processed multiple times, or when
automation systems try to ensure the sysctl is set to the correct
value. If the value is unchanged, then just do nothing.

PR: 243532
Reviewed by: markj
MFC after: 3 days
Sponsored by: Modirum MDPay
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D32775

2 years agorelease: Remove unused variables in azure Makefile
Li-Wen Hsu [Thu, 4 Nov 2021 08:42:38 +0000 (16:42 +0800)]
release: Remove unused variables in azure Makefile

Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation

2 years agobeep(1): Initial version of utility to create terminal beep via soundcard.
Hans Petter Selasky [Tue, 26 Oct 2021 17:13:00 +0000 (19:13 +0200)]
beep(1): Initial version of utility to create terminal beep via soundcard.

Reviewed by: imp@, emaste@ and pstef@
Differential Revision: https://reviews.freebsd.org/D32672
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agofsck_msdosfs: truncate directory entry when the head pointer is invalid.
Xin LI [Thu, 4 Nov 2021 05:09:32 +0000 (22:09 -0700)]
fsck_msdosfs: truncate directory entry when the head pointer is invalid.

As far as we know, there is no FAT implementation that supported hard
links, and our msdosfs driver assumed one cluster chain is only
referenced by one directory entry and clears it out when the file is
deleted.  On the other hand, the current code would proceed with
checkchain() when the directory entry's head cluster is a valid numbered
cluster without checking if it was a valid head node of a cluster chain.

So if the cluster do not being a chain (e.g. CLUST_FREE, CLUST_BAD),
or was already referenced by another directory entry, this would
trigger an assertion in check_chain() at a later time.

Fix this by giving the user an option to truncate the directory entry
when the head cluster is an invalid cluster, an visited head node,
or not a head node.

Reported by: NetApp (kevans@)
Reviewed by: kevans, emaste (no objection)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D32699

2 years agoprocfs_doprocfile(): simplify
Konstantin Belousov [Thu, 4 Nov 2021 03:58:06 +0000 (05:58 +0200)]
procfs_doprocfile(): simplify

Now that proc_get_binpath() does not return NULL in fullpath on success,
directly use sbuf_cat() over the value.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoproc_get_binpath(): provide syntaxically correct value for unused NDINIT arg
Konstantin Belousov [Thu, 4 Nov 2021 00:53:21 +0000 (02:53 +0200)]
proc_get_binpath(): provide syntaxically correct value for unused NDINIT arg

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoSIFTR: Fix compilation with -DSIFTR_IPV6
Allan Jude [Thu, 4 Nov 2021 00:31:13 +0000 (00:31 +0000)]
SIFTR: Fix compilation with -DSIFTR_IPV6

A few pieces of the SIFTR code that are behind #ifdef SIFTR_IPV6 have
not been updated as APIs have changed, etc.

Reported by: Alexander Sideropoulos <Alexander.Sideropoulos@netapp.com>
Reviewed by: rscheff, lstewart
Sponsored by: NetApp
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D32698

2 years agossh: move common Makefile boilerplate to a new ssh.mk
Ed Maste [Tue, 2 Nov 2021 18:48:33 +0000 (14:48 -0400)]
ssh: move common Makefile boilerplate to a new ssh.mk

This moves SSHDIR and ssh_namespace.h handling to a common location,
and will simplify future work such as adding U2F support (D32509).

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

2 years agovt: fix git mismerge
Warner Losh [Wed, 3 Nov 2021 22:20:41 +0000 (16:20 -0600)]
vt: fix git mismerge

I made a mistaking in merging the final commits for the devctl changes. This
adds the 'hushed' variable and has the correct dates for the manuals.

Pointy hat to: imp

2 years agovt: fix typo
Warner Losh [Wed, 3 Nov 2021 22:12:55 +0000 (16:12 -0600)]
vt: fix typo

Notifcation -> Notification

2 years agovt: Fix frequency calcuation for bell
Warner Losh [Wed, 3 Nov 2021 21:55:55 +0000 (15:55 -0600)]
vt: Fix frequency calcuation for bell

386BSD provided a MD function sysbeep. This took two arguments (pitch
and period). Pitch was jammed into the PIT's divisor directly (which
means the argument was expected to sound a tone at '1193182 / pitch'
Hz). FreeBSD inherited this interface.

In commit e46598588587 (svn 177642, Mar 26 2008), phk changed this
function to take a tone to sound in hz. He converted all in-tree
instances of 1193182 / hz to just hz (and kept the few misguided folks
that passed hz directly unchanged -- this was part of what motivated the
change). He converted the places where we pre-computed the 8254 divisor
from being pitch to 1193182 / pitch (since that converts the divisor to
the frequency and the interfaces that were exposed to userland exposed
it in these units in places, continuing the tradition inherited from SCO
System V/386 Unix in spots).

In 2009, Ed Shouten was contracted by the FreeBSD Foundation to write /
finish newcons. This work was done in perforce and was imported into
subversion in user/ed/newcons in revision 199072
(https://svnweb.freebsd.org/base?view=revision&revision=199072) which
was later imported into FreeBSD by ray@ (Aleksandr Rybalko).

From that earliest import into svn import to this date, we ring the bell
with:
      sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION);
where VT_BELLPITCH was defined to be 800. This results in a bell
frequency of 1491Hz, more or less today. This is similar to the
frequency that syscons and pcvt used (1493Hz and 1500Hz respectively).
This in turn was inherited from 386BSD, it seems, which used the hard
coded value 0x31b which is 795 -> 1500Hz.

This '800' was intended to be the bell tone (eg 800Hz) and this
interface was one that wasn't converted. The most common terminal prior
to the rise of PCs was the VT100, which had an approximately 800Hz
bell. Ed Shouten has confirmed that the original intent was 800Hz and
changing this was overlooked after the change to -current was made.
This restors that original intent and makes the bell less obnoxious in
the process.

Reviewed by: des, adrian
Differential Revision: https://reviews.freebsd.org/D32594
Sponsored by: Netflix

2 years agovt: Add devctl message for bells
Warner Losh [Wed, 3 Nov 2021 21:55:48 +0000 (15:55 -0600)]
vt: Add devctl message for bells

Generate VT events when the bell beeps. When coupled with disabling the
bell,this allows custom bells to be rung when we'd otherwise beep.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D32656