Commit Graph

147416 Commits

Author SHA1 Message Date
Doug Ambrisko
e315351fc7 Add the mfi(4) ioctl support to mrsas(4)
The hardware supported by mfi(4) and mrsas(4) use the same dcmd's.
mfiutil(8) in theory could run on controlled attached to mrsas(4).
It can't since mrsas(4) doesn't have support for the FreeBSD mfi(4)
ioctl.  Porting the ioctl from mfi(4) to mrsas(4) would be the first
step in making mrsasutil(8) which is an additional name for mfiutil(8)
but opens /dev/mrsasX instead of /dev/mfiX

PR:			https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265794
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D36342
Tested by:		Dan Mahoney <freebsd@gushi.org>
2023-04-28 10:14:30 -07:00
Alexander V. Chernikov
2711d4345e netlink: fix debug message on 32-bit archs 2023-04-28 15:47:11 +00:00
Alexander V. Chernikov
bc8dc48437 netlink: add forgotten opt_netlink header 2023-04-28 15:44:01 +00:00
Christos Margiolis
b999f2458c kinst: do not use DPCPU_ID_GET if we already have the trampoline
No functional change intended.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39870
2023-04-28 11:11:10 -04:00
Mark Johnston
6eca9db1e7 busdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()
Otherwise POSTREAD syncs may re-invalidate the shadow of the data buffer
when copying from bounce pages, resulting in false-positive KMSAN
reports.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2023-04-28 10:59:01 -04:00
Alexander V. Chernikov
dc81813497 netlink: properly zero all fields in the ndmsg header.
MFC after:	3 days
2023-04-28 14:04:47 +00:00
Alexander V. Chernikov
30d7e724db route: show originator PID in netlink monitor
Replacing rtsock with netlink also means providing similar tracing facilities,
rtsock provides `route -n monitor` interface, where each message can be traced
to the originating PID.
This diff closes the feature gap between rtsock and netlink in that regard.

Netlink works slightly differently from rtsock, as it is a generic message
"broker". It calls some kernel KPIs and returns the result to the caller.
Other Netlink consumers gets notified on the changed kernel state using the
relevant subsystem callbacks. Typically, it is close to impossible to pass
some data through these KPIs to enhance the notification.

This diff approaches the problem by using osd(9) to assign the relevant
socket pointer (`'nlp`) to the per-socket taskqueue execution thread.
This change allows to recover the pointer in the aforementioned notification
callbacks and extract some additional data.
Using `osd(9)` (and adding additional metadata) to the notification receiver
comes with some additional cost attached, so this interface needs to be
enabled explicitly by using a newly-created `NETLINK_MSG_INFO` `SOL_NETLINK`
socket option.

The actual medatadata (which includes the originator PID) is provided via
control messages. To enable extensibility, the control message data is
encoded in the standard netlink(TLV-based) fashion. The list of the
currently-provided properties can be found in `nlmsginfo_attrs`.
snl(3) is extended to enable decoding of netlink messages with metadata
(`snl_read_message_dbg()` stores the parsed structure in the provided buffer).

Differential Revision: https://reviews.freebsd.org/D39391
2023-04-28 13:54:54 +00:00
Alexander V. Chernikov
9e79038c50 netlink: fix netlink interface operations when netlink is loaded as a module.
This change completes 089104e0e0.

MFC after:	2 weeks
2023-04-28 13:35:58 +00:00
Andrew Turner
020edaea2a Split out pmap_map_delete on arm64
This will be used when supporting some extensions, e.g. Branch Target
Identification (BTI).

Sponsored by:	Arm Ltd
2023-04-28 11:54:19 +01:00
Zhenlei Huang
bbfb244724 mrsas: Fix a typo in a source code comment
- s/feild/field/

MFC after:	3 days
2023-04-28 18:01:58 +08:00
Zhenlei Huang
5bcbdb0b2e mps: Fix a typo in a source code comment
- s/feild/field/

MFC after:	3 days
2023-04-28 18:01:58 +08:00
Ian Moffett
99cb088f1a ixgbe: Fix typos in source code comments
- s/feilds/fields/

Reviewed by:	zlei
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/707
2023-04-28 18:01:58 +08:00
Dmitry Chagin
166e2e5a9e linux(4): Uniformly dev_t arguments translation
The two main uses of dev_t are in struct stat and as a parameter of the
mknod system calls.
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit quantity
with 12 bits set asaid for the major number and 20 for the minor number.
The in-kernel dev_t encoded as MMMmmmmm, where M is a hex digit of the
major number and m is a hex digit of the minor number.
The user-space dev_t encoded as mmmM MMmm, where M and m is the major
and minor numbers accordingly. This is downward compatible with legacy
systems where dev_t is 16 bits wide, encoded as MMmm.
In glibc dev_t is a 64-bit quantity, with 32-bit major and minor numbers,
encoded as MMMM Mmmm mmmM MMmm. This is downward compatible with the Linux
kernel and with legacy systems where dev_t is 16 bits wide.
In the FreeBSD dev_t is a 64-bit quantity. The major and minor numbers
are encoded as MMMmmmMm, therefore conversion of the device numbers between
Linux user-space and FreeBSD kernel required.
2023-04-28 11:55:05 +03:00
Dmitry Chagin
994ed958ae linux(4): Add a dedicated fstat() implementation
In between kern_fstat() and translate_fd_major_minor(), another process
having the same filedesc could modify or close fd.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D39763
2023-04-28 11:55:04 +03:00
Dmitry Chagin
cb858340dc linux(4): Add a dedicated statat() implementation
Get rid of calling Linux stat translation hook and specific to Linux
handling of non-vnode dirfd from kern_statat(),

Reviewed by:		kib, mjg
Differential revision:	https://reviews.freebsd.org/D35474
2023-04-28 11:55:04 +03:00
Dmitry Chagin
80d8a4a003 linux(4): Make struct stat64 to match Linux actual one 2023-04-28 11:55:04 +03:00
Dmitry Chagin
cd0fca82bb linux(4): Regen for mknod syscall changes 2023-04-28 11:55:04 +03:00
Dmitry Chagin
ca3333dd4a linux(4): Use Linux dev_t type for mknod syscalls dev argument
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Prior the 2.6 kernel dev_t type was an unsigned short.
However, since the firs commit of the Linuxulator, mknod syscall get int dev
argument.
Also, there is some confusion here, while the kernel declares a dev_t type
as a 32-bit sized, the user-space dev_t type can be size of 64 bits, e.g.,
in the Glibc library.
To avoid confusion and to help porting of the Linuxulator to other platforms
use explicit l_dev_t for dev argument of mknod syscalls.
2023-04-28 11:55:02 +03:00
Dmitry Chagin
19973638be linux(4): Move dev_t type declaration under /compat/linux
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Move it into the MI linux.h under /compat/linux.
2023-04-28 11:55:02 +03:00
Dmitry Chagin
e0bfe0d62c linux(4): Make struct newstat to match actual Linux one
In the struct stat the st_dev, st_rdev are unsigned long.
2023-04-28 11:55:01 +03:00
Dmitry Chagin
023e688496 linux(4): Regen for struct l_old_stat changes 2023-04-28 11:55:01 +03:00
Dmitry Chagin
2370c7321f linux(4): Update syscalls.master to reflect struct l_old_stat 2023-04-28 11:54:59 +03:00
Dmitry Chagin
391fd1e1a1 linux(4): Mark old fstat syscal as unimplemented
It looks like the old fstat system call never been implemented.
2023-04-28 11:54:59 +03:00
Dmitry Chagin
a408fc097f linux(4): Rename obsolete old struct l_stat to struct l_old_stat 2023-04-28 11:54:59 +03:00
Dmitry Chagin
e9204c5c2c linux(4): Move statx_copyout() close to linux_statx()
Just for future changes of the conditional Linuxulator build. We need
a small refactoring of the MI code to help porting Linuxulator to other
platforms.
2023-04-28 11:54:59 +03:00
Dmitry Chagin
6072eea0c3 linux(4): Move translate_vnhook_major_minor() into the Linux common module 2023-04-28 11:54:58 +03:00
Dmitry Chagin
2a38f51c5b linux(4): Sort includes in the linux_stats.c 2023-04-28 11:54:58 +03:00
Johannes Totz
3f3ad56520 Expose EFI wake time API
Reviewed by:	kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36714
2023-04-28 04:27:55 +03:00
Olivier Certner
6450e7bbad vfs: Fix "emptydir" mount option
Fix vfs_emptydir(). It would consider directories containing directories
with name of the form 'X.' (X being any authorized byte) as empty. Also,
it would cause VOP_READDIR() to return an error on directories
containing enough whiteouts. While here, use a more decently sized
buffer as done elsewhere.

Remove ad-hoc iteration on the directory's content and instead use the
newly exported vn_dir_next_dirent() function (this is what fixes the
second problem mentioned above).

PR:	270988
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39775
2023-04-28 04:27:54 +03:00
Olivier Certner
3d8450db4c vfs: vn_dir_next_dirent(): Simplify interface and harden
Simplify the old interface (one less argument, simpler termination test)
and add documentation about it. Add more sanity checks (mostly under
INVARIANTS, but also in the general case to prevent infinite
loops). Drop the explicit test on minimum directory entry size (without
INVARIANTS).

Deal with the impacts in callers (dirent_exists() and vop_stdvptocnp()).
dirent_exists() has been simplified a bit, preserving the exact same
semantics but for the return code whose meaning has been reversed (0 now
means the entry exists, ENOENT that it doesn't and other values are
genuine errors). While here, suppress gratuitous casts of malloc return
values.

vn_dir_next_dirent() has been tested by a 'make -j4 buildkernel' with a
temporary modification to the VFS cache causing vn_vptocnp() to always
call VOP_VPTOCNP() and finally vop_stdvptocnp() (observed with temporary
debug counters).

Export new _GENERIC_MINDIRSIZ and _GENERIC_MAXDIRSIZ on __BSD_VISIBLE,
and GENERIC_MINDIRSIZ and GENERIC_MAXDIRSIZ on _KERNEL.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39764
2023-04-28 04:27:54 +03:00
Olivier Certner
6bce3f23d0 vfs: Export get_next_dirent() as vn_dir_next_dirent()
Move internal-to-'vfs_default.c' get_next_dirent() to 'vfs_vnops.c' and
export it for use by other parts of the VFS. This is a preparatory
change for using it in vfs_emptydir().

No functional change.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39755
2023-04-28 04:27:54 +03:00
Mark Johnston
ec45f952a2 sockbuf: Add KMSAN checks to sbappend*()
Otherwise KMSAN only detects uninitialized memory when the contents of
the buffer are copied out to userspace or transmitted to a network
interface.  At that point the KMSAN violation will be far removed from
its origin, so let's try to make debugging such problems a bit easier.

Reviewed by:	glebius
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38101
2023-04-27 12:58:56 -04:00
Kyle Evans
087a2e64ba openzfs: re-enable FPU usage on aarch64
The BLAKE3 generated assembly files have now been updated to avoid
clobbering x18, we can safely re-enable FPU usage on aarch64.
2023-04-26 19:47:14 -05:00
Tino Reichardt
42f0ac5f1b Fix BLAKE3 aarch64 assembly for FreeBSD and macOS
The x18 register isn't useable within FreeBSD kernel space, so we
have to fix the BLAKE3 aarch64 assembly for not using it.

The source files are here: https://github.com/mcmilk/BLAKE3-tests

Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #14728
2023-04-26 19:46:47 -05:00
Cheng Cui
60167184ab
siftr: remove barely used hash generation per record
Reviewers: rscheff, tuexen
Approved by: rscheff, tuexen
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39835
2023-04-26 15:57:42 -04:00
Elliott Mitchell
d7e3b05b0d arm: remove passing trapframe to intr_ipi_dispatch()
This was needed before INTRNG was in place and handling the push of
curthread->td_intr_frame.  Since INTRNG now handles this, there is no
longer and need for playing around with the frame inside IPI interrupts.
2023-04-26 20:08:30 +01:00
Elliott Mitchell
c7e5e9dc41 arm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()
This was needed when intr_ipi_dispatch() was called by hardware-specific
IPI interrupt routines which didn't save the trap frame.  Now all ARM
interrupts pass through INTRNG which will have already saved the trap
frame and disabled preemption.

Remove the conditional trapframe/argument passing to the handlers.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37938
2023-04-26 20:08:30 +01:00
Mateusz Guzik
d09a955a60 zfs: Fix positive ABD size assertion in abd_verify().
This cherry-picks upstream:
commit bba7cbf0a4
Author: Alexander Motin <mav@FreeBSD.org>
Date:   Wed Apr 26 12:20:43 2023 -0400

    Fix positive ABD size assertion in abd_verify().

    Gang ABDs without childred are legal, and they do have zero size.
    For other ABD types zero size doesn't have much sense and likely
    not working correctly now.

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

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-26 18:00:36 +00:00
Ed Maste
b73183d1a2 ipv6: disable RFC 4620 nodeinfo by default
RFC 4620 is an experimental RFC that can be used to request information
about a host, including:

- the fully-qualified or single-component name
- some set of the Responder's IPv6 unicast addresses
- some set of the Responder's IPv4 unicast addresses

This is not something that should be made available by default.

PR:		257709
Submitted by:	ruben@verweg.com
Reviewed by:	melifaro
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39778
2023-04-26 13:47:59 -04:00
Kyle Evans
ce5a210997 openzfs: arm64: implement kfpu_begin/kfpu_end
This is part one of a fix for booting with ZFS on arm64 using
accelerated checksum implementations.  Checksum benchmarking will
attempt to use the FPU, so we currently panic quickly on boot.  BLAKE3
is still broken, as it clobbers x18 and we promptly discover that fact
as soon as we attempt to fetch curthread in kfpu_end().

Note that _STANDALONE is special-cased here, but ideally we wouldn't be
building the code that uses kfpu_begin()/kfpu_end() at all in the loader
environment.

Discussed with:	imp (a bit)
Differential Revision:	https://reviews.freebsd.org/D39448
2023-04-26 12:24:00 -05:00
Mark Johnston
2c0209a2ca callout: Remove an unneeded MTX_NEW
Reported by:	hselasky
Fixes:		78cfa762eb ("callout: Move per-CPU callout state into the dpcpu region")
2023-04-26 11:15:56 -04:00
Kristof Provost
a81f5112a0 pf: clear PF_TAG_ROUTE_TO for dummynet fast path
Similar to the PF_TAG_DUMMYNET we must also clear the route tag if
dummynet didn't keep the packet. In that case we'd continue immediately
and there'd be no need for the route tag. Keeping it could lead to
unexpected routing of traffic.

See also:	27407a6adc
See also:	https://redmine.pfsense.org/issues/14055
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-26 17:09:47 +02:00
Mark Johnston
e72f7ed43e buf: Dynamically allocate per-CPU buffer queues
To reduce static bloat.  No functional change intended.

PR:		269572
Reviewed by:	mjg, kib, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39808
2023-04-26 10:09:31 -04:00
Mark Johnston
78cfa762eb callout: Move per-CPU callout state into the dpcpu region
This eliminates some static bloat in amd64 kernels and reduces the
penalty of increasing MAXCPU.  The structures now also maintain NUMA
affinity.  No functional change intended.

PR:		269572
Reviewed by:	mjg, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39807
2023-04-26 10:09:09 -04:00
Mark Johnston
74ac712f72 vmm: Dynamically allocate a couple of per-CPU state save areas
This avoids bloating the BSS when MAXCPU is large.

No functional change intended.

PR:		269572
Reviewed by:	corvink, rew
Tested by:	rew
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39805
2023-04-26 10:08:42 -04:00
Dmitry Chagin
e185d83fc4 linux(4): Use inlined LINUX_KERNVER for tests to improve readability
MFC after:		1 month
2023-04-26 16:57:30 +03:00
Dmitry Chagin
76f8584e49 linux(4): Don't relie on process osreldata when testing features
The ELF note identifyies the operating-system ABI that the executable
was created for. The note data of the Glibc executable contains the
earliest release number of the Linux kernel that supports this ABI.
As of a current 2.37 version of Glibc, it is 3.2.0 for x86, 3.7.0
for Aarch64.
Glibc does not use this release number and the current kernel's
LINUX_VERSION_CODE to detect kernel features, using fallbacks to known
previous way in case of ENOSYS or something else instead.

A dynamically linked Glibc reads the current kernel's LINUX_VERSION_CODE
from the ELF note in the vDSO or fallback to uname syscall if the vDSO
can't be located and parse the release field in struct utsname. Glibc
uses the current kernel's LINUX_VERSION_CODE for "kernel too old" check.

While here use inlined LINUX_KERNVER for tests to improve readability,
as suggested by emaste@.

MFC after:		1 month
2023-04-26 16:56:41 +03:00
Mark Johnston
727fd8a73d irdma: Silence an unused function warning
Reviewed by:	erj
Fixes:	35105900c6 ("irdma(4): Upgrade the driver to 1.1.11-k")
Differential Revision:	https://reviews.freebsd.org/D39719
2023-04-26 09:36:52 -04:00
Alexander V. Chernikov
20b6945c7f netlink: fix IPv6 proxy ndp deletion.
* Move LLT_ADDEDPROXY handling into lltable_link_entry() to
 reduct duplication
* Use standard lltable_delete_addr() for entry deletion
* Add (forgotten) call to llt_post_resolved handler after
 adding the entry via netlink.

MFC after:	2 weeks
2023-04-26 13:26:37 +00:00
Andrew Turner
f8c451d291 Add vt_simplefb to the arm64 NOTES file
This will be picked up in the LINT-ACPI and LINT-FDT configs to check
it builds with only one option enabled

Sponsored by:	Arm Ltd
2023-04-26 14:11:36 +01:00
Andrew Turner
80327535cf Mark simplefb as depending on fdt
This file is for a FDT specific device, mark it as such.

Reported by:	Zachary Leaf <zachary.leaf@arm.com>
Sponsored by:	Arm Ltd
2023-04-26 14:11:31 +01:00
Alexander V. Chernikov
a1db1097e6 netlink: fix build without NETLINK in the kernel.
PR:	271066
2023-04-26 11:19:41 +00:00
Christian McDonald
ef661d4a5b pf: introduce ridentifier and labels to ether rules
Make Ethernet rules more similar to the usual layer 3 rules by also
allowing ridentifier and labels to be set on them.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-26 11:14:41 +02:00
Vitaliy Gusev
0912408a28
vmm: fix HLT loop while vcpu has requested virtual interrupts
This fixes the detection of pending interrupts when pirval is 0 and the
pending bit is set

More information how this situation occurs, can be found here:
c5b5f2d808/sys/amd64/vmm/intel/vmx.c (L4016-L4031)

Reviewed by:		corvink, markj
Fixes:			02cc877968 ("Recognize a pending virtual interrupt while emulating the halt instruction.")
MFC after:		1 week
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D39620
2023-04-26 10:38:46 +02:00
Andrew Turner
d5035d913c Add a simple-framebuffer vt driver
This allows us to support this hardware and, in the future, use clocks
so they are enabled past the initial kernel boot process.

Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D30103
2023-04-26 00:44:48 -05:00
Kyle Evans
61fd6a1ea2 Note that static hints no longer break loader hints
This commentary was carried over from the x86 version of the same code,
but has actually been inaccurate for a while now. As of FreeBSD 12.x,
all environments are used unless they disable each other. See
39d44f7f15 ("kern_environment: use any provided environments [...]")
for details.

Reviewed by:	imp
Differentiala Revision:	https://reviews.freebsd.org/D35695
2023-04-26 00:38:32 -05:00
Konstantin Belousov
37e6036b26 VOP_CLOSE(): MNTK_EXTENDED_SHARED filesystems do not need excl lock
All in-tree implementations of VOP_CLOSE() for filesystems proclaiming
MNTK_EXTENDED_SHARED, are fine with the shared lock for the closed
vnode.  I checked the following implementations:
	ffs
	ext2
	ufs
	null
	tmpfs
	devfs
	fdescfs
	cd9660
	zfs
It seems that initial addition of FWRITE check was due to necessity of
handling the VV_TEXT vnode vflag.  Since VOP_ADD_WRITECOUNT() only
requires shared lock, we can relax the locking requirement there.

Reviewed by:	markj, Olivier Certner <olce.freebsd@certner.fr>
Tested by:	Olivier Certner
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D39784
2023-04-26 01:39:25 +03:00
Gleb Smirnoff
f2e75b967a tcp_hpts: add missing "inline"
Fixes:	c2a69e846f
2023-04-25 15:18:26 -07:00
Cheng Cui
d090464ecd
Change the unit of srtt and rto to usec, inspired by these in struct "tcp_info". Therefore, no need hz and tcp_rtt_scale in the headline of the log. Update the man page as well.
Summary: Simplify srtt and rto values in siftr log.

Test Plan:
Tested in Emulab testbed:
cc@s1:~ % sudo sysctl net.inet.siftr
net.inet.siftr.port_filter: 0
net.inet.siftr.genhashes: 0
net.inet.siftr.ppl: 1
net.inet.siftr.logfile: /var/log/siftr.log
net.inet.siftr.enabled: 0
cc@s1:~ % sudo sysctl net.inet.siftr.port_filter=5001
net.inet.siftr.port_filter: 0 -> 5001
cc@s1:~ % sudo sysctl net.inet.siftr.enabled=1
net.inet.siftr.enabled: 0 -> 1
cc@s1:~ %
cc@s1:~ % iperf -c r1 -n 1M
------------------------------------------------------------
Client connecting to r1, TCP port 5001
TCP window size: 32.0 KByte (default)
------------------------------------------------------------
[  1] local 10.1.1.2 port 33817 connected with 10.1.1.3 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-0.91 sec  1.00 MBytes  9.22 Mbits/sec
cc@s1:~ % sudo sysctl net.inet.siftr.enabled=0
net.inet.siftr.enabled: 1 -> 0

cc@s1:~ % ll /var/log/siftr.log
-rw-r--r--  1 root  wheel    91K Apr 25 09:38 /var/log/siftr.log
cc@s1:~ % cat /var/log/siftr.log
enable_time_secs=1682437111	enable_time_usecs=121115	siftrver=1.3.0	sysname=FreeBSD	sysver=1400088	ipmode=4
o,0x00000000,1682437125.907343,10.1.1.2,33817,10.1.1.3,5001,1073725440,1073725440,2,0,0,0,0,2,536,0,1,672,1000000,32768,0,65536,0,0,0,0,0
i,0x00000000,1682437126.106759,10.1.1.2,33817,10.1.1.3,5001,1073725440,1073725440,2,0,0,0,0,2,536,0,1,672,1000000,32768,0,65536,0,1,0,0,0
o,0x00000000,1682437126.106767,10.1.1.2,33817,10.1.1.3,5001,1073725440,14480,2,65535,65700,9,9,4,1460,201000,1,16778209,803000,33580,0,65700,0,0,0,0,0
o,0x00000000,1682437126.107141,10.1.1.2,33817,10.1.1.3,5001,1073725440,14480,2,65535,65700,9,9,4,1460,201000,1,16778208,803000,33580,60,65700,0,0,0,0,0
...
i,0x00000000,1682437127.016754,10.1.1.2,33817,10.1.1.3,5001,1073725440,606109,1030,748544,66048,9,9,9,1460,100812,1,1008,303000,475948,0,65700,0,0,0,0,0
o,0x00000000,1682437127.016759,10.1.1.2,33817,10.1.1.3,5001,1073725440,606109,1030,748544,66048,9,9,10,1460,100812,1,1011,303000,475948,0,65700,0,0,0,0,0
disable_time_secs=1682437131	disable_time_usecs=767582	num_inbound_tcp_pkts=371	num_outbound_tcp_pkts=186	total_tcp_pkts=557	num_inbound_skipped_pkts_malloc=0	num_outbound_skipped_pkts_malloc=0	num_inbound_skipped_pkts_tcpcb=0	num_outbound_skipped_pkts_tcpcb=0	num_inbound_skipped_pkts_inpcb=0	num_outbound_skipped_pkts_inpcb=0	total_skipped_tcp_pkts=0	flow_list=10.1.1.2;33817-10.1.1.3;5001,

Reviewers: rscheff, tuexen
Approved by: rscheff, tuexen
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39803
2023-04-25 13:26:39 -04:00
John Baldwin
7aab8fc5c5 clang: Enable -Wdeprecated-non-prototype by default.
PR:		270919 (exp-run)
Reviewed by:	dim, emaste
Differential Revision:	https://reviews.freebsd.org/D39535
2023-04-25 14:09:21 -07:00
Mykola Hohsadze
7edb7adf8c arm64/disassem.c: Add support str/strb/strh instructions
Added disassembly support for each type of str/strb/strh instruction
encoding.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39336
2023-04-25 17:23:15 -03:00
Mykola Hohsadze
cb923f03fa arm64/disassem.c: Fix typo sxts to sxts and amount for TYPE_02
The current implementation is wrong, since it unconditionally sets the
amount equal to the <size> field of the instruction. However, when the
<S> bit (scale) is not set, it must be zero.

Also fix a typo, sxts to sxtx, according to the Arm64 documentation.

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39334
2023-04-25 17:23:15 -03:00
Mykola Hohsadze
5b61ad4b00 arm64/disassem.c: style and formatting
Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38899
2023-04-25 17:23:15 -03:00
Gleb Smirnoff
c3c20de3b2 tcp: move HPTS/LRO flags out of inpcb to tcpcb
These flags are TCP specific.  While here, make also several LRO
internal functions to pass tcpcb pointer instead of inpcb one.

Reviewed by:		rrs
Differential Revision:	https://reviews.freebsd.org/D39698
2023-04-25 12:19:48 -07:00
Gleb Smirnoff
c2a69e846f tcp_hpts: move HPTS related fields from inpcb to tcpcb
This makes inpcb lighter and allows future cache line optimizations
of tcpcb.  The reason why HPTS originally used inpcb is the compressed
TIME-WAIT state (see 0d7445193a), that used to free a tcpcb, while the
associated connection is still on the HPTS ring.

Reviewed by:		rrs
Differential Revision:	https://reviews.freebsd.org/D39697
2023-04-25 12:18:33 -07:00
Gleb Smirnoff
144259f673 tcp: purge the input queue from tcp_discardcb()
The purge was intentionally removed in a540cdca31.  My assumption
was that the stacks that use the input queue always call the
tcp_handle_orphaned_packets() in their tfb_tcp_fb_fini method.
However, rack will skip doing that if t_fb_ptr is NULL and there are
scenarios when it is NULL, e.g. close(2) on a socket (but some
special close(2)).  Instead of working out all possible scenarios
let's put this safebelt back.

Reviewed by:		rrs
Differential Revision:	https://reviews.freebsd.org/D39696
2023-04-25 12:18:19 -07:00
Justin Hibbits
f46a05b5d3 al_eth: Finish conversion to IfAPI
Reviewed by:	zlei
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38955
2023-04-25 14:25:31 -04:00
Justin Hibbits
cfaab41c95 irdma: Convert to IfAPI
Mostly mechanical changes, with some reworking in irdma_cm for iterating
over interfaces and addresses.  Further rework by Bartosz Sobczak.

Reviewed by:	bartosz.sobczak_intel.com
Tested by:	mateusz.moga_intel.com
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38960
2023-04-25 14:25:31 -04:00
Mateusz Guzik
95e4f5ef7c x86: whack pmspcv from GENERIC
The driver is enormous and rarely used.

      text      data       bss        dec         hex   filename
  23076646   1870505   4415872   29363023   0x1c00b4f   kernel.before
  20017433   1870305   4416000   26303738   0x1915cfa   kernel.after

People using the driver will need to add pmspcv_load="YES" to
their loader.conf.

Reviewed by:	jhb
Relnotes:	yes
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39816
2023-04-25 18:09:44 +00:00
Dimitry Andric
9ea31d78f0 al_eth: make function definitions consistent with declarations
The declarations for al_eth_lm_retimer_ds25_signal_detect() and
al_eth_lm_retimer_ds25_cdr_lock() say that these functions return
'al_bool', but the definitions actually return 'boolean_t'.

Make the definitions match the declarations.

Reviewed by:	jhb, emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D39759
2023-04-25 20:02:04 +02:00
Dimitry Andric
3029b0b0e9 boolean_t: change to unsigned int to avoid signed bitfield warnings
This is the final part, which actually makes boolean_t unsigned. Note
that we do not change its size, nor do we try to change it directly to
bool, since that results in a lot of regressions.

Converting the remaining instances of boolean_t to plain C99 bool can
now be done in a piecemeal fashion, after which boolean_t may hopefully
be retired.

MFC after:	1 week
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D39753
2023-04-25 19:58:18 +02:00
Dimitry Andric
f74be55e30 vm: fix a number of functions to match the expected prototypes
Noticed while attempting to make boolean_t unsigned: some vm-related
function declarations and defintions were using boolean_t where they
should have used int, and vice versa.

MFC after:	1 week
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D39753
2023-04-25 19:58:18 +02:00
Dimitry Andric
64b5d74fff zfs: make zfs_vfs_held() definition consistent with declaration
Noticed while attempting to change boolean_t into an actual bool: in
include/sys/zfs_ioctl_impl.h, zfs_vfs_held() is declared to return a
boolean_t, but in module/os/freebsd/zfs/zfs_ioctl_os.c it is defined to
return an int. Make the definition match the declaration.

Obtained from:	https://github.com/openzfs/zfs/commit/62cc9d4f6
Reviewed by:	jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D39753
2023-04-25 19:58:17 +02:00
Mark Johnston
47cf1b37f4 vmm: Expose some more AVX512 CPUID bits to guests
This is required to announce support for some accelerated AES
operations.  AVX512BW indicates support for the AVX512-FP16 extension
and AVX512VL indicates support for the use of AVX512 instructions with
vector lengths smaller than 512 bits.

VAES and VPCLMULQDQ extensions indicate that VEX-prefixed AES-NI and
pclmulqdq instructions are supported.

All of these bits are needed for OpenSSL to use VAES to accelerate
AES-GCM transforms.

Reviewed by:	corvink, kib, jhb
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D39781
2023-04-25 13:35:14 -04:00
Dimitry Andric
bab8274c09 Use bool for one-bit wide bit-fields
A signed one-bit wide bit-field can take only the values 0 and -1. Clang
16 introduced a warning that "implicit truncation from 'int' to a
one-bit wide bit-field changes value from 1 to -1". Fix the warnings by
using C99 bool.

Reported by:	Clang 16
Reviewed by:	emaste, jhb
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D39705
2023-04-25 19:26:03 +02:00
Mateusz Guzik
b0695c6abe zfs: Revert "Fix data race between zil_commit() and zil_suspend()"
This reverts commit 4c856fb333.

To quote a pending upstream PR:
This reverts commit 4c856fb to resolve a newly introduced deadlock which
in practice is more disruptive that the issue this commit intended to
address.

Causes deadlocks described in https://github.com/openzfs/zfs/issues/14775

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-25 16:01:22 +00:00
Allan Jude
c98ecfceb3 Add support for zpool user properties
Usage:

    zpool set org.freebsd:comment="this is my pool" poolname

Tests are based on zfs_set's user property tests.

Also stop truncating property values at MAXNAMELEN, use ZFS_MAXPROPLEN.

Reviewed by:	markj
Approved by:	markj
Co-authored-by:	Mateusz Piotrowski <0mp@FreeBSD.org>
Obtained from:	OpenZFS 8eae2d214c Add support for zpool user properties
Sponsored by:	Beckhoff Automation GmbH & Co. KG.
Sponsored by:	Klara Inc.
Differential Revision: https://reviews.freebsd.org/D39657
2023-04-25 17:23:07 +02:00
Mateusz Guzik
b4d3dd8615 zfs: fix up bogus checksums with blake3 in face of cpu migration
This is a temporary measure until a better fix is sorted out.

Upstream report: https://github.com/openzfs/zfs/issues/14785
Reported by:	Evgeniy Khramtsov
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-25 15:20:19 +00:00
Alexander V. Chernikov
04349d3094 netlink: remove now-unused rtnl_iface_find_cloner_locked(). 2023-04-25 15:04:11 +00:00
Alexander V. Chernikov
9e81e2c452 netlink: fix powerpc build. 2023-04-25 14:59:04 +00:00
Mark Johnston
722b2e2f9a dtrace: Sync dis_tables.c with illumos
This brings in the following commits:

    commit 584b574a3b16c6772c8204ec1d1c957c56f22a87
    12174 i86pc: variable may be used uninitialized
    Author: Toomas Soome <tsoome@me.com>
    Reviewed by: John Levon <john.levon@joyent.com>
    Reviewed by: Andrew Stormont <astormont@racktopsystems.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit a25e615d76804404e5fc63897a9196d4f92c3f5e
    12371 dis x86 EVEX prefix mishandled
    12372 dis EVEX encoding SIB mishandled
    12373 dis support for EVEX vaes instructions
    12374 dis support for EVEX vpclmulqdq instructions
    12375 dis support for gfni instructions
    Author: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

    commit c1e9bf00765d7ac9cf1986575e4489dd8710d9b1
    12369 dis WBNOINVD support
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit e4f6ce7088a7dd335b9edf4774325f888692e5fb
    10893 Need support for new Cascade Lake Instructions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Gordon Ross <gwr@nexenta.com>

    commit cff040f3ef42d16ae655969398f5a5e6e700b85e
    10226 Need support for new EPYC ISA extensions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jason King <jason.king@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit d242cdf5288b86d9070d88791c8ee696612becdc
    8492 AVX512 dis - legacy logical instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 81b505b772ab015c588c56bb116239ee549b6eee
    8384 AVX512 dis - EVEX prefix support
    8385 32-bit avx dis test mishandles EVEX prefix
    8386 32-bit bound dis is incorrect
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 92381362ae635a3bea638d87b7119f1623b6212e
    8319 dis support for new xsave instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit a4e73d5d60e566669c550027fae2b1d87b4be2b4
    8240 AVX512 dis - opmask instruction support
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

    959b2dfd39979fe8a9a315a52741d009eb168822
    7825 want avx dis tests
    7826 PCLMULQDQ psuedo-ops aren't properly described in dis
    7827 dis tests for f16c, movbe, cpuid, msr, tsc, fence instrs
    7828 sysenter and sysexit dis should be allowed in 64-bit x86
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

MFC after:	2 weeks
2023-04-25 10:46:10 -04:00
Boris Lytochkin
fc727ad63d ipfw: add [fw]mark implementation for ipfw
Packet Mark is an analogue to ipfw tags with O(1) lookup from mbuf while
regular tags require a single-linked list traversal.
Mark is a 32-bit number that can be looked up in a table
[with 'number' table-type], matched or compared with a number with optional
mask applied before comparison.
Having generic nature, Mark can be used in a variety of needs.
For example, it could be used as a security group: mark will hold a security
group id and represent a group of packet flows that shares same access
control policy.

Reviewed By: pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D39555
MFC after:	1 month
2023-04-25 12:40:23 +00:00
Alexander V. Chernikov
089104e0e0 netlink: add netlink interfaces to if_clone
This change adds netlink create/modify/dump interfaces to the `if_clone.c`.
The previous attempt with storing the logic inside `netlink/route/iface_drivers.c`
 did not quite work, as, for example, dumping interface-specific state
 (like vlan id or vlan parent) required some peeking into the private interfaces.

The new interfaces are added in a compatible way - callers don't have to do anything
unless they are extended with Netlink.

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D39032
MFC after:	1 month
2023-04-25 12:34:46 +00:00
Alexander V. Chernikov
acc65df45a netlink: require proper privileges when adding neighbor.
MFC after:	3 days
2023-04-25 12:28:22 +00:00
Alexander V. Chernikov
896e22fbc6 netlink: fix neighbour deleting for IPv6.
MFC after:	2 weeks
2023-04-25 12:27:02 +00:00
Alexander V. Chernikov
e83f23eb5e netlink: enable extended error reporting in snl(3).
MFC after:	2 weeks
2023-04-25 11:21:03 +00:00
Alexander V. Chernikov
5af9ad5359 netlink: add snl(3) support for dumping nexthops and neighbors
MFC after:	2 weeks
2023-04-25 11:14:12 +00:00
Alexander V. Chernikov
b32cf15d86 netlink: add support for dumping kernel nexthops.
MFC after:	2 weeks
2023-04-25 11:12:18 +00:00
Alexander V. Chernikov
a2728a9a5b netlink: allow creation of temporary lle entries.
MFC after:	2 weeks
2023-04-25 11:08:47 +00:00
Alexander V. Chernikov
ca1850478f lltable: properly set expire time to 0 for static IPv4 entries.
MFC after:	2 weeks
2023-04-25 10:59:50 +00:00
Alexander V. Chernikov
fab828b455 netlink: fix parameters in snl_attr_get_flag()
MFC after:	2 weeks
2023-04-25 10:57:59 +00:00
Alexander V. Chernikov
70810dc817 netlink: add nlattr_get_uint8() function to pack u8 attributes.
MFC after:	2 weeks
2023-04-25 10:56:42 +00:00
Alexander V. Chernikov
34066d0008 routing: add iterator-based nhop traversal KPI.
MFC after:	2 weeks
2023-04-25 10:55:16 +00:00
Alexander V. Chernikov
fd1aa866eb routing: add rt_tables_get_rnh_safe() that doesn't panic when af/fib is
incorrect.

MFC after:	2 weeks
2023-04-25 10:53:51 +00:00
Andrew Turner
6a9c2e63be Add padding for future use on arm64
Allow new features to be supported without changing the size of
existing structures.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39777
2023-04-25 10:23:15 +01:00
Vladimir Kondratyev
19c804b74f bcm5974(4): Make Magic Trackpad 2 support endian-safe.
While here make touch orientation event matching with Linux

MFC after:	1 month
2023-04-25 12:20:53 +03:00
Val Packett
ef8397c28e bcm5974(4): add Magic Trackpad 2 (USB only) support
The MT2 uses a compact report format, but otherwise is similar in many
ways to the internal trackpads, it even uses the same mode switching
commands.

Reviewed by:	wulf
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D34437
2023-04-25 12:20:53 +03:00
Stefan Eßer
88a795e80c sys/fs: do not report blocks allocated for synthetic file systems
The pseudo file systems (devfs, fdescfs, procfs, etc.) report total
and available blocks and inodes despite being synthetic with no
underlying storage device to which those values could be applied.

The current code of these file systems tends to report a fixed number
of total blocks but no free blocks, and in the case of procfs,
libprocfs, linsysfs also no free inodes.

This can be irritating in e.g. the "df" output, since 100% of the
resources seem to be in use, but it can also create warnings in
monitoring tools used for capacity management.

This patch makes these file systems return the same value for the
total and free parameters, leading to 0% in use being displayed by
"df". Since there is no resource that can be exhausted, this appears
to be a sensible result.

Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D39442
2023-04-25 09:59:15 +02:00
Stefan Eßer
0728695c63 fs/msdosfs: Fix potential panic and size calculations
Some combinations of FAT12 file system parameters could cause a kernel
panic due to an unmapped access if the size of the FAT was larger than
the CPU page size. The reason is that FAT12 uses 3 bytes to store
2 FAT pointers, leading to partial FAT pointers at the end of buffers
of a size that is not a multiple of 3.

With a typical page size of 4 KB, this caused the FAT entry at byte
offsets 4095 and 4096 to cross the page boundary, with only the first
page mapped. This was fixed by adjusting the mapping to always cover
both bytes of each FAT entry.

Testing revealed 2 other inconsistencies that are fixed by this commit:

1) The calculation of the size of the data area did not take into
   account the fact that the first two data block numbers are reserved
   and that the data area starts with block 2. This could cause a
   FAT12 file system created with the maximum supported number of
   blocks to be incorrectly identified as FAT16.

2) The root directory does not take up space in the data area of a
   FAT12 or FAT16 file system, since it is placed into a reserved
   area outside of that data area. This commits makes stat() report
   the logical size of the root directory, but with 0 blocks allocated
   from the data area.

PR:		270587
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D39386
2023-04-25 09:58:29 +02:00
Konstantin Belousov
04d815f115 netipsec/key.c: use designated initializers for arrays
Also de-expand nitems() use in related asserts, and fix maxsize array
name in the assert message.

Sponsored by:	NVidia networking
2023-04-25 09:41:24 +03:00
Konstantin Belousov
fcc7aabdca netipsec: some style
Sponsored by:	NVidia networking
2023-04-25 09:39:51 +03:00
Cheng Cui
1f782fcc0c
Remove unused fields in siftr_stats. Thus, update the man page as well.
Summary: Remove unused fields in siftr_stats. Thus, update the man page as well.

Test Plan: Tested in Emulab testbed.

Reviewers: rscheff, tuexen
Approved by: rscheff, tuexen
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39776
2023-04-24 15:31:15 -04:00
Cheng Cui
8aa2be695e
Correct the value of macro TF2_TCP_ACCOUNTING.
Summary: Make sure the values are in order.

Reviewers: rscheff, tuexen, #transport!
Approved by: rscheff, tuexen, glebius
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39716
2023-04-24 15:28:41 -04:00
Olivier Certner
6a5e614015 vn_open_vnode(): fix locking around VOP_CLOSE() on advisory lock error
In the case of a FIFO or if trying to open a file for writing, an
exclusive lock is necessary.

Reviewed by:	kib
MFC after:	1 week
2023-04-25 01:37:58 +03:00
Olivier Certner
faec42a3ef sys/dirent.h: comment update, 'd_off' is offset of next entry
This is the historical (and still current) behavior, as well as that of
NetBSD, OpenBSD, illumos and Linux (getdents()/getdents64()).

Reviewed by:	kib
MFC after:	3 days
2023-04-25 00:32:10 +03:00
Konstantin Belousov
a718431c30 lookup(): ensure that openat("/", "..", O_RESOLVE_BENEATH) fails
PR:	269780
Reported by:	Dan Gohman <dev@sunfishcode.online>
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39773
2023-04-25 00:32:10 +03:00
John Baldwin
9b02f2daf4 powerpc: Use valid prototypes for function declarations with no arguments.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39733
2023-04-24 08:53:50 -07:00
Andrew Turner
c94e4d91da Clean up PCI DEN0115 driver probing
Rather than checking for the SMCCC version check if the PCI_VERSION
call returns a valid version.

Sponsored by:	Arm Ltd
2023-04-24 16:34:21 +01:00
Warner Losh
d4c78130f4 powerpc: syscalls.c is standard
No need to add it here, much less make it optional on ktr.

Sponsored by:		Netflix
2023-04-24 09:25:42 -06:00
Justin Hibbits
02f3b17fa5 Mechanically convert Xen netfront/netback(4) to IfAPI
Reviewed by:	zlei
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37800
2023-04-24 09:54:23 -04:00
Justin Hibbits
7814374b7c IfAPI: Hide the macros that touch ifnet members
Nothing should be directly touching the ifnet members, which are hidden
in <net/if_private.h>, so hide them in the same header to avoid errors
from users.

Sponsored by:	Juniper Networks, Inc.
2023-04-24 09:54:23 -04:00
Justin Hibbits
97583aa256 linuxkpi: Migrate to IfAPI
Summary:
Trivial changes for LinuxKPI to use IfAPI.  The 'bsdifp' looks unused,
so removed it instead of converting it to a pointer.

Bump __FreeBSD_version for change to struct net_device.

Reviewed by:	bz, hselasky
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39491
2023-04-24 09:54:22 -04:00
Andrew Turner
c3785c3eb0 Remove unneeded SMMU macros
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39186
2023-04-24 12:48:01 +01:00
Andrew Turner
cdd34e0038 Remove virtual addresses from smmu_pmap_remove_pages
This function needs to unmap all memory in a given SMMU context. Have
it iterate over all page table entries to find what has been mapped
rather than looking at virtual addresses.

While here use SMMU specific macros.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39185
2023-04-24 12:47:55 +01:00
Andrew Turner
b97e94d91e Move to a SMMU specific struct for the smmu pmap
This is not managed through the VM subsystem so only needs to hold the
data the SMMU driver needs.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39184
2023-04-24 12:47:50 +01:00
Andrew Turner
49ee1a7ef0 Create a common function to get the SMMU sid
Now the PCI drivers have a common interface to read the IOMMU xref
and SID create a common function to read it. This fixes an issue where
we will call into an ACPI specific function when booting with FDT when
both are enabled.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39183
2023-04-24 12:47:44 +01:00
Andrew Turner
913d04deed Add PCI_ID_OFW_IOMMU to the pci ecam ACPI driver
Teach the pci host generic ACPI attachment about PCI_ID_OFW_IOMMU. This
will be used by the arm64 smmu IOMMU driver to read the xref and ID
this interface provides in a bus-agnostic way.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39182
2023-04-24 12:47:38 +01:00
Andrew Turner
117beba8a8 arm64: Clean up smmu fdt xref handling
Use the xref from OF_xref_from_node for the smmu xref. We already have
a valid xref ID, there is no need to convert this to a memory address.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39181
2023-04-24 12:47:31 +01:00
Andrew Turner
8bc94f256e Remove redundant data from pci host generic
The bus tag and handle fields are already stored in the resource. Use
this with the bus_read/bus_write helper macros.

Sponsored by:	Arm Ltd
2023-04-24 12:33:50 +01:00
Andrew Turner
078a69abcb Use a uint64_t to store the arm64 mpidr
Use a single uint64_t to hole the mpidr register as we can break the
KBI on 14. Keep the macro so code can still be MFCd to 13.

Sponsored by:	Arm Ltd
2023-04-24 12:33:50 +01:00
Andrew Turner
c9a05c0722 Add a PCI driver that follows the Arm DEN0115 spec
Add a n attachment to the pci_host_generic driver for the Arm DEN0115
PCI Configuration Space Access Firmware Interface [1]. This can be used
when PCI controllers need to implement quirks in the PCI root bus.
To handle this the firmware implements a SMCCC interface the driver can
use to read and write the configuration register.

This has been tested on a Raspberry Pi 4 booting with EDK2.

[1] https://developer.arm.com/documentation/den0115/latest

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39228
2023-04-24 12:33:50 +01:00
Andrew Turner
7029f2c887 Allow pci_host_generic attachments to manage registers
To allow for attachments that don't use memory mapped registers add
a flag they can set when the base driver shouldn't map them.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39227
2023-04-24 12:33:50 +01:00
Andrew Turner
fb421e96c0 Make arm64 pcb padding explicit
There is padding between some fields. Mark those I have found so they
can be reused later if needed.

Sponsored by:	Arm Ltd
2023-04-24 12:33:50 +01:00
Andrew Turner
1bf4991bbc Remove unneeded masks from the arm64 KASAN shadow
When mapping the arm64 KASAN shadow map we use Ln_TABLE_MASK to align
physical addresses, however these should already be aligned either
by rounding to a greater alignment, or the VM subsystem is giving us
a correctly aligned page.

Remove these extra alignment masks.

Reviewed by:	kevans
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39752
2023-04-24 12:33:50 +01:00
Hu Shunchao
6ed3b9ca25 hid: fix typo in hid_is_collection
hid_input is equal to 0. It is leftover from NetBSD code.

Reviewed by:	hselasky, wulf
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D28149
2023-04-24 14:17:51 +03:00
Val Packett
176939bd36 bcm5974: fix wellspring9 pressure settings to handle force sensitivity
Reviewed by:	wulf
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D34435
2023-04-24 12:41:52 +03:00
Val Packett
1f40866feb intelspi: add PCI attachment (Lynx/Wildcat/Sunrise Point)
Also adds fixups and cleanups:

- apply the child's mode/speed
- implement suspend/resume support
- use RF_SHAREABLE interrupts
- use bus_delayed_attach_children since the transfer can use interrupts
- add support for newly added spibus features (cs_delay and flags)

Operation tested on Broadwell (Wildcat Point) MacBookPro12,1.
Attachment also tested on Kaby Lake (Sunrise Point) Pixelbook.

Reviewed by:	wulf
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D29249
2023-04-24 12:41:52 +03:00
Val Packett
3c08673438 spibus: extend API: add cs_delay ivar, KEEP_CS and NO_SLEEP flags
These feature are required for an upcoming Apple MacBook topcase
(HID over SPI) driver:

A delay after toggling CS is required to avoid anomalies like an extra
junk byte in front of the message. Keeping CS asserted is required to
be able to read a status report after writing a command. (The device
won't return the status if CS was deasserted.)

Sleep is not allowed in the interrupt context where the Apple input
driver runs its transactions. Use a flag to tell the SPI driver to
avoid mtx_sleep.

Reviewed by:	manu (ok to SPI part of larger patch)
MFC afret:	1 month
Differential revision:	https://reviews.freebsd.org/D29534
2023-04-24 12:41:52 +03:00
Val Packett
b344bd3a7d ext2fs: extract crc16 into sys/crc16.h
deduplicate this as it might be needed for other drivers (e.g. Apple SPI-HID)

Sponsored by:	https://www.patreon.com/valpackett
Reviewed by:	chuck, imp
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32879
2023-04-24 12:41:52 +03:00
Bjoern A. Zeeb
da8fa4e37a ath10k: import ath10k driver
Import ISC-licensed ath10k driver assumed to be
based on Linux kvalo/ath.git master at
6bae9de622d3ef4805aba40e763eb4b0975c4f6d.

Import support to redirect fwlogs to kernel messages
from https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/389075

Complement the driver to make compile on FreeBSD
using LinuxKPI with changes covered by #ifdef (__FreeBSD__).
Further select updates were applied since the initial import
in order to keep compiling along with other LinuxKPI based
drivers.

Any other native driver using BUS_PROBE_DEFAULT will attach
ignoring this one by default given bsd_probe_return is set
to a lower priority.

Add the module build framework.

We only support PCI parts.

The firmware is provided by port net/wifi-firmware-ath10k-kmod.

Given the lack of full license texts on most files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by:	core (emaste, 2022-04-08) [1]
MFC after:	2 months
2023-04-23 21:31:07 +00:00
Bjoern A. Zeeb
ebacd8013f athk: import common code for ath1?k drivers
Import common ISC-licensed athk parts assumed to be
based on Linux kvalo/ath.git master at
6bae9de622d3ef4805aba40e763eb4b0975c4f6d.

The only modification should be for FreeBSD module
handling in main.c.

Add the module build framework unconnected to the
build for now.

These files will be shared by ath1?k drivers.

MFC after:	2 months
2023-04-23 21:31:07 +00:00
Bjoern A. Zeeb
06a1103fe3 ath10k: ath11k: add specific LinuxKPI support
Add files needed by ath1?k drivers to linuxkpi/linuxkpi_wlan.
This contain (skeleton) implementations of what is needed to
compile but specifically mhi/qmi/qrtr will need more work for
ath11k.

MFC after:	2 months
2023-04-23 21:31:07 +00:00
Bjoern A. Zeeb
3c4ba5f554 mt76: add module build framework and man pages
Add framework to build if_mt7915 and if_mt7921 with LinuxKPI
as well as initial man pages for the two mt76 chipset drivers.

MFC after:	2 months
2023-04-23 21:31:07 +00:00
Bjoern A. Zeeb
6c92544d7c mt76: import mediatek/mt76 driver
Import ISC-licensed driver parts of mediatek/mt76
assumed to be based on Linux wireless-testing at
a02411a5b98612c12be99349836d99f07db12a77 (tag: wt-2022-11-23).

Complement the driver and LinuxKPI with our own (dummy)
implementations of missing parts (util.h and soc/mediatek/)
as well as changes to make compile on FreeBSD with changes
covered by #ifdef (__FreeBSD__) conditions.
Further select updates were applied since the initial import
in order to keep compiling along with other LinuxKPI based
drivers.

For the moment we only target the mt7915 and mt7921 PCI parts.
More may follow in the future.

Firmware is provided by port net/wifi-firmware-mt76-kmod.

Given the lack of full license texts on non-local files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by:	core (emaste, 2022-04-08) [1]
MFC after:	2 months
2023-04-23 21:29:49 +00:00
Dimitry Andric
42162fb2fe kcsan: add __tsan_mem(cpy|move|set) aliases for clang >= 16
Summary:
After https://github.com/llvm/llvm-project/commit/b4257d3bf58c ("[tsan]
Replace mem intrinsics with calls to interceptors") intrinsic calls to
memcpy, memmove or memset will directly call sanitizer interceptors,
e.g. __tsan_memcpy, __tsan_memmove or __tsan_memset.

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

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

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

Reviewed by:	markj
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D39772
2023-04-23 20:59:06 +02:00
Mark Johnston
4b39a12830 arm64: Disable PAC when booting on a Windows Dev Kit 2023
It appears that PAC registers are configured to trap upon access, but
since the kernel starts in EL1 on this platform it has no ability to
inspect or modify this configuration.  Simply disable PAC on this
platform for now, since the kernel otherwise hangs during boot.

PR:		270472
Reviewed by:	andrew, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D39748
2023-04-23 13:55:57 -04:00
Mark Johnston
ff13b92475 riscv: Implement bus_describe_intr() for nexus
Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39750
2023-04-23 13:55:57 -04:00
Mark Johnston
7623cc8f65 arm64: Implement bus_describe_intr() for nexus
Prompted by a compiler warning introduced by
e582d4a2b0 ("arm64: nexus code tidy-up").

Reviewed by:	mhorne, andrew
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39749
2023-04-23 13:55:57 -04:00
Mark Johnston
93998d166f inpcb: Fix some bugs in _in_pcbinshash_wild()
- In _in_pcbinshash_wild(), we should avoid returning v6 sockets unless
  no other matches are available.  This preserves pre-existing
  semantics.
- Fix an inverted test: when inserting a non-jailed PCB, we want to
  search for the first non-jailed PCB in the hash chain.
- Test the right PCB when searching for a non-jailed PCB.

While here, add a required locking assertion.

Fixes:	7b92493ab1 ("inpcb: Avoid inp_cred dereferences in SMR-protected lookup")
2023-04-23 13:55:57 -04:00
Michael Tuexen
66d6fd5322 sctp: use constants from RFC 8260 to improve compliance
Keep the old constants for backwards compatibility.

MFC after:	1 week
2023-04-23 17:48:05 +02:00
Bjoern A. Zeeb
0e8953b94b LinuxKPI: pci.h: always initialize return value
In pcie_capability_read_*() always initialize the return value to
avoid warnings of uninitialized values in callers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D39721
2023-04-23 13:29:30 +00:00
Dimitry Andric
d142601887 powerpc: fix a few pmap related functions to return correct types
While experimenting with changing boolean_t to another type, I noticed
that several powerpc pmap related functions returned the wrong type:
boolean_t instead of int.

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

MFC after:	3 days
2023-04-23 15:23:04 +02:00
Zhenlei Huang
b658c0fce1 ip_mroute: Delete unreachable code
As the flag M_WAITOK is passed to ip_encap_attach(), then the function
will never return NULL, and the following code within NULL check branch
will be unreachable.

No functional change intended.

Reviewed by:	kp
Fixes:		6d8fdfa9d5 Rework IP encapsulation handling code
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39746
2023-04-23 12:47:57 +08:00
Zhenlei Huang
c373e1d6ad if_stf: Delete unreachable code
As the flag M_WAITOK is passed to ip_encap_attach(), then the function
will never return NULL, and the following code within NULL check branch
will be unreachable.

No functional change intended.

Reviewed by:	kp
Fixes:		6d8fdfa9d5 Rework IP encapsulation handling code
MFC after:	1 week
Differential Revision:  https://reviews.freebsd.org/D39746
2023-04-23 12:47:57 +08:00
Dmitry Chagin
66e8f1f7d3 linux(4): Fix arm64 build after b7a6bcdd, missed chunk added
MFC after:		1 month
2023-04-23 01:41:12 +03:00
Dmitry Chagin
0ef30b5d6b linux(4): Bump osrelease to 5.15.0
Linux kernel version 5.15 named Trick or Treat is a 22nd LTS release.

Reviewed by:		trasz, emaste
Differential Revision:	https://reviews.freebsd.org/D39649
MFC after:		1 month
2023-04-22 22:18:08 +03:00
Dmitry Chagin
b7a6bcdd13 linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata
AT_MINSIGSTKSZ has appeared in the 5.13.0 Linux kernel first time.

Differential Revision:	https://reviews.freebsd.org/D39648
MFC after:		1 month
2023-04-22 22:17:52 +03:00
Dmitry Chagin
70eab81d6f linux(4): Export the AT_EXECFN depending on the process osreldata
AT_EXECFN has appeared in the 2.6.26 Linux kernel first time.

Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D39647
MFC after:		1 month
2023-04-22 22:17:36 +03:00
Dmitry Chagin
40c36c4674 linux(4): Export the AT_RANDOM depending on the process osreldata
AT_RANDOM has appeared in the 2.6.30 Linux kernel first time.

Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D39646
MFC after:		1 month
2023-04-22 22:17:17 +03:00
Dmitry Chagin
56c5230afd linux(4): Fix LINUX_AT_COUNT comments
Differential Revision:	https://reviews.freebsd.org/D39645
MFC after:		1 month
2023-04-22 22:16:43 +03:00