freebsd.git
8 years agoImplement finer locking in ITS
zbb [Thu, 11 Feb 2016 12:03:11 +0000 (12:03 +0000)]
Implement finer locking in ITS

- Change locks' names to be more suitable
- Don't use blocking mutex. Lock only basic operations such
  as lists or bitmaps modifications.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5230

8 years agoInitially bind all interrupts to the boot CPU when using GICv3
zbb [Thu, 11 Feb 2016 12:01:33 +0000 (12:01 +0000)]
Initially bind all interrupts to the boot CPU when using GICv3

This should be done by routing all interrupts to CPU0,
different assignment will be induced by either interrupts
shuffling or bus_bind_intr().

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5229

8 years agoCall pmc_hook() correctly in the ARM64 interrupt handler
zbb [Thu, 11 Feb 2016 11:59:32 +0000 (11:59 +0000)]
Call pmc_hook() correctly in the ARM64 interrupt handler

pmc_hook() was called only in case of the stray interrupt but should
rather be called on each interrupt. Move in to the arm_cpu_intr()
handler, out of the critical section too.

Reviewed by:   br
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5161

8 years agoIntroduce bus_bind_intr method for ARM64
zbb [Thu, 11 Feb 2016 11:58:27 +0000 (11:58 +0000)]
Introduce bus_bind_intr method for ARM64

It can be used to bind specific interrupt to a particular CPU.
Requires PIC support for interrupts binding.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5122

8 years agoFix bugs in interrupts allocation on ARM64
zbb [Thu, 11 Feb 2016 11:57:13 +0000 (11:57 +0000)]
Fix bugs in interrupts allocation on ARM64

Separate interrupt descriptors lookup from allocation. It was possible
to perform config on non-existing interrupt simply by allocating spurious
descriptor.
Must lock the interrupt descriptors table lookup to avoid mismatches.
This ought to prevent trouble while setting up new interrupt
and dispatching existing one.
Use spin mutex rather than sleep mutex. This is mainly due to lock in
arm_dispatch_intr.
This should be eventually changed to a lock-less solution without
walking through a linked list on each interrupt.

Reviewed by:   andrew, wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5121

8 years agoxen-netfront: remove useless NULL check in netif_free
royger [Thu, 11 Feb 2016 11:57:12 +0000 (11:57 +0000)]
xen-netfront: remove useless NULL check in netif_free

xn_ifp is allocated in create_netdev with if_alloc(IFT_ETHER).
According to the current arrangement it can't be NULL.

Coverity ID: 1349805
Submitted by: Wei Liu <wei.liu2@citrix.com>
Reviewed by: royger
Sponsored by: Citrix Systems R&D
Differential revision: https://reviews.freebsd.org/D5252

8 years agoMinor clean-ups for ARM64 GICv3 and GIC drivers
zbb [Thu, 11 Feb 2016 11:55:37 +0000 (11:55 +0000)]
Minor clean-ups for ARM64 GICv3 and GIC drivers

GICv3:
- move ICC_SGI1R_EL1 definitions to armreg.h and use proper system
  register's names
GIC:
- remove unused functions

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5119

8 years agoxen-netfront: rearrange error paths in setup_txqs
royger [Thu, 11 Feb 2016 11:53:32 +0000 (11:53 +0000)]
xen-netfront: rearrange error paths in setup_txqs

Coverity spotted double free errors in error path. Fix that by
removing the extraneous calls.

Coverity ID: 1349798
Submitted by: Wei Liu <wei.liu2@citrix.com>
Reviewed by: royger
Sponsored by: Citrix Systems R&D
Differential revision: https://reviews.freebsd.org/D5251

8 years agoxen-netfront: remove pointless assignment in xn_ioctl
royger [Thu, 11 Feb 2016 11:50:31 +0000 (11:50 +0000)]
xen-netfront: remove pointless assignment in xn_ioctl

The variable error is assigned to 0 before entering the switch.
Assigning error to 0 before break pointless rewrites the real error
value that should be returned.

Coverity ID: 1304974
Submitted by: Wei Liu <wei.liu2@citrix.com>
Reviewed by: royger
Sponsored by: Citrix Systems R&D
Differential revision: https://reviews.freebsd.org/D5250

8 years agoStop defining fdt_pic_table when building for ARM_INTRNG.
andrew [Thu, 11 Feb 2016 11:49:27 +0000 (11:49 +0000)]
Stop defining fdt_pic_table when building for ARM_INTRNG.

8 years agoStop device enumeration when we see first empty slot.
br [Thu, 11 Feb 2016 11:21:45 +0000 (11:21 +0000)]
Stop device enumeration when we see first empty slot.
This fixes operation in QEMU and saves some booting time as well.

Pointed out by: Sagar Karandikar <skarandikar@berkeley.edu>
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

8 years agoRemove unused Zedboard config files. files.zedboard was empty other than
andrew [Thu, 11 Feb 2016 10:48:15 +0000 (10:48 +0000)]
Remove unused Zedboard config files. files.zedboard was empty other than
comments, and std.zedboard just pointed to files.zedboard and std.xilinx.

8 years agoUse a pair of ifs when comparing the 32-bit flowid integers so that
hselasky [Thu, 11 Feb 2016 10:03:50 +0000 (10:03 +0000)]
Use a pair of ifs when comparing the 32-bit flowid integers so that
the sign bit doesn't cause an overflow. The overflow manifests itself
as a sorting index wrap around in the middle of the sorted array,
which is not a problem for the LRO code, but might be a problem for
the logic inside qsort().

Reviewed by: gnn @
Sponsored by: Mellanox Technologies
Differential Revision: https://reviews.freebsd.org/D5239

8 years agoARM64 disassembler: support for LDR instructions
wma [Thu, 11 Feb 2016 06:50:11 +0000 (06:50 +0000)]
ARM64 disassembler: support for LDR instructions

    Implemented disassembly for a whole bunch of
    various ldr instructions.

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5217

8 years agoMake bus_space_generic properly map/unmap memory (using pmap_mapdev and
adrian [Thu, 11 Feb 2016 06:24:34 +0000 (06:24 +0000)]
Make bus_space_generic properly map/unmap memory (using pmap_mapdev and
pmap_unmapdev respectively) so that resources are properly managed.

This is work originally done by kan@.  Stanislav picked it up as part
of his Mediatek SoC work.

Tested:

* Carambola2, AR933x SoC

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Reviewed by: kan
Differential Revision: https://reviews.freebsd.org/D5184

8 years agoMigrate the other MIPS24K SoC cores to use the CPU_MIPS24K option.
adrian [Thu, 11 Feb 2016 06:23:02 +0000 (06:23 +0000)]
Migrate the other MIPS24K SoC cores to use the CPU_MIPS24K option.

8 years agoMissing commit - remove MIPS fdt bus space.
adrian [Thu, 11 Feb 2016 06:19:58 +0000 (06:19 +0000)]
Missing commit - remove MIPS fdt bus space.

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

8 years agoRemove bus space fdt for MIPS.
adrian [Thu, 11 Feb 2016 06:19:32 +0000 (06:19 +0000)]
Remove bus space fdt for MIPS.

This was originall done by kan@.

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Reviewed by: kan
Differential Revision: https://reviews.freebsd.org/D5184

8 years agoConvert MIPS nexus and mips_pic to BUS_PASS
adrian [Thu, 11 Feb 2016 06:15:43 +0000 (06:15 +0000)]
Convert MIPS nexus and mips_pic to BUS_PASS

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Reviewed by: kan
Differential Revision: https://reviews.freebsd.org/D5196

8 years agoTeach the MIPS ticker to attach itself properly when using INTRNG.
adrian [Thu, 11 Feb 2016 06:13:53 +0000 (06:13 +0000)]
Teach the MIPS ticker to attach itself properly when using INTRNG.

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Reviewed by: kan
Differential Revision: https://reviews.freebsd.org/D5183

8 years agoBegin the MIPS_INTRNG support.
adrian [Thu, 11 Feb 2016 06:09:27 +0000 (06:09 +0000)]
Begin the MIPS_INTRNG support.

This is a prelude to intr-ng support for MIPS boards that need it -
notably the CI20 port from kan@ that's upcoming, but also work that
Stanislav is doing for the Mediatek platforms.

This is the initial platform dependent bits in include/intr.h, some
#defines for the nexus code for the intrng initialisation/runtime
bits, some changed naming (which I'll fix later to be the same, much
like what I did for ARM intr-ng) in exception.S, and the first cut
at a PIC.

Stanislav and I refactored out the common code for intrng support,
so the mips intrng definitions are quite small (sys/mips/include/intr.h.)

This is all work done by kan@, which stanislav has been cherry picking
into common code for his mediatek chipset work.

Tested:

* Carambola2 - no regressions (not intr-ng though!)

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Reviewed by: kan (original author)
Differential Revision: https://reviews.freebsd.org/D5182

8 years agoUpdate uefi.8 for ZFS and multi device boot support
emaste [Thu, 11 Feb 2016 02:02:01 +0000 (02:02 +0000)]
Update uefi.8 for ZFS and multi device boot support

As of r294068 boot1.efi can load loader.efi from ZFS.

As of r295320 boot1.efi prefers to load loader.efi from the same device
it was loaded from.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agoDocument boot1.efi's handling of /boot.config, added in r294768
emaste [Thu, 11 Feb 2016 01:30:43 +0000 (01:30 +0000)]
Document boot1.efi's handling of /boot.config, added in r294768

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agoUpdate leapsecond file in non-chroot environments.
cy [Thu, 11 Feb 2016 01:16:57 +0000 (01:16 +0000)]
Update leapsecond file in non-chroot environments.

PR: 207095
Submitted by: madpilot
MFC after: 3 days

8 years agoExt4: fix handling of files with sparse blocks before extent's index.
pfg [Thu, 11 Feb 2016 00:34:11 +0000 (00:34 +0000)]
Ext4: fix handling of files with sparse blocks before extent's index.

This is ongoing work from Damjan Jovanovic to improve ext4 read support
with sparse files:

Keep track of the first and last block in each extent as it descends down
the extent tree, thus being able to work out that some blocks are sparse
earlier. This solves an issue on r293680.

In ext4_bmapext() start supporting the runb parameter, which appears to be
the number of adjacent blocks prior to the block being converted in the
same way that runp is the number of blocks after, speding up random access
to mmaped files.

PR: 206652

8 years agoAdd WITH_GDB src.conf(5) description
emaste [Thu, 11 Feb 2016 00:30:51 +0000 (00:30 +0000)]
Add WITH_GDB src.conf(5) description

8 years agoAdd missing src.conf(5) descriptions for tool chain components
emaste [Thu, 11 Feb 2016 00:14:00 +0000 (00:14 +0000)]
Add missing src.conf(5) descriptions for tool chain components

Sponsored by: The FreeBSD Foundation

8 years agoUpdate list of binutils controlled by WITHOUT_BINUTILS_BOOTSTRAP
emaste [Wed, 10 Feb 2016 23:57:09 +0000 (23:57 +0000)]
Update list of binutils controlled by WITHOUT_BINUTILS_BOOTSTRAP

Tools removed from the list are now provided by the ELF Tool Chain
project and are not controlled by the WITHOUT_BINUTILS_BOOTSTRAP knob.

Sponsored by: The FreeBSD Foundation

8 years agoRemove useless checks for NULL before calling free(9), in the kernel
kib [Wed, 10 Feb 2016 21:35:00 +0000 (21:35 +0000)]
Remove useless checks for NULL before calling free(9), in the kernel
elf linkers.

Found by: Related PVS-Studio diagnostic
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoFinish r173600. There is no need to test a condition if both cases
kib [Wed, 10 Feb 2016 21:16:37 +0000 (21:16 +0000)]
Finish r173600.  There is no need to test a condition if both cases
result in the same value.

Found by: PVS-Studio
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agontb_hw(4): Print correct PAT name for non-WC/WB types mapped at load
cem [Wed, 10 Feb 2016 20:49:22 +0000 (20:49 +0000)]
ntb_hw(4): Print correct PAT name for non-WC/WB types mapped at load

Sponsored by: EMC / Isilon Storage Division

8 years agontb_hw(4): Allow any x86 PAT caching flags for MW defaults
cem [Wed, 10 Feb 2016 20:28:28 +0000 (20:28 +0000)]
ntb_hw(4): Allow any x86 PAT caching flags for MW defaults

Replace the hw.ntb.enable_writecombine tunable with
hw.ntb.default_mw_pat.  It can be set with several specific numerical
values to select a caching type.  Any bogus value is treated as
Uncacheable (UC).

The ntb_mw_set_wc() KPI has removed the restriction that the selected
mode must be one of UC, WC, or WB.

Sponsored by: EMC / Isilon Storage Division

8 years agoAdd a kern.icl.drivers sysctl, to retrieve the list of registered
trasz [Wed, 10 Feb 2016 19:01:26 +0000 (19:01 +0000)]
Add a kern.icl.drivers sysctl, to retrieve the list of registered
ICL drivers.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoGarbage collect unused arguments of m_init().
glebius [Wed, 10 Feb 2016 18:54:18 +0000 (18:54 +0000)]
Garbage collect unused arguments of m_init().

8 years agoGarbage collect m_getclr().
glebius [Wed, 10 Feb 2016 18:36:51 +0000 (18:36 +0000)]
Garbage collect m_getclr().

8 years agoSimilar to r295116, add an additional 1 second sleep after calling ggatel
ngie [Wed, 10 Feb 2016 17:57:24 +0000 (17:57 +0000)]
Similar to r295116, add an additional 1 second sleep after calling ggatel
before calling dd to defeat a race when writing out to the geom_gate(4)
device

MFC after: 1 month
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove stray semicolons from the iSCSI code.
trasz [Wed, 10 Feb 2016 17:55:39 +0000 (17:55 +0000)]
Remove stray semicolons from the iSCSI code.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoExplicitly include <sys/systm.h>. Previously we were pulling it in due to
andrew [Wed, 10 Feb 2016 16:49:20 +0000 (16:49 +0000)]
Explicitly include <sys/systm.h>. Previously we were pulling it in due to
header pollution.

8 years agoFix a logic inversion when checking for ARM_INTRNG
andrew [Wed, 10 Feb 2016 16:44:20 +0000 (16:44 +0000)]
Fix a logic inversion when checking for ARM_INTRNG

Pointy hat to: andrew

8 years agoOnly use fdt_pic_table when not using ARM_INTRNG
andrew [Wed, 10 Feb 2016 16:39:02 +0000 (16:39 +0000)]
Only use fdt_pic_table when not using ARM_INTRNG

8 years agoAdd new rc.conf parameter "jail_reverse_stop"
feld [Wed, 10 Feb 2016 16:13:59 +0000 (16:13 +0000)]
Add new rc.conf parameter "jail_reverse_stop"

When a user defines "jail_list" in rc.conf the jails are started in the
order defined. Currently the jails are not are stopped in reverse order
which may break dependencies between jails/services and prevent a clean
shutdown. The new parameter "jail_reverse_stop" will shutdown jails in
"jail_list" in reverse order when set to "YES".

Please note that this does not affect manual invocation of the jail rc
script. If a user runs the command

  # service jail stop jail1 jail2 jail3

the jails will be stopped in exactly the order specified regardless of
jail_reverse_stop being defined in rc.conf.

PR: 196152
Approved by: jamie
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5233

8 years agoUse OF_getencprop to read a property, it already handles the endian
andrew [Wed, 10 Feb 2016 15:56:52 +0000 (15:56 +0000)]
Use OF_getencprop to read a property, it already handles the endian
conversion so we don't need to pass the data through fdt32_to_cpu.

8 years agoRemove man page references to rndassociates.com, which has been taken over
jamie [Wed, 10 Feb 2016 14:48:49 +0000 (14:48 +0000)]
Remove man page references to rndassociates.com, which has been taken over
by a domain squatter.

8 years agosfxge: implement SIOCGI2C to read information from phy modules
arybchik [Wed, 10 Feb 2016 12:14:56 +0000 (12:14 +0000)]
sfxge: implement SIOCGI2C to read information from phy modules

The IOCTL is used by 'ifconfig -v' to show SFP+/QSFP+ information
including inventory information and dianostics (temperature, light
levels, voltage etc).

Reviewed by:    gnn,melifaro
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D5240

8 years agoRevert an arm64 change that sneaked in with r295464.
andrew [Wed, 10 Feb 2016 10:28:33 +0000 (10:28 +0000)]
Revert an arm64 change that sneaked in with r295464.

8 years agoRemove O_SYNC from the options passed to dbmopen().
se [Wed, 10 Feb 2016 09:40:45 +0000 (09:40 +0000)]
Remove O_SYNC from the options passed to dbmopen().

The services db is created as a temporary file that is moved over the
existing file after completion. Thus there is no need to immediately
flush all created db records to the temporary file.

This speeds up creation of the services db by a factor of 500 on my
ZFS based /var/db filesytem (from 110 seconds to 0.235 seconds).

MFC after: 1 week

8 years agoUpdate of the Allwinner drivers to:
andrew [Wed, 10 Feb 2016 09:19:29 +0000 (09:19 +0000)]
Update of the Allwinner drivers to:
 * Use the Linux compat string
 * Use EARLY_DRIVER_MODULE to attach at the right time
 * Add a generic A10 kernel config file
 * A20 now use generic_timer
 * Add two new dts files for Olimex boards
 * Update our custom DTS file for A10 and A20 to use the same compatible
   property names as the vendor ones.

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision: https://reviews.freebsd.org/D4792

8 years agoCorrect PCI device description.
hselasky [Wed, 10 Feb 2016 08:03:10 +0000 (08:03 +0000)]
Correct PCI device description.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

8 years agoAdd `stats' command to get ng_bridge(4) stats
dteske [Wed, 10 Feb 2016 04:56:38 +0000 (04:56 +0000)]
Add `stats' command to get ng_bridge(4) stats

8 years agoBreak out the shared bits of the arm intrng definitions into sys/intr.h;
adrian [Wed, 10 Feb 2016 04:43:08 +0000 (04:43 +0000)]
Break out the shared bits of the arm intrng definitions into sys/intr.h;
leave the machine dependent bits in sys/arm/.

This is in preparation for MIPS INTRNG work.

Submitted by: Stanislav Galabov <sgalabov@gmail.com>

8 years agoAdd vnet jail configuration examples
dteske [Wed, 10 Feb 2016 04:04:31 +0000 (04:04 +0000)]
Add vnet jail configuration examples

8 years agoFix make universe when running with non POSIX/C locales using a locale sensitive
bapt [Wed, 10 Feb 2016 00:26:01 +0000 (00:26 +0000)]
Fix make universe when running with non POSIX/C locales using a locale sensitive
pattern

Reported by: many
Submitted by: jilles

8 years agoZero pf rule counters so daily reports make sense
lidl [Tue, 9 Feb 2016 21:00:38 +0000 (21:00 +0000)]
Zero pf rule counters so daily reports make sense

Zero pf rule counters so that each daily report lists an absolute
number of rejected packets, not the total since the last time the
machine rebooted (or the counters were manually cleared).

PR: 206467
Submitted by: Rick Adams
Approved by: rpaulo (mentor)
Differential Revision: https://reviews.freebsd.org/D5172

8 years agoInclude sys/_task.h into uma_int.h, so that taskqueue.h isn't a
glebius [Tue, 9 Feb 2016 20:22:35 +0000 (20:22 +0000)]
Include sys/_task.h into uma_int.h, so that taskqueue.h isn't a
requirement for uma_int.h.

Suggested by: jhb

8 years agoRename variable to reflect the condition.
kib [Tue, 9 Feb 2016 18:35:37 +0000 (18:35 +0000)]
Rename variable to reflect the condition.

Suggested by: jhb
Sponsored by: The FreeBSD Foundation

8 years agoRemove unneeded whitespace, and fix a license for a new file. Extracted
andrew [Tue, 9 Feb 2016 18:19:24 +0000 (18:19 +0000)]
Remove unneeded whitespace, and fix a license for a new file. Extracted
from a larger patch.

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
X-Differential Revision: https://reviews.freebsd.org/D4792

8 years agoBring generated interfaces up always
dteske [Tue, 9 Feb 2016 18:11:18 +0000 (18:11 +0000)]
Bring generated interfaces up always

8 years agoChange MAC algo to support mixing w/jng interfaces
dteske [Tue, 9 Feb 2016 18:10:36 +0000 (18:10 +0000)]
Change MAC algo to support mixing w/jng interfaces

8 years agoFix bpf unhiding example /etc/devfs.rules
dteske [Tue, 9 Feb 2016 18:08:40 +0000 (18:08 +0000)]
Fix bpf unhiding example /etc/devfs.rules

8 years agoTo support userspace audio daemons like Virtual OSS, /dev/sndstat is
hselasky [Tue, 9 Feb 2016 17:09:14 +0000 (17:09 +0000)]
To support userspace audio daemons like Virtual OSS, /dev/sndstat is
made writeable by the root user. Userspace audio daemons can add or
update an entry in /dev/sndstat by doing a single system write call to
any /dev/sndstat file descriptor handle. When the audio daemon closes the
file handle or is killed the entry disappears.

While at it, cleanup the sound status code a bit:
- keep the device list sorted to avoid sorting the list every time a
  /dev/sndstat read request is made.
- factor out locking into a pair of locking macros.
- use the sound status lock to protect all per file handle states,
  when generating the output for /dev/sndstat and when removing or
  adding sound status devices. This way sndstat_acquire() and
  sndstat_release() become superfluous and can be removed.

Reviewed by: mav @
Differential Revision: https://reviews.freebsd.org/D5191

8 years agoUpdate our copy of the Linux dts files to be in sync with Linux 4.5-rc1. We
andrew [Tue, 9 Feb 2016 16:42:32 +0000 (16:42 +0000)]
Update our copy of the Linux dts files to be in sync with Linux 4.5-rc1. We
now uave a full copy of the arm device tree sources to help when adding
support for newer boards.

Sponsored by: ABT Systems Ltd

8 years agoRename P_KTHREAD struct proc p_flag to P_KPROC.
kib [Tue, 9 Feb 2016 16:30:16 +0000 (16:30 +0000)]
Rename P_KTHREAD struct proc p_flag to P_KPROC.

I left as is an apparent bug in ntoskrnl_var.h:AT_PASSIVE_LEVEL()
definition.

Suggested by: jhb
Sponsored by: The FreeBSD Foundation

8 years agoUse designated initialisers for the db disassembler interface to help with
andrew [Tue, 9 Feb 2016 10:18:22 +0000 (10:18 +0000)]
Use designated initialisers for the db disassembler interface to help with
finding the struct when searching for one of its members.

8 years agoCorrect the year, it's 2016.
andrew [Tue, 9 Feb 2016 10:06:06 +0000 (10:06 +0000)]
Correct the year, it's 2016.

8 years agoAdd an ARMv7 config file to build nanobsd images for the qemu virt
andrew [Tue, 9 Feb 2016 09:57:50 +0000 (09:57 +0000)]
Add an ARMv7 config file to build nanobsd images for the qemu virt
platform.

Sponsored by: ABT Systems Ltd

8 years agoDon't set the offset when loading the kernel on the arm loader.efi. The
andrew [Tue, 9 Feb 2016 09:39:30 +0000 (09:39 +0000)]
Don't set the offset when loading the kernel on the arm loader.efi. The
copyin and copyout code handle virtual addresses such that they will take
a virtual address and convert it into a valid physical address. It may
also mean we fail to boot as the elf files load address could be 0.

Sponsored by: ABT Systems Ltd

8 years agoImprove comment to reflect recent changes.
trasz [Tue, 9 Feb 2016 09:38:05 +0000 (09:38 +0000)]
Improve comment to reflect recent changes.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoUse a proper type for return value of postfix_to_mult(); the way it's
trasz [Tue, 9 Feb 2016 09:37:04 +0000 (09:37 +0000)]
Use a proper type for return value of postfix_to_mult(); the way it's
being used wouldn't work if the value returned didn't fit in intmax_t.

Submitted by: bde@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoUse proper functions for parsing the numeric values.
trasz [Tue, 9 Feb 2016 09:32:10 +0000 (09:32 +0000)]
Use proper functions for parsing the numeric values.

Submitted by: bde@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoIgnore invalid page descriptors in ARM64 pmap_mincore
wma [Tue, 9 Feb 2016 06:26:27 +0000 (06:26 +0000)]
Ignore invalid page descriptors in ARM64 pmap_mincore

    Prevent the function from null-pointer-dereference when unexisting
    mapping is being processed.

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb, cognet
Differential revision: https://reviews.freebsd.org/D5228

8 years agoTeach ofw_bus_parse_xref_list_alloc to be able to return the length of the parsed...
adrian [Tue, 9 Feb 2016 03:35:40 +0000 (03:35 +0000)]
Teach ofw_bus_parse_xref_list_alloc to be able to return the length of the parsed list.

Currently, there is no easy way to know in advance how many entries a list parsed by
ofw_bus_parse_xref_list_alloc() in sys/dev/ofw/ofw_bus_subr.c has.

This patch:

* teaches the existing function about handling idx == -1 and returning how big
  the set is; then renames it as _internal;
* create a new function that asserts idx != -1, so the old API is maintained;
* add a new function that returns just the list length.

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Differential Revision: https://reviews.freebsd.org/D5043

8 years agoAdjust MAC algo to support interface branching
dteske [Tue, 9 Feb 2016 01:41:03 +0000 (01:41 +0000)]
Adjust MAC algo to support interface branching

8 years agoStop clang from generating movt/movw sequences. These don't get relocated
andrew [Tue, 9 Feb 2016 00:15:41 +0000 (00:15 +0000)]
Stop clang from generating movt/movw sequences. These don't get relocated
so will access data from an unrelocated address. This is only needed for
self relocating code on ARMv7, however this is true for both ubldr and
loader.efi, the only two loaders we support on ARMv7.

While here also force the fpu to be none as is done in libstand.

Sponsored by: ABT Systems Ltd

8 years agoEnsure the bss is aligned to a 4-byte address as we use 4-byte aligned
andrew [Tue, 9 Feb 2016 00:01:43 +0000 (00:01 +0000)]
Ensure the bss is aligned to a 4-byte address as we use 4-byte aligned
stores to clear it.

While here reduce the alignment of the data from 4k to 16 byte aligned.
This should be more than enough, without wasting too much space.

Sponsored by: ABT Systems Ltd

8 years agoCall kthread_exit() rather than kproc_exit() for a premature kthread exit.
jhb [Mon, 8 Feb 2016 23:11:23 +0000 (23:11 +0000)]
Call kthread_exit() rather than kproc_exit() for a premature kthread exit.

Kernel threads (and processes) are supposed to call kthread_exit() (or
kproc_exit()) to terminate.  However, the kernel includes a fallback in
fork_exit() to force a kthread exit if a kernel thread's "main" routine
returns.  This fallback was added back when the kernel only had processes
and was not updated to call kthread_exit() instead of kproc_exit() when
threads were added to the kernel.

This mistake was particular exciting when the errant thread belonged to
proc0.  Due to the missing P_KTHREAD flag the fallback did not kick in
and instead tried to return to userland via whatever garbage was in the
trapframe.  With P_KTHREAD set it tried to terminate proc0 resulting in
other amusements.

PR: 204999
MFC after: 1 week

8 years agoMark proc0 as a kernel process via the P_KTHREAD flag.
jhb [Mon, 8 Feb 2016 23:06:27 +0000 (23:06 +0000)]
Mark proc0 as a kernel process via the P_KTHREAD flag.

All other kernel processes have this flag set and all threads in proc0
(including thread0) have the similar TDP_KTHREAD flag set.

PR: 204999
Submitted by: Oliver Pinter @ HardenedBSD
Reviewed by: kib
MFC after: 1 week

8 years agoFix the SCSI Extended INQUIRY probe case when an error is returned
ken [Mon, 8 Feb 2016 22:13:08 +0000 (22:13 +0000)]
Fix the SCSI Extended INQUIRY probe case when an error is returned
and a retry is scheduled.

Instead of leaving the device queue frozen, unfreeze the device queue so
that the retry can happen.

Sponsored by: Spectra Logic
MFC after: 3 days

8 years agoFix the gcc build after r295407.
markj [Mon, 8 Feb 2016 22:02:56 +0000 (22:02 +0000)]
Fix the gcc build after r295407.

X-MFC-With: r295407

8 years agokmod.mk: Ensure ILINKS are created before building.
bdrewery [Mon, 8 Feb 2016 20:58:52 +0000 (20:58 +0000)]
kmod.mk: Ensure ILINKS are created before building.

This allows skipping 'make depend' or running 'make clean all' without
getting a flip-flopping dependency due to the exists() just below.
Otherwise an error is encountered, such as:
  fatal error: 'machine/endian.h' file not found.

Sponsored by: EMC / Isilon Storage Division

8 years agokmod.mk: Support a beforebuild target such as bsd.prog.mk has.
bdrewery [Mon, 8 Feb 2016 20:57:12 +0000 (20:57 +0000)]
kmod.mk: Support a beforebuild target such as bsd.prog.mk has.

Sponsored by: EMC / Isilon Storage Division

8 years agoficl: Replace rand(3) with random(3).
pfg [Mon, 8 Feb 2016 20:03:14 +0000 (20:03 +0000)]
ficl: Replace rand(3) with random(3).

Be a little more consistent with random(3) and push an
unsigned value.

Again, this has no effect as this code doesn't get compiled
for the boot code.

8 years agoficl: Replace rand(3) with random(3).
pfg [Mon, 8 Feb 2016 19:45:55 +0000 (19:45 +0000)]
ficl: Replace rand(3) with random(3).

While the later is a better random generator than the former, the main
reason of the change is that random() has a better chance to work with
libstand(3).

At this time we don't include random number generators in bootforth
so this has no effect.

8 years agoImplement -P for boot loader. It's a bit easier to implement here than
imp [Mon, 8 Feb 2016 19:34:17 +0000 (19:34 +0000)]
Implement -P for boot loader. It's a bit easier to implement here than
in boot1, like is normally done. When a keyboard appears in the UEFI
device tree, assume -D -h, just like on a BIOS boot.

# It is unclear if an ACPI keyboard appearing in the tree means there's
# a real keyboard or not. A USB keyboard doesn't seem to appear unless
# it is really there.

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

8 years agoIf libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbols
kib [Mon, 8 Feb 2016 19:24:13 +0000 (19:24 +0000)]
If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbols
do not participate in the global symbols namespace, but rtld locks are
still replaced and functions are interposed.  In particular,
__pthread_map_stacks_exec is resolved to the libc version.  If a
library is loaded later, which requires adjustment of the stack
protection mode, rtld calls into libc __pthread_map_stacks_exec due to
the symbols scope.  The libc version might recurse into binder and
recursively acquire rtld bind lock, causing the hang.

Make libc __pthread_map_stacks_exec() interposed, which synchronizes
rtld locks and version of the stack exec hook when libthr loaded,
regardless of the symbol scope control or symbol resolution order.

The __pthread_map_stacks_exec() symbol is removed from the private
version in libthr since libc symbol now operates correctly in presence
of libthr.

Reported and tested by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoAdjust MAC allocation algo to support layering
dteske [Mon, 8 Feb 2016 17:47:36 +0000 (17:47 +0000)]
Adjust MAC allocation algo to support layering

8 years agoProvide additional information on overall purpose
dteske [Mon, 8 Feb 2016 17:36:46 +0000 (17:36 +0000)]
Provide additional information on overall purpose

8 years agoFix copy/paste error; s/ngX/eXb/
dteske [Mon, 8 Feb 2016 17:30:17 +0000 (17:30 +0000)]
Fix copy/paste error; s/ngX/eXb/

8 years agoRestore kgzldr on i386 only
emaste [Mon, 8 Feb 2016 16:59:52 +0000 (16:59 +0000)]
Restore kgzldr on i386 only

I previously disconnected kgzdr based on a misunderstanding.

I'd still like to transition to supporting only the loader(8)-based
boot path for handling compressed kernels, but that can follow the
standard deprecation procedure.

This reverts r291113.

Requested by: dteske

8 years agoRemove the assert which outlived its usefulness, and, by default,
kib [Mon, 8 Feb 2016 10:54:27 +0000 (10:54 +0000)]
Remove the assert which outlived its usefulness, and, by default,
disable compilation of the code which made it possible to call
stop_all_proc() from usermode at all.

Move the comment to the preamble of stop_all_proc() and reword it to
give overview of the function intent.

proc0 has P_HADTHREADS flag set due to kthread_add(), but no
P_KTHREAD, which triggered the assert, which does not serve a purpose
now.

Reported by: Oliver Pinter
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoAdd a format string to the err() calls.
adrian [Mon, 8 Feb 2016 02:11:34 +0000 (02:11 +0000)]
Add a format string to the err() calls.

8 years agoMake sure NANO_DISKIMGDIR exists.
imp [Sun, 7 Feb 2016 23:20:44 +0000 (23:20 +0000)]
Make sure NANO_DISKIMGDIR exists.

8 years agosemget(): Check for [EEXIST] error first.
jilles [Sun, 7 Feb 2016 22:12:39 +0000 (22:12 +0000)]
semget(): Check for [EEXIST] error first.

Although POSIX literally permits failing with [EINVAL] if IPC_CREAT and
IPC_EXCL were both passed, the semaphore set already exists and has fewer
semaphores than nsems, this does not allow an application to retry safely:
if the [EINVAL] is actually because of the semmsl limit, an infinite loop
would result.

PR: 206927

8 years agosemget(2): Add missing [EINVAL] conditions.
jilles [Sun, 7 Feb 2016 21:25:08 +0000 (21:25 +0000)]
semget(2): Add missing [EINVAL] conditions.

PR: 206927

8 years agoSimplify running the FreeBSD test suite
ngie [Sun, 7 Feb 2016 18:40:04 +0000 (18:40 +0000)]
Simplify running the FreeBSD test suite

Replace `make regress` (legacy test make target) and `make test` (incomplete
test make target added with the FreeBSD test suite) with make check as it's
consistent with other open source projects.

`make check` defaults to running tests from `.OBJDIR`, but can be overridden
with the `CHECKDIR` variable.

Add `make checkworld` target to simplify running the FreeBSD test suite from
`TESTSBASE` (i.e. the top-level tests directory), similar to buildworld.

Document `make check` and `make checkworld` in build(7).

Other minor changes:

- Rename intermediate file (`Kyuafile.auto`) to `Kyuafile` to simplify
  `make check`.
- Remove terse warnings attached to `beforetest`/`aftertest`.
- Add kyua binary check to check target in suite.test.mk; error out if it's
  not found

The MFC is [partly] contingent on other build related changes being MFCed.

Differential Revision: https://reviews.freebsd.org/D4406
MFC after: 2 months
X-MFC to: stable/10
Relnotes: yes
Reviewed by: bdrewery, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division

8 years agoUse new NANO_LOG to put the logs some place reasonable. Also, share
imp [Sun, 7 Feb 2016 16:44:13 +0000 (16:44 +0000)]
Use new NANO_LOG to put the logs some place reasonable. Also, share
the object directory among all builds where it makes sense. When
building with NANO_CPUTYPE, separate that out to its own object
directory. Put disk files in their own directories.

This should make having multiple variants of the same architecture
saner.

8 years agoUse NANO_LOG instead of NANO_OBJ for log file locations. Have it
imp [Sun, 7 Feb 2016 16:44:06 +0000 (16:44 +0000)]
Use NANO_LOG instead of NANO_OBJ for log file locations. Have it
default to NANO_OBJ.

8 years agoAdd simple config for i386 BIOS boot.
imp [Sun, 7 Feb 2016 16:44:04 +0000 (16:44 +0000)]
Add simple config for i386 BIOS boot.

8 years agoVarious fixups:
imp [Sun, 7 Feb 2016 16:43:55 +0000 (16:43 +0000)]
Various fixups:
o Make sure we create bsd label for MBR scheme (though we don't
  really need it for the efi case, and boot1 can't read it). Add
  notes about why we have to do this, at least for BIOS.
o Make the BIOS / UEFI with gpt config work.
o Remove now-moribund packaging stuff

8 years agoAdd two scripts for vnet jails
dteske [Sun, 7 Feb 2016 16:41:54 +0000 (16:41 +0000)]
Add two scripts for vnet jails

One for if_bridge(4) back-end, another for ng_bridge(4) back-end

Sponsored by: FIS Global, Inc.

8 years agoMinor grammar fix in comment.
pfg [Sun, 7 Feb 2016 16:18:12 +0000 (16:18 +0000)]
Minor grammar fix in comment.