]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agozfs: Fix a pair of bugs in zfs_fhtovp()
Mark Johnston [Mon, 24 Oct 2022 15:55:48 +0000 (11:55 -0400)]
zfs: Fix a pair of bugs in zfs_fhtovp()

This cherry-picks upstream ed566bf1cd0bdbf85e8c63c1c119e3d2ef5db1f6

    - Add a zfs_exit() call in an error path, otherwise a lock is
      leaked.
    - Remove the fid_gen > 1 check.  That appears to be Linux-specific:
      zfsctl_snapdir_fid() sets fid_gen to 0 or 1 depending on whether
      the snapshot directory is mounted.  On FreeBSD it fails, making
      snapshot dirs inaccessible via NFS.

PR: 266236

(cherry picked from commit 6fe0a6c80a1aff14236924eb33e4013aa8c14f91)

19 months agoAdd random VMware device IDs.
Alexander Motin [Thu, 20 Oct 2022 14:19:24 +0000 (10:19 -0400)]
Add random VMware device IDs.

Just to make dmesg look nicer there.

MFC after: 1 week

(cherry picked from commit 2a31a06bf1bb2d328d6672ed91c3e54734684cc0)

19 months agoOpenBSM: fix free() in au_read_rec error case
Ed Maste [Mon, 24 Oct 2022 13:45:59 +0000 (09:45 -0400)]
OpenBSM: fix free() in au_read_rec error case

buf is a char ** and *buf is the allocated buffer.

PR: 267050
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c61b3f7de9a0a39d2bc78e3e78d148c369e706a5)

19 months agossh: update to OpenSSH 9.1p1
Ed Maste [Wed, 19 Oct 2022 14:27:11 +0000 (10:27 -0400)]
ssh: update to OpenSSH 9.1p1

Release notes are available at https://www.openssh.com/txt/release-9.1

9.1 contains fixes for three minor memory safety problems; these have
lready been merged to the copy of OpenSSH 9.0 that is in the FreeBSD base
system.

Some highlights copied from the release notes:

Potentially-incompatible changes
--------------------------------

 * ssh(1), sshd(8): SetEnv directives in ssh_config and sshd_config
   are now first-match-wins to match other directives. Previously
   if an environment variable was multiply specified the last set
   value would have been used. bz3438

 * ssh-keygen(8): ssh-keygen -A (generate all default host key types)
   will no longer generate DSA keys, as these are insecure and have
   not been used by default for some years.

New features
------------

 * ssh(1), sshd(8): add a RequiredRSASize directive to set a minimum
   RSA key length. Keys below this length will be ignored for user
   authentication and for host authentication in sshd(8).

 * sftp-server(8): add a "users-groups-by-id@openssh.com" extension
   request that allows the client to obtain user/group names that
   correspond to a set of uids/gids.

 * sftp(1): use "users-groups-by-id@openssh.com" sftp-server
   extension (when available) to fill in user/group names for
   directory listings.

 * sftp-server(8): support the "home-directory" extension request
   defined in draft-ietf-secsh-filexfer-extensions-00. This overlaps
   a bit with the existing "expand-path@openssh.com", but some other
   clients support it.

 * ssh-keygen(1), sshd(8): allow certificate validity intervals,
   sshsig verification times and authorized_keys expiry-time options
   to accept dates in the UTC time zone in addition to the default
   of interpreting them in the system time zone. YYYYMMDD and
   YYMMDDHHMM[SS] dates/times will be interpreted as UTC if suffixed
   with a 'Z' character.

   Also allow certificate validity intervals to be specified in raw
   seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This
   is intended for use by regress tests and other tools that call
   ssh-keygen as part of a CA workflow. bz3468

 * sftp(1): allow arguments to the sftp -D option, e.g. sftp -D
   "/usr/libexec/sftp-server -el debug3"

 * ssh-keygen(1): allow the existing -U (use agent) flag to work
   with "-Y sign" operations, where it will be interpreted to require
   that the private keys is hosted in an agent; bz3429

MFC after: 2 weeks
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 38a52bd3b5cac3da6f7f6eef3dd050e6aa08ebb3)

19 months agokvm_close(3): Check kd->sparse_map != NULL before munmap
Ashish SHUKLA [Tue, 30 Aug 2022 08:18:51 +0000 (08:18 +0000)]
kvm_close(3): Check kd->sparse_map != NULL before munmap

PR: 266113
Reviewed by: markj

(cherry picked from commit e6901a29bc4345f12e9c85426cc2be81045020a6)

19 months agotmpfs: report minimal hole size
Konstantin Belousov [Mon, 17 Oct 2022 17:46:22 +0000 (20:46 +0300)]
tmpfs: report minimal hole size

(cherry picked from commit e9adbcdf2e8000efaca404abcc904eec4eb4ae29)

19 months agotmpfs: implement FIOSEEKDATA and FIOSEEKHOLE
Konstantin Belousov [Mon, 17 Oct 2022 15:26:43 +0000 (18:26 +0300)]
tmpfs: implement FIOSEEKDATA and FIOSEEKHOLE

(cherry picked from commit 85cff1455a8c3422c6ba8a9f895b5d65118f3499)

19 months agoAdd vm_page_any_valid()
Konstantin Belousov [Tue, 18 Oct 2022 09:16:36 +0000 (12:16 +0300)]
Add vm_page_any_valid()

(cherry picked from commit 934bfc128efae7dec678dd52f75a28ac3538384a)

19 months agovn_bmap_seekhole: check that passed offset is non-negative
Konstantin Belousov [Mon, 17 Oct 2022 15:29:38 +0000 (18:29 +0300)]
vn_bmap_seekhole: check that passed offset is non-negative

(cherry picked from commit 33ce1788350612f4143be6837b74f77e29329fd9)

19 months agotmpfs: order include files alphabetically
Konstantin Belousov [Mon, 17 Oct 2022 14:54:57 +0000 (17:54 +0300)]
tmpfs: order include files alphabetically

(cherry picked from commit 8b32cdec9cd55c234e892b48042d61d951196dca)

19 months agotmpfs: change return type of tmpfs_pages_check_avail() to bool
Konstantin Belousov [Mon, 17 Oct 2022 14:25:10 +0000 (17:25 +0300)]
tmpfs: change return type of tmpfs_pages_check_avail() to bool

(cherry picked from commit 7f055843ac50a8c800f7a1b87641bec5919a46a8)

19 months agouma: Never pass cache zones to memguard
Mark Johnston [Wed, 19 Oct 2022 18:27:49 +0000 (14:27 -0400)]
uma: Never pass cache zones to memguard

Items allocated from cache zones cannot usefully be protected by
memguard.

PR: 267151
Reported and tested by: pho

(cherry picked from commit 2dba2288aa364c36c756770ac77590816b15d954)

19 months agolibc: Make elf_aux_info() return an error if AT_USRSTACK* is undefined
Mark Johnston [Tue, 18 Oct 2022 22:11:26 +0000 (18:11 -0400)]
libc: Make elf_aux_info() return an error if AT_USRSTACK* is undefined

Otherwise we do not fall back to sysctls if the auxv entries are not
defined by the kernel.  Arguably this is not a bug since we do not
support newer libc running on an older kernel, but we can be a bit more
gentle for the benefit of Valgrind or any other software which
synthesizes the auxv for virtualization purposes.

Reported by: Paul Floyd <paulf2718@gmail.com>
Reviewed by: brooks, kib

(cherry picked from commit a4ee0edc4a0b3f880463021c7ae1bdcf7112f3d6)

19 months agortld: remove unused macro FPTR_TARGET
Konstantin Belousov [Sat, 22 Oct 2022 02:15:06 +0000 (05:15 +0300)]
rtld: remove unused macro FPTR_TARGET

(cherry picked from commit f585d13dd60bfa0f1dc1f41ba261b9058b105489)

19 months agobsdinstall: use the correct DISTDIR for fetching local distfiles
Kyle Evans [Fri, 14 Oct 2022 05:22:09 +0000 (00:22 -0500)]
bsdinstall: use the correct DISTDIR for fetching local distfiles

fetchmissingdists naturally sets BSDINSTALL_DISTDIR to a directory in
the new filesystem that it can write fetched distfiles to.  As a result,
BSDINSTALL_DISTSITE was incorrectly set to the scratch space on /mnt for
the call to distfetch when grabbing local distfiles, and it would
subsequently fail.

Switch to using the copy of BSDINSTALL_DISTDIR that we stashed off
coming into fetchmissingdists; this one is in-fact set to the path where
the local distfiles are stored.

Patch suggested by jrtc27.

Reported and tested by: Daniel O'Connor <darius dons net au>

(cherry picked from commit 12b92f3ed82aa71c0eba246ce3053ef225724570)

19 months agoriscv: drop a dead declaration
Mitchell Horne [Wed, 12 Oct 2022 20:03:29 +0000 (17:03 -0300)]
riscv: drop a dead declaration

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6f4c938b2b8e06ffa96432c2735b90fce27fa583)

19 months agogetpagesize(3): cross-reference getpagesizes(3)
Mitchell Horne [Mon, 17 Oct 2022 16:55:10 +0000 (13:55 -0300)]
getpagesize(3): cross-reference getpagesizes(3)

MFC after: 3 days

(cherry picked from commit 4a9b1a146385912510ed1b203cd853a327643625)

19 months agoksched: correct return code for invalid priority
Ali Abdallah [Mon, 17 Oct 2022 18:11:48 +0000 (15:11 -0300)]
ksched: correct return code for invalid priority

By convention, EINVAL is returned when validating arguments, not EPERM.
This matches the documented behaviour of sched_setscheduler(3), and that
of SCHED_OTHER.

PR: 227735
MFC after: 1 week
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D37021

(cherry picked from commit ba4782022ac840bd20f4e10cb95ca27d2742333a)

19 months agopthread_setschedparam(3): document EPERM return
Mitchell Horne [Mon, 17 Oct 2022 18:11:13 +0000 (15:11 -0300)]
pthread_setschedparam(3): document EPERM return

In kern_sched_setparam(), before setting any parameters, p_cansched() is
called to check that the thread has appropriate privileges.

PR: 175687
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37020

(cherry picked from commit 04620006b9116049e9e2f27d74417d2d84dc8d10)

19 months agokern_intr: Check for NULL event in intr_destroy()
Mitchell Horne [Sat, 15 Oct 2022 18:43:53 +0000 (15:43 -0300)]
kern_intr: Check for NULL event in intr_destroy()

It likely won't happen, but is consistent with the other functions of
this KPI.

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

(cherry picked from commit 39888ed7a3dca81c5d5c886e699dbcf58953137f)

19 months agossh: remove pre- and post-merge update steps
Ed Maste [Thu, 6 Oct 2022 14:57:41 +0000 (10:57 -0400)]
ssh: remove pre- and post-merge update steps

We no longer use the pre- and post-merge scripts to strip/add RCS tags.
The tags have been removed from main, but persist on older branches.

While here renumber the steps in the update documentation using a more
conventional scheme.

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

(cherry picked from commit fca7ac55f8db80b5250bd80a83e1368fe0c39ae5)

19 months agoFix LINT build after 368ee2f86a0f4f6
Doug Moore [Mon, 3 Oct 2022 05:15:21 +0000 (00:15 -0500)]
Fix LINT build after 368ee2f86a0f4f6
Reported by: jenkins
Fixes: 368ee2f86a0f4f6

(cherry picked from commit ffbc2a58b13a9239269e661fe23f86c587cc7638)

19 months agorb_tree: let insert search start from next node
Doug Moore [Mon, 3 Oct 2022 03:27:21 +0000 (22:27 -0500)]
rb_tree: let insert search start from next node

When the node to insert in the rb_tree is known to precede or follow a
particular node, new methods RB_INSERT_PREV and RB_INSERT_NEXT,
defined here, allow the search for where to insert the new node begin
with that particular node, rather than at the root, to save a bit of
time.

Using those methods, instead of RB_INSERT, in managing a tree in
iommu_gas.c, saves a little time.

Reviewed by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35516

(cherry picked from commit 368ee2f86a0f4f60338472be4bfd3c09ab401f87)

19 months agoinet: Simplify if_multiaddrs iteration.
Alexander Motin [Sat, 8 Oct 2022 17:10:07 +0000 (13:10 -0400)]
inet: Simplify if_multiaddrs iteration.

Similar to 2cd6ad766eb23 for inet6 drop ifma_restart use, creating more
problems than solving.  It is no longer needed after epoch introduction.

While there, add NULL check for ifma_ifp in igmp_change_state(), that
sometimes caused panics on interface destruction.

MFC after: 2 weeks

(cherry picked from commit 1e9482f4331bdce775061bea66ff54a6a79d5245)

19 months agompr(4): Add Aero/Sea devices to supported hardware list
Sreekanth Reddy [Tue, 18 Oct 2022 12:34:13 +0000 (05:34 -0700)]
mpr(4): Add Aero/Sea devices to supported hardware list

Add Aero/Sea devices to supported hardware list in mpr man page.

PR: 267172
MFC after: 3 days

(cherry picked from commit 751ec8af5ea1df5a4eadd1f3e7d76271fcfed0b1)

19 months agorefcount.9: Update refcount_acquire(9) description after a67d540832b8
Ka Ho Ng [Wed, 12 Oct 2022 17:47:59 +0000 (13:47 -0400)]
refcount.9: Update refcount_acquire(9) description after a67d540832b8

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D36943

(cherry picked from commit 87fa64c569c54c2ec444ada699acde2ada696d97)

19 months agossh: add command to push tag to FREEBSD-upgrade instructions
Ed Maste [Wed, 23 Feb 2022 18:47:28 +0000 (13:47 -0500)]
ssh: add command to push tag to FREEBSD-upgrade instructions

Because it appears `git push --follow-tags` may push extra, undesired
tags document both techniques (pushing the specific vendor/openssh/X.YpZ
tag and pushing all with --follow-tags, using --dry-run first).

Discussed with: imp, lwhsu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33605

(cherry picked from commit ab7d09596958791d20596b16b81a957495e4b370)

19 months agoFix mpr(4) panic during a firmware update.
Kenneth D. Merry [Mon, 17 Oct 2022 16:48:34 +0000 (12:48 -0400)]
Fix mpr(4) panic during a firmware update.

Issue Description:
The RequestCredits field of IOCFacts got changed between the Phase23
firmware to Phase24 firmware. So as part of firmware update operation,
driver has to free the resources & pools which are created with the Phase23
Firmware's IOCFacts data (i.e. during driver load time) and has to
reallocate the resources and pools using Phase24's IOCFacts data. Here
driver has freed the interrupts but missed to reallocate the interrupts and
hence config page read operation is getting timed out and controller is
going for recursive reinit (controller reset) operations and leading to
kernel panic.

Fix:
Reallocate the interrupts if the interrupts are disabled as part of
firmware update/downgrade operation.

Submitted by: Sreekanth Ready <sreekanth.reddy@broadcom.com>
Tested by: ken
MFC after: 3 days

(cherry picked from commit 11778fca4a83f5e3b597c75785aa5c0ee0dc518e)

19 months agoioat: Add Ice Lake ID.
Alexander Motin [Thu, 6 Oct 2022 18:44:10 +0000 (14:44 -0400)]
ioat: Add Ice Lake ID.

MFC after: 2 weeks

(cherry picked from commit e4e91353c62e2af425061a4e56e1f24dcca2dd0f)

19 months agovmd: Add DID 8086:7D0B and 8086:AD0B for Intel MTL SKUs
Alexander Motin [Thu, 6 Oct 2022 16:44:59 +0000 (12:44 -0400)]
vmd: Add DID 8086:7D0B and 8086:AD0B for Intel MTL SKUs

MFC after: 2 weeks

(cherry picked from commit 9bce11410645f4e84521c2ee44d3082aad8ae1e9)

19 months agovmd: Bypass MSI/MSI-X remapping when possible.
Alexander Motin [Thu, 6 Oct 2022 16:15:25 +0000 (12:15 -0400)]
vmd: Bypass MSI/MSI-X remapping when possible.

By default all VMD devices remap children MSI/MSI-X interrupts into their
own.  It creates additional isolation, but also complicates things due to
sharing, etc.  Fortunately some VMD devices can bypass the remapping.
Add tunable to control it for remap testing or if something go wrong.

MFC after: 2 weeks

(cherry picked from commit c28220d8661ee1928bff7d2c6bcd3e64c25f927b)

19 months agosysent: regen after ee9bc5818356, posix_fadvise in capmode
Ed Maste [Thu, 14 Apr 2022 19:17:07 +0000 (15:17 -0400)]
sysent: regen after ee9bc5818356, posix_fadvise in capmode

(cherry picked from commit f99cc5a38947e80c41bfa28855291ac5a2e41fea)

19 months agoAllow posix_fadvise in capability mode
Ed Maste [Wed, 13 Apr 2022 22:36:03 +0000 (18:36 -0400)]
Allow posix_fadvise in capability mode

posix_fadvise operates only on a provided fd.  Noted by
Mathieu <sigsys@gmail.com> in review D34761.

No new CAP_ rights are added for posix_fadvise(), as 'advice' in
general only influences when I/O happens; the fd must have existing
CAP_ rights for actual data access.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34903

(cherry picked from commit 52a1d90c8bfe80a15e71a1a2bd7b9407949741d6)

19 months agoiflib: Introduce v2 of TX Queue Select Functionality
Eric Joyner [Mon, 17 Oct 2022 21:52:20 +0000 (14:52 -0700)]
iflib: Introduce v2 of TX Queue Select Functionality

For v2, iflib will parse packet headers before queueing a packet.

This commit also adds a new field in the structure that holds parsed
header information from packets; it stores the IP ToS/traffic class
field found in the IPv4/IPv6 header.

To help, it will only partially parse header packets before queueing
them by using a new header parsing function that does less than the
current parsing header function; for our purposes we only need up to the
minimal IP header in order to get the IP ToS infromation and don't need
to pull up more data.

For now, v1 and v2 co-exist in this patch; v1 still offers a
less-invasive method where none of the packet is parsed in iflib before
queueing.

This also bumps the sys/param.h version.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: IntelNetworking
Sponsored by: Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D34742

(cherry picked from commit 9c950139051298831ce19d01ea5fb33ec6ea7f89)

19 months agopvscsi: Advertise maxio of 256k.
Warner Losh [Wed, 21 Apr 2021 18:10:42 +0000 (12:10 -0600)]
pvscsi: Advertise maxio of 256k.

While the PV SCSI SG list can handle 512k of SG entries, it can only do
so for I/O that's aligned to 4k or better. newfs_msdos does unaligned
I/O, so triggers too long for host errors in cam when a 512k I/O is
attempted. Prefer power of 2 256k to the absolute maximum 508k, though
that can be revisited should the latter show to give significant
performance improvement.

MFC After: 3 days
Tested by: darius on discord (508k version of patch)
Sponsored by: Netflix

(cherry picked from commit 9a5a5c1576b4ce308a97e0bce887261701ae3edc)

19 months agortld: fix typo in comment
Konstantin Belousov [Mon, 17 Oct 2022 14:08:36 +0000 (17:08 +0300)]
rtld: fix typo in comment

(cherry picked from commit ca2560bd85ab8d5cb18855cf61f49a7219cb3d8f)

19 months agolibdtrace: Fix some CPU register number definitions to match the kernel
Mark Johnston [Wed, 12 Oct 2022 19:59:09 +0000 (15:59 -0400)]
libdtrace: Fix some CPU register number definitions to match the kernel

(cherry picked from commit 53a31c87df9f0f77d26a5d35cb8322c8e78033ce)

19 months agodtrace: Drop illumos ifdefs for CPU register definitions
Mark Johnston [Wed, 12 Oct 2022 19:59:00 +0000 (15:59 -0400)]
dtrace: Drop illumos ifdefs for CPU register definitions

These are fixed, so having upstream's version is not especially useful,
and the duplicated definitions make for confusing reading.  No
functional change intended.

(cherry picked from commit b34a6e0fed4af33671c79347deb77e3e93930df3)

19 months agomalloc(9): update names and hardlinks
Mitchell Horne [Wed, 12 Oct 2022 16:43:57 +0000 (13:43 -0300)]
malloc(9): update names and hardlinks

Give all documented functions a .Nm entry in the man page, following the
order they are listed in the synopsis. Create MLINKs for each of the
functions as well.

While here, add a missing include directive to the synopsis, and appease
mandoc by wrapping a long line.

Reviewed by: markj, imp (previous version), jhb (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36940

(cherry picked from commit 30c6a66864821d3b47e25612c0d2e727ec36154e)

19 months agoswi(9): remove BUGS section
Mitchell Horne [Wed, 12 Oct 2022 16:38:08 +0000 (13:38 -0300)]
swi(9): remove BUGS section

Most of these globals have been removed, save for clk_intr_event. This
one is appropriate to keep in sys/interrupt.h, despite the fact that it
has only one consumer.

Bump .Dd for this and previous changes.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36939

(cherry picked from commit ed02be352dc973827446436eece4cad5b8c91bf3)

19 months agoDowngrade tty_intr_event from a global
Mitchell Horne [Wed, 12 Oct 2022 16:36:08 +0000 (13:36 -0300)]
Downgrade tty_intr_event from a global

It can be static within uart_tty.c. It is an open question whether there
remains any real benefit to having uart instances share a swi thread.

Reviewed by: imp, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36938

(cherry picked from commit 05b727fee550598bfae5754783f9decfdeeb3c3d)

19 months agoswi(9): clean up description of clk_intr_event
Mitchell Horne [Wed, 12 Oct 2022 16:35:23 +0000 (13:35 -0300)]
swi(9): clean up description of clk_intr_event

From what I can tell, setdelayed() was removed so long ago that its
mention is more likely to be confusing than helpful. We now have a
manpage for hardclock(9), so reference that.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36937

(cherry picked from commit 96b76a6a1edd6d0e0d4fa07c37d11d5805e8b8b3)

19 months agoRemove last references of vm_ih
Mitchell Horne [Wed, 12 Oct 2022 16:32:27 +0000 (13:32 -0300)]
Remove last references of vm_ih

The only remaining user was busdma, and so it was simplified.

Reviewed by: markj, jhb
MFC after: 1 week
Fixes: 254e4e5b77d7 ("Simplify swi for bus_dma")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36936

(cherry picked from commit e23c3445f69c945a8d5316b26bd996dbc900b2aa)

19 months agonanobsd: remove unmodified copies of ssh config files
Ed Maste [Wed, 13 Apr 2022 21:04:33 +0000 (17:04 -0400)]
nanobsd: remove unmodified copies of ssh config files

Nanobsd included copies of ssh_config and sshd_config.  The former is
identical to the one provided by the base system, and the latter is
identical except for PermitRootLogin, which is updated by nanobsd's
cust_allow_ssh_root anyhow.  Remove nanobsd's copies and use the
existing base system ones.

Reported by: Jose Luis Duran <jlduran@gmail.com> in D34937
Reviewed by: Jose Luis Duran <jlduran@gmail.com>, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36933

(cherry picked from commit 42942998437d9304110e39b04552853729aa498e)
(cherry picked from commit 6e6c45e66f68e68b451a27430f51a687e00bad15)
(cherry picked from commit a1e39f96d244fe30a3277c9cefbfd23e046cf845)

19 months agoqoriq_dw_pci: Fix typo in link status checking code
Bartlomiej Grzesik [Tue, 31 Aug 2021 04:22:33 +0000 (06:22 +0200)]
qoriq_dw_pci: Fix typo in link status checking code

On some DesignWare PCIe controllers accessing config registers of slots
whose link is down triggers a SError. Because of that we need to check the
link status before any acceses config space.
Due to a typo link was always reported up.
This fixes a SError that occured during boot on LS1028A-RDB.

Obtained from: Semihalf
Reviewed by: wma
Differential revision: https://reviews.freebsd.org/D31509

(cherry picked from commit df9c0e88e1e30cb5d1c81c4c2f295f7d153ed02b)

19 months agosort: deindent file_reader_free and cleanup its usage
Baptiste Daroussin [Thu, 13 Oct 2022 08:51:17 +0000 (10:51 +0200)]
sort: deindent file_reader_free and cleanup its usage

(cherry picked from commit 226e41467ee15c7aba33d59ee7b512b984b182e7)

19 months agosort: simplify file_reader_clean
Baptiste Daroussin [Thu, 13 Oct 2022 08:40:21 +0000 (10:40 +0200)]
sort: simplify file_reader_clean

Deindent the function, remove useless tests:
 - free already test if argument is NULL
 - closefile already test if the input is stdin or null

(cherry picked from commit ffd41d39c660ca1c80b77707238e8e5ef26d7d7a)

19 months agosort: deindent closefile
Baptiste Daroussin [Thu, 13 Oct 2022 08:38:12 +0000 (10:38 +0200)]
sort: deindent closefile

(cherry picked from commit f9d9a7cc4f2ff38795e5056721297e2b8442bf7a)

19 months agosort: use asprintf(3) instead of malloc + snprintf(3)
Baptiste Daroussin [Thu, 13 Oct 2022 08:34:57 +0000 (10:34 +0200)]
sort: use asprintf(3) instead of malloc + snprintf(3)

(cherry picked from commit 48a53cc4849555f1a0b805adddb9f517a305a2ae)

19 months agosort: deindent openfile
Baptiste Daroussin [Thu, 13 Oct 2022 08:31:08 +0000 (10:31 +0200)]
sort: deindent openfile

(cherry picked from commit 958b0d46425395f8f4606ac5d12681d623282e9d)

19 months agosort: use memset to initialize structure when possible
Baptiste Daroussin [Thu, 13 Oct 2022 07:07:46 +0000 (09:07 +0200)]
sort: use memset to initialize structure when possible

(cherry picked from commit f02c783757365340763739e58ef0e68ec13a0f8f)

19 months agosort: unify the code to read from FILE *
Baptiste Daroussin [Thu, 13 Oct 2022 07:36:48 +0000 (09:36 +0200)]
sort: unify the code to read from FILE *

Previously the code to read from a local file or stdin was sperarated
After the change to remove the home made line reader used for stdin
(replaced by getdelim) it apprears that the rest of the code which is
used to read from any FILE * but stdin can benefit from the exact same
change.

(cherry picked from commit 8b9071360a312f2bb2104864af0b9905acac87bc)

19 months agosort: remove unused function
Baptiste Daroussin [Thu, 13 Oct 2022 07:33:12 +0000 (09:33 +0200)]
sort: remove unused function

(cherry picked from commit e8815fb30b340108bc4b36ab46afa31f673948d0)

19 months agosort: simplify the code to handle -z flag
Baptiste Daroussin [Thu, 13 Oct 2022 08:21:48 +0000 (10:21 +0200)]
sort: simplify the code to handle -z flag

(cherry picked from commit f079ef8aa428ebffad28f5c62cce52c2bf70fb49)

19 months agosort: cleanup now unused structutre and prototypes
Baptiste Daroussin [Thu, 13 Oct 2022 08:19:18 +0000 (10:19 +0200)]
sort: cleanup now unused structutre and prototypes

(cherry picked from commit 4d4fcf619efcc02a962d0723a7ccd94fb621c6e6)

19 months agosort: use mkstemp(3) instead of reinventing it
Baptiste Daroussin [Wed, 12 Oct 2022 15:57:37 +0000 (17:57 +0200)]
sort: use mkstemp(3) instead of reinventing it

MFC After: 1 week

(cherry picked from commit 3f9e5e59bda05acea409fa3121c835a74672de1c)

19 months agosort: replace home made line reader by getdelim(3)
Baptiste Daroussin [Wed, 12 Oct 2022 13:31:50 +0000 (15:31 +0200)]
sort: replace home made line reader by getdelim(3)

The previous code had bug when reading lines with an unexpected
encoding, returning without the full line being captured.
This result in sort complaining with "sort: Illegal byte sequence"

Using getdelim(3) instead of the home made code, fixes the situation.

PR: 241679
Reported by: Ronald F. Guilmette <rfg-freebsd@tristatelogic.com>
MFC After: 1 week
Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D36948

(cherry picked from commit b58094c0d98e5d0ab8abdcdb655ac902ae8ad66e)

19 months agoOptionalObsoleteFiles: grep nls files have been removed 4 years ago
Baptiste Daroussin [Wed, 12 Oct 2022 14:28:36 +0000 (16:28 +0200)]
OptionalObsoleteFiles: grep nls files have been removed 4 years ago

(cherry picked from commit 00ffd6b5e88e9f2cf176379dc185c7f0c0920ba7)

19 months agosort: add wrapper around calloc
Baptiste Daroussin [Wed, 12 Oct 2022 13:52:38 +0000 (15:52 +0200)]
sort: add wrapper around calloc

(cherry picked from commit a312f3e74286c9bccd498198bfd236c49916d891)

19 months agosort: replace malloc+memset with calloc
Baptiste Daroussin [Wed, 12 Oct 2022 13:57:11 +0000 (15:57 +0200)]
sort: replace malloc+memset with calloc

(cherry picked from commit ecc3c2916751a0aef5619ed8f0ba1cc37c0a22ba)

19 months agopw: remove the inaccurate anymore information from the README
Baptiste Daroussin [Wed, 12 Oct 2022 10:11:32 +0000 (12:11 +0200)]
pw: remove the inaccurate anymore information from the README

(cherry picked from commit 88e6c9a674be41bb817573f61c86dec255ca1646)

19 months agopw: exit with an error in case of using an illegal option
Baptiste Daroussin [Wed, 12 Oct 2022 10:06:32 +0000 (12:06 +0200)]
pw: exit with an error in case of using an illegal option

PR: 263188
Reported by: Dennis Clarke <dclarke@blastwave.org>
MFC After: 1 week

(cherry picked from commit c0358afd5bbc2c675941fed2905479ad109770bb)

19 months agopci_vendors: update to 2022.09.09
Baptiste Daroussin [Wed, 12 Oct 2022 09:31:15 +0000 (11:31 +0200)]
pci_vendors: update to 2022.09.09

(cherry picked from commit 0b4886f4543ea8e55313321c92263adf8e0e6ff7)

19 months agoinet6(4): add a missing IPPROTO_ETHERIP entry
Hiroki Sato [Fri, 27 Aug 2021 08:14:35 +0000 (17:14 +0900)]
inet6(4): add a missing IPPROTO_ETHERIP entry

bridge(4) + gif(4) did not work when the outer protocol was IPv6.

Submitted by: Masahiro Kozuka
PR: 256820

Approved by: hps (to cherry-pick)

(cherry picked from commit 9823a0c0acf4fc277a71336ea737e1de7c65742f)

19 months agodma: restore addition of newline when missing from input
Ed Maste [Tue, 27 Sep 2022 19:19:19 +0000 (15:19 -0400)]
dma: restore addition of newline when missing from input

If input mail does not have a newline on the last line dma must add
one.  This was broken by the addition of long-line splitting, with the
switch from strlen(line) to linelen returned by getline().

PR: 266629
Reviewed by: bapt, Mikko Lehto
Tested by: Mikko Lehto
MFC after: 1 week
Fixes: b0b2d05fd060 ("Split body of mails not respecting...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36763

(cherry picked from commit 169487223143b1232ec4686b720b028af8d6d42b)

19 months agoReapply: "bus.h: rewrite comment describing intr_type"
Mitchell Horne [Fri, 7 Oct 2022 22:21:49 +0000 (19:21 -0300)]
Reapply: "bus.h: rewrite comment describing intr_type"

Describe more clearly the purpose of these flags and where they are
used.

Remove grog's comment about revisiting the flags. At this point it does
not make sense to change this long-standing API, especially in light of
2cf7870864ea ("Collapse interrupt thread priorities").

Give a better example of a bus modifying these flags; I did not find any
existing instance where a bus changes the interrupt's type.

Reviewed by: imp, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36896

Note: 2cf7870864ea is not present in stable/13 and likely will never be.
While reapplying this change, I have modified the comment further to
eliminate any inaccuracy Re: priorities. It should be applicable even if
the change is merged some day.

(cherry picked from commit af390486010e8fc78c4d715e751cd1175d0752c7)

19 months agoRevert "bus.h: rewrite comment describing intr_type"
Mitchell Horne [Tue, 18 Oct 2022 14:13:24 +0000 (11:13 -0300)]
Revert "bus.h: rewrite comment describing intr_type"

This reverts commit fff5fec16b2ec42b0cb357fdbb675353e3126f21.

It needs slight modification for stable/13 which does not have collapsed
interrupt thread priorities.

19 months agosbuf(9): reference the correct function
Mitchell Horne [Thu, 13 Oct 2022 13:01:11 +0000 (10:01 -0300)]
sbuf(9): reference the correct function

This was most likely a copy-paste error.

PR: 262433
MFC after: 3 days
Reported by: Boris Ivanovsky <bivanovsky@gmail.com>
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 204a5f5800a0d025c223a7b0b66537e30777d0c7)

19 months agoofw_graph(9): hook it up to the Makefile
Mitchell Horne [Tue, 11 Oct 2022 19:28:16 +0000 (16:28 -0300)]
ofw_graph(9): hook it up to the Makefile

Otherwise, the man page is not installed. Add appropriate MLINKS.

Reviewed by: manu
MFC after: 3 days
Fixes: 9a4eed0be20c ("ofw_graph: Add functions for graph bindings")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36932

(cherry picked from commit d88131e1e50c9cce5bd089b156661ca3090c10c6)

19 months agoriscv: handle misaligned address exceptions
Mitchell Horne [Tue, 11 Oct 2022 13:39:50 +0000 (10:39 -0300)]
riscv: handle misaligned address exceptions

If this exception is coming from userspace, send the appropriate SIGBUS
to the process. If it's coming from the kernel this is still fatal, but
we can give a better panic message.

Typical misaligned loads/stores are emulated by the SBI firmware, and
require no intervention from our kernel. The notable exception here is
misaligned access with atomic instructions. These can generate the
exception and panic seen in the PR.

With this, we now handle all defined exception types.

PR: 266109
MFC after: 1 week
Found by: syzkaller
Reported by: P1umer <p1umer1337@gmail.com>
Differential Revision: https://reviews.freebsd.org/D36876

(cherry picked from commit 9b4cbaa9c3da233cf06381c3d22e3472ee586585)

19 months agobus.h: rewrite comment describing intr_type
Mitchell Horne [Fri, 7 Oct 2022 22:21:49 +0000 (19:21 -0300)]
bus.h: rewrite comment describing intr_type

Describe more clearly the purpose of these flags and where they are
used.

Remove grog's comment about revisiting the flags. At this point it does
not make sense to change this long-standing API, especially in light of
2cf7870864ea ("Collapse interrupt thread priorities").

Give a better example of a bus modifying these flags; I did not find any
existing instance where a bus changes the interrupt's type.

Reviewed by: imp, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36896

(cherry picked from commit af390486010e8fc78c4d715e751cd1175d0752c7)

19 months agoEVENTHANDLER(9): drop the list of event handlers
Mitchell Horne [Fri, 7 Oct 2022 22:25:12 +0000 (19:25 -0300)]
EVENTHANDLER(9): drop the list of event handlers

Maintaining a comprehensive list of event handlers in this man page is a
futile endeavor. It is entirely detached from the source code, and
therefore requires that anyone adding/removing an event handler have
prior knowledge of the list. Many do not, so it will naturally become
stale (and is).

This is demonstrated by the fact that there are currently 88 instances
of EVENTHANDLER_DECLARE() in the source tree, but the list contains 66
items.

Many of the descriptions do not offer much detail that could not be
gleaned from the handler name alone. It is a more effective strategy to
document the purpose/details of the event handler in a comment alongside
its declaration.

Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36895

(cherry picked from commit 34aac98e3511d90df9209204df6772935a2b7617)

19 months agodtrace: Add a "regs" variable
Mark Johnston [Tue, 4 Oct 2022 16:54:36 +0000 (12:54 -0400)]
dtrace: Add a "regs" variable

This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired.  It does
not work for SDT providers because their probes are implemented as plain
function calls and so don't save registers.  It's not clear what
semantics "regs" should have for them anyway.

This is akin to "uregs", which nominally provides access to the
userspace registers.  In fact, DIF already had a DIF_VAR_REGS variable
defined, it was simply unimplemented.

Usage example: print the contents of %rdi upon each call to
amd64_syscall():

    fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}

Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d.
Currently there are no similar definitions for non-x86 platforms.

Reviewed by: christos

(cherry picked from commit bdd101c4d4aeab6c9e76250c310c16f5704b8b8c)

19 months agoatomic: Style
Mark Johnston [Tue, 11 Oct 2022 14:54:36 +0000 (10:54 -0400)]
atomic: Style

Fixes: 30253da1a982 ("atomic: Add some type checking to plain atomic_load/store helpers")

(cherry picked from commit 301a27dc65463fc9a909835863ff5566623f6ef2)

19 months agoixl(4): Fix SR-IOV panics
Yan Ka Chiu [Wed, 13 Jul 2022 01:16:29 +0000 (18:16 -0700)]
ixl(4): Fix SR-IOV panics

The hw and ifp of a vsi will be NULL if such ixl_vsi is allocated
for a VF. When ixl_reconfigure_filters called, it is trying to
access vsi->ifp and hw->mac.addr and therefore is casuing panic.

This commit add checks to determine if vsi is a VF by checking
if vsi->hw is NULL, before adding IXL_VLAN_ANY filter (which
is already in a VF vsi's filter list) and VLAN filters.

(erj's Note: The SR-IOV flows need revisiting; this will help
prevent panics for now)

Reviewed by: krzysztof.galazka@intel.com, erj@
Differential Revision: https://reviews.freebsd.org/D35649

(cherry picked from commit e706512a2b64fa2741144caf056c9fe923b60004)

19 months agoixl(4): Add support for I710 devices and remove non-inclusive language
Krzysztof Galazka [Tue, 24 May 2022 16:08:57 +0000 (09:08 -0700)]
ixl(4): Add support for I710 devices and remove non-inclusive language

Intel introduces a new line of 1G Ethernet adapters
with Device ID 0x0DD2. While at that also remove
non-inclusive language.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: kbowling@
Tested by: gowtham.kumar.ks@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34924

(cherry picked from commit b7b40e4a38d8521a40494d868d0870dfb9d6d77d)

19 months agoice(4): Add RDMA Client Interface
Eric Joyner [Thu, 2 Dec 2021 00:50:06 +0000 (16:50 -0800)]
ice(4): Add RDMA Client Interface

This allows the "irdma" driver to communicate with the ice(4)
driver to allow it access to the underlying device's hardware
resources as well as synchronize access to shared resources.

This interface already existed in the standalone out-of-tree
1.34.2 driver; this commit adds and enables it in the in-kernel
driver.

Note:

Adds hack to module Makefile to compile interface/.m files

These are required for the RDMA client interface, but they don't
build as-is like the normal .c files. The source directory doesn't
seem to be included by default, so add lines that specifically
add them as libraries so that ice_rdma.h can be found and the
interface files will compile.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D30889

(cherry picked from commit 8a13362d49bf07dfc654e25976d057adbe0ac9c1)
(cherry picked from commit d8cce8145c39812cc31b50070c44d66ca21a5127)

19 months agopci: Disable Electromechanical Interlock.
Alexander Motin [Tue, 4 Oct 2022 14:34:15 +0000 (10:34 -0400)]
pci: Disable Electromechanical Interlock.

Add sysctl/tunable to control Electromechanical Interlock support.
Disable it by default since Linux does not do it either and it seems
the number of systems having it broken is higher than having working.

This fixes NVMe backplane operation on ASUS RS500A-E11-RS12U server
with AMD EPYC 7402 CPU, where attempts to control reported interlock
for some reason end up in PCIe link loss, while interlock status does
not change (it is not really there).

MFC after: 2 weeks

(cherry picked from commit a58536b91ae3931d222c3e4f1a949ff4a4927fb2)

19 months agoclnt_vc.c: Replace msleep() with pause() to avoid assert panic
Rick Macklem [Fri, 14 Oct 2022 22:46:55 +0000 (15:46 -0700)]
clnt_vc.c: Replace msleep() with pause() to avoid assert panic

An msleep() in clnt_vc.c used a global "fake_wchan" wchan argument
along with the mutex in a CLIENT structure.  As such, it was
possible to use different mutexes for the same wchan and
cause a panic assert.  Since this is in a rarely executed code
path, the assert panic was only recently observed.

Since "fake_wchan" never gets a wakeup, this msleep() can
be replaced with a pause() to avoid the panic assert,
which is what this patch does.

(cherry picked from commit 82512c17ea39fcc272483024cb55d567dfd55366)

19 months agoBump __FreeBSD_version to 1301508
Bjoern A. Zeeb [Mon, 17 Oct 2022 20:38:38 +0000 (20:38 +0000)]
Bump __FreeBSD_version to 1301508
after merges of LinuxKPI changes and for de-macrofying pause().

19 months agonet80211: move IEEE80211_F_WME check to vap for consistency
Bjoern A. Zeeb [Mon, 26 Sep 2022 20:57:41 +0000 (20:57 +0000)]
net80211: move IEEE80211_F_WME check to vap for consistency

The IEEE80211_F_WME checks done on the ic were changed to be per-vap
back in the time when multi-bss was introduced or earlier in 2008.
This one was left out but given it is a (re-)accos-req case I see
no reason not to use the vap value here for consistency too.

Sponsored by: The FreeBSD Foundation
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D36733

(cherry picked from commit f82316f67883b53ee0f79bf28be32dfa7d64d5e3)

19 months agoLinuxKPI: add the "dummy" includes directory to builds
Bjoern A. Zeeb [Fri, 23 Sep 2022 21:25:07 +0000 (21:25 +0000)]
LinuxKPI: add the "dummy" includes directory to builds

While we could add the dummy includes directory manually to only the
drivers needing it, it seems a lot easier to simply add it to all
without any expected harm.

This is needed for more drivers (and to remove some #ifdef in current
ones) with empty header files being present not yielding errors.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, imp
Differential Revision: https://reviews.freebsd.org/D36684

(cherry picked from commit f8bad56164a43aa108498a97bd0021a943c0a02e)

19 months agoLinuxKPI: define LINUXKPI_INCLUDES for module builds as well
Bjoern A. Zeeb [Fri, 23 Sep 2022 21:18:45 +0000 (21:18 +0000)]
LinuxKPI: define LINUXKPI_INCLUDES for module builds as well

While for in-kernel we already have LINUXKPI_INCLUDES in kern.pre.mk
for kmod builds we've not had a common define to use leading to various
spellings of include paths.

In order for the include list to be expanded more easily in the future,
e.g., adding the "dummy" includes (for all) and to harmonize code,
duplicate LINUXKPI_INCLUDES to kmod.mk and use it for all module Makefiles.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36683

(cherry picked from commit 514fb3872166a361faa81d89909f65913e90b1b2)

19 months agoLinuxKPI: add struct dmi_header and unsupported dmi_walk()
Bjoern A. Zeeb [Fri, 23 Sep 2022 22:21:06 +0000 (22:21 +0000)]
LinuxKPI: add struct dmi_header and unsupported dmi_walk()

Add a structure definition as well as a dummy dmi_walk for now
which returns an error as not supported.  Our current dmi implementation
is special but does not give access to all details but rather only
information from kenv which does not suffice all use cases.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36687

(cherry picked from commit f486b352470edc82142766c2f3da2b8220774b7f)

19 months agoLinuxKPI: cache.h add L1_CACHE_ALIGN()
Bjoern A. Zeeb [Wed, 21 Sep 2022 19:46:17 +0000 (19:46 +0000)]
LinuxKPI: cache.h add L1_CACHE_ALIGN()

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36655

(cherry picked from commit f7c0c1590e3e313d7f60da275b1d74dd82b56b04)

19 months agoLinuxKPI: dma-mapping: add dmam_alloc_coherent()
Bjoern A. Zeeb [Wed, 21 Sep 2022 20:58:05 +0000 (20:58 +0000)]
LinuxKPI: dma-mapping: add dmam_alloc_coherent()

Add the devres version dmam_alloc_coherent() of dma_alloc_coherent()
along with the ancillary free function.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36661

(cherry picked from commit 7105f0d967530852b907375687575a8c2ba62fd2)

19 months agoLinuxKPI: device.h add devm_kmemdup()
Bjoern A. Zeeb [Wed, 21 Sep 2022 19:33:30 +0000 (19:33 +0000)]
LinuxKPI: device.h add devm_kmemdup()

Add devm_kmemdup() as needed by a networking driver.

Sponsored by: The FreeBSD Foundation
eviewed by:  hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D36652

(cherry picked from commit e999fbf0776208f9ecbc2926fd088427d766b014)

19 months agoLinuxKPI: pci.h add more defines and functions
Bjoern A. Zeeb [Wed, 21 Sep 2022 19:39:01 +0000 (19:39 +0000)]
LinuxKPI: pci.h add more defines and functions

Add #defines for PCI_DEVICE_ID and repoint the PCI_VENDOR_ID one.
Add dev_is_pci().
Add pcie_capability_clear_word() according to similar implementations.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D36653

(cherry picked from commit c41d83548b6cf18b48af974ad995354f38cf04a4)

19 months agoLinuxKPI: pci_ids.h Add more Vendor IDs.
Bjoern A. Zeeb [Wed, 21 Sep 2022 20:02:00 +0000 (20:02 +0000)]
LinuxKPI: pci_ids.h  Add more Vendor IDs.

Add PCI vendor IDs found in ath and mt76 drivers.  This should make it
easier for me and others not having to re-define them locally.

Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D36659

(cherry picked from commit fdc7ef3c9831bd4c69a431069aaaad0981ceaf17)

19 months agoLinuxKPI: io.h constify arguments and add more functions
Bjoern A. Zeeb [Wed, 21 Sep 2022 19:55:47 +0000 (19:55 +0000)]
LinuxKPI: io.h constify arguments and add more functions

Constify "*from" arguments and add __ioread32_copy() and
__ioread64_copy() based on the already existing implementations.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36657

(cherry picked from commit 046b82842c61c2d5d1648b5024958827e0a85725)

19 months agoLinuxKPI: if_ether.h add more constants
Bjoern A. Zeeb [Wed, 21 Sep 2022 19:51:52 +0000 (19:51 +0000)]
LinuxKPI: if_ether.h add more constants

In addition to the ones added last year add more found in modern
drivers.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36656

(cherry picked from commit 8e30f49256e254b31fc7c25c97e608f19c268b2b)

19 months agoLinuxKPI: lockdep.h add lockdep_{,un}register_key()
Bjoern A. Zeeb [Thu, 22 Sep 2022 15:03:36 +0000 (15:03 +0000)]
LinuxKPI: lockdep.h add lockdep_{,un}register_key()

Add NOPs for lockdep_{,un}register_key().

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D36658

(cherry picked from commit b27c3aa800bb1b3fc6081895df501c367dc3d9cc)

19 months agoLinuxKPI: tracepoint.h add more defines
Bjoern A. Zeeb [Wed, 21 Sep 2022 20:06:44 +0000 (20:06 +0000)]
LinuxKPI: tracepoint.h add more defines

Add some more defines used in drivers to make it easier to compile.

Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D36660

(cherry picked from commit f9f4988dc48db76f764f418c35b2f76045ded279)

19 months agoLinuxKPI: pci.h split up pcim_iomap_regions_request_all()
Bjoern A. Zeeb [Wed, 21 Sep 2022 19:41:37 +0000 (19:41 +0000)]
LinuxKPI: pci.h split up pcim_iomap_regions_request_all()

Factor out parts of pcim_iomap_regions_request_all() into
pcim_iomap_regions() now needed for a driver.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D36654

(cherry picked from commit 30048f61423bed87912686a7adfd12be9a4c7c27)

19 months agoiwlwifi: enforce FreeBSD specific (expected) behaviour
Bjoern A. Zeeb [Sun, 25 Sep 2022 21:23:12 +0000 (21:23 +0000)]
iwlwifi: enforce FreeBSD specific (expected) behaviour

iwlwifi can return early from probe (in FreeBSD attach) while a separate
thread is still grinding loading the firmware and setting things up.
For us this means that kldload succeeded but we may not have a physical
wireless interface (com) yet but the rc framework might already try to
configure a vap on one.

Wait until we get a firmware completion event from the other thread
(on success or error) and block returning.  That way we can ensure that
the "hw" (or com in net80211 terms) is there when we return from attach
matching the expected FreeBSD driver behaviour.

Reported by: J.R. Oldroyd (jr opal.com)
Reported by: probably inderectly showing as other problem
Tested by: J.R. Oldroyd (jr opal.com)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f808c43ad9234670770601ba32a7426b00bbf528)

19 months agoLinuxKPI: device.h remove duplicate #include
Bjoern A. Zeeb [Wed, 21 Sep 2022 17:25:34 +0000 (17:25 +0000)]
LinuxKPI: device.h remove duplicate #include

linux/types.h is included twice; reduce to the first.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8ea48fc59eaf475aa7d92f07db9b36370c349f3f)

19 months agoLinuxKPI: 802.11: add more header compat bits
Bjoern A. Zeeb [Wed, 21 Sep 2022 17:12:48 +0000 (17:12 +0000)]
LinuxKPI: 802.11: add more header compat bits

First part adding more bits in order to synch up drivers to the same
level and enable a new ones.

(cherry picked from commit f02e21159b2e7ab0d75905742f74ae5798bea122)

19 months agoLinuxKPI: 80211 (+net80211): update and cleanup headers
Bjoern A. Zeeb [Fri, 9 Sep 2022 18:40:23 +0000 (18:40 +0000)]
LinuxKPI: 80211 (+net80211): update and cleanup headers

Fix types for various struct fields (initially added as int).

Move structs and inline functions logically together, e.g., for wowlan.
Add more skeleton functions and #defines needed for iwlwifi d3.c
in the future.

Add struct ieee80211_vht_cap (without "_ie") to net80211 and remove
duplicate definitions in LinuxKPI headers now using net80211 structs.
For now leave ieee80211_ie_vhtcap in net80211.  I am not sure yet if we
actually need it as such.  That'll be cleaned up with more VHT updates
in net80211 in the future.

No functional changes in currently compiled code intended.

Try to implement ieee80211_action_contains_tpc() as I ran into it with
an older iwlwifi chipset.  This depends on c994352a8841eb453.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 800aa9cd3d8050c1d873a1db02d9a546dca8c42e)

19 months agosystm.h: change pause from #define to inline function
Bjoern A. Zeeb [Thu, 8 Sep 2022 00:04:42 +0000 (00:04 +0000)]
systm.h: change pause from #define to inline function

There are drivers are using (*pause)(x, y) function pointers and depending
on how "pause" is used it gets replaced by pause_sbt causing compile time
failures.
Given "pause" is a generic enough name change it from a #define to an
inline function to avoid replacements where it should not.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D36489

(cherry picked from commit 7ea1cac248574ed06c7823ffbfb9a60157240e57)

19 months agobhyve: Make bc_magic unsigned
Mark Johnston [Sat, 8 Oct 2022 15:26:31 +0000 (11:26 -0400)]
bhyve: Make bc_magic unsigned

This addresses a number of compiler warnings about signed/unsigned
comparisons in assertions.

(cherry picked from commit 3dddf73ee1eb1cea3146da2df376be48d4b2a589)