]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAs part of the general cleanup of the ipfilter code, special cases
cy [Tue, 4 Dec 2018 06:11:04 +0000 (06:11 +0000)]
As part of the general cleanup of the ipfilter code, special cases
are committed separately to document fixing them separately from
the general cleanup. In this case we don't want to hide the utter
brokenness of what is being fixed.

Clean up a discombobulated block of #if's, with one block unreachable.
ip_fil.c is used in ipftest which is used to dry-run test ipfilter
rules in userspace without loading them in the kernel. The call to
(*ifp->if_output) matches that in the FreeBSD kernel.

Further testing and work will be required to make ipftest fully
functional.

MFC after: 1 week

5 years agoSprinkle EARLY_DRIVER_MODULE around the tree
jhibbits [Tue, 4 Dec 2018 04:55:49 +0000 (04:55 +0000)]
Sprinkle EARLY_DRIVER_MODULE around the tree

Mark some buses as BUS_PASS_BUS, and some resources as BUS_PASS_RESOURCE.
This also decouples some resource attachment orderings from being races by
device tree ordering, instead relying on the bus pass to provide the
ordering.

This was originally intended to support multipass suspend/resume, but it's
also needed on PowerMacs when using fdt, as the device tree seems to get
created in reverse of the OFW tree.
Reviewed by: nwhitehorn (long ago)
Differential Revision: https://reviews.freebsd.org/D918

5 years agopowerpc: preload_addr_relocate is no longer necessary for booke
jhibbits [Tue, 4 Dec 2018 03:51:10 +0000 (03:51 +0000)]
powerpc: preload_addr_relocate is no longer necessary for booke

The same behavior was moved to machdep.c, paired with AIM's relocation,
making this redundant.  With this, it's now possible to boot FreeBSD with
ubldr on a uboot Book-E platform, even with a
KERNBASE != VM_MIN_KERNEL_ADDRESS.

5 years agoRevert r340997 at the request of multiple users.
sbruno [Tue, 4 Dec 2018 03:23:14 +0000 (03:23 +0000)]
Revert r340997 at the request of multiple users.
- breaks ports-mgmt/pkg build for mips64, powerpc64 and i386 for some users.

--- pkg-static ---
/usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init':
/usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230:
undefined reference to `pthread_condattr_init'

Reported by: jhibbits zeising

5 years agoRemove test for KSE (removed in 2008).
brooks [Tue, 4 Dec 2018 00:22:08 +0000 (00:22 +0000)]
Remove test for KSE (removed in 2008).

Approved by: julian

5 years agoRemove a needlessly clever hack to start init with sys_exec().
brooks [Tue, 4 Dec 2018 00:15:47 +0000 (00:15 +0000)]
Remove a needlessly clever hack to start init with sys_exec().

Construct a struct image_args with the help of new exec_args_*() helper
functions and call kern_execve().

The previous code mapped a page in userspace, copied arguments out
to it one at a time, and then constructed a struct execve_args all so
that sys_execve() can call exec_copyin_args() to copy the data back in
to a struct image_args.

Opencode the part of pre_execve()/post_execve() that releases a
reference to the initial vmspace. We don't need to stop threads like
they do.

Reviewed by: kib, jhb (prior version)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15469

5 years agoPrint type designator 'D' for the KF_TYPE_DEV files.
kib [Mon, 3 Dec 2018 23:42:04 +0000 (23:42 +0000)]
Print type designator 'D' for the KF_TYPE_DEV files.

No type-specific data is provided by the kernel.

Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agoImprove procstat reporting for the linux cdev file descriptors.
kib [Mon, 3 Dec 2018 23:39:45 +0000 (23:39 +0000)]
Improve procstat reporting for the linux cdev file descriptors.

If there is a vnode attached to the linux file, use it to fill
kinfo_file.  Otherwise, report a new KF_TYPE_DEV file type, without
supplying any type-specific information.

KF_TYPE_DEV is supposed to be used by most devfs-specific file types.

Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agomkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs.
yuripv [Mon, 3 Dec 2018 22:31:57 +0000 (22:31 +0000)]
mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs.

This fixes 'cdrom' target in the case when world was built by user,
and not root.

Reviewed by: imp
Differential revision: https://reviews.freebsd.org/D18414

5 years agoRemove declarations of syscalls not used in libthr.
brooks [Mon, 3 Dec 2018 22:09:23 +0000 (22:09 +0000)]
Remove declarations of syscalls not used in libthr.

Reviewed by: kib
Sponsored by: DARPA, AFRL

5 years agoAdd a missing definition for the !COMPAT_FREEBSD32 case.
markj [Mon, 3 Dec 2018 21:07:10 +0000 (21:07 +0000)]
Add a missing definition for the !COMPAT_FREEBSD32 case.

Reported by: jenkins
MFC with: r341442
Sponsored by: The FreeBSD Foundation

5 years agoPlug memory disclosures via ptrace(2).
markj [Mon, 3 Dec 2018 20:54:17 +0000 (20:54 +0000)]
Plug memory disclosures via ptrace(2).

On some architectures, the structures returned by PT_GET*REGS were not
fully populated and could contain uninitialized stack memory.  The same
issue existed with the register files in procfs.

Reported by: Thomas Barabosch, Fraunhofer FKIE
Reviewed by: kib
MFC after: 3 days
Security: kernel stack memory disclosure
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18421

5 years agoSome fixes for LD_BIND_NOW + ifuncs.
kib [Mon, 3 Dec 2018 20:03:43 +0000 (20:03 +0000)]
Some fixes for LD_BIND_NOW + ifuncs.

- Do not perform ifunc relocations together with other PLT relocations
  in PLT.  Instead, do it during an additional pass over the init
  list, so that ifuncs are resolved in the order of dso
  dependencies. This allows the ifuncs resolvers to call into depended
  libs.  Init list now includes all objects instead of only objects
  with init/fini callables.
- Disable relro protection around bind_now ifunc relocations.

I considered calling ifunc resolvers of dso after initializers of all
dependencies are processed, and decided that this is wrong/should not
be supported. The order now is normal relocations for all
objects->ifunc resolution in init order->initializers, where each step
does complete pass over all loaded objects before moving to the next
step.

Reported, tested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18400

5 years agoClarify that /dev/kmem is not used.
sevan [Mon, 3 Dec 2018 20:01:51 +0000 (20:01 +0000)]
Clarify that /dev/kmem is not used.
Move cross ref to right place while here.

Submitted by: kib
MFC after: 7 days

5 years agoProvide naive but self-contained implementations of memset(3) and
kib [Mon, 3 Dec 2018 19:55:55 +0000 (19:55 +0000)]
Provide naive but self-contained implementations of memset(3) and
bzero(3) for rtld.

This again reduces rtld dependency on libc, and in future, avoid ifunc
relocations when the functions are converted to ifuncs in libc.

Reported by: mjg
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18400

5 years agozfs: we can boot from dataset with large_dnode enabled
tsoome [Mon, 3 Dec 2018 19:35:21 +0000 (19:35 +0000)]
zfs: we can boot from dataset with large_dnode enabled

loader has been supporting large_dnode for some time, no need to block the
feature for boot dataset.

Reviewed by: avg
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18391

5 years agostand/i386: rename .s to .S to use Clang IAS
emaste [Mon, 3 Dec 2018 19:16:34 +0000 (19:16 +0000)]
stand/i386: rename .s to .S to use Clang IAS

As part of the migration away from obsolete binutils we want to retire
GNU as.  Most assembly files used on amd64 have a .S extension and
(via rules in share/mk/bsd.suffixes.mk) are assembled with Clang's
Integrated Assembler (IAS).  Rename files in stand/i386 to .S to use
the integrated assembler.

Clang's IAS supports the defsym option (via -Wa,) but only with one
dash, not two.  As both -defsym and --defsym are accepted by GNU as,
use the former.

PR: 233611
Reviewed by: tsoome
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18369

5 years agoNote these tools use kvm(3) and not procfs as in Solaris.
sevan [Mon, 3 Dec 2018 18:00:46 +0000 (18:00 +0000)]
Note these tools use kvm(3) and not procfs as in Solaris.

Obtained from: NetBSD
MFC after: 7 days

5 years agoMove inclusion of src.opts.mk later.
imp [Mon, 3 Dec 2018 17:51:10 +0000 (17:51 +0000)]
Move inclusion of src.opts.mk later.

src.opts.mk includes bsd.own.mk. This in turn defines CTFCONVERT_CMD
depending on the MK_CTF value. We then set MK_CTF to no, which has no
real effect. The solution is to set all the MK_foo values before
including src.opts.mk.

This should stop the cdboot binary from exploding in size for releases
built WITH_CTF=yes in src.conf.

Sponsored by: Netflix

5 years agonetmap(4): improve man page
vmaffione [Mon, 3 Dec 2018 17:17:59 +0000 (17:17 +0000)]
netmap(4): improve man page

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D18057

5 years agodisable BIND_NOW in libc, libthr, and rtld
emaste [Mon, 3 Dec 2018 15:59:46 +0000 (15:59 +0000)]
disable BIND_NOW in libc, libthr, and rtld

An issue remains with BIND_NOW and processes using threads.  For now,
restore libc's BIND_NOW disable, and also disable BIND_NOW in rtld and
libthr.

A patch is in review (D18400) that likely fixes this issue, but just
disable BIND_NOW pending further testing after it is committed.

PR: 233333
Sponsored by: The FreeBSD Foundation

5 years agoUse less misleading directory name.
trasz [Mon, 3 Dec 2018 13:15:54 +0000 (13:15 +0000)]
Use less misleading directory name.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDisable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
andrew [Mon, 3 Dec 2018 09:40:37 +0000 (09:40 +0000)]
Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
files that haven't been implemented.

Reported by: sbruno
MFC with: r339738
Sponsored by: DARPA, AFRL

5 years agopowerpc: Check for a fdt in the metadata if it doesn't already exist
jhibbits [Mon, 3 Dec 2018 04:56:06 +0000 (04:56 +0000)]
powerpc: Check for a fdt in the metadata if it doesn't already exist

It's possible the fdt pointer was passed in via the metadata, as is done in
ubldr.  Check for the fdt here, instead of working with a NULL fdt, and
panicking.

5 years agopowerpc/booke: Check for the metadata address by physical address
jhibbits [Mon, 3 Dec 2018 04:47:28 +0000 (04:47 +0000)]
powerpc/booke: Check for the metadata address by physical address

The metadata pointer will almost never be at or above 'btext', as btext is a
relocated symbol, so will be based at VM_MIN_KERNEL_ADDRESS, not at
KERNBASE.  Check the address against kernload, where the kernel is
physically loaded.

5 years agoEliminate duplicated code and struct member definitions in the handoff
ian [Mon, 3 Dec 2018 03:58:30 +0000 (03:58 +0000)]
Eliminate duplicated code and struct member definitions in the handoff
of args data between gptboot/zfsboot and loader(8).

Despite what seems like a lot of changes here, there are no actual
changes in behavior, or in the data layout in the structures involved.
This is just eliminating identical code pasted into multiple locations.

In detail, the changes are...

- Move struct zfs_boot_args definition from libsa/zfs/libzfs.h to
  i386/common/bootargs.h because it is specific to x86 booting and the
  handoff between zfsboot and loader, and has no relation to the zfs
  library code in general.

- The geli_boot_args and zfs_boot_args structs both contain an identical
  set of member variables containing geli information.  Extract this out
  to a new geli_boot_data struct, and embed it in the arg-passing structs.

- Provide new routines geli_import_boot_data() and geli_export_boot_data()
  that can be shared between gptboot, zfsboot, and loader instead of
  pasting identical code into several different .c files.

- Remove some checks for a NULL pointer that can never be true because the
  pointer being tested was set using pointer math (kargs + 1) and that can
  never result in NULL in this code.

5 years agoFix typo in comment
imp [Sun, 2 Dec 2018 23:13:45 +0000 (23:13 +0000)]
Fix typo in comment

Sponsored by: Netflix

5 years agoDelete the undocumented alias 'wds'.
imp [Sun, 2 Dec 2018 23:13:35 +0000 (23:13 +0000)]
Delete the undocumented alias 'wds'.

This was a typo for wdc. Eliminate it since it was in error. People
should use either 'wdc' or 'hgst' for the vendor from now on. 'hgst'
works for all versions this functionality is present for.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove Intel specific log pages to intel.c
imp [Sun, 2 Dec 2018 23:13:24 +0000 (23:13 +0000)]
Move Intel specific log pages to intel.c

Move the Intel specific log pages (including the one that samsung
implements) to intel.c. Add comment to the samsung vendor that it will
be going away soon.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoUsage cleanup pt 2
imp [Sun, 2 Dec 2018 23:13:12 +0000 (23:13 +0000)]
Usage cleanup pt 2

Eliminage redundant spaces and nvmecontrol at start of all the usage
strings. Update the usage printing code to add them back when
presenting to the user. Allow multi-line usage messages and print
proper leading spaces for lines starting with a space.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoUsage cleanup pt 1
imp [Sun, 2 Dec 2018 23:12:58 +0000 (23:12 +0000)]
Usage cleanup pt 1

Provide a usage() function that takes a struct nvme_function pointer
and produces a usage mssage. Eliminate all now-redundant usage
functions. Propigate the new argument through the program as needed.
Use common routine to print usage.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoReturn after we find the dispatched function.
imp [Sun, 2 Dec 2018 23:12:48 +0000 (23:12 +0000)]
Return after we find the dispatched function.

If the dispatched function doesn't exit, then we get can get a
spurious function not found message. They all do exit, but this is a
little cleaner.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove the hgst/wdc log page printing code into wdc.c
imp [Sun, 2 Dec 2018 23:12:37 +0000 (23:12 +0000)]
Move the hgst/wdc log page printing code into wdc.c

These are all hgst/wdc specific, so move them into the wdc.c to live
with the wdc command.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove common logpage routines into nvmecontrol.h
imp [Sun, 2 Dec 2018 23:12:26 +0000 (23:12 +0000)]
Move common logpage routines into nvmecontrol.h

For the upcoming move of vendor specific code into vendor specific
files, make the common logpage routines global and move them to
nvmecontrol.h.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMake logpage functions a linker set.
imp [Sun, 2 Dec 2018 23:12:16 +0000 (23:12 +0000)]
Make logpage functions a linker set.

Move logpage function def to header. Convert all the logpage_function
elements to elements of the linker set. Leave them all in logpage.c
for the moment.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoMove nvmecontrol to using linker sets for commands
imp [Sun, 2 Dec 2018 23:10:55 +0000 (23:10 +0000)]
Move nvmecontrol to using linker sets for commands

More commands will be added to nvmecontrol. Also, there will be a few
more vendor commands (some of which may need to remain private to
companies writing them). The first step on that journey is to move to
using linker sets to dispatch commands. The next step will be using
dlopen to bring in the .so's that have the command that might need
to remain private for seamless integration.

Similar changes to this will be needed for vendor specific log pages.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403

5 years agoFix PCI driver unload for Marvell PCI controller
gonzo [Sun, 2 Dec 2018 21:58:36 +0000 (21:58 +0000)]
Fix PCI driver unload for Marvell PCI controller

Add generic implementation for bus_deactivate_resource method. Without
it bus_release_resource fails with "Failed to release active resource"
message

MFC after: 1 week

5 years agoBuild the dtb for the rock64 board.
andreast [Sun, 2 Dec 2018 19:36:20 +0000 (19:36 +0000)]
Build the dtb for the rock64 board.

Reviewed by: manu@

5 years agoAdd rule to build the dtb for the rock64 board.
andreast [Sun, 2 Dec 2018 19:35:22 +0000 (19:35 +0000)]
Add rule to build the dtb for the rock64 board.

Reviewed by: manu@

5 years agoFix off-by-one (page) errors in checks in d_mmap methods of several drivers.
kib [Sun, 2 Dec 2018 18:30:58 +0000 (18:30 +0000)]
Fix off-by-one (page) errors in checks in d_mmap methods of several drivers.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoAdd a comment noting that the additional range checks are not needed.
kib [Sun, 2 Dec 2018 13:29:13 +0000 (13:29 +0000)]
Add a comment noting that the additional range checks are not needed.

The object size is set in the dsp_mmap_single() which provides the
range limit by vm_fault().

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoFix off by one in hpet_mmap() csw method.
kib [Sun, 2 Dec 2018 13:27:36 +0000 (13:27 +0000)]
Fix off by one in hpet_mmap() csw method.

Reported by: C Turt <ecturt@gmail.com>
Reviewed by: alc, markj
Tested by: pho
admbug: 781
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoChange the vm_ooffset_t type to unsigned.
kib [Sun, 2 Dec 2018 13:16:46 +0000 (13:16 +0000)]
Change the vm_ooffset_t type to unsigned.

The type represents byte offset in the vm_object_t data space, which
does not span negative offsets in FreeBSD VM.  The change matches byte
offset signess with the unsignedness of the vm_pindex_t which
represents the type of the page indexes in the objects.

This allows to remove the UOFF_TO_IDX() macro which was used when we
have to forcibly interpret the type as unsigned anyway.  Also it fixes
a lot of implicit bugs in the device drivers d_mmap methods.

Reviewed by: alc, markj (previous version)
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoCorrect accuracy of the barrier writes accounting.
kib [Sun, 2 Dec 2018 12:53:39 +0000 (12:53 +0000)]
Correct accuracy of the barrier writes accounting.

Discussed with: mckusick
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoReturn computed real memory size, not a value from similarly named
mmel [Sun, 2 Dec 2018 07:39:16 +0000 (07:39 +0000)]
Return computed real memory size, not a value from similarly named
global variable.

MFC after: 1 week

5 years agoUnbreak geli/gmirror testcases if their geom classes cannot be loaded
asomers [Sun, 2 Dec 2018 05:06:37 +0000 (05:06 +0000)]
Unbreak geli/gmirror testcases if their geom classes cannot be loaded

The problem with the logic prior to this commit was twofold:

1. The wrong set of idioms (TAP-compatible) were being applied to the ATF
   testcases when run, resulting in confusing ATF failure results on setup.
2. The cleanup subroutines were broken when the geom classes could not be
   loaded as they exited with 0 unexpectedly.

This commit changes the test code to source the class-specific configuration
(conf.sh) once globally, instead of sourcing it per testcase and per cleanup
subroutine, and to call the ATF-specific setup subroutine(s) inline in
the testcases.

The refactoring done is effectively a no-op for the TAP testcases, modulo
any refactoring done to create common code between the ATF and TAP
testcases.

This unbreaks the geli testcases converted to ATF in r327662 and r327683,
and the gmirror testcases added in r327780, respectively, when the geom
class could not be loaded.

tests/sys/geom/class/mirror/...
    While here, ignore errors when turning debug failpoint sysctl off, which
    could occur if the gmirror class was not loaded.

Submitted by: ngie
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd/pull/241

5 years agoubldr: Force 'usefdt' variable to 1 for powerpc
jhibbits [Sun, 2 Dec 2018 02:20:35 +0000 (02:20 +0000)]
ubldr: Force 'usefdt' variable to 1 for powerpc

The fdt is gated, on powerpc, with a 'usefdt' environment variable.  Force
enable it in ubldr, so that the fdt is passed through the metadata.

5 years agoRemove some dead code from the geli tests
asomers [Sun, 2 Dec 2018 00:41:43 +0000 (00:41 +0000)]
Remove some dead code from the geli tests

This is detritus in the Makefile, leftover from 327662.

MFC after: 2 weeks

5 years agopmcr: Fix pstate setting on Power8
cem [Sat, 1 Dec 2018 21:37:47 +0000 (21:37 +0000)]
pmcr: Fix pstate setting on Power8

Fix p-state setting on Power8 by removing the accidental double-indirection of
the pstate_ids table.

The pstate_ids table comes from the OF property "ibm,pstate-ids."  On Power9,
the values happen to be identical to the indices, so the extra indirection was
harmless.  On Power8, the values were out of the range [0, npstates], so
pmcr_set() would fail the spec[0] range check with EINVAL.

While here, include both the value and index in the driver-specific register
array as spec[0] and spec[1] respectively.  They're redundant, but relatively
harmless, and it may aid debugging.

While here, fix the range check to exclude the index npstates, which is one
past the last valid index.

PR: 233693
Reported and tested by: sbruno
Reviewed by: jhibbits

5 years agoRestore build of the kernel, removed through r341377
cem [Sat, 1 Dec 2018 21:28:05 +0000 (21:28 +0000)]
Restore build of the kernel, removed through r341377

Turns out we already had a path_mtu_discovery variable.

X-MFC-with: r341377

5 years agoFix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
jhibbits [Sat, 1 Dec 2018 20:39:20 +0000 (20:39 +0000)]
Fix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
in threaded programs that unload libraries.

Summary:
The GNOME update to 3.28 exposed a bug in __elf_phdr_match_addr(), which leads
to a crash when building devel/libsoup on powerpc64.

Due to __elf_phdr_match_addr() limiting its search to PF_X sections, on the
PPC64 ELFv1 ABI, it was never matching function pointers properly.

This meant that libthr was never cleaning up its atfork list in
__pthread_cxa_finalize(), so if a library with an atfork handler was unloaded,
libthr would crash on the next fork.

Normally, the null pointer check it does before calling the handler would avoid
this crash, but, due to PPC64 ELFv1 using function descriptors instead of raw
function pointers, a null check against the pointer itself is insufficient, as
the pointer itself was not null, it was just pointing at a function descriptor
that had been zeroed. (Which is an ABI violation.)

Calling a zeroed function descriptor on PPC64 ELFv1 causes a jump to address 0
with a zeroed r2 and r11.

Submitted by: git_bdragon.rtk0.net
Reviewed By: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18364

5 years agoAdd Silergy SYR827 PMIC driver
manu [Sat, 1 Dec 2018 20:31:49 +0000 (20:31 +0000)]
Add Silergy SYR827 PMIC driver

SYR827 is a PMIC that can output a voltage from 0.7125V to 1.5V in 12.5mV steps
It's controlled via I2C.

MFC after: 1 month

5 years agoarm64: rockchip: rk805: Add basic support for RK808 PMIC
manu [Sat, 1 Dec 2018 20:31:05 +0000 (20:31 +0000)]
arm64: rockchip: rk805: Add basic support for RK808 PMIC

RK808 PMIC is the companion chip for RK3399 SoC.
Add basic regulator support in RK805 since they are similar.

MFC after: 1 month

5 years agoRemove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX
cy [Sat, 1 Dec 2018 20:30:18 +0000 (20:30 +0000)]
Remove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX
is dead). This includes collaterally removing code shared by HP/UX,
SGI, and Linux, where IP Filter will in all likelihood for various
reasons never run again.

MFC after: 1 week

5 years agoarm64: rockchip: rk_i2c: Use correct clock
manu [Sat, 1 Dec 2018 20:29:42 +0000 (20:29 +0000)]
arm64: rockchip: rk_i2c: Use correct clock

While here add RK3399 support and call clk_set_assigned to set the correct
clock set in the DTS.

MFC after: 1 month

5 years agoarm64/rockchip: add RK3399 support
manu [Sat, 1 Dec 2018 20:28:16 +0000 (20:28 +0000)]
arm64/rockchip: add RK3399 support

Add CRU (Clock and Reset Unit) driver for RK3399.
Add support in rk_pinctrl driver.

Submitted by:  Greg V <greg@unrelenting.technology> (Original version)
Differential Revision: https://reviews.freebsd.org/D16732

MFC after: 1 month

5 years agoarm64: rockchip: Add RK3399_CLK_PLL
manu [Sat, 1 Dec 2018 20:26:59 +0000 (20:26 +0000)]
arm64: rockchip: Add RK3399_CLK_PLL

PLLs on the RK3399 are different than the ones on the RK3328.
Add a new type and some dedicated recalc and set_freq functions.
Rename the RK3328 dedicated rk_clk_pll function with rk3328_ prefix.

MFC after: 1 month

5 years agoRestore handling of PMTU discovery, removed through an unifdef(1)
cy [Sat, 1 Dec 2018 17:59:41 +0000 (17:59 +0000)]
Restore handling of PMTU discovery, removed through an unifdef(1)
following the MFV of r254219 into r255332. In addition the 'FreeBSD'
macro was never defined in ipfilter 5.1.2 thus it never would have
been enabled in the first place.

This work is prompted by a general cleanup of the IP Filter code
prompted by working to resolve a PR. More to follow.

MFC after: 1 week

5 years agoAllow to create swap zone larger than v_page_count / 2.
kib [Sat, 1 Dec 2018 16:50:12 +0000 (16:50 +0000)]
Allow to create swap zone larger than v_page_count / 2.

If user configured the maxswapzone tunable, just take the literal
value for the initial zone sizing attempt.  Before, it was only
possible to reduce the zone by the tunable.

While there, correct the message which was not correct when zone
creation rounded the size up.

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

5 years agoCorrect the tunable name in the message.
kib [Sat, 1 Dec 2018 16:43:18 +0000 (16:43 +0000)]
Correct the tunable name in the message.

Submitted by:  Andre Albsmeier <mail@fbsd.e4m.org>
PR: 231577
MFC after: 1 week

5 years agoamd64: align target memmove buffer to 16 bytes before using rep movs
mjg [Sat, 1 Dec 2018 14:20:32 +0000 (14:20 +0000)]
amd64: align target memmove buffer to 16 bytes before using rep movs

See the review for sample test results.

Reviewed by: kib (kernel part)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18401

5 years agopf tests: Test name handling
kp [Sat, 1 Dec 2018 09:59:32 +0000 (09:59 +0000)]
pf tests: Test name handling

Provoke a situation where two interfaces have the same name, and verify
pf's reaction to this.

5 years agopf: Fix panic on overlapping interface names
kp [Sat, 1 Dec 2018 09:58:21 +0000 (09:58 +0000)]
pf: Fix panic on overlapping interface names

In rare situations[*] it's possible for two different interfaces to have
the same name. This confuses pf, because kifs are indexed by name (which
is assumed to be unique). As a result we can end up trying to
if_rele(NULL), which panics.

Explicitly checking the ifp pointer before if_rele() prevents the panic.
Note pf will likely behave in unexpected ways on the the overlapping
interfaces.

[*] Insert an interface in a vnet jail. Rename it to an interface which
exists on the host. Remove the jail. There are now two interfaces with
the same name in the host.

5 years agopf tests: Make pass_block:noalias more robust
kp [Sat, 1 Dec 2018 09:57:29 +0000 (09:57 +0000)]
pf tests: Make pass_block:noalias more robust

Send several ICMPv6 echo requests. We've seen occasional failures with a
single request.

5 years agoClarify that patterns are extended regular expressions in pkill(1) manual page.
ygy [Sat, 1 Dec 2018 05:58:33 +0000 (05:58 +0000)]
Clarify that patterns are extended regular expressions in pkill(1) manual page.

PR: 231060
Submitted by: naddy
MFC after: 3 days

5 years agoRemove trim(8) by multiple demands.
eugen [Sat, 1 Dec 2018 03:20:10 +0000 (03:20 +0000)]
Remove trim(8) by multiple demands.

5 years agoMaybe make gcc happy
vangyzen [Fri, 30 Nov 2018 23:47:57 +0000 (23:47 +0000)]
Maybe make gcc happy

According to Jenkins, the GCC architectures were unhappy because:

    sigaltstack.c:82: warning: missing initializer
    sigaltstack.c:82: warning: (near initialization for 'oss.ss_size')

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

5 years agoFix reporting of SS_ONSTACK
vangyzen [Fri, 30 Nov 2018 22:44:33 +0000 (22:44 +0000)]
Fix reporting of SS_ONSTACK

Fix reporting of SS_ONSTACK in nested signal delivery when sigaltstack()
is used on some architectures.

Add a unit test for this.  I tested the test by introducing the bug
on amd64.  I did not test it on other architectures.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18347

5 years agotrim(8): serveral style fixes
eugen [Fri, 30 Nov 2018 21:57:02 +0000 (21:57 +0000)]
trim(8): serveral style fixes

Submitted by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18380

5 years agoamd64: handle small memmove buffers with overlapping stores
mjg [Fri, 30 Nov 2018 20:58:08 +0000 (20:58 +0000)]
amd64: handle small memmove buffers with overlapping stores

Handling sizes of > 32 backwards will be updated later.

Reviewed by: kib (kernel part)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18387

5 years agoiscsi: simplify the capsicumization
oshogbo [Fri, 30 Nov 2018 19:40:16 +0000 (19:40 +0000)]
iscsi: simplify the capsicumization

Approved by: trasz
Differential Revision: https://reviews.freebsd.org/D17962

5 years agolibcasper: do not fail if Capsicum is not avilable
oshogbo [Fri, 30 Nov 2018 19:27:14 +0000 (19:27 +0000)]
libcasper: do not fail if Capsicum is not avilable

Casper service can be also used on the kernels without Capsicum support.

Reported by: sbruno
Tested by: sbruno

5 years agoAdd missing display messages when toggling modes.
markj [Fri, 30 Nov 2018 18:02:59 +0000 (18:02 +0000)]
Add missing display messages when toggling modes.

PR: 233667
Submitted by: James Wright <james.wright@jigsawdesign.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18331

5 years agoSilence down the example builds a bit.
trasz [Fri, 30 Nov 2018 16:02:27 +0000 (16:02 +0000)]
Silence down the example builds a bit.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd an example of quick kernel rebuild.
trasz [Fri, 30 Nov 2018 16:01:43 +0000 (16:01 +0000)]
Add an example of quick kernel rebuild.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd an example of rebuilding a single piece of userspace.
trasz [Fri, 30 Nov 2018 15:56:14 +0000 (15:56 +0000)]
Add an example of rebuilding a single piece of userspace.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRevert r341337; according to imp@ we still support these.
trasz [Fri, 30 Nov 2018 15:52:03 +0000 (15:52 +0000)]
Revert r341337; according to imp@ we still support these.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUse .Va for sysctls, not .Dv.
trasz [Fri, 30 Nov 2018 12:17:35 +0000 (12:17 +0000)]
Use .Va for sysctls, not .Dv.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUse .Va for sysctls, not .Dv.
trasz [Fri, 30 Nov 2018 11:50:41 +0000 (11:50 +0000)]
Use .Va for sysctls, not .Dv.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRemove duplicated word.
trasz [Fri, 30 Nov 2018 11:44:43 +0000 (11:44 +0000)]
Remove duplicated word.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoSay in plain text what the 'debug' keymap action usually is.
trasz [Fri, 30 Nov 2018 11:44:16 +0000 (11:44 +0000)]
Say in plain text what the 'debug' keymap action usually is.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRemove the hint for ISA buses; we don't support them anymore.
trasz [Fri, 30 Nov 2018 11:42:19 +0000 (11:42 +0000)]
Remove the hint for ISA buses; we don't support them anymore.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoLimit option_len for the TCP_CCALGOOPT.
tuexen [Fri, 30 Nov 2018 10:50:07 +0000 (10:50 +0000)]
Limit option_len for the TCP_CCALGOOPT.

Limiting the length to 2048 bytes seems to be acceptable, since
the values used right now are using 8 bytes.

Reviewed by: glebius, bz, rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18366

5 years agoAdapt the fix in r341008 to correctly work with EBR.
ae [Fri, 30 Nov 2018 10:36:14 +0000 (10:36 +0000)]
Adapt the fix in r341008 to correctly work with EBR.

IFNET_RLOCK_NOSLEEP() is epoch_enter_preempt() in FreeBSD 12+. Holding
it in sysctl_rtsock() doesn't protect us from ifnet unlinking, because
unlinking occurs with IFNET_WLOCK(), that is rw_wlock+sx_xlock, and it
doesn check that concurrent code is running in epoch section. But while
we are in epoch section, we should be able to do access to ifnet's
fields, even it was unlinked. Thus do not change if_addr and if_hw_addr
fields in ifnet_detach_internal() to NULL, since rtsock code can do
access to these fields and this is allowed while it is running in epoch
section.

This should fix the race, when ifnet_detach_internal() unlinks ifnet
after we checked it for IFF_DYING in sysctl_dumpentry.

Move free(ifp->if_hw_addr) into ifnet_free_internal(). Also remove the
NULL check for ifp->if_description, since free(9) can correctly handle
NULL pointer.

MFC after: 1 week

5 years agoarm64: allwinner: Add 792Mhz frequency to sun50i-a64-opp
manu [Fri, 30 Nov 2018 10:31:30 +0000 (10:31 +0000)]
arm64: allwinner: Add 792Mhz frequency to sun50i-a64-opp

This is the frequency of the cpu on the Pinebook so add it to make
cpufreq find the current setting.
Note that this dtbo on the Pinebook doesn't work right now as u-boot
dtb doesn't have symbols and so it fails to apply. Linux 4.20 have
the dts and will be imported once taggued.

MFC after: 1 month
X-MFC with: r341268

5 years agoloader.efi: fix EFI getchar() for multiple consoles
tsoome [Fri, 30 Nov 2018 08:42:14 +0000 (08:42 +0000)]
loader.efi: fix EFI getchar() for multiple consoles

This fix is ported from illumos (issue #9970), the analysis and initial
implementation was done by John Levon.

See also: https://www.illumos.org/issues/9970

Currently, efi_cons_getchar() will wait for a key. While this seems to make
sense, the implementation of getchar() in common/console.c will loop across
getchar() for all consoles without doing ischar() first.

This means that if we've configured multiple consoles, we can't input into
the serial, as getchar() will be sat waiting for input only from efi_console.c

This patch does implement a bit more generic key buffer to support
translation of input keys, and we use generic efi_readkey() to reduce
duplication from calls from getchar() and poll().

5 years agoloader: create separate lists for fd, cd and hd, merge bioscd with biosdisk
tsoome [Fri, 30 Nov 2018 08:01:11 +0000 (08:01 +0000)]
loader: create separate lists for fd, cd and hd, merge bioscd with biosdisk

Create unified block IO implementation in BIOS version, like it is done in UEFI
side. Implement fd, disk and cd device lists, this will split floppy devices
from disks and will allow us to have consistent, predictable device naming
(modulo BIOS issues).

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

5 years agosfxge(4): rollback last seen VLAN TCI if Tx packet is dropped
arybchik [Fri, 30 Nov 2018 07:11:05 +0000 (07:11 +0000)]
sfxge(4): rollback last seen VLAN TCI if Tx packet is dropped

Early processing of a packet on transmit may change last seen
VLAN TCI in the queue context. If such a packet is eventually
dropped, last seen VLAN TCI must be set to its previous value.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18288

5 years agosfxge(4): ensure EvQ poll stops when abort is requested
arybchik [Fri, 30 Nov 2018 07:10:54 +0000 (07:10 +0000)]
sfxge(4): ensure EvQ poll stops when abort is requested

If an event handler requested an abort, only the inner loop was
guarenteed to be broken out of - the outer loop could continue
if total == batch.

Fix this by poisoning batch to ensure it is different to total.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18287

5 years agosfxge(4): support Medford2
arybchik [Fri, 30 Nov 2018 07:10:43 +0000 (07:10 +0000)]
sfxge(4): support Medford2

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18286

5 years agosfxge(4): update external port number calculation
arybchik [Fri, 30 Nov 2018 07:10:32 +0000 (07:10 +0000)]
sfxge(4): update external port number calculation

Revise the external port calculation to support all
X2 port modes. The previous algorithm could not
handle different port numbering schemes on each cage.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18285

5 years agosfxge(4): correct annotations where NULL input is OK
arybchik [Fri, 30 Nov 2018 07:10:20 +0000 (07:10 +0000)]
sfxge(4): correct annotations where NULL input is OK

Correct annotations where NULL input can be permitted

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18284

5 years agosfxge(4): support new link modes in the driver
arybchik [Fri, 30 Nov 2018 07:10:09 +0000 (07:10 +0000)]
sfxge(4): support new link modes in the driver

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18283

5 years agosfxge(4): use transceiver ID when reading info
arybchik [Fri, 30 Nov 2018 07:09:58 +0000 (07:09 +0000)]
sfxge(4): use transceiver ID when reading info

In efx_mcdi_phy_module_get_info() probe the
transceiver identification byte rather than assume
the module matches the fixed port type.  This
supports scenarios such as a SFP mounted in a QSFP
port via a QSA module.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18282

5 years agosfxge(4): add accessor to whole link status
arybchik [Fri, 30 Nov 2018 07:09:46 +0000 (07:09 +0000)]
sfxge(4): add accessor to whole link status

Add a function which makes an MCDI GET_LINK request and
packages up the results. Currently, the get-link function
is triggered from several entry points which then pass
on or store selected parts of the data. When the driver
needs to obtain the current link state, it is more
efficient to do this in a single call.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18281

5 years agosfxge(4): guard Rx scale code with corresponding option
arybchik [Fri, 30 Nov 2018 07:09:34 +0000 (07:09 +0000)]
sfxge(4): guard Rx scale code with corresponding option

Previously only some of the code was guarded by this which caused
a build error when EFSYS_OPT_RX_SCALE is 0 (e.g. in manftest).

Submitted by:   Tom Millington <tmillington at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18280

5 years agosfxge(4): infer port mode bandwidth from max link speed
arybchik [Fri, 30 Nov 2018 07:09:23 +0000 (07:09 +0000)]
sfxge(4): infer port mode bandwidth from max link speed

Limit the port mode bandwidth calculations by the maximum
reported link speed. This system detects 25G vs 10G cards,
and 100G port modes vs 40G.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18279

5 years agosfxge(4): support improvements to bandwidth calculations
arybchik [Fri, 30 Nov 2018 07:09:11 +0000 (07:09 +0000)]
sfxge(4): support improvements to bandwidth calculations

Change the interface to ef10_nic_get_port_mode_bandwidth()
so more NIC information can be used to infer bandwidth
requirements. Huntington calculations separated out
completely.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18278

5 years agosfxge(4): add X2 port modes to bandwidth calculator
arybchik [Fri, 30 Nov 2018 07:09:00 +0000 (07:09 +0000)]
sfxge(4): add X2 port modes to bandwidth calculator

Add cases for the new port modes supported by X2 NICs.
Lane bandwidth is calculated for pre-X2 cards so is an
underestimate for X2 in 25G/100G modes.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18277

5 years agosfxge(4): update to current port mode terminology
arybchik [Fri, 30 Nov 2018 07:08:50 +0000 (07:08 +0000)]
sfxge(4): update to current port mode terminology

>From Medford onwards, the newer constants enumerating
port modes should be used.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18276