Commit graph

288698 commits

Author SHA1 Message Date
Emmanuel Vadot 1f469a9fc4 hwreset: Move reset code in dev/hwreset
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	imp
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43192
2024-01-10 19:20:28 +01:00
Emmanuel Vadot be82b3a0bf clk: Move clock code in dev/clk
We've removed kernel option EXT_RESOURCES almost two years ago.
While it was ok to have some code under a common 'extres' subdirectory
at first, we now have a lot of consumer of it and we made it mandatory
so no need to have it under a cryptic name.

Reviewed by:	mhorne
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43191
2024-01-10 19:20:26 +01:00
Emmanuel Vadot fe75646a02 usb: dwc3: Move driver under a subdirectory
dwc3 is big enough to have its own subdirectory.
While here only make it depend on kernel option dwc3 and rk_dwc3
without any SOC options.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43190
2024-01-10 19:20:24 +01:00
Emmanuel Vadot 77f2224158 clk: Move rockchip driver into the common directory
No need to keep it under sys/arm64/rockchip/clk
It's easier to find which controller we support by looking under one directory.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43189
2024-01-10 19:20:22 +01:00
Emmanuel Vadot e37e8677fe clk: Move allwinner driver into the common directory
No need to keep it under sys/arm/allwinner/clkng
It's easier to find which controller we support by looking under one directory.
It will also be shared with Allwinner RiscV SoC.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43188
2024-01-10 19:20:20 +01:00
Emmanuel Vadot 02e9120893 pwm: Move allwinner driver into the common directory
No need to keep it under sys/arm/allwinner
It's easier to find which controller we support by looking under one directory.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43187
2024-01-10 19:20:19 +01:00
Emmanuel Vadot 2e3507c25e pwm: Move rockchip driver into the common directory
No need to keep it under sys/arm64/rockchip
It's easier to find which controller we support by looking under one directory.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43186
2024-01-10 19:20:17 +01:00
Emmanuel Vadot ec2b0ccdee spibus: Move allwinner driver into the common directory
No need to keep it under sys/arm/allwinner
It's easier to find which controller we support by looking under one directory.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43185
2024-01-10 19:20:15 +01:00
Emmanuel Vadot 994c943a00 spibus: Move rockchip driver into the common directory
No need to keep it under sys/arm64/rockchip
It's easier to find which controller we support by looking under one directory.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
2024-01-10 19:20:13 +01:00
Emmanuel Vadot 3c2b2a28b9 iicbus: Move rockchip driver into the common directory
No need to keep it under sys/arm64/rockchip
It's easier to find which controller we support by looking under one directory.
While here remove the condition on SOC option, device rk_i2c is enough as all
Rockchip SoC that we support have this controller.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D43184
2024-01-10 19:20:10 +01:00
Olivier Certner a1e37beb45
cr_bsd_visible(): Style fixes
Explicitly test for non-zero return codes.

Separate assignment and testing of 'error' in distinct lines.

Reviewed by:            emaste, kib
Approved by:            emaste (mentor)
MFC after:              1 week
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43335
2024-01-10 18:50:19 +01:00
Olivier Certner 6211cd4be3
pthread_attr_get_np(3): Revamp
Fix and more thoroughly describe the attributes object lifecycle.

Also, correct the text about which attributes' values are reported.

Add the ENOMEM error.

While here, rephrase unclear passages, add references and fix the
example's style.

Reviewed by:            kib, emaste
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43330
2024-01-10 18:50:19 +01:00
Olivier Certner aadb4a1b3f
pthread_attr_get_np(): Use malloc(), report ENOMEM, don't tamper on error
Similarly as in the previous commit, using calloc() instead of malloc()
is useless here in the regular case since the subsequent call to
cpuset_getaffinify() is going to completely fill the allocated memory.

However, there is an additional complication.  This function tries to
allocate memory to hold the cpuset if it previously wasn't, and does so
before the thread lock is acquired, which can fail on a bad thread ID.
In this case, it is necessary to deallocate the memory allocated in this
function so that the attributes object appears unmodified to the caller
when an error is returned.  Without this, a subsequent call to
pthread_attr_getaffinity_np() would expose uninitialized memory (not
a security problem per se, since it comes from the same process) instead
of returning a full mask as it would before the failing call to
pthread_attr_get_np().  So the caller would be able to notice a change
in the state of the attributes object even if pthread_attr_get_np()
reported failure, which would be quite surprising.  A similar problem
that could occur on failure of cpuset_setaffinity() has been fixed.

Finally, we shall always report memory allocation failure.  This already
goes for pthread_attr_init(), so, if for nothing else, just be
consistent.

Reviewed by:            emaste, kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43329
2024-01-10 18:50:19 +01:00
Stefan Eßer f4fbc49d20 vendor/bc: upgrade to version 6.7.5
This update fixes a bug that line breaks in printed numbers may not
match the line length set by the user. The value is printed correctly,
just not split as specified in some situations.

(cherry picked from commit 52a5ec1b178fd07651446c7e31b1512794a04dbf)
2024-01-10 17:36:29 +01:00
Stefan Eßer e6857bd4d7 vendor/bc: upgrade to version 6.7.4
Documentation updates only, no functional changes to the software.

(cherry picked from commit a3f3a7b4dc80d577e4c8fc64dfbbb359d2e24228)
2024-01-10 17:35:14 +01:00
Stefan Eßer aa339f1d5d vendor/bc: upgrade to version 6.7.2
This update improves the implementation of the power function p() and
adds 3 new functions to the extended math library: min(), max(), and
i2rand().

(cherry picked from commit 0b4a06ab29a0da80f6cb5c99189054cb8e2f756c)
2024-01-10 17:34:49 +01:00
Yoshihiro Takahashi 1fa4ddcc6d periodic: Fix periodic reports when log files are not compressed.
The modern zcat(1) is capable of handling compressed and uncompressed
text files, so we can simply use zcat command.

PR:		253168
Reviewed by:	delphij
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43357
2024-01-10 20:48:56 +09:00
Martin Matuska f552d7adeb zfs: merge openzfs/zfs@a382e2119
Notable upstream pull request merges:
 #15693 a382e2119 Add Gotify notification support to ZED
 #15732 e78aca3b3 Fix livelist assertions for dedup and cloning
 #15733 7ecaa0758 make zdb_decompress_block check decompression reliably
 #15735 255741fc9 Improve block sizes checks during cloning

Obtained from:	OpenZFS
OpenZFS commit:	a382e21194
2024-01-10 09:18:25 +01:00
Michael Tuexen 13720136fb tcpsso: fix when used without -i option
Since fdb987bebd it is not possible anymore to use inp_next
iterator for bound, but unconnected sockets. This applies
to TCP listening sockets. Therefore the metioned commit broke
tcpsso on listening sockets if the -i option was not used.
Fix this by iterating through all endpoints instead of only
through the bound, but unconnected ones.

Reviewed by:		markj
Fixes:			fdb987bebd ("inpcb: Split PCB hash tables")
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43353
2024-01-10 08:33:09 +01:00
David E. O'Brien dafd0d6855 History for arc4random_*() 2024-01-09 22:09:47 -08:00
Gleb Smirnoff 8338ea1d3c tests/netlink: add minimal test for a group writer
Subscribe a socket for RTNLGRP_IPV4_ROUTE announcements, add & delete
a route and check that announcements came in.
2024-01-09 16:56:51 -08:00
Brooks Davis 13f345cdec powerpc64/SYS.h: implement _SYSCALL_BODY() macro
Add _SYSCALL_BODY() macro which invokes the syscall via _SYCALL() and
calls cerror as required.  Use to implement PSEUDO() and RSYSCALL().

Reviewed by:	jhibbits
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43322
2024-01-09 22:59:29 +00:00
Brooks Davis 8e2c2992da socket_msg_trunc: allocate a large enough buffer
Allocate 9000 bytes to match the largest requsted size.  Add a check to
prevent the list of sizes and buffer size from getting out of sync
again.

Reviewed by:	markj
Found with:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D43340
2024-01-09 22:59:29 +00:00
Marius Strobl f221d35be7 igb(4): Remove disconnected SYSCTL
The global hw.igb.rx_process_limit knob never was adhered to by the
in-tree version of this driver but similar functionality is available
via the device-specific dev.igb.N.iflib.rx_budget.

While at it, remove the - besides initialization of tx_process_limit -
unused {r,t}x_process_limit members.
2024-01-09 23:15:44 +01:00
Marius Strobl 0d6d28ce56 e1000(4): Remove disconnected SYSCTL
The global hw.em.rx_process_limit knob has been replaced by the device-
specific dev.IF.N.iflib.rx_budget along with the conversion to iflib(4).

While at it, remove the - besides initialization of tx_process_limit -
unused {r,t}x_process_limit members.
2024-01-09 23:15:44 +01:00
Navdeep Parhar 9ea86c8f67 cxgbe(4): Use the correct size for the CIM LA on the T6.
The logic analyzer in the T6 CIM block has a different capture size than
previous chips.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-01-09 13:27:00 -08:00
Andrew Gallatin 5cd08d9ecf apei: Mark ReadAckRegister resource as shareable
Work around vendors who use the same address for multiple
ReadAckRegisters in their ACPI HEST table.  This
allows apei to attach cleanly on Ampere Altra servers.
Note the issue is not specific to Ampere, I've run into
it with at least one other vendor (whose server is not
yet released).

Sponsored by: Netflix
Reviewed by: jhb
2024-01-09 16:07:34 -05:00
Gleb Smirnoff 09fa78d438 netlink: fix regression with group writers
Refactoring of argument list to nl_send_one() led to derefercing
wrong union member.  Rename nl_send_one() to a more generic name,
isolate anew nl_send_one() as the callback only for the normal
writer and provide correct argument to nl_send() from nl_send_group().

Fixes:	ff5ad900d2
2024-01-09 13:01:28 -08:00
Robert Wing 0013741108 powerpc_mmu_radix: add leaf page for wired mappings when pmap_enter(psind=1)
This applies the fix to powerpc's pmap as was done in commit aa3bcaad51
and d0941ed9b5 for amd64 and riscv pmaps, respectively.

Reported by:    Jenkins
Reviewed by:	bojan.novkovic_fer.hr, markj
Fixes: e4078494f3
Differential Revision:	https://reviews.freebsd.org/D43339
2024-01-09 11:23:18 -09:00
John Baldwin c6a488511a acpi: Only reserve resources enumerated via _CRS
In particular, don't reserve resources added by drivers via other
means (e.g. acpi_bus_alloc_gas which calls bus_alloc_resource
right after adding the resource).

The intention of reserved resources is to ensure that a resource range
that a bus driver knows is assigned to a device is reserved by the
system even if no driver is attached to the device.  This prevents
other "wildcard" resource requests from conflicting with these
resources.  For ACPI, the only resources the bus driver knows about
for unattached devices are the resources returned from _CRS.  All of
these resources are already reserved now via acpi_reserve_resources
called from acpi_probe_children.

As such, remove the logic from acpi_set_resource to try to reserve
resources when they are set.  This permits RF_SHAREABLE to work with
acpi_bus_alloc_gas without requiring hacks like the current one for
CPU device resources in acpi_set_resource.

Reported by:	gallatin (RF_SHAREABLE not working)
Diagnosed by:	jrtc27
2024-01-09 11:23:10 -08:00
John Baldwin a9b6151206 memdesc: Helper function to construct mbuf chain backed by memdesc buffer
memdesc_alloc_ext_mbufs constructs a chain of external (M_EXT or
M_EXTPG) mbufs backed by a data buffer described by a memory
descriptor.

Since memory descriptors are not an actual buffer just a description
of a buffer, the caller is required to supply a couple of helper
routines to manage allocation of the raw mbufs and associating them
with a reference to the underlying buffer.

Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D42933
2024-01-09 11:09:43 -08:00
John Baldwin 8cb9b68f58 sys: Use mbufq_empty instead of comparing mbufq_len against 0
Reviewed by:	bz, emaste
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43338
2024-01-09 11:00:46 -08:00
John Baldwin 76f405ed63 mbuf: Add mbufq_empty
Complement to the existing mbufq_full

Reviewed by:	bz
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43337
2024-01-09 11:00:19 -08:00
John Baldwin 6977311633 net80211 amdpu: Simplify a few loops that drain an mbufq
These loops already handled a NULL return from mbufq_dequeue when the
queue was empty, so remove a redundant check of mbufq_len before
dequeueing.

Reviewed by:	bz
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43336
2024-01-09 10:59:48 -08:00
John Baldwin 6631e2f9b4 kldxref: Workaround incorrect PT_DYNAMIC in existing powerpc kernels
Existing powerpc kernels include additional sections beyond .dynamic
in the PT_DYNAMIC segment.  Relax the requirement for an exact size
match of the section and segment for PowerPC files as a workaround.

Reported by:	jrtc27
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43123
2024-01-09 10:57:48 -08:00
Michael Gmelin 731704f5ea bsdinstall: Fix installation script splitting
This allows writing setup scripts that contain lines starting with
"#!", e.g., a shebang when creating a shell script using cat:

    #!/bin/sh
    echo "Populate rc.local"
    cat >/etc/rc.local<<EOF
    #!/bin/sh
    echo booted | logger -s -t 'example'
    EOF

Prevent accidentally running a setup script left behind by a
previous invocation of bsdinstall.

Reviewed by:	imp, jrtc27
Differential Revision:	https://reviews.freebsd.org/D43350
2024-01-09 19:14:17 +01:00
gofaster a382e21194
Add Gotify notification support to ZED
This commit adds the zed_notify_gotify() function and hooks it
into zed_notify(). This will allow ZED to send notifications
to a self-hosted Gotify service, which can be received
on a desktop or mobile device. It is configured with ZED_GOTIFY_URL,
ZED_GOTIFY_APPTOKEN and ZED_GOTIFY_PRIORITY variables in zed.rc.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: gofaster <felix.gofaster@gmail.com>
Closes #15693
2024-01-09 09:49:30 -08:00
Alexander Motin e78aca3b33
Fix livelist assertions for dedup and cloning
Two block pointers in livelist pointing to the same location may
be caused not only by dedup, but also by block cloning. We should
not assert D bit set in them.

Two block pointers in livelist pointing to the same location may
have different logical birth time in case of dedup or cloning. We
should assert identical physical birth time instead.

Assert identical physical block size between pointers in addition
to checksum, since that is what checksums are calculated on.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15732
2024-01-09 09:48:40 -08:00
Alexander Motin 255741fc97
Improve block sizes checks during cloning
- Fail if source block is smaller than destination.  We can only
grow blocks, not shrink them.
 - Fail if we do not have full znode range lock.  In that case grow
is not even called.  We should improve zfs_rangelock_cb() somehow
to know when cloning needs to grow the block size unlike write.
 - Fail of we tried to resize, but failed.  There are many reasons
for it to fail that we can not predict at this level, so be ready
for them.  Unlike write, that may proceed after growth failure,
block cloning can't and must return error.

This fixes assertion inside dmu_brt_clone() when it sees different
number of blocks held in destination than it got block pointers.
Builds without ZFS_DEBUG returned EXDEV, so are not affected much.

Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15724 
Closes #15735
2024-01-09 09:46:43 -08:00
Kent Ross 7ecaa07580
make zdb_decompress_block check decompression reliably
This function decompresses to two buffers and then compares them to
check whether the (opaque) decompression process filled the whole
buffer. Previously it began with lbuf uninitialized and lbuf2 filled
with pseudorandom data. This neither guarantees that any bytes not
written by the compressor would be different, nor seems incredibly
sound otherwise!

After these changes, instead of filling one buffer with generated
pseudorandom data we overwrite each buffer with completely different
data. This should remove the possibility of low-probability failures,
as well as make the process simpler and cheaper.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Kent Ross <k@mad.cash>
Closes #15733
2024-01-09 09:13:52 -08:00
Dag-Erling Smørgrav c2356a440d asa: Rewrite to fix line termination issue.
The standard is somewhat unclear, but on the balance, I believe that the
phrase “the rest of the input line” should be interpreted to mean the
rest of the input line including the terminating newline if and only if
there is one.  This means the current implementation is incorrect on two
points:

- First, it suppresses the previous line's newline in the '1' case.

- Second, it unconditionally emits a newline at the end of the output
  for non-empty input, even if the input did not end with a newline.

Resolve this by rewriting the main loop.  Instead of special-casing the
first line and then assuming that every line ends with a newline, we
remember how each line ends and emit that either at the beginning of
the next line or at the end of the file except in the one case ('+')
where the standard explicitly says not to.

While here, try to reduce diff to upstream a little and update their
RCS tag to reflect the fact that while we've diverged significantly
from them, we've incorporated all their changes.  Remove the useless
second RCS tag.

We also update the tests to account for the change in interpretation
of the '1' case and add a test case for unterminated input.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43326
2024-01-09 17:27:15 +01:00
Ruslan Bukin ddf7fbbb57 Intel FPGA: Support programming larger bitfiles.
Issue data claim command after every chunk of data programmed,
so we can reuse the SVC buffer for the next chunk.

Tested on Terasic DE10 Pro.

Sponsored by: UKRI
2024-01-09 14:18:53 +00:00
Olivier Certner 15bb0300ee
libhtr: pthread_attr_setaffinity_np(): Replace calloc() with malloc()
Using calloc() instead of malloc() is useless here since the allocated
memory is to be wholly crushed by the memcpy() call that follows.

Suggested by:           kib
Reviewed by:            emaste, kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D43328
2024-01-09 14:29:26 +01:00
Olivier Certner 4d312aa051
libthr: thr_attr.c: More style and clarity fixes
The change of argument for sizeof() (from a type to an object) is to be
consistent with the change done for the malloc() code just above in the
preceding commit touching this file.

Consider bit flags as integers and test whether they are set with an
explicit comparison with 0.

Use an explicit flag value (PTHREAD_SCOPE_SYSTEM) in place of a variable
that has this value at point of substitution.

All other changes are straightforward.

Suggested by:           kib
Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D43327
2024-01-09 14:29:25 +01:00
Daniel Ebdrup Jensen 45486372ca nfsv4(4): Reflow lines to 80 character limit
In belatedly fixing a mistake made in fbbdfa2b8a, I noticed that igor
and mandoc -Tlint had a few more things to say.

As such, I'm reflowing a few lines and fixing a contraction.

MFC with:	fbbdfa2b8a
2024-01-09 12:14:57 +01:00
Daniel Ebdrup Jensen c925f0720f nfsv4(4): Belatedly bump .Dd
I forgot to do it when making the commit, so hat-tip to asomers@

Reported by:	asomers@
Fixes:		fbbdfa2b8a (nfsv4(4): mention the nfsv4_server_only..)
MFC with:	fbbdfa2b8a
2024-01-09 12:14:56 +01:00
Peter Holm bd9ddbc9cd stress2: Remove useless test scenario 2024-01-09 11:31:05 +01:00
Peter Holm f1bc2f67a3 stress2: Reduce idle time. Remove debug output 2024-01-09 11:28:26 +01:00
Kyle Evans 5d1ecf0b61 build: only inspect the first word of toolchain tools
CC/CXX/CPP/LD may all have arguments supplied in various circumstances,
which break the logic here.  We only need to determine which of these
tools we're expecting to invoke from PATH, which just requires
examination of the first word.  Limit our scope to exactly that.

Patch suggested by:	jrtc27
Reviewed by:		imp, jrtc27
Differential Revision:	https://reviews.freebsd.org/D43372
2024-01-08 22:22:25 -06:00
Kyle Evans cef5e56f3f bhyveload: add CAP_SEEK to our dirfd rights
In the case of hostbase_fd, this is infact a bug fix; we have a seek
callback that the host: filesystem may use in loader, and we really
don't have a good excuse to break it.

bootfd-derived fds will only be used with fdlopen(3) and rtld doesn't
seem to need pread / lseek at all for it today, but there's no reason to
break if it finds a good reason to later.

Suggested by:	markj
2024-01-08 21:08:16 -06:00