Commit Graph

9269 Commits

Author SHA1 Message Date
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
Greg V
f39d9c9131 libkern: import strnstr from libc
Required for drm-kmod 5.6 (amdgpu).

Reviewed by:		bz, hselasky, nc
Differential Revision:	https://reviews.freebsd.org/D31131
2021-07-14 17:55:08 -07:00
Warner Losh
c0c703342d pccard: remove pccard device from all kernels
All the PC Card drivers have been removed from the tree. Remove the
pccard drivers from all the kernels.

Sponsored by:		Netflix
2021-07-13 20:39:31 -06:00
Warner Losh
27d997be97 cardbus: move card_if.m to sys/dev/cardbus
Move card_if.m to sys/dev/cardbus since pccard is disappearing.

Sponsored by:		Netflix
2021-07-13 20:39:30 -06:00
Navdeep Parhar
3c900106ea cxgbe(4): Update firmwares to 1.26.0.0.
Changes since 1.25.6.0 are listed here.  This list comes from the
Release Notes for "Chelsio Unified Wire 3.14.0.4 for Linux" dated
2021-07-08.

Fixes
-----

BASE:
- Wait 5ms before and after the i2c command that clears the mod_select.
  This fixes incorrect port module type read from i2c.

Obtained from:	Chelsio Communications
MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-07-12 21:25:36 -07:00
Peter Grehan
517904de5c igc(4): Introduce new driver for the Intel I225 Ethernet controller.
This controller supports 2.5G/1G/100MB/10MB speeds, and allows
tx/rx checksum offload, TSO, LRO, and multi-queue operation.

The driver was derived from code contributed by Intel, and modified
by Netgate to fit into the iflib framework.

Thanks to Mike Karels for testing and feedback on the driver.

Reviewed by:	bcr (manpages), kbowling, scottl, erj
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30668
2021-07-12 14:57:18 +10:00
Bjoern A. Zeeb
bf3a385217 fan53555: attach to build and switch from syr827
Rather than extending syr827 for syr828 (as initially done in D31103)
switch to the Fairchild Semiconductor Corporation fan53555 implementation
which is in-tree but was not attached to the build.  The fan53555
implementation also supports syr827/syr8278 already. [1]
Update NOTES and the arm64 GENERIC configuration for the switch.
syr827 for now stays in the tree but is not used by any
kernel configuration.

Suggested by:	mmel [1]
Reviewed by:	mmel, manu
Differential Revision: https://reviews.freebsd.org/D31112
2021-07-08 20:17:45 +00:00
Alexander Motin
d0732fa819 Add ocs_gendump.c to the build, missed in 29e2dbd42c. 2021-07-06 15:03:06 -04:00
Emmanuel Vadot
993e8236c3 arm64: allwinner: Add r_intc driver
The r intc interrupt controller seems to do a lot of things :
- It can handle the NMI interrupt
- It have local interrupts for some device that also can be muxed with GIC
- It can serve as an forwarder for the GIC

It's mostly used for deepsleep/wakeup if I understood correctly and we do not
support this on arm64.

For now just forward everything to the GIC so interrupts works again for device
which now have this interrupts controller set since dts v5.12

Sponsored by:	Diablotin Systems
2021-07-01 18:46:38 +02:00
Eric Joyner
538ef055b7
ice_ddp: Update to 1.3.24.0
This version is intended to be used with the 0.29.4 version of the
ice(4) driver, which will be be committed afterwards.

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

Reviewed by:	stallamr_netapp.com
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D30887
2021-06-25 10:21:39 -07:00
Marcin Wojtas
a2dc172dda Introduce LS1028A PCI MDIO driver.
Implement support for the NXP LS1028A SoC MDIO controller.
It is attached to the internal PCI root complex.
The controller is used to communicate with PHYs of ports connected
to the internal switch.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30731
2021-06-24 13:01:22 +02:00
Marcin Wojtas
19aa95e4b3 Introduce new driver for NXP Ethernet controller
ENETC it a gigabit Ethernet controller found on the LS1028A board.
It supports basic VLAN offloads - tag extraction, injection and hardware
filtering. Inband MDIO connectivity is used for link status
monitoring through the miibus interface. Fixed-link mode is also
supported, which allows for operation of internal cpu to switch port.
Since no admin interrupts are present in hardware, link status polling
has to be used.
Due to a hardware bug software reset of the NIC results in a external
abort. Because of that most of the hardware initialization is done
during attach. This also means that in the case of an fatal error full
board reset is required.
The enetc_hw.h header was imporoted from Linux. It is dual licensed.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30729
2021-06-24 13:01:13 +02:00
Dmitry Chagin
e013e36939 linux(4): Get rid of Linuxulator kernel build options.
Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel
build options. Since we have 32 and 64 bit Linux emulators, we can't build both
emulators together into the kernel. I don't think it matters, Linux emulation
depends on loadable modules (via rc).

Cut LINPROCFS and LINSYSFS for consistency.

PR:			215061
Reviewed by:		bcr (manpages), trasz
Differential Revision:	https://reviews.freebsd.org/D30751
MFC after:		2 weeks
2021-06-22 08:32:39 +03:00
Warner Losh
0febdc5ed5 NOTES: Improve wording
jhb@ pointed out an extra plural in this phrase and a gramatical error,
so reword a little to be less awkward to fix both issues.

Sponsored by:		Netflix
2021-06-19 08:56:58 -06:00
Warner Losh
7bd295750b NOTES: fix typo
Noted by:		gj@
Sponsored by:		Netflix
2021-06-18 09:19:55 -06:00
Warner Losh
0f882bb14a NOTES: Update the HZ entry with latest advice.
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30804
2021-06-18 08:41:56 -06:00
Mateusz Guzik
345077ccd5 Remove an(4) leftover from conf/NOTES
Unbreaks LINT kernels.
2021-06-12 08:58:11 +00:00
Emmanuel Vadot
663b174b5b an: Remove driver
Last an(4) devices have been End Of Life and End Of Sale in 2007.
Time to remove this driver.

Differential Revision:	https://reviews.freebsd.org/D30679
Reviewed by:		imp (earlier version), emaste (earlier version)
Sponsored by:		Diablotin Systems
2021-06-11 21:18:04 +02:00
Oleksandr Tymoshenko
cb25a94558 arm64: allwinner: Add i2s and codec support
Differential Revision:	https://reviews.freebsd.org/D27830
2021-06-11 21:06:08 +02:00
Oleksandr Tymoshenko
2cfe870acd arm64: Add Soc audio framework
This framework is initial implementation of the simple-audio-card compatible
audio driver framework. It provides glue for CPU/codec/aux device.

Differential Revision:	https://reviews.freebsd.org/D27830
2021-06-11 21:06:04 +02:00
Marcin Wojtas
28c4e511c2 Add ofw interface support to PCI
Some arm64 SoCs have nodes in their fdts that describe devices
connected to the internal PCI bus. One such SoC is Freescale LS1028A.
In order to access information stored in them we need to add ofw bus
support to pci. Pass devinfo request up to our parent, which
is responsible for parsing all the information.
It allows to use ofw interface on PCI devices that support it.
This method is similar to sys/dev/acpica/acpi_pci.c.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30181
2021-06-08 17:52:02 +02:00
Mark Johnston
97993d1ebf hyperv: Fix vmbus after the i386 4/4 split
The vmbus ISR needs to live in a trampoline.  Dynamically allocating a
trampoline at driver initialization time poses some difficulties due to
the fact that the KENTER macro assumes that the offset relative to
tramp_idleptd is fixed at static link time.  Another problem is that
native_lapic_ipi_alloc() uses setidt(), which assumes a fixed trampoline
offset.

Rather than fight this, move the Hyper-V ISR to i386/exception.s.  Add a
new HYPERV kernel option to make this optional, and configure it by
default on i386.  This is sufficient to make use of vmbus(4) after the
4/4 split.  Note that vmbus cannot be loaded dynamically and both the
HYPERV option and device must be configured together.  I think this is
not too onerous a requirement, since vmbus(4) was previously
non-functional.

Reported by:	Harry Schmalzbauer <freebsd@omnilan.de>
Tested by:	Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by:	whu, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30577
2021-06-08 09:40:30 -04:00
Warner Losh
e8dca53aa0 kmod.mk: Allow extra objects to be specified in modules
OBJS are automatically added to CLEANFILES. For pre-built objects, this
is not desirable since it will delete the object from the source
tree. Introduce EXTRA_OBJS which list these object files, but aren't
added to clean files.

Sponsored by:		Netflix
Reviewed by:		emaste@
Differential Revision:	https://reviews.freebsd.org/D30615
2021-06-02 10:39:58 -06:00
Andrew Turner
2422138952 Fix the KCSAN_ENABLED check when building modules
The KCSAN_ENABLED variable is non-empty when the kernel is being built
with KCSAN. This allows us to disable modules that are known to be
broken.

There was a bug where we would check if it was defined. As this is
always the case the KCSAN_ENABLED variable would be set when building
modules so we would never build such a module. Fix this by checking
if the value is empty before passing it on to the module stage.

This doesn't affect how modules are built as the CFLAGS passed to
modules has the correct check.

Reported by:	rstone
Sponsored by:	Innovate UK
2021-06-02 10:59:19 +00:00
Navdeep Parhar
e0fa04e257 cxgbe(4): Update firmwares to 1.25.6.0.
Changes since 1.25.0.0 are listed here.  This list comes from the
Release Notes for the "Chelsio Unified Wire v3.14.0.3 for Linux"
release dated 2021-05-21.

Fixes
-----

BASE:
- Fixed Back to back T6 100G-CR4 link coming up with NO FEC sometimes.
- [T5] Try to bring up link in 1G speed if link doesn't come up on 10G.
- Fixed a bug to not allow BaseR fec in 100G speed.
- Fixed linkup issues on BT adapter in 1G and 100M speed.
- Fixed an issue to allow driver to send VI_ENABLE multiple times (once
  with rx disable and then later rx enable).
- Fixed rate limiting not working on class number 16 to 30.
- Fixed backward compatibility issue in port type interpretation with vpd
  version 0x80.

ETH:
- Fixed a case when firmware failed to deliver NIC WR completion to host.
- No rate limit support for WR ETH_TX_PKTS2 due to performance reasons.

OFLD
- Fixed a connection hang in SO adapters when tp_plen_max (set by driver)
  is more than the window size.
- Added fw_filter_vnic_mode to firmware API file (t4fw_interface.h)
- Use correct rx channel in coprocessor crypto completion (CPL_FW6_PLD). This
  was causing out of order completion to host.

FOiSCSI
- Fixed a crash due to unaligned access of ipv6 address.
- Fixed a crash during lun reset.

Enhancements
------------

ETH:
- Rate limiting support added for encapsulated (vxlan, nvgre, geneve) NIC TCP
  packets.

OFLD:
- More than 128 SGLs supported in FW_RI_FR_NSMR_WR. Now, more than 16GB
  (upto 64GB) of PBLs can be written with single FW_RI_FR_NSMR_WR.

Obtained from:	Chelsio Communications
MFC after:	1 month
Sponsored by:	Chelsio Communications
2021-05-29 01:00:20 -07:00
John Baldwin
21e3c1fbe2 Assume OCF is the only KTLS software backend.
This removes support for loadable software backends.  The KTLS OCF
support is now always included in kernels with KERN_TLS and the
ktls_ocf.ko module has been removed.  The software encryption routines
now take an mbuf directly and use the TLS mbuf as the crypto buffer
when possible.

Bump __FreeBSD_version for software backends in ports.

Reviewed by:	gallatin, markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D30138
2021-05-25 16:59:19 -07:00
Emmanuel Vadot
80e645dcdb mmc: Only build mmc_fdt_helper and mmc_pwrseq for arch that uses ext_resources
This is now a needed requirement and fixes powerpc* build
2021-05-21 19:35:20 +02:00
Emmanuel Vadot
5b2a81f58d mmc: Add mmc-pwrseq driver
This driver is used to power up sdio card or eMMC.
It handle the reset-gpio, clocks and needed delays for powerup/powerdown.

Sponsored by:	Diablotin Systems
Differential Revision:	https://reviews.freebsd.org/D30288
2021-05-21 17:36:20 +02:00
Marcin Wojtas
240429103c Rename ofwpci.c to ofw_pcib.c
It's a class0 driver that implements some pcib methods and creates
a pci bus as its children.
The "ofw_pci" name will be used by a new driver that will be a subclass
of the pci bus.
No functional changes intended.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30226
2021-05-20 11:22:25 +02:00
Justin Hibbits
ffd21bd289 Make ISA_206_ATOMICS a kernel option
Summary:
To make it easier to build a kernel with PowerISA 2.06 atomics (sub-word
atomics), add a kernel config option.  User space still needs to specify
it as a CFLAG but that seems easier to do than for the kernel config.

Reviewed By: luporl
Differential Revision: https://reviews.freebsd.org/D29809
2021-05-17 08:46:38 -05:00
Roger Pau Monné
ac3ede5371 x86/xen: remove PVHv1 code
PVHv1 was officially removed from Xen in 4.9, so just axe the related
code from FreeBSD.

Note FreeBSD supports PVHv2, which is the replacement for PVHv1.

Sponsored by: Citrix Systems R&D
Reviewed by: kib, Elliott Mitchell
Differential Revision: https://reviews.freebsd.org/D30228
2021-05-17 11:41:21 +02:00
Marcin Wojtas
4dfb620ea4 Add LS1028A clockgen driver
The new driver provides probe and attach functions for the NXP LS1028A
clockgen and passes configuration information to QorIQ clockgen class.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30125
2021-05-07 03:48:53 +02:00
Brandon Bergren
6e1abda231 riscv: Remove old qemu compatibility code
During early qemu development, the /soc node was marked as compatible
with "riscv-virtio-soc" instead of "simple-bus".

This was changed in qemu 53f54508dae6 in Sep 2018, and predates the
baseline required qemu version (5.0) for riscv by a wide margin.

The generic simplebus code handles attachment in all cases nowadays.

Sponsored by:	Tag1 Consulting, Inc.
Reviewed by:	jrtc27, mhorne
Differential Revision:	https://reviews.freebsd.org/D30011
2021-04-27 16:22:04 -05:00
Ruslan Bukin
f17c4e38f5 Move IOMMU code to a separate pmap module and switch ARM System MMU
driver to use it.

Add ARM Mali Txxx (Midgard), Gxx (Bifrost) GPU page management code.

Sponsored by: UKRI
2021-04-27 19:16:09 +01:00
Emmanuel Vadot
47bde7925b mmccam: Add mmc_sim, a generic sim for mmc driver to use
This adds a generic sim that abstract a lot of what needs to be implemented
in a driver for mmccam support.
A new interface with three methods is added :

 - mmc_sim_get_tran_settings: Use to get what the controller supports in term
   of capabilities, freq etc ...
 - mmc_sim_set_tran_settings: Use to change the speed/freq/etc of the
   sdcard host controller
 - mmc_sim_cam_request: Used for MMCIO requests

Differential Revision:	https://reviews.freebsd.org/D27485
Reviewed by:	kibab
2021-04-27 19:00:38 +02:00
Warner Losh
2183bfcce4 newvers.sh: better regexp for the FreeBSD_version line
Tested with:		cirrus-ci https://cirrus-ci.com/build/6012323274948608
Reviewed by:		emaste@, rgrimes@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D29869
2021-04-22 11:45:12 -06:00
Mark Johnston
38da497a4d Add the KASAN runtime
KASAN enables the use of LLVM's AddressSanitizer in the kernel.  This
feature makes use of compiler instrumentation to validate memory
accesses in the kernel and detect several types of bugs, including
use-after-frees and out-of-bounds accesses.  It is particularly
effective when combined with test suites or syzkaller.  KASAN has high
CPU and memory usage overhead and so is not suited for production
environments.

The runtime and pmap maintain a shadow of the kernel map to store
information about the validity of memory mapped at a given kernel
address.

The runtime implements a number of functions defined by the compiler
ABI.  These are prefixed by __asan.  The compiler emits calls to
__asan_load*() and __asan_store*() around memory accesses, and the
runtime consults the shadow map to determine whether a given access is
valid.

kasan_mark() is called by various kernel allocators to update state in
the shadow map.  Updates to those allocators will come in subsequent
commits.

The runtime also defines various interceptors.  Some low-level routines
are implemented in assembly and are thus not amenable to compiler
instrumentation.  To handle this, the runtime implements these routines
on behalf of the rest of the kernel.  The sanitizer implementation
validates memory accesses manually before handing off to the real
implementation.

The sanitizer in a KASAN-configured kernel can be disabled by setting
the loader tunable debug.kasan.disable=1.

Obtained from:	NetBSD
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29416
2021-04-13 17:42:20 -04:00
Mark Johnston
01028c736c Add a KASAN option to the kernel build
LLVM support for enabling KASAN has not yet landed so the option is not
yet usable, but hopefully this will change soon.

Reviewed by:	imp, andrew
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29454
2021-04-13 17:42:20 -04:00
Warner Losh
662053e8dc hptrr: Move to using .o files
Use .o files directly. Replace the .o.uu files that we uudecode with .o files.
Adjust the kernel and module build to cope.

Suggestions by:		markj@, emaste@
Sposnored by:           Netflix, Inc
Differential Revision:	https://reviews.freebsd.org/D29636
2021-04-12 13:47:55 -06:00
Warner Losh
fddb3f4d7d hptmv: use .o files directly
uudecode the .o.uu files and commit directly to the tree. Adjust the build
infrastructure to cope with the new location, both for the kernel and modules.

Sposnored by:           Netflix, Inc
Differential Revision:	https://reviews.freebsd.org/D29635
2021-04-12 13:47:55 -06:00
Warner Losh
550cb4ab85 hpt27xx: store the .o files directly in the tree
Store the .o files directly in the tree. We no longer need to play uuencode
games like we did in the CVS days. Adjust the build infrastructure to match.

Reviewed by:            markj@
Sposnored by:           Netflix, Inc
Differential Revision:	https://reviews.freebsd.org/D29634
2021-04-12 13:47:55 -06:00
Warner Losh
5b20c5e1f8 hptnr: Store the .o files directly in the repo
We no longer need to use uuencode to uuencode files in our tree.  Store the .o
file directly instead. Adjust the build to cope with the new arrangement.

Suggestions by:		emaste, bz, donner
Reviewed by:		markm
Sposnored by:		Netflix, Inc
Differential Revision:	https://reviews.freebsd.org/D29632
2021-04-12 13:47:55 -06:00
Kristof Provost
5c62eded5a pf: Introduce nvlist variant of DIOCADDRULE
This will make future extensions of the API much easier.
The intent is to remove support for DIOCADDRULE in FreeBSD 14.

Reviewed by:	markj (previous version), glebius (previous version)
MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29557
2021-04-10 11:16:00 +02:00
Justin Hibbits
16e549ebe2 Merge the QorIQ GPIO drivers between arm and powerpc
Summary:
They're nearly identical, so don't use two copies.  Merge the newer
driver into the older one, and move it to a common location.

Add the Semihalf and associated copyrights in addition to mine, since
it's a non-trivial amount of code merged.

Reviewed By: mw
Differential Revision: https://reviews.freebsd.org/D29520
2021-04-05 10:35:15 -05:00
Konstantin Belousov
aa3ea612be x86: remove gcov kernel support
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D29529
2021-04-02 15:41:51 +03:00
Mitchell Horne
4beb385813 gdb: allow setting/removing hardware watchpoints
Handle the 'z' and 'Z' remote packets for manipulating hardware
watchpoints.

This could be expanded quite easily to support hardware or software
breakpoints as well.

https://sourceware.org/gdb/onlinedocs/gdb/Packets.html

Reviewed by:	cem, markj
MFC after:	3 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
NetApp PR:	51
Differential Revision:	https://reviews.freebsd.org/D29173
2021-03-30 11:36:41 -03:00
Emmanuel Vadot
63f344024a arm64: Check dtb version against the one we're expecting to find
Do for arm64 what was done for armv7 in e63faa9ba8
2021-03-23 15:24:53 +01:00
Ed Maste
0cff00ae68 retire obsolete mn(4) sync serial driver
Approved by:	phk
Relnotes:	yes
2021-03-22 15:06:51 -04:00
Alex Richardson
c8c62548bf Don't add -Winline for WARNS=6
This warning is very rarely useful (inline is a hint and not mandatory).
This flag results in many warnings being printed when compiling C++
code that uses the standard library with GCC.

This flag was originally added in back in r94332 but the flag is a no-op
in Clang ("This diagnostic flag exists for GCC compatibility, and has no
effect in Clang"). Removing it should make the GCC build output slightly
more readable.

Reviewed By:	jrtc27, imp
Differential Revision: https://reviews.freebsd.org/D29235
2021-03-22 11:55:45 +00:00
Mitchell Horne
c02c04f113 x86: consolidate hw watchpoint logic into new file
This is a prerequisite to using these functions outside of ddb, but also
provides some cleanup and minor refactoring. This code is almost
entirely duplicated between the two implementations, the only
significant difference being the lack of dbreg synchronization on i386.

Cleanups are:
 - demote some internal functions to static
 - use the constant NDBREGS instead of a '4' literal
 - remove K&R definitions
 - some added comments

Reviewed by:	kib, jhb
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29153
2021-03-19 16:51:52 -03:00
Greg V
15565e0a21 kern.mk: fix -Wno-error style to fix build with Clang 12
Clang 12 no longer supports -Wno-error-..., only the -Wno-error=...
style (which is already used everywhere else in the tree).

Differential Revision:	https://reviews.freebsd.org/D29157
2021-03-10 17:34:35 -05:00
Hans Petter Selasky
ebe5cf355d Implement basic support for allocating memory from a specific numa node
in the LinuxKPI.

Differential Revision:	https://reviews.freebsd.org/D29077
Reviewed by:	markj@ and kib@
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-03-09 21:01:47 +01:00
Alex Richardson
01fe4cac28 kern.mk: Fix wrong variable being used for linker path after 172a624f0
When I synchronized kern.mk with bsd.sys.mk, I accidentally changed
CCLDFLAGS to LDFLAGS which is not used by the kernel builds. This commit
should unbreak the GitHub actions cross-build CI. I didn't notice it
locally because cheribuild already passes -fuse-ld in the linker flags as
it predates this being done in the makefiles.

Reported By:	Jose Luis Duran
Fixes:		172a624f0 ("Silence annoying and incorrect non-default linker warning with GCC")
2021-03-08 09:37:46 +00:00
Eric Joyner
d08b8680e1 ice(4): Update to version 0.28.1-k
This updates the driver to align with the version included in
the "Intel Ethernet Adapter Complete Driver Pack", version 25.6.

There are no major functional changes; this mostly contains
bug fixes and changes to prepare for new features. This version
of the driver uses the previously committed ice_ddp package
1.3.19.0.

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

Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D28640
2021-03-05 17:33:39 -08:00
Alex Richardson
172a624f0c Silence annoying and incorrect non-default linker warning with GCC
The CROSS_TOOLCHAIN GCC .mk files include -B${CROSS_BINUTILS_PREFIX}, so
GCC will select the right linker and we don't need to warn.
While here also apply 17b8b8fb5f to kern.mk.

Test Plan:	no more warning printed with CROSS_TOOLCHAIN=mips-gcc6
Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D29015
2021-03-04 18:27:39 +00:00
John Baldwin
92aecd1e6f ossl: Add ChaCha20 cipher support.
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28756
2021-03-03 15:20:57 -08:00
John Baldwin
a079e38b08 ossl: Add Poly1305 digest support.
Reviewed by:	cem
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28754
2021-03-03 15:20:57 -08:00
Andrew Turner
48ba9b2669 Use L2 blocks when in the identity map
This reduces the memory mapped to be closer to the minimal memory
needed to enable the MMU.

Reviewed by:	mmel
Sponsored by:	Innovate UK
Differential Revision:://reviews.freebsd.org/D27765
2021-03-03 14:18:03 +00:00
Mitchell Horne
1fc928770b Remove stale references to opt_sio.h
The sio(4) driver was removed entirely in 2019, commit 71f0077631.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D28929
2021-02-25 21:43:12 -04:00