]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoConsolidate powerpcspe CFLAGS
Justin Hibbits [Sun, 10 Nov 2019 22:08:07 +0000 (22:08 +0000)]
Consolidate powerpcspe CFLAGS

Don't depend on CPUTYPE to define powerpcspe CFLAGS, they should be set
unconditionally.  This reduces duplication.  Also, set some CFLAGS as
gcc-only, because clang's SPE support always uses the SPE ABI, it's not an
optional feature.

4 years agopowerpcspe: use -mspe instead of -mspe=yes to enable SPE
Justin Hibbits [Sun, 10 Nov 2019 20:36:38 +0000 (20:36 +0000)]
powerpcspe: use -mspe instead of -mspe=yes to enable SPE

-mspe=yes/no was deprecated even before GCC 4.2.1 in favor of
-mspe/-mno-spe.  Clang only supports -mspe/-mno-spe.

4 years agoSome language fixes.
Alexander Motin [Sun, 10 Nov 2019 18:07:02 +0000 (18:07 +0000)]
Some language fixes.

Submitted by: rpokala@
MFC after: 2 weeks

4 years agoMFV r354582: file 5.37.
Xin LI [Sun, 10 Nov 2019 17:00:23 +0000 (17:00 +0000)]
MFV r354582: file 5.37.

MFC after: 3 days

4 years agoloader: use struct initializer in vdev_probe().
Toomas Soome [Sun, 10 Nov 2019 15:07:36 +0000 (15:07 +0000)]
loader: use struct initializer in vdev_probe().

Hopefully it is a bit more clear this way.

4 years agoloader: memory leak in vdev_label_read_config()
Toomas Soome [Sun, 10 Nov 2019 15:03:59 +0000 (15:03 +0000)]
loader: memory leak in vdev_label_read_config()

We need to free the allocated buffer for label.

4 years agoamd64: change r_gdt to the local variable in hammer_time().
Konstantin Belousov [Sun, 10 Nov 2019 10:03:22 +0000 (10:03 +0000)]
amd64: change r_gdt to the local variable in hammer_time().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoamd64: Change SFENCE to locked op for synchronizing with CLFLUSHOPT on Intel.
Konstantin Belousov [Sun, 10 Nov 2019 09:41:29 +0000 (09:41 +0000)]
amd64: Change SFENCE to locked op for synchronizing with CLFLUSHOPT on Intel.

Reviewed by: cem, jhb
Discussed with: alc, scottph
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22007

4 years agoamd64: move common_tss into pcpu.
Konstantin Belousov [Sun, 10 Nov 2019 09:28:18 +0000 (09:28 +0000)]
amd64: move common_tss into pcpu.

This saves some memory, around 256K I think.  It removes some code,
e.g. KPTI does not need to specially map common_tss anymore.  Also,
common_tss become domain-local.

Reviewed by: jhb
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22231

4 years agoInclude cache zones into zone_foreach() where appropriate.
Konstantin Belousov [Sun, 10 Nov 2019 09:25:19 +0000 (09:25 +0000)]
Include cache zones into zone_foreach() where appropriate.

The r354367 is reverted since it is subsumed by this, more complete, approach.

Suggested by: markj
Reviewed by: alc. glebius, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22242

4 years agoEliminate a redundant pmap_load() from pmap_remove_pages().
Alan Cox [Sun, 10 Nov 2019 05:22:01 +0000 (05:22 +0000)]
Eliminate a redundant pmap_load() from pmap_remove_pages().

There is no reason why the pmap_invalidate_all() in pmap_remove_pages()
must be performed before the final PV list lock release.  Move it past
the lock release.

Eliminate a stale comment from pmap_page_test_mappings().  We implemented
a modified bit in r350004.

MFC after: 1 week

4 years agopowerpc64/powernv: Use OPAL call for non-POWER8 PCI TCE reset
Justin Hibbits [Sun, 10 Nov 2019 04:24:36 +0000 (04:24 +0000)]
powerpc64/powernv: Use OPAL call for non-POWER8 PCI TCE reset

According to the OPAL documentation, only the POWER8 (PHB3) should use
the register write TCE reset method.  All others should use the OPAL
call.

On POWER9 the call is semantically identical to the register write, with
a wait for completion.

4 years agoVendor import of file 5.37
Xin LI [Sun, 10 Nov 2019 03:44:32 +0000 (03:44 +0000)]
Vendor import of file 5.37

4 years agoAdd compact scraptchpad protocol for ntb_transport(4).
Alexander Motin [Sun, 10 Nov 2019 03:37:45 +0000 (03:37 +0000)]
Add compact scraptchpad protocol for ntb_transport(4).

Previously ntb_transport(4) required at least 6 scratchpad registers,
plus 2 more for each additional memory window.  That is too much for some
configurations, where several drivers have to share resources of the same
NTB hardware.  This patch introduces new compact version of the protocol,
requiring only 3 scratchpad registers, plus one more for each additional
memory window.  The optimization is based on fact that neither of version,
number of windows or number of queue pairs really need more then one byte
each, and window sizes of 4GB are not very useful now.  The new protocol
is activated automatically when the configuration is low on scratchpad
registers, or it can be activated explicitly with loader tunable.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoAllow splitting PLX NTB BAR2 into several memory windows.
Alexander Motin [Sun, 10 Nov 2019 03:24:53 +0000 (03:24 +0000)]
Allow splitting PLX NTB BAR2 into several memory windows.

Address Lookup Table (A-LUT) being enabled allows to specify separate
translation for each 1/128th or 1/256th of the BAR2.  Previously it was
used only to limit effective window size by blocking access through some
of A-LUT elements.  This change allows A-LUT elements to also point
different memory locations, providing to upper layers several (up to 128)
independent memory windows.  A-LUT hardware allows even more flexible
configurations than this, but NTB KPI have no way to manage that now.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agobcm2835_sdhci: don't panic in DMA interrupt if curcmd went away
Kyle Evans [Sun, 10 Nov 2019 03:06:03 +0000 (03:06 +0000)]
bcm2835_sdhci: don't panic in DMA interrupt if curcmd went away

This is an exceptional case; generally found during controller errors.
A panic when we attempt to acess slot->curcmd->data is less ideal than
warning, and other verbiage will be emitted to indicate the exact error.

4 years agoRevert premature part of r354577
Kyle Evans [Sun, 10 Nov 2019 02:31:29 +0000 (02:31 +0000)]
Revert premature part of r354577

bcm2835_vcbus.c will be the future home to some I/O address mapping
routines, but it has neither been committed nor reviewed.

4 years agoarm64: add SOC_BRCM_BCM2838, build it in GENERIC
Kyle Evans [Sun, 10 Nov 2019 01:43:51 +0000 (01:43 +0000)]
arm64: add SOC_BRCM_BCM2838, build it in GENERIC

BCM2838/BCM2711 is the Raspberry Pi 4, which we will soon be able to boot
on once some ports bits are worked out.

4 years agoUpdate the VOP_COPY_FILE_RANGE man page to reflect the semantic change
Rick Macklem [Sun, 10 Nov 2019 01:21:10 +0000 (01:21 +0000)]
Update the VOP_COPY_FILE_RANGE man page to reflect the semantic change
made by r354574.

This is a content change.

4 years agoUpdate the copy_file_range man page to reflect the semantic change
Rick Macklem [Sun, 10 Nov 2019 01:13:41 +0000 (01:13 +0000)]
Update the copy_file_range man page to reflect the semantic change
done by r354574.

This is a content change.

4 years agoUpdate copy_file_range(2) to be Linux5 compatible.
Rick Macklem [Sun, 10 Nov 2019 01:08:14 +0000 (01:08 +0000)]
Update copy_file_range(2) to be Linux5 compatible.

The current linux man page and testing done on a fairly recent linux5.n
kernel have identified two changes to the semantics of the linux
copy_file_range system call.
Since the copy_file_range(2) system call is intended to be linux compatible
and is only currently in head/current and not used by any commands,
it seems appropriate to update the system call to be compatible with
the current linux one.
The first of these semantic changes was changed to be compatible with
linux5.n by r354564.
For the second semantic change, the old linux man page stated that, if
infd and outfd referred to the same file, EBADF should be returned.
Now, the semantics is to allow infd and outfd to refer to the same file
so long as the byte ranges defined by the input file offset, output file offset
and len does not overlap. If the byte ranges do overlap, EINVAL should be
returned.
This patch modifies copy_file_range(2) to be linux5.n compatible for this
semantic change.

4 years agogeneric_ehci_fdt: Fix compile when EXT_RESOURCES isn't present
Emmanuel Vadot [Sat, 9 Nov 2019 22:25:45 +0000 (22:25 +0000)]
generic_ehci_fdt: Fix compile when EXT_RESOURCES isn't present

4 years agolibipsec: correct a typo
Bjoern A. Zeeb [Sat, 9 Nov 2019 21:59:29 +0000 (21:59 +0000)]
libipsec: correct a typo

Correct a typo in the ipsec_errlist and replicated in a comment.
No functional changes.

MFC after: 3 weeks

4 years agoAdd GEOM attribute to report physical device name, and report it
Edward Tomasz Napierala [Sat, 9 Nov 2019 17:30:19 +0000 (17:30 +0000)]
Add GEOM attribute to report physical device name, and report it
via 'diskinfo -v'.  This avoids the need to track it down via CAM,
and should also work for disks that don't use CAM.  And since it's
inherited thru the GEOM hierarchy, in most cases one doesn't need
to walk the GEOM graph either, eg you can use it on a partition
instead of disk itself.

Reviewed by: allanjude, imp
Sponsored by: Klara Inc
Differential Revision: https://reviews.freebsd.org/D22249

4 years agoFor vm_map, #defining DIAGNOSTIC to turn on full assertion-based
Doug Moore [Sat, 9 Nov 2019 17:08:27 +0000 (17:08 +0000)]
For vm_map, #defining DIAGNOSTIC to turn on full assertion-based
consistency checking slows performance dramatically. This change
reduces the number of assertions checked by completely walking the
vm_map tree only when the write-lock is released, and only then if the
number of modifications to the tree since the last walk exceeds the
number of tree nodes.

Reviewed by: alc, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22163

4 years agoUpdate the VOP_COPY_FILE_RANGE.9 man page to reflect the semantic change
Rick Macklem [Fri, 8 Nov 2019 23:58:33 +0000 (23:58 +0000)]
Update the VOP_COPY_FILE_RANGE.9 man page to reflect the semantic change
implemented by r354564.

This is a content change.

4 years agoUpdate the copy_file_range.2 man page to reflect the semantic change
Rick Macklem [Fri, 8 Nov 2019 23:49:27 +0000 (23:49 +0000)]
Update the copy_file_range.2 man page to reflect the semantic change
implemented by r354564.

This is a content change.

4 years agoUpdate copy_file_range(2) to be Linux5 compatible.
Rick Macklem [Fri, 8 Nov 2019 23:39:17 +0000 (23:39 +0000)]
Update copy_file_range(2) to be Linux5 compatible.

The current linux man page and testing done on a fairly recent linux5.n
kernel have identified two changes to the semantics of the linux
copy_file_range system call.
Since the copy_file_range(2) system call is intended to be linux compatible
and is only currently in head/current and not used by any commands,
it seems appropriate to update the system call to be compatible with
the current linux one.
The old linux man page stated that, if the
offset + len exceeded file_size for the input file, EINVAL should be returned.
Now, the semantics is to copy up to at most file_size bytes and return that
number of bytes copied. If the offset is at or beyond file_size, a return
of 0 bytes is done.
This patch modifies copy_file_range(2) to be linux compatible for this
semantic change.
A separate patch will change copy_file_range(2) for the other semantic
change, which allows the infd and outfd to refer to the same file, so
long as the byte ranges do not overlap.

4 years agobcm2835: commit missing constant from r354560
Kyle Evans [Fri, 8 Nov 2019 20:53:56 +0000 (20:53 +0000)]
bcm2835: commit missing constant from r354560

Surgically pulling the patch from my debugging work lead to this slopiness-
my apologies.

4 years agoAdd new iwm(4) files to sys/conf/files.
Mark Johnston [Fri, 8 Nov 2019 20:47:59 +0000 (20:47 +0000)]
Add new iwm(4) files to sys/conf/files.

Submitted by: rea
MFC with: r354504

4 years agobcm2835_sdhci: remove unused power_id field
Kyle Evans [Fri, 8 Nov 2019 20:14:36 +0000 (20:14 +0000)]
bcm2835_sdhci: remove unused power_id field

This was once set, but I removed it by the time I committed it because both
configurations use the same POWER_ID. This can be separated back out if the
situation changes.

4 years agobcm2835_sdhci: add some very basic support for rpi4
Kyle Evans [Fri, 8 Nov 2019 20:12:57 +0000 (20:12 +0000)]
bcm2835_sdhci: add some very basic support for rpi4

DMA is currently disabled while I work out why it's broken, but this is
enough for upstream U-Boot + rpi-firmware + our rpi3-psci-monitor to boot
with the right config.

The RPi 4 is still not in a good "supported" state, as we have no
USB/PCI-E/Ethernet drivers, but if air-gapped pies only able to operate over
cereal is your thing, here's your guy.

Submitted by: Robert Crowston (with modifications)

4 years agoloader.efi: Default to serial if we don't have a ConOut variable
Emmanuel Vadot [Fri, 8 Nov 2019 20:08:44 +0000 (20:08 +0000)]
loader.efi: Default to serial if we don't have a ConOut variable

In the EFI implementation in U-Boot no ConOut efi variable is created,
this cause loader to fallback to TERM_EMU implementation which is very
very very slow (and uses the ConOut device in the system table anyway).
The UEFI spec aren't clear as if this variable needs to exists or not.

Reviewed by: imp, kevans

4 years agoRemove explicit declaration of rk_clk_fract_set_freq() function
Michal Meloun [Fri, 8 Nov 2019 19:29:14 +0000 (19:29 +0000)]
Remove explicit declaration of rk_clk_fract_set_freq() function
forgotten in r354556.

MFC after: 3 weeks
MFC with: r354556
Noticed by: manu

4 years agoTidy up Rockchip composite clock.
Michal Meloun [Fri, 8 Nov 2019 19:15:50 +0000 (19:15 +0000)]
Tidy up Rockchip composite clock.
- add support for log2 based dividers
- use proper write mask when writing to divider register

MFC after: 3 weeks
Reviewed by: manu
Differential Revision:  https://reviews.freebsd.org/D22283

4 years agoEnhance Rockchip clocks implementation.
Michal Meloun [Fri, 8 Nov 2019 19:13:11 +0000 (19:13 +0000)]
Enhance Rockchip clocks implementation.
- add support for fractional dividers
- allow to declare fixed and linked clock

MFC after: 3 weeks
Reviewed by: manu
Differential Revision:  https://reviews.freebsd.org/D22282

4 years agoCleanup Rockchip clocks implementation.
Michal Meloun [Fri, 8 Nov 2019 19:03:34 +0000 (19:03 +0000)]
Cleanup Rockchip clocks implementation.
- style
- unify dprinf defines
- make dprinf's 32-bit compatible
Not a functional change.

MFC after: 3 weeks
Reviewed by: manu, imp
Differential Revision:  https://reviews.freebsd.org/D22281

4 years agoImplement support for (soft)linked clocks.
Michal Meloun [Fri, 8 Nov 2019 18:57:41 +0000 (18:57 +0000)]
Implement support for (soft)linked clocks.
This kind of clock nodes represent temporary placeholder for clocks
defined later in boot process. Also, these are necessary to break
circular dependencies occasionally occurring in complex clock graphs.

MFC after: 3 weeks

4 years agoReenable netinet6 and netpfil tests on i386, net/scapy 2.4.3_2 contains the fix
Li-Wen Hsu [Fri, 8 Nov 2019 18:56:02 +0000 (18:56 +0000)]
Reenable netinet6 and netpfil tests on i386, net/scapy 2.4.3_2 contains the fix

PR: 239380
Sponsored by: The FreeBSD Foundation

4 years agobhyve: add support for virtio-net mergeable rx buffers
Vincenzo Maffione [Fri, 8 Nov 2019 17:57:03 +0000 (17:57 +0000)]
bhyve: add support for virtio-net mergeable rx buffers

Mergeable rx buffers is a virtio-net feature that allows the hypervisor
to use multiple RX descriptor chains to receive a single receive packet.
Without this feature, a TSO-enabled guest is compelled to publish only
64K (or 32K) long chains, and each of these large buffers is consumed
to receive a single packet, even a very short one. This is a waste of
memory, as a RX queue has room for 256 chains, which means up to 16MB
of buffer memory for each (single-queue) vtnet device.
With the feature on, the guest can publish 2K long chains, and the
hypervisor will merge them as needed.

This change also enables the feature in the netmap backend, which
supports virtio-net offloads. We plan to add support for the
tap backend too.
Note that differently from QEMU/KVM, here we implement one-copy receive,
while QEMU uses two copies.

Reviewed by:    jhb
MFC after:      3 weeks
Differential Revision: https://reviews.freebsd.org/D21007

4 years agoDereference lem(4), no longer in 13-CURRENT.
Glen Barber [Fri, 8 Nov 2019 17:33:42 +0000 (17:33 +0000)]
Dereference lem(4), no longer in 13-CURRENT.
While here, fix formatting of inline parenthesis and Xrs.

Sponsored by: Rubicon Communications, LLC (netgate.com)

4 years agolibpmc: Forgot regex.h
Emmanuel Vadot [Fri, 8 Nov 2019 17:27:20 +0000 (17:27 +0000)]
libpmc: Forgot regex.h

Reported by: ci
MFC after: 1 week
X-MFC-With: r354549

4 years agolibpmc: Match on the cpuid with a regex
Emmanuel Vadot [Fri, 8 Nov 2019 16:56:48 +0000 (16:56 +0000)]
libpmc: Match on the cpuid with a regex

The CPUID is, or can be, a regex to be matched.
Use regex from libc instead of strcmp

Tested-by: gallatin
MFC after: 1 week

4 years agovmm: pass M_WAITOK to uma_zalloc when allocating FPU save area
Eric van Gyzen [Fri, 8 Nov 2019 16:30:55 +0000 (16:30 +0000)]
vmm: pass M_WAITOK to uma_zalloc when allocating FPU save area

Submitted by: patrick.sullivan3@dell.com
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22276

4 years agomark LLVM_LIBUNWIND as broken on sparc64, with PR reference
Ed Maste [Fri, 8 Nov 2019 15:20:19 +0000 (15:20 +0000)]
mark LLVM_LIBUNWIND as broken on sparc64, with PR reference

PR: 233405

4 years agoelfcopy/strip: Ensure sections have required alignment on output
Ed Maste [Fri, 8 Nov 2019 14:59:41 +0000 (14:59 +0000)]
elfcopy/strip: Ensure sections have required alignment on output

Object files may specify insufficient alignment on certain sections, for
example due to a bug in NASM[1].  When we detect that case in elfcopy or
strip, emit a warning and increase the alignment to the minimum
required.

The NASM bug was fixed in 2015[2], but we might as well have this fixup
(and warning) in elfcopy in case we encounter such a file for any other
reason.

This might be reworked somewhat upstream - see ELF Tool Chain
ticket 485[3].

[1] https://bugzilla.nasm.us/show_bug.cgi?id=3392307
[2] https://repo.or.cz/w/nasm.git/commit/1f0cb0f2c1ba632c0fab02424928cfb756a9160c
[3] https://sourceforge.net/p/elftoolchain/tickets/485/

PR: 198611
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2292

4 years agokvm: fix types for cross-debugging
Ed Maste [Fri, 8 Nov 2019 14:51:09 +0000 (14:51 +0000)]
kvm: fix types for cross-debugging

As with other libkvm interfaces use maximum-sized types to support
cross-debugging (e.g. a 64-bit vmcore on a 32-bit host).  See
https://lists.freebsd.org/pipermail/svn-src-all/2019-February/176051.html
for further discussion.

This is an API-breaking change, but there are few consumers of this
interface today.

Reviewed by: will
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21945

4 years agofrag6: properly handle atomic fragments according to RFCs.
Bjoern A. Zeeb [Fri, 8 Nov 2019 14:36:44 +0000 (14:36 +0000)]
frag6: properly handle atomic fragments according to RFCs.

RFC 8200 says:
"If the fragment is a whole datagram (that is, both the Fragment
         Offset field and the M flag are zero), then it does not need
         any further reassembly and should be processed as a fully
         reassembled packet (i.e., updating Next Header, adjust Payload
         Length, removing the Fragment header, etc.).  .."

That means we should remove the fragment header and make all the adjustments
rather than just skipping over the fragment header.  The difference should
be noticeable in that a properly handled atomic fragment triggering an ICMPv6
message at an upper layer (e.g. dest unreach, unreachable port) will not
include the fragment header.

Update the test cases to also test for an unfragmentable part.  That is
needed so that the next header is properly updated (not just lengths).

MFC after: 3 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D22155

4 years agocsu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs
Kyle Evans [Fri, 8 Nov 2019 14:28:39 +0000 (14:28 +0000)]
csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs

.jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs, as
we're still getting .jcr sections added -- presumably due to the reference
in crtbegin. Without this terminal, the .jcr section (without data) overlaps
with the next section and register_classes in crtbegin will be examining the
wrong item.

PR: 241439
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D22132

4 years agoadd reference to PR for sparc64 BSD_CRTBEGIN in BROKEN_OPTIONS
Ed Maste [Fri, 8 Nov 2019 14:25:26 +0000 (14:25 +0000)]
add reference to PR for sparc64 BSD_CRTBEGIN in BROKEN_OPTIONS

We will soon remove the BSD_CRTBEGIN option (and will use the new CRT
files always) as part of the GCC 4.2.1 removal.  Right now BSD_CRTBEGIN
works everywhere but sparc64; add a reference to the PR in case anyone
stumbles across this and is looking for more information.

4 years agoarm linuxulator: reformat syscalls.master per current style
Ed Maste [Fri, 8 Nov 2019 14:18:16 +0000 (14:18 +0000)]
arm linuxulator: reformat syscalls.master per current style

Equivalent to r339958 for sys/kern/syscalls.master.

Also add a dummy name for an UNUSED.

Sponsored by: The FreeBSD Foundation

4 years agoarm linuxulator: add syscalls definition
Ed Maste [Fri, 8 Nov 2019 14:17:25 +0000 (14:17 +0000)]
arm linuxulator: add syscalls definition

From Linux arch/arm/kernel/call.S

Reviewed by: imp (earlier)
Submitted by: Grégory Soutadé <soutade_gmail.com>
Differential Revision: https://reviews.freebsd.org/D7972

4 years agomakefs: avoid warning when creating FAT filesystem on existing file
Ed Maste [Fri, 8 Nov 2019 14:11:25 +0000 (14:11 +0000)]
makefs: avoid warning when creating FAT filesystem on existing file

Previously the mkfs_msdos function (from newfs_msdos) emitted warnings
in the case that an image size is specified and the target is not a
file, or no size is specified and the target is not a character device.
The latter warning (not a character device) doesn't make sense when this
code is used in makefs, regardless of whether an image size is specified
or not.

Sponsored by: The FreeBSD Foundation

4 years agosuggest xtoolchain package if binutils and GCC bootstraps are both broken
Ed Maste [Fri, 8 Nov 2019 14:06:48 +0000 (14:06 +0000)]
suggest xtoolchain package if binutils and GCC bootstraps are both broken

Previously we checked for only BINUTILS_BOOTSTRAP as a broken option
and suggested installing the binutils package.  This was originally done
for arm64 where we used the in-tree Clang with external binutils package.

Add a case to the warning to suggest instead the full xtoolchain package
if we have no in-tree compiler either.

Differential Revision: https://reviews.freebsd.org/D21851

4 years agocstyle cleanup for i386_copy.c
Toomas Soome [Fri, 8 Nov 2019 12:19:03 +0000 (12:19 +0000)]
cstyle cleanup for i386_copy.c

No functional changes are intended.

4 years agoHumanize more columns in the vmstat(8) output and adjust widths.
Edward Tomasz Napierala [Fri, 8 Nov 2019 11:09:50 +0000 (11:09 +0000)]
Humanize more columns in the vmstat(8) output and adjust widths.
The few columns that are not humanized are usually 0.  This makes
the output mostly aligned.

Reviewed by: allanjude
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22185

4 years agoFix the man page to correctly describe the use of the "len" argument.
Rick Macklem [Fri, 8 Nov 2019 06:40:17 +0000 (06:40 +0000)]
Fix the man page to correctly describe the use of the "len" argument.

The man page incorrectly described the use of the"len" argument, which
is updated to the number of bytes copied and not reduced by the number
of bytes copied.

This is a content change.

4 years agopowerpc/booke: Only handle kernel page faults in KVA range
Justin Hibbits [Fri, 8 Nov 2019 04:26:19 +0000 (04:26 +0000)]
powerpc/booke:  Only handle kernel page faults in KVA range

The memory range between VM_MAXUSER_ADDRESS and VM_MIN_KERNEL_ADDRESS is
reserved for devices currently, which are always mapped in TLB1, and
therefore do not exist in the kernel page table.  Any page fault in this
range is therefore automatically a fatal fault.

4 years agopowerpc/booke: Make the TLB save area and mask match
Justin Hibbits [Fri, 8 Nov 2019 03:45:13 +0000 (03:45 +0000)]
powerpc/booke: Make the TLB save area and mask match

Since TLB_MAXNEST is 3, the insert mask should only be 2 bits.  Given that 2
bits counts to 4, and that we already have plenty of space wasted in
padding, make the nest level 4 to match the mask.

4 years agopowerpc/mpc85xx: Add MSI support for Freescale PowerPC SoCs
Justin Hibbits [Fri, 8 Nov 2019 03:36:19 +0000 (03:36 +0000)]
powerpc/mpc85xx: Add MSI support for Freescale PowerPC SoCs

Freescale SoCs use a set of IRQs at the high end of the OpenPIC IRQ
list, not counted in the NIRQs of the Feature reporting register.  Some
SoCs include a MSI inbound window in the PCIe controller configuration
registers as well, but some don't.  Currently, this only handles the
SoCs *with* the MSI window.

There are 256 MSIs per MSI bank (32 per MSI IRQ, 8 IRQs per MSI bank).
The P5020 has 3 banks, yielding up to 768 MSIs; older SoCs have only one
bank.

4 years agobcm2835_dma: Mark IRQs shareable
Kyle Evans [Fri, 8 Nov 2019 03:27:56 +0000 (03:27 +0000)]
bcm2835_dma: Mark IRQs shareable

On the RPi4, some of these IRQs are shared. Start moving toward a mode where
we accept that shared IRQs happen and simply ignore interrupts that are
seemingly for no reason.

I would like to be more verbose here, but my 30-minute assessment of the
current world order is that mapping a resource/rid to an actual IRQ number
(as found in FDT) data is not a simple matter. Determining if more than one
handler is attached to an IRQ is closer to feasible, but it's unclear which
way is the cleaner path. Beyond that, we're only really using it to be
slightly more verbose when something's going wrong, so for now just suppress
and drop a complaint-comment.

This was originally submitted (via freebsd-arm@) by Robert Crowston; the
additional verbosity was dropped by kevans@.

Submitted by: Robert Crowston <crowston@protonmail.com>

4 years agoTurn the error about a lack of LIBCOMPAT into a warning.
Brooks Davis [Fri, 8 Nov 2019 03:14:06 +0000 (03:14 +0000)]
Turn the error about a lack of LIBCOMPAT into a warning.

Add some diagnostic output.

This works around the fact that buildworld calls cleandir in libexec
with the wrong MACHINE_ARCH (i386 on amd64) when the OBJ directory is empty.

Reported by: bdragon, jkim

4 years agocxgbe(4): Query Vdd from the firmware if its last known value is 0.
Navdeep Parhar [Fri, 8 Nov 2019 01:13:12 +0000 (01:13 +0000)]
cxgbe(4): Query Vdd from the firmware if its last known value is 0.

TVSENSE may not be ready by the time t4_fw_initialize returns and the
firmware returns 0 if the driver asks for the Vdd before the sensor is
ready.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agoDocument iwm(4) support for 9000-series devices.
Mark Johnston [Fri, 8 Nov 2019 00:01:37 +0000 (00:01 +0000)]
Document iwm(4) support for 9000-series devices.

Sponsored by: The FreeBSD Foundation

4 years agoGet the fix in back by reverting the part accidentally included in r354491.
Li-Wen Hsu [Thu, 7 Nov 2019 23:57:48 +0000 (23:57 +0000)]
Get the fix in back by reverting the part accidentally included in r354491.

This brings back r354467.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoRevert r354518 and commit the intented fix rather than the diagnostic
Brooks Davis [Thu, 7 Nov 2019 23:54:40 +0000 (23:54 +0000)]
Revert r354518 and commit the intented fix rather than the diagnostic
check.

This fixes the definition of MK_LIB32 in Makefile.inc1.

4 years agoFix the ARCH check for LIB32 from Makefile.inc1.
Brooks Davis [Thu, 7 Nov 2019 23:50:33 +0000 (23:50 +0000)]
Fix the ARCH check for LIB32 from Makefile.inc1.

4 years agoUpdate iwm and iwmfw man pages with info about 9000-series chips.
Mark Johnston [Thu, 7 Nov 2019 23:39:33 +0000 (23:39 +0000)]
Update iwm and iwmfw man pages with info about 9000-series chips.

Thanks to bapt, bz, cem, woodsb02, Neel Chauhan and Salvador Martínez
Mármol for helping test the initial 9000-series support.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Sync device initialization and reset code with iwlwifi.
Mark Johnston [Thu, 7 Nov 2019 23:39:17 +0000 (23:39 +0000)]
iwm: Sync device initialization and reset code with iwlwifi.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Implement support for scans with "adaptive" dwell time.
Mark Johnston [Thu, 7 Nov 2019 23:39:04 +0000 (23:39 +0000)]
iwm: Implement support for scans with "adaptive" dwell time.

This is required by 9000-series firmware.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Use the default station for all transmits.
Mark Johnston [Thu, 7 Nov 2019 23:38:49 +0000 (23:38 +0000)]
iwm: Use the default station for all transmits.

This is what iwlwifi seems to do, and the previous behaviour triggered
firmware panics during transmit on a 9560.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Set flag for pad bytes in offload_assist.
Mark Johnston [Thu, 7 Nov 2019 23:38:36 +0000 (23:38 +0000)]
iwm: Set flag for pad bytes in offload_assist.

Though we don't otherwise use firmware's offload capabilities, we need
to set this flag when the MAC header's size isn't a multiple of four.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Use antenna B for TX on 9000-series chips.
Mark Johnston [Thu, 7 Nov 2019 23:38:17 +0000 (23:38 +0000)]
iwm: Use antenna B for TX on 9000-series chips.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Update the station add command for the new RX API.
Mark Johnston [Thu, 7 Nov 2019 23:37:55 +0000 (23:37 +0000)]
iwm: Update the station add command for the new RX API.

The firmware expects a new version of the add-station command in
9000-series chips.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi.
Mark Johnston [Thu, 7 Nov 2019 23:37:30 +0000 (23:37 +0000)]
iwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi.

Do not configure bluetooth on newer chips, it causes firmware panics.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Fix scheduler configuration for aux and cmd queue configuration.
Mark Johnston [Thu, 7 Nov 2019 23:37:17 +0000 (23:37 +0000)]
iwm: Fix scheduler configuration for aux and cmd queue configuration.

- Configure the scheduler only for the management queue.
- Fix a bug when enabling the schduler: the queues are specified using a
  bitmask.
- Fix style in the area.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Implement the new receive path.
Mark Johnston [Thu, 7 Nov 2019 23:37:02 +0000 (23:37 +0000)]
iwm: Implement the new receive path.

This is the multiqueue receive code required for 9000-series chips.
Note that we still only configure a single RX queue for now.  Multiqueue
support will require MSI-X configuration and a scheme for managing a
global pool of RX buffers.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Enable all 31 tx queues.
Mark Johnston [Thu, 7 Nov 2019 23:36:46 +0000 (23:36 +0000)]
iwm: Enable all 31 tx queues.

For now iwm only ever uses queue 0 and the management queue, but my 9560
raises a software error interrupt during initialization if this flag is
not set.  iwlwifi sets it for all 7000- and 8000-series hardware, so we
might as well do it unconditionally.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Explicitly enable MSI on newer chipsets.
Mark Johnston [Thu, 7 Nov 2019 23:36:25 +0000 (23:36 +0000)]
iwm: Explicitly enable MSI on newer chipsets.

9000-series chips implement support for MSI-X interrupts and disable MSI
by default.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Define the mqrx_supported capability.
Mark Johnston [Thu, 7 Nov 2019 23:36:10 +0000 (23:36 +0000)]
iwm: Define the mqrx_supported capability.

The firmware for 9000-series and newer devices has a different receive
API which supports multiple queues.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Add device configuration definitions for 9000-series chips.
Mark Johnston [Thu, 7 Nov 2019 23:35:54 +0000 (23:35 +0000)]
iwm: Add device configuration definitions for 9000-series chips.

Match such chips using the device ID.  We should really be checking the
subdevice as well, since a smaller number of 9460 and 9560 devices
actually belong to a new series of devices and require different
firmware, but that will require some extra logic in iwm_attach().

Submitted by: lwhsu, Guo Wen Jun <blockk2000@gmail.com>
MFC after: 2 weeks

4 years agoiwm: Sync the firmware tx_cmd descriptor fields with iwlwifi.
Mark Johnston [Thu, 7 Nov 2019 23:35:29 +0000 (23:35 +0000)]
iwm: Sync the firmware tx_cmd descriptor fields with iwlwifi.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Use the same delays as iwlwifi when resetting the device.
Mark Johnston [Thu, 7 Nov 2019 23:35:15 +0000 (23:35 +0000)]
iwm: Use the same delays as iwlwifi when resetting the device.

This is required for initialization to succeed for newer device
families.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Add a device family definition for 9000 chips.
Mark Johnston [Thu, 7 Nov 2019 23:35:01 +0000 (23:35 +0000)]
iwm: Add a device family definition for 9000 chips.

Convert existing device family checks to avoid assuming that the device
family is always one of IWM_DEVICE_FAMILY_7000 or _8000.

Submitted by: lwhsu, Guo Wen Jun <blockk2000@gmail.com>
MFC after: 2 weeks

4 years agoiwm: Add 9000-series RX register definitions.
Mark Johnston [Thu, 7 Nov 2019 23:34:41 +0000 (23:34 +0000)]
iwm: Add 9000-series RX register definitions.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Add a few _prph functions needed for 9000-series chips.
Mark Johnston [Thu, 7 Nov 2019 23:34:28 +0000 (23:34 +0000)]
iwm: Add a few _prph functions needed for 9000-series chips.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Sync the TLV API enum with iwlwifi.
Mark Johnston [Thu, 7 Nov 2019 23:34:12 +0000 (23:34 +0000)]
iwm: Sync the TLV API enum with iwlwifi.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Define a name for TLV 48.
Mark Johnston [Thu, 7 Nov 2019 23:33:58 +0000 (23:33 +0000)]
iwm: Define a name for TLV 48.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Avoid calling iwm_start() each time a descriptor is reclaimed.
Mark Johnston [Thu, 7 Nov 2019 23:29:57 +0000 (23:29 +0000)]
iwm: Avoid calling iwm_start() each time a descriptor is reclaimed.

Only perform the call when a qfull bit transitions.  While here, avoid
assignments in declarations in iwm_mvm_rx_tx_cmd().

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Call iwm_dev_check() earlier in iwm_attach().
Mark Johnston [Thu, 7 Nov 2019 23:29:43 +0000 (23:29 +0000)]
iwm: Call iwm_dev_check() earlier in iwm_attach().

This ensures that the driver softc reflects device capabilities as early
as possible, for use by device initialization code that is conditional
on certain capabilities.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Simplify fw_has_{api,capa}().
Mark Johnston [Thu, 7 Nov 2019 23:29:25 +0000 (23:29 +0000)]
iwm: Simplify fw_has_{api,capa}().

No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Remove a couple of unused fields from the softc.
Mark Johnston [Thu, 7 Nov 2019 23:29:00 +0000 (23:29 +0000)]
iwm: Remove a couple of unused fields from the softc.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoiwm: Fix style in the TX path.
Mark Johnston [Thu, 7 Nov 2019 23:27:54 +0000 (23:27 +0000)]
iwm: Fix style in the TX path.

Also ensure that the htole* macros are applied correctly when specifying
the segment length and upper address bits.  No functional change
intended (unless you use iwm(4) on a big-endian machine).

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agolibcompat: build 32-bit rtld and ldd as part of "everything"
Brooks Davis [Thu, 7 Nov 2019 22:58:10 +0000 (22:58 +0000)]
libcompat: build 32-bit rtld and ldd as part of "everything"

Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

Changes relative to r354449:

Correct detection of the compiler type when bsd.compat.mk is used
outside Makefile.libcompat.  Previously it always matched the clang
case.

Set LDFLAGS including the linker emulation for mips where -m32 seems to
be insufficent.

Reviewed by: imp, kib (origional version in r354449)
Obtained from: CheriBSD (conceptually)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22251

4 years agoRemove now unused INP_INFO_RLOCK macros.
Gleb Smirnoff [Thu, 7 Nov 2019 22:26:54 +0000 (22:26 +0000)]
Remove now unused INP_INFO_RLOCK macros.

4 years agorevert r354482, checking for XENHVM was a wrong way of checking for Xen
Andriy Gapon [Thu, 7 Nov 2019 21:43:31 +0000 (21:43 +0000)]
revert r354482, checking for XENHVM was a wrong way of checking for Xen

4 years agobcm_lintc: don't attach if "interrupt-controller" is missing
Kyle Evans [Thu, 7 Nov 2019 21:31:15 +0000 (21:31 +0000)]
bcm_lintc: don't attach if "interrupt-controller" is missing

This is a standard required property for interrupt controllers, and present
on the bcm_lintc nodes for currently supported RPi models. For the RPi4, we
have both bcm_lintc as well as GIC-400, but only one may be active at a
time.

Don't probe bcm_lintc if it's missing the "interrupt-controller" property --
in RPi 4 DTS, the bcm_lintc node is actually missing this along with other
required interrupt properties. Presumably, if the earlier boot stages will
support switching to the legacy interrupt controller (as is suggested
possible by the documentation), the DTS will need to be updated to indicate
the proper interrupt-parent and hopefully also mark this node as an
interrupt-controller instead.

4 years agoIn TCP HPTS enter the epoch in tcp_hpts_thread() and assert it in
Gleb Smirnoff [Thu, 7 Nov 2019 21:30:27 +0000 (21:30 +0000)]
In TCP HPTS enter the epoch in tcp_hpts_thread() and assert it in
the leaf functions.

4 years agoMechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP
Gleb Smirnoff [Thu, 7 Nov 2019 21:29:38 +0000 (21:29 +0000)]
Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP
timewait manipulation leaf functions.

4 years agoSince pfslowtimo() runs in the network epoch, tcp_slowtimo()
Gleb Smirnoff [Thu, 7 Nov 2019 21:28:46 +0000 (21:28 +0000)]
Since pfslowtimo() runs in the network epoch, tcp_slowtimo()
also does.  This allows to simplify tcp_tw_2msl_scan() and
always require the network epoch in it.