Commit Graph

9327 Commits

Author SHA1 Message Date
Richard Scheffenegger
bb1d472d79 tcp: make CUBIC the default congestion control mechanism.
This changes the default TCP Congestion Control (CC) to CUBIC.
For small, transactional exchanges (e.g. web objects <15kB), this
will not have a material effect. However, for long duration data
transfers, CUBIC allocates a slightly higher fraction of the
available bandwidth, when competing against NewReno CC.

Reviewed By: tuexen, mav, #transport, guest-ccui, emaste
Relnotes: Yes
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D36537
2022-09-13 12:09:21 +02:00
Adrian Chadd
7d0e83c60b arm: add dwc3/xhci as build options for ARM
Summary:
This mirrors the recentish changes to armv8; the ipq4018 port uses
dwc3 + xhci and thus needs this.

Subscribers: imp, andrew

Reviewed by: imp

Differential Revision: https://reviews.freebsd.org/D36530
2022-09-11 19:36:42 -07:00
Dag-Erling Smørgrav
d3791ac46a NOTES: add Veriexec options and modules.
Sponsored by:	Klara, Inc.
MFC after:	1 week
2022-09-09 14:11:19 +02:00
Andrew Turner
949bc17cf2 Import the arm64 Cortex Strings memset into the kernel
Bring in the last version of the optimized memset from the Cortex
Strings library that didn't use the VFP registers. While here clean up
to use the ENTRY/EDIT macros.

This is imported from:
https://git.linaro.org/toolchain/cortex-strings.git/tree/src/aarch64/memset.S?id=bc654e7a594385071b42db3c9c94bd0fd5fe0da5

Sponsored by:	The FreeBSD Foundation
2022-09-08 14:30:09 +01:00
Andrew Turner
51a1bf7ba7 Import an optimized arm64 memcmp into the kernel
Bring in a version of the Arm Optimized Routines memcpy from before
the VFP registers were used.

Imported with modification from:
https://github.com/ARM-software/optimized-routines/blob/e823e3abf5f89ecb/string/aarch64/memcmp.S

Sponsored by:	The FreeBSD Foundation
2022-09-08 14:29:37 +01:00
Andrew Turner
8c6e5d8cf1 Import an optimized str{n}cmp on arm64
These are from the Arm Optimized Routines and don't use the VFP so are
safe to use in the kernel.

Sponsored by:	The FreeBSD Foundation
2022-09-08 14:23:20 +01:00
Andrew Turner
01e478d955 Update the arm64 kernel memcpy/memmove
Bring in the latest Arm Optimized Routines memcpy/memmove into the
arm64 kernel. As these functions have been merged in the current
version remove the now unneeded memmove.S.

Sponsored by:	The FreeBSD Foundation
2022-09-08 14:23:20 +01:00
Gleb Smirnoff
aa74cc6d6f divert(4): do not depend on ipfw(4)
Although originally socket was intended to use with ipfw(4) only, now
it also can be used with pf(4).  On a kernel without packet filters,
it still can be used to inject traffic.
2022-09-06 20:54:57 -07:00
Gleb Smirnoff
e72c522858 divert(4): make it compilable and working without INET
Differential revision:	https://reviews.freebsd.org/D36383
2022-08-30 15:09:21 -07:00
Mark Johnston
465988e9fa NOTES: Update the comment for MCLSHIFT
MFC after:	1 week
2022-08-24 19:59:32 -04:00
Mark Johnston
b0b0e4ee00 NOTES: Update the default MSIZE and MCLSHIFT values
After commit 840327e5dd ("mbuf: Don't support PAGE_SIZE < 4K"), these
defaults were causing LINT kernel builds to fail.

Reported by:	Jenkins
MFC after:	1 week
2022-08-24 19:57:33 -04:00
Navdeep Parhar
2bb28b5f8c cxgbe(4): Update firmwares to 1.27.0.0.
Changes since 1.26.6.0 are listed here.  This list comes from the
Release Notes for "Chelsio Unified Wire 3.17.0.0 for Linux" dated
2022-07-29.

Fixes
-----

BASE:
- Enabled all MA parity interrupt bits.
- Use config file value to override number of rx channel. nrxch=1 was not
  handled in the firmware.
- Replaced read only registers with new registers EDC_H_BIST_USER_WDATA0,
  EDC_H_BIST_USER_WDATA1 and EDC_H_BIST_CMD_LEN to dump the uP memory parity
  error status registers.
- 10G simplex module support enabled.

Obtained from:	Chelsio Communications
MFC after:	1 month
Sponsored by:	Chelsio Communications
2022-08-16 01:06:32 -07:00
Mateusz Guzik
648edd6378 x86: remove MP_WATCHDOG
It does not work with ULE, which is the default scheduler for over a
decade.

Reviewed by:	emaste, kib
Differential Revision:	https://reviews.freebsd.org/D36094
2022-08-11 21:35:32 +00:00
Gleb Smirnoff
f63cb32c19 Retire 4.4BSD raw sockets
Until today the remnants of the original code had provided some aid
in implementation of routing socket and IPSEC key socket.  There were
more obfuscation rather than generalisation with this aid.

A historical reference on the original idea of the raw sockets can
be found in chapter 11 of 4.4BSD System Manager Manual:

https://raw.githubusercontent.com/sergev/4.4BSD-Lite2/master/usr/share/doc/smm/18.net.pdf

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36124
2022-08-11 09:19:36 -07:00
Alexander V. Chernikov
102e6817f0 devd: move all devd notification logic to a separate file.
Currently, subr_bus.c shares logic for (a) maintaining all HW devices
 (e.g. discovery/attach/detach logic) and (b) generic devctl notification
 layer for devices/PMU/GEOM/interfaces/etc).
These two subsystems share really tiny interaction interface, composed of 3
 notification functions. With that in mind, move devctl layer to a
 separate file, establishing a clear notification interface between the
 sub.c bus layer and the provider (devctl).

The primary driver of this change is netlink implementation (D36002).
The idea is to propagate device-level events to netlink as well, so all
 netlink customers can subscribe to these changes.
The long-term goal is to deprecate devctl and to use netlink as the
 kernel<> userland transport provided netlink gets enough traction.

Reviewed by:	imp, markj
Differential Revision: https://reviews.freebsd.org/D36091
MFC after:	1 month
2022-08-10 18:56:01 +00:00
Alexander V. Chernikov
5c4d2252d7 routing: move rtentry and subscription code out of route_ctl.c
route_ctl.c size has grown considerably since initial introduction.
Factor out non-relevant parts:
* all rtentry logic, such as creation/destruction and accessors
 goes to net/route/route_rtentry.c
* all rtable subscription logic goes to net/route/route_subscription.c

Differential Revision: https://reviews.freebsd.org/D36074
MFC after:	1 month
2022-08-10 18:56:01 +00:00
Alexander V. Chernikov
2ce553854c routing: add rib_<add|del>_route_px() functions operating with nexthops.
This change adds public KPI to work with routes using pre-created
 nexthops, instead of using data from addrinfo structures. These
 functions will be later used for adding/deleting kernel-originated
 routes and upcoming netlink protocol.

As a part of providing this KPI, low-level route addition code has been
 reworked to provide more control over route creation or change.
 Specifically, a number of operation flags
 (RTM_F_<CREATE|EXCL|REPLACE|APPEND>) have been added, defining the
 desired behaviour the the route already exists (or not exists). This
 change required some changes in the multipath addition code, resulting
 in moving this code to route_ctl.c, rendering mpath_ctl.c empty.

Differential Revision: https://reviews.freebsd.org/D36073
MFC after:	1 month
2022-08-10 18:56:01 +00:00
Luiz Souza
adff82ea35 Add the PHY driver for the Marvell 88E1512.
This driver supports the auto negotiation mode between the copper and fiber
ports.

This PHY has two independent PHYs (one for copper and other for fiber) but in
this case the functionality is presented as a single PHY for easy management.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-08-09 15:59:22 +02:00
John Baldwin
bbb2f53715 cxgbe: Rename t4_kern_tls.c to t6_kern_tls.c.
This implementation of NIC TLS is specific to T6 adapters.

Sponsored by:	Chelsio Communications
2022-08-08 11:21:53 -07:00
Mark Johnston
f4f56ff43d qat: Rename to qat_c2xxx and remove support for modern chipsets
A replacement QAT driver will be imported, but this replacement does not
support Atom C2xxx hardware.  So, the existing driver will be kept
around to provide opencrypto offload support for those chipsets.

Reviewed by:	pauamma, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35817
2022-07-27 11:10:52 -04:00
Dimitry Andric
e726e71056 Suppress unused variable warning for zfs_fm.c
With clang 15, the following -Werror warning is produced:

    sys/contrib/openzfs/module/zfs/zfs_fm.c:256:6: error: variable 'cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int cnt = 0;
                ^

The 'cnt' variable does not seem to be used for anything, but since this
is contributed code, suppress the warning instead.

MFC after:	3 days
2022-07-26 22:08:14 +02:00
Dimitry Andric
e83ffec3af Suppress -Wstrict-prototypes for several zlib files
Clang 15 is more strict about function definitions not matching
declarations, and zlib has a lot of these, but since it is contributed
code (and in K&R style to boot), suppress those warnings instead.

MFC after:	3 days
2022-07-26 21:25:08 +02:00
Dimitry Andric
3c9a0112ba Fix unused variable warning in acpica's nsaccess.c
With clang 15, the following -Werror warning is produced:

    sys/contrib/dev/acpica/components/namespace/nsaccess.c:452:29: error: variable 'NumCarats' set but not used [-Werror,-Wunused-but-set-variable]
        UINT32                  NumCarats;
                                ^

Here, 'NumCarats' is a variable that is only used when debugging. Since
acpica is contributed code, suppress the warning with a compile flag.

MFC after:	3 days
2022-07-20 21:10:43 +02:00
Mitchell Horne
287d467c5d mac: add new mac_ddb(4) policy
Generally, access to the kernel debugger is considered to be unsafe from
a security perspective since it presents an unrestricted interface to
inspect or modify the system state, including sensitive data such as
signing keys.

However, having some access to debugger functionality on production
systems may be useful in determining the cause of a panic or hang.
Therefore, it is desirable to have an optional policy which allows
limited use of ddb(4) while disabling the functionality which could
reveal system secrets.

This loadable MAC module allows for the use of some ddb(4) commands
while preventing the execution of others. The commands have been broadly
grouped into three categories:
 - Those which are 'safe' and will not emit sensitive data (e.g. trace).
   Generally, these commands are deterministic and don't accept
   arguments.
 - Those which are definitively unsafe (e.g. examine <addr>, search
   <addr> <value>)
 - Commands which may be safe to execute depending on the arguments
   provided (e.g. show thread <addr>).

Safe commands have been flagged as such with the DB_CMD_MEMSAFE flag.

Commands requiring extra validation can provide a function to do so.
For example, 'show thread <addr>' can be used as long as addr can be
checked against the system's list of process structures.

The policy also prevents debugger backends other than ddb(4) from
executing, for example gdb(4).

Reviewed by:	markj, pauamma_gundo.com (manpages)
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35371
2022-07-18 22:06:15 +00:00
Mitchell Horne
2449b9e5fe mac: kdb/ddb framework hooks
Add three simple hooks to the debugger allowing for a loaded MAC policy
to intervene if desired:
 1. Before invoking the kdb backend
 2. Before ddb command registration
 3. Before ddb command execution

We extend struct db_command with a private pointer and two flag bits
reserved for policy use.

Reviewed by:	markj
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35370
2022-07-18 22:06:13 +00:00
Mark Johnston
1424f65bbc vm_pager: Remove the default pager
It's unused now.  Keep the OBJ_DEFAULT identifier, but make it an alias
of OBJT_SWAP for the benefit of out-of-tree code.

Reviewed by:	alc, imp, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35790
2022-07-17 07:09:48 -04:00
Brooks Davis
3bf6636512 cddl/*: add a WITH(OUT)_DTRACE option
Add an option to enable/disable DTrace without disabling ZFS.  New
architectures such as CHERI may support ZFS before they support DTrace
and the old model of WITHOUT_CDDL disabling both wasn't helpful.

For compatiblity, the CDDL option remains and WITHOUT_CDDL implies
WITHOUT_DTRACE.  WITHOUT_DTRACE also implies WITHOUT_CTF.

As part of this change, largely convert cddl/*/Makefile to using the
more compact SUBDIR.${MK_<FOO>}+= form rather than using intermediate
variables.

Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D35718
2022-07-06 14:03:48 +01:00
Bjoern A. Zeeb
fbb5cb66f7 dwc3: add ACPI attachment
Split the current FDT-only implementation up into an FDT and an
ACPI part reusing and sharing as much code as possible (thanks mw!).

This makes the Synopsis XHCI root hubs attach correctly on SolidRun's
HoenyComb instead of just the generic XHCI root and this means we
are also doing proper chip setup and applying the quirk needed there [1].

There is one problem with ACPI attachment in that it uses the generic
XHCI PNP ID.  So we need to do extra checks in order to not claim
all xhci, which means we check for a known quirk to be present
in acpi_probe.  Long term this isn't scaling and this was discussed
in SolidRun's Discord Channel in 2021 with the intend that "jnettlet"
will take this to a steering committee.  Since then ACPI has kind-of
become a technology non grata (due to not getting changes into Linux
timely) so it is unclear if this will ever happen.  If there will be
further hardware with dwc3/ACPI we should go and make sure this problem
gets solved.

[1] 24698f90b7/Silicon/NXP/LX2160A/AcpiTables/Dsdt/Usb.asl

Reviewed by:		manu, mw
MFC after:		10 days
Differential Revision:	https://reviews.freebsd.org/D32256
2022-07-06 11:26:34 +00:00
Bjoern A. Zeeb
97dbd37753 pca954x: harmonize pca9547 and pca954x and add pca9540 support
The two implementations for the pca9548 switch and the pca9547 mux
seemed close enough so we can put them together and with a bit more
abstraction add pca9540 support.

While here apply a bit of consistency in variable and driver naming and
use device_has_property instead of the FDT-only OF_ variant.

This disconnects pca9547 from the build but does not yet delete it.

MFC after:	2 weeks
Reviewed by:	mmel (earlier version), avg
Differential Revision: https://reviews.freebsd.org/D35701
2022-07-04 19:12:01 +00:00
Bjoern A. Zeeb
8154df37a5 arm64: NXP add LS1088a clockgen support
Add a driver for NXP LS1088a clockgen support which passes
configuration information to QorIQ clockgen class.
The implementaiton started off as copy of ls1028 support and was
adjusted accordingly.

Reviewed by:	dgr_semihalf.com (earlier), mmel
MFC after:	1 week
Sponsored by:	Traverse Technologies (providing Ten64 HW for testing)
Differential Revision: https://reviews.freebsd.org/D35617
2022-07-02 16:27:23 +00:00
Dag-Erling Smørgrav
038405f32f Enable CRC64 checksums in xz.
Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D35668
2022-06-29 20:25:52 +00:00
Kristof Provost
ab91feabcc ovpn: Introduce OpenVPN DCO support
OpenVPN Data Channel Offload (DCO) moves OpenVPN data plane processing
(i.e. tunneling and cryptography) into the kernel, rather than using tap
devices.
This avoids significant copying and context switching overhead between
kernel and user space and improves OpenVPN throughput.

In my test setup throughput improved from around 660Mbit/s to around
2Gbit/s.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34340
2022-06-28 11:33:10 +02:00
Bjoern A. Zeeb
d78bef0ebe hwpmc: further fix build (__diagused/debug/missing files entries)
Fix builds after 1459a22787 and
59191f3573 by using __diagused
for variables only used in KASSERT().
In addition remove two debug lines that look like a copy and paste error
from dmc620 to cmn600.
Further add the newly introduced files to sys/confg/files.arm64 as well
so that LINT compiles without missing symbols.
2022-06-27 01:36:52 +00:00
Andrew Turner
52f6e63ab3 Fix the zfs build for arm64
Remove -mgeneral-regs-only when building the arm64 blake3 code. It
uses simd instructions so will use non-general purpose registers.

Sponsored by:	The FreeBSD Foundation
2022-06-24 14:50:12 +01:00
Martin Matuska
d1aefbc04c zfs: fix static module build broken in 1f1e2261e 2022-06-23 19:44:38 +02:00
Ed Maste
a4d55999dc Remove ISA sound cards from NOTES
Fixes:		df51e63eb5 ("Retire snd_ad1816 ISA sound card driver")
Fixes:		aa83e9b189 ("Retire snd_ess ISA sound card driver")
Fixes:		754decef38 ("Retire snd_gusc ISA sound card driver")
Fixes:		5126e5eeeb ("Retire snd_mss ISA sound card driver")
Fixes:		716924cb48 ("Retire snd_sbc ISA sound card driver")

Sponsored by:	The FreeBSD Foundation
2022-06-21 16:33:00 -04:00
Ed Maste
716924cb48 Retire snd_sbc ISA sound card driver
Along with the snd_sb8 and snd_sb16 drivers.  They supported ISA
Creative Sound Blaster and compatible sound cards.

Note that isa/sb.h is not removed, as it is still used by some PCI
sound card drivers.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933b
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by:	mav
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34671
2022-06-21 14:50:04 -04:00
Ed Maste
5126e5eeeb Retire snd_mss ISA sound card driver
The snd_mss driver supported Microsoft Sound System sound cards.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933b
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by:	mav
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	Thttps://reviews.freebsd.org/D34671
2022-06-21 14:50:04 -04:00
Ed Maste
754decef38 Retire snd_gusc ISA sound card driver
snd_gusc supported the Gravis UltraSound MAX and UltraSound PnP sound
cards.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933b
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by:	mav
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34671
2022-06-21 14:50:04 -04:00
Ed Maste
aa83e9b189 Retire snd_ess ISA sound card driver
snd_ess supported sound cards using the ESS 18xx chipset.

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933b
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by:	mav
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34671
2022-06-21 14:50:04 -04:00
Ed Maste
df51e63eb5 Retire snd_ad1816 ISA sound card driver
snd_ad1816 supported ISA sound cards based on the Analog Devices
AD1816A "SoundPort® Controller".

ISA sound card drivers are deprecated as discussed on the current[1] and
stable[2] mailing lists.  Deprecation notices were added in e39ec8933b
and MFCd to stable branches.

Driver removals are being committed individually so that specific
drivers can be restored if necessary (either in FreeBSD or by downstream
projects).

[1] https://lists.freebsd.org/archives/freebsd-current/2022-March/001680.html
[2] https://lists.freebsd.org/archives/freebsd-stable/2022-March/000585.html

Reviewed by:	mav
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34671
2022-06-21 14:50:04 -04:00
John Baldwin
6ab35c78fb newvers.sh: Don't use return to exit.
Commit acfb506b3d replaced an exit 0 when using -V with a return
instead.  FreeBSD's sh treats a return outside of a function like
exit, but this is a non-portable extension.  Other Bourne shells only
permit return to be used within a function and continue execution
(possibly with a warning).

To fix, don't reuse VARS_ONLY (which is intended to be set by other
scripts before sourcing newvers.sh directly) and instead use a new
variable (VARS_ONLY_EXIT) to restore the use of exit for the
non-sourced case.

Reviewed by:	emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35481
2022-06-14 10:51:39 -07:00
John Baldwin
628a4156a7 firmware: Map '@' in filenames to '_' in symbols.
'@' is not a valid character in symbol names and can sometimes appear
in path names.

Reviewed by:	imp, markj
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35480
2022-06-14 10:50:51 -07:00
Brooks Davis
d07600c563 amd64: symlink i386 includes into build dir
By creating an i386 symlink, this allows code compiled with -m32 to
build (32-bit vdso and linux bits) when -m32 support requires files
in the i386 hierarchy.

Reviewed by:	jhb, imp
2022-06-13 18:35:38 +01:00
Ed Maste
a7bd57de86 Sort SPLIT_KERNEL_DEBUG correctly in kern.opts.mk
Fixes:		e3709cfe6a ("Add SPLIT_KERNEL_DEBUG knob")
2022-06-09 10:39:52 -04:00
Ed Maste
e3709cfe6a Add SPLIT_KERNEL_DEBUG knob
Prior to 9b6edf364e WITHOUT_KERNEL_SYMBOLS split kernel debug data
into standalone debug files at build time, but did not install those
files.  As of 9b6edf364e it stopped splitting the debug data, leaving
it in the kernel and modules (the default kernel configs include
DEBUG=-g).

Revert 9b6edf364e and introduce a new build-time SPLIT_KERNEL_DEBUG
knob, as some people rely on the pre-9b6edf364eb0 WITHOUT_KERNEL_SYMBOLS
behaviour and that was imp's original intent.

PR:		264433
Reviewed by:	eugen, imp
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35437
2022-06-08 17:14:46 -04:00
Mitchell Horne
acdfbc6cbe irdma: fix LINT-NOIP/NOINET/NOINET6 builds
This module depends on the presence of both INET and INET6 options in
order to compile.

Reviewed by:	erj
Fixes:	cdcd52d41e ("irdma: Add RDMA driver for Intel(R) Ethernet...")
Differential Revision:	https://reviews.freebsd.org/D35343
2022-05-30 17:47:55 -03:00
Bartosz Sobczak
cdcd52d41e
irdma: Add RDMA driver for Intel(R) Ethernet Controller E810
This is an initial commit for RDMA FreeBSD driver for Intel(R) Ethernet
Controller E810, called irdma.  Supporting both RoCEv2 and iWARP
protocols in per-PF manner, RoCEv2 being the default.

Testing has been done using krping tool, perftest, ucmatose, rping,
ud_pingpong, rc_pingpong and others.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	#manpages (pauamma_gundo.com) [documentation]
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D34690
2022-05-23 16:52:49 -07:00
Eric Joyner
8a13362d49
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>

MFC after:	1 week
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D30889
2022-05-23 16:23:49 -07:00
Andrew Turner
88ac318759 Support LSE atomics in the arm64 casue* functions
As with atomic(9) use the ARMv8.1 Large System Extension atomic
instructions to implement the userspace compare and swap functions.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35234
2022-05-19 11:30:21 +01:00
Dimitry Andric
0817c8dc2a Avoid adding -d to kernel module link command lines for lld >= 14
Since 0b3178a45c we have added '-d' to the link command line for
kernel modules, so if any unexpected common symbols turn up (even though
we use -fno-common in CFLAGS), storage will be allocated in in the
module itself.

However, with lld this option did not have any effect since ~2017, and
as of lld 14 it warns: "-d, -dc, -dp, and --[no-]define-common will be
removed. See https://github.com/llvm/llvm-project/issues/53660"

Add a linker type and version check, to avoid adding the option for lld
14 and later.

Reported by:	bz
MFC after:	2 weeks
2022-05-14 22:07:12 +02:00
Ruslan Bukin
a5ec261a7c Add FDT attachment driver for ARM System MMU v3.2 controller.
Tested on ARM Morello Board.

Sponsored by:	UKRI
2022-05-07 11:18:35 +01:00
John Baldwin
0b377a49fa FB_INSTALL_CDEV: Remove this option and related code.
This option was never enabled in GENERIC and does not appear to work
(the cdevsw is stored in a global array but never passed to make_dev
to be associated with a character device).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D35008
2022-04-21 10:29:14 -07:00
John Baldwin
8b83d7e0ee Make -Wunused-but-set-variable a fatal error for clang 13+ for kernel builds.
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D34949
2022-04-18 16:06:27 -07:00
John Baldwin
615d289ffe Re-enable set but not used warnings for kernel builds.
make tinderbox now passes with this warning enabled as a fatal error,
so revert the change to hide it in preparation for making it fatal.

This reverts commit e8e691983b.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D34948
2022-04-18 16:06:14 -07:00
John Baldwin
a95c70012b zfs: Disable -Wunused-but-set-variable for dnode.c.
dn is only used by DNODE_VERIFY (conditional on ZFS_DEBUG) in
dnode_special_open.
2022-04-13 16:08:20 -07:00
John Baldwin
1ae22e62e4 infiniband: Disable -Wunused-but-set-variable for a few more OFED files. 2022-04-12 14:58:59 -07:00
Roger Pau Monné
b93f47eaee xen/acpi: upload Cx and Px data to Xen
When FreeBSD is running as dom0 (initial domain) on a Xen system it
has access to the native ACPI tables and is the OSPM. However the
hypervisor is the entity in charge of the CPU idle and frequency
states, and in order to perform this duty it requires information
found the ACPI dynamic tables that can only be parsed by the OSPM.

Introduce a new Xen specific ACPI driver to fetch the Processor
related information and upload it to Xen. Note that this driver needs
to take precedence over the generic ACPI CPU driver when running as
dom0, so downgrade the probe score of the native driver to
BUS_PROBE_DEFAULT in order for the Xen specific driver to use
BUS_PROBE_SPECIFIC.

Tested on an Intel NUC to successfully parse and upload both the Cx and
Px states to Xen.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb kib
Differential revision: https://reviews.freebsd.org/D34841
2022-04-12 10:03:26 +02:00
Gordon Bergling
efd0fdfe28 NOTES: Remove a double word in comments
- s/for for/for/

MFC after:	3 days
2022-04-09 10:31:49 +02:00
John Baldwin
b367bd1952 ce: Disable -Wunused-but-set-variable for obfuscated tau32-ddk.c. 2022-04-08 17:25:13 -07:00
John Baldwin
db3603ff09 ibcore: Disable set but unused warnings. 2022-04-06 16:45:29 -07:00
John Baldwin
d68cc5a839 isci: Disable set but unused warnings. 2022-04-06 16:45:28 -07:00
Warner Losh
2f3b67560a zstd: Supress set but unused warnings for zstd_compress_superblock.c
Sponsored by:		Netflix
2022-04-05 21:42:05 -06:00
Robert Wing
e8e691983b suppress set but not used warnings for kernel builds
Use -Wno-unused-but-set-variable for kernel builds with clang13.

To turn this warning back on, set the following in src.conf:
    WITH_SET_BUT_NOTUSED_KERNEL_WARNINGS=

Reviewed by:	mjg, imp
Differential Revision:	https://reviews.freebsd.org/D34784
2022-04-05 13:34:34 -08:00
Warner Losh
ff8d9d9c56 config.mk: Add opt_platform.h support
opt_platform.h is now included from miivar.h, so add support for
generating it in the standalone build case.

Sponsored by:		Netflix
2022-04-05 13:52:55 -06:00
Mitchell Horne
c9114f9f86 Add new vnode dumper to support live minidumps
This dumper can instantiate and write the dump's contents to a
file-backed vnode.

Unlike existing disk or network dumpers, the vnode dumper should not be
invoked during a system panic, and therefore is not added to the global
dumper_configs list. Instead, the vnode dumper is constructed ad-hoc
when a live dump is requested using the new ioctl on /dev/mem. This is
similar in spirit to a kgdb session against the live system via
/dev/mem.

As described briefly in the mem(4) man page, live dumps are not
guaranteed to result in a usuable output file, but offer some debugging
value where forcefully panicing a system to dump its memory is not
desirable/feasible.

A future change to savecore(8) will add an option to save a live dump.

Reviewed by:	markj, Pau Amma <pauamma@gundo.com> (manpages)
Discussed with:	kib
MFC after:	3 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D33813
2022-04-05 15:35:05 -03:00
Gordon Bergling
b34f7568d1 NOTES: Fix a typo in a comments
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:50:04 +02:00
Martin Matuska
da5137abdf zfs: merge openzfs/zfs@bc3f12bfa (master) into main
Notable upstream pull request merges:
  #12083 libzfs: FreeBSD doesn't resize partitions for you
  #13106 add physical device size to SIZE column in 'zpool list -v'
  #13158 Allow zfs send to exclude datasets
  #13190 module: zfs: zio_inject: zio_match_handler: don't << -1
  #13219 FreeBSD: add missing replay check to an assert in zfs_xvattr_set
  #13220 module: freebsd: avoid a taking a destroyed lock in zfs_zevent bits
  #13221 Fix ACL checks for NFS kernel server

Obtained from:	OpenZFS
OpenZFS commit:	bc3f12bfac
2022-03-29 12:07:34 +02:00
Ed Maste
92e6b4712b Retire broken snd_ds1 and snd_maestro drivers
In 2012 joel@ reported[1] that these were not functional, and they do
not appear to have been fixed since.

[1] https://lists.freebsd.org/pipermail/freebsd-multimedia/2012-January/012751.html

Reported by:	joel
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2022-03-18 20:33:19 -04:00
John Baldwin
2814ba8ef1 Move NO_WUNUSED_BUT_SET_VARIABLE clang helper to the right place.
Reviewed by:	imp, dim, emaste
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34537
2022-03-14 14:05:25 -07:00
Eric Joyner
56429daea2
ice(4): Update to 1.34.2-k
- Adds FW logging support
  - Once enabled, this lets the firmware print event and error messages
    to the log, increasing the visibility into what the hardware is
    doing; this is useful for debugging
- General bug fixes
- Adds inital DCB support to the driver
  - Notably, this adds support for DCBX to the driver; now with the
    fw_lldp sysctl set to 1, the driver and adapter will adopt a DCBX
    configuration sent from a link partner
  - Adds statistcs sysctls for priority flow control frames
  - Adds new configuration sysctls for DCB-related features: (VLAN) user
    priority to TC mapping; ETS bandwidth allocation; priority flow
    control
- Remove unused SR-IOV files (until support gets added)

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Tested by:	jeffrey.e.pieper@intel.com
MFC after:	3 days
MFC with:	213e91399b, e438f0a975
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D34024
2022-03-04 10:51:41 -08:00
Vladimir Kondratyev
d5add41d4d ietp(4): Driver for Elantech I2C touchpad
MFC after:	2 month
Tested by:	Matt Daw <matt.daw_AT_gmail_DOT_com>
2022-03-03 02:35:24 +03:00
Vladimir Kondratyev
5aa839c9e2 bcm5974: wsp(4) driver version with HID attachment.
MFC after:	2 month
Tested by:	Greg V (Type 4 touchpads)
2022-03-03 02:35:23 +03:00
Vladimir Kondratyev
1ef67193ba hid: Add missed dependency on usbdevs.h for static builds
MFC after:	2 month
2022-03-03 02:35:23 +03:00
Warner Losh
369216b039 ath: fix older clang build.
Define NO_WUNUSED_BUT_SET_VARIABLE for newer clang, and use it in ATH_C
to account for different clang versions. Use it in Makefiles as well.

Sponsored by:		Netflix
Reviewed by:		kevans, jhb
Differential Revision:	https://reviews.freebsd.org/D34408
2022-03-01 22:55:34 -07:00
Warner Losh
7dda139e6d ath: missed a chance to use ${ATH_C}
Fixes:		8881d206f4 (reviewed by scottl, markj in D34401)
Noticed by:	markj
Sponsored by:	Netflix
2022-03-01 14:00:14 -07:00
Warner Losh
8881d206f4 ath: Suppress set but unused warnings
The ath driver has a lot of these warnings. It's an older driver, so
just supress these warnings until they can be fixed. They are a mix of
simple dead stores, debubgging output and stuff that would require
careful study to know if its safe to remove the access or not (there are
likely very few of the latter, but if there are any they are latent bugs
that compiler could optimize away). Since I have no ath hardware to test
on anymore, take the conservative approach.

Sponsored by:		Netflix
2022-03-01 08:06:42 -07:00
Kirk McKusick
c7996ddf80 Create a new GEOM utility, gunion(8).
The gunion(8) utility is used to track changes to a read-only disk on
a writable disk. Logically, a writable disk is placed over a read-only
disk. Write requests are intercepted and stored on the writable
disk. Read requests are first checked to see if they have been
written on the top (writable disk) and if found are returned. If
they have not been written on the top disk, then they are read from
the lower disk.

The gunion(8) utility can be especially useful if you have a large
disk with a corrupted filesystem that you are unsure of how to
repair. You can use gunion(8) to place another disk over the corrupted
disk and then attempt to repair the filesystem. If the repair fails,
you can revert all the changes in the upper disk and be back to the
unchanged state of the lower disk thus allowing you to try another
approach to repairing it. If the repair is successful you can commit
all the writes recorded on the top disk to the lower disk.

Another use of the gunion(8) utility is to try out upgrades to your
system. Place the upper disk over the disk holding your filesystem
that is to be upgraded and then run the upgrade on it. If it works,
commit it; if it fails, revert the upgrade.

Further details can be found in the gunion(8) manual page.

Reviewed by: Chuck Silvers, kib (earlier version)
tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D32697
2022-02-28 16:36:08 -08:00
Emmanuel Vadot
b7bfded146 files: Make mmc_fdt_helper and sdhci depends on clk and regulator
Those two frameworks are needed.
2022-02-23 08:47:57 +01:00
Emmanuel Vadot
adbb32d3e6 files: Make mmc_pwrseq depends on regulator and clk
It uses those two frameworks too.
2022-02-22 11:22:23 +01:00
Emmanuel Vadot
832adbd4c4 files: Make mmc_helpers depends on regulator and clk
It also needs those two framework.
2022-02-22 10:01:22 +01:00
Mitchell Horne
da5b7e90e7 boottrace: a simple boot and shutdown-time tracing facility
Boottrace is a facility for capturing trace events during boot and
shutdown. This includes kernel initialization, as well as rc. It has
been used by NetApp internally for several years, for catching and
diagnosing slow devices or subsystems. It is driven from userspace by
sysctl interface, and the output is a human-readable log of events
(kern.boottrace.log).

This commit adds the core boottrace functionality implementing these
interfaces. Adding the trace annotations themselves to kernel and
userland will happen in follow-up commits. A future commit will also add
a boottrace(4) man page.

For now, boottrace is unconditionally compiled into the kernel but
disabled by default. It can be enabled by setting the
kern.boottrace.enabled tunable to 1 in loader.conf(5).

There is an existing boot-time event tracing facility, which can be
compiled into the kernel with 'options TSLOG'. While there is some
functional overlap between this and boottrace, they are distinct. TSLOG
is suitable for generating detailed timing information and flamegraphs,
and has been used to great success by cperciva@ to diagnose and reduce
the overall system boot time. Boottrace aims to more quickly provide an
overview of timing and resource usage of the boot (and shutdown) process
to a sysadmin who requires this knowledge.

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#23
Differential Revision:	https://reviews.freebsd.org/D30184
2022-02-21 20:15:45 -04:00
Emmanuel Vadot
f898e41925 files: Make mmc_helper depend on gpio
mmc_helper have an hard dependency on gpio_if.h
gpio(4) isn't in the default x86 kernel and none of the x86
sd/mmc drivers uses mmc_helper so just add a dependency on gpio.

Fixes: 85b3794cee ("files: Make ext_resources non-optional")
2022-02-21 18:31:00 +01:00
Emmanuel Vadot
8b39d2fe35 options: Remove EXT_RESOURCES
It is now unused in kernel code.

MFC after:	Never
Differential Revision:	https://reviews.freebsd.org/D33839
2022-02-21 17:29:15 +01:00
Emmanuel Vadot
85b3794cee files: Make ext_resources non-optional
EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D33834
2022-02-21 17:29:06 +01:00
Michal Meloun
960ce3f7b2 Fix a534b50e24 on powerpc.
MFC with:	1bd3e8ba69
2022-02-20 14:06:29 +01:00
Michal Meloun
1bd3e8ba69 ofw_iicbus: Add method for manual setting of basic OFW parameters.
Some IIC multifunction devices may have multiple I2C addresses per chip, but
only the primary address is listed in the DT (e.g. MAX776200). In this case,
the sub-devices for the secondary addresses must be created manually with
fixed OFW parameters (node, name, compatibility string, IIC address).
Add a bus method to the ofw_iicbus interface that does this.

MFC after:	4 weeks
2022-02-20 12:25:58 +01:00
David E. O'Brien
aea2a658ef Don't delete hack.c - causes perpetual 'out of date' kernel
Deleting hack.c cause the kernel to always be out of date:

   $ make kernel
   make: /usr/src/sys/amd64/compile/GENERIC/.depend.hack.pico, 1:
	     ignoring stale .depend for hack.c
   :> hack.c
   cc -shared -O2 -pipe ... -nostdlib hack.c -o hack.pico
   rm -f hack.c
   MAKE="make" sh ../../../conf/newvers.sh "-R" GENERIC
   cc -c -O2 -pipe ...  -std=iso9899:1999 -Werror  vers.c
   ctfconvert -L VERSION -g vers.o
   linking kernel.full

Keeping hack.c in the compile directory causes no harm,
so there's no reason to delete it.

Also rename the file to "force-dyamic-hack.c" so it is
clear what the hack is aboug.

Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D34281
2022-02-16 20:02:50 -08:00
John Baldwin
2f6a842484 Disable -Wreturn-type on GCC.
GCC is more pedantic than clang about warning when a function doesn't
handle undefined enum values (see GCC bug 87950).  Clang's warning
gives a more pragmatic coverage and should find any real bugs, so
disable the warning for GCC rather than adding __unreachable
annotations to appease GCC.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D34147
2022-02-14 11:48:47 -08:00
Ed Maste
acfb506b3d newvers.sh: allow multiple -V args in one invocation
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34253
2022-02-12 11:06:54 -05:00
Konstantin Belousov
fd8d4e53bc vdso linker scripts: explicitly specify output arch and target
Requested by:	jhb
Reviewed by:	emaste, imp, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34157
2022-02-12 00:32:23 +02:00
Dimitry Andric
5f2aca8394 Disable clang 14 warning about bitwise operators in zstd
Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after:	3 days
2022-02-08 21:46:08 +01:00
John Baldwin
c227269e2f Stop adding -Wredundant-decls to CWARNFLAGS.
clang doesn't implement it, and Linux doesn't enforce it.  As a
result, new instances keep cropping up both in FreeBSD's code and in
upstream sources from vendors.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D34144
2022-02-07 12:47:51 -08:00
Richard Scheffenegger
f7220c486c tcp: move ECN handling code to a common file
Reduce the burden to maintain correct and
extensible ECN related code across multiple
stacks and codepaths.

Formally no functional change.

Incidentially this establishes correct
ECN operation in one instance.

Reviewed By: rrs, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34162
2022-02-05 15:04:42 +01:00
Richard Scheffenegger
7994ef3c39 Revert "tcp: move ECN handling code to a common file"
This reverts commit 0c424c90ea.
2022-02-05 01:07:51 +01:00
Richard Scheffenegger
0c424c90ea tcp: move ECN handling code to a common file
Reduce the burden to maintain correct and
extensible ECN related code across multiple
stacks and codepaths.

Formally no functional change.

Incidentially this establishes correct
ECN operation in one instance.

Reviewed By: rrs, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34162
2022-02-04 22:54:41 +01:00
John Baldwin
63b7c2df8e Disable -Wunused-function for {ed,x}25519_ref10.c in libsodium. 2022-02-02 12:25:16 -08:00
Konstantin Belousov
21a37c3cc6 Exclude DEBUG_VFS_LOCKS from non-debug kernel configs
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-02-02 19:27:32 +02:00
Hans Petter Selasky
84d7b8e75f mlx5en: Implement TLS RX support.
TLS RX support is modeled after TLS TX support. The basic structures and layouts
are almost identical, except that the send tag created filters RX traffic and
not TX traffic.

The TLS RX tag keeps track of past TLS records up to a certain limit,
approximately 1 Gbyte of TCP data. TLS records of same length are joined
into a single database record.

Regularly the HW is queried for TLS RX progress information. The TCP sequence
number gotten from the HW is then matches against the database of TLS TCP
sequence number records and lengths. If a match is found a static params WQE
is queued on the IQ and the hardware should immediately resume decrypting TLS
data until the next non-sequential TCP packet arrives.

Offloading TLS RX data is supported for untagged, prio-tagged, and
regular VLAN traffic.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:17 +01:00
Hans Petter Selasky
2c0ade806a mlx5: Implement flow steering helper functions for TCP sockets.
This change adds convenience functions to setup a flow steering rule based on
a TCP socket. The helper function gets all the address information from the
socket and returns a steering rule, to be used with HW TLS RX offload.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:16 +01:00
Hans Petter Selasky
694263572f mlx5en: Implement support for internal queues, IQ.
Internal send queues are regular sendqueues which are reserved for WQE commands
towards the hardware and firmware. These queues typically carry resync
information for ongoing TLS RX connections and when changing schedule queues
for rate limited connections.

The internal queue, IQ, code is more or less a stripped down copy
of the existing SQ managing code with exception of:

1) An optional single segment memory buffer which can be read or
   written as a whole by the hardware, may be provided.
2) An optional completion callback for all transmit operations, may
   be provided.
3) Does not support mbufs.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:15 +01:00
Emmanuel Vadot
1961a14a47 linuxkpi: Add i2c support
Add i2c support to linuxkpi. This is needed by drm-kmod.
For every i2c_adapter added by i2c_add_adapter we add a child to the
device named "lkpi_iic". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
For every i2c_adapter added by i2c_bit_add_bus we add a child to the
device named "lkpi_iicbb". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
With the help of iic(4), this expose the i2c controller to userspace
allowing a user to query DDC information from a monitor.
e.g.: i2c -f /dev/iic0 -a 0x28 -c 128 -d r
will query the standard EDID from the monitor if plugged.

The bitbang part (lkpi_iicbb) isn't tested at all for now as I don't have
compatible hardware (all my hardware have native i2c controller).

Tested on:	Intel (SandyBridge, Skylake, ApolloLake)
Tested on:	AMD (Picasso, Polaris (amd64 and arm64))

MFC after:	1 month
Reviewed by:	hselasky
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33053
2022-01-25 16:15:39 +01:00
Eric Joyner
e438f0a975
ice_ddp: Update to 1.3.27.0
This is intended to be used with forthcoming ice(4) driver version 1.34.2.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation
2022-01-24 18:25:56 -08:00
John Baldwin
16cf646a6f crypto: Remove xform.c and compile xform_*.c standalone.
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33995
2022-01-24 15:27:40 -08:00
John Baldwin
1d95c6f9c0 Don't implicitly pull in most of 'device crypto' for 'options IPSEC'.
options IPSEC is already documented as requiring 'device crypto' and
duplicating the dependencies is harder to read and not always
consistent.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33990
2022-01-24 15:27:39 -08:00
John Baldwin
0c6274a819 crypto: Add an API supporting curve25519.
This adds a wrapper around libsodium's curve25519 support matching
Linux's curve25519 API.  The intended use case for this is WireGuard.

Note that this is not integrated with OCF as it is not related to
symmetric operations on data.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33935
2022-01-24 15:27:39 -08:00
Martin Matuska
5025e85013 zfs: fix kernel build after e92ffd9b6 if ZFS is compiled in
Add missing source file lz4_zfs.c to sys/conf/files
2022-01-23 09:27:27 +01:00
Piotr Kubaj
a0f3abb098 powerpc: enable ice in GENERIC64LE
Approved by:	erj
Differential Revision: https://reviews.freebsd.org/D33974
2022-01-21 02:17:46 +01:00
John Baldwin
42876a039e crypto: Stop compiling in chacha20poly1305 AEAD ciphers from libsodium.
These ciphers are now supported via OCF or 'struct enc_xform'.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33889
2022-01-18 14:48:40 -08:00
John Baldwin
e71680049b crypto: Add a simple API for [X]ChaCha20-Poly1035 on flat buffers.
This is a synchronous software API which wraps the existing software
implementation shared with OCF.  Note that this will not currently
use optimized backends (such as ossl(4)) but may be appropriate for
operations on small buffers.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33524
2022-01-18 14:47:13 -08:00
Roger Pau Monné
e0516c7553 x86/apic: remove apic_ops
All supported Xen instances by FreeBSD provide a local APIC
implementation, so there's no need to replace the native local APIC
implementation anymore.

Leave just the ipi_vectored hook in order to be able to override it
with an implementation based on event channels if the underlying local
APIC is not virtualized by hardware. Note the hook cannot use ifuncs,
because at the point where ifuncs are resolved the kernel doesn't yet
know whether it will benefit from using the optimization.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D33917
2022-01-18 10:19:04 +01:00
Colin Percival
c2705ceaeb x86: Speed up clock calibration
Prior to this commit, the TSC and local APIC frequencies were calibrated
at boot time by measuring the clocks before and after a one-second sleep.
This was simple and effective, but had the disadvantage of *requiring a
one-second sleep*.

Rather than making two clock measurements (before and after sleeping) we
now perform many measurements; and rather than simply subtracting the
starting count from the ending count, we calculate a best-fit regression
between the target clock and the reference clock (for which the current
best available timecounter is used). While we do this, we keep track
of an estimate of the uncertainty in the regression slope (aka. the ratio
of clock speeds), and stop measuring when we believe the uncertainty is
less than 1 PPM.

In order to avoid the risk of aliasing resulting from the data-gathering
loop synchronizing with (a multiple of) the frequency of the reference
clock, we add some additional spinning depending upon the iteration number.

For numerical stability and simplicity of implementation, we make use of
floating-point arithmetic for the statistical calculations.

On the author's Dell laptop, this reduces the time spent in calibration
from 2000 ms to 29 ms; on an EC2 c5.xlarge instance, it is reduced from
2000 ms to 2.5 ms.

Reviewed by:	bde (previous version), kib
MFC after:	1 month
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D33802
2022-01-12 12:34:07 -08:00
Andrew Turner
85b7c566f1 Add arm64 pointer authentication support
Pointer authentication allows userspace to add instructions to insert
a Pointer Authentication Code (PAC) into a register based on an address
and modifier and check if the PAC is correct. If the check fails it will
either return an invalid address or fault to the kernel.

As many of these instructions are a NOP when disabled and in earlier
revisions of the architecture this can be used, for example, to sign
the return address before pushing it to the stack making Return-oriented
programming (ROP) attack more difficult on hardware that supports them.

The kernel manages five 128 bit signing keys: 2 instruction keys, 2 data
keys, and a generic key. The instructions then use one of these when
signing the registers. Instructions that use the first four store the
PAC in the register being signed, however the instructions that use the
generic key store the PAC in a separate register.

Currently all userspace threads share all the keys within a process
with a new set of userspace keys being generated when executing a new
process. This means a forked child will share its keys with its parent
until it calls an appropriate exec system call.

In the kernel we allow the use of one of the instruction keys, the ia
key. This will be used to sign return addresses in function calls.
Unlike userspace each kernel thread has its own randomly generated.

Thread0 has a static key as does the early code on secondary CPUs.
This should be safe as there is minimal user interaction with these
threads, however we could generate random keys when the Armv8.5
Random number generation instructions are present.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31261
2022-01-12 15:27:17 +00:00
Andrew Turner
2754373f9a Use ${MACHINE} for the kernel modeule ldscript
For consistancy with the kernel linker script also use ${MACHINE} for
finding the kernel module linker script. As we currently only use this
for amd64 and i386 this is a no-op, but I'm planning on using this with
arm64 where ${MACHINE} != ${MACHINE_ARCH}.

Reviewed by:	markj, kib, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33841
2022-01-11 16:58:31 +00:00
Mitchell Horne
d72e944812 riscv: gdb(4) support
Add the MD portion required for the gdb stub.

Reviewed by:	jhb (earlier version)
Discussed with:	jrtc27
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33734
2022-01-10 13:40:12 -04:00
Hubert Mazur
f21c469dbc Add driver for marvell, a37x0 peripheral clocks
Add driver for Marvell, Armada-37xx peripheral clock.
Register clocks for various peripheral devices in
north bridge or south bridge domain. Dump clock's
domain while verbose boot.

Reviewed by:
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D32294
2022-01-04 13:26:35 +01:00
Hubert Mazur
127e4d9524 Add driver for armada, 37x0-tbg-clock
Driver for tbg clocks. Read reference frequency from parent
and modify it depending on parameters read from register.

Reviewed by:		manu
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D32293
2022-01-04 13:26:34 +01:00
Hubert Mazur
01b9c59fd2 Add driver for marvell, armada-3700 oscillator
Driver registers new clock device. Clock frequency is set depending
on tenth bit's value obtained from syscon register. Full information
about the clock is dumped if bootverbose is enabled.

Driver was tested on EspressoBin.

Reviewed by:		manu
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D32292
2022-01-04 13:26:34 +01:00
Navdeep Parhar
3b76242433 cxgbe(4): Update firmwares to 1.26.6.0.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CHANGES
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Version : 1.26.6.0
Date    : 01/03/2022
================================================================================

Fixes
-----
BASE:
- Fixed one module eeprom read failure.
- Fixed an issue with speed selection when 40G and 25G are advertised and
  supported.
- Fixed a random traffic hang when T5 receives invalid ets BW in dcbx
  messages from a switch.
- Fixed very long link up time with few switches.
================================================================================

Obtained from:	Chelsio Communications
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2022-01-03 15:24:42 -08:00
Mark Johnston
5ba4192565 Remove an obsolete warning from NOTES
The PREEMPTION option is enabled in all GENERIC kernel configurations.

MFC after:	1 week
2022-01-03 13:00:50 -05:00
Warner Losh
e0281204cc Add clarifying comments
Expand on the terse comments for where each of these files is used.

Reviewed by:		emaste
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D33716
2022-01-02 00:30:58 -07:00
Warner Losh
0c8968c6b0 mips: remove forgotten options file too
Sponsored by:		Netflix
2021-12-31 15:09:46 -07:00
Warner Losh
5a73a6c178 Add lio back to NOTES
lio appears to be partially removed from this file. It's a modern enough
card, so add it back. It builds everywhere.

Sponsored by:		Netflix
2021-12-31 14:56:16 -07:00
Warner Losh
c09981f142 mips: Remove sys/mips
Remove sys/mips as the next step of decomissioning mips from the tree.
Remove mips special cases from the kernel make files. Remove the mips
specific linker scripts.

Sponsored by:		Netflix
2021-12-30 20:57:24 -07:00
Bjoern A. Zeeb
6b4cac814e LinuxKPI: add 802.11 compat code
Add 802.11 compat code for mac80211 and to a minimal degree cfg80211.
This allows us to compile and use basic functionality of wireless
drivers such as iwlwifi.

This is a constant work in progress but having it in the tree will
allow others to test and more easy to track changes and avoid having
snapshots no longer applying to branches.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-27 18:47:25 +00:00
Bjoern A. Zeeb
d105895844 LinuxKPI: import beginning of a new version of netdevice.h
Import a netdevice update complementing the last remaining bits of
the old ifnet derived implementation.  Along add a (for now) task
based NAPI implementation.

This is the minimal set of chnages which are needed for the initial
support of wireless drivers.  The NAPI implementation has an option to
still switch to "direct dispatch" as it had been used by these drivers
before not relying on a deferred context along with some printf tracing.
This has been helpful in the last weeks for debugging and will be
cleaned once we have had broader testing and are sure this is fine as-is.
Should we need a more time-sensitive or load-sensitive response
in the future we can always switch to something more sophisticated.

Sponsored by:		The FreeBSD Foundation
MFC after:		3 days
X-Differential Revision: D33075 (abandoned without feedback a while ago)
2021-12-27 18:47:25 +00:00
Bjoern A. Zeeb
49ed6e979c LinuxKPI: add a work-in-progress skbuff implementation
This is a work-in-progress implementation of sk_buff compat code
used for wireless drivers only currently.
Bring in this version of the code as it has proven to be good enough
to have packets going for a few months.

The current implementation has several drawbacks including the need
for us to copy data between sk_buffs and mbufs.
Do not rely on the internals of this implementation.  They are highly
likely to change as we will improve the integration to FreeBSD mbufs.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-27 18:47:25 +00:00
Jessica Clarke
1846bbd1b3 arm64: Don't rely on host readelf for u-boot booti image generation
readelf is not a bootstrap tool and so cannot be relied upon to exist.
On macOS there is no system readelf, and even on Linux or FreeBSD where
it does exist, BUILD_WITH_STRICT_TMPPATH builds won't be able to use it.
Instead of making it a bootstrap tool, just use nm as that suffices and
already is a bootstrap tool.

Fixes:		28482babd0 ("arm64: Use new arm_kernel_boothdr script for generating booti images.")
Reviewed by:	emaste, mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32734
2021-12-24 19:25:20 +00:00
Andrew Turner
8ddb4b9b66 Extract the arm64 signal code to a new file
This will be used by the vdso signal trampoline on arm64.

While here fix the license as this part of locore.S to correct the
copyright owner.

Sponsored by:	The FreeBSD Foundation
2021-12-24 11:59:43 +00:00
Brandon Bergren
c583b02587 [PowerPC] PowerMac timebase sync for G4
Summary:
Disable timebase on (some) AIM platforms (tested on PowerMac G4) prior
to synchronization.

Some platforms use a GPIO to enable and disable timebase, while others
use a platform function.

This mirrors 0d69f00b on mpc85xx.

Todo:
 * Implement various G5 timebase controls.
 * Print out platform code on unknown G5s so we can collect it.
 * Change API to be give/take pairs like Linux does so it's possible to
   do a software sync protocol.

Reviewed By: #powerpc, jhibbits
Subscribers: mikael, markmi_dsl-only.net, luporl, alfredo
Tags: #powerpc
Differential Revision: https://reviews.freebsd.org/D29136
2021-12-23 16:06:07 -06:00
Adrian Chadd
0727f7b520 arm: add dwc3 as a compilable driver
The IPQ4018/IPQ4019 cores use the DWC3 core.  So make it available
here.
2021-12-23 10:36:51 -08:00
Cy Schubert
3b9b51fe46 ipfilter: Move kernel bits to netpfil
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sys/netpil. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to netpfil.

This is the first of three commits the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00
Kyle Evans
8ea3921f93 sysent: regenerate files every time
This forces everything to be regenerated by marking makesyscalls.lua
as .PHONY, which may be helpful in, e.g., rebase scenarios, which may
have unexpected effects on mtimes but still really need a regen.

For now we apply this to the default sysent target, which is ran
manually and not as a part of buildkernel.  We can reconsider this if
someone manually running it has issues with the runtime, but the top
level sysent target can run each in parallel; I recommend -j4 or so.

Requested by:	kib
Reviewed by:	brooks, kib (both earlier version)
Differential Revision:	https://reviews.freebsd.org/D33357
2021-12-16 20:56:28 -06:00
John Baldwin
eb2d9adb24 Sort libsodium entries by path in sys/conf/files.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33483
2021-12-16 13:46:48 -08:00
Warner Losh
31b35400cf pccard: Remove more of the PC Card infrastructure
Remove more of the pccard infrasturcture. CardBus Yenta driver (cbb)
still references the remaining bits. It needs some additiona work to
remove 16-bit support still, so it remains.

Sponsored by:		Netflix
2021-12-14 15:27:47 -07:00
Warner Losh
b4fba31b63 Remove references to PCMCIA
Remove more references to PCMCIA in kernel config files. We no longer
support PC Card devices.

Sponsored by:		Netflix
2021-12-14 15:27:47 -07:00
Warner Losh
21e22be91a ed: Remove options
ed(4) was removed some time ago, but these options relevant to only it
weren't GC'd at the time. Remove them.

Sponsored by:		Netflix
2021-12-09 17:41:39 -07:00
Navdeep Parhar
357ba2cf17 cxgbe(4): Update firmwares to 1.26.4.0
(Rest is from the README that came with the firmware)

Version : 1.26.4.0
Date    : 12/02/2021

Fixes
-----

BASE:
- Fixed error on setting 25G speed on 100G copper with multiple FEC set in
  firmware commands.
- Handle link of unknown optics modules by enabling module tx unconditionally.
- Fixed link not coming up for 25G CRS phys. Firmware incorrectly tried to
  bring up the link in RS-FEC but as per IEEE spec, it must be BASER FEC.
- Fixed an issue where firmware doesn't automatically retry next FEC if driver
  asks to bring up the link using RS-FEC and link doesn't come up.

Obtained from:	Chelsio Communications
MFC after:	1 month
Sponsored by:	Chelsio Communications
2021-12-09 11:25:31 -08:00
Jessica Clarke
169b368a62 amd64: Pass DEBUG when building VDSO wrapper
Not doing so results in ctfconvert failing with

  ERROR: ctfconvert: elf-vdso.so.o doesn't have type data to convert

On FreeBSD this is non-fatal, since the ctf tools have a hack to make
such errors not fail the build and instead just silently continue
without CTF data (which is a bad idea these days and should probably be
removed; they date back to the original import). However, those are
under #ifdef __FreeBSD__ so do not apply when cross-building from
non-FreeBSD, causing the build to fail.

Fix this by forwarding DEBUG on to the compiler invocation for the VDSO
wrapper. It's assembly so it's not hugely useful, but there is a
non-zero amount of information preserved, and other assembly files are
built with -g by default too so this matches them; the alternative would
be to tag the files.amd64 entries with no-ctfmerge. Note that the VDSO
itself is still compiled without debug info, this only affects the
wrapper linked into the kernel.

Fixes:		98c8b62524 ("vdso for ia32 on amd64"), ab4524b3d7 ("amd64: wrap 64bit sigtramp into vdso")
MFC after:	1 month
2021-12-07 00:24:20 +00:00
Konstantin Belousov
0f2d88d1eb amd64: Only build aout.ko when COMPAT_FREEBSD32 is enabled
a.out.ko is useless without COMPAT_FREEBSD32, and since vdso support was
added, it requires a header built during depend phase, from the COMPAT
option.

Reported by:	glebius
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33311
2021-12-07 02:10:48 +02:00
Konstantin Belousov
610173c593 kern.pre.mk: trim space at EoL
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33311
2021-12-07 02:00:12 +02:00
Mitchell Horne
339ef82773 Remove references to sio(4) from NOTES
Also zs(4) and sab(4), which have similarly been removed.

Reviewed by:	imp, jhb, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33279
2021-12-06 15:15:30 -04:00
Konstantin Belousov
d49b75d0d6 Enforce that vdso does not contain runtime relocations
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:47:30 +02:00
Konstantin Belousov
98c8b62524 vdso for ia32 on amd64
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:46:49 +02:00
Konstantin Belousov
ab4524b3d7 amd64: wrap 64bit sigtramp into vdso
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:46:49 +02:00
Konstantin Belousov
9b135747a3 kern.pre.mk: allow to use and customize elfdump during kernel build
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:46:49 +02:00
Florian Walpen
bf2fa8d9d1 MAC/priority module for realtime privilege group
This is a MAC policy module that grants scheduling privileges based on
group membership.  Users or processes in the group realtime (gid 47) are
allowed to run threads and processes with realtime scheduling priority.
For timing-sensitive, low-latency software like audio/jack, running with
realtime priority helps to avoid stutter and gaps.

PR:	239125
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D33191
2021-12-04 20:19:25 +02:00
Cy Schubert
db0ac6ded6 Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
This reverts commit 266f97b5e9, reversing
changes made to a10253cffe.

A mismerge of a merge to catch up to main resulted in files being
committed which should not have been.
2021-12-02 14:45:04 -08:00
Cy Schubert
266f97b5e9 wpa: Import wpa_supplicant/hostapd commit 14ab4a816
This is the November update to vendor/wpa committed upstream 2021-11-26.

MFC after:      1 month
2021-12-02 13:35:14 -08:00
Gleb Smirnoff
93c67567e0 Remove "options PCBGROUP"
With upcoming changes to the inpcb synchronisation it is going to be
broken. Even its current status after the move of PCB synchronization
to the network epoch is very questionable.

This experimental feature was sponsored by Juniper but ended never to
be used in Juniper and doesn't exist in their source tree [sjg@, stevek@,
jtl@]. In the past (AFAIK, pre-epoch times) it was tried out at Netflix
[gallatin@, rrs@] with no positive result and at Yandex [ae@, melifaro@].

I'm up to resurrecting it back if there is any interest from anybody.

Reviewed by:		rrs
Differential revision:	https://reviews.freebsd.org/D33020
2021-12-02 10:48:48 -08:00
Wojciech Macek
94e25b7acb flex_spi: Support for FlexSPI Flash controller.
NXP FlexSPI is a complex SPI controller which provides
full offload for accessing NOR Flash.
Create a Flash driver which attaches to existing FreeBSD
infrastructure and exports generic READ and WRITE disk commands.
The Flash has to be identified first to configure controller
internals. For now, only one NOR Flash chip is supported.
Future commits shall either increase number of known chips
or implement SFDP mechanism which can be used by other Flash
drivers.

Sponsored by:		Alstom
Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D33117
2021-11-30 06:41:34 +01:00
Andrew Turner
ae92ace05f Per-thread stack canary on arm64
With the update to llvm 13 we are able to tell the compiler it can find
the SSP canary relative to the register that holds the userspace stack
pointer. As this is unused in most of the kernel it can be used here
to point to a per-thread SSP canary.

As the kernel could be built with an old toolchain, e.g. when upgrading
from 13, add a warning that the options was enabled but the compiler
doesn't support it to both the build and kernel boot.

Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33079
2021-11-26 14:44:00 +00:00
Warner Losh
8722e05ae1 twa: Remove
Belatedly remove twa(4). It was supposed to go before 13.0, but was
overlooked.

Sponsored by:		Netflix
Relnotes:		yes
Reviewed by:		scottl
Differential Revision:	https://reviews.freebsd.org/D33114
2021-11-25 00:45:13 -07:00
Warner Losh
0d5935af8f esp: Remove
Belatedly remove esp(4). It was tagged as gone in 13, but was overlooked
until now.

Sponsored by:		Netflix
Reviewed by:		scottl
Differential Revision:	https://reviews.freebsd.org/D33115
2021-11-25 00:45:12 -07:00
Warner Losh
60de2867c9 amr: remove
Belatedly remove amr(4). It was slated to depart before 13.0 but was
overlooked until now.

Sponsored by:		Netflix
Relnotes:		yes
Reviewed by:		scottl
Differential Revision:	https://reviews.freebsd.org/D33113
2021-11-25 00:45:12 -07:00
Warner Losh
399188a2c6 iir: Remove
Belatedly remove iir(4). It was slated to go before 13, but was
overlooked.

Sponsored by:		Netflix
Relnotes:		yes
Reviewed by:		scottl
Differential Revision:	https://reviews.freebsd.org/D33112
2021-11-25 00:45:12 -07:00
Warner Losh
a9620045a5 mly: Remove.
We'd said this was going away in 13, but was overlooked. Belatedly
remove.

Sponsored by:		Netflix
Relnotes:		yes
Reviewed by:		scottl
Differential Revision:	https://reviews.freebsd.org/D33111
2021-11-25 00:45:12 -07:00
Eric Joyner
ca853dee3b
iavf(4): Split source and update to 3.0.26-k
The iavf(4) driver now uses a different source base from ixl(4), since
it will be the standard VF driver for new Intel Ethernet products going
forward, including ice(4). It continues to use the iflib framework
for network drivers.

Since it now uses a different source code base, this commit adds a new
sys/dev/iavf entry, but it re-uses the existing module name so no
configuration changes are necessary.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:		kbowling@
Tested by:		lukasz.szczepaniak@intel.com
Sponsored by:		Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D28636
2021-11-24 11:54:08 -08:00
Mark Johnston
ecbbe83144 netinet: Deduplicate most in_cksum() implementations
in_cksum() and related routines are implemented separately for each
platform, but only i386 and arm have optimized versions.  Other
platforms' copies of in_cksum.c are identical except for style
differences and support for big-endian CPUs.

Deduplicate the implementations for the rest of the platforms.  This
will make it easier to implement in_cksum() for unmapped mbufs.  On arm
and i386, define HAVE_MD_IN_CKSUM to mean that the MI implementation is
not to be compiled.

No functional change intended.

Reviewed by:	kp, glebius
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33095
2021-11-24 13:31:16 -05:00
Bjoern A. Zeeb
1c55b0ce1c std.nodebug: turn off net80211 debugging as well
Add IEEE80211_DEBUG to turn off some net80211 debbugging for
no-debug builds.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2021-11-24 18:06:20 +00:00
Hubert Mazur
26d6547567 Pcf85063: Add RTC driver
Add driver for pcf85063 real time clock. Register set and get time
methods. Parse data obtained from bus according to specification
and fill kernel structures.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32817
2021-11-24 07:40:38 +01:00
Hubert Mazur
cb35af13f9 TCA6408: Add driver for tca6408 gpio expander
Driver for tca6408 gpio expander over i2c bus. Expose API for
manipulating pin's direction, state and polarity inversion.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32819
2021-11-24 07:40:38 +01:00
Kornel Duleba
0c9156faec Introduce DP83822 PHY driver
DP83822 is a 10/100 Texas Instruments PHY.
Link status change interrupts are supported by the driver,
however not all boards have the PHY interrupt wired.
Because of that if failure to allocate an IRQ is not treated as an error.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32815
2021-11-24 07:40:36 +01:00
Kornel Duleba
e85c94b8d6 Introduce DP83867 PHY driver
DP83867 is a 10/100/1000 Texas Instruments PHY.
Only SGMII mode is supported.
Link status changes can be checked through an interrupt generated by the PHY,
if available

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32813
2021-11-24 07:40:36 +01:00
Gleb Smirnoff
ce40632a31 ifnet: append if_debug.c to if.c
With this change if_index can become static.  There is nothing
that if_debug.c would want to isolate from if.c.  Potentially
if.c wants to share everything with if_debug.c.

Move Bjoern's copyright to if.c.

Reviewed by:	bz
2021-11-22 19:49:57 -08:00
N.J. Mann
a11983366e pchtherm: Let the driver be compiled into the kernel
PR:		259776
MFC after:	1 week
2021-11-22 12:12:37 -05:00
Konstantin Belousov
0d7a6199b6 kmod_syms.awk: fix removal of the export list from the symbol table
Print some warning when export is requested for non-existing symbol.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32878
2021-11-18 15:56:24 +02:00
Brooks Davis
e02f64d9b8 freebsd32: add real abort2
Previously, the code would copy twice as many pointers as specified
and print pairs of them a single 64-bit pointer.

abort2 doesn't return so make the return type void

freebsd32_abort2 is in it's own file with a 2-clause BSD license
based on a discussion with Wojciech many years ago.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Stefan Eßer
09cd634160 zfs: fix commit dae1713419 merge openzfs/zfs@269b5dadc into main
Commit dae1713419 did not add two required lines for edonr specific
functionality to this file, causing kernel build failures if ZFS is
compiled in.

This commit should be included in an eventual MFC of dae1713419.
2021-11-17 13:16:39 +01:00
Kristof Provost
4e85b64890 Add a COMPAT_FREEBSD13 kernel option
Use it wherever COMPAT_FREEBSD11 is currently specified.

Reviewed by:	jhb (previous version)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33005
2021-11-17 03:08:40 +01:00
Emmanuel Vadot
98c60dc31f pmic: rockchip: Split the driver in rk805 and rk808
This make the base driver cleaner and the subclassed driver only have
related code.

Kernel config wise this is still only handled by rk805.

No functional changes intended.
2021-11-14 12:31:26 +01:00
Emmanuel Vadot
cb3c3e0a42 pmic: rockchip: Split the clocks part in its own file
No functional changes intended.
2021-11-14 12:31:23 +01:00
Emmanuel Vadot
ad651f176b pmic: rockchip: Split the regulators part in its own file
No functional changes intended.
2021-11-14 12:31:21 +01:00
Emmanuel Vadot
328077bb8f pmic: rockchip: Split the rtc part in its own file
Even if for now all the RTC-related register are at the same offset don't
use some hardcoded values for them but set them based on the PMIC type.

No functional changes intended.
2021-11-14 12:31:18 +01:00
Emmanuel Vadot
51919325ff arm64: rockchip: Move rk805 pmic driver to dev/iicbus/pmic/rockchip
Having all PMIC driver at the same place makes it easier.
2021-11-14 12:31:07 +01:00
Jessica Clarke
a2fa290024 mips: Fix build of kernel.tramp.bin after upstream merge
Since the upstream merge we end up with the compiler generating calls to
memcpy (and it appears upstream LLVM does too, so this will probably
also be a problem upstream when the LLVM 13 import is finished). Like
the kernel we should just compile this file with -ffreestanding to avoid
such surprises.

Note that elf_trampoline.c does actually provide a memcpy, but it's
static. That's a bit weird, and means by the time the memcpy calls are
generated by the compiler the explicit ones have already been inlined
and the function itself GC'ed, but since using -ffreestanding is the
right thing to do for this kind of code anyway, that doesn't actually
matter.

Obtained from:	https://github.com/CTSRD-CHERI/cheribsd/commit/219ddb6293c
2021-11-13 21:52:26 +01:00
Andriy Gapon
c0525ab1d1 pca954x: driver for PCA954x / TCA954x I2C switches
At the moment only PCA9548A is supported and has been tested.

MFC after:	2 weeks
2021-11-13 11:27:41 +02:00
Randall Stewart
b8d60729de tcp: Congestion control cleanup.
NOTE: HEADS UP read the note below if your kernel config is not including GENERIC!!

This patch does a bit of cleanup on TCP congestion control modules. There were some rather
interesting surprises that one could get i.e. where you use a socket option to change
from one CC (say cc_cubic) to another CC (say cc_vegas) and you could in theory get
a memory failure and end up on cc_newreno. This is not what one would expect. The
new code fixes this by requiring a cc_data_sz() function so we can malloc with M_WAITOK
and pass in to the init function preallocated memory. The CC init is expected in this
case *not* to fail but if it does and a module does break the
"no fail with memory given" contract we do fall back to the CC that was in place at the time.

This also fixes up a set of common newreno utilities that can be shared amongst other
CC modules instead of the other CC modules reaching into newreno and executing
what they think is a "common and understood" function. Lets put these functions in
cc.c and that way we have a common place that is easily findable by future developers or
bug fixers. This also allows newreno to evolve and grow support for its features i.e. ABE
and HYSTART++ without having to dance through hoops for other CC modules, instead
both newreno and the other modules just call into the common functions if they desire
that behavior or roll there own if that makes more sense.

Note: This commit changes the kernel configuration!! If you are not using GENERIC in
some form you must add a CC module option (one of CC_NEWRENO, CC_VEGAS, CC_CUBIC,
CC_CDG, CC_CHD, CC_DCTCP, CC_HTCP, CC_HD). You can have more than one defined
as well if you desire. Note that if you create a kernel configuration that does not
define a congestion control module and includes INET or INET6 the kernel compile will
break. Also you need to define a default, generic adds 'options CC_DEFAULT=\"newreno\"
but you can specify any string that represents the name of the CC module (same names
that show up in the CC module list under net.inet.tcp.cc). If you fail to add the
options CC_DEFAULT in your kernel configuration the kernel build will also break.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc.
RELNOTES:YES
Differential Revision: https://reviews.freebsd.org/D32693
2021-11-11 06:28:18 -05:00
Kornel Duleba
197ff4c35b ossl: Add support for AES-CBC cipher
AES-CBC OpenSSL assembly is used underneath.
The glue layer(ossl_aes.c) is based on CHACHA20 implementation.
Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic
does not have a fallback implementation in case CPU doesn't
support required instructions.
Because of that CPU caps are checked during initialization and AES
support is advertised only if available.
The feature is available on all architectures that ossl supports:
i386, amd64, arm64.

The biggest advantage of this patch over existing solutions
(aesni(4) and armv8crypto(4)) is that it supports SHA,
allowing for ETA operations.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Reviewed by:		jhb (previous version)
Differential revision:	https://reviews.freebsd.org/D32099
2021-11-08 10:53:31 +01:00
Oleksandr Tymoshenko
aa917184a9 add rk3328_codec and rk_i2s from gonzoua/socaudio
Not sure why these haven't been committed with the rest of the SoC Audio
project.  They work sufficiently well for me.

Discussed with:	manu
MFC after:	1 month
2021-11-06 19:47:10 +02:00
Andriy Gapon
24f567bb0e files.arm64: fix sort order for aw_i2s.c 2021-11-06 19:45:49 +02:00
Andriy Gapon
6354154ef5 pcf8574: driver for 8-pin quasi-bidirectional GPIO over I2C
MFC after:	2 weeks
2021-11-06 19:23:27 +02:00
Andriy Gapon
ff6fe29835 driver for MAX44009 I2C illuminance sensor 2021-11-06 19:19:04 +02:00
Andriy Gapon
a60b304697 pcf8591: driver for adc/dac with i2c interface 2021-11-06 19:14:50 +02:00
Wojciech Macek
200bc58953 Revert "ossl: Add support for AES-CBC cipher"
This reverts commit 849faf4e0b.
2021-11-06 17:46:01 +01:00
Kornel Duleba
463b6ba05a Introduce qoriq_gpio_pic driver
It adds the PIC functionality on top of qoriq_gpio driver.
We need a separate module since the powerpc PIC API is completely
different than on other architectures.

Two types of intr_map_data are supported:
INTR_MAP_DATA_GPIO and INTR_MAP_DATA_FDT.

This way interrupts can be allocated using the userspace gpio
interrupt allocation method, as well as directly from simplebus.
The latter can be used by devices that have its irq routed to a GPIO pin.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-11-06 09:08:45 +01:00
Kornel Duleba
849faf4e0b ossl: Add support for AES-CBC cipher
AES-CBC OpenSSL assembly is used underneath.
The glue layer(ossl_aes.c) is based on CHACHA20 implementation.
Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic
does not have a fallback implementation in case CPU doesn't
support required instructions.
Because of that CPU caps are checked during initialization and AES
support is advertised only if available.
The feature is available on all architectures that ossl supports:
i386, amd64, arm64.

The biggest advantage of this patch over existing solutions
(aesni(4) and armv8crypto(4)) is that it supports SHA,
allowing for ETA operations.

Sponsored by:		Stormshield
Obtained from:		Semihalf
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D32099
2021-11-06 09:08:44 +01:00
Mark Johnston
2a519c3b14 kasan: Disable validation of function parameters passed by value
It appears that the emitted code in the caller does not update shadow
state for values passed on the stack to the callee, which it seemingly
ought to do after pushing values on the stack and prior to the call
itself.  This leaves open a window where an interrupt handler can cause
regions of the stack containing these values to be poisoned, resulting
in rare false positive reports.  This happens particularly in the amd64
TLB invalidation code, where we liberally pass cpuset_t's around by
value.

LLVM has a flag to disable validation of accesses of function parameters
passed by value.  Such validation is itself a relatively new feature.
Turn it off for now.

Reported by:	pho, syzkaller
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-11-03 12:36:02 -04:00
Ruslan Bukin
4bb6991531 arm/pmu: add ACPI attachment.
This makes hwpmc(4) sampling work on ACPI-based AArch64 systems.
Tested on ARM Neoverse N1.

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: jrtc27, mhorne
Differential Revision: https://reviews.freebsd.org/D24423
2021-11-02 19:35:29 +00:00
Kornel Duleba
8c5fead105 Remove enetc_mdio driver
It was previously used by felix(4) for PHY communication.
Since that is not the case anymore this driver is now left unused.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-10-29 10:08:26 +02:00
Wojciech Macek
ccfa9ac5ac NXP: Add ls1028a SPI clock driver
Provide driver for LS1028A and LX2160 SPI clock modules.

Obtained from:		Semihalf
Sponsored by:		Alstom
Differential revision:	https://reviews.freebsd.org/D32689
2021-10-29 09:52:20 +02:00
Ed Maste
48cb3fee25 Retire obsolete iscsi_initiator(4)
The new iSCSI initiator iscsi(4) was introduced with FreeBSD 10.0, and
the old intiator was marked obsolete shortly thereafter (in commit
d32789d95c, MFC'd to stable/10 in ba54910169).  Remove it now.

Reviewed by:	jhb, mav
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32673
2021-10-26 16:17:35 -04:00
Gleb Smirnoff
6aae3517ed Retire synchronous PPP kernel driver sppp(4).
The last two drivers that required sppp are cp(4) and ce(4).

These devices are still produced and can be purchased
at Cronyx <http://cronyx.ru/hardware/wan.html>.

Since Roman Kurakin <rik@FreeBSD.org> has quit them, they no
longer support FreeBSD officially.  Later they have dropped
support for Linux drivers to.  As of mid-2020 they don't even
have a developer to maintain their Windows driver.  However,
their support verbally told me that they could provide aid to
a FreeBSD developer with documentaion in case if there appears
a new customer for their devices.

These drivers have a feature to not use sppp(4) and create an
interface, but instead expose the device as netgraph(4) node.
Then, you can attach ng_ppp(4) with help of ports/net/mpd5 on
top of the node and get your synchronous PPP.  Alternatively
you can attach ng_frame_relay(4) or ng_cisco(4) for HDLC.
Actually, last time I used cp(4) back in 2004, using netgraph(4)
instead of sppp(4) was already the right way to do.

Thus, remove the sppp(4) related part of the drivers and enable
by default the negraph(4) part.  Further maintenance of these
drivers in the tree shouldn't be a big deal.

While doing that, remove some cruft and enable cp(4) compilation
on amd64.  The ce(4) for some unknown reason marks its internal
DDK functions with __attribute__ fastcall, which most likely is
safe to remove, but without hardware I'm not going to do that, so
ce(4) remains i386-only.

Reviewed by:		emaste, imp, donner
Differential Revision:	https://reviews.freebsd.org/D32590
See also:		https://reviews.freebsd.org/D23928
2021-10-22 11:41:36 -07:00
Adrian Chadd
c29c0e6876 arm: allow the debug stuff in CP14 to be disabled at compile time
The upcoming QCA ipq401x support detects the CP14 debug features,
but any attempt to use it causes an undefined instruction error.
It apparently needs a specific TZ image loaded by the early bootloader
(SBL) in order to enable these kinds of features.

So add a new kernel option that explicitly disables this in the
arm code - the debugger works fine without it.
2021-10-18 19:18:56 +00:00
Adrian Chadd
8e53cd7099 ipq4018: add TCSR definitions from Linux.
These are hardware configuration options which are required in
the linux/openwrt device trees for the IPQ4018/IPQ4019 devices.

Since this isn't obtained from linux upstream but instead from
openwrt, this can't go in contrib; instead it is going in
sys/dts/include/ .

Obtained from: OpenWRT

Tested:

* IPQ4019 ASUS RT-AC58U AP, initial bootstrapping
2021-10-18 19:18:01 +00:00
Konstantin Belousov
4cc167a352 Restore PPS_SYNC in NOTES
This partially reverts e81e77c5a0, leaving the option both in
GENERICs on amd64/arm64/arm, and in global NOTES file.  Apparently
this better matches existing practice, where we do not try to hard
to make LINT and GENERIC complimentary.

Requested and reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-10-12 23:10:35 +03:00
Konstantin Belousov
e81e77c5a0 Enable PPS_SYNC on amd64, arm64 and armv7
Remove the option from NOTES/LINT, and add to NOTES for powerpc and
riscv.

PR:	259036
Requested by:	John Hay <john@sanren.ac.za>
Discussed with:	ian, imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-10-10 22:34:40 +03:00
Konstantin Belousov
aba66031f2 riscv: move signal delivery code to exec_machdep.c
Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Konstantin Belousov
dfaf65023e arm: move signal delivery code to exec_machdep.c
Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Konstantin Belousov
b4ae6b1660 arm64: move signal delivery code to exec_machdep.c
also move ptrace-related helpers to ptrace_machdep.c.

Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Konstantin Belousov
4c5bf59152 i386: move signal delivery code to exec_machdep.c
also move ptrace-related helpers to ptrace_machdep.c
Apply some style. Use ANSI C function definitions.
Remove MPSAFE annotations.

Reviewed by:	emaste, imp
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32310
2021-10-08 03:20:42 +03:00
Warner Losh
4b3da659bf nvme: Only reset once on attach.
The FreeBSD nvme driver has reset the nvme controller twice on attach to
address a theoretical issue assuring the hardware is in a known
state. However, exierence has shown the second reset is unnecessary and
increases the time to boot. Eliminate the second reset. Should there be
a situation when you need a second reset (for buggy or at least somewhat
out of the mainstream hardware), the hardware option NVME_2X_RESET will
restore the old behavior. Document this in nvme(4).

If there's any trouble at all with this, I'll add a sysctl tunable to
control it.

Sponsored by:		Netflix
Reviewed by:		cperciva, mav
Differential Revision:	https://reviews.freebsd.org/D32241
2021-10-01 11:09:34 -06:00
Andrew Turner
18c2139495 Add a gic interface to allocate MSI interrupts
The previous update to handle the gicv2m as a child of the gicv3 driver
assumed there was only a single gicv2m child. On some hardware there
are multiple children. Support this by removing the mbi ivars and
adding a new interface to handle MSI allocation in a given range.

Tested by:	mw, trasz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32224
2021-10-01 11:27:33 +01:00
Warner Losh
79a100e28e bluetooth: complete removal of ng_h4
The ng_h4 module was disconnected 13 years ago when the tty later was
locked by Ed. It completely fails to compile, and has a number of false
positives for Giant use. Remove it for lack of interest. Bluetooth has
largely (completely?) moved on from bluetooth over UART transport.

OK'd by:		emax
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31846
2021-09-29 20:00:02 -06:00
Vladimir Kondratyev
66ea390652 LinuxKPI: Remove FreeBSD struct resource from all LKPI headers
except linux/pci.h to avoid conflicts with Linux version.
This allows to #define resource in drm-kmod globally and strip some #ifdef-s

Reviewed by:	hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D31673
2021-09-29 23:12:36 +03:00
Bartlomiej Grzesik
adbce5ff74 sdhci_xenon: add ACPI support
Add support for ACPI device probing for SDHCI controller found on Marvell chips.

Reviewed by: mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31600
2021-09-29 16:19:28 +02:00
Bartlomiej Grzesik
d78e464d23 sdhci_xenon: split driver file into generic file and fdt parts
This patch splits driver code into two seperate files sdhci_xenon.c
and sdhci_xenon_fdt.c. This will allow future implementation of ACPI
discovery of sdhci on Xenon chips.

Reviewed by: mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31599
2021-09-29 16:19:28 +02:00
Navdeep Parhar
45d6fbaec2 cxgbe(4): Update firmwares to 1.26.2.0.
The firmwares and the following changelog are from the "Chelsio Unified
Wire v3.15.0.0 for Linux."

Version : 1.26.2.0
Date    : 09/24/2021
====================

FIXES
-----

BASE:
- Added support for SFP+ RJ45 (0x1C).
- Fixing backward compatibility issue with older drivers when multiple
  speeds are passed to firmware.

OFLD:
- Do not touch tp_plen_max if driver is supplying tp_plen_max. This
  fixes a connection reset issue in iscsi.

ENHANCEMENTS
------------

BASE:
- Firmware header modified to add firmware binary signature.

MFC after:	1 month
Sponsored by:	Chelsio Communications
2021-09-27 23:52:51 -07:00
John Baldwin
e72c7e2738 kernel: Disable errors for -Walloca-larger-than for GCC.
GCC complains about the use of alloca() with variable sizes (for XSAVE
state len) in sendsig() for i386.  Modern XSAVE state is probably
getting a bit large for the i386 kstack, but downgrade the error to a
warning.

Reviewed by:	kib, emaste
Differential Revision:	https://reviews.freebsd.org/D31934
2021-09-25 11:24:35 -07:00
Konstantin Belousov
cf0ee8738e Drop cloudabi
According to https://github.com/NuxiNL/cloudlibc:
CloudABI is no longer being maintained. It was an awesome experiment,
but it never got enough traction to be sustainable.

There is no reason to keep it in FreeBSD.

Approved by:	ed (private mail)
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31923
2021-09-22 00:18:44 +03:00
Konstantin Belousov
12ca33f44f amd64: move signal handling and register structures manipulations into exec_machdep.c
from machdep.c which is too large pile of unrelated things.
Some ptrace functions are moved from machdep.c to ptrace_machdep.c.

Now machdep.c contains code mostly related to the low level initialization
and regular low level operation of the architecture, while signal MD code
and registers handling is placed in exec_machdep.c.

Reviewed by:	jhb, markj
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31954
2021-09-21 20:20:15 +03:00
Bartlomiej Grzesik
8a8166e5bc mmc: switch mmc_helper to device_ api
Add generic mmc_helper which uses newly introduced device_*_property
api. Thanks to this change the sd/mmc drivers will be capable
of parsing both DT and ACPI description.

Ensure backward compatibility for all mmc_fdt_helper users.

Reviewed by: manu, mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31598
2021-09-20 17:18:02 +02:00
Guinan Sun
6b9d35fac1 e1000: remove duplicated phy codes
Add two files base.c and base.h to reduce the redundancy
in the silicon family code.
Remove the code duplication from e1000_82575 files.
Clean family specific functions from base.
Fix up a stray and duplicate function declaration.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (44dddd14059f151f39f7e075b887decfc9a10f11)
MFC after:	1 week
2021-09-17 14:17:15 -07:00
Artur Rojek
a3f0d18237 ena: fix building in-kernel driver
When building ENA as compiled into the kernel, the driver would fail to
build. Resolve the problem by introducing the following changes:
1. Add missing `ena_rss.c` entry in `sys/conf/files`.
2. Prevent SYSCTL_ADD_INT from throwing an assert due to an extra
CTLTYPE_INT flag.

Fixes: 986e7b9227 ("ena: Move RSS logic into its own source files")
Fixes: 6d1ef2abd3 ("ena: Implement full RSS reconfiguration")

Obtained from: Semihalf
Sponsored by: Amazon, Inc.
MFC after: 1 week
2021-09-16 16:47:45 +02:00
John Baldwin
44126818d2 infiniband: Disable -Wredundant-decl warnings.
ib_uverbs_flow_resources_free() is declard in two header files in
upstream OFED.  Disable the warning to avoid introducing diffs to fix
the build on GCC 9.

While here, fix the ibcore module to disable the same warnings
disabled in OFED_CFLAGS.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D31943
2021-09-15 09:03:18 -07:00
John Baldwin
828f257277 Remove nonexistent include path for arm64 crypto files.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D31932
2021-09-15 09:03:17 -07:00
Mark Johnston
cf4670fe0b kcov: Integrate with KMSAN
- kern_kcov.c needs to be compiled with -fsanitize=kernel-memory when
  KMSAN is configured since it calls into various other subsystems.
- Disable address and memory sanitizers in kcov(4)'s coverage sanitizer
  callbacks, as they do not provide useful checking.  Moreover, with
  KMSAN we may otherwise get false positives since the caller (coverage
  sanitizer runtime) is not instrumented.
- Disable KASAN and KMSAN interceptors in subr_coverage.c, as they do
  not provide any benefit but do introduce overhead when fuzzing.

Sponsored by:	The FreeBSD Foundation
2021-09-14 14:29:27 -04:00
Konstantin Belousov
2b6eec531a x86: duplicate acpi_wakeup.c per i386 and amd64
The file as is is the maze of #ifdef passages, all slightly different.
Divorcing i386 and amd64 version actually makes changing the code
easier, also no changes for i386 are planned.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31931
2021-09-14 00:23:14 +03:00
John Baldwin
b9485d76e3 Add EPOCH_TRACE to NOTES to get LINT coverage.
Sponsored by:	The FreeBSD Foundation
2021-09-11 13:05:44 -07:00
Alexander Motin
7af4475a6e vmd(4): Major driver refactoring
- Re-implement pcib interface to use standard pci bus driver on top of
vmd(4) instead of custom one.
 - Re-implement memory/bus resource allocation to properly handle even
complicated configurations.
 - Re-implement interrupt handling to evenly distribute children's MSI/
MSI-X interrupts between available vmd(4) MSI-X vectors and setup them
to be handled by standard OS mechanisms with minimal overhead, except
sharing when unavoidable.

Successfully tested on Dell XPS 13 laptop with Core i7-1185G7 CPU (VMD
device ID 0x9a0b) and single NVMe SSD, dual-booting with Windows 10.

Successfully tested on Supermicro X11DPI-NT motherboard with Xeon(R)
Gold 6242R CPUs (VMD device ID 0x201d), simultaneously handling NVMe
SSD on one PCIe port and PLX bridge with 3 NVMe and 1 AHCI SSDs on
another.  Handles SSD hot-plug (except Optane 905p for some reason,
which are not detected until manual bus rescan) and enabled IOMMU
(directly connected SSDs work, but ones connected to the PLX fail
without errors from IOMMU).

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
Differential revision:	https://reviews.freebsd.org/D31762
2021-09-02 20:58:02 -04:00
Brooks Davis
df501bac69 syscalls.master: switch to CAPENABLED flags
Switch the main syscall table to use CAPENABLED flags rather than
capabilities.conf.  This avoid synchronization issues between
syscalls.master and capabilities.conf (e.g. when renaming a syscall
during development).

For now, move capabilities.conf to sys/compat/freebsd32 and use it
there.  Use of sys/compat/freebsd32/syscalls.master should be replaced
by makesyscalls.lua enhancements to allow the main one to be used.

This change results in no changes to generated files after running
`make sysent`.

Reviewed by:	kevans, emaste
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D31350
2021-09-01 21:58:16 +01:00
Dimitry Andric
395d46caae Don't error out on unused but set variables with clang 13
Clang 13.0.0 now has a -Wunused-but-set-variable warning similar to the
one gcc has had for quite a while. Since this triggers *very* often for
our kernel builds, don't make it a hard error, but leave the warning
visible so is some incentive to fix the instances.

MFC after:	3 days
2021-08-29 15:53:40 +02:00
Arnaud Ysmal
3706af423f Add support for Lewisburg GPIO through P2SB
Obtained from:		Semihalf
Sponsored by:		Stormshield
Differential revision:	https://reviews.freebsd.org/D31269
2021-08-26 11:00:39 +02:00
Mateusz Guzik
451756d1ba powerpc: retire bcmp
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Reviewed by:	jhibbits
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-23 16:11:56 +00:00
Mateusz Guzik
44056f9a72 riscv: retire bcmp
Unused since ba96f37758 ("Use __builtin for various mem* and b* (e.g. bzero)
routines.")

Reviewed by:	mhorne
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-23 16:11:18 +00:00
Mateusz Guzik
1652d2ff09 arm64: retire bcmp
Reviewed by:	andrew
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31645
2021-08-23 15:23:20 +02:00
Mateusz Guzik
d47afcb203 arm64: retire bzero
Reviewed by:	andrew
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31644
2021-08-23 15:22:44 +02:00
Mateusz Guzik
766a7c73e9 arm64: add read_frequently, read_mostluy and exclusive_cache_line to linker script
Reviewed by:	andrew
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31643
2021-08-23 15:22:17 +02:00
Wei Hu
ce110ea12f Microsoft Azure Network Adapter(MANA) VF support
MANA is the new network adapter from Microsoft which will be available
in Azure public cloud. It provides SRIOV NIC as virtual function to
guest OS running on Hyper-V.

The code can be divided into two major parts. Gdma_main.c is the one to
bring up the hardware board and drives all underlying hardware queue
infrastructure. Mana_en.c contains all main ethernet driver code.
It has only tested and supported on amd64 architecture.

PR:		256336
Reviewed by:	decui@microsoft.com
Tested by:	whu
MFC after:	2 week
Relnotes:	yes
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D31150
2021-08-20 10:44:57 +00:00
Adam Fenn
6c69c6bb4c kvm_clock: KVM paravirtual clock support
Add support for the KVM paravirtual clock device.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29733
2021-08-14 15:57:54 +03:00
Adam Fenn
346f5a0c48 x86: files: Make sys/x86/x86/pvclock.c optional
Make inclusion of `sys/x86/x86/pvclock.c` contingent on that of its
dependents.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31417
2021-08-14 15:57:54 +03:00
Justin Hibbits
5ae48eb998 powerpc/pseries: Allow radix pmap in pseries for ISA 3.0
ISA 3.0 allows for nested radix translations with minimal to no
involvement of the hypervisor.  This should make pseries signficantly
faster on POWER9 pseries instances, as fewer hypercalls are needed to
manage pmap now.

MFC after:	2 weeks
Relnotes:	yes
2021-08-11 19:07:04 -05:00
Mark Johnston
a422084abb Add the KMSAN runtime
KMSAN enables the use of LLVM's MemorySanitizer in the kernel.  This
enables precise detection of uses of uninitialized memory.  As with
KASAN, this feature has substantial runtime overhead and is intended to
be used as part of some automated testing regime.

The runtime maintains a pair of shadow maps.  One is used to track the
state of memory in the kernel map at bit-granularity: a bit in the
kernel map is initialized when the corresponding shadow bit is clear,
and is uninitialized otherwise.  The second shadow map stores
information about the origin of uninitialized regions of the kernel map,
simplifying debugging.

KMSAN relies on being able to intercept certain functions which cannot
be instrumented by the compiler.  KMSAN thus implements interceptors
which manually update shadow state and in some cases explicitly check
for uninitialized bytes.  For instance, all calls to copyout() are
subject to such checks.

The runtime exports several functions which can be used to verify the
shadow map for a given buffer.  Helpers provide the same functionality
for a few structures commonly used for I/O, such as CAM CCBs, BIOs and
mbufs.  These are handy when debugging a KMSAN report whose
proximate and root causes are far away from each other.

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2021-08-10 21:27:53 -04:00
Mark Johnston
30d00832d7 conf: Add a KMSAN kernel option
Sponsored by:	The FreeBSD Foundation
2021-08-10 21:22:12 -04:00
Scott Long
27b8dd594d Remove duplicate entry for arm/mv/armada38x/armada38x_rtc.c
Sponsored by:   Rubicon Communications, LLC ("Netgate")
2021-08-09 18:57:50 +00:00
Jessica Clarke
896e217a0e fu740_pci_dw: Add SiFive FU740 PCIe controller driver
Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31033
2021-08-07 19:27:31 +01:00
Mitchell Horne
1b8db4b4e3 arm: enable stack-smashing protection
With current generation clang/llvm it can pass all of our tests in
libc/ssp.

While here, remove the extra MACHINE_CPUARCH check for mips. SSP is
included in BROKEN_OPTIONS for this architecture in src.opts.mk, which
is enough to ensure normal builds won't set SSP_CFLAGS.

Reviewed by:	kevans, imp, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31400
2021-08-04 15:23:22 -03:00
Kornel Duleba
dfcaa2c18b enetc_mdio: Support building the driver as a loadable module.
After recent arm64 GENERIC config cleanup the ENETC MDIO
in NXP LS1028A SoC should support being loaded as a module.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-08-03 12:07:49 +02:00
Marcin Wojtas
451bcf1b36 Introduce driver for Freescale Felix switch
It is found on boards equipped with LS1028A SoC.
802.1q VLAN grouping is supported.
An external MDIO device is used for communicating with PHYs.
The driver is built as a module by default, it is not included
in GENERIC kernel config.

Submitted by: Lukasz Hajec <lha@semihalf.com>
              Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30923
2021-08-03 12:07:49 +02:00
Hans Petter Selasky
9340ebd404 Add missing file to sys/conf/files after 469884cf04 .
Found by:	vishwin@
Differential Revision:	https://reviews.freebsd.org/D29921
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-08-02 08:25:04 +02:00
Konstantin Belousov
e18380e341 amd64: do not assume that kernel is loaded at 2M physical
Allow any 2M aligned contiguous location below 4G for the staging
area location.  It should still be mapped by loader at KERNBASE.

The assumption kernel makes about loader->kernel handoff with regard to
the MMU programming are explicitly listed at the beginning of hammer_time(),
where kernphys is calculated.  Now kernphys is the variable instead of
symbol designating the physical address.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31121
2021-07-31 16:53:42 +03:00
Hans Petter Selasky
469884cf04 LinuxKPI: Make FPU sections thread-safe and use the NOCTX flag.
Reviewed by:	kib
Submitted by:	greg@unrelenting.technology
Differential Revision:	https://reviews.freebsd.org/D29921
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-07-31 15:36:48 +02:00
Mark Johnston
a90d053b84 Simplify kernel sanitizer interceptors
KASAN and KCSAN implement interceptors for various primitive operations
that are not instrumented by the compiler.  KMSAN requires them as well.
Rather than adding new cases for each sanitizer which requires
interceptors, implement the following protocol:
- When interceptor definitions are required, define
  SAN_NEEDS_INTERCEPTORS and SANITIZER_INTERCEPTOR_PREFIX.
- In headers that declare functions which need to be intercepted by a
  sanitizer runtime, use SANITIZER_INTERCEPTOR_PREFIX to provide
  declarations.
- When SAN_RUNTIME is defined, do not redefine the names of intercepted
  functions.  This is typically the case in files which implement
  sanitizer runtimes but is also needed in, for example, files which
  define ifunc selectors for intercepted operations.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-07-29 21:13:32 -04:00
Julien Grall
ae59812748 xen/timer: make xen timer optional
The timer is not used on ARM.

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D29041
2021-07-28 17:27:03 +02:00
Julien Grall
a48f7ba444 xen: move x86/xen/xenpv.c to dev/xen/bus/xenpv.c
Minor changes are necessary to make this processor-independent, but
moving the file out of x86 and into common is the first step (so
others don't add /more/ x86-isms).

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D29042
2021-07-28 17:27:02 +02:00
Hans Petter Selasky
b633e08c70 ibcore: Kernel space update based on Linux 5.7-rc1.
Overview:

This is the first stage of a RDMA stack upgrade introducing kernel
changes only based on Linux 5.7-rc1.

This patch is based on about four main areas of work:
- Update of the IB uobjects system:
  - The memory holding so-called AH, CQ, PD, SRQ and UCONTEXT objects
    is now managed by ibcore. This also require some changes in the
    kernel verbs API. The updated verbs changes are typically about
    initialize and deinitialize objects, and remove allocation and
    free of memory.

- Update of the uverbs IOCTL framework:
  - The parsing and handling of user-space commands has been
    completely refactored to integrate with the updated IB uobjects
    system.

- Various changes and updates to the generic uverbs interfaces in
  device drivers including the new uAPI surface.

- The mlx5_ib_devx.c in mlx5ib and related mlx5 core changes.

Dependencies:

- The mlx4ib driver code has been updated with the minimum changes
needed.

- The mlx5ib driver code has been updated with the minimum changes
needed including DV support.

Compatibility:

- All user-space facing APIs are backwards compatible after this
  change.

- All kernel-space facing RDMA APIs are backwards compatible after
  this change, with exception of ib_create_ah() and ib_destroy_ah()
  which takes a new flag.

- The "ib_device_ops" structure exist, but only contains the driver ID
  and some structure sizes.

Differences from Linux:

- Infiniband drivers must use the INIT_IB_DEVICE_OPS() macro to set
  the sizes needed for allocating various IB objects, when adding
  IB device instances.

Security:

- PRIV_NET_RAW is needed to use raw ethernet transmit features.
- PRIV_DRIVER is needed to use other privileged operations.

Based on upstream Linux, Torvalds (5.7-rc1):
8632e9b5645bbc2331d21d892b0d6961c1a08429

MFC after:	1 week
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31149
Sponsored by:	NVIDIA Networking
2021-07-28 13:28:29 +02:00
Alexander Motin
e0229c5110 Remove opensolaris_atomic.S dependency.
This file is no longer there, so this broke static zfs build.

MFC after:	1 week
2021-07-27 19:52:39 -04:00
Kristof Provost
b972a7fa9e pf: fix LINT build
We failed to list the new pf_syncookies.c file in sys/conf/files. This
worked for the usual configurations, where pf is a module, but not for
LINT builds.

Reported by:	lwhsu
MFC after:	1 week
Sponsored by:	Modirum MDPay
2021-07-20 18:08:30 +02:00
Mateusz Guzik
9ef5b65085 arm: bcmp -> memcmp
The bcmp symbol is not used, at the same time memcmp as pulled from
libkern does byte-by-byte comparison.

So happens bcmp as found in support.S is in fact renamed memcmp, rename
it back.

Discussed with:	cognet
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-19 09:52:23 +00:00
Kyle Evans
7a129c973b kern: add an option for preserving the early kenv
Some downstream configurations do not store secrets in the
early (loader/static) environments and desire a way to preserve these
for diagnostic reasons.  Provide an option to do so.

Reviewed by:	imp, jhb (earlier version)
Differential Revision:	https://reviews.freebsd.org/D30834
2021-07-18 23:05:48 -05:00