]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 months agoExtend description of -p to include interactions with -d and implying -x
Benedict Reuschling [Fri, 6 Oct 2023 14:29:21 +0000 (14:29 +0000)]
Extend description of -p to include interactions with -d and implying -x

PR: 268052
Event: Oslo Hackathon
Differential Revision: https://reviews.freebsd.org/D40595

9 months agoCirrus CI: Only trigger amd64-gcc12 on pull requests
Jose Luis Duran [Fri, 6 Oct 2023 12:13:26 +0000 (12:13 +0000)]
Cirrus CI: Only trigger amd64-gcc12 on pull requests

Since Cirrus Labs is limiting their free usage tier [1], limit gcc CI
runs to pull requests only.

[1]: https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/

9 months agomailmap: Add pstef and val
Mina Galić [Thu, 5 Oct 2023 18:25:30 +0000 (20:25 +0200)]
mailmap: Add pstef and val

normalize pstef@'s Name, as well as Val Packett's.

Reviewed by: pstef, val_packett.cool
Differential Revision: https://reviews.freebsd.org/D41949

9 months agogrowfs: make exit codes more consistent
Mina Galić [Thu, 5 Oct 2023 18:24:53 +0000 (20:24 +0200)]
growfs: make exit codes more consistent

We have overused err(1), so it's hard to distinguish when an error is
very, very serious, and when it's just a user-error, or even harmless.

This patch changes the current behaviour to distinguish between the
following three:

1 for usage errors
2 for recoverable errors
3 or higher for unrecoverable errors

Reviewed by: jilles, pauamma_gundo.com, des
Differential Revision: https://reviews.freebsd.org/D27161

9 months agortw88: re-connect to the build
Bjoern A. Zeeb [Fri, 6 Oct 2023 10:53:07 +0000 (10:53 +0000)]
rtw88: re-connect to the build

This adds the (updated) rtw88 driver back to the build.
Functionality has not been tested (much) so might not currently
work but people offered to test.

Firmware is provided by the wifi-firmware-rtw88-kmod port/package.

This reverts commit 712468443df1130db8f893a5e2ce5c6a8dbf5cde.

9 months agonet80211: pass __func__, __LINE__ also to ieee80211_alloc_node()
Bjoern A. Zeeb [Fri, 6 Oct 2023 10:38:22 +0000 (10:38 +0000)]
net80211: pass __func__, __LINE__ also to ieee80211_alloc_node()

Pass caller information to ieee80211_alloc_node() so that in case
IEEE80211_DEBUG_REFCNT is compiled in we can (better) track references,
in this case the initial ieee80211_node_initref().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agoCorrect the example: use maxproc instead of nonexistent nproc
Benedict Reuschling [Fri, 6 Oct 2023 09:02:30 +0000 (09:02 +0000)]
Correct the example: use maxproc instead of nonexistent nproc

Reported by: dewayne@heuristicsystems.com.au
PR: 272357
Differential Revision: https://reviews.freebsd.org/D40885

9 months agoif_re: add Realtek Killer Ethernet E2600 IDs
Sk Razee [Fri, 6 Oct 2023 06:08:16 +0000 (08:08 +0200)]
if_re: add Realtek Killer Ethernet E2600 IDs

PR: 274292
MFC after: 1 week
Reviewed by: kp
Event: Oslo Hackathon at Modirum

9 months agoConnect mitigations(7) to the build
Ed Maste [Thu, 5 Oct 2023 17:55:36 +0000 (13:55 -0400)]
Connect mitigations(7) to the build

Also add some cross references.

Sponsored by: The FreeBSD Foundation

9 months agoAdd mitigations(7) describing our vulnerability mitigations
Ed Maste [Fri, 8 Sep 2023 17:49:11 +0000 (13:49 -0400)]
Add mitigations(7) describing our vulnerability mitigations

This is an initial take on documenting vulnerability mitigations.

Reviewed by: gbe (earlier)
Sponsored by: The FreeBSD Foundation
Co-authored-by: Olivier Certner <olce.freebsd@certner.fr>
Differential Revision: https://reviews.freebsd.org/D41794

9 months agodwc: if_dwc_aw: Include net/if_media.h
Emmanuel Vadot [Thu, 5 Oct 2023 16:59:56 +0000 (18:59 +0200)]
dwc: if_dwc_aw: Include net/if_media.h

Needed my miivar.h

Fixes: 6b73554e3e9b ("dwc: Do not re-invent phy mode type")

9 months agofusefs: add more readdir tests for misbehaving servers
Alan Somers [Thu, 5 Oct 2023 16:13:05 +0000 (10:13 -0600)]
fusefs: add more readdir tests for misbehaving servers

Inspired by PR 274268

MFC after: 2 weeks
Sponsored by: Axcient

9 months agopf: fix SCTP SDT probe
Kristof Provost [Thu, 5 Oct 2023 14:57:50 +0000 (16:57 +0200)]
pf: fix SCTP SDT probe

We want the return value of pf_test_rule(), i.e. the result of the
evaluation of the new state, not the result of the evaluation of the
original packet/state.

MFC after: 1 week
Sponsored by: Orange Business Services

9 months agobsdconfig: remove even more of the ftp support
Baptiste Daroussin [Thu, 5 Oct 2023 15:37:21 +0000 (17:37 +0200)]
bsdconfig: remove even more of the ftp support

9 months agodwc: Remove if_dwc_mac_type
Emmanuel Vadot [Wed, 4 Oct 2023 19:10:47 +0000 (21:10 +0200)]
dwc: Remove if_dwc_mac_type

This doesn't represent the mac_type but if the DMA engine support
extended descriptors.
Read the HW_FEATURE register to learn if the DMA engine supports it.

No functional changes intended.

9 months agodwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h
Emmanuel Vadot [Wed, 4 Oct 2023 18:21:24 +0000 (20:21 +0200)]
dwc: Move BUS_MODE_DEFAULT_PBL; in if_dwcvar.h

And rename it to DMA_DEFAULT_PBL, this is the default for all (most ?)
dma engine that dwc should support.
While here stop including dwc1000_reg.h in if_dwc.c, we don't need it anymore.

No functional changes intended.

9 months agodwc: Do not re-invent phy mode type
Emmanuel Vadot [Wed, 4 Oct 2023 16:29:11 +0000 (18:29 +0200)]
dwc: Do not re-invent phy mode type

Directly uses the MII_CONTYPE_*

No functional changes intended.

9 months agodwc: Move dma engine configuration to dwc1000_dma.c
Emmanuel Vadot [Wed, 4 Oct 2023 16:19:26 +0000 (18:19 +0200)]
dwc: Move dma engine configuration to dwc1000_dma.c

No functional changes intended.

9 months agodwc: Move the dma reset code in dwc1000_dma.c
Emmanuel Vadot [Wed, 4 Oct 2023 05:55:11 +0000 (07:55 +0200)]
dwc: Move the dma reset code in dwc1000_dma.c

No functional changes intended

9 months agodwc: Setup desc addresses in the dma init function.
Emmanuel Vadot [Tue, 3 Oct 2023 16:46:56 +0000 (18:46 +0200)]
dwc: Setup desc addresses in the dma init function.

9 months agodwc: Move interrupt related code to core and dma file
Emmanuel Vadot [Tue, 3 Oct 2023 16:04:03 +0000 (18:04 +0200)]
dwc: Move interrupt related code to core and dma file

No functional changes intended.

9 months agodwc: Put all DMA related defines in dma1000_dma.c
Emmanuel Vadot [Thu, 28 Sep 2023 20:37:48 +0000 (22:37 +0200)]
dwc: Put all DMA related defines in dma1000_dma.c

No need to polute dwm1000_dma.h now.

No functional changes intended.

9 months agodwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core
Emmanuel Vadot [Thu, 28 Sep 2023 20:36:24 +0000 (22:36 +0200)]
dwc: Move struct dwc_hash_maddr_ctx declaration in dwc1000_core

it's only used there.

No functional change intended.

9 months agodwc: Move the txstart dma part to dwc1000_dma
Emmanuel Vadot [Thu, 28 Sep 2023 20:34:47 +0000 (22:34 +0200)]
dwc: Move the txstart dma part to dwc1000_dma

This is dma related to move it to the dma file.

No functional changes intended.

9 months agodwc: Split core functions
Emmanuel Vadot [Thu, 28 Sep 2023 19:38:36 +0000 (21:38 +0200)]
dwc: Split core functions

Synopsis/Designware controller have multiple version. The version currently
supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit.
In the goal to support all of those in the same base driver start splitting the
core function to a new file.

No functional changes intended.

9 months agodwc: Split dma functions
Emmanuel Vadot [Thu, 28 Sep 2023 18:40:55 +0000 (20:40 +0200)]
dwc: Split dma functions

Synopsis/Designware controller have multiple dma version, the one included
in the driver is the base one. if_awg is one example of a dwc variant that
have another DMA controller. eqos is a newer variant of dwc that have a newer
dma controller.
In the goal to support all of those in the same base driver start splitting the
dma function to a new file.

No functional changes intended.

9 months agodwc: Rename if_dwc.h to dwc1000_reg.h
Emmanuel Vadot [Mon, 25 Sep 2023 17:56:31 +0000 (19:56 +0200)]
dwc: Rename if_dwc.h to dwc1000_reg.h

Synopsis/Designware controller have multiple version. The version currently
supported by dwc(4) is the version 3 and it's usually called 1000 for gigabit.
This file only have definition for the registers of this version so rename it.

No functional changes intended.

9 months agodwc: Drop 'All rights reserved'
Emmanuel Vadot [Tue, 26 Sep 2023 17:26:16 +0000 (19:26 +0200)]
dwc: Drop 'All rights reserved'

Discussed with: br

9 months agodwc: Rewrite clock and reset functions
Emmanuel Vadot [Sat, 23 Sep 2023 16:24:22 +0000 (18:24 +0200)]
dwc: Rewrite clock and reset functions

snps,dwmac have one required clock named stmmaceth and one optional pclk,
correctly handle both in if_dwc, no need to get/enable stmmacseth again
in if_dwc_rk.
It also have one required reset also named stmmaceth and one optional ahb,
correctly handle both.
Rockchip have another optional clock named clk_mac_speed, get it and enable it
if present. Also fix the optional RMII clocks, they were previously wrongly
enabled in RGMII case.

9 months agodwc: Add support for aal
Emmanuel Vadot [Sat, 23 Sep 2023 16:56:26 +0000 (18:56 +0200)]
dwc: Add support for aal

snps,aal is used to indicate that the DMA engine should
use Address-Aligned Beats.

9 months agodwc: Add support for mixed-burst
Emmanuel Vadot [Sat, 23 Sep 2023 16:52:29 +0000 (18:52 +0200)]
dwc: Add support for mixed-burst

snps,mixed-burst is used to indicate that the DMA engine should
use mixed-burst mode.

9 months agodwc: Remove unused GPIO_ACTIVE_LOW define
Emmanuel Vadot [Sat, 23 Sep 2023 16:45:04 +0000 (18:45 +0200)]
dwc: Remove unused GPIO_ACTIVE_LOW define

While here move comment block above the appropriate functions.

9 months agodwc: Rename dwc_reset to dwc_reset_phy
Emmanuel Vadot [Sat, 23 Sep 2023 16:34:19 +0000 (18:34 +0200)]
dwc: Rename dwc_reset to dwc_reset_phy

It only deals with reseting the phy.
While here avoid calling ofw_bus_get_node again and save the node in softc.

9 months agodwc: Move every sub drivers to dev/dwc
Emmanuel Vadot [Sat, 23 Sep 2023 14:38:32 +0000 (16:38 +0200)]
dwc: Move every sub drivers to dev/dwc

It makes it easier to find all the sub drivers and change them if needed.
While here do not gate dwc_rk with soc options, dwc_rk is made for all rockchip
SoCs. Same thing for dwc_socfpga

9 months agobsdconfig: simplify pkg installation and ABI detection
Baptiste Daroussin [Thu, 5 Oct 2023 15:16:31 +0000 (17:16 +0200)]
bsdconfig: simplify pkg installation and ABI detection

9 months agocertctl: Split certificate bundles before processing.
Dag-Erling Smørgrav [Thu, 5 Oct 2023 14:50:01 +0000 (16:50 +0200)]
certctl: Split certificate bundles before processing.

This allows 'certctl rehash' to do the right thing when ca_root_nss is
installed, instead of linking the entire bundle to the hash of the
first certificate it contains.

MFC after: 3 days
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D42087

9 months agocertctl: Clean up.
Dag-Erling Smørgrav [Thu, 5 Oct 2023 14:49:53 +0000 (16:49 +0200)]
certctl: Clean up.

MFC after: 3 days
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D42086

9 months agonet80211: de-inline ieee80211_ref_node()
Bjoern A. Zeeb [Mon, 2 Oct 2023 20:20:14 +0000 (20:20 +0000)]
net80211: de-inline ieee80211_ref_node()

Make ieee80211_ref_node() a macro so we can pass __func__, __LINE__
in for IEEE80211_DEBUG_REFCNT as we do for other refcount related
functions.  Add the appropriate IEEE80211_DPRINTF() call to the
_ieee80211_ref_node() implementation to support wlandebug(8) +node
printf style tracing.
As a plus we can now also use Dtrace fbt on the
_ieee80211_{ref,free}_node() implementations with futher logic,
gathering backtraces, etc. more flexibly.

Sponsored by: The FreeBSD Foundation
X-MFC: never

9 months agoLinuxKPI: 802.11: hide txq debugging behind checks
Bjoern A. Zeeb [Wed, 4 Oct 2023 20:30:00 +0000 (20:30 +0000)]
LinuxKPI: 802.11: hide txq debugging behind checks

Two txq debug messages were left unconditionally.  Hide them behind
ifdef/if() condition checks for selective debugging only.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agortw88: Use RF_CFGCH instead of hard coded 0x18
Bjoern A. Zeeb [Thu, 5 Oct 2023 14:01:48 +0000 (14:01 +0000)]
rtw88: Use RF_CFGCH instead of hard coded 0x18

While debugging some funky register reads of 0xaeaea from RF_CFGCH
resulting in "rtw880: [TXGAPK] unknown channel 234!!" more of these
reads came to my attention hidden by using the register index rather
than the defined value.  Make this more grep-able.

MFC after: 3 days

9 months agonet80211: remove ieee80211_unref_node()
Bjoern A. Zeeb [Mon, 2 Oct 2023 14:30:46 +0000 (14:30 +0000)]
net80211: remove ieee80211_unref_node()

ieee80211_unref_node() was only used in two error cases in
ieee80211_send_nulldata().  There we do not need to guard against
ni pointer reuse after decrementing the refcount of the ni as we
only update the stats and return.

Update the man page and remove the link for the now gone function.

Sponsored by: The FreeBSD Foundation
X-MFC: never
Reviewed by: adrian, emaste
Differential Revision: https://reviews.freebsd.org/D42035

9 months agonetlink: fix accessing freed memory
Bjoern A. Zeeb [Sat, 30 Sep 2023 15:11:57 +0000 (15:11 +0000)]
netlink: fix accessing freed memory

The check for if_addrlen in dump_iface() is not sufficient to determine
if we still have a valid if_addr.  Rather than directly accessing if_addr
check the STAILQ (for the first entry).
This avoids panics when destroying cloned interfaces as experienced with
net80211 wlan ones.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: jhibbits (earlier version), kp
Differential Revision: https://reviews.freebsd.org/D42027

9 months agovfs cache: add 2 more optimizaiton ideas
Mateusz Guzik [Thu, 5 Oct 2023 12:38:32 +0000 (12:38 +0000)]
vfs cache: add 2 more optimizaiton ideas

9 months agovfs cache: denote a known bug in cache_remove_cnp
Mateusz Guzik [Thu, 5 Oct 2023 12:32:29 +0000 (12:32 +0000)]
vfs cache: denote a known bug in cache_remove_cnp

9 months agovfs cache: plug a hypothetical corner case when freeing
Mateusz Guzik [Sat, 23 Sep 2023 02:04:06 +0000 (02:04 +0000)]
vfs cache: plug a hypothetical corner case when freeing

cache_zap_unlocked_bucket is called with a bunch of addresses and
without any locks held, forcing it to revalidate everything from
scratch.

It did not account for a case where the entry is reallocated with
everything the same except for the target vnode.

Should the target use a different lock than the one expected, freeing
would proceed without being properly synchronized.

Note this is almost impossible to happen in practice.

9 months agovfs cache: sanitize debug counters
Mateusz Guzik [Thu, 5 Oct 2023 12:16:18 +0000 (12:16 +0000)]
vfs cache: sanitize debug counters

They are very rarely triggered, so no need for per-cpu distribution.

At the same time the non-cpu ones still should use atomics to not lose
any updates.

9 months agobsdconfig: use working respositories
Baptiste Daroussin [Thu, 5 Oct 2023 12:43:19 +0000 (14:43 +0200)]
bsdconfig: use working respositories

pkg(8) packages have not been published in ftp.freebsd.org, so
remove this option

9 months agobsdconfig: remove support for ftp, pkg does not support it anymore
Baptiste Daroussin [Thu, 5 Oct 2023 12:39:13 +0000 (14:39 +0200)]
bsdconfig: remove support for ftp, pkg does not support it anymore

9 months agofortune: use 115200 in serial example
Ed Maste [Thu, 5 Oct 2023 12:11:46 +0000 (08:11 -0400)]
fortune: use 115200 in serial example

Commit 4722ceb7d53e switched the default serial rate to 115200 bps.
Follow suit in the freebsd-tips fortune example.

Reviewed by: bcr
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41495

9 months agoObsoleteFiles.inc: document the removal of floppy support in bsdconfig
Baptiste Daroussin [Thu, 5 Oct 2023 11:31:26 +0000 (13:31 +0200)]
ObsoleteFiles.inc: document the removal of floppy support in bsdconfig

9 months agobsdconfig: drop support for floppies
Baptiste Daroussin [Thu, 5 Oct 2023 08:37:39 +0000 (10:37 +0200)]
bsdconfig: drop support for floppies

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D42083

9 months agogenl: add a monitor subcommand
Baptiste Daroussin [Thu, 5 Oct 2023 10:51:02 +0000 (12:51 +0200)]
genl: add a monitor subcommand

usage:
$ genl monitor <family> <multicats group>

this subcommand allows to monitor the message from a multicast group
of a given family when received.

If it knows how to parse the messages received it will dump the decoded
version, otherwise it will just inform a new message has been received

So far it only knows how to parse nlctrl notify messages, but the plan
to allow to make the parsing extensible via lua scripts

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

9 months agoif_ovpn tests: fix ra test
Kristof Provost [Thu, 5 Oct 2023 07:41:25 +0000 (09:41 +0200)]
if_ovpn tests: fix ra test

Client one is supposed to be assigend 198.51.100.2, but sometimes it
loses the race and the address ends up assigned to client two. When this
happened one would try to ping itself, which failed because the loopback
interface isn't up.

Ideally we'd generate static address assignments, but that would
complicate the test. Activate loopback interfaces so the test always
passes, and just try to ping both possible addresses.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

9 months agobsdinstall: decouple from the MK_DIALOG option
Baptiste Daroussin [Thu, 5 Oct 2023 07:54:20 +0000 (09:54 +0200)]
bsdinstall: decouple from the MK_DIALOG option

bsdinstall does not depend on libdialog(3) or anything using
libdialog(3) for a while now, it does not need to depend on MK_DIALOG
anymore

9 months agobsdconfig: always build and install
Baptiste Daroussin [Thu, 5 Oct 2023 07:51:16 +0000 (09:51 +0200)]
bsdconfig: always build and install

it does not depend on dialog(1) anymore

9 months agobsdconfig(8): add bsddialog(1) support
Alfonso S. Siciliano [Thu, 5 Oct 2023 07:29:12 +0000 (09:29 +0200)]
bsdconfig(8): add bsddialog(1) support

Add bsddialog(1) to bsdconfig(8). This can be considered an increment not a
replacement, `$DIALOG=dialog' restores dialog(1).

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

9 months agobectl: fix some `mandoc -Tlint` complaints
Kyle Evans [Thu, 5 Oct 2023 02:26:55 +0000 (21:26 -0500)]
bectl: fix some `mandoc -Tlint` complaints

The EXAMPLES mis-comments caused an obnoxious amount of blank space
above SEE ALSO when rendered by mandoc to a terminal.  The missing
termination of .Xo meant the description of -h ran together with the
subcommand synopsis. The other changes were generally ignored tags due
to context that simply don't need to be there.

Provoked by: grahamperrin

9 months agoARC: Remove b_cv from struct l1arc_buf_hdr
Alexander Motin [Wed, 4 Oct 2023 21:45:00 +0000 (17:45 -0400)]
ARC: Remove b_cv from struct l1arc_buf_hdr

Earlier as part of #14123 I've removed one use of b_cv.  This patch
reuses the same approach to remove the other one from much more
rare code path.

This saves 16 bytes of L1 ARC header on FreeBSD (reducing it from
200 to 184 bytes) and seems even more on Linux.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15340

9 months agoTCP: Fix a rack bug that skyzall found which results in a crash.
Randall Stewart [Wed, 4 Oct 2023 19:16:01 +0000 (15:16 -0400)]
TCP: Fix a rack bug that skyzall found which results in a crash.

So when we call the fast_rsm retransmit path, we should always move
snd_nxt back up to snd_max. In fact during ack-processing if snd_nxt
falls behind it should be moved up there as well. Otherwise what
can happen is we have an incorrect mark on snd_nxt and incorrectly
calculate the offset when we go through the  front path (which is
what skzyall was able to do) then when we go to clean up the
send the offset is all wrong and we crash.

Special thanks to Gleb for pointing out the problem and the email
that had the reproducer so I could find the issue.

Reported-by: syzbot+f5061a372f74f021ec02@syzkaller.appspotmail.com
Sponsored by: Netflix Inc

9 months agolinux(4): Fix semid64_ds structure layout
Dmitry Chagin [Wed, 4 Oct 2023 18:21:12 +0000 (21:21 +0300)]
linux(4): Fix semid64_ds structure layout

Unlike x86_64, other 64-bit architectures do not have paddings
for the time fields.

MFC after: 1 week

9 months agolinux(4): Deduplicate SystemV IPC defines from amd64/linux
Dmitry Chagin [Wed, 4 Oct 2023 18:18:45 +0000 (21:18 +0300)]
linux(4): Deduplicate SystemV IPC defines from amd64/linux

MFC after: 1 week

9 months agobhyve: Move the vm_inject_fault() implementation to vmexit.c
Mark Johnston [Wed, 4 Oct 2023 16:29:07 +0000 (12:29 -0400)]
bhyve: Move the vm_inject_fault() implementation to vmexit.c

This function isn't generic and has a different signature on arm64.  No
functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40991

9 months agobhyve: Build the HPET ACPI table on amd64 only
Mark Johnston [Wed, 4 Oct 2023 16:28:28 +0000 (12:28 -0400)]
bhyve: Build the HPET ACPI table on amd64 only

There is no HPET on arm64 and vm_get_hpet_capabilities() is not
implemented there.  Move the vm_get_hpet_capabilities() call into
build_hpet(): I cannot see a downside, and doing so eliminates a global
variable and reduces the amount of code that needs to be conditionally
compiled.  No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40990

9 months agobhyve: Move most early initialization into an MD routine
Mark Johnston [Wed, 4 Oct 2023 16:27:54 +0000 (12:27 -0400)]
bhyve: Move most early initialization into an MD routine

Prior to initializing PCI devices, main() calls a number of
initialization routines, many of which are amd64-specific.  Move this
list of calls to bhyverun_machdep.c.  Similarly, add an MD function to
handle late initialization.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40989

9 months agobhyve: Move vcpu initialization into a MD source file
Mark Johnston [Wed, 4 Oct 2023 16:27:07 +0000 (12:27 -0400)]
bhyve: Move vcpu initialization into a MD source file

- Make handling of x86 config options, like x86.x2apic, conditional to
  amd64.
- Move fbsdrun_set_capabilities() and spinup_vcpu() to a new file,
  bhyverun_machdep.c.  The moved code is all highly x86 specific.

I'm not sure how best to handle the namespace.  I'm using "bhyve_" for
MD functions called from MI code.  We also have "fbsdrun_" for some MI
routines that are typically called from MD code.  The file name is
prefixed by "bhyverun_".

Reviewed by: corvink
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40987

9 months agobhyve: Make gdb support optional
Mark Johnston [Wed, 4 Oct 2023 16:26:36 +0000 (12:26 -0400)]
bhyve: Make gdb support optional

Add a BHYVE_GDB_SUPPORT make variable that can be set by per-arch
makefiles.  When set, BHYVE_GDB is defined and can be used as a
preprocessor predicate.  Use it to guard gdb stub calls in MI code.

The arm64 bhyve port currently does not have a functional gdb stub, but
that's not critical to landing the port, so this mechanism slightly
reduces the friction of adding support for a new platform.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40986

9 months agobhyve: Make most I/O port handling specific to amd64
Mark Johnston [Wed, 4 Oct 2023 16:26:08 +0000 (12:26 -0400)]
bhyve: Make most I/O port handling specific to amd64

- The qemu_fwcfg interface, as implemented, is I/O port-based, but QEMU
  implements an MMIO interface that we'll eventually want to port for
  arm64.
- Retain support for I/O space PCI BARs, simply treat them like MMIO
  BARs for most purposes, similar to what the arm64 kernel does.  Such
  BARs are created by virtio devices.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40741

9 months agobhyve: Conditionally compile framebuffer-related code
Mark Johnston [Wed, 4 Oct 2023 16:25:47 +0000 (12:25 -0400)]
bhyve: Conditionally compile framebuffer-related code

The arm64 port does not implement VGA, so move the device model sources.
Compile framebuffer code only on amd64 for now, but do not move the
sources, as we ought to be able to add support later.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40740

9 months agobhyve: Move legacy PCI interrupt handling under amd64/
Mark Johnston [Wed, 4 Oct 2023 16:25:19 +0000 (12:25 -0400)]
bhyve: Move legacy PCI interrupt handling under amd64/

Specifically, move IO-APIC, LPC and PIRQ routing code under amd64/.

Use ifdefs to conditionally compile related code in other files.  In
particular, legacy PCI interrupt handling is now compiled only on amd64.
This is not too invasive, but suggestions for a more modular approach
would be appreciated.

I am not sure why qemu fwcfg handling is tied to LPC, and I suspect it
should be decoupled.  In this commit I just apply an ifdef hammer, but
we will eventually want fwcfg on arm64 as well.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40739

9 months agobhyve: Compile some device models only on amd64
Mark Johnston [Wed, 4 Oct 2023 16:24:57 +0000 (12:24 -0400)]
bhyve: Compile some device models only on amd64

These models register legacy PCI interrupts, which won't be supported in
the arm64 port.  In principle it should be possible to make these models
work on arm64 with a bit of effort, so don't move the sources to the
amd64 subdirectory.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40738

9 months agobhyve: Move AP startup code to amd64/
Mark Johnston [Wed, 4 Oct 2023 16:24:19 +0000 (12:24 -0400)]
bhyve: Move AP startup code to amd64/

This code is only invoked via MD vmexit handlers.  No functional change
intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40737

9 months agobhyve: Move the gvt-d driver to amd64/
Mark Johnston [Wed, 4 Oct 2023 16:24:04 +0000 (12:24 -0400)]
bhyve: Move the gvt-d driver to amd64/

It is amd64-only.  No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40736

9 months agobhyve: Move power management code to amd64/
Mark Johnston [Wed, 4 Oct 2023 16:23:50 +0000 (12:23 -0400)]
bhyve: Move power management code to amd64/

This implements various x86-specific interfaces.  No functional change
intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40735

9 months agobhyve: Move the RTC driver to amd64/
Mark Johnston [Wed, 4 Oct 2023 16:23:36 +0000 (12:23 -0400)]
bhyve: Move the RTC driver to amd64/

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40734

9 months agobhyve: Move MSR emulation into amd64/
Mark Johnston [Wed, 4 Oct 2023 16:23:22 +0000 (12:23 -0400)]
bhyve: Move MSR emulation into amd64/

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40733

9 months agobhyve: Remove some unneeded includes from snapshot.c
Mark Johnston [Wed, 4 Oct 2023 16:23:07 +0000 (12:23 -0400)]
bhyve: Remove some unneeded includes from snapshot.c

MFC after: 1 week
Sponsored by: Innovate UK

9 months agobhyve: Split vmexit handling into a separate file
Mark Johnston [Wed, 4 Oct 2023 16:22:56 +0000 (12:22 -0400)]
bhyve: Split vmexit handling into a separate file

Put it in amd64, since most of it is MD and won't be used on arm64.  Add
a bit of glue to bhyverun.h to make CPU startup and shutdown work
without having to export more global variables.  AP startup will be
reworked further in a future revision.

This makes bhyverun.c much more machine-independent.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40556

9 months agobhyve: Move kernemu to amd64/
Mark Johnston [Wed, 4 Oct 2023 16:22:41 +0000 (12:22 -0400)]
bhyve: Move kernemu to amd64/

This code handles instruction emulation for accesses to various
amd64-specific MMIO regions.

No functional change intended.

Reviewed by: corvink, jhb, emaste
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40554

9 months agobhyve: Move more amd64-specific code under amd64/
Mark Johnston [Wed, 4 Oct 2023 16:21:20 +0000 (12:21 -0400)]
bhyve: Move more amd64-specific code under amd64/

mptable and the e820 are both rather amd64-specific and can be moved
easily.

In the case of e820, move the registration with qemu_fwcfg into e820.c,
as it simplifies bhyverun.c a bit and I can't see any downsides.

No functional change intended.

Reviewed by: corvink, jhb, emaste
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40552

9 months agobhyve: Move some more amd64-specific drivers to their own subdir
Mark Johnston [Wed, 4 Oct 2023 16:20:57 +0000 (12:20 -0400)]
bhyve: Move some more amd64-specific drivers to their own subdir

No functional change intended.

Reviewed by: corvink, jhb, emaste
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40551

9 months agobhyve: Start moving machine-dependent code into subdirectories
Mark Johnston [Wed, 4 Oct 2023 16:20:37 +0000 (12:20 -0400)]
bhyve: Start moving machine-dependent code into subdirectories

In preparation for an arm64 port, make an easy change which puts some
machine-dependent code in its own directory.

Going forward, code which is only used on one platform should live in a
MD directory.  We should strive to layer modules in such a way as to
avoid polluting shared code with lots of ifdefs.  For some existing
files this will take some effort.

task_switch.c and fwctl.c are an easy place to start: the former is very
x86-specific, and the latter provides an I/O port interface which can't
be used on anything other than x86.  (fwcfg as implemented has the same
problem, but QEMU also supports a MMIO fwcfg interface.)  So I propose
that we start by simply making those files conditional.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40501

9 months agobhyve: Improve pcifd function naming
Mark Johnston [Wed, 4 Oct 2023 16:19:58 +0000 (12:19 -0400)]
bhyve: Improve pcifd function naming

read_config() and write_config() are externally visible, so give them
more descriptive names.  No functional change intended.

MFC after: 1 week
Sponsored by: Innovate UK

9 months agomailmap: Fixup a few github nouser emails
Warner Losh [Wed, 4 Oct 2023 16:15:27 +0000 (10:15 -0600)]
mailmap: Fixup a few github nouser emails

Fixup a couple foo@user.noreply.github.com email addresses based other
information (either known FreeBSD user, known other commits with the
correct name, etc)

9 months agobsddialog: import version 1.0
Baptiste Daroussin [Wed, 4 Oct 2023 16:11:36 +0000 (18:11 +0200)]
bsddialog: import version 1.0

9 months agomount.8: Mention tarfs(5)
Jose Luis Duran [Wed, 4 Oct 2023 15:42:40 +0000 (15:42 +0000)]
mount.8: Mention tarfs(5)

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/856

9 months agobsddialog: Import version 1.0
Baptiste Daroussin [Wed, 4 Oct 2023 15:43:22 +0000 (17:43 +0200)]
bsddialog: Import version 1.0

9 months agoaxge: Add support for AX88179A
Damien Broka [Tue, 19 Sep 2023 16:26:06 +0000 (17:26 +0100)]
axge: Add support for AX88179A

The AX88179A has two firmware modes, one of which is backward
compatible with existing AX88178A/179 driver. The active firmware mode
can be controlled through a register.

Update axge(4) man page to mention 179A support and ensure that, when
bound to a AX88179A, the driver activates the compatible firmware mode.

Reviewed by: markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/854
MFC after: 1 week

9 months agofreebsd-update: add a note about when files may be deleted
Ed Maste [Fri, 29 Sep 2023 15:47:41 +0000 (11:47 -0400)]
freebsd-update: add a note about when files may be deleted

Files under /var/db/freebsd-update are required during the upgrade
process, and to support rollback.  They may be deleted if no upgrade is
in progress and rollback will not be required.

PR: 273601
Reviewed by: bcr
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42022

9 months agozfs: merge openzfs/zfs@f795e90a1
Martin Matuska [Wed, 4 Oct 2023 12:02:37 +0000 (14:02 +0200)]
zfs: merge openzfs/zfs@f795e90a1

Notable upstream pull request merges:
 #15322 4e16964e1 Add '-u' - nomount flag for zfs set
 #15331 fe4d055b3 Report ashift of L2ARC devices in zdb
 #15333 249d759ca Fix invalid pointer access in trace_dbuf.h
 #15339 f795e90a1 Add BTI landing pads to the AArch64 SHA2 assembly

Obtained from: OpenZFS
OpenZFS commit: f795e90a11c683d64bacc260fb7feab705b220b1

9 months agoVendor import of OpenSSH 9.5p1
Ed Maste [Wed, 4 Oct 2023 12:06:41 +0000 (08:06 -0400)]
Vendor import of OpenSSH 9.5p1

9 months agoLinuxKPI: remove dummy headers with implementations
Bjoern A. Zeeb [Wed, 4 Oct 2023 10:17:21 +0000 (10:17 +0000)]
LinuxKPI: remove dummy headers with implementations

Both agp_backend.h and utsname.h have an implementation in common/
these days so the dummy headers are no longer needed.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agopf: cope with missing rpool.cur
Kristof Provost [Tue, 3 Oct 2023 15:11:44 +0000 (17:11 +0200)]
pf: cope with missing rpool.cur

If we're evaluating a pfsync'd state (and have different rules on both
ends) our state may point to the default rule, which does not have
rpool.cur set. As a result we can end up dereferencing a NULL pointer.

Explicitly check for this when we try to re-construct the route-to interface.

Also add a test case which can trigger this issue.

MFC after: 3 days
See also: https://redmine.pfsense.org/issues/14804
Sponsored by: Rubicon Communications, LLC ("Netgate")

9 months agoAdd BTI landing pads to the AArch64 SHA2 assembly
Andrew Turner [Tue, 3 Oct 2023 22:12:36 +0000 (23:12 +0100)]
Add BTI landing pads to the AArch64 SHA2 assembly

The Arm Branch Target Identification (BTI) extension guards against
branching to an unintended instruction.

To support BTI add the landing pad instructions to the SHA2 functions.
These are from the hint space so are a nop on hardware that lacks BTI
support or if BTI isn't enabled.

Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Andrew Turner <andrew.turner4@arm.com>
Closes #14862
Closes #15339

9 months agoLinuxKPI: 802.11: fix re-creation of VAP
Bjoern A. Zeeb [Tue, 3 Oct 2023 21:14:55 +0000 (21:14 +0000)]
LinuxKPI: 802.11: fix re-creation of VAP

After dbf7691999abe (as indicated in that commit message) EEXISTS
errors may be seen.  From current investigation that is due to the
single-VAP support in LinuxKPI 802.11 and the related calls to
mo_start() and mo_stop() and them being disabled in ic_parent()
currently.  Calling mo_stop() in lkpi_ic_vap_delete() seems to
fix the problem and new VAPs (wlan interfaces) can be created again
after being destroyed.

Fixes: dbf7691999abe ("improve lkpi_ic_vap_delete()")
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 months agolinuxkpi: Fix uses of `pmap_change_attr()`
Jean-Sébastien Pédron [Wed, 16 Aug 2023 20:32:42 +0000 (22:32 +0200)]
linuxkpi: Fix uses of `pmap_change_attr()`

[Why]
This function takes an offset and a length as argument, not a physical
address and a number of pages.

This misuse caused the `set_memory_*()` and
`arch_io_reserve_memtype_wc()` functions to return EINVAL.

Another problem was the fact that they returned errors as a positive
integer, whereas Linux uses negative integers.

[How]
Physical addresses and number of pages are converted to offset+length in
the `set_memory_*()` functions.

`arch_io_reserve_memtype_wc()` now calls `pmap_change_attr()` directly
instead of using `set_memory_wc()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42053

9 months agosbuf.9: Add LIBRARY section
Mateusz Piotrowski [Tue, 3 Oct 2023 17:07:15 +0000 (19:07 +0200)]
sbuf.9: Add LIBRARY section

Sponsored by: Klara, Inc.
MFC after: 3 days

9 months agodtrace: fix fbt regression for aarch64
Igor Ostapenko [Tue, 3 Oct 2023 16:48:00 +0000 (19:48 +0300)]
dtrace: fix fbt regression for aarch64

fbt computes incorrect instruction position for AArch64 kernel module symbol.

The issue is with the for loop, it does an extra increment of instr pointer
after the required instruction is found. Hence, a wrong instruction is
targeted for patching.

Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Fixes: 980746e5cb26 ("fbt: simplify arm64 function-prologue parsing")
Reviewed by: markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/855
MFC after: 1 week

9 months agovfs cache: describe various optimization ideas
Mateusz Guzik [Tue, 3 Oct 2023 13:36:50 +0000 (13:36 +0000)]
vfs cache: describe various optimization ideas

While here report a sample result from running on Sapphire Rapids:

An access(2) loop slapped into will-it-scale, like so:
        while (1) {
                int error = access(tmpfile, R_OK);
                assert(error == 0);

                (*iterations)++;
        }

.. operating on /usr/obj/usr/src/amd64.amd64/sys/GENERIC/vnode_if.c

In operations per second:
lockless: 3462164
locked: 1362376

While the over 3.4 mln may seem like a big number, a critical look shows
it should be significantly higher.

A poor man's profiler, counting how many times given routine was sampled:
dtrace -w -n 'profile:::profile-4999 /execname == "a.out"/ {
@[sym(arg0)] = count(); } tick-5s { system("clear"); trunc(@, 40);
printa("%40a %@16d\n", @); clear(@); }'

[snip]
                    kernel`kern_accessat              231
           kernel`cpu_fetch_syscall_args              324
       kernel`cache_fplookup_cross_mount              340
                            kernel`namei              346
                    kernel`amd64_syscall              352
             kernel`tmpfs_fplookup_vexec              388
                             kernel`vput              467
                      kernel`vget_finish              499
                   kernel`lockmgr_unlock              529
                    kernel`lockmgr_slock              558
                    kernel`vget_prep_smr              571
                       kernel`vput_final              578
                           kernel`vdropl             1070
                           kernel`memcmp             1174
                     kernel`0xffffffff80             2080
                                     0x0             2231
                   kernel`copyinstr_smap             2492
                   kernel`cache_fplookup             9246

9 months agovfs cache: s/vfs.cache_fast_lookup/vfs.cache.param.fast_lookup
Mateusz Guzik [Tue, 3 Oct 2023 13:34:32 +0000 (13:34 +0000)]
vfs cache: s/vfs.cache_fast_lookup/vfs.cache.param.fast_lookup

9 months agolinux(4): Actually delete linux_sysproto.h
Dmitry Chagin [Tue, 3 Oct 2023 08:26:17 +0000 (11:26 +0300)]
linux(4): Actually delete linux_sysproto.h

MFC after: 1 week