]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoFollowing r331292, many of the files (such as the LICENSE file)
gjb [Tue, 10 Apr 2018 17:40:44 +0000 (17:40 +0000)]
Following r331292, many of the files (such as the LICENSE file)
have moved from the u-boot-rpi3 share directory to the default
rpi-firmware share directory.  Remove the files from UBOOT_FILES
and append the DTB file to a DTB_FILES list so the correct path
is used, fixing a build failure.

Sponsored by: The FreeBSD Foundation

6 years agoCall through powerpc_interrupt for all Book-E interrupts
jhibbits [Tue, 10 Apr 2018 17:32:27 +0000 (17:32 +0000)]
Call through powerpc_interrupt for all Book-E interrupts

Make int_external_input, int_decrementer, and int_performance_counter all
now use trap_common, just like on AIM.  The effects of this are:

* All traps are now properly displayed in ddb.  Previously traps from
  external input, decrementer, and performance counters, would display as
  just basic stack traces.  Now the frame is displayed.

* External interrupts are now handled with interrupts enabled, so handling
  can be preempted.  This seems to fix a hang found post-r329882.

6 years agoAdd missing header change from r332381.
jtl [Tue, 10 Apr 2018 17:00:37 +0000 (17:00 +0000)]
Add missing header change from r332381.

Sponsored by: Netflix, Inc.
Pointy hat: jtl

6 years agoModify the net.inet.tcp.function_ids sysctl introduced in r331347.
jtl [Tue, 10 Apr 2018 16:59:36 +0000 (16:59 +0000)]
Modify the net.inet.tcp.function_ids sysctl introduced in r331347.
Export additional information which may be helpful to userspace
consumers and rename the sysctl to net.inet.tcp.function_info.

Sponsored by: Netflix, Inc.

6 years agoMove the TCP Blackbox Recorder probe in tcp_output.c to be with the
jtl [Tue, 10 Apr 2018 15:54:29 +0000 (15:54 +0000)]
Move the TCP Blackbox Recorder probe in tcp_output.c to be with the
other tracing/debugging code.

Sponsored by: Netflix, Inc.

6 years agoClean up some debugging code left in tcp_log_buf.c from r331347.
jtl [Tue, 10 Apr 2018 15:51:37 +0000 (15:51 +0000)]
Clean up some debugging code left in tcp_log_buf.c from r331347.

Sponsored by: Netflix, Inc.

6 years agohead(1): Provide long options
kevans [Tue, 10 Apr 2018 14:44:07 +0000 (14:44 +0000)]
head(1): Provide long options

Provide long options --bytes and --lines to match -c and -n respectively.
This improves head(1)'s compatibility with its GNU counterpart in a sensible
way.

Reviewed by: eadler (previous version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D14139

6 years agotail(1): Address mandoc concern (space before punctuation after macro)
kevans [Tue, 10 Apr 2018 14:42:24 +0000 (14:42 +0000)]
tail(1): Address mandoc concern (space before punctuation after macro)

X-MFC-With: r332372

6 years agotail(1): Add some long options
kevans [Tue, 10 Apr 2018 14:27:27 +0000 (14:27 +0000)]
tail(1): Add some long options

Add --blocks, --bytes, and --lines long options for -b, -c, and -n
respectively. This improves tail(1)'s compatibility with its GNU counterpart
in a straightforward way.

Reviewed by: eadler (earlier version)
MFC after: 3 days

6 years agoCorrect a comment.
markj [Tue, 10 Apr 2018 14:07:02 +0000 (14:07 +0000)]
Correct a comment.

Submitted by: Domagoj Stolfa
X-MFC with: r332364
Sponsored by: DARPA, AFRL

6 years agoSet zfs_arc_free_target to v_free_target.
markj [Tue, 10 Apr 2018 13:56:06 +0000 (13:56 +0000)]
Set zfs_arc_free_target to v_free_target.

Page daemon output is now regulated by a PID controller with a setpoint
of v_free_target. Moreover, the page daemon now wakes up regularly
rather than waiting for a wakeup from another thread. This means that
the free page count is unlikely to drop below the old
zfs_arc_free_target value, and as a result the ARC was not readily
freeing pages under memory pressure. Address the immediate problem by
updating zfs_arc_free_target to match the page daemon's new behaviour.

Reported and tested by: truckman
Discussed with: jeff
X-MFC with: r329882
Differential Revision: https://reviews.freebsd.org/D14994

6 years agoAssert that dtrace_probe() doesn't re-enter itself.
markj [Tue, 10 Apr 2018 13:47:09 +0000 (13:47 +0000)]
Assert that dtrace_probe() doesn't re-enter itself.

This helps catch cases where an instrumented function is called while
in probe context.

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 2 weeks
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D14863

6 years agoRemove deprecated DT sources of Armada 38x SoCs
mw [Tue, 10 Apr 2018 13:25:42 +0000 (13:25 +0000)]
Remove deprecated DT sources of Armada 38x SoCs

Now, as all platform code and drivers support Linux
DT binding, safely remove deprecated sources and rely
on sys/gnu/dts from now on.

Obtained from: Semihalf
Sponsored by: Stormshield

6 years agoIntroduce dry run option for attaching the device.
oshogbo [Tue, 10 Apr 2018 13:22:48 +0000 (13:22 +0000)]
Introduce dry run option for attaching the device.
This will allow us to verify if passphrase and key is valid without
decrypting whole device.

Reviewed by: cem@, allanjude@
Differential Revision: https://reviews.freebsd.org/D15000

6 years agoEnable Qualcomm Debug Subsystem (QDSS) block on MSM8916 SoC.
br [Tue, 10 Apr 2018 12:53:48 +0000 (12:53 +0000)]
Enable Qualcomm Debug Subsystem (QDSS) block on MSM8916 SoC.

This is required for ARM Coresight operation on Dragonboard 410c.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14987

6 years agopf tests: Do not build or install if pf is not enabled
kp [Tue, 10 Apr 2018 12:45:34 +0000 (12:45 +0000)]
pf tests: Do not build or install if pf is not enabled

Do not build or install pf tests if WITHOUT_PF is set. This fixes the build
failure with WITHOUT_PF=yes.

Reported by: Vladimir Zakharov <zakharov.vv@gmail.com>

6 years agoImprove detection of addressing mode in e6000sw
mw [Tue, 10 Apr 2018 08:35:43 +0000 (08:35 +0000)]
Improve detection of addressing mode in e6000sw

Some devices cannot rely on the switch MDIO address passed in the DTB
for specifying single/multi-chip addressing mode. Introduce new property
"single-chip-addressing" which added to DTS will force single-chip mode.

Submitted by: Michal Mazur <mkm@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14800

6 years agoDon't show the number of currently established SCTP associations,
tuexen [Tue, 10 Apr 2018 08:19:14 +0000 (08:19 +0000)]
Don't show the number of currently established SCTP associations,
since this is not monotonically increasing. It's number can be
derived from the other counters shown.

MFC after: 3 days

6 years agoStrip trailing whitespace.
trasz [Tue, 10 Apr 2018 08:14:31 +0000 (08:14 +0000)]
Strip trailing whitespace.

MFC after: 2 weeks

6 years agoStrip trailing whitespace.
trasz [Tue, 10 Apr 2018 08:13:59 +0000 (08:13 +0000)]
Strip trailing whitespace.

MFC after: 2 weeks

6 years agoMake development(7) mention tests and section 9 of manual pages.
trasz [Tue, 10 Apr 2018 08:01:55 +0000 (08:01 +0000)]
Make development(7) mention tests and section 9 of manual pages.

MFC after: 2 weeks

6 years agoFix the position of $bootable so that -o platformid=efi applies correctly.
benno [Tue, 10 Apr 2018 02:49:53 +0000 (02:49 +0000)]
Fix the position of $bootable so that -o platformid=efi applies correctly.

Sponsored by: iXsystems, Inc.
Pointy hat to: benno (again)

6 years agoFix makefs invocation after r331843.
benno [Tue, 10 Apr 2018 02:43:07 +0000 (02:43 +0000)]
Fix makefs invocation after r331843.

Reported by: gjb
Reviewed by: gjb
Sponsored by: iXsystems, Inc.
Pointy hat to: benno

6 years agoEnable cesa driver to work with Linux DT binding
mw [Mon, 9 Apr 2018 23:36:52 +0000 (23:36 +0000)]
Enable cesa driver to work with Linux DT binding

Linux device tree binding, whose usage is obligatory,
comprises faulty representation of Marvell cryptographic
engine (CESA) - two engines are artificially gathered into
single DT node, in order to avoid certain SW limitation.

This patch improves the cesa driver to support above binding,
depending on compatible string, which helps to ensure
backward compatibility.

Submitted by: Patryk Duda
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14760

6 years agoRefactor PCIOCGETCONF for improved readability.
brooks [Mon, 9 Apr 2018 22:59:10 +0000 (22:59 +0000)]
Refactor PCIOCGETCONF for improved readability.

The code now has a single, consistant flow for all three ioctl
variants. ifdefs and for pre-FreeBSD-7 compatability are moved to
functions and macros. So the flow is alwasy the same, we impose
the cost of allocating, copying to, updating from, and freeing a
copy of struct pci_conf_io on all paths.

This change will allow PCIOCGETCONF32 support currently in
sys/compat/freebsd32/freebsd32_ioctl.c to be moved here.

Reviewed by: kib, jhb
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14978

6 years ago[man] Add documentation for OpenFirmware API
gonzo [Mon, 9 Apr 2018 22:23:45 +0000 (22:23 +0000)]
[man] Add documentation for OpenFirmware API

Add man pages for following OpenFirmware functions:

OF_child, OF_parent, OF_peer, OF_device_from_xref,
OF_device_register_xref, OF_xref_from_device, OF_getprop,
OF_getencprop, OF_getencprop_alloc, OF_getprop_alloc, OF_getproplen,
OF_hasprop, OF_nextprop, OF_prop_free, OF_searchencprop,
OF_searchprop, OF_setprop

Edited by: wblock
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D14511

6 years agoAlign OF_getencprop_alloc API with OF_getencprop and OF_getprop_alloc
gonzo [Mon, 9 Apr 2018 22:06:16 +0000 (22:06 +0000)]
Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_alloc

Change OF_getencprop_alloc semantics to be combination of malloc and
OF_getencprop and return size of the property, not number of elements
allocated.

For the use cases where number of elements is preferred introduce
OF_getencprop_alloc_multi helper function that copies semantics
of OF_getencprop_alloc prior to this change.

This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi
function signatures consistent with OF_getencprop_alloc and
OF_getencprop_alloc_multi.

Functionality-wise this patch is mostly rename of OF_getencprop_alloc
to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo
where 1 was used as a block size.

6 years agolinuxulator: add else case braces to reduce diffs between archs
emaste [Mon, 9 Apr 2018 19:11:24 +0000 (19:11 +0000)]
linuxulator: add else case braces to reduce diffs between archs

Sponsored by: Turing Robotic Industries Inc.

6 years agoRetire the geom_aes class
kevans [Mon, 9 Apr 2018 17:30:30 +0000 (17:30 +0000)]
Retire the geom_aes class

It's had a good life, but it's not really configurable and not really used.

Obtained from: opBSD (with some changes)
Differential Revision: https://reviews.freebsd.org/D14991

6 years agolinuxulator: deduplicate linux_exec_imgact_try
emaste [Mon, 9 Apr 2018 17:24:01 +0000 (17:24 +0000)]
linuxulator: deduplicate linux_exec_imgact_try

Previously linuxulator had three identical copies of
linux_exec_imgact_try.  Deduplicate before adding another arch to
linuxulator.

Sponsored by: Turing Robotic Industries Inc
Differential Revision: https://reviews.freebsd.org/D14856

6 years agoif_awg: Add support for allwinner,{tx,rx}-delay-ps bindings
kevans [Mon, 9 Apr 2018 14:05:43 +0000 (14:05 +0000)]
if_awg: Add support for allwinner,{tx,rx}-delay-ps bindings

Split out delay parsing into a separate function; we'll support both
{tx,rx}-delay as well as the new versions.

While here, validate that they're within the expected range and fail to
attach if they are not. Assuming that we can clamp the delay is a bad idea
that might result in a non-working awg anyways, so we'll fail early to make
it easier to catch.

This version also unsets the tx and rx delay registers unconditionally and
then sets them if we read a non-zero delay. These delay properties should
default to 0 if not specified, as declared in the binding documentation.
Presumably the delays will be set via hardware configuration if they're not
explicitly set in FDT.

6 years agocfumass(4) no longer requires iscsi(4).
trasz [Mon, 9 Apr 2018 13:32:12 +0000 (13:32 +0000)]
cfumass(4) no longer requires iscsi(4).

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agonetmap: align codebase to upstream version v11.4
vmaffione [Mon, 9 Apr 2018 09:24:26 +0000 (09:24 +0000)]
netmap: align codebase to upstream version v11.4

Changelist:
  - remove unused nkr_slot_flags
  - new nm_intr adapter callback to enable/disable interrupts
  - remove unused sysctls and document the other sysctls
  - new infrastructure to support NS_MOREFRAG for NIC ports
  - support for external memory allocator (for now linux-only),
    including linux-specific changes in common headers
  - optimizations within netmap pipes datapath
  - improvements on VALE control API
  - new nm_parse() helper function in netmap_user.h
  - various bug fixes and code clean up

Approved by: hrs (mentor)

6 years ago[man] Fix return type of BUS_ADD_CHILD(9)
gonzo [Mon, 9 Apr 2018 05:48:12 +0000 (05:48 +0000)]
[man] Fix return type of BUS_ADD_CHILD(9)

Fix return type of BUS_ADD_CHILD(9) in SYNOPSYS section,
it should be device_t, not int

PR: 207389
MFC after: 3 days

6 years agoMake OF_searchencprop signature consistent with OF_getencprop
gonzo [Mon, 9 Apr 2018 00:38:24 +0000 (00:38 +0000)]
Make OF_searchencprop signature consistent with OF_getencprop

Use pcell_t* as a destination buffer argument instead of void
pointer to be consistent with OF_getencprop signature.

6 years agoFix one more OF_getprop_alloc instance missed in r332310
gonzo [Sun, 8 Apr 2018 23:17:51 +0000 (23:17 +0000)]
Fix one more OF_getprop_alloc instance missed in r332310

X-MFC-With: r332310

6 years agoClean up OF_getprop_alloc API
gonzo [Sun, 8 Apr 2018 22:59:34 +0000 (22:59 +0000)]
Clean up OF_getprop_alloc API

OF_getprop_alloc takes element size argument and returns number of
elements in the property. There are valid use cases for such behavior
but mostly API consumers pass 1 as element size to get string
properties. What API users would expect from OF_getprop_alloc is to be
a combination of malloc + OF_getprop with the same semantic of return
value. This patch modifies API signature to match these expectations.

For the valid use cases with element size != 1 and to reduce
modification scope new OF_getprop_alloc_multi function has been
introduced that behaves the same way OF_getprop_alloc behaved prior to
this patch.

Reviewed by: ian, manu
Differential Revision: https://reviews.freebsd.org/D14850

6 years agoReplace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These
andrew [Sun, 8 Apr 2018 22:07:06 +0000 (22:07 +0000)]
Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These
are almost identical so there is no need to keep the former around.

Sponsored by: DARPA, AFRL

6 years agoDocument ofw_bus_subr helpers "compatible" and "status" properties
gonzo [Sun, 8 Apr 2018 20:53:00 +0000 (20:53 +0000)]
Document ofw_bus_subr helpers "compatible" and "status" properties

Add documentation for following functions:

- ofw_bus_is_compatible
- ofw_bus_is_compatible_strict
- ofw_bus_node_is_compatible
- ofw_bus_search_compatible
- ofw_bus_get_status
- ofw_bus_status_okay
- ofw_bus_node_status_okay

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14724

6 years agoFix typo
jhibbits [Sun, 8 Apr 2018 19:33:05 +0000 (19:33 +0000)]
Fix typo

Reserved cause is 6, not 5.

Reported by: cem

6 years agoAdd the ability to control the CPU topology of created VMs
rgrimes [Sun, 8 Apr 2018 19:24:49 +0000 (19:24 +0000)]
Add the ability to control the CPU topology of created VMs
from userland without the need to use sysctls, it allows the old
sysctls to continue to function, but deprecates them at
FreeBSD_version 1200060 (Relnotes for deprecate).

The command line of bhyve is maintained in a backwards compatible way.
The API of libvmmapi is maintained in a backwards compatible way.
The sysctl's are maintained in a backwards compatible way.

Added command option looks like:
bhyve -c [[cpus=]n][,sockets=n][,cores=n][,threads=n][,maxcpus=n]
The optional parts can be specified in any order, but only a single
integer invokes the backwards compatible parse.  [,maxcpus=n] is
hidden by #ifdef until kernel support is added, though the api
is put in place.

bhyvectl --get-cpu-topology option added.

Reviewed by: grehan (maintainer, earlier version),
Reviewed by: bcr (manpages)
Approved by: bde (mentor), phk (mentor)
Tested by: Oleg Ginzburg <olevole@olevole.ru> (cbsd)
MFC after: 1 week
Relnotes: Y
Differential Revision: https://reviews.freebsd.org/D9930

6 years agoPedantic polishing of code to please FlexeLint.
phk [Sun, 8 Apr 2018 19:23:50 +0000 (19:23 +0000)]
Pedantic polishing of code to please FlexeLint.

Approved by: ed

6 years agoPowerpc64: Add the facility unavailable trap subsystem
jhibbits [Sun, 8 Apr 2018 19:11:25 +0000 (19:11 +0000)]
Powerpc64: Add the facility unavailable trap subsystem

Summary:
This code adds the basic infrastructure for the facility subsystem. A facility
trap is raised when an unavailable instruction is executed. One example is
executing a Hardware Transactional Memory instruction while the MSR[TM] is
disabled. In the past, there was a specific interrupt for it (FP, VEC), but the
new instructions seem to be multiplexed on this facility interrupt.

The root cause of the trap is provided on Facility Status and Control Register
(FSCR) register.

Submitted by: Breno Leitao
Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D14566

6 years agoFix LINT (and static COMPAT_LINUX32) after r332122.
brooks [Sun, 8 Apr 2018 17:10:32 +0000 (17:10 +0000)]
Fix LINT (and static COMPAT_LINUX32) after r332122.

6 years agoAllow hinted attachment on FDT-based systems. Instead of returning ENXIO
ian [Sun, 8 Apr 2018 17:06:30 +0000 (17:06 +0000)]
Allow hinted attachment on FDT-based systems.  Instead of returning ENXIO
when the FDT data doesn't enable the device instance, return
BUS_PROBE_NOWILDCARD, the same as for non-FDT systems.

6 years agopowerpc64: Print current MSR on printtrap()
jhibbits [Sun, 8 Apr 2018 16:55:28 +0000 (16:55 +0000)]
powerpc64: Print current MSR on printtrap()

Summary:
Print current MSR on printtrap(). Currently, printtrap just prints srr1, which
contains part of the MSR prior to the exception. I find useful to dump the
current value of the MSR, since it changes when there is an interruption.

With this patch, this is the new printtrap model:

handled user trap:

    exception       = 0x700 (program)
    srr0            = 0x100008a0 (0x100008a0)
    srr1            = 0x800000000002f032
    current msr     = 0x8000000000009032
    lr              = 0x1000089c (0x1000089c)
    curthread       = 0x7a50000
pid = 714, comm = ttrap2

Submitted by: Breno Leitao
Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D14600

6 years agopowerpc64: Avoid calling isync twice
jhibbits [Sun, 8 Apr 2018 16:46:24 +0000 (16:46 +0000)]
powerpc64: Avoid calling isync twice

Summary:
It is not necessary to call isync() after calling mtmsr() function, mainly
because the mtmsr() calls 'isync' internally to synchronize the machine state
register. Other than that, isync() just calls the 'isync' instruction, thus,
the 'isync' instruction is being called twice, and that seems to be unnecessary.

This patch just remove the unecessary calls to isync() after mtmsr().

Submitted by: Breno Leitao
Differential Revision: https://reviews.freebsd.org/D14583

6 years agopowerpc/ofw: Fix malloc inside lock
jhibbits [Sun, 8 Apr 2018 16:43:56 +0000 (16:43 +0000)]
powerpc/ofw: Fix malloc inside lock

Summary:
Currently ofw_real_bounce_alloc() is requesting memory, using WAITOK, holding a
non-sleepable locks, called 'OF Bounce Page'.

Fix this by allocating the pages outside of the lock, and only updating the
global variables while holding the lock.

Submitted by: Breno Leitao
Differential Revision: https://reviews.freebsd.org/D14955

6 years agolocks: tweak backoff a little bit
mjg [Sun, 8 Apr 2018 16:34:10 +0000 (16:34 +0000)]
locks: tweak backoff a little bit

Previous limits were chosen when locking primitives had spurious lock
accesses.

Flipping the starting point to 1 (or rather 2 as the first call shifts it)
provides a modest win when mild contention is seen while not hurting worse
cases. Tested on a bunch of one, two and four socket old and new systems
(Westmere, Skylake, Threadreaper and others) by doing concurrent page faults,
buildkernel/buildworld and other stuff (although not all systems got all the
tests).

Another thing is the upper limit. It is semi-arbitrarily chosen as it was
getting out of hand for slightly less small systems (e.g. a 128-thread one).

Note that backoff is fundamentally a speculative bandaid and this change just
makes it fit a little bit better. It remains completely oblivious to the
hardware topology or the contention pattern. This is being experimented with.

6 years agoRevert r332277, it contained an unintended extra change
andrew [Sun, 8 Apr 2018 15:21:12 +0000 (15:21 +0000)]
Revert r332277, it contained an unintended extra change

6 years agoReplace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These
andrew [Sun, 8 Apr 2018 15:12:36 +0000 (15:12 +0000)]
Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These
are almost identical so there is no need to keep the former around.

Sponsored by: DARPA, AFRL

6 years agoloader: 332270 did left out stand/i386/loader/loader.rc
tsoome [Sun, 8 Apr 2018 13:40:38 +0000 (13:40 +0000)]
loader: 332270 did left out stand/i386/loader/loader.rc

we have 2 instances of loader.rc...

6 years agoMove fdt_is_type to be a Marvell specific function. It's not used by any
andrew [Sun, 8 Apr 2018 12:20:06 +0000 (12:20 +0000)]
Move fdt_is_type to be a Marvell specific function. It's not used by any
other SoCs.

Sponsored by: DARPA, AFRL

6 years agoFix a logical inversion bug.
tuexen [Sun, 8 Apr 2018 12:08:20 +0000 (12:08 +0000)]
Fix a logical inversion bug.

Thanks to Irene Ruengeler for finding and reporting this bug.

MFC after: 3 days

6 years agoloader: 332270 did use wrong path for efi.4th
tsoome [Sun, 8 Apr 2018 11:55:27 +0000 (11:55 +0000)]
loader: 332270 did use wrong path for efi.4th

The correct  path is still /boot/efi.4th

6 years agoSmall cleanup, no functional change.
tuexen [Sun, 8 Apr 2018 11:50:06 +0000 (11:50 +0000)]
Small cleanup, no functional change.

MFC after: 3 days

6 years agoloader: include efi.4th only if we do have uefi
tsoome [Sun, 8 Apr 2018 11:39:27 +0000 (11:39 +0000)]
loader: include efi.4th only if we do have uefi

Also simplify efi.4th.

6 years agoFix a signed/unsigned warning showing up for the userland stack
tuexen [Sun, 8 Apr 2018 11:37:00 +0000 (11:37 +0000)]
Fix a signed/unsigned warning showing up for the userland stack
on some platforms.
Thanks to Felix Weinrank for reporting the issue.

MFC after:i 3 days

6 years agoAdd (intmax_t) type casts to some printf parameters to keep i386 happy.
mckusick [Sun, 8 Apr 2018 07:18:29 +0000 (07:18 +0000)]
Add (intmax_t) type casts to some printf parameters to keep i386 happy.

6 years agoWhen using the fsdb `blocks' command, replace the long and ugly list of
mckusick [Sun, 8 Apr 2018 07:06:12 +0000 (07:06 +0000)]
When using the fsdb `blocks' command, replace the long and ugly list of
blocks with the much more concise and readable block list shown by the
prtblknos() function imported from tools/diag/prtblknos.

6 years agoThe ufs_disk_write() function is used to upgrade a read-only descriptor
mckusick [Sun, 8 Apr 2018 06:59:42 +0000 (06:59 +0000)]
The ufs_disk_write() function is used to upgrade a read-only descriptor
to a read-write descriptor. Do not close the read-only descriptor until
the read-write is successfully obtained. Before this fix, a failed upgrade
left no usable descriptor with which to work.

6 years agoSplit tools/diag/prtblknos into two parts:
mckusick [Sun, 8 Apr 2018 06:52:58 +0000 (06:52 +0000)]
Split tools/diag/prtblknos into two parts:
main.c - opens disk and processes the argument list
 of inodes to be printed
prtblknos.c - prints out the list of blocks used by an inode

This change allows the fsdb program to import prtblknos() to use when
printing out the set of blocks used by an inode.

This program was switched to using the libufs library to ease its
integration with fsdb and any other filesystem utility that might
want to use it in the future.

6 years agoDefensive programming when reading inodes in getino().
mckusick [Sun, 8 Apr 2018 05:15:34 +0000 (05:15 +0000)]
Defensive programming when reading inodes in getino().
Specifically check for out-of-range inodes, and whether
return-value pointers are NULL.

6 years agoUpdate VMCI license based on comments from core, the FreeBSD Foundation,
mp [Sun, 8 Apr 2018 01:32:56 +0000 (01:32 +0000)]
Update VMCI license based on comments from core, the FreeBSD Foundation,
and VMware legal:
- Add a dual BSD-2 Clause/GPLv2 LICENSE file in the VMCI directory
- Remove the use of "All Rights Reserved"
- Per best practice, remove copyright/license info from Makefile

Reviewed by: imp, emaste, jhb, Vishnu Dasa <vdasa@vmware.com>
Approved by: VMware legal via Mark Peek <markpeek@vmware.com>
Differential Revision:  https://reviews.freebsd.org/D14979

6 years ago[rpi] Add fdt_pinctrl(4) support to Raspberry Pi GPIO driver
gonzo [Sun, 8 Apr 2018 00:56:19 +0000 (00:56 +0000)]
[rpi] Add fdt_pinctrl(4) support to Raspberry Pi GPIO driver

On Raspberry Pi platform GPIO controller also responsible for pins
multiplexing. Pi code predates proper FDT support in FreeBSD so a
lot of pinmux info is hardcoded. This patch:

- Implements pinctl methods in bcm2835_gpio
- Converts all devices with ad-hoc pinmux info to proper pin control
  mechanisms and adds pinmux info in FreeBSD's custom dts files.
- Adds fdt_pinctrl option to RPI2 and RPI-B kernels
- Adds SPI pinmux config to FreeBSD's customization of GNU DTS.

Reviewed by: imp, manu
Differential Revision: https://reviews.freebsd.org/D14104

6 years agoAdd a manpage for spigen(4).
ian [Sat, 7 Apr 2018 23:31:55 +0000 (23:31 +0000)]
Add a manpage for spigen(4).

6 years agoAdd a83t overlays for sid and emac
kevans [Sat, 7 Apr 2018 22:28:43 +0000 (22:28 +0000)]
Add a83t overlays for sid and emac

The sun8i-a83t-bananapi-m3-emac overlay technically doesn't match what will
be coming from upstream. The tx-delay and rx-delay should be specified in
terms of allwinner,tx-delay-ps and allwinner,rx-delay-ps respectively. The
values are still technically correct for what we write in if_awg, and
support for the new bindings will be coming soon.

6 years agoCast the data pointer to the correct type for the data being accessed (as
ian [Sat, 7 Apr 2018 22:21:06 +0000 (22:21 +0000)]
Cast the data pointer to the correct type for the data being accessed (as
opposed to one that accidentally worked on the one arch I test-compiled for
on my first try).

Reported by: np@, O. Hartmann <ohartmann@walstatt.org>
Pointy hat: ian@

6 years agoDon't check for impossible NULL return from malloc(..., M_WAITOK).
ian [Sat, 7 Apr 2018 21:31:09 +0000 (21:31 +0000)]
Don't check for impossible NULL return from malloc(..., M_WAITOK).

6 years agoAdd the ioctl definitions for spigen get/set spi mode. Should have been
ian [Sat, 7 Apr 2018 20:53:34 +0000 (20:53 +0000)]
Add the ioctl definitions for spigen get/set spi mode.  Should have been
part of r332233.

6 years agoAdd an ioctl to get/set the SPI transfer mode. Also, make the bus clock
ian [Sat, 7 Apr 2018 20:38:01 +0000 (20:38 +0000)]
Add an ioctl to get/set the SPI transfer mode.  Also, make the bus clock
frequency ioctl actually set the corresponding ivar instead of just storing
the value locally in the softc (and then not using it for anything).  Also,
return the correct error code if the ioctl cmd is not recognized.

6 years agoGenerate a spibus_set_[ivarname]() convenience function for each ivar,
ian [Sat, 7 Apr 2018 20:34:57 +0000 (20:34 +0000)]
Generate a spibus_set_[ivarname]() convenience function for each ivar,
now that they can be set.

6 years agoRemove the existing identify() hack to force-add a spigen device on
ian [Sat, 7 Apr 2018 20:04:03 +0000 (20:04 +0000)]
Remove the existing identify() hack to force-add a spigen device on
FDT-based systems, and instead add proper FDT probe code.  Because this
driver is freebsd-specific and just provides generic userland access to run
spibus transactions, there is no bindings document to mandate a compatible
string, so just arbitrarily use "freebsd,spigen".

6 years agoAdd nvme_util.c to cam.ko.
imp [Sat, 7 Apr 2018 19:29:19 +0000 (19:29 +0000)]
Add nvme_util.c to cam.ko.

cam.ko can't load onto the kernel w/o nvme in the kernel. Add
nvme_util.c to cam.ko.

Noticed by: kib@

6 years agoArrange the list of generated sources as 1-per-line alphbetical, and add
ian [Sat, 7 Apr 2018 19:09:57 +0000 (19:09 +0000)]
Arrange the list of generated sources as 1-per-line alphbetical, and add
the files required when building for FDT-based systems.

6 years agoReturn BUS_PROBE_DEFAULT, not zero, because this is not the one driver
ian [Sat, 7 Apr 2018 18:58:58 +0000 (18:58 +0000)]
Return BUS_PROBE_DEFAULT, not zero, because this is not the one driver
implementation that must be used, it's just the base system default driver.

Also add a comment noting that we're being more liberal about the bus
frequency property than the dts binding documents require.

6 years agoA couple minor improvements to spibus.c...
ian [Sat, 7 Apr 2018 18:25:07 +0000 (18:25 +0000)]
A couple minor improvements to spibus.c...

 - Change the description string to "SPI bus" (was "spibus bus").

 - This is the default driver for a SPI bus, not a generic implementation,
   so return the probe value that indicates such.

 - Use device_delete_children() at detach time, instead of a local loop
   to enumerate the children and detach each one individually.

6 years agoAdd support for writing/changing spi device ivars. The SPI mode (polarity
ian [Sat, 7 Apr 2018 18:09:31 +0000 (18:09 +0000)]
Add support for writing/changing spi device ivars.  The SPI mode (polarity
and phase) and the maximum bus speed can be changed.  The chip select
number cannot be changed, because the device instances which are children
of spibus are inherently associated with the chip select number they were
instantiated for.

6 years agoHandle Skylake-X errata SKZ63.
kib [Sat, 7 Apr 2018 17:06:13 +0000 (17:06 +0000)]
Handle Skylake-X errata SKZ63.

SKZ63 Processor May Hang When Executing Code In an HLE Transaction
Region

Problem: Under certain conditions, if the processor acquires an HLE
(Hardware Lock Elision) lock via the XACQUIRE instruction in the Host
Physical Address range between 40000000H and 403FFFFFH, it may hang
with an internal timeout error (MCACOD 0400H) logged into
IA32_MCi_STATUS.

Move the pages from the range into the blacklist.  Add a tunable to
not waste 4M if local DoS is not the issue.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15001

6 years agoallwinner: a83t_r_ccu: Add proper IR clock support
manu [Sat, 7 Apr 2018 15:40:00 +0000 (15:40 +0000)]
allwinner: a83t_r_ccu: Add proper IR clock support

Now that NM clocks support prediv, add proper support for the IR clock found
on the A83T SoC.

Tested On:  BananaPi M3
Reported by: kevans

6 years agoallwinner: aw_clk_nm: Add prediv value
manu [Sat, 7 Apr 2018 15:38:42 +0000 (15:38 +0000)]
allwinner: aw_clk_nm: Add prediv value

Some NM clocks needs a fixed prediv value applied to the parent frequency
on some conditions. Add support for it.

6 years agolibsa: name is not used in dirmatch()
tsoome [Sat, 7 Apr 2018 14:42:47 +0000 (14:42 +0000)]
libsa: name is not used in dirmatch()

Seems like variable 'name' is leftover.

6 years agolibsa: cd9660: warning: 'lenskip' may be used uninitialized in this function
tsoome [Sat, 7 Apr 2018 14:40:09 +0000 (14:40 +0000)]
libsa: cd9660: warning: 'lenskip' may be used uninitialized in this function

We better provide value for lenskip in both instances.

6 years agoaxp81x: Do not fail if regulators aren't properly defined
manu [Sat, 7 Apr 2018 14:17:17 +0000 (14:17 +0000)]
axp81x: Do not fail if regulators aren't properly defined

If a regulator is missing a mandatory property (like 'regulator-name'), do
not fail, regulator_parse_ofw_stdparam is returning a non-zero value so just
skip this regulator.
Also if any regulator fails to attach continue with the rest of the regulators
instead of returning ENXIO in axp8xx_attach

Tested On: BananaPi M3

6 years agoFix enough warnings that we can build syslogd on all targets at WARNS=6.
ed [Sat, 7 Apr 2018 09:03:51 +0000 (09:03 +0000)]
Fix enough warnings that we can build syslogd on all targets at WARNS=6.

This also fixes the build on MIPS.

Reported by: cy (MIPS build failure)

6 years agoRemove the thread argument from ifr_buffer_*() accessors.
brooks [Fri, 6 Apr 2018 23:25:54 +0000 (23:25 +0000)]
Remove the thread argument from ifr_buffer_*() accessors.

They are always used in a context where curthread is the correct thread.
This makes them more similar to the ifr_data_get_ptr() accessor.

6 years agoAdd a way to temporarily suspend and resume virtual CPUs.
jhb [Fri, 6 Apr 2018 22:03:43 +0000 (22:03 +0000)]
Add a way to temporarily suspend and resume virtual CPUs.

This is used as part of implementing run control in bhyve's debug
server.  The hypervisor now maintains a set of "debugged" CPUs.
Attempting to run a debugged CPU will fail to execute any guest
instructions and will instead report a VM_EXITCODE_DEBUG exit to
the userland hypervisor.  Virtual CPUs are placed into the debugged
state via vm_suspend_cpu() (implemented via a new VM_SUSPEND_CPU ioctl).
Virtual CPUs can be resumed via vm_resume_cpu() (VM_RESUME_CPU ioctl).

The debug server suspends virtual CPUs when it wishes them to stop
executing in the guest (for example, when a debugger attaches to the
server).  The debug server can choose to resume only a subset of CPUs
(for example, when single stepping) or it can choose to resume all
CPUs.  The debug server must explicitly mark a CPU as resumed via
vm_resume_cpu() before the virtual CPU will successfully execute any
guest instructions.

Reviewed by: avg, grehan
Tested on: Intel (jhb), AMD (avg)
Differential Revision: https://reviews.freebsd.org/D14466

6 years agoifconf(): correct handling of sockaddrs smaller than struct sockaddr.
brooks [Fri, 6 Apr 2018 20:26:56 +0000 (20:26 +0000)]
ifconf(): correct handling of sockaddrs smaller than struct sockaddr.

Portable programs that use SIOCGIFCONF (e.g. traceroute) assume
that each pseudo ifreq is of length MAX(sizeof(struct ifreq),
sizeof(ifr_name) + ifr_addr.sa_len).  For short sockaddrs we copied
too much from the source sockaddr resulting in a heap leak.

I believe only one such sockaddr exists (struct sockaddr_sco which
is 8 bytes) and it is unclear if such sockaddrs end up on interfaces
in practice.  If it did, the result would be an 8 byte heap leak on
current architectures.

admbugs: 869
Reviewed by: kib
Obtained from: CheriBSD
MFC after: 3 days
Security: kernel heap leak
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14981

6 years agoRe-sort LOADER options
kevans [Fri, 6 Apr 2018 19:49:57 +0000 (19:49 +0000)]
Re-sort LOADER options

These have become unsorted from everything else. This is desync'd from
stable/11 due to some hand-merging that was done there, so the MFC of this
will look slightly different.

MFC after: 3 days

6 years agoDo not fail devices just for errors in descriptor format.
mav [Fri, 6 Apr 2018 19:47:44 +0000 (19:47 +0000)]
Do not fail devices just for errors in descriptor format.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

6 years agopf tests: Basic ioctl validation
kp [Fri, 6 Apr 2018 19:37:15 +0000 (19:37 +0000)]
pf tests: Basic ioctl validation

Basic validation tests for DIOCRADDADDRS, DIOCRDELADDRS, DIOCRSETADDRS,
DIOCRGETADDRS, DIOCRGETASTATS, DIOCRCLRASTATS, DIOCRTSTADDRS,
DIOCRINADEFINE, DIOCXBEGIN and DIOCXROLLBACK.

MFC after: 1 week

6 years agopf: Improve ioctl validation
kp [Fri, 6 Apr 2018 19:36:35 +0000 (19:36 +0000)]
pf: Improve ioctl validation

Ensure that multiplications for memory allocations cannot overflow, and
that we'll not try to allocate M_WAITOK for potentially overly large
allocations.

MFC after: 1 week

6 years agopf tests: Try to provoke a memory leak
kp [Fri, 6 Apr 2018 19:22:22 +0000 (19:22 +0000)]
pf tests: Try to provoke a memory leak

There was a memory leak in the DIOCRADDTABLES ioctl() code which could
be triggered by trying to add tables with the same name.
Try to provoke this memory leak. It was fixed in r331225.

MFC after: 1 week

6 years agopf tests: Basic ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT
kp [Fri, 6 Apr 2018 19:21:29 +0000 (19:21 +0000)]
pf tests: Basic ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT

Validate the DIOCIGETIFACES and DIOCXCOMMIT ioctls with invalid values.

MFC after: 1 week

6 years agopf: Improve ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT
kp [Fri, 6 Apr 2018 19:20:45 +0000 (19:20 +0000)]
pf: Improve ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT

These ioctls can process a number of items at a time, which puts us at
risk of overflow in mallocarray() and of impossibly large allocations
even if we don't overflow.

There's no obvious limit to the request size for these, so we limit the
requests to something which won't overflow. Change the memory allocation
to M_NOWAIT so excessive requests will fail rather than stall forever.

MFC after: 1 week

6 years agoAdd an unused _COMPAT_LINUX32 option to ensure opt_compat.h exists on
brooks [Fri, 6 Apr 2018 19:11:22 +0000 (19:11 +0000)]
Add an unused _COMPAT_LINUX32 option to ensure opt_compat.h exists on
platforms without COMPAT_LINUX32.

Reported by: kib

6 years agoMove most of the contents of opt_compat.h to opt_global.h.
brooks [Fri, 6 Apr 2018 17:35:35 +0000 (17:35 +0000)]
Move most of the contents of opt_compat.h to opt_global.h.

opt_compat.h is mentioned in nearly 180 files. In-progress network
driver compabibility improvements may add over 100 more so this is
closer to "just about everywhere" than "only some files" per the
guidance in sys/conf/options.

Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
is created on all architectures.

Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
set of compiled files.

Reviewed by: kib, cem, jhb, jtl
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14941

6 years agoSupport -DNO_CLEAN builds across r332119.
brooks [Fri, 6 Apr 2018 17:23:47 +0000 (17:23 +0000)]
Support -DNO_CLEAN builds across r332119.

6 years agoIf a user closes the socket before we call tcp_usr_abort(), then
jtl [Fri, 6 Apr 2018 17:20:37 +0000 (17:20 +0000)]
If a user closes the socket before we call tcp_usr_abort(), then
tcp_drop() may unlock the INP.  Currently, tcp_usr_abort() does not
check for this case, which results in a panic while trying to unlock
the already-unlocked INP (not to mention, a use-after-free violation).

Make tcp_usr_abort() check the return value of tcp_drop(). In the case
where tcp_drop() returns NULL, tcp_usr_abort() can skip further steps
to abort the connection and simply unlock the INP_INFO lock prior to
returning.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Netflix, Inc.

6 years agoRemove caching from getlogin(2).
brooks [Fri, 6 Apr 2018 17:17:34 +0000 (17:17 +0000)]
Remove caching from getlogin(2).

This caching has existed since the CSRG import, but serves no obvious
purpose. Sure, setlogin() is called rarely, but calls to getlogin()
should also be infrequent. The required invalidation was not
implemented on aarch64, arm, mips, amd riscv so updates would never
occur if getlogin() was called before setlogin().

Reported by: Ali Mashtizadeh <ali@mashtizadeh.com>
Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14965