Commit graph

296624 commits

Author SHA1 Message Date
John Baldwin
4e62c3cafa Remove now-redundant calls to device_delete_child
Deleting a child explicitly before calling bus_generic_detach is now
redundant, so remove those calls and rely on bus_generic_detach to
delete children instead.

Differential Revision:	https://reviews.freebsd.org/D47961
2025-01-02 13:22:35 -05:00
John Baldwin
cf416f56eb Use the new bus_generic_detach directly in place of home-grown versions
Differential Revision:	https://reviews.freebsd.org/D47960
2025-01-02 13:22:20 -05:00
John Baldwin
b196276c20 bus_generic_detach: Delete children after detaching them
This provides better semantics as a standalone DEVMETHOD for
device_attach as bus drivers should remove child devices they created
as part of detach cleanup.  The implementation calls
bus_detach_children() first to permit child devices an opportunity to
veto the detach operation.  If that succeeds, device_delete_children()
is used to delete the child devices.

This requires fixing various drivers that were deleting devices
explicitly (via a device_t pointer cached in the softc) after calling
bus_generic_detach to stop doing that and just rely on
bus_generic_detach to remove child devices.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47959
2025-01-02 13:21:30 -05:00
John Baldwin
28f5e880e8 Use device_delete_children instead of explicit calls to device_delete_child
This is simpler and more robust in the face of potential double-frees
(e.g. if called after bus_generic_detach which will delete devices in
a future commit).

Reviewed by:	manu, imp
Differential Revision:	https://reviews.freebsd.org/D47958
2025-01-02 13:20:21 -05:00
John Baldwin
e9d3857040 Use bus_detach_children instead of bus_generic_detach
These drivers perform additional teardown steps in between detaching
child devices and deleting child devices.

Differential Revision:	https://reviews.freebsd.org/D47957
2025-01-02 13:19:39 -05:00
Ruslan Bukin
9be0058ea0 riscv vmm: virtual timer support.
Add a virtual timer implementation based on SBI Time extension.
This is needed for Eswin EIC7700 SoC which does not include the newer SSTC
extension.

Timer interrupt pending bit (STIP) could not be cleared in the guest system,
so rework interrupts handling: add new "interrupts_pending" field. Use it
for timer interrupt only for now, but later we can extend to store all
pending interrupts (Timer, IPI and External).

With this I'm able to boot FreeBSD (SMP) guest on HiFive Premier P550,
which is the first real hardware with RISC-V 'H'-spec included.

Differential Revision: https://reviews.freebsd.org/D48133
2025-01-02 16:02:39 +00:00
Michael Tuexen
8471791eb6 TCP RACK: simplify condition
It is already known that rsm != NULL, so no need to check for it.

Reviewed by:		rrs
CID:			1523815
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48282
2025-01-02 16:19:30 +01:00
Michael Tuexen
c7e81cc043 TCP BBR: do not log an uninitialized value
Reviewed by:		rrs
CID:			1523789
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48281
2025-01-02 16:17:05 +01:00
Leonid Evdokimov
0749d81343 pf tests: check cleared time when zeroing stats for table addresses
Verify that we reset the cleared time when we zero an address' counters in
a table.

PR:		282877, 282984
Reviewed by:	kp
MFC after:	2 weeks
Signed-off-by:	Leonid Evdokimov <leon@darkk.net.ru>
Differential Revision:	https://reviews.freebsd.org/D48242
2025-01-02 13:34:50 +01:00
Emmanuel Vadot
b2d2a78ad8 Import device-tree files from Linux 6.12 2025-01-02 10:12:13 +01:00
Emmanuel Vadot
cd989bfc73 Import device-tree files from Linux 6.12 2025-01-02 10:11:32 +01:00
Emmanuel Vadot
0e8011faf5 Import device-tree files from Linux 6.11 2025-01-02 10:10:48 +01:00
Emmanuel Vadot
beb6e748a9 Import device-tree files from Linux 6.11 2025-01-02 10:10:08 +01:00
Emmanuel Vadot
7d0873ebb8 Import device-tree files from Linux 6.10 2025-01-02 10:09:19 +01:00
Emmanuel Vadot
a809180891 Import device-tree files from Linux 6.10 2025-01-02 10:07:48 +01:00
Emmanuel Vadot
01950c46b8 Import device-tree files from Linux 6.9 2025-01-02 10:06:22 +01:00
Baptiste Daroussin
4087ffdbce nvi: import version 2.2.1-52c07e8 2025-01-02 10:04:12 +01:00
Baptiste Daroussin
ae7f9696ae nvi: import version 2.2.1-52c07e8 2025-01-02 09:53:44 +01:00
Emmanuel Vadot
e2e0a4ea3f Import device-tree files from Linux 6.9 2025-01-02 08:42:44 +01:00
Kyle Evans
2832af7b4e shar: add a note about the port to the deprecation warning
cy@ was kind enough to preemptively create a port from the version of
this script in base for those that need this exact interface; add a
pointer to it so that interested individuals could start installing it
sooner rather than later.

Noted by:	cy
MFC after:	3 days
2025-01-01 21:18:00 -06:00
Kyle Evans
f68ee0e7a1 shar: add a deprecation notice
The shar(1) program is simple, but the fundamental idea of a sh archive
is risky at best and one that we probably shouldn't be promoting as
prominently as a program in $PATH and a manpage.  Let's deprecate and
remove it, since the same functionality can easily be found in
tar(1) instead.

Reviewed by:	emaste, philip
Reviewed by:	allanjude, brooks, delphij, des, imp, rpokala (previous)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D48130
2025-01-01 20:15:36 -06:00
Kyle Evans
3d0a0dda3a pkg: finish adding the ECC signer and signature type bits
Signature types need to be parsed out of the key/signature information
that we are presented with from the files we download.  We use that to
understand whicher signer we need to dispatch to.

The ECC signer is more-or-less lifted from pkg(8), with some changes to
slim it down for pkg(7).

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D48108
2025-01-01 15:11:24 -06:00
Kyle Evans
2e065d74a5 pkg: add a pkgsign_verify_data callback
This will be used to verify raw payloads, as if signed by pkg-key(8).
It will be used specifically in pkg(7) to verify .pubkeysig as published
by poudriere.

Amend verify_pubsignature() now to use it.  For the RSA signer, we need
to verify using a sha256 of the data instead of the data itself.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D48109
2025-01-01 15:11:23 -06:00
Kyle Evans
2ecfc040a0 pkg: refactor out a pkg_read_fd()
We already have to do this for reading the pubkey, just pull it out for
other uses.  The ECC signer will use this to verify the bootstrap if
the PUBKEY mechanism is used.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D48107
2025-01-01 15:11:23 -06:00
Kyle Evans
5862580ded pkg: abstract rsa out behind a pkgsign API
This mirrors a change we made in pkg(8), and will be used to next add
another signer that does ECC.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D48106
2025-01-01 15:11:23 -06:00
Kyle Evans
2629e90dd0 pkg: pull rsa bits out of pkg.c
We'll eventually add a pkgsign abstraction over these similar to how we do
in pkg(8), but start by isolating these parts.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D48105
2025-01-01 15:11:22 -06:00
Kyle Evans
05427f4639 secure: hook up libecc as libpkgecc
libecc is not intended to be general use, other applications should
really be using openssl.  pkg(7) uses libecc to align with the pkg(8)
project and its goals.  This will be used in the upcoming support for
ECC in pkg(7).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D48117
2025-01-01 15:11:22 -06:00
Kyle Evans
f0865ec990 Add 'crypto/libecc/' from commit '736d663976d1768533badbf06581481d01fade4c'
git-subtree-dir: crypto/libecc
git-subtree-mainline: f59bb61e1e
git-subtree-split: 736d663976
2025-01-01 15:11:18 -06:00
Kyle Evans
f59bb61e1e lib: hook libder up to the build
libder will be used in upcoming ECC support in the pkg(7) bootstrap to
read DER-encoded keys and signatures.

Differential Revision:	https://reviews.freebsd.org/D48116
2025-01-01 15:11:06 -06:00
Kyle Evans
35c0a8c449 Add 'contrib/libder/' from commit '9c40c4de4c33b2ba1124fb752ebea0bebaa6013f'
git-subtree-dir: contrib/libder
git-subtree-mainline: d11904b350
git-subtree-split: 9c40c4de4c
2025-01-01 15:11:02 -06:00
Alan Somers
d11904b350 Fix lib/libc/nss/getgr_test with large numbers of groups
These tests create a linked list with one entry for every group on the
running system.  On a system with about 30,000 groups, the test took 69
seconds to run, and crashed Kyua with the below error:

kyua: E: string or blob too big (sqlite op: sqlite3_bind_blob) (sqlite db: /root/.kyua/store/results.usr_tests.20241231-203317-570235.db).

Fix the test by limiting it to operating on the first 1024 groups.
Apply the same change to getpw_test and getserv_test too, which are
vulnerable to the same problem.

MFC after:	2 weeks
Sponsored by:	ConnectWise
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D48275
2025-01-01 13:23:47 -07:00
Michael Tuexen
3b9da3dcd1 TCP RACK: avoid using uninitialized tot_idle variable
Reviewed by:		rrs
CID:			1540027
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48277
2025-01-01 18:42:00 +01:00
Michael Tuexen
1781324db2 TCP BBR: remove code which is never executed
USEC_2_TICKS() returns at least 1.

Reviewed by:		rrs
CID:			1523775
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D4827
2025-01-01 18:39:23 +01:00
Juraj Lutter
4c0435d919 mac(4): Mention mac_do(4)
Mention also mac_do(4) in the mac(4) manual page.

Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D48255
2025-01-01 14:18:46 +01:00
Mark Johnston
4196f227aa libdtrace: Be less strict when comparing pointer types
If one of two pointers refers to a forward declaration, let the pointers
be compatible so long as the referred types have the same name.
Otherwise we can get spurious errors.

To give a specific example, this can happen when ipfw_nat.ko is loaded
before ipfw.ko and /usr/lib/dtrace/ipfw.d is processed.  Currently,
ipfw_nat.ko does not have a definition for struct inpcb (i.e., none of
its files include in_pcb.h), so in the CTF type graph, struct
ip_fw_args' "inp" member refers to a forward declaration, represented in
CTF with CTF_K_FORWARD.

Then, when libdtrace processes the ipfw_match_info_t translator in
ipfw.d, it decides that the "inp" field assignment is incorrect because
the two pointers are incompatible.  However, there's no harm in allowing
this assignment.  Add some logic to dt_node_is_ptrcompat() to detect
this case and declare the pointers as compatible so long as the name of
the thing they refer to is the same, similar to how any pointer is
compatible with a void *.

Reported by:	marck
Reviewed by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48254
2025-01-01 00:05:03 +00:00
Xin LI
b55baa8139 copyright: Happy New Year 2025 2025-01-01 00:04:28 +00:00
Adrian Chadd
cbc331d153 rtwn: fix builds on non-x86 platforms
The powerpcspe build is spitting out uint64_t != unsigned long, so this
fails.  Comment out the logging for now to unbreak the build.
2024-12-31 14:45:52 -08:00
Adrian Chadd
aa17878371 rtwn: print out the firmware file being loaded
The firmware version isn't enough; different firmware is loaded
for different revisions of a given chip.  So print out the file too;
it'll make handling reports much easier.

Differential Revision:	https://reviews.freebsd.org/D48067
Reviewed by:	emaste
2024-12-31 13:58:17 -08:00
Michael Tuexen
5ec914e06c TCP BBR: fix condition when sending a tail loss probe
Reviewed by:		rrs
CID:			1523793
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48274
2024-12-31 22:03:13 +01:00
Michael Tuexen
0ce13b1d58 TCP RACK: add comment
Indicate that the missing of the break is intentionally.

Reviewed by:		rrs
CID:			1523782
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48273
2024-12-31 21:51:58 +01:00
Joseph Koshy
aac74b708b
libelftc: Fix a typo - FreeBSD's riscv port is little-endian.
This change brings the descriptor for target "elf64-riscv-freebsd"
in line with its documentation.

I missed this somehow when reviewing https://reviews.freebsd.org/D20768.

Reported by: Haowu Ge (on elftoolchain-developers)
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D48271
2024-12-31 19:53:05 +00:00
Adrian Chadd
06b7335701 rtwn: add rtwn_ctl_vhtrate(), some cleanups
* remove the hard-coded ridx values in rate2ridx(), use the RIDX
  defines for CCK/OFDM rates

* Add a placeholder rtwn_ctl_vhtrate() which returns the dot11rate
  control rate to use for the given VHT rate index.  Since net80211
  currently doesn't have any VHT PHY tables, there's no mapping for
  us to leverage so just return OFDM 12M for now.

* Use the new macro to convert rate index to MCS rate

* Add a printf() in rate2ridx if it's passed a HT/VHT rate.

Differential Revision:	https://reviews.freebsd.org/D48098
Reviewed by:	bz
2024-12-31 11:13:26 -08:00
Adrian Chadd
307f9c3515 rtwn: only set INIRATE if we're not doing firmware rate control.
This register (array) controls the initial rate to use for each
MACID.  There's no need to set it if firmware rate control is enabled -
it'll actually be under firmware control (and we can read it back to
see what choices the firmware is making.)

Locally tested:

* RTL8188EU, STA
* RTL8192CU, STA
* RTL8192EU, STA

Differential Revision:	https://reviews.freebsd.org/D48094
Reviewed by:	bz
2024-12-31 11:12:57 -08:00
Adrian Chadd
af2e102c40 rtwn: enable periodic TX reporting support on RTL8188EU NICs.
The RTL8188E firmware doesn't have the "full" offload firmware
rate control.  Instead, the vendor driver has a bunch of logic
in the driver for rate probing and selection.

Part of this is the periodic TX report - which uploads a summary
of multi-rate retries and drops per MAC.  Using it drastically
cuts down on the TX notifications - it's fired from a timer
(defaulting to ~ 1.6 seconds) and is a single receive frame in
the normal bulk RX path.

I've not ported / reimplemented the whole vendor driver rate adaption
code - instead, I'm just using the normal net80211 rate control APIs.
It seems to behave OK - I get 25-30mbit down and 20mbit up using TCP/
speedtest.

Locally tested:

* RTL8188EU, STA mode

Differential Revision:	 https://reviews.freebsd.org/D48088
Reviewed by:	fuz, bz
Obtained from:	https://github.com/lwfinger/rtl8188eu/blob/master/hal/Hal8188ERateAdaptive.c
2024-12-31 11:11:33 -08:00
Adrian Chadd
7ddf19492c rtwn: add support for register IO debugging
Add support to read/write the MAC/PHY registers.

Hide it behind RTWN_DEBUG.

This doesn't cover the RF registers as they require a different
IO path, but I haven't yet debugged the RF paths.

Locally tested:

* RTL8192CU, STA
* RTL8188EU, STA
* RTL8812AU / RTL8821AU, STA

Differential Revision:	https://reviews.freebsd.org/D48084
Reviewed by:	bz
2024-12-31 11:11:07 -08:00
Simon J. Gerraty
203027b2d5 Update libexec/rc/debug.sh and hooks.sh
Use local_works() to test if 'local' actually works for
current shell.
2024-12-31 10:47:06 -08:00
Michael Tuexen
b47dcb4b1f TCP BBR: fix getsockopt() for TCP_BBR_USEDEL_RATE
Actually implement the IPPROTO_TCP-level socket option
TCP_BBR_USEDEL_RATE.

Reviewed by:		rrs
CID:			1523813
CID:			1523814
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48261
2024-12-31 17:29:04 +01:00
Michael Tuexen
4f3a0c7197 TCP RACK: don't use an uninitialized variable
When storing the old beta values in rack_swap_beta_values(),
ensure that the newreno_flags field is initialized appropriately
instead of using an uninitialized value.
Since the stored newreno_flags aren't actually used, this fix
should not have any functional change.

Reviewed by:		rrs
CID:			1523796
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48260
2024-12-31 17:26:04 +01:00
Michael Tuexen
4940584bbf TCP RACK, BBR: cleanup of ctf_process_inbound_raw()
Instead of dealing with ifp == NULL, which should never happen,
assume that this is not true. Use KASSERT to make this clear.
No functional change intended.

Reviewed by:		glebius, rrs
CID:			1523767
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D48258
2024-12-31 17:22:03 +01:00
Zhenlei Huang
81f9d3b11f sys/sys/kernel.h: Remove SI_SUB_DONE
It was not used since 9a7add6d01.

Reviewed by:	mhorne, imp
Fixes:		9a7add6d01 init_main: Switch from sysinit array to SLIST
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47915
2025-01-01 00:01:21 +08:00