]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 weeks agosrc.conf.5: Regenerate
Mark Johnston [Wed, 3 Apr 2024 17:45:25 +0000 (13:45 -0400)]
src.conf.5: Regenerate

7 weeks agolibvmmapi: Conditionalize compilation of some functions
Mark Johnston [Wed, 3 Apr 2024 17:45:06 +0000 (13:45 -0400)]
libvmmapi: Conditionalize compilation of some functions

Hide definitions of several functions that currently don't have
implementatations in the arm64 vmm port.  In particular, add a
WITH_VMMAPI_SNAPSHOT preprocessor variable that can be used to enable
compilation of save/restore functions, and conditionalize compilation of
some functions only used by amd64 bhyve.  If in the long term they
remain amd64-only, they can move to vmmapi_machdep.c, but for now it's
not clear to me that that's the right thing to do.

MFC after: 2 weeks
Sponsored by: Innovate UK

7 weeks agobhyve: Push option parsing down into bhyverun_machdep.c
Mark Johnston [Wed, 3 Apr 2024 17:44:40 +0000 (13:44 -0400)]
bhyve: Push option parsing down into bhyverun_machdep.c

After a couple of attempts I think this is the cleanest approach despite
the expense of some code duplication.  Quite a few of the single-letter
bhyve options are x86-specific.

I think that going forward we should strongly discourage the addition of
new options and instead configure guests using the more general
configuration file syntax.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41753

7 weeks agoarm64: Connect bhyve and libvmmapi to the build
Mark Johnston [Wed, 3 Apr 2024 17:44:29 +0000 (13:44 -0400)]
arm64: Connect bhyve and libvmmapi to the build

Reviewed by: corvink, andrew, jhb, emaste
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41742

7 weeks agobhyve: Partially disable INT#x support in virtio for arm64
Mark Johnston [Wed, 3 Apr 2024 17:43:48 +0000 (13:43 -0400)]
bhyve: Partially disable INT#x support in virtio for arm64

A FreeBSD guest won't make use of this support and pci_lintr_* is not
implemented on arm64.  Simply make pci_lintr_*() calls amd64-specific
for now.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41741

7 weeks agobhyve: Use vm_raise_msi() instead of vm_lapic_msi()
Mark Johnston [Wed, 3 Apr 2024 17:43:35 +0000 (13:43 -0400)]
bhyve: Use vm_raise_msi() instead of vm_lapic_msi()

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41740

7 weeks agobhyve: Add PCI mappings for arm64
Mark Johnston [Wed, 3 Apr 2024 17:11:37 +0000 (13:11 -0400)]
bhyve: Add PCI mappings for arm64

- The extended config space and BAR ranges are listed in the FDT.
- Avoid referencing I/O ports in ACPI tables.  Currently the arm64 port
  does not support ACPI in any case.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41739

7 weeks agobhyve: Do not compile PCI passthrough support on arm64
Mark Johnston [Wed, 3 Apr 2024 17:11:24 +0000 (13:11 -0400)]
bhyve: Do not compile PCI passthrough support on arm64

Some required kernel functionality is not yet implemented.

For now this means that one cannot specify host PCI register values, but
that functionality is only used by amd64-specific device models for now.
Note that this limitation is rather artificial; it arises only because
pci_host_read_config() lives in pci_passthru.c.

Reviewed by: corvink, andrew, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41738

7 weeks agobhyve: Add bhyverun and vmexit handlers for arm64
Andrew Turner [Wed, 3 Apr 2024 17:10:41 +0000 (13:10 -0400)]
bhyve: Add bhyverun and vmexit handlers for arm64

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

7 weeks agolibvmmapi: Zero out the structure passed to VM_GET_MEMSEG
Mark Johnston [Wed, 3 Apr 2024 17:09:43 +0000 (13:09 -0400)]
libvmmapi: Zero out the structure passed to VM_GET_MEMSEG

Avoid assuming that the kernel zeros the name buffer, it does not do
this for zero-length segments.

MFC after: 2 weeks
Sponsored by: Innovate UK

7 weeks agolibvmmapi: Make vm_raise_msi() a common function
Mark Johnston [Wed, 3 Apr 2024 17:09:32 +0000 (13:09 -0400)]
libvmmapi: Make vm_raise_msi() a common function

Currently, bhyve PCI emulation uses vm_lapic_msi() to raise an MSI in
the guest.  The arm64 port has a similar function, vm_raise_msi().
Add vm_raise_msi() on amd64 as well and have it simply call
vm_lapic_msi() so that bhyve can use a common, generically named
function.

Reviewed by: corvink, andrew, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41752

7 weeks agolibvmmapi: Add arm64 support
Mark Johnston [Wed, 3 Apr 2024 17:07:51 +0000 (13:07 -0400)]
libvmmapi: Add arm64 support

- Define wrappers for some MD ioctls.
- Provide a list of vmm device ioctls for cap_ioctl_limit().
- Disable use of the lowmem region.

Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41005

7 weeks agolibvmmapi: Make memory segment handling a bit more abstract
Mark Johnston [Wed, 3 Apr 2024 17:01:31 +0000 (13:01 -0400)]
libvmmapi: Make memory segment handling a bit more abstract

libvmmapi leaves a hole at [3GB, 4GB) in the guest physical address
space.  This hole is not used in the arm64 port, which maps everything
above 4GB.  This change makes the code a bit more general to accomodate
arm64 more naturally.  In particular:

- Remove vm_set_lowmem_limit(): it is unused and doesn't have
  well-defined constraints, e.g., nothing prevents a consumer from
  setting a lowmem limit above the highmem base.
- Define a constant for the highmem base and use that everywhere that
  the base is currently hard-coded.
- Make the lowmem limit a compile-time constant instead of a vmctx field.
- Store segment info in an array.
- Add vm_get_highmem_base(), for use in bhyve since the current value is
  hard-coded in some places.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41004

7 weeks agolibvmmapi: Move PCI passthrough ioctl wrappers into a separate file
Mark Johnston [Wed, 3 Apr 2024 16:56:22 +0000 (12:56 -0400)]
libvmmapi: Move PCI passthrough ioctl wrappers into a separate file

The arm64 port doesn't implement PCI passthrough and in particular
doesn't define the ioctls used by these wrappers.  It might be that the
ppt ioctl interface will require modification to support arm64.  Until
that's sorted out one way or another, put this code in a separate file
so that it's easy to conditionally compile.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41003

7 weeks agolibvmmapi: Move more amd64-specific ioctl wrappers to vmmapi_machdep.c
Mark Johnston [Wed, 3 Apr 2024 16:56:11 +0000 (12:56 -0400)]
libvmmapi: Move more amd64-specific ioctl wrappers to vmmapi_machdep.c

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41002

7 weeks agolibvmmapi: Split the ioctl list into MI and MD lists
Mark Johnston [Wed, 3 Apr 2024 16:55:54 +0000 (12:55 -0400)]
libvmmapi: Split the ioctl list into MI and MD lists

To enable use in capability mode, libvmmapi needs a list of all the
ioctls that might be invoked on the vmm device handle.  Some of these
ioctls are amd64-specific.  Move the ioctl list to vmmapi_machdep.c and
define a list of MI ioctls so that the arm64 port can build its own list
without duplicating common ioctls.  No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41001

7 weeks agolibvmmapi: Move VM capability names to vmmapi_machdep.c
Mark Johnston [Wed, 3 Apr 2024 16:55:36 +0000 (12:55 -0400)]
libvmmapi: Move VM capability names to vmmapi_machdep.c

Add some missing entries while here.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41000

7 weeks agolibvmmapi: Move some ioctl wrappers to vmmapi_machdep.c
Mark Johnston [Wed, 3 Apr 2024 16:52:25 +0000 (12:52 -0400)]
libvmmapi: Move some ioctl wrappers to vmmapi_machdep.c

ioctls relating to segments and various x86-specific interrupt
controllers are easy candidates to move to vmmapi_machdep.c.

In vmmapi.h I'm just ifdefing MD prototypes for now.  We could instead
split vmmapi.h into multiple headers, e.g., vmmapi.h and
vmmapi_machdep.h, but it's not obvious to me yet that that's the right
approach.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40999

7 weeks agolibvmmapi: Add a subdirectory for amd64-specific code
Mark Johnston [Wed, 3 Apr 2024 16:52:00 +0000 (12:52 -0400)]
libvmmapi: Add a subdirectory for amd64-specific code

Move vmmapi_freebsd.c there.  It contains x86-specific code used only by
bhyveload(8).

Move vcpu_reset() into vmmapi_machdep.c.  It is also x86-specific.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40998

7 weeks agobhyve: Use vm_get_highmem_base() instead of hard-coding the value
Mark Johnston [Wed, 3 Apr 2024 16:51:37 +0000 (12:51 -0400)]
bhyve: Use vm_get_highmem_base() instead of hard-coding the value

This reduces the coupling between libvmmapi (which creates the highmem
segment) and bhyve, in preparation for the arm64 port.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40992

7 weeks agobhyve: Add FDT building code for arm64
Mark Johnston [Wed, 3 Apr 2024 16:50:21 +0000 (12:50 -0400)]
bhyve: Add FDT building code for arm64

fdt.c provides some basic routines which let platform initialization
code build the FDT that gets passed into the guest.  For now this is not
very generic; we declare info about CPUs, memory, a single UART
(specified by -o console), a PCIe controller (used for virtio devices),
an interrupt controller and the platform timer.

Co-authored-by: andrew
Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40996

7 weeks agobhyve: Provide optional libfdt linking
Mark Johnston [Wed, 3 Apr 2024 16:48:45 +0000 (12:48 -0400)]
bhyve: Provide optional libfdt linking

The arm64 port currently does not support ACPI, it instead builds up an
FDT which is exported to the guest.  This mechanism will not be used on
amd64 but isn't really arm64-specific either, so provide an opt-in
mechanism to link libfdt.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40995

7 weeks agobhyve: Add PL011 UART emulation
Andrew Turner [Wed, 3 Apr 2024 16:46:43 +0000 (12:46 -0400)]
bhyve: Add PL011 UART emulation

This will be use for arm64 guests, instead of the existing ns16550 UART
model.

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

7 weeks agosys_procctl(): Make it clear that negative commands are invalid
Olivier Certner [Wed, 10 Apr 2024 14:32:32 +0000 (16:32 +0200)]
sys_procctl(): Make it clear that negative commands are invalid

An initial reading of the preamble of sys_procctl() gives the impression
that no test prevents a malicious user from passing a negative commands
index (in 'uap->com'), which is soon used as an index into the static
array procctl_cmds_info[].

However, a closer examination leads to the conclusion that the existing
code is technically correct.  Indeed, the comparison of 'uap->com' to
the nitems() expression, which expands to a ratio of sizeof(), leads to
a conversion of 'uap->com' to an 'unsigned int' as per Usual Arithmetic
Conversions/Integer Promotions applied by '<=', because sizeof() returns
'size_t' values, and we define 'size_t' as an equivalent of 'unsigned
int' (which is not mandated by the standard, the latter allowing, e.g.,
integers of lower ranks).

With this conversion, negative values of 'uap->com' are automatically
ruled-out since they are converted to very big unsigned integers which
are caught by the test.  An analysis of assembly code produced by LLVM
16 on amd64 and practical tests confirm that no exploitation is possible.

However, the guard code as written is misleading to readers and might
trip up static analysis tools.  Make sure that negative values are
explicitly excluded so that it is immediately clear that EINVAL will be
returned in this case.

Build tested with clang 16 and GCC 12.

Approved by:    markj (mentor)
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

7 weeks agotcp: Make tcp_var.h more self-contained
Mark Johnston [Mon, 8 Apr 2024 17:37:25 +0000 (13:37 -0400)]
tcp: Make tcp_var.h more self-contained

struct tcpcb embeds a struct osd and a struct callout.  Rather than
forcing all consumers to pull in the same headers, include the headers
directly.

No functional change intended.

Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44685

7 weeks agovm_reserv_reclaim_contig: Return NULL not false
Minsoo Choo [Wed, 10 Apr 2024 12:49:26 +0000 (12:49 +0000)]
vm_reserv_reclaim_contig: Return NULL not false

Reviewed by: dougm, zlei
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44667

7 weeks agopciconf(8): dump AMD IOMMU Base Capability
Konstantin Belousov [Tue, 9 Apr 2024 22:13:59 +0000 (01:13 +0300)]
pciconf(8): dump AMD IOMMU Base Capability

Reviewed by: emaste
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44732

7 weeks agopcireg.h: Add AMD IOMMU Base Cap definitions
Konstantin Belousov [Sun, 7 Apr 2024 01:25:46 +0000 (04:25 +0300)]
pcireg.h: Add AMD IOMMU Base Cap definitions

Reviewed by: emaste
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44732

7 weeks agopcireg.h: add include guard
Konstantin Belousov [Sun, 7 Apr 2024 01:27:46 +0000 (04:27 +0300)]
pcireg.h: add include guard

Reviewed by: emaste
Sponsored by: Advanced Micro Devices (AMD)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44732

7 weeks agolibbe(3): history: fix
Graham Perrin [Thu, 5 Oct 2023 03:45:22 +0000 (04:45 +0100)]
libbe(3): history: fix

'bectl(8) and libbe' (not 'libbe and libbe(3)').

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/857

7 weeks agolibbe(3): consistency, and authors
Graham Perrin [Thu, 5 Oct 2023 02:45:04 +0000 (03:45 +0100)]
libbe(3): consistency, and authors

Consistency with the manual page for bectl(8), including addition of an
AUTHORS section.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/857

7 weeks agobectl(8): authors: Kyle Evans: fine-tune
Graham Perrin [Thu, 5 Oct 2023 02:30:35 +0000 (03:30 +0100)]
bectl(8): authors: Kyle Evans: fine-tune

Discussed with Kyle in Discord.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/857

7 weeks agobectl(8): authors: be more explicit
Graham Perrin [Thu, 5 Oct 2023 02:03:58 +0000 (03:03 +0100)]
bectl(8): authors: be more explicit

Cross-reference (name) the manual page that was written by Bryan
Drewery.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/857

7 weeks agobectl(8): HISTORY, AUTHORS: further attention
Graham Perrin [Tue, 3 Oct 2023 12:07:18 +0000 (13:07 +0100)]
bectl(8): HISTORY, AUTHORS: further attention

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/857

7 weeks agobectl(8): corrections, changes
Graham Perrin [Tue, 3 Oct 2023 09:08:16 +0000 (10:08 +0100)]
bectl(8): corrections, changes

beadm(1) no longer exists.

Cross-reference beadm(8).

Aim to improve the HISTORY and AUTHORS sections, including consistency
with the manual pages for beadm(8) and libbe(3).

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/857

7 weeks agoexit.3: add the comma after an empty space
rilysh [Wed, 10 Apr 2024 03:36:10 +0000 (21:36 -0600)]
exit.3: add the comma after an empty space

exit(3) man page shows __cxa_atexit(3,) instead of __cxa_atexit(3), in a
particular section. It seems the comma gets inside the parenthesis and
with an extra space, it can be viewed as expected.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1006

7 weeks agoReapply "release.sh: Add -jN to `make release`"
Colin Percival [Wed, 10 Apr 2024 03:27:44 +0000 (20:27 -0700)]
Reapply "release.sh: Add -jN to `make release`"

With the latest changes to release/Makefile, it is now possible to
run `make release -jN` without the build failing (at least in my
latest tests).

This reverts commit 7b707e797b2cd6265ba8f6215e59445e9efb9e97.

MFC after: 1 week

7 weeks agorelease: Don't reuse disc1/bootonly directories
Colin Percival [Wed, 10 Apr 2024 03:27:19 +0000 (20:27 -0700)]
release: Don't reuse disc1/bootonly directories

The disc1 and bootonly directories have files distributed into them
for use in "full" and "mini" images; the former are disc1.iso and
memstick.img, and the latter is bootonly.iso and mini-memstick.img.

Unfortunately the scripts which package a directory tree into an ISO
or memory stick image also modify the directory, for example to
create an appropriate /etc/fstab file; so creating two images at the
same time breaks.

Resolve this by copying disc1 to disc1-disc1 and disc1-memstick,
and copying bootonly to bootonly-bootonly and bootonly-memstick,
before using those directories for constructing the ISO+memstick
images.

MFC after: 1 week

7 weeks agorelease: distributekernel before packagekernel
Colin Percival [Wed, 10 Apr 2024 03:26:51 +0000 (20:26 -0700)]
release: distributekernel before packagekernel

With these as a single make command, `make -j` breaks when it tries to
package up a kernel which hasn't been distributed yet.

MFC after: 1 week

7 weeks agorelease: make -j compat: cd inside subshell
Colin Percival [Wed, 10 Apr 2024 03:25:34 +0000 (20:25 -0700)]
release: make -j compat: cd inside subshell

Place instances of "cd foo && bar" inside subshells for compatibility
with modern make(8) which uses a single shell for the duration of a
makefile target.

MFC after: 1 week

7 weeks agobcm2838_xhci: add module
Lexi Winter [Wed, 10 Apr 2024 03:11:36 +0000 (21:11 -0600)]
bcm2838_xhci: add module

bcm2838_xhci(4) is a shim for the XHCI controller on the Raspberry Pi 4B
SoC.  It loads the controller's firmware before passing control to the
normal xhci(4) driver.

When xhci(4) is built as a module (and not in the kernel), bcm2838_xhci
is not built at all and the RPi4's XHCI controller won't attach due to
missing firmware.

To fix this, build a new module, bcm2838_xhci.ko, which depends on
xhci.ko.  For the dependency to work correctly, also modify xhci to
provide the 'xhci' module in addition to the 'xhci_pci' module it
already provided.

Since bcm2838_xhci is specific to a quirk of the RPi4 SoC, only build
the module for AArch64.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1142

7 weeks agotests: Add ktrace regression test for shm_open
Jake Freeland [Wed, 10 Apr 2024 02:18:11 +0000 (21:18 -0500)]
tests: Add ktrace regression test for shm_open

Verify that a capability violation is recorded when shm_open(2) is called
with a non-anonymous path.

Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44733

7 weeks agouipc_shm: Copyin userpath for ktrace(2)
Jake Freeland [Wed, 10 Apr 2024 02:17:11 +0000 (21:17 -0500)]
uipc_shm: Copyin userpath for ktrace(2)

If userpath is not SHM_ANON, then copy it in early so ktrace(2) can
record it. Without this change, ktrace(2) will attempt to strcpy a
userspace string and trigger a page fault.

Reported by: syzbot+490b9c2a89f53b1b9779@syzkaller.appspotmail.com
Fixes: 0cd9cde767c3
Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44702

7 weeks agounionfs_lookup(): fix wild accesses to vnode private data
Jason A. Harmening [Sun, 18 Feb 2024 00:19:32 +0000 (18:19 -0600)]
unionfs_lookup(): fix wild accesses to vnode private data

There are a few spots in which unionfs_lookup() accesses unionfs vnode
private data without holding the corresponding vnode lock or interlock.

Reviewed by: kib, olce
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44601

7 weeks agoNOTES: Move NVMe entries to MI file
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Move NVMe entries to MI file

While here, adjust the sample setting for NVME_USE_NVD to use a
non-default setting as is typical in entries in NOTES.

Discussed with: imp
Reviewed by: manu
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44691

7 weeks agosys: Enable NVMe drivers on all architectures
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
sys: Enable NVMe drivers on all architectures

The NVMe drivers are portable and are already included statically in
GENERIC on other architectures such as aarch64 and riscv64.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44690

7 weeks agoNOTES: Tidy entries for SATA controllers
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Tidy entries for SATA controllers

- Add typical comments after device entries (copied from amd64
  GENERIC)

- Add an entry for 'device ada'.  Normally this is pulled in via
  'device sd', but is documented in ada(4) and can be used to include
  ATA/SATA disk support in a kernel without SCSI disk support.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44689

7 weeks agoNOTES: Add devices for iSCSI support
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Add devices for iSCSI support

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44688

7 weeks agoiser: Add kernel build glue
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
iser: Add kernel build glue

'device iser' is documented in iser(4) but not supported.  Hook it up
to the build.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44687

7 weeks agoNOTES: Move OFED options to MI NOTES
John Baldwin [Tue, 9 Apr 2024 22:02:58 +0000 (15:02 -0700)]
NOTES: Move OFED options to MI NOTES

Disable in armv7 NOTES to match sys/modules/Makefile

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44686

7 weeks agoperiodic/daily/801.trim-zfs: Add a daily zfs trim script
Lexi Winter [Tue, 9 Apr 2024 21:49:56 +0000 (15:49 -0600)]
periodic/daily/801.trim-zfs: Add a daily zfs trim script

As mentioned in zpoolprops(7), on some SSDs, it may not be desirable to
use ZFS autotrim because a large number of trim requests can degrade
disk performance; instead, the pool should be manually trimmed at
regular intervals.

Add a new daily periodic script for this purpose, 801.trim-zfs.  If
enabled (daily_trim_zfs_enable=YES; the default is NO), it will run a
'zpool trim' operation on all online pools, or on the pools listed in
'daily_trim_zfs_pools'.

The trim is not started if the pool is degraded (which matches the
behaviour of the existing 800.scrub-zfs script) or if a trim is already
running on that pool.  Having autotrim enabled does not inhibit the
periodic trim; it's sometimes desirable to run periodic trims even with
autotrim enabled, because autotrim can elide trims for very small
regions.

PR: 275965
MFC after: 1 week
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/956

7 weeks agopci_host_generic: Tolerate range resource allocation failures
John Baldwin [Tue, 9 Apr 2024 21:55:40 +0000 (14:55 -0700)]
pci_host_generic: Tolerate range resource allocation failures

QEMU for armv7 includes a PCI memory range whose CPU address is
greater than 4GB.  This falls outside the range of armv7's global
mem_rman used by the nexus driver.  As a result, pcib0 fails to
attach blocking all PCI devices.

Instead, change the driver to be a bit more tolerant.  If allocating a
resource for a range fails, don't fail attaching the entire driver,
but do skip adding the associated PCI range to the relevant rman in
the pcib driver.  This will prevent child devices from using BARs that
allocate from this range.  In the case of QEMU on armv7 devices can
still allocate from an earlier PCI memory range that is within the
32-bit address space (and in fact none of the firmware-assigned memory
BARs use addresses from the upper range).

While here, reorder the operations on I/O ranges a bit: 1) print the
range under bootverbose first (rather than last) so that the range is
printed before any relevant errors for the range, 2) move
rman_manage_region last after the parent resource has been set and
allocated.

Reported by: markj, Jenkins
Reviewed by: markj
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision: https://reviews.freebsd.org/D44698

7 weeks agoRevert "unix: new implementation of unix/stream & unix/seqpacket"
Gleb Smirnoff [Tue, 9 Apr 2024 20:15:16 +0000 (13:15 -0700)]
Revert "unix: new implementation of unix/stream & unix/seqpacket"

The regressions in aio(4) and kernel RPC aren't a 5 minute problem.

This reverts commit d80a97def9a1db6f07f5d2e68f7ad62b27918947.
This reverts commit d1cbb17a873c787a527316bbb27551e97d5ad30c.
This reverts commit fb8a8333b481cc4256d0b3f0b5b4feaa4594e01f.

7 weeks agoconfig.mk: Add MK_VIMAGE knob
Stephen J. Kiernan [Tue, 9 Apr 2024 17:04:24 +0000 (13:04 -0400)]
config.mk: Add MK_VIMAGE knob

Default to VIMAGE as yes.
Add VIMAGE to __DEFAULT_DEPENDENT_OPTIONS (to define VIMAGE_SUPPORT)

Only output VIMAGE to opt_global.h when VIMAGE support is wanted.

Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39636

7 weeks agoarm64 pmap: Add ATTR_CONTIGUOUS support [Part 2]
Alan Cox [Mon, 8 Apr 2024 05:05:54 +0000 (00:05 -0500)]
arm64 pmap: Add ATTR_CONTIGUOUS support [Part 2]

Create ATTR_CONTIGUOUS mappings in pmap_enter_object().  As a result,
when the base page size is 4 KB, the read-only data and text sections
of large (2 MB+) executables, e.g., clang, can be mapped using 64 KB
pages.  Similarly, when the base page size is 16 KB, the read-only
data section of large executables can be mapped using 2 MB pages.

Rename pmap_enter_2mpage().  Given that we have grown support for 16 KB
base pages, we should no longer include page sizes that may vary, e.g.,
2mpage, in pmap function names.  Requested by: andrew

Co-authored-by: Eliot Solomon <ehs3@rice.edu>
Differential Revision: https://reviews.freebsd.org/D44575

7 weeks agorpc: use new macros to lock socket buffers
Gleb Smirnoff [Tue, 9 Apr 2024 16:17:19 +0000 (09:17 -0700)]
rpc: use new macros to lock socket buffers

Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947

7 weeks agovm: add macro to mark arguments used when NUMA is defined
Stephen J. Kiernan [Wed, 3 Apr 2024 21:05:24 +0000 (17:05 -0400)]
vm: add macro to mark arguments used when NUMA is defined

This fixes compiler warnings when -Wunused-arguments is enabled and
not quieted.

Reviewed by: kib, markj
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44623

7 weeks agong_socket: Treat EEXIST from kern_kldload() as success
Zhenlei Huang [Tue, 9 Apr 2024 10:04:47 +0000 (18:04 +0800)]
ng_socket: Treat EEXIST from kern_kldload() as success

EEXIST is possible in a race condition.

Inspired by: ffc72591b1f5 (Don't worry if a module is already loaded ...)
Reviewed by: glebius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44633

7 weeks agomountd.8: Document the new -A mountd option
Rick Macklem [Tue, 9 Apr 2024 01:58:40 +0000 (18:58 -0700)]
mountd.8: Document the new -A mountd option

Commit fefb7c399b39 added warning messages noting
that administrative controls that exported directories
that are not local server file system mount points actually
export the entire local server file system.
This commit also added a new command line option "-A' that
silences these warnings.

This patch documents the new "-A' mountd option.

This is a content change.

Reviewed by: markj, pauamma_gundo.com (manpages)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44692

7 weeks agosockets: Add hhook in sonewconn for inheriting OSD specific data
Stephen J. Kiernan [Tue, 9 Apr 2024 01:31:34 +0000 (21:31 -0400)]
sockets: Add hhook in sonewconn for inheriting OSD specific data

Added HHOOK_SOCKET_NEWCONN and bumped HHOOK_SOCKET_LAST

Reviewed by: glebius, tuexen
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44632

7 weeks agounix: return immediately on MSG_OOB
Gleb Smirnoff [Tue, 9 Apr 2024 00:09:16 +0000 (17:09 -0700)]
unix: return immediately on MSG_OOB

Jumping to cleanup routines will work on uninitialized stack mc.

Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947
Reported-by: syzbot+4adf0b37849ea7723586@syzkaller.appspotmail.com

7 weeks agounix: fix the ad hoc STAILQ_PREPEND()
Gleb Smirnoff [Tue, 9 Apr 2024 00:02:00 +0000 (17:02 -0700)]
unix: fix the ad hoc STAILQ_PREPEND()

If there is nothing to prepend, don't try STAILQ_INSERT_HEAD().

Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947
Reported-by: syzbot+bb7f3d07c79b5faf8de8@syzkaller.appspotmail.com
7 weeks agoicmp: correct the assertion that checks limit + jitter
Gleb Smirnoff [Mon, 8 Apr 2024 23:54:19 +0000 (16:54 -0700)]
icmp: correct the assertion that checks limit + jitter

Fixes: 4399e055ea610cdefa1470ad1ee614dd81ba5e56

7 weeks agocp: Never follow symbolic links in destination.
Dag-Erling Smørgrav [Mon, 8 Apr 2024 22:41:33 +0000 (00:41 +0200)]
cp: Never follow symbolic links in destination.

Historically, BSD cp has followed symbolic links in the destination
when copying recursively, while GNU cp has not.  POSIX is somewhat
vague on the topic, but both interpretations are within bounds.  In
33ad990ce974, cp was changed to apply the same logic for symbolic
links in the destination as for symbolic links in the source: follow
if not recursing (which is moot, as this situation can only arise
while recursing) or if the `-L` option was given.  There is no support
for this in POSIX.  We can either switch back, or go all the way.

Having carefully weighed the kind of trouble you can run into by
following unexpected symlinks up against the kind of trouble you can
run into by not following symlinks you expected to follow, we choose
to go all the way.

Note that this means we need to stat the destination twice: once,
following links, to check if it is or references the same file as the
source, and a second time, not following links, to set the dne flag
and determine the destination's type.

While here, remove a needless complication in the dne logic.  We don't
need to explicitly reject overwriting a directory with a non-directory,
because it will fail anyway.

Finally, add test cases for copying a directory to a symlink and
overwriting a directory with a non-directory.

MFC after: never
Relnotes:  yes
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44578

7 weeks agounix: new implementation of unix/stream & unix/seqpacket
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
unix: new implementation of unix/stream & unix/seqpacket

Provide protocol specific pr_sosend and pr_soreceive for PF_UNIX
SOCK_STREAM sockets and implement SOCK_SEQPACKET sockets as an extension
of SOCK_STREAM.  The change meets three goals: get rid of unix(4) specific
stuff in the generic socket code, provide a faster and robust unix/stream
sockets and bring unix/seqpacket much closer to specification.  Highlights
follow:

- The send buffer now is truly bypassed.  Previously it was always empty,
but the send(2) still needed to acquire its lock and do a variety of
tricks to be woken up in the right time while sleeping on it.  Now the
only two things we care about in the send buffer is the I/O sx(9) lock
that serializes operations and value of so_snd.sb_hiwat, which we can read
without obtaining a lock.  The sleep of a send(2) happens on the mutex of
the receive buffer of the peer.  A bulk send/recv of data with large
socket buffers will make both syscalls just bounce between owning the
receive buffer lock and copyin(9)/copyout(9), no other locks would be
involved.

- The implementation uses new mchain structure to manipulate mbuf chains.
Note that this required converting to mchain two functions that are shared
with unix/dgram: unp_internalize() and unp_addsockcred() as well as adding
a new shared one uipc_process_kernel_mbuf().  This induces some non-
functional changes in the unix/dgram code as well.  There is a space for
improvement here, as right now it is a mix of mchain and manually managed
mbuf chains.

- unix/seqpacket previously marked as PR_ADDR & PR_ATOMIC and thus treated
as a datagram socket by the generic socket code, now becomes a true stream
socket with record markers.

- unix/stream loses the sendfile(2) support.  This can be brought back,
but requires some work.  Let's first see if there is any interest in this
feature, except purely academical.

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44151

7 weeks agombuf: provide mc_uiotomc() a function to copy from uio(9) to mchain
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: provide mc_uiotomc() a function to copy from uio(9) to mchain

Implement m_uiotombuf() as a wrapper around mc_uiotomc().  The M_EXTPG is
left untouched.  The m_uiotombuf() is left as a compat KPI.  New code
should use either mc_uiotomc() or m_uiotombuf_nomap().

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44150

7 weeks agombuf: provide mc_get() that allocates struct mchain of given length
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: provide mc_get() that allocates struct mchain of given length

Implement m_getm2(), which is widely used via m_getm() macro, as a wrapper
around mc_get().  New code is advised to use mc_get().

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44149

7 weeks agombuf: add mc_split() that works on two struct mchain
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: add mc_split() that works on two struct mchain

It preserves tail points and all length/memory accounting, so that caller
doesn't need to do any extra traversals.  It doesn't respect M_PKTHDR but
it may be improved if needed.  It respects M_EOR, though.  First consumer
will be the new unix(4) SOCK_STREAM and SOCK_SEQPACKET.

Also provide much more simple mc_concat() that glues two chains back.

Reviewed by: markj
Differentail Revision: https://reviews.freebsd.org/D44148

7 weeks agombuf: provide new type for mbuf manipulation - mbuf chain
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
mbuf: provide new type for mbuf manipulation - mbuf chain

It tracks both the first mbuf and last mbuf, making it handy to use inside
functions that are interested in both. It also tracks length of data and
memory usage. It can be allocated on stack and passed to an mbuf
allocation or another mbuf manipulation function. It can be embedded into
some kernel facility internal structure representing most simple data
buffer. It uses modern queue(3) based linkage, but is also compatible with
old style m_next linkage. Transitioning older code to new type can be done
gradually - a code that doesn't understand the chain yet, can be supplied
with STAILQ_FIRST(&mc.mc_q). So you can have a mix of old style and new
style code in one function as a temporary solution.

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44147

7 weeks agosendfile: mark it explicitly as a TCP only feature
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
sendfile: mark it explicitly as a TCP only feature

Back in 2015 when it turned non-blocking, it was working with PF_UNIX
and it may still work.  However, the usefullness of such application
of sendfile(2) is questionable.  Disable the feature while unix/stream
is under refactoring.

Relnotes: yes

7 weeks agotests/unix_seqpacket: remove workaround for a kernel bug that is no longer
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:51 +0000 (13:16 -0700)]
tests/unix_seqpacket: remove workaround for a kernel bug that is no longer

7 weeks agotests/unix_seqpacket: test send(2) to a closed or aborted peer socket
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:50 +0000 (13:16 -0700)]
tests/unix_seqpacket: test send(2) to a closed or aborted peer socket

In both cases the kernel returns EPIPE and delivers SIGPIPE, unless
blocked or disabled.  The test isn't specific to SOCK_SEQPACKET, it is the
same for SOCK_STREAM.  Put the test into this file, since it has all
primitives to write this test tersely.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D44146

7 weeks agotests/unix_seqpacket: provide random data pumping test with MSG_EOR
Gleb Smirnoff [Mon, 8 Apr 2024 20:16:50 +0000 (13:16 -0700)]
tests/unix_seqpacket: provide random data pumping test with MSG_EOR

Allocate a big chunk of randomly initialized memory.  Send it to the peer
in random sized chunks, throwing MSG_EOR at randomly initialized offsets.
Receive into random sized chunks setting MSG_WAITALL randomly.  Check that
MSG_EORs where they should be, check that MSG_WAITALL is abode, but
overriden by MSG_EOR.  And finally memcmp() what we receive.

Reviewed by: asomers, tuexen
Differential Revision: https://reviews.freebsd.org/D43775

7 weeks agosys/queue.h: Add {LIST,TAILQ}_REPLACE().
Dag-Erling Smørgrav [Mon, 8 Apr 2024 18:16:40 +0000 (20:16 +0200)]
sys/queue.h: Add {LIST,TAILQ}_REPLACE().

MFC after: 1 week
Obtained from: NetBSD
Sponsored by: Klara, Inc.
Reviewed by: cperciva, imp
Differential Revision: https://reviews.freebsd.org/D44679

7 weeks agosys/queue.h: Whitespace cleanup.
Dag-Erling Smørgrav [Mon, 8 Apr 2024 18:16:35 +0000 (20:16 +0200)]
sys/queue.h: Whitespace cleanup.

MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44678

7 weeks agong_bridge: document the limitation brought in f961caf2184c
Gleb Smirnoff [Mon, 8 Apr 2024 17:48:22 +0000 (10:48 -0700)]
ng_bridge: document the limitation brought in f961caf2184c

7 weeks agong_bridge: allow to automatically assign numbers to new hooks
David Marker [Mon, 8 Apr 2024 17:48:22 +0000 (10:48 -0700)]
ng_bridge: allow to automatically assign numbers to new hooks

This will allow a userland machinery that orchestrates a bridge (e.g. a
jail or vm manager) to not double the number allocation logic.  See bug
278130 for longer description and examples.

Reviewed by: glebius, afedorov
Differential Revision: https://reviews.freebsd.org/D44615
PR: 278130

7 weeks agodebugnet: Fix logging of frame length
Zhenlei Huang [Mon, 8 Apr 2024 16:47:06 +0000 (00:47 +0800)]
debugnet: Fix logging of frame length

MFC after: 1 week

7 weeks agoethernet: Fix logging of frame length
Zhenlei Huang [Mon, 8 Apr 2024 16:44:33 +0000 (00:44 +0800)]
ethernet: Fix logging of frame length

Both the mbuf length and the total packet length are signed.

While here, update a stall comment to reflect the current practice.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42390

7 weeks agoecho(1): Add EXAMPLES
Fernando Apesteguía [Thu, 7 Sep 2023 13:27:49 +0000 (15:27 +0200)]
echo(1): Add EXAMPLES

While here add CAVEAT section and promote the use of printf(1)

Reviewed by: gbe@, imp@
Approved by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D43493

7 weeks agonetinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters
Kristof Provost [Thu, 18 Jan 2024 19:44:47 +0000 (20:44 +0100)]
netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters

When debugging network issues one common clue is an unexpectedly
incrementing error counter. This is helpful, in that it gives us an
idea of what might be going wrong, but often these counters may be
incremented in different functions.

Add a static probe point for them so that we can use dtrace to get
futher information (e.g. a stack trace).

For example:
dtrace -n 'mib:ip:count: { printf("%d", arg0); stack(); }'

This can be disabled by setting the following kernel option:
options  KDTRACE_NO_MIB_SDT

Reviewed by: gallatin, tuexen (previous version), gnn (previous version)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D43504

7 weeks agocapsicum.h: Include ktrace.h only in kernel
Jake Freeland [Mon, 8 Apr 2024 13:27:17 +0000 (08:27 -0500)]
capsicum.h: Include ktrace.h only in kernel

Fix cross build failure by including ktrace.h only when _KERNEL is
defined.

Fixes: 9bec84131215
Approved by: markj (mentor)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 weeks agolibvmmapi: add missing capability strings
Rob Norris [Mon, 8 Apr 2024 13:08:20 +0000 (13:08 +0000)]
libvmmapi: add missing capability strings

Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44642

7 weeks agobhyvectl: generate usage from options table
Rob Norris [Mon, 8 Apr 2024 13:07:32 +0000 (13:07 +0000)]
bhyvectl: generate usage from options table

The usage text had fallen out of sync with the actually available
options. Rather than keep them in sync by hand, just generate usage from
the available options.

Signed-off-by: Rob Norris <robn@despairlabs.com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44641

7 weeks agoswap_pager: Unbusy readahead pages after an I/O error
Mark Johnston [Mon, 8 Apr 2024 13:02:48 +0000 (09:02 -0400)]
swap_pager: Unbusy readahead pages after an I/O error

The swap pager itself allocates readahead pages, so should take care to
unbusy them after a read error, just as it does in the non-error case.

PR: 277538
Reviewed by: olce, dougm, alc, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44646

7 weeks agoLinuxKPI: Stub sysfs_remove_link in linux/sysfs.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Stub sysfs_remove_link in linux/sysfs.h

sysfs_create_link is stubbed already. Stub sysfs_remove_link too to be
feature-complete.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add want_init_on_free to linux/mm.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add want_init_on_free to linux/mm.h

want_init_on_free returns if heap memory zeroing on free is enabled.
FreeBSD does not zeroes heap memory on free().

Sponsored by: Serenity Cyber Security
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add ACPI_ID_LEN const to linux/mod_devicetable.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add ACPI_ID_LEN const to linux/mod_devicetable.h

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add pci_dev_id to linux/pci.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add pci_dev_id to linux/pci.h

It returns bus/device/function number for given PCI device.
Also add intermediate PCI_DEVID macro used in some drivers.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add the accelerator PCIe class
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:43 +0000 (09:47 +0300)]
LinuxKPI: Add the accelerator PCIe class

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add PTR_IF macro
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add PTR_IF macro

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add vm_flags_(clear|set) functions
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add vm_flags_(clear|set) functions

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Improve timer_shutdown_sync
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Improve timer_shutdown_sync

timer_shutdown_sync not only shutdowns a timer but prevents it rearming.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add get_random_u32_below function
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add get_random_u32_below function

get_random_u32_below returns a random integer in the interval [0, ceil),
with uniform distribution.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add VM_ACCESS_FLAGS define to linux/mm.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add VM_ACCESS_FLAGS define to linux/mm.h

VM_ACCESS_FLAGS is a basic access permission flags.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Import vanilla linux/overflow.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Import vanilla linux/overflow.h

It is dual-licensed (GPLv2 & MIT) and self-contained header file.
No need to reimplement it.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Move [SU](8|16|32|64)_(MAX|MIN) defines to linux/limits.h
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Move [SU](8|16|32|64)_(MAX|MIN) defines to linux/limits.h

Some source files get them from linux/limits.h directly rather than from
linux/kernel.h.
While here replace Linux constant values with sys/stdint.h provided ones.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Add strnchr function
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add strnchr function

strnchr() finds a character in a length limited string.

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 month

7 weeks agoLinuxKPI: Add ms_to_ktime
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:42 +0000 (09:47 +0300)]
LinuxKPI: Add ms_to_ktime

Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week

7 weeks agoLinuxKPI: Set suspend type on syspend/resume cycle enter
Vladimir Kondratyev [Mon, 8 Apr 2024 06:47:41 +0000 (09:47 +0300)]
LinuxKPI: Set suspend type on syspend/resume cycle enter

Recent amdgpu depends on pm_suspend_target_state value to separate
S3 and S0ix support.

Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu (in bugzilla)
MFC after: 1 week