Commit Graph

250003 Commits

Author SHA1 Message Date
Brandon Bergren
9411e24df3 [PowerPC] kernel ifunc support for powerpc*, fix ppc64 relocation oddities.
This is a general cleanup of the relocatable kernel support on powerpc,
needed to enable kernel ifuncs.

 * Fix some relocatable issues in the kernel linker, and change to using
   a RELOCATABLE_KERNEL #define instead of #ifdef __powerpc__ for parts that
   other platforms can use in the future if they wish to have ET_DYN kernels.

 * Get rid of the DB_STOFFS hack now that the kernel is relocated to the DMAP
   properly across the board on powerpc64.

 * Add powerpc64 and powerpc32 ifunc functionality.

 * Allow AIM64 virtual mode OF kernels to run from the DMAP like other AIM64
   by implementing a virtual mode restart. This fixes the runtime address on
   PowerMac G5.

 * Fix symbol relocation problems on post-relocation kernels by relocating
   the symbol table.

 * Add an undocumented method for supplying kernel symbols on powernv and
   other powerpc machines using linux-style kernel/initrd loading -- If
   you pass the kernel in as the initrd as well, the copy resident in initrd
   will be used as a source for symbols when initializing the debugger.
   This method is subject to removal once we have a better way of doing this.

Approved by:	jhibbits
Relnotes:	yes
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D23156
2020-05-07 19:32:49 +00:00
Ed Maste
f8519228d1 OptionalObsoleteFiles.inc: remove objdump
objdump is removed unconditionally in ObsoleteFiles.inc
2020-05-07 18:24:32 +00:00
Hans Petter Selasky
40d59cd731 Set PCM_CAP_VIRTUAL for virtual DSP devices.
Submitted by:	Kevin Zheng <kevinz5000@gmail.com>
PR:		246206
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2020-05-07 18:15:35 +00:00
Jessica Clarke
cfe6a221ad virtio_mmio: Add casts missing from r360722
This fixes -Wshift-count-overflow warnings/errors on architectures using
32-bit physical addresses.

Reported by:	lwhsu
2020-05-07 17:59:17 +00:00
Brandon Bergren
f57d153e2e [PowerPC] Fix powerpcspe build failure after r360569
On powerpcspe, vm_paddr_t is 64 bit despite it being a 32 bit platform.
Adjust compile time assertion to compensate.
2020-05-07 17:58:07 +00:00
Emmanuel Vadot
4c27484934 linuxkpi: Add pci_iomap and pci_iounmap
Those function are use to map/unmap io region of a pci device.
Different resource can be mapped depending on the bar so use a
tailq to store them all.

Sponsored-by: The FreeBSD Foundation

Reviewed by:	emaste, hselasky
Differential Revision:	https://reviews.freebsd.org/D24696
2020-05-07 17:00:51 +00:00
Piotr Pawel Stefaniak
ca8c0d5e81 ps: extend the non-standard option -d (tree view) to work with -p
Initially it seemed that there were multiple possible ways to do it.

Processing option -p could conditionally add selected processes and
their descendants to the list for further work, but it is not guaranteed
to know whether the -d option has been used or not, and it also doesn't
have access to the process list just yet.

There is also descendant_sort() which has access to all possibly needed
information, but serves the purely post-processing purpose of sorting
output.

Then there is the loop that uses invocation information and full process
list to create a list of processes for final display. It seems the most
natural place to implement this, but indeterminate state of the process
list and volatility of the final list that is being created obstruct
adding an elegant search for all elements of process descendancy trees.

So I opted for adding another loop, just before the one I mentioned
above. For all selected processes it conditionally adds direct
descendants to the end of this list of selected processes.

Possible usage:
* ps -auxd -p $$
* ps -auxd -p 1
* while x=$(pgrep svnlite); do clear; ps auxd -p $x; sleep 2; done
* ps -auxd -p `pgrep make`

Reviewed by:	kevans, kaktus (earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24380
2020-05-07 16:56:18 +00:00
Andriy Gapon
20077ec02c gpioiic_attach: fix a NULL pointer crash on hints-based systems
The attach method uses GPIO_GET_BUS() to get a "newbus" device
that provides a pin.  But on hints-based systems a GPIO controller
driver might not be fully initialized yet and it does not know gpiobus
hanging off it.  Thus, GPIO_GET_BUS() cannot be called yet.
The reason is that controller drivers typically create a child gpiobus
using gpiobus_attach_bus() and that leads to the following call chain:
gpiobus_attach_bus() -> gpiobus_attach() ->
bus_generic_attach(gpiobus) -> gpioiic_attach().
So, gpioiic_attach() is called before gpiobus_attach_bus() returns.

I observed this bug with nctgpio driver on amd64.
I think that the problem was introduced in r355276.

The fix is to avoid calling GPIO_GET_BUS() from the attach method.
Instead, we know that on hints-based systems only the parent gpiobus can
provide the pins.
Nothing is changed for FDT-based systems.

MFC after:	1 week
2020-05-07 13:11:32 +00:00
Baptiste Daroussin
e47f1857b2 Update the screen termcap entries
Those updates have been obtained form converting the terminfo information
provided by the screen sources to termcap.

MFC after:	3 days
2020-05-07 12:43:28 +00:00
Marcin Wojtas
04cf2b885d Optimize ENA Rx refill for low memory conditions
Sometimes, especially when there is not much memory in the system left,
allocating mbuf jumbo clusters (like 9KB or 16KB) can take a lot of time
and it is not guaranteed that it'll succeed. In that situation, the
fallback will work, but if the refill needs to take a place for a lot of
descriptors at once, the time spent in m_getjcl looking for memory can
cause system unresponsiveness due to high priority of the Rx task. This
can also lead to driver reset, because Tx cleanup routine is being
blocked and timer service could detect that Tx packets aren't cleaned
up. The reset routine can further create another unresponsiveness - Rx
rings are being refilled there, so m_getjcl will again burn the CPU.
This was causing NVMe driver timeouts and resets, because network driver
is having higher priority.

Instead of 16KB jumbo clusters for the Rx buffers, 9KB clusters are
enough - ENA MTU is being set to 9K anyway, so it's very unlikely that
more space than 9KB will be needed.

However, 9KB jumbo clusters can still cause issues, so by default the
page size mbuf cluster will be used for the Rx descriptors. This can have a
small (~2%) impact on the throughput of the device, so to restore
original behavior, one must change sysctl "hw.ena.enable_9k_mbufs" to
"1" in "/boot/loader.conf" file.

As a part of this patch (important fix), the version of the driver
was updated to v2.1.2.

Submitted by:   cperciva
Reviewed by:    Michal Krawczyk <mk@semihalf.com>
Reviewed by:    Ido Segev <idose@amazon.com>
Reviewed by:    Guy Tzalik <gtzalik@amazon.com>
MFC after:      3 days
PR:             225791, 234838, 235856, 236989, 243531
Differential Revision: https://reviews.freebsd.org/D24546
2020-05-07 11:28:39 +00:00
Randall Stewart
8717b8f1bb NF has an internal option that changes the tcp_mcopy_m routine slightly (has
a few extra arguments). Recently that changed to only have one arg extra so
that two ifdefs around the call are no longer needed. Lets take out the
extra ifdef and arg.

Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D24736
2020-05-07 10:46:02 +00:00
Baptiste Daroussin
99c986470b Fix indentation of the Kitty entry
MFC after:	2 days
2020-05-07 08:58:08 +00:00
Alexander V. Chernikov
682b902daf Add rib_lookup() sockaddr lookup wrapper and make ifa_ifwithroute use it.
Create rib_lookup() wrapper around per-af dataplane lookup functions.
This will help in the cases of having control plane af-agnostic code.

Switch ifa_ifwithroute() to use this function instead of rtalloc1().

Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D24731
2020-05-07 08:11:36 +00:00
Jessica Clarke
a1da7a46f6 virtio: Support MMIO bus for all devices
The bus is independent of the device, so all devices can be attached to
either a PCI bus or an MMIO bus. For example, QEMU's virtio-rng-device
gives the MMIO variant of virtio-rng-pci, and is now detected.

Reviewed by:	andrew, br, brooks (mentor)
Approved by:	andrew, br, brooks (mentor)
Differential Revision:	https://reviews.freebsd.org/D24730
2020-05-06 23:31:30 +00:00
Jessica Clarke
046096d5c7 virtio_mmio: Support non-transitional version 2 devices
The non-legacy virtio MMIO specification drops the use of PFNs and
replaces them with physical addresses. Whilst many implementations are
so-called transitional devices, also implementing the legacy
specification, TinyEMU[1] does not. Device-specific configuration
registers have also changed to being little-endian, and must be accessed
using a single aligned access for registers up to 32 bits, and two
32-bit aligned accesses for 64-bit registers.

[1] https://bellard.org/tinyemu/

Reviewed by:	br, brooks (mentor)
Approved by:	br, brooks (mentor)
Differential Revision:	https://reviews.freebsd.org/D24681
2020-05-06 23:28:51 +00:00
John Baldwin
883a2dc672 Deprecate ubsec(4) for FreeBSD 13.0.
With the removal of in-tree consumers of DES, Triple DES, and
MD5-HMAC, the only algorithm this driver still supports is SHA1-HMAC.
This is not very useful as a standalone algorithm (IPsec AH-only with
SHA1 would be the only user).

This driver has also not been kept up to date with the original driver
in OpenBSD which supports a few more cards and AES-CBC on newer cards.
The newest card currently supported by this driver was released in
2005.

Reviewed by:	cem
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24691
2020-05-06 22:15:09 +00:00
Dimitry Andric
e86cf8ada1 Merge commit 4ca2cad94 from llvm git (by Justin Hibbits):
[PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

  Summary:

  Change the default ABI to be compatible with GCC. For 32-bit ELF
  targets other than Linux, Clang now returns small structs in
  registers r3/r4. This affects FreeBSD, NetBSD, OpenBSD. There is no
  change for 32-bit Linux, where Clang continues to return all structs
  in memory.

  Add clang options -maix-struct-return (to return structs in memory)
  and -msvr4-struct-return (to return structs in registers) to be
  compatible with gcc. These options are only for PPC32; reject them on
  PPC64 and other targets. The options are like -fpcc-struct-return and
  -freg-struct-return for X86_32, and use similar code.

  To actually return a struct in registers, coerce it to an integer of
  the same size. LLVM may optimize the code to remove unnecessary
  accesses to memory, and will return i32 in r3 or i64 in r3:r4.

  Fixes PR#40736

  Patch by George Koehler!

  Reviewed By: jhibbits, nemanjai
  Differential Revision: https://reviews.llvm.org/D73290

Requested by:	jhibbits
MFC after:	3 days
2020-05-06 19:10:39 +00:00
Ed Maste
e3d954e7bb src.conf.5: regen after objdump removal 2020-05-06 18:43:27 +00:00
Ed Maste
fe808290f0 src.opts.mk: with BINUTILS limited to as it is used on i386 and amd64 only 2020-05-06 18:40:52 +00:00
Ed Maste
8b18f85887 update WITH_/WITHOUT_BINUTILS descriptions for objdump removal 2020-05-06 18:39:55 +00:00
Ed Maste
80b7615484 binutils: disconnect objdump from the build
The in-tree binutils is old and will not be updated.  It does not support
all archs supported by FreeBSD, and for the archs it does support not all
CPU features are supported.

Other tools have migrated to copyfree alternatives.  Although llvm-objdump
is nearly a drop-in replacement for GNU objdump it is missing a few options
and has some differences in output format.  For now just remove GNU objdump;
ports and developers can use a contemporary, maintained version from ports
or packages.  We can revisit installing llvm-objdump as objdump in the
future.

PR:		212319 [exp-run]
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7338
2020-05-06 18:38:40 +00:00
Dimitry Andric
95512cda91 In r358396 I merged llvm upstream commit 2e24219d3, which fixed "error:
unsupported relocation on symbol" when assembling arm 'adr' pseudo
instructions. However, the upstream commit did not take big-endian arm
into account.

Applying the same changes to the big-endian handling is straightforward,
thanks to Andrew Turner and Peter Smith for the hint. This will also be
submitted upstream.

MFC after:	immediately, since this fix is meant for stable/11
2020-05-06 18:13:00 +00:00
Andriy Gapon
6e32d0e325 usbhid: add several missing usages from Digitizer page
This is applicable to HID in general, not just USB HID.

Inspired by:	wulf
MFC after:	1 week
2020-05-06 15:24:31 +00:00
Mark Johnston
6d08b87b88 arm: Don't enable interrupts in init_secondary().
This has the same reasoning as described in r357048.

Remove a stray declaration while here.

Reported and tested by:	trasz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-05-06 15:10:05 +00:00
Mark Johnston
1a5b3b5102 Simplify arm64's pmap_bootstrap() a bit.
locore constructs an L2 page mapping the kernel and preloaded data
starting a KERNBASE (the same as VM_MIN_KERNEL_ADDRESS on arm64).
initarm() and pmap_bootstrap() use the preloaded metadata to
tell it where it can start allocating from.

pmap_bootstrap() currently iterates over the L2 page to find the last
valid entry, but doesn't do anything with the result.  Remove the loop
and zap some now-unused local variables.

MFC after:	2 weeks
Sponsored by:	Juniper Networks, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D24559
2020-05-06 15:01:06 +00:00
Alexander V. Chernikov
768c98a737 Add basic routing LPM tests.
Differential Revision:	https://reviews.freebsd.org/D24684
2020-05-06 07:48:37 +00:00
Ed Maste
6fd36c3b7a GNU as: print a deprecation warning on program start
GNU as 2.17.50 will be removed before FreeBSD 13.
2020-05-06 01:08:19 +00:00
Rick Macklem
04d6c514b0 Delete unused function newnfs_trimleading.
The NFS function called newnfs_trimleading() has not been used by the
code in long time. To give you a clue, it still had a K&R style function
declaration.
Delete it, since it is just cruft, as a part of the NFS mbuf handling
cleanup in preparation for adding ext_pgs mbuf support.
The ext_pgs mbuf support for the build/send side is needed by
nfs-over-tls.
2020-05-06 00:44:03 +00:00
Ed Maste
4ac4a7f80b elfctl: update earliest FreeBSD revision to 12.2
elfctl has been merged to stable/12, and so will appear in FreeBSD 12.2

Reported by:	Dewayne Geraghty
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-05-05 21:50:52 +00:00
Michael Tuexen
cb9fb7b2cb Avoid underflowing a variable, which would result in taking more
data from the stream queues then needed.

Thanks to Timo Voelker for finding this bug and providing a fix.

MFC after:		3 days
2020-05-05 19:54:30 +00:00
Benedict Reuschling
6a7016194d Add HISTORY sections to document when this
functionality first appeared in FreeBSD.

Submitted by:	Gordon Bergling gbergling_gmail.com
Approved by:	bcr
Differential Revision:	https://reviews.freebsd.org/D24677
2020-05-05 19:31:47 +00:00
Benedict Reuschling
ac39a5d5ea Fix broken links in the man page by pointing to a
source that works or is the new location on the
same page.

Submitted by:	    alfix86_gmail.com
Approved by:	    bcr
Differential Revision:	https://reviews.freebsd.org/D23769
2020-05-05 19:00:26 +00:00
Conrad Meyer
530d2d67b5 ls(1): Fix trivial SEGV due to NULL deref in OOM path
Reported by:	Anton Rang <rang AT acm.org>
Sponsored by:	Dell EMC Isilon
2020-05-05 18:06:32 +00:00
Conrad Meyer
b34f8412c5 strdup.3: Slightly canonicalize OOM return/error status
Attempted to clean up the language around "this is a malloc'd object."  May be
passed as a parameter to free(3) is a bit obtuse.

Sponsored by:	Dell EMC Isilon
2020-05-05 17:57:04 +00:00
Conrad Meyer
6b1e5fae2c pwcache.3: Explicitly document OOM condition
The pwcache functions allocate memory, and may return NULL pointers if that
allocation fails and the corresponding uid or gid was not found in the local
password database.  Document this behavior.

Sponsored by:	Dell EMC Isilon
2020-05-05 17:55:45 +00:00
Michael Tuexen
d3c3d6f99c Fix the computation of the numbers of entries of the mapping array to
look at when generating a SACK. This was wrong in case of sequence
numbers wrap arounds.

Thanks to Gwenael FOURRE for reporting the issue for the userland stack:
https://github.com/sctplab/usrsctp/issues/462
MFC after:		3 days
2020-05-05 17:52:44 +00:00
Andriy Gapon
f470cbb2d6 acpi_video: try our best to work on systems without non-essential methods
Only _BCL and _BCM methods seem to be essential to the driver's
operation.  If _BQC is missing then we can assume that the current
brightness is whatever we set by the last _BCM invocation.  If _DCS or
_DGS is missing the we can make assumptions as well.

The change is based on a patch suggested by Anthony Jenkins
<Scoobi_doo@yahoo.com> in PR 207086.

PR:		207086
Submitted by:	Anthony Jenkins <Scoobi_doo@yahoo.com (earlier version)
Reviewed by:	manu
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D24653
2020-05-05 12:14:11 +00:00
Andrew Turner
4495f36874 Fix the EFI_DEBUG case, prio_str is only used when EFI_DEBUG is unset.
Sponsored by:	Innovate UK
2020-05-05 10:01:10 +00:00
Andrew Turner
3d5e12ebce As with r352446 align blocks in boot1.efi
We need to ensure the buffers are aligned before passing them to ReadBlocks.
Assume 512 bytes is enough for now.

Reviewed by:	imp
MFC after:	1 month
Sponsored by:	Innovate UK
2020-05-05 09:42:26 +00:00
Rick Macklem
3973ef1dfc Revert r360514, to avoid unnecessary churn of the sources.
r360514 prepared the NFS code for changes to handle ext_pgs mbufs on
the receive side. However, at this time, KERN_TLS does not pass
ext_pgs mbufs up through soreceive(). As such, as this time, only
the send/build side of the NFS mbuf code needs to handle ext_pgs mbufs.
Revert r360514 since the rather extensive changes required for receive
side ext_pgs mbufs are not yet needed.
This avoids unnecessary churn of the sources.
2020-05-05 00:58:03 +00:00
John Baldwin
483d953a86 Initial support for bhyve save and restore.
Save and restore (also known as suspend and resume) permits a snapshot
to be taken of a guest's state that can later be resumed.  In the
current implementation, bhyve(8) creates a UNIX domain socket that is
used by bhyvectl(8) to send a request to save a snapshot (and
optionally exit after the snapshot has been taken).  A snapshot
currently consists of two files: the first holds a copy of guest RAM,
and the second file holds other guest state such as vCPU register
values and device model state.

To resume a guest, bhyve(8) must be started with a matching pair of
command line arguments to instantiate the same set of device models as
well as a pointer to the saved snapshot.

While the current implementation is useful for several uses cases, it
has a few limitations.  The file format for saving the guest state is
tied to the ABI of internal bhyve structures and is not
self-describing (in that it does not communicate the set of device
models present in the system).  In addition, the state saved for some
device models closely matches the internal data structures which might
prove a challenge for compatibility of snapshot files across a range
of bhyve versions.  The file format also does not currently support
versioning of individual chunks of state.  As a result, the current
file format is not a fixed binary format and future revisions to save
and restore will break binary compatiblity of snapshot files.  The
goal is to move to a more flexible format that adds versioning,
etc. and at that point to commit to providing a reasonable level of
compatibility.  As a result, the current implementation is not enabled
by default.  It can be enabled via the WITH_BHYVE_SNAPSHOT=yes option
for userland builds, and the kernel option BHYVE_SHAPSHOT.

Submitted by:	Mihai Tiganus, Flavius Anton, Darius Mihai
Submitted by:	Elena Mihailescu, Mihai Carabas, Sergiu Weisz
Relnotes:	yes
Sponsored by:	University Politehnica of Bucharest
Sponsored by:	Matthew Grooms (student scholarships)
Sponsored by:	iXsystems
Differential Revision:	https://reviews.freebsd.org/D19495
2020-05-05 00:02:04 +00:00
Michael Tuexen
51a5392297 Add net epoch support back, which was taken out by accident in
https://svnweb.freebsd.org/changeset/base/360639

Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D24694
2020-05-04 23:05:11 +00:00
Randall Stewart
570045a0fc This fixes two issues found by ankitraheja09@gmail.com
1) When BBR retransmits the syn it was messing up the snd_max
2) When we need to send a RST we might not send it when we should

Reported by:	ankitraheja09@gmail.com
Sponsored by:  Netflix.com
Differential Revision: https://reviews.freebsd.org/D24693
2020-05-04 23:02:58 +00:00
John Baldwin
ad5570559b Use a lookup table of algorithm types for alg_is_* helpers.
This makes it easier to maintain these functions as algorithms are
added or removed.

Reviewed by:	cem
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D24668
2020-05-04 22:31:38 +00:00
Michael Tuexen
7985fd7e76 Enter the net epoch before calling the output routine in TCP BBR.
This was only triggered when setting the IPPROTO_TCP level socket
option TCP_DELACK.
This issue was found by runnning an instance of SYZKALLER.
Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D24690
2020-05-04 22:02:49 +00:00
Randall Stewart
963fb2ad94 This commit brings things into sync with the advancements that
have been made in rack and adds a few fixes in BBR. This also
removes any possibility of incorrectly doing OOB data the stacks
do not support it. Should fix the skyzaller crashes seen in the
past. Still to fix is the BBR issue just reported this weekend
with the SYN and on sending a RST. Note that this version of
rack can now do pacing as well.

Sponsored by:Netflix Inc
Differential Revision:https://reviews.freebsd.org/D24576
2020-05-04 20:28:53 +00:00
Randall Stewart
d3b6c96b7d Adjust the fb to have a way to ask the underlying stack
if it can support the PRUS option (OOB). And then have
the new function call that to validate and give the
correct error response if needed to the user (rack
and bbr do not support obsoleted OOB data).

Sponsoered by: Netflix Inc.
Differential Revision:	 https://reviews.freebsd.org/D24574
2020-05-04 20:19:57 +00:00
Brooks Davis
ea69bf7f5d Set LG_VADDR to 48 on RISC-V.
The Sv48 PTE format is the largest currently defined address space for
RISC-V. It makes no sense to define a larger size and doing so (at
least for 64-bits) forces rtrees down a slow path.

Reviewed by:	vangyzen, jhb, mhorne
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24658
2020-05-04 17:16:30 +00:00
John Baldwin
af5b6f81db Add RFC reference for AES-CTR with IPsec.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2020-05-04 16:50:01 +00:00
Alexander V. Chernikov
d94be4ccaa Switch DDB show route to direct rnh_matchaddr() call instead of rtalloc1().
Eliminate the last rtalloc1() call to finish transition to the new routing
KPI defined in r359823.

Differential Revision:	https://reviews.freebsd.org/D24663
2020-05-04 15:07:57 +00:00