Commit Graph

8816 Commits

Author SHA1 Message Date
Konstantin Belousov
750ea20d3f Delete dead CLUSTERDEBUG config option.
Reviewed by:	mckusick
Tested by:	pho
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28679
2021-02-21 11:38:21 +02:00
Mateusz Guzik
5fa12fe0cd amd64: implement strlen in assembly, take 2
Tested with glibc test suite.

The C variant in libkern performs excessive branching to find the zero
byte instead of using the bsfq instruction. The same code patched to use
it is still slower than the routine implemented here as the compiler
keeps neglecting to perform certain optimizations (like using leaq).

On top of that the routine can be used as a starting point for copyinstr
which operates on words intead of bytes.

The previous attempt had an instance of swapped operands to andq when
dealing with fully aligned case, which had a side effect of breaking the
code for certain corner cases. Noted by jrtc27.

Sample results:

$(perl -e "print 'A' x 3"):
stock:  211198039
patched:338626619
asm:    465609618

$(perl -e "print 'A' x 100"):
stock:   83151997
patched: 98285919
asm:    120719888

Reviewed by:	jhb, kib
Differential Revision:	https://reviews.freebsd.org/D28779
2021-02-21 00:43:05 +00:00
John Baldwin
dd2e1352b6 Add an implementation of CHACHA20_POLY1305 to cryptosoft.
This uses the chacha20 IETF and poly1305 implementations from
libsodium.  A seperate auth_hash is created for the auth side whose
Setkey method derives the poly1305 key from the AEAD key and nonce as
described in RFC 8439.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27837
2021-02-18 09:26:23 -08:00
John Baldwin
fc8fc743d8 Add an OCF algorithm for ChaCha20-Poly1305 AEAD.
Note that this algorithm implements the mode defined in RFC 8439.

Reviewed by:	cem
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27836
2021-02-18 09:26:00 -08:00
Roger Pau Monné
952667da98 xen/efi: introduce a PV interface for EFI run time services for dom0
FreeBSD when running as a dom0 under Xen is not supposed to access the
run time services directly, and instead should proxy the calls through
Xen using an hypercall interface that exposes access to selected run
time services.

Implement the efirt interface on top of the Xen provided hypercalls.

Sponsored by:		Citrix Systems R&D
Reviewed by:		kib
Differential revision:	https://reviews.freebsd.org/D28621
2021-02-16 15:26:12 +01:00
Simon J. Gerraty
66803b34a0 Only require mac_veriexec for verified_exec
The veriexec option is redundant, mac_veriexec is sufficient.

MFC after: 1 week

#
#                                                         72 columns --|
#
# Uncomment and complete these metadata fields, as appropriate:
#
# PR:		<If and which Problem Report is related.>
# Reported by:	<If someone else reported the issue.>
# Reviewed by:	<If someone else reviewed your modification.>
# Approved by:	<If you needed approval for this commit.>
# Obtained from:	<If the change is from a third party.>
# MFC after:	<N [day[s]|week[s]|month[s]].  Request a reminder email>
# MFH:		<Ports tree branch name.  Request approval for merge.>
# Relnotes:	<Set to 'yes' for mention in release notes.>
# Security:	<Vulnerability reference (one per line) or description.>
# Sponsored by:	<If the change was sponsored by an organization.>
# Pull Request:	<https://github.com/freebsd/<repo>/pull/###>
# Differential Revision:	<https://reviews.freebsd.org/D###>
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.  The commit author should be set appropriately, using
# `git commit --author` if someone besides the committer sent in the change.
#
# Uncomment and complete these metadata fields, as appropriate:
#
# PR:
# Reported by:	<If someone else reported the issue.>
# Reviewed by:	<If someone else reviewed your modification.>
# Approved by:	<If you needed approval for this commit.>
# Obtained from:	<If the change is from a third party.>
# MFC after:	<N [day[s]|week[s]|month[s]].  Request a reminder email>
# MFH:		<Ports tree branch name.  Request approval for merge.>
# Relnotes:	<Set to 'yes' for mention in release notes.>
# Security:	<Vulnerability reference (one per line) or description.>
# Sponsored by:	<If the change was sponsored by an organization.>
# Pull Request:	<https://github.com/freebsd/<repo>/pull/###>
# Differential Revision:	<https://reviews.freebsd.org/D###>
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.  The commit author should be set appropriately, using
# `git commit --author` if someone besides the committer sent in the change.
#
2021-02-14 09:20:41 -08:00
Emmanuel Vadot
a6dc68c0e0 arm64: if_dwc is also needed by intel stratix10 platform
MFC after:	3 days
2021-02-10 21:15:59 +01:00
Emmanuel Vadot
3b721b4495 arm64: Add a SOC_BRCM_NS2 option
Only compile files needed for this platform if the option is enabled in the
kernel config file.
Add the option to GENERIC.

MFC after:	3 days
2021-02-10 21:15:50 +01:00
Emmanuel Vadot
b81439d1eb arm64: Make thunderx vnic file depend on soc_cavm_thunderx
MFC after:	3 days
2021-02-10 21:15:40 +01:00
Emmanuel Vadot
ea3b6abf3f arm64: Order sys/conf/files.arm64
This is now easier to read and see what's compiled-in

No functional changes intended.

MFC after:	3 days
2021-02-10 21:15:19 +01:00
Mateusz Guzik
b49a0db662 Revert "amd64: implement strlen in assembly"
This reverts commit af366d353b.

Trips over '\xa4' byte and terminates early, as found in
lib/libc/gen/setdomainname_test:setdomainname_basic testcase

However, keep moving libkern/strlen.c out of conf/files.

Reported by:	lwhsu
2021-02-09 16:23:18 +01:00
Warner Losh
35af933173 acpi: limit the AMDI0020/AMDI0010 workaround to an option
It appears that production versions of EPYC firmware get the _STA method right
for these nodes. In fact, this workaround breaks on production hardware by
including too many uart nodes. This work around was for pre-release hardware
that wound up not having a large deployment. Move this work around to a kernel
option since the machines that needed it have been powered off and are difficult
to resurrect. Should there be a more significant deployment than is understood,
we can restrict it based on smbios strings.

Discussed with: mmacy@, seanc@, jhb@
MFC After: 3 days
2021-02-08 14:47:49 -07:00
Mateusz Guzik
af366d353b amd64: implement strlen in assembly
The C variant in libkern performs excessive branching to find the
non-zero byte instead of using the bsfq instruction. The same code
patched to use it is still slower than the routine implemented here
as the compiler keeps neglecting to perform certain optimizations
(like using leaq).

On top of that the routine can is a starting point for copyinstr
which operates on words instead of bytes.

Tested with glibc test suite.

Sample results (calls/s):

Haswell:
$(perl -e "print 'A' x 3"):
stock:	211198039
patched:338626619
asm:	465609618

$(perl -e "print 'A' x 100"):
stock:	 83151997
patched: 98285919
asm:	120719888

AMD EPYC 7R32:
$(perl -e "print 'A' x 3"):
stock:	282523617
asm:	491498172

$(perl -e "print 'A' x 100"):
stock:	114857172
asm:	112082057
2021-02-08 19:15:21 +00:00
Konstantin Belousov
ff975f15d8 WITH_OFED build option: fix
Userspace has OFED build enabled for quite some time, but kernel modules
were not. This is useless config because any userspace IB code requires
kernel support. So enable modules build by default.

Move WITH_OFED to WITHOUT_OFED since defaults are now enabled.

Reviewed by:	emaste, hselasky, kevans
MFC after:	3 days
Sponsored by:	NVidia Networking / Mellanox Technologies
Differential Revision:	https://reviews.freebsd.org/D28460
2021-02-02 18:44:52 +02:00
Warner Losh
8a51f14a78 newvers: tweak uname to be more useful
The current uname is branch-cXXXX-gHASH

Three changes to make uname more useful.
1. Move from using git rev-list --count to git rev-lis --count --first-parent
   since that gives a better, incrementing number.
2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of
   a hash and we've changed the sematnics of XXXXX
3. Remove g to make HASH cut and pastable.

Durting review, #1 & #3 had the largest consensus. There was a diversity of
opinion on #2, but on the whole it was positive so I'll acknowledge the dissent,
but move forward with something seems to have support since the dissent was all
about what letter to use where I chose 'n'.

MFC After: 3 days
Reviewed by: rgrimes, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D28338
2021-01-28 17:44:56 -07:00
Bjoern A. Zeeb
fa765ca73e LinuxKPI: implement devres() framework parts and two examples
This code implements a version of the devres framework found
working for various iwlwifi use cases and also providing functions
for ttm_page_alloc_dma.c from DRM.

Part of the framework replicates the consumed KPI, while others
are internal helper functions.

In addition the simple devm_k*malloc() consumers were implemented
and kvasprintf() was enhanced to also work for the devm_kasprintf()
case.
Addmittingly lkpi_devm_kmalloc_release() could be avoided but for
the overall understanding of the code and possible memory tracing
it may still be helpful.

Further devsres consumer are implemented for iwlwifi but will follow
later as the main reason for this change is to sort out overlap with
DRM.

Sponsored-by:	The FreeBSD Foundation
Obtained-from:	bz_iwlwifi
MFC After:	3 days
Reviewed-by:	hselasky, manu
Differential Revision:	https://reviews.freebsd.org/D28189
2021-01-28 16:32:43 +00:00
Bjoern A. Zeeb
a6c2507d1b LinuxKPI: add firmware loading support
Implement linux firmware KPI compat code.
This includes: request_firmware() request_firmware_nowait(),
request_firmware_direct(), firmware_request_nowarn(),
and release_firmware().

Given we will try to map requested names from natively ported
or full-linuxkpi-using drivers to a firmware(9) auto-loading
name format (.ko file name and image name matching),
we quieten firmware(9) and print success or failure (unless
the _nowarn() version was called) in the linuxkpi implementation.
At the moment we try up-to 4 different naming combinations,
with path stripped, original name, and requested name with '/'
or '.' replaced.

We do not currently defer loading in the "nowait" case.

Sponsored-by:	The FreeBSD Foundation
Sponsored-by:	Rubicon Communications, LLC ("Netgate")
		(firmware(9) nowarn update from D27413)
MFC after:	3 days
Reviewed by:	kib, manu (looked at older versions)
Differential Revision:	https://reviews.freebsd.org/D27414
2021-01-28 16:05:32 +00:00
Mateusz Guzik
bcb7f57aa2 conf/kern.mk: save some work by using realpath instead of cd ; pwd
I did not check if the entire ordeal can be avoided in the first place.
2021-01-27 12:41:33 +00:00
Lutz Donnerhacke
cfd6422a52 netgraph/ng_vlan_rotate: IEEE 802.1ad VLAN manipulation netgraph type
This node is part of an A10-NSP (L2-BSA) development.

Carrier networks tend to stack three or more tags for internal
purposes and therefore hiding the service tags deep inside of the
stack. When decomposing such an access network frame, the processing
order is typically reversed: First distinguish by service, than by
other means.

This new netgragh node allows to bring the relevant VLAN in front (to
the out-most position). This way other netgraph nodes (like ng_vlan)
can operate on this specific type.

Reviewed by:	manpages (gbe), brueffer (manpages), kp
Approved by:	kp (mentor)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22076
2021-01-26 16:53:24 +01:00
Mateusz Guzik
b42a2ea558 Remove ndis(4) remnants from kernel configs
Unbreaks LINT kernels.
2021-01-26 00:04:13 +00:00
Brooks Davis
bfc99943b0 ndis(4): remove as previous announced
nids(4) was a clever idea in the early 2000's when the market was
flooded with 10/100 NICs with Windows-only drivers, but that hasn't been
the case for ages and the driver has had no meaningful maintenance in
ages. It only supports Windows-XP era drivers.

Also remove:
 - ndis support from wpa_supplicant
 - ndiscvt(8)

Reviewed By:	emaste, bcr (manpages)
Differential Revision:	https://reviews.freebsd.org/D27609
2021-01-25 21:45:03 +00:00
Ed Maste
8564660237 newvers.sh: add newline at EOF in generated vers.c
Previously we omitted the newline, which did not cause a functional
issue for the build but resulted in suboptimal output from e.g.
`cat vers.c`.
2021-01-25 14:57:18 -05:00
Mateusz Guzik
ace7209ce0 newvers.sh: restore reporting branch names
It got removed arguably without much discussion in the commit which
added gitup support.
2021-01-22 13:03:15 +00:00
Oleksandr Tymoshenko
ed9b7f4414 armv8crypto: add AES-GCM support
Add support for AES-GCM using OpenSSL's accelerated routines.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D27454
Sponsored by:	Ampere Computing
Submitted by:	Klara, Inc.
2021-01-21 21:41:27 -08:00
Glen Barber
a53ce3fc49 Bump CURRENT to 14.0
This one goes to 14.

Approved by:	re (implicit)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-01-21 19:10:07 -05:00
Ed Maste
9e98065cf1 newvers.sh: avoid bare git invocation
git may not be in the path, and $git_cmd includes some commandline
arguments.

Reported by:	mjg
Tested by:	mjg
2021-01-21 10:03:39 -05:00
John Baldwin
5bd565855a Tidy some crypto-related lines in sys/conf/files.
Reviewed by:	cem (earlier version)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D27835
2021-01-20 16:40:05 -08:00
Michael Osipov
a9fc14fbf4 newvers.sh: add support for gitup(1)
gitup writes a .gituprevision file into the shallow clone directory. Read that
file and print commit information only.

Submitted by:	Michael Osipov <michael.osipov@siemens.com>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/449

While here, drop the redundant branch name from the git output and don't
count commits in shallow clones.

Reported by:	Michael Osipov <michael.osipov@siemens.com>
MFC after:	2 weeks
2021-01-20 10:48:27 +01:00
Andriy Gapon
2c98edd6d6 htu21: driver for HTU21D I2C temperature and humidity sensor
MFC after:	2 weeks
Relnotes:	perhaps
2021-01-19 15:08:51 +02:00
Bryan Venteicher
9da9560c4d virtio: Add VirtIO PCI modern (V1) support
Use the existing legacy PCI driver as the basis for shared code
between the legacy and modern PCI drivers. The existing virtio_pci
kernel module will contain both the legacy and modern drivers.

Changes to the virtqueue and each device driver (network, block, etc)
for V1 support come in later commits.

Update the MMIO driver to reflect the VirtIO bus method changes, but
the modern compliance can be improved on later.

Note that the modern PCI driver requires bus_map_resource() to be
implemented, which is not the case on all archs.

The hw.virtio.pci.transitional tunable default value is zero so
transitional devices will continue to be driven via the legacy
driver.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27856
2021-01-19 04:55:23 +00:00
Andrew Gallatin
efa9c21bca KTLS: Enable KERN_TLS in GENERIC on amd64
Based on discussions on freebsd-arch@, enable KERN_TLS in
GENERIC on amd64, but leave it disabled via the
sysctl kern.ipc.tls.enable.  Users wishing to enable
ktls must set kern.ipc.tls.enable=1

While here, fix wording in NOTES to mention that KERN_TLS
also does receive now.

Sponsored by:	Netflix

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D28163
2021-01-18 13:29:10 -05:00
Emmanuel Vadot
a0ee5920be mips: Add the device-tree path to the include paths 2021-01-16 11:33:37 +01:00
Emmanuel Vadot
384bd0b5b0 riscv: Add the device-tree path to the include path 2021-01-16 11:31:17 +01:00
Emmanuel Vadot
efdf807990 Switch to the new device-tree vendor tree
The old vendor tree was never fully merged and doing partial merge isn't
supported with git subtree merge so a new one was created.
Switch the build to use the new DTS from sys/contrib/device-tree
This also bump the DTS used to be in sync with Linux 5.9
While here change the way to get the linux version, simply hardcode
the value in sys/dts/freebsd-compatible.dts and use awk to get that
to put it in the CFLAGS.
As a bonus we now have the bindings docs available
in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo
or to the vendor tree.
2021-01-15 20:08:39 +01:00
Emmanuel Vadot
58e169ab14 arm64: Add the dts include directory to the includes dir
We do that for arm so we can directly #include <dt-bindings/...>
2021-01-15 14:15:31 +01:00
Andrew Turner
94611a8388 Add missing no-ctfconvert to C generation rules
Stop running ctfconvert over generated C files in the kernel by marking
them with no-ctfconvert.

This fixes warnings from ctfconvert trying to parse C files:

ctfconvert: file.c: Couldn't read ehdr: Invalid argument

Reviewed by:	emaste, mmel
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D28156
2021-01-15 09:41:41 +00:00
Vladimir Kondratyev
b62f6dfaed hid: Replace USBHID_ENABLED kernel config option with loader tunable
usbhid(4) is disabled by default to avoid conflicts with existing USB HID
drivers. To enable it place following lines to /boot/loader.conf:

hw.usb.usbhid.enable=1
usbhid_load="YES"

Suggested by:	jhb
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D28124
2021-01-14 23:04:47 +03:00
Andrew Turner
6eebda3bba Split out the NODEBUG options to a common file
This is the superset of the nooptions found in the -DEBUG kernels.

Reviewed by:	emaste, manu
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D28152
2021-01-14 16:57:53 +00:00
Glen Barber
7ae27c2d6c newvers.sh: set to ALPHA1 as part of the 13.0 cycle
Sponsored by:	Rubicon Communications, LLC (netgate.com)
2021-01-13 19:01:30 -05:00
Andrew Turner
594389d1de Create a stack frame when needed in the arm64 kernel
When building the arm64 kernel for use with dtrace or hwpmc we need
to include a stack frame so they can extract a stack trace.

As with amd64 also build a stack frame in modules.

Sponsored by:	Innovate UK
2021-01-13 16:36:52 +00:00
Emmanuel Vadot
11d62b6f31 linuxkpi: add kernel_fpu_begin/kernel_fpu_end
With newer AMD GPUs (>=Navi,Renoir) there is FPU context usage in the
amdgpu driver.
The `kernel_fpu_begin/end` implementations in drm did not even allow nested
begin-end blocks.

Submitted by: Greg V
Reviewed By: manu, hselasky
Differential Revision: https://reviews.freebsd.org/D28061
2021-01-12 12:31:00 +01:00
Emmanuel Vadot
2c95fb753f linuxkpi: Add shrinker support
A driver can register a shrinker that will be called when the kernel
wants to free some memory.
Add support for that in linuxkpi and call the registered shrinkers
when the lowmem event is triggered.

Reviewed by:	bz
Differential Revision:	 https://reviews.freebsd.org/D27728
2021-01-12 12:31:00 +01:00
Vladimir Kondratyev
0f0379fa55 hid: Add recently imported drivers to NOTES
Reviewed by:	hselasky
Differential revision:	https://reviews.freebsd.org/D28060
2021-01-10 22:17:20 +03:00
Hans Petter Selasky
a898ee51c4 Fix LINT kernel build after 01f2e864f7.
Differential revision:	https://reviews.freebsd.org/D27893
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-09 10:49:21 +01:00
Konstantin Belousov
de27805fee linuxkpi: handle ARI
Stop trying to manually calculate RID, which cannot be done correctly
by PCI_DEVFN().  Use PCI_GET_RID() method instead.

Do not use pci_find_dbsf() to go from the linux pci_dev to freebsd
device_t.  First, device is readily available as dev.bsddev.  Second,
using pci_find_dbsf() fails for ARI-enabled functions with large
function numbers, because PCI_SLOT()/PCI_FUNC() are for non-ARI.

Reviewed by:	bz, hselasky, manu
Tested by:	manu (drm)
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27960
2021-01-08 23:17:21 +02:00
mhorne
bbfa199cbc arm64: gdb(4) machine-dependent bits
Everything required for remote kernel debugging over a serial
connection. For FDT-based systems, a debug port can be specified by
setting hw.fdt.dbgport to the desired device tree node in loader.conf.
For example, hw.fdt.dbgport="uart1", or
hw.fdt.dbgport="serial@ff1a0000".

Looks good:	emaste
Tested by:	rwatson
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27727
2021-01-08 14:53:44 -04:00
Warner Losh
a21def4d56 pccard: Remove wi(4) driver
Remove wi(4). pccard is going away, and wi only supports PC Card
devices, though it has a minor amount of glue to also support
PCI cards. However, removing the one without removing the other
is hard, so the whole driver is being removed.

Relnotes: Yes
2021-01-07 20:41:06 -07:00
Warner Losh
23e124c78b pccard: Remove bt3c(4) driver
pccard is being removed, so remove bt3c driver since it only has PC
Card attachment. Also remove bt3cfw(8) since it's the firmware for this
driver.

Relnotes: Yes
2021-01-07 20:40:41 -07:00
Warner Losh
0d3a424a89 pccard: Remove cmx(4) driver
The only attachment of cmx was pccard, so remove the driver in
anticipation of PC Card support removal.

Relnotes: Yes
2021-01-07 20:23:18 -07:00
Warner Losh
31cafce9fd pccard: Remove ata(4) PC Card attachemnt
Remove ata PC Card attachment.

Relnotes: Yes
2021-01-07 20:23:14 -07:00