]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agoBug fixes for fsck_ffs(8).
Kirk McKusick [Tue, 18 Apr 2023 06:03:30 +0000 (23:03 -0700)]
Bug fixes for fsck_ffs(8).

Sponsored by: Netflix

(cherry picked from commit 18746531a881356ed24b6ef2fdc9e50707642163)

14 months agoAdd `chdb' command to fsdb(8) to set direct block numbers.
Kirk McKusick [Tue, 18 Apr 2023 05:42:32 +0000 (22:42 -0700)]
Add `chdb' command to fsdb(8) to set direct block numbers.

(cherry picked from commit 7636973c68f15419a71bc8e4253b2fbae3258025)

14 months agoImprovement in UFS/FFS directory placement when doing mkdir(2).
Kirk McKusick [Thu, 30 Mar 2023 04:09:39 +0000 (21:09 -0700)]
Improvement in UFS/FFS directory placement when doing mkdir(2).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39246

(cherry picked from commit fe5e6e2cc5d6f2e4121eccdb3a8ceba646aef2c9)

14 months agoal_eth: make function definitions consistent with declarations
Dimitry Andric [Sat, 22 Apr 2023 11:45:57 +0000 (13:45 +0200)]
al_eth: make function definitions consistent with declarations

The declarations for al_eth_lm_retimer_ds25_signal_detect() and
al_eth_lm_retimer_ds25_cdr_lock() say that these functions return
'al_bool', but the definitions actually return 'boolean_t'.

Make the definitions match the declarations.

Reviewed by: jhb, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39759

(cherry picked from commit 9ea31d78f00d23612f3ab44d83265f8039f487af)

14 months agoUse bool for one-bit wide bit-fields
Dimitry Andric [Tue, 25 Apr 2023 17:18:58 +0000 (19:18 +0200)]
Use bool for one-bit wide bit-fields

A signed one-bit wide bit-field can take only the values 0 and -1. Clang
16 introduced a warning that "implicit truncation from 'int' to a
one-bit wide bit-field changes value from 1 to -1". Fix the warnings by
using C99 bool.

Reported by: Clang 16
Reviewed by: emaste, jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39705

(cherry picked from commit bab8274c090942cf96c44bc001307b9bffac9d7e)

14 months agopowerpc: fix a few pmap related functions to return correct types
Dimitry Andric [Sun, 23 Apr 2023 13:22:44 +0000 (15:22 +0200)]
powerpc: fix a few pmap related functions to return correct types

While experimenting with changing boolean_t to another type, I noticed
that several powerpc pmap related functions returned the wrong type:
boolean_t instead of int.

Fix several declarations and definitions to match the actual pmap
function types: pmap_dev_direct_mapped_t and pmap_ts_referenced_t.

MFC after: 3 days

(cherry picked from commit d142601887524fc595ed0f5e6a69419727222f0a)

14 months agokcsan: add __tsan_mem(cpy|move|set) aliases for clang >= 16
Dimitry Andric [Sun, 23 Apr 2023 18:11:34 +0000 (20:11 +0200)]
kcsan: add __tsan_mem(cpy|move|set) aliases for clang >= 16

Summary:
After https://github.com/llvm/llvm-project/commit/b4257d3bf58c ("[tsan]
Replace mem intrinsics with calls to interceptors") intrinsic calls to
memcpy, memmove or memset will directly call sanitizer interceptors,
e.g. __tsan_memcpy, __tsan_memmove or __tsan_memset.

Building GENERIC-KCSAN with clang >= 16 would thus result in link errors
similar to:

  ld: error: undefined symbol: __tsan_memcpy
  >>> referenced by cam_compat.c:150 (/usr/src/sys/cam/cam_compat.c:150)
  >>>               cam_compat.o:(cam_compat_handle_0x17)
  >>> referenced by cam_compat.c:151 (/usr/src/sys/cam/cam_compat.c:151)
  >>>               cam_compat.o:(cam_compat_handle_0x17)
  >>> referenced by cam_compat.c:152 (/usr/src/sys/cam/cam_compat.c:152)
  >>>               cam_compat.o:(cam_compat_handle_0x17)
  >>> referenced 1692 more times

Similar to subr_msan.c, add aliases from the existing kcsan_* versions
of these functions to __tsan_* names.

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39772

(cherry picked from commit 42162fb2fe30c0881e7e4d2143ddcfee3e1dd752)

14 months agoInclude bsd.linker.mk to get LINKER_TYPE and VERSION in rescue
Dimitry Andric [Mon, 17 Apr 2023 17:43:29 +0000 (19:43 +0200)]
Include bsd.linker.mk to get LINKER_TYPE and VERSION in rescue

To be able to use these make variables, you also have to include
bsd.linker.mk, apparently.

Fixes: 458f4722bf97
MFC after: 1 week

(cherry picked from commit 653e8c11f43dc6448b8560eb1f6679de2c47e1ed)

14 months agoSuppress lld 16 errors about undefined symbols in version maps
Dimitry Andric [Mon, 17 Apr 2023 16:00:20 +0000 (18:00 +0200)]
Suppress lld 16 errors about undefined symbols in version maps

lld >= 16 turned on --no-undefined-version by default, which results in
errors whenever symbols are mentioned in version maps, but are not
actually defined in the binary.

Since we have quite a few instances of symbols that are defined or not,
depending on various compile-time settings, suppress this lld check for
the time being.

MFC after: 1 week

(cherry picked from commit 2ba84b4bcdd6012e8cfbf8a0d060a4438623a638)

14 months agoSuppress lld 16 errors about multiply defined symbols in rescue
Dimitry Andric [Mon, 17 Apr 2023 16:25:30 +0000 (18:25 +0200)]
Suppress lld 16 errors about multiply defined symbols in rescue

lld >= 16 became more strict about multiply defined symbols. Since there
are many of those in crunchgen'd programs, turn off the check when
linking the rescue binary.

MFC after: 1 week

(cherry picked from commit 458f4722bf974c7fa7961952fcaee146f5a97708)

14 months agobhyve: remove redundant variable
Vitaliy Gusev [Wed, 1 Mar 2023 07:45:46 +0000 (07:45 +0000)]
bhyve: remove redundant variable

Reviewed by:    corvink,markj
Sponsored by:   vStack
Differential Revision: https://reviews.freebsd.org/D38836

14 months agobhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item
Corvin Köhne [Tue, 21 Jun 2022 08:35:40 +0000 (10:35 +0200)]
bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item

Requested-by: coreboot
Reviewed by: <If someone else reviewed your modification.>
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39315

(cherry picked from commit 305edaa47918a559de46a5d72060644009f1875c)

14 months agobhyve: add hook for PCI header of passthru devices
Corvin Köhne [Tue, 7 Sep 2021 11:42:25 +0000 (13:42 +0200)]
bhyve: add hook for PCI header of passthru devices

Most register of the PCI header are either constant values or require
emulation anyway. The command and status register are the only exception which
require hardware access. So, we're adding an emulation handler for all
other register.

As this emulation handler will be reused by some future features like
GPU passthrough, we directly export it.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33010

(cherry picked from commit b6e67875a3e5bc706fe37565e464c61fe7833846)

14 months agobhyve: define array to protect passthru regs
Corvin Köhne [Fri, 19 Mar 2021 12:48:34 +0000 (13:48 +0100)]
bhyve: define array to protect passthru regs

GPU passthrough requires a special handling of some PCI config register.
Therefore, we need a flexible approach for implementing it. Adding an
array of handler meets this condition.

Start by using the default handler for all accesses to the PCI config
space. In upcoming commits, we can start to split the default handler
into several handler for each register that requires emulation.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39291

(cherry picked from commit 931bb7bf1c8f90f3303b5291e4868c587f9364e7)

14 months agobhyve: save softc of ACPI devices
Corvin Köhne [Fri, 22 Jul 2022 08:15:28 +0000 (10:15 +0200)]
bhyve: save softc of ACPI devices

This will be useful for writing device specific ACPI tables or DSDT
methods.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39322

(cherry picked from commit 158adced65f844682d26e1e64f247de94212f135)

14 months agobhyve: allow device specific DSDT entries
Corvin Köhne [Fri, 22 Jul 2022 08:11:14 +0000 (10:11 +0200)]
bhyve: allow device specific DSDT entries

This feature will be used by future commits to implement a device
specific method (_DSM) for TPM devices.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39321

(cherry picked from commit e976464a50aceebf97fb3cc6b94058111fc40de1)

14 months agobhyve: check for errors when writing device specific DSDT entries
Corvin Köhne [Wed, 5 Apr 2023 06:45:22 +0000 (08:45 +0200)]
bhyve: check for errors when writing device specific DSDT entries

At the moment, this function can't fail. This behaviour will change in
the future. In preparation to that, convert the return type to int in
order to be able to check for errors.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39422

(cherry picked from commit ab34ea4711b1001c416dc286380e54c118ff0c49)

14 months agobhyve: allow building device specific ACPI tables
Corvin Köhne [Fri, 22 Jul 2022 08:09:01 +0000 (10:09 +0200)]
bhyve: allow building device specific ACPI tables

Some ACPI devices require a device specific acpi table. E.g. a TPM2
device requires a TPM2 table. Use the acpi_device_emul struct to define
such a device specific table.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39320

(cherry picked from commit 0926566f6f9cc1dba0d7b5d7e0b45484dd901b20)

14 months agobhyve: introduce acpi_device_emul struct
Corvin Köhne [Fri, 22 Jul 2022 08:00:10 +0000 (10:00 +0200)]
bhyve: introduce acpi_device_emul struct

It'll be easier to add new properties to the ACPI device emulation if we
have a struct which holds all device specific properties. In some future
commits the acpi_device_emul struct will be expanded to include some
device specific functions to build ACPI tables.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39319

(cherry picked from commit acd0088c44f9ccaff571e041dc56d01fcc47d64b)

14 months agobhyve: add config option to modify LPC IDs
Corvin Köhne [Tue, 23 Nov 2021 12:14:41 +0000 (13:14 +0100)]
bhyve: add config option to modify LPC IDs

The Intel GOP driver checks the LPC IDs to detect the platform it's
running on. The GOP driver only works on the platforms it's written for.
Maybe other Intel driver have the same behaviour. For that reason, we
should use the LPC IDs of the FreeBSD host for GPU passthrough to work
properly.

We don't know if setting different LPC IDs have any side effect.
Therefore, don't use the host LPC IDs by default on Intel system. Give
the user the opportunity to modify the LPC IDs.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D28280

(cherry picked from commit f4ceaff56ddaacc151df07d2d205a2d7fcb736a8)

bhyve: fix spelling mistake of pcireg option

The option is spelled "pcireg" not "pcir".

MFC after: 1 week
Fixes: f4ceaff56ddaacc151df07d2d205a2d7fcb736a8
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit c98d13fbf9c9b75a49e48789932cd1395c95e7bf)

bhyve: scan PCI device functions to find host LPC

At least on some AMD devices the host LPC bridge could be located as
seperate function of another PCI device.

Fixes: f4ceaff56ddaacc151df07d2d205a2d7fcb736a8
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39310

(cherry picked from commit d3e03d235e3133f79ff9e3879fd4ed61ace38d73)

bhyve: do not exit if LPC finds no host selector

The host selector is only required when the user likes to use the same
LPC device IDs as the physical LPC device. This is an uncommon use case.
For that reason, it makes no sense to exit when we don't find the host
selector.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39311

(cherry picked from commit 0d29d750b9a7188c435d3701b2183f4df15ac98b)

14 months agoipfw.8: MFC: improve description for interface matching
Eugene Grosbein [Tue, 25 Apr 2023 11:12:11 +0000 (18:12 +0700)]
ipfw.8: MFC: improve description for interface matching

The manual describes "if*" form only while kernel uses fnmatch(3)
and allows use for more versatile shell-like patterns.
Note that explicitly and provide an example.

(cherry picked from commit 9f5dc374d0dadb6947a9bd9ff8ff44931e1b6422)

14 months agolink_elf: fix SysV hash function overflow
Ed Maste [Wed, 12 Apr 2023 14:04:27 +0000 (10:04 -0400)]
link_elf: fix SysV hash function overflow

Quoting from https://maskray.me/blog/2023-04-12-elf-hash-function:

The System V Application Binary Interface (generic ABI) specifies the
ELF object file format. When producing an output executable or shared
object needing a dynamic symbol table (.dynsym), a linker generates a
.hash section with type SHT_HASH to hold a symbol hash table. A DT_HASH
tag is produced to hold the address of .hash.

The function is supposed to return a value no larger than 0x0fffffff.
Unfortunately, there is a bug. When unsigned long consists of more than
32 bits, the return value may be larger than UINT32_MAX. For instance,
elf_hash((const unsigned char *)"\xff\x0f\x0f\x0f\x0f\x0f\x12") returns
0x100000002, which is clearly unintended, as the function should behave
the same way regardless of whether long represents a 32-bit integer or
a 64-bit integer.

Reviewed by: kib, Fangrui Song
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39517

(cherry picked from commit 2ef2c26f3f132af33f6f12cd7b27d4dbbd7fa435)

14 months agortld: fix SysV hash function overflow
Ed Maste [Wed, 12 Apr 2023 15:07:26 +0000 (11:07 -0400)]
rtld: fix SysV hash function overflow

Quoting from https://maskray.me/blog/2023-04-12-elf-hash-function:

The System V Application Binary Interface (generic ABI) specifies the
ELF object file format. When producing an output executable or shared
object needing a dynamic symbol table (.dynsym), a linker generates a
.hash section with type SHT_HASH to hold a symbol hash table. A DT_HASH
tag is produced to hold the address of .hash.

The function is supposed to return a value no larger than 0x0fffffff.
Unfortunately, there is a bug. When unsigned long consists of more than
32 bits, the return value may be larger than UINT32_MAX. For instance,
elf_hash((const unsigned char *)"\xff\x0f\x0f\x0f\x0f\x0f\x12") returns
0x100000002, which is clearly unintended, as the function should behave
the same way regardless of whether long represents a 32-bit integer or
a 64-bit integer.

Reviewed by: kib, Fangrui Song
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39517

(cherry picked from commit 29e3a06510823edbb91667d21f530d3ec778116d)

14 months agortld: reindent and style(9) elf_hash()
Ed Maste [Wed, 12 Apr 2023 15:06:14 +0000 (11:06 -0400)]
rtld: reindent and style(9) elf_hash()

In preparation for an upcoming change (D39517).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 87443cb6c669b51ceaa7f85db63191374477efc1)

14 months agomemmem: add a note about other systems which have memmem
Ed Maste [Thu, 30 Mar 2023 01:03:27 +0000 (21:03 -0400)]
memmem: add a note about other systems which have memmem

memmem started as a GNU extension but is now widely available.

Reviewed by: mhorne (slightly earlier version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39337

(cherry picked from commit 30da840c627c80800c06edef346d907d6e5066a6)

14 months agollvm: fix some llvm-* tool links when WITH_LLVM_BINUTILS is set
Ed Maste [Fri, 21 Apr 2023 13:11:45 +0000 (09:11 -0400)]
llvm: fix some llvm-* tool links when WITH_LLVM_BINUTILS is set

A few Makefiles overrode LINKS and MLINKS when WITH_LLVM_BINUTILS was
set, which caused some llvm- prefixed tools to disappear.  One such case
was llvm-ranlib, which some ports invoke explicitly.

Use += when adding to LINKS and MLINKS under WITH_LLVM_BINUTILS.

PR: 270955, 270956, 270959
Submitted by: jbeich
Reviewed by: arichardson
Fixes: 021385aba562 ("Add WITH_LLVM_BINUTILS to install LLVM binuti...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39747

(cherry picked from commit 41df1d60e3237df2106dddf357e3205bf29f85d5)

14 months agorelease: Remove "All Rights Reserved" from FreeBSD Foundation copyrights
Ed Maste [Mon, 17 Apr 2023 14:56:59 +0000 (10:56 -0400)]
release: Remove "All Rights Reserved" from FreeBSD Foundation copyrights

(cherry picked from commit 4654ba28fb8b0a7d74366120cc1967791b46ac3a)

14 months agomakefs: set cd9660 Rock Ridge timestamps for . and ..
Ed Maste [Tue, 18 Apr 2023 13:57:29 +0000 (09:57 -0400)]
makefs: set cd9660 Rock Ridge timestamps for . and ..

DOT and DOTDOT entries have special handling, and previously only Rock
Ridge PX (POSIX attributes) entries were attached.  Add TF (timestamp)
entries as well.

PR: 203531
Reported by: Thomas Schmitt <scdbackup@gmx.net>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39662

(cherry picked from commit dd9059b3e9a1711d54c1d511a2cbb23e6e23f556)

14 months agomakefs: call brelse from bread
Ed Maste [Mon, 13 Mar 2023 21:00:20 +0000 (17:00 -0400)]
makefs: call brelse from bread

This matches NetBSD and rationalizes makefs with the kernel API.

This reverts commit 370e009188ba90c3290b1479aa06ec98b66e140a.

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
Obtained from: NetBSD 0a62dad69f620c4125e1a19fcb6a5a3575fd
Differential Revision: https://reviews.freebsd.org/D39070

(cherry picked from commit e5551216d8e563043248bc7f3cb1c75b2dbd9791)

14 months agoopenssh: restore PrintLastLog option
Ed Maste [Thu, 20 Apr 2023 00:09:13 +0000 (20:09 -0400)]
openssh: restore PrintLastLog option

Upstream's autoconf sets DISABLE_LASTLOG if lastlog.ll_line does not
exist, but PrintLastLog also works with utmpx and other mechanisms.

Reported upstream at
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-May/040242.html

PR: 209441
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 43c6b7a60aff069da7e0ba6c87d3d7a532e812f6)
(cherry picked from commit 170511589e4d15a27ee92979691cfc1b26929bb7)

14 months agoposixshmcontrol(1): silently ignore inaccessible segments when listing
Konstantin Belousov [Sun, 23 Apr 2023 23:30:58 +0000 (02:30 +0300)]
posixshmcontrol(1): silently ignore inaccessible segments when listing

PR: 271038

(cherry picked from commit 043e24bdb01938c0d5a73a3192e316ce0b96ec1b)

14 months agosys/dirent.h: comment update, 'd_off' is offset of next entry
Olivier Certner [Sun, 23 Apr 2023 08:05:06 +0000 (10:05 +0200)]
sys/dirent.h: comment update, 'd_off' is offset of next entry

(cherry picked from commit faec42a3ef60d1c5e80da3e9aa3178ad1e0e7701)

14 months agouart(4): add Sunrise Point UART controllers
Kyle Evans [Fri, 14 Apr 2023 14:52:48 +0000 (09:52 -0500)]
uart(4): add Sunrise Point UART controllers

Sponsored by: Zenith Electronics LLC
Sponsored by: Klara, Inc.

(cherry picked from commit d1b6271118188dd25a18f2372ab1d3004335ea3c)

14 months agoloader: comconsole: don't unconditionally wipe out hw.uart.console
Kyle Evans [Fri, 14 Apr 2023 04:41:22 +0000 (23:41 -0500)]
loader: comconsole: don't unconditionally wipe out hw.uart.console

It may be the case that we need to set hw.uart.console manually in some
scenarios that comconsole can't necessarily support.  Avoid clobbering
hw.uart.console unless we've actually selected comconsole so that one
could at least get kernel console output..

Discussed with: imp
Sponsored by: Zenith Electronics LLC
Sponsored by: Klara, Inc.

(cherry picked from commit ec671f4980437008b0119c6367816083e15fa503)

14 months agoumtx: allow to configure minimal timeout (in nanoseconds)
Konstantin Belousov [Sat, 15 Apr 2023 17:46:12 +0000 (20:46 +0300)]
umtx: allow to configure minimal timeout (in nanoseconds)

PR: 270785

(cherry picked from commit 93ca6ff2958cace3b7b883ed797ea6539881a6a2)

14 months agox86: initialize use_xsave once
Konstantin Belousov [Tue, 18 Apr 2023 15:50:26 +0000 (18:50 +0300)]
x86: initialize use_xsave once

(cherry picked from commit 617a11eab6337693eae9d160453adf1943ab6a37)

14 months agosyncer vnode: add VOP_GETWRITEMOUNT() definition explicitly
Konstantin Belousov [Sun, 16 Apr 2023 17:04:53 +0000 (20:04 +0300)]
syncer vnode: add VOP_GETWRITEMOUNT() definition explicitly

(cherry picked from commit 7aeea73e30789c8987fbfa52cde93bab577bbc09)

14 months agosync_vnode(): add assert to check vn_start_write() correctness
Konstantin Belousov [Sat, 15 Apr 2023 19:41:44 +0000 (22:41 +0300)]
sync_vnode(): add assert to check vn_start_write() correctness

(cherry picked from commit d8a096621bcf4539d0920eb0711d19fcb30c0576)

14 months agozfs: fix up EINVAL from getdirentries on .zfs
Mateusz Guzik [Thu, 20 Apr 2023 08:36:53 +0000 (08:36 +0000)]
zfs: fix up EINVAL from getdirentries on .zfs

PR: 270909
(cherry picked from commit 9c4e270822a3592bf122f9a8e4e815b4602329f1)

14 months agovfs cache: fix vfs.cache.stats.* name typos
Igor Ostapenko [Wed, 19 Apr 2023 17:12:25 +0000 (20:12 +0300)]
vfs cache: fix vfs.cache.stats.* name typos

Two vfs.cache.stats names are fixed:
- s/.dotdothis/.dotdothits/
- s/.posszaps/.poszaps/

Signed-off-by: Igor Ostapenko <pm@igoro.pro>
[mjg: massaged the header a little bit]
(cherry picked from commit 0e0c47ecd624da976bf7e1ff391cb4a00c76b200)

14 months agovmrun.sh: Fix a typo in usage()
Mateusz Piotrowski [Thu, 20 Apr 2023 12:43:57 +0000 (14:43 +0200)]
vmrun.sh: Fix a typo in usage()

MFC after: 3 days
Sponsored by: Klara Inc.

(cherry picked from commit 607bc91d90a34f4d75cb7738bf23bc4517cd327f)

14 months agozfs: merge openzfs/zfs@e25f9131d (zfs-2.1-release) into stable/13
Martin Matuska [Sun, 23 Apr 2023 10:12:49 +0000 (12:12 +0200)]
zfs: merge openzfs/zfs@e25f9131d (zfs-2.1-release) into stable/13

OpenZFS release 2.1.11

Notable upstream pull requeset merges:
  #13368 ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced() (reverted)
  #13758 Allow mounting snapshots in .zfs/snapshot as a regular user
  #13816 Fix a race condition in dsl_dataset_sync() when activating features
  #14039 Optimize microzaps
  #14196 Remove atomics from zh_refcount
  #14198 Switch dnode stats to wmsums
  #14199 Remove few pointer dereferences in dbuf_read()
  #14200 Micro-optimize zrl_remove()
  #14218 Avoid a null pointer dereference in zfs_mount() on FreeBSD
  #14293 Turn default_bs and default_ibs into ZFS_MODULE_PARAMs
  #14317 Pack zrlock_t by 8 bytes
  #14402 Prefetch on deadlists merge
  #14418 Introduce minimal ZIL block commit delay
  #14448 Fix console progress reporting for recursive send
  #14454 Improve arc_read() error reporting
  #14502 Partially revert f806306ce0
         "Activate filesystem features only in syncing context"
  #14516 System-wide speculative prefetch limit
  #14523 Move dmu_buf_rele() after dsl_dataset_sync_done()
  #14563 Optimize the is_l2cacheable functions
  #14573 Add missing increment to dsl_deadlist_move_bpobj()
  #14621 Colorize patchset
  #14639 FreeBSD: Remove extra arc_reduce_target_size() call
  #14641 Additional limits on hole reporting
  #14653 Update vdev state for spare vdev
  #14712 Fix "Add colored output to zfs list"
  #14761 Revert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"

Obtained from: OpenZFS
OpenZFS tag: zfs-2.1.11
OpenZFS commit: e25f9131d679692704c11dc0c1df6d4585b70c35
Relnotes: yes

14 months agokern.mk: clang >= 16 already infers ELFv2 for powerpc64
Dimitry Andric [Thu, 20 Apr 2023 19:27:11 +0000 (21:27 +0200)]
kern.mk: clang >= 16 already infers ELFv2 for powerpc64

There is no need to pass -mabi=elfv2 explicitly anymore, and with clang
16 in fact results in a "unused argument" warning.

MFC after: 3 days

(cherry picked from commit 42140052765e05c83a3ea797dce3eaad94bc3733)

14 months agoprocctl: add state flags to PROC_REAP_GETPIDS reports
Val Packett [Sat, 15 Apr 2023 17:59:30 +0000 (14:59 -0300)]
procctl: add state flags to PROC_REAP_GETPIDS reports

(cherry picked from commit 77f0e198d9134b6ca2650d3a84d7db2d786ec0c0)

14 months agonet80211: Remove double words in source code comments
Gordon Bergling [Tue, 18 Apr 2023 05:11:43 +0000 (07:11 +0200)]
net80211: Remove double words in source code comments

- s/we we/we/

(cherry picked from commit 93e491481686bb392b36a01e1569069846cf5f7e)

14 months agolast(1): Remove double words in source code comments
Gordon Bergling [Tue, 18 Apr 2023 05:12:45 +0000 (07:12 +0200)]
last(1): Remove double words in source code comments

- s/on on/on/
- s/we we/we/

(cherry picked from commit 1190b82c2294762c77099fc52835d5d07b57e7a3)

14 months agostand: Remove a double word in a source code comment
Gordon Bergling [Thu, 20 Apr 2023 09:11:18 +0000 (11:11 +0200)]
stand: Remove a double word in a source code comment

- s/value value/value/

(cherry picked from commit 66095010d1f4e5ff4a7bc39020106103887a470e)

14 months agoichiic: use bool for one-bit wide bit-fields
Dimitry Andric [Tue, 18 Apr 2023 18:08:28 +0000 (20:08 +0200)]
ichiic: use bool for one-bit wide bit-fields

A one-bit wide bit-field can take only the values 0 and -1. Clang 16
introduced a warning that "implicit truncation from 'int' to a one-bit
wide bit-field changes value from 1 to -1". Fix by using c99 bool.

Reported by: Clang
Reviewed by: emaste, wulf
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39665

(cherry picked from commit 87f55ab0b46ad72efee11d1b64ec8f839bb013da)

14 months agobsnmp: make single bit bitfields unsigned to avoid clang 16 warning
Dimitry Andric [Mon, 17 Apr 2023 16:11:56 +0000 (18:11 +0200)]
bsnmp: make single bit bitfields unsigned to avoid clang 16 warning

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a declaration in bsnmp's snmpd.h:

    contrib/bsnmp/snmpd/trans_lsock.c:271:21: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            peer->input.stream = 1;
                               ^ ~

Signed one-bit bitfields can only have values -1 and 0, but the intent
here is to use the field as a boolean, so make it unsigned.

MFC after: 3 days

(cherry picked from commit b740e02500ca248e1096cf745a17d2a8fcc44fed)

14 months agolibsa: make single bit bitfields unsigned to avoid clang 16 warning
Dimitry Andric [Mon, 17 Apr 2023 16:15:57 +0000 (18:15 +0200)]
libsa: make single bit bitfields unsigned to avoid clang 16 warning

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a declaration in libsa's tftp.c:

    stand/libsa/tftp.c:382:20: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                                    h->islastblock = 1;     /* very short file */
                                                   ^ ~
    stand/libsa/tftp.c:432:18: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    h->islastblock = 1;     /* EOF */
                                   ^ ~

Signed one-bit bitfields can only have values -1 and 0, but the intent
here is to use the field as a boolean, so make it unsigned.

MFC after: 3 days

(cherry picked from commit 1a3ccb8f1552977e1b264e3b89d1fba8e717dad8)

14 months agounionfs.5: Use '.An -nosplit' in the AUTHORS section
Gordon Bergling [Wed, 19 Apr 2023 15:11:41 +0000 (17:11 +0200)]
unionfs.5: Use '.An -nosplit' in the AUTHORS section

Use '.An -nosplit' in the AUTHORS section to prevent line breaks.

(cherry picked from commit 409731e7d71358cda3d23d903607614c29680038)

14 months agomakefs: use unsigned and %u for rock_ridge_move_count
Ed Maste [Mon, 10 Apr 2023 22:53:53 +0000 (18:53 -0400)]
makefs: use unsigned and %u for rock_ridge_move_count

For diff reduction against NetBSD's makefs.  Based on NetBSD git mirror
commit 00991aee8248.

With this change our makefs cd9660 support should be in sync up to
NetBSD commit bdae6c9dc792 ("makefs(8): Nix trailing whitespace.").

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 10854bf51747c172e45e365995ccf42aef2ab470)

14 months agomakefs: remove unused variable
Ed Maste [Mon, 17 Apr 2023 12:12:27 +0000 (08:12 -0400)]
makefs: remove unused variable

Reported by: Clang
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 79ead0849707396cb2de0bab7e354fb099ea344e)

14 months agomakefs: remove unused cd9660 options
Ed Maste [Fri, 31 Mar 2023 12:52:22 +0000 (08:52 -0400)]
makefs: remove unused cd9660 options

Makefs defined "follow-symlinks" and "help" options, but they did
nothing.  Remove them.

Obtained from: OpenBSD a8f1645688c2
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c753f49f7006d28786c29dfbb5f838b494e2146f)

15 months agoEnable KERN_TLS by default in ARM64 GENERIC
Allan Jude [Thu, 28 Jan 2021 20:48:37 +0000 (20:48 +0000)]
Enable KERN_TLS by default in ARM64 GENERIC

PR: 270759
Sponsored-by: Ampere Computing
Submitted-by: Klara, Inc.

(cherry picked from commit f9322ff6efa508df8368e31e3c4880cff11b0e23)

15 months agosftp: avoid leaking path arg in calls to make_absolute_pwd_glob
Ed Maste [Thu, 3 Nov 2022 17:17:40 +0000 (13:17 -0400)]
sftp: avoid leaking path arg in calls to make_absolute_pwd_glob

As Coverity reports:
    Overwriting tmp in tmp = make_absolute_pwd_glob(tmp, remote_path)
    leaks the storage that tmp points to.

Consume the first arg in make_absolute_pwd_glob, and add xstrdup() to
the one case which did not assign to the same variable that was passed
in. With this change make_absolute() and make_absolute_pwd_glob() have
the same semantics with respect to freeing the input string.

This change was reported to OpenSSH in
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-November/040497.html
[and was later adopted upstream].

Reported by: Coverity Scan
CID: 1500409
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37253

(cherry picked from commit 69c72a57af843267b220f8367c4cc7162a12d696)

15 months agobridge: Log MAC address port flapping
Zhenlei Huang [Fri, 7 Apr 2023 14:25:41 +0000 (22:25 +0800)]
bridge: Log MAC address port flapping

MAC flapping occurs when a bridge receives packets with the same source MAC
address on different member interfaces. The common reasons are:
 - user roams from one bridge port to another
 - user has wrong network setup, bridge loops e.g.
 - someone set duplicated ethernet address on his/her nic
 - some bad guy / virus / trojan send spoofed packets

if_bridge currently updates the bridge routing entry silently hence it is hard
to diagnose.

Emit logs when MAC address port flapping occurs to make it easier to diagnose.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39375
Differential Revision: https://reviews.freebsd.org/D39542

(cherry picked from commit 2d3614fb132b1cb8efd1e0accdd0c98ce6893efa)
(cherry picked from commit 9af6f4268ac3cc8203f34c746d955b4405279099)

15 months agoprintf.9: Update the use example of the %D conversion specifier
Zhenlei Huang [Fri, 14 Apr 2023 10:08:56 +0000 (18:08 +0800)]
printf.9: Update the use example of the %D conversion specifier

The output of hexadecimal bytes are in lowercase. Update the example to
reflect the reality.

Reviewed by: gbe (manpages)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39543

(cherry picked from commit 722b7589cca704670c3c532bdd0f5d46675df085)

15 months agolagg(4): Correctly define some sysctl variables
Zhenlei Huang [Mon, 17 Apr 2023 10:24:35 +0000 (18:24 +0800)]
lagg(4): Correctly define some sysctl variables

939a050ad96c virtualized lagg(4), but the corresponding sysctl of some
virtualized global variables are not marked with CTLFLAG_VNET. A try to
operate on those variables via sysctl will effectively go to the 'master'
copies and the virtualized ones are not read or set accordingly. As a
side effect, on updating the 'master' copy, the virtualized global
variables of newly created vnets will have correct values.

PR: 270705
Reviewed by: kp
Fixes: 939a050ad96c Virtualize lagg(4) cloner
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39467

(cherry picked from commit 401f03445e4aa42960e337604560593c7096e589)

15 months agovnet: Fix a typo in a source code comment
Zhenlei Huang [Mon, 17 Apr 2023 10:24:35 +0000 (18:24 +0800)]
vnet: Fix a typo in a source code comment

- s/form/from/

MFC after: 3 days

(cherry picked from commit a7acce3491987c116e607697a4906807f4ea1c10)

15 months agomlx5ib(4): Mark driver knows net epoch
Zhenlei Huang [Wed, 5 Apr 2023 16:06:15 +0000 (00:06 +0800)]
mlx5ib(4): Mark driver knows net epoch

This driver has already been EPOCH(9) aware since e48813009c6a.

Reviewed by: hselasky
Tested by: hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39406

(cherry picked from commit da4068c4e1a090915a1a763c0d9fa5dc5b80842c)

15 months agoinfiniband: Opt-in for net epoch
Zhenlei Huang [Wed, 5 Apr 2023 16:05:02 +0000 (00:05 +0800)]
infiniband: Opt-in for net epoch

This is counterpart to e87c4940156c, which did the same for ethernet.

Suggested by: hselasky
Reviewed by: hselasky, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39405

(cherry picked from commit fc6c93b6a5cf14cbc099f550f745d63779499fec)

15 months agogrdc.6: Add an ENVIRONMENT section
Gordon Bergling [Sun, 16 Apr 2023 09:17:06 +0000 (11:17 +0200)]
grdc.6: Add an ENVIRONMENT section

- Add an ENVIRONMENT section

Obtained from: OpenBSD

(cherry picked from commit 991360ba49707b84889e5bfce49dfbf383088171)

15 months agomorse.6: Mention to standards in the SEE ALSO section
Gordon Bergling [Sun, 16 Apr 2023 09:46:09 +0000 (11:46 +0200)]
morse.6: Mention to standards in the SEE ALSO section

Mention ITU-T Recommendation F.1 and ITU-R M.1677-1
in the SEE ALSO section.

Obtained from: OpenBSD

(cherry picked from commit 82a036d86acaac75b1ff6d4f8b767bbb117694f1)

15 months agomount_nfs.8: Fix a mandoc warning
Gordon Bergling [Tue, 18 Apr 2023 07:14:20 +0000 (09:14 +0200)]
mount_nfs.8: Fix a mandoc warning

- sections out of conventional order: Sh IMPLEMENTATION NOTES

(cherry picked from commit c2a9d23736da3593bc7cc883f43d913188d79beb)

15 months agoamd64: fix PKRU and swapout interaction
Konstantin Belousov [Thu, 13 Apr 2023 11:37:35 +0000 (14:37 +0300)]
amd64: fix PKRU and swapout interaction

(cherry picked from commit 1e0e335b0f0dbae8ce49307377b23ef3673bd402)

15 months agotrpt: fix several bugs and add deprecation notice
Michael Tuexen [Thu, 20 Apr 2023 22:09:40 +0000 (00:09 +0200)]
trpt: fix several bugs and add deprecation notice

This patch fixes several bugs releated to trpt including
* the computation of the TCP payload bytes, in particular when
  TCP options are present or IPv4 is used.
* the logging of incoming and outgoing packets.
* the logging of timers, in particular add support for logging of
  the delayed ack timer.
Also add a deprecation note, since support for this utility has been
removed from the main branch. Therefore, this is a direct commit to
stable/13.

Reviewed by: cc, glebius, rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D39436

15 months agopkill: tests: do a pass for case-sensitive conflicts
Kyle Evans [Mon, 20 Mar 2023 19:51:41 +0000 (14:51 -0500)]
pkill: tests: do a pass for case-sensitive conflicts

As in 76b6a59f9d30a5a39a5ed, encode upper-case flag tests with a leading
underbar to avoid collisions (thus, erroneously dirty git repos) on
case-sensitive filesystems.

PR: 270948
Sponsored by: Klara, Inc.

(cherry picked from commit 822057bfbbbcdb722a7ccd0e40d6b7e82b1d83f7)

15 months agoloader: lua: disable autoboot timer after password entry
Cyrus Rahman [Sun, 16 Apr 2023 02:30:41 +0000 (21:30 -0500)]
loader: lua: disable autoboot timer after password entry

In the lua loader, if one sets a password in loader.conf, the
autoboot_delay timer will start before the menu is displayed.  One can
interrupt the autoboot and bring up the menu by entering a keyboard
character before the timer expires.

If this is done a prompt for the password is displayed.  Entering the
password will bring up the menu, but the timer will again start and
another keyboard character must be entered or autoboot will abort the
menu and boot the system.

PR: 265472
Reviewed by: kevans
MFC after: 3 days

(cherry picked from commit 0ab68e9272b573becdb42edf2b4419cb7ab04707)

15 months agoloader: lua: unload the kernel when changing BEs
Cyrus Rahman [Sun, 16 Apr 2023 02:27:53 +0000 (21:27 -0500)]
loader: lua: unload the kernel when changing BEs

Usually the kernel is loaded later, but there are circumstances where it
could have been loaded earlier than changing BEs.  Unload anything that
is already there so that we know we're using artifacts from the proper
environment.

PR: 265471
Reviewed by: kevans
MFC after: 3 days

(cherry picked from commit d7584aa09fcf8d96544e5bfb3ea78f50d7720c0c)

15 months agotty: Default to printing kernel stack traceback only on INVARIANT kernels
Warner Losh [Wed, 19 Apr 2023 19:32:45 +0000 (13:32 -0600)]
tty: Default to printing kernel stack traceback only on INVARIANT kernels

Change the default from printing a breif kernel thread stack informaton
back to omitting it for non-invariant kernels in response to
SIGINFO/^T. Full and brief stack support can be selected with the
kern.tty_info_kstacks sysctl.

MFC After: 2 weeks
Sponsored by: Netflix
Reviewed by: grembo, jhb
Differential Revision: https://reviews.freebsd.org/D35576

(cherry picked from commit b69996d1d5d08fd5009ac325ea8e8154efd01b33)

15 months agobridge: Try to make the GRAB_OUR_PACKETS macro a bit more readable
Mark Johnston [Wed, 5 Apr 2023 14:37:00 +0000 (10:37 -0400)]
bridge: Try to make the GRAB_OUR_PACKETS macro a bit more readable

- Let the compiler use constant folding to eliminate conditionals.
- Fix some inconsistent whitespace.

No functional change intended.

Reviewed by: zlei
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38410

(cherry picked from commit 82bbdde4ebc9deb30d3a05ddec4d76f0a88df881)

15 months agonetisr: Purge another reference to NETISR_EPAIR
Mark Johnston [Wed, 12 Apr 2023 14:27:00 +0000 (10:27 -0400)]
netisr: Purge another reference to NETISR_EPAIR

Fixes: 03276e338a1b ("netisr: Remove the now-unused NETISR_EPAIR queue index")
MFC after: 1 week

(cherry picked from commit b4f1582f3b62ca943a6009d7f08c938833bf70d5)

15 months agoTag zfs-2.1.11
Tony Hutter [Tue, 18 Apr 2023 18:44:34 +0000 (11:44 -0700)]
Tag zfs-2.1.11

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
15 months agoValues printed by zpool-iostat(8) should be right-aligned
Low-power [Tue, 18 Apr 2023 18:34:41 +0000 (02:34 +0800)]
Values printed by zpool-iostat(8) should be right-aligned

This inappropriate left-alignment was introduced in 7bb7b1f.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes #14751

15 months agoRevert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"
Tony Hutter [Tue, 18 Apr 2023 15:41:52 +0000 (08:41 -0700)]
Revert "ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()"

This reverts commit 4b3133e671b958fa2c915a4faf57812820124a7b.

Users identified this commit as a possible source of data
corruption:
https://github.com/openzfs/zfs/issues/14753

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Issue #14753
Closes #14761

15 months agocontrib: dracut: fix race with root=zfs:dset when necessities required
наб [Tue, 28 Mar 2023 20:49:50 +0000 (22:49 +0200)]
contrib: dracut: fix race with root=zfs:dset when necessities required

This had always worked in my testing, but a user on hardware reported
this to happen 100%, and I reproduced it once with cold VM host caches.

dracut-zfs-generator runs as a systemd generator, i.e. at Some
Relatively Early Time; if root= is a fixed dataset, it tries to
"solve [necessities] statically at generation time".

If by that point zfs-import.target hasn't popped (because the import is
taking a non-negligible amount of time for whatever reason), it'll see
no children for the root datase, and as such generate no mounts.

This has never had any right to work. No-one caught this earlier because
it's just that much more convenient to have root=zfs:AUTO, which orders
itself properly.

To fix this, always run zfs-nonroot-necessities.service;
this additionally simplifies the implementation by:
  * making BOOTFS from zfs-env-bootfs.service be the real, canonical,
    root dataset name, not just "whatever the first bootfs is",
    and only set it if we're ZFS-booting
  * zfs-{rollback,snapshot}-bootfs.service can use this instead of
    re-implementing it
  * having zfs-env-bootfs.service also set BOOTFSFLAGS
  * this means the sysroot.mount drop-in can be fixed text
  * zfs-nonroot-necessities.service can also be constant and always
    enabled, because it's conditioned on BOOTFS being set

There is no longer any code generated at run-time
(the sysroot.mount drop-in is an unavoidable gratuitous cp).

The flow of BOOTFS{,FLAGS} from zfs-env-bootfs.service to sysroot.mount
is not noted explicitly in dracut.zfs(7), because (a) at some point it's
just visual noise and (b) it's already ordered via d-p-m.s from z-i.t.

Backport-of: 3399a30ee02d0d31ba2d43d0ce0a2fd90d5c575d
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
15 months agoepair tests: test PCP tagged packets
Kristof Provost [Mon, 10 Apr 2023 10:55:10 +0000 (12:55 +0200)]
epair tests: test PCP tagged packets

PR: 270736
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39483

(cherry picked from commit d116b8430b90212e308fe9945038c7bd98edf1bc)

15 months agoif_epair: also remove vlan metadata from mbufs
Kristof Provost [Mon, 10 Apr 2023 11:02:55 +0000 (13:02 +0200)]
if_epair: also remove vlan metadata from mbufs

We already remove mbuf tags from packets transitting an if_epair, but we
didn't remove vlan metadata.
In certain configurations this could lead to unexpected vlan tags
turning up on the rx side.

PR: 270736
Reviewed by: markj
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39482

(cherry picked from commit c69ae8419734829404bdb47d694d105c85f9835e)

15 months agoarm: Remove a double word in a comment in setjmp
Gordon Bergling [Thu, 13 Apr 2023 18:37:25 +0000 (20:37 +0200)]
arm: Remove a double word in a comment in setjmp

- s/number number/number/

(cherry picked from commit 26713ad9cf18b6ecd37f862182c84c1e57aee091)

15 months agokern: remove a double word in a KASSERT in subr_trap
Gordon Bergling [Thu, 13 Apr 2023 18:03:37 +0000 (20:03 +0200)]
kern: remove a double word in a KASSERT in subr_trap

- s/with with/with/

(cherry picked from commit c159f76713d7c1cbfdfc0c81dd91a5483096cf6f)

15 months agotmpfs: MFC: unbreak module build outside of kernel build environment
Eugene Grosbein [Sat, 15 Apr 2023 04:00:03 +0000 (11:00 +0700)]
tmpfs: MFC: unbreak module build outside of kernel build environment

(cherry picked from commit 5ee1c90e50ce8832c79aa61c8c2bbb71bd097799)

15 months agoarm64: nexus code tidy-up
Mitchell Horne [Fri, 10 Feb 2023 14:26:53 +0000 (10:26 -0400)]
arm64: nexus code tidy-up

Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38495

(cherry picked from commit e582d4a2b09e679baae457b50c7270b4a9f501bf)

15 months agoarm: nexus code tidy-up
Mitchell Horne [Mon, 6 Feb 2023 15:57:33 +0000 (11:57 -0400)]
arm: nexus code tidy-up

Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38495

(cherry picked from commit c650e1949558c1993d7486859ad9804fd582129e)

15 months agopowerpc: nexus code tidy-up
Mitchell Horne [Fri, 10 Feb 2023 14:37:08 +0000 (10:37 -0400)]
powerpc: nexus code tidy-up

Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

Update the top-level comment to be closer to other nexus
implementations.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38495

(cherry picked from commit c514686aa06a08a97df051a75da9ea7964a74fb0)

15 months agoriscv: nexus code tidy-up
Mitchell Horne [Mon, 6 Feb 2023 15:53:09 +0000 (11:53 -0400)]
riscv: nexus code tidy-up

Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38495

(cherry picked from commit abe3309e71b94527e937f034dd81ca7d6afdeb67)

15 months agox86: nexus code tidy-up
Mitchell Horne [Fri, 10 Feb 2023 14:52:38 +0000 (10:52 -0400)]
x86: nexus code tidy-up

Make a pass at the various nexus implementations, fixing some very minor
style issues, obsolete comments, etc.

The method declaration section has become unwieldy in many respects.
Attempt to tame it by:
 - Using generated method typedefs
 - Grouping methods roughly by category, and then alphabetically.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D38495

(cherry picked from commit 99bd5c1fe32272ce6e8d9b2d575b42dd94593b25)

15 months agoofwbus: only allow unit number zero
Mitchell Horne [Mon, 13 Feb 2023 17:44:03 +0000 (13:44 -0400)]
ofwbus: only allow unit number zero

ofwbus has always been the root of attachment for OFW/FDT platforms. It
may have simplebus children, but we expect only one instance of the
ofwbus driver, added directly by nexus. We may as well ensure this
remains the case.

Reviewed by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38493

(cherry picked from commit afca197f5240ce2c2c7abfe5c9fbc50ba55f178b)

15 months agoofwbus: remove arm64 ifdefs
Mitchell Horne [Mon, 13 Feb 2023 17:43:25 +0000 (13:43 -0400)]
ofwbus: remove arm64 ifdefs

Rather than using the DEVICE_IDENTIFY method, let's have other
ofwbus-using platforms add ofwbus0 explicitly in nexus, like arm64. This
gives them the same flexibility, e.g. if riscv starts supporting ACPI,
and cleans up the #ifdefs.

We were doing this already on riscv, but adjust the 'order' parameters.

Reviewed by: andrew, jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38492

(cherry picked from commit 53d5e65eead0f713c5e256018d46edbec0a96c11)

15 months agoofwbus: remove handling of resources from ofwbus
Elliott Mitchell [Wed, 8 Feb 2023 20:17:03 +0000 (16:17 -0400)]
ofwbus: remove handling of resources from ofwbus

The architecture nexus should handle allocation and release of memory and
interrupts. This is to ensure that system-wide resources such as these
are available to all devices, not just children of ofwbus0.

On powerpc this moves the ownership of these resources up one level,
from ofwbus0 to nexus0. Other architectures already have the required
logic in their nexus implementation, so this eliminates the duplication
of resources. An implementation of nexus_adjust_resource() is added for
arm, arm64, and riscv.

As noted by ian@ in the review, resource handling was the main bit of
logic distinguishing ofwbus from simplebus. With some attention to
detail, it should be possible to merge the two in the future.

Co-authored by: mhorne
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30554

(cherry picked from commit f9bdaab95ec469738fbfc1f0edd3e8c744b7f71f)

15 months agophysmem: add ram0 pseudo-driver
Mitchell Horne [Thu, 27 May 2021 14:27:40 +0000 (11:27 -0300)]
physmem: add ram0 pseudo-driver

Its purpose is to reserve all I/O space belonging to physical memory
from nexus, preventing it from being handed out by bus_alloc_resource()
to callers such as xenpv_alloc_physmem(), which looks for the first
available free range it can get. This mimics the existing pseudo-driver
on x86.

If needed, the device can be disabled with hint.ram.0.disabled="1" in
/boot/device.hints.

Reviewed by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D32343

(cherry picked from commit e6cf1a0826c9d7f229e41224ec7b783501636528)

15 months agoarm: add an interrupt rman to nexus
Mitchell Horne [Sun, 5 Dec 2021 15:27:50 +0000 (11:27 -0400)]
arm: add an interrupt rman to nexus

Allow the nexus bus to own and manage interrupt resources. Currently,
interrupt resources on this architecture are managed completely by
ofwbus, but it is desirable that system-wide memory and interrupt
resources be managed by the top-level bus.

This is a pre-requisite to moving this resource management out of
ofwbus.

Reviewed By: ian, Elliott Mitchell <ehem+freebsd@m5p.com>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D32357

(cherry picked from commit 1d03c3578d05b011dc714ec0735a5783c421530b)

15 months agoofw: fix memory leak in ofwbus_attach()
Christos Margiolis [Mon, 10 Apr 2023 15:31:46 +0000 (15:31 +0000)]
ofw: fix memory leak in ofwbus_attach()

PR: 269509
Reported by: Jaroslaw Pelczar <jarek@jpelczar.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38903

(cherry picked from commit 38594ff9c0c9568b5082ba3273103904a6afd38e)

15 months agoawk: errror on printf format strings lacking conversion specifier
Ed Maste [Fri, 14 Apr 2023 14:49:05 +0000 (10:49 -0400)]
awk: errror on printf format strings lacking conversion specifier

Reported by: phk
Reviewed by: imp, markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39573

(cherry picked from commit 5dbd073b045c8e98730c025a4acf2279be26c33e)

15 months agoiicbus(4): Use the existing CTLFLAG_RWTUN flag definition
Zhenlei Huang [Wed, 12 Apr 2023 04:20:38 +0000 (12:20 +0800)]
iicbus(4): Use the existing CTLFLAG_RWTUN flag definition

Use it when possible, instead of separated flags.

No functional change intended.

Reviewed by: hselasky, erj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39466

(cherry picked from commit deac4c7f0753841de8da4d7f37d7e49620b3bbb4)

15 months agobxe(4): Use CTLFLAG_RDTUN flag definition
Zhenlei Huang [Wed, 12 Apr 2023 04:20:38 +0000 (12:20 +0800)]
bxe(4): Use CTLFLAG_RDTUN flag definition

sysctl variables rx_budget and max_aggregation_size are read-only loader
tunable. Mark them with CTLFLAG_RD flag.

No functional change intended.

Reviewed by: hselasky, erj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39466

(cherry picked from commit 8bd9afe9e1821368f4bb0d39c8c6703bf5007fd1)

15 months agoice(4): Use the existing CTLFLAG_RWTUN flag definition
Zhenlei Huang [Wed, 12 Apr 2023 04:20:38 +0000 (12:20 +0800)]
ice(4): Use the existing CTLFLAG_RWTUN flag definition

Use it when possible, instead of separated flags.

No functional change intended.

Reviewed by: hselasky, erj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39466

(cherry picked from commit 5ff8018108278d06e024676c539e9f60f8189e83)

15 months agocam iosched: Use the existing CTLFLAG_RDTUN and CTLFLAG_RWTUN flag definitions
Zhenlei Huang [Wed, 12 Apr 2023 04:20:38 +0000 (12:20 +0800)]
cam iosched: Use the existing CTLFLAG_RDTUN and CTLFLAG_RWTUN flag definitions

Use them when possible, instead of separated flags.

No functional change intended.

Reviewed by: hselasky, erj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39466

(cherry picked from commit 69cb72b8728ba605d6cc8758480eca3fc6fd2ed6)

15 months agopowerpc: Use the existing CTLFLAG_RDTUN and CTLFLAG_RWTUN flag definitions
Zhenlei Huang [Wed, 12 Apr 2023 04:20:38 +0000 (12:20 +0800)]
powerpc: Use the existing CTLFLAG_RDTUN and CTLFLAG_RWTUN flag definitions

Use them when possible, instead of separated flags.

No functional change intended.

Reviewed by: hselasky, erj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39466

(cherry picked from commit dc1c5138c3255cc9004a3842001ed6c5db8f4ea3)

15 months agovimage.8: Remove a double word
Gordon Bergling [Thu, 13 Apr 2023 18:22:25 +0000 (20:22 +0200)]
vimage.8: Remove a double word

- s/are are/are/

(cherry picked from commit e0c2f93029850968712a4fb4ab3630579d8812d3)