freebsd.git
9 years agoFix build.
delphij [Sat, 25 Oct 2014 00:16:36 +0000 (00:16 +0000)]
Fix build.

9 years agocxgbe(4): bump up PF4's share of some global resources.
np [Sat, 25 Oct 2014 00:14:44 +0000 (00:14 +0000)]
cxgbe(4): bump up PF4's share of some global resources.

This increases the size of the per-port RSS slice and also allows the
driver to use a larger number of tx and rx queues.

MFC after: 2 weeks

9 years agoUse the __DECONST macro rather than hand rolling the same thing.
brooks [Fri, 24 Oct 2014 23:25:44 +0000 (23:25 +0000)]
Use the __DECONST macro rather than hand rolling the same thing.

Sponsored by: DARPA, AFRL

9 years agoFix the build by installing acpi_hpet.h correctly.
rpaulo [Fri, 24 Oct 2014 23:25:11 +0000 (23:25 +0000)]
Fix the build by installing acpi_hpet.h correctly.

Submitted by: jase
MFC after: 1 week

9 years agoRemove an unused variable that would be better spelled __func__.
brooks [Fri, 24 Oct 2014 23:24:47 +0000 (23:24 +0000)]
Remove an unused variable that would be better spelled __func__.

Sponsored by: DARPA, AFRL

9 years agoAdd an iicbus_reset() method to bcm2835_bsc. While it is generally not
loos [Fri, 24 Oct 2014 22:06:21 +0000 (22:06 +0000)]
Add an iicbus_reset() method to bcm2835_bsc.  While it is generally not
used for kernel devices it is used by i2c(8).

This fix the 'error: Device not configured' when i2c(8) tries to reset the
controller, as an example:

# i2c -r
Resetting I2C controller on /dev/iic0: error: Device not configured

For now use conservative settings for default i2c speeds.

MFC after: 1 week

9 years agoAdd a sysctl to control the HPET allow_write behaviour.
rpaulo [Fri, 24 Oct 2014 21:08:36 +0000 (21:08 +0000)]
Add a sysctl to control the HPET allow_write behaviour.

Requested by: kib

9 years agoFix cpsw_detach() to not panic when called from cpsw_attach().
loos [Fri, 24 Oct 2014 21:08:02 +0000 (21:08 +0000)]
Fix cpsw_detach() to not panic when called from cpsw_attach().

For an unkown reason (at moment), sometimes if_cpsw cannot read from PHY
and fails to attach calling cpsw_detach() which end up in a panic.

Fix it by doing the proper check before detach the miibus and also fix the
leak of few variables.

And to actually make it work, ether_ifattach() has to be moved to the end
of cpsw_attach() to avoid a race where calling ether_ifdetach() before
domain_init() (which will only run later on) would make it crash at
INP_INFO_RLOCK() on in_pcbpurgeif0().

Tested on: BBB (am335x)
MFC after: 1 week

9 years agoEliminate conf_lock and instead rely on the NSS write lock to protect
markj [Fri, 24 Oct 2014 20:29:14 +0000 (20:29 +0000)]
Eliminate conf_lock and instead rely on the NSS write lock to protect
NSS configuration state.

As a side effect, this fixes a race condition which can occur if multiple
threads call nsdispatch(3) concurrently before nsswitch.conf has been
parsed. Previously, the thread holding conf_lock could cause other threads
to return from nss_configure() before nsswitch.conf had been parsed, forcing
them to fall back to the default sources for their NSS methods.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D994
MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division

9 years agoThe current POSIX semaphore implementation stores the _has_waiters flag
jhb [Fri, 24 Oct 2014 20:02:44 +0000 (20:02 +0000)]
The current POSIX semaphore implementation stores the _has_waiters flag
in a separate word from the _count.  This does not permit both items to
be updated atomically in a portable manner.  As a result, sem_post()
must always perform a system call to safely clear _has_waiters.

This change removes the _has_waiters field and instead uses the high bit
of _count as the _has_waiters flag.  A new umtx object type (_usem2) and
two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to implement
these semantics.  The older operations are still supported under the
COMPAT_FREEBSD9/10 options.  The POSIX semaphore API in libc has
been updated to use the new implementation.  Note that the new
implementation is not compatible with the previous implementation.
However, this only affects static binaries (which cannot be helped by
symbol versioning).  Binaries using a dynamic libc will continue to work
fine.  SEM_MAGIC has been bumped so that mismatched binaries will error
rather than corrupting a shared semaphore.  In addition, a padding field
has been added to sem_t so that it remains the same size.

Differential Revision: https://reviews.freebsd.org/D961
Reported by: adrian
Reviewed by: kib, jilles (earlier version)
Sponsored by: Norse

9 years agoAdd COMPAT_FREEBSD9 and COMPAT_FREEBSD10 options to wrap code that
jhb [Fri, 24 Oct 2014 19:58:24 +0000 (19:58 +0000)]
Add COMPAT_FREEBSD9 and COMPAT_FREEBSD10 options to wrap code that
provides compatability for FreeBSD 9.x and 10.x binaries.  Enable
these options in kernel configs that enable other COMPAT_FREEBSD<n>
options.

9 years agoHPET: avoid handling the multiple file-descriptor case.
rpaulo [Fri, 24 Oct 2014 19:58:00 +0000 (19:58 +0000)]
HPET: avoid handling the multiple file-descriptor case.

It had two bugs: one where mmap was still allowed and another where
D_TRACKCLOSE doesn't handle all cases.

Thanks to jhb and kib for pointing them out.
MFC after: 1 week

9 years agoDon't reference sem(4) from the POSIX semaphore pages. POSIX semaphores
jhb [Fri, 24 Oct 2014 19:55:49 +0000 (19:55 +0000)]
Don't reference sem(4) from the POSIX semaphore pages.  POSIX semaphores
were reimplemented using umtx in FreeBSD 9 and no longer use sem(4).

9 years agoFix a bug where DMA maps created with bus_dmamap_create() won't increment
loos [Fri, 24 Oct 2014 19:18:39 +0000 (19:18 +0000)]
Fix a bug where DMA maps created with bus_dmamap_create() won't increment
the map count and without being able to keep track of the current map
allocation, bus_dma_tag_destroy() will fail to proceed and will return
EBUSY even after all the maps have been correctly destroyed with
bus_dmamap_destroy().

Found while testing the detach method of a NIC.

Tested on: BBB (am335x)
Reviewed by: cognet, ian
MFC after: 1 week

9 years agoHPET: create /dev/hpetN as a way to access HPET from userland.
rpaulo [Fri, 24 Oct 2014 18:39:15 +0000 (18:39 +0000)]
HPET: create /dev/hpetN as a way to access HPET from userland.

In some cases, TSC is broken and special applications might benefit
from memory mapping HPET and reading the registers to count time.
Most often the main HPET counter is 32-bit only[1], so this only gives
the application a 300 second window based on the default HPET
interval.
Other applications, such as Intel's DPDK, expect /dev/hpet to be
present and use it to count time as well.

Although we have an almost userland version of gettimeofday() which
uses rdtsc in userland, it's not always possible to use it, depending
on how broken the multi-socket hardware is.

Install the acpi_hpet.h so that applications can use the HPET register
definitions.

[1] I haven't found a system where HPET's main counter uses more than
32 bit.  There seems to be a discrepancy in the Intel documentation
(claiming it's a 64-bit counter) and the actual implementation (a
32-bit counter in a 64-bit memory area).

MFC after: 1 week
Relnotes: yes

9 years agoFix documentation issue.
melifaro [Fri, 24 Oct 2014 17:06:56 +0000 (17:06 +0000)]
Fix documentation issue.

PR: 194581
Submitted by: madpilot

9 years agoUpdate the network interface baudrate integer according to the actual
hselasky [Fri, 24 Oct 2014 16:39:01 +0000 (16:39 +0000)]
Update the network interface baudrate integer according to the actual
line rate.

Submitted by: jhb @
MFC after: 1 week

9 years ago- Add sys/types.h for the APIs in sys/sysctl.h
ngie [Fri, 24 Oct 2014 16:18:16 +0000 (16:18 +0000)]
- Add sys/types.h for the APIs in sys/sysctl.h
- Poke at VM_MIN_ADDRESS in machine/vmparam.h because FreeBSD doesn't have a
  vm.minaddress sysctl analog
- Expect ENOMEM instead of EAGAIN in mlock_limits
- Provide mlock an mmap'ed page twice to simulate MAP_WIRED on NetBSD

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoCorrect my previous commit:
ngie [Fri, 24 Oct 2014 16:07:31 +0000 (16:07 +0000)]
Correct my previous commit:

- getrusage_utime_back succeeds reliably on FreeBSD
- getrusage_utime_zero passes/fails in a seemingly non-deterministic manner.
  Skip it for now (and fix it later)

In the initial port of this testcase to FreeBSD, the results failed reliably
in the same manner as it does on NetBSD

Sponsored by: EMC / Isilon Storage Division

9 years agoAccept the documented FDT compatible string for the PL310 cache controller
ian [Fri, 24 Oct 2014 15:44:29 +0000 (15:44 +0000)]
Accept the documented FDT compatible string for the PL310 cache controller
as well as the non-standard string we've been using for a couple years.

9 years agoAdd D-Link DWA-123 rev D1 and Elecom WDC-150SU2M.
kevlo [Fri, 24 Oct 2014 15:36:30 +0000 (15:36 +0000)]
Add D-Link DWA-123 rev D1 and Elecom WDC-150SU2M.

9 years agoBump default dynamic limit to 16k entries.
melifaro [Fri, 24 Oct 2014 13:57:15 +0000 (13:57 +0000)]
Bump default dynamic limit to 16k entries.
Print better log message when limit is hit.

PR: 193300
Submitted by: me at nileshgr.com

9 years agoRemove redundant check and m_pullup() call.
ae [Fri, 24 Oct 2014 13:34:22 +0000 (13:34 +0000)]
Remove redundant check and m_pullup() call.

9 years agoFix displaying non-contiguous netmasks.
melifaro [Fri, 24 Oct 2014 13:29:12 +0000 (13:29 +0000)]
Fix displaying non-contiguous netmasks.

Found by: ae
Sponsored by: Yandex LLC

9 years agoImprove ctld.conf example.
trasz [Fri, 24 Oct 2014 12:30:43 +0000 (12:30 +0000)]
Improve ctld.conf example.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoMake the initiator-name and initiator-portal checks a little nicer.
trasz [Fri, 24 Oct 2014 11:40:09 +0000 (11:40 +0000)]
Make the initiator-name and initiator-portal checks a little nicer.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoTidy up the login code; no functional changes.
trasz [Fri, 24 Oct 2014 11:34:55 +0000 (11:34 +0000)]
Tidy up the login code; no functional changes.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoamd64: make uiomove_fromphys functional for pages not mapped by the DMAP
royger [Fri, 24 Oct 2014 09:48:58 +0000 (09:48 +0000)]
amd64: make uiomove_fromphys functional for pages not mapped by the DMAP

Place the code introduced in r268660 into a separate function that can be
called from uiomove_fromphys. Instead of pre-allocating two KVA pages use
vmem_alloc to allocate them on demand when needed. This prevents blocking if
a page fault is taken while physical addresses from outside the DMAP are
used, since the lock is now removed.

Also introduce a safety catch in PHYS_TO_DMAP and DMAP_TO_PHYS.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D947

amd64/amd64/pmap.c:
 - Factor out the code to deal with non DMAP addresses from pmap_copy_pages
   and place it in pmap_map_io_transient.
 - Change the code to use vmem_alloc instead of a set of pre-allocated
   pages.
 - Use pmap_qenter and don't pin the thread if there can be page faults.

amd64/amd64/uio_machdep.c:
 - Use pmap_map_io_transient in order to correctly deal with physical
   addresses not covered by the DMAP.

amd64/include/pmap.h:
 - Add the prototypes for the new functions.

amd64/include/vmparam.h:
 - Add safety catches to make sure PHYS_TO_DMAP and DMAP_TO_PHYS are only
   used with addresses covered by the DMAP.

9 years ago- Mark signo __unused in the signal handler function
ngie [Fri, 24 Oct 2014 06:57:16 +0000 (06:57 +0000)]
- Mark signo __unused in the signal handler function
- Effectively #if 0 out some code that does not fail on FreeBSD

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division

9 years ago- Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD
ngie [Fri, 24 Oct 2014 06:53:06 +0000 (06:53 +0000)]
- Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD
- Use #include "h_macros.h" instead of relative path analog

Sponsored by: EMC / Isilon Storage Division

9 years agoReturn BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree
delphij [Fri, 24 Oct 2014 06:27:45 +0000 (06:27 +0000)]
Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree
driver.  This change was verified by Microsoft.

9 years agoFix a leaked Storage Variable.
araujo [Fri, 24 Oct 2014 05:39:32 +0000 (05:39 +0000)]
Fix a leaked Storage Variable.

Phabric: D981
Submitted by: myself
Reported by: Coverity
CID: 1248848
Reworked by: kevlo
Reviewed by: marcel, davide, ray, kevlo
Approved by: marcel, kevlo

9 years agoFix formatting of vmstat (1) so that it looks cleaner on standard 80
mckusick [Fri, 24 Oct 2014 04:01:14 +0000 (04:01 +0000)]
Fix formatting of vmstat (1) so that it looks cleaner on standard 80
column displays. In particular it wraps far less often.

Submitted by: Andy Kosela <akosela@andykosela.com>
PR:           191976

9 years ago- Test for EINVAL requirement when passing an invalid flag in to msync(2)
ngie [Fri, 24 Oct 2014 03:53:49 +0000 (03:53 +0000)]
- Test for EINVAL requirement when passing an invalid flag in to msync(2)
- Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region
  on FreeBSD

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division

9 years ago- Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always
ngie [Fri, 24 Oct 2014 03:42:37 +0000 (03:42 +0000)]
- Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always
  executed on a non-devfs filesystem
- Expect mknod(path, S_IFREG, 0) to fail on FreeBSD

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoWhitespace
jhibbits [Fri, 24 Oct 2014 03:34:21 +0000 (03:34 +0000)]
Whitespace

X-MFC-with: r273570
MFC after: 1 week

9 years agoThree updates to PowerPC FBT:
jhibbits [Fri, 24 Oct 2014 03:33:01 +0000 (03:33 +0000)]
Three updates to PowerPC FBT:

* Use a constant to define the number of stack frames in a probe exception.
* Only allow function symbols in powerpc64 ('.' prefixed)
* Set the fbtp_roffset for return probes, so the correct dtrace_probe call is
  made.

MFC after: 1 week

9 years agoMove the duplicated code to a single function.
loos [Thu, 23 Oct 2014 23:20:04 +0000 (23:20 +0000)]
Move the duplicated code to a single function.

No functional changes.

9 years agoHook xo(1) to the build -- it's like echo, but uses libxo to
marcel [Thu, 23 Oct 2014 23:16:21 +0000 (23:16 +0000)]
Hook xo(1) to the build -- it's like echo, but uses libxo to
support emitting machine-readable output.

Sponsored by: Juniper Networks, Inc.

9 years agoHook libxo to the build.
marcel [Thu, 23 Oct 2014 23:14:23 +0000 (23:14 +0000)]
Hook libxo to the build.

Sponsored by: Juniper Networks, Inc.

9 years agoProvide a working GPIOBUS_IVAR() macro for FDT systems.
loos [Thu, 23 Oct 2014 23:12:30 +0000 (23:12 +0000)]
Provide a working GPIOBUS_IVAR() macro for FDT systems.

9 years agoIn all cases except CTLTYPE_STRING, penv is NULL here, so passing it
des [Thu, 23 Oct 2014 22:42:56 +0000 (22:42 +0000)]
In all cases except CTLTYPE_STRING, penv is NULL here, so passing it
indiscriminately to printf() and freeenv() is incorrect.  Add a NULL
check before freeenv(); as for printf(), we could use req.newptr
instead, but we'd have to select the correct format string based on
the type, and that's too much work for an error message, so just
remove it.

9 years agoAdd generated headers xoversion.h and xoconfig.h. These are the result
marcel [Thu, 23 Oct 2014 22:33:27 +0000 (22:33 +0000)]
Add generated headers xoversion.h and xoconfig.h. These are the result
of configuring the source tree:
% automake --add-missing
% autoconf
% ./configure

9 years agoImport libxo 0.1.4
marcel [Thu, 23 Oct 2014 22:30:14 +0000 (22:30 +0000)]
Import libxo 0.1.4

Obtained from: https://github.com/Juniper/libxo
Sponsored by: Juniper Networks, Inc.

9 years agoInstall a temporary workaround to avoid problems in fdt data with linux's
ian [Thu, 23 Oct 2014 22:21:22 +0000 (22:21 +0000)]
Install a temporary workaround to avoid problems in fdt data with linux's
workaround for an imx6 chip erratum.  Linux works around the bug with
changes in fdt data that we can't currently handle, so to enable running
with standard vendor-supplied fdt data, this watches for an attempt to map
the gpio1_6 interrupt and remaps it back to the standard ethernet interrupt.

This can be undone when the intrng project is completed and our gpio drivers
can also be interrupt controllers.

9 years agoUnder PAE ULONG is insufficient for representing the physical memory size. Use QUAD
alc [Thu, 23 Oct 2014 21:02:40 +0000 (21:02 +0000)]
Under PAE ULONG is insufficient for representing the physical memory size.  Use QUAD
for "hw.physmem" so that a physical memory size greater than 4 GB can be specified
from the boot loader.

9 years agoUse a static callout to drive key_timehandler() instead of timeout().
jhb [Thu, 23 Oct 2014 20:43:16 +0000 (20:43 +0000)]
Use a static callout to drive key_timehandler() instead of timeout().
While here, make key_timehandler() private to key.c.

Submitted by: bz (2)
Tested by: bz

9 years agoIn selfdfree re-evaulate sf_si after takin the lock.
mjg [Thu, 23 Oct 2014 19:06:08 +0000 (19:06 +0000)]
In selfdfree re-evaulate sf_si after takin the lock.

Otherwise we can race with doselwakeup.

This is a fixup to r273549

Reviewed by: jhb
Reported by: everyone and their dog

9 years agoTest if 'env' is NULL before doing memset() and strlen(),
delphij [Thu, 23 Oct 2014 18:23:50 +0000 (18:23 +0000)]
Test if 'env' is NULL before doing memset() and strlen(),
the caller may pass NULL to freeenv().

9 years agopuc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card.
rpaulo [Thu, 23 Oct 2014 18:03:27 +0000 (18:03 +0000)]
puc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card.

Submitted by: Alex Burlyga <alex.burlyga.ietf at gmail.com>
MFC after: 1 week

9 years agominor updates to make it more explicit that when using fpu_kern_thread,
jmg [Thu, 23 Oct 2014 17:24:50 +0000 (17:24 +0000)]
minor updates to make it more explicit that when using fpu_kern_thread,
you don't need to use fpu_kern_enter/_leave...

Reviewed by: kib

9 years agoAvoid taking the lock in selfdfree when not needed.
mjg [Thu, 23 Oct 2014 15:35:47 +0000 (15:35 +0000)]
Avoid taking the lock in selfdfree when not needed.

9 years agoChange the code to use the openpty(3) API which uses the pts(4) driver
emax [Thu, 23 Oct 2014 15:16:40 +0000 (15:16 +0000)]
Change the code to use the openpty(3) API which uses the pts(4) driver
instead of the pty(4) driver.

PR: 184597
Submitted by: tobias.rehbein
MFC after: 2 weeks

9 years agoMove if_get_counter initialization from if_attach into if_alloc.
ae [Thu, 23 Oct 2014 14:29:52 +0000 (14:29 +0000)]
Move if_get_counter initialization from if_attach into if_alloc.
Also, initialize all counters before ifnet will become available in the system.
This fixes possible access to uninitialized ifned fields.

PR: 194550

9 years agoFix a bug where some DTS layouts could cause the premature ending of the
loos [Thu, 23 Oct 2014 13:47:19 +0000 (13:47 +0000)]
Fix a bug where some DTS layouts could cause the premature ending of the
search (i.e. without returning any result) and you would end up with a
random MAC address.

Change the search algorithm to a recursive one to ensure that all the nodes
on DTS will be verified.

The previous algorithm could not keep up if the DTS has too many sub-nodes.

While here, fix the punctuation on comments.

9 years agovt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font
dumbbell [Thu, 23 Oct 2014 12:38:05 +0000 (12:38 +0000)]
vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font

To restore the default font using vidcontrol(1), use the "-f" flag
without an argument:
    vidcontrol -f < /dev/ttyv0

PR: 193910
Differential Revision: https://reviews.freebsd.org/D971
Submitted by: Marcin Cieslak <saper@saper.info>
Reviewed by: ray@, emaste@
Approved by: ray@
MFC after: 1 week

9 years agoClean up (refactor) discovery a little; no functional changes.
trasz [Thu, 23 Oct 2014 12:02:27 +0000 (12:02 +0000)]
Clean up (refactor) discovery a little; no functional changes.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoShow SFP+/QSFP memory map dump on higher verbose levels.
melifaro [Thu, 23 Oct 2014 11:01:49 +0000 (11:01 +0000)]
Show SFP+/QSFP memory map dump on higher verbose levels.

Sponsored by: Yandex LLC
MFC after: 1 week

9 years agoOmit the mprotect_exec testcase on FreeBSD
ngie [Thu, 23 Oct 2014 08:29:09 +0000 (08:29 +0000)]
Omit the mprotect_exec testcase on FreeBSD

Sponsored by: EMC / Isilon Storage Division

9 years agoMark signum __unused
ngie [Thu, 23 Oct 2014 08:13:07 +0000 (08:13 +0000)]
Mark signum __unused

Sponsored by: EMC / Isilon Storage Division

9 years agoFix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr)
ngie [Thu, 23 Oct 2014 08:12:31 +0000 (08:12 +0000)]
Fix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr)

9 years agoAdd limits.h #include for SSIZE_MAX
ngie [Thu, 23 Oct 2014 08:06:34 +0000 (08:06 +0000)]
Add limits.h #include for SSIZE_MAX

Sponsored by: EMC / Isilon Storage Division

9 years agoAdd limits.h #include for SSIZE_MAX
ngie [Thu, 23 Oct 2014 08:05:47 +0000 (08:05 +0000)]
Add limits.h #include for SSIZE_MAX

Sponsored by: EMC / Isilon Storage Division

9 years ago- Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al)
ngie [Thu, 23 Oct 2014 08:05:03 +0000 (08:05 +0000)]
- Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al)
- Expect overflow with rlim_max at INT64_MAX, not UINT64_MAX (rlim_t is int64_t
on FreeBSD)

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division

9 years ago- Mark sig/signo __unused
ngie [Thu, 23 Oct 2014 07:59:59 +0000 (07:59 +0000)]
- Mark sig/signo __unused
- Do not provide a relative path via #include "h_macros.h"

Sponsored by: EMC / Isilon Storage Division

9 years agoUse <atf_srcdir>/truncate_test.root_owned instead of /usr/bin/fpr as fpr does
ngie [Thu, 23 Oct 2014 07:54:46 +0000 (07:54 +0000)]
Use <atf_srcdir>/truncate_test.root_owned instead of /usr/bin/fpr as fpr does
not exist on FreeBSD

truncate_test.root_owned will be generated at build time and owned by root

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoAdd limits.h #include for INT_MAX
ngie [Thu, 23 Oct 2014 07:22:18 +0000 (07:22 +0000)]
Add limits.h #include for INT_MAX

Sponsored by: EMC / Isilon Storage Division

9 years ago- Omit the poll testcases on FreeBSD (they require pollts)
ngie [Thu, 23 Oct 2014 07:20:35 +0000 (07:20 +0000)]
- Omit the poll testcases on FreeBSD (they require pollts)
- Add necessary headers for the testcases

Sponsored by: EMC / Isilon Storage Division

9 years agoMark signo __unused in handler(..)
ngie [Thu, 23 Oct 2014 07:11:58 +0000 (07:11 +0000)]
Mark signo __unused in handler(..)

Sponsored by: EMC / Isilon Storage Division

9 years agoOmit all of the testcases as revoke(2) is only implemented on devfs(5)
ngie [Thu, 23 Oct 2014 07:07:35 +0000 (07:07 +0000)]
Omit all of the testcases as revoke(2) is only implemented on devfs(5)

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoOmit the pollts testcases on FreeBSD
ngie [Thu, 23 Oct 2014 07:05:14 +0000 (07:05 +0000)]
Omit the pollts testcases on FreeBSD

Sponsored by: EMC / Isilon Storage Division

9 years agoPort t_mmap.c to FreeBSD
ngie [Thu, 23 Oct 2014 06:42:53 +0000 (06:42 +0000)]
Port t_mmap.c to FreeBSD

- Add needed headers for the testcases
- Omit mmap_block on non-NetBSD OSes
- Use "security.bsd.map_at_zero" instead of "vm.user_va0_disable"

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoAdd sys/socket.h #include for struct sockaddr_in
ngie [Thu, 23 Oct 2014 06:35:19 +0000 (06:35 +0000)]
Add sys/socket.h #include for struct sockaddr_in

Sponsored by: EMC / Isilon Storage Division

9 years agoAdd limits.h #include for LINE_MAX
ngie [Thu, 23 Oct 2014 06:25:52 +0000 (06:25 +0000)]
Add limits.h #include for LINE_MAX

Sponsored by: EMC / Isilon Storage Division

9 years ago- Mark unused parameters __unused in handler
ngie [Thu, 23 Oct 2014 06:24:36 +0000 (06:24 +0000)]
- Mark unused parameters __unused in handler
- Call sigqueue with getpid() instead of 0 -- the latter idiom appears to only
be valid on NetBSD

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoConvert "fcntl(n, F_CLOSEM)" to "closefrom(n)"
ngie [Thu, 23 Oct 2014 06:21:10 +0000 (06:21 +0000)]
Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)"

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoPort t_pipe2.c to FreeBSD
ngie [Thu, 23 Oct 2014 06:18:28 +0000 (06:18 +0000)]
Port t_pipe2.c to FreeBSD

- Omit the pipe2_nosigpipe testcase on FreeBSD (FreeBSD doesn't have
  O_NOSIGPIPE).
- Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)".
- Save and restore the resource limit on the number of files (RLIMIT_NOFILE).

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoExpect getgroups_err to fail on FreeBSD
ngie [Thu, 23 Oct 2014 05:58:02 +0000 (05:58 +0000)]
Expect getgroups_err to fail on FreeBSD

PR: 189941
Submitted by: pho
Sponsored by: EMC / Isilon Storage Division

9 years agoAdd netinet/in.h for struct sockaddr_in
ngie [Thu, 23 Oct 2014 05:46:10 +0000 (05:46 +0000)]
Add netinet/in.h for struct sockaddr_in

Sponsored by: EMC / Isilon Storage Division

9 years agoAdd VirtIO console driver
bryanv [Thu, 23 Oct 2014 04:47:32 +0000 (04:47 +0000)]
Add VirtIO console driver

Support for the multiport feature is mostly implemented, but currently
disabled due to some potential races in the hot plug code paths.

Requested by: marcel
MFC after: 1 month
Relnotes: yes

9 years agoUnconditionally enable the clocks for all imx6 devices that we have drivers
ian [Thu, 23 Oct 2014 03:13:14 +0000 (03:13 +0000)]
Unconditionally enable the clocks for all imx6 devices that we have drivers
for, or that are required to run the chip (such as busses).  Turn off all
the devices we don't yet have drivers for.

Some day we will have a fully functional imx6 clock driver so that we can
manage clocks based on fdt data.  This will have to do until then.

9 years agoSync with NetBSD.
delphij [Thu, 23 Oct 2014 01:22:29 +0000 (01:22 +0000)]
Sync with NetBSD.

MFC after: 2 weeks

9 years agoMFV r273494: xz 5.0.7.
delphij [Thu, 23 Oct 2014 00:40:56 +0000 (00:40 +0000)]
MFV r273494: xz 5.0.7.

MFC after: 2 weeks

9 years agoMFV r273492: remove gettext files.
delphij [Thu, 23 Oct 2014 00:31:26 +0000 (00:31 +0000)]
MFV r273492: remove gettext files.

9 years agoPopulate the GELI passphrase cache with the kern.geom.eli.passphrase
cperciva [Wed, 22 Oct 2014 23:41:15 +0000 (23:41 +0000)]
Populate the GELI passphrase cache with the kern.geom.eli.passphrase
variable (if any) provided in the boot environment.  Unset it from
the kernel environment after doing this, so that the passphrase is
no longer present in kernel memory once we enter userland.

This will make it possible to provide a GELI passphrase via the boot
loader; FreeBSD's loader does not yet do this, but GRUB (and PCBSD)
will have support for this soon.

Tested by: kmoore

9 years agoFix some buglets in the error-handling of getdevice(). In particular, report
markj [Wed, 22 Oct 2014 23:35:56 +0000 (23:35 +0000)]
Fix some buglets in the error-handling of getdevice(). In particular, report
an error if the argument to pciconf -a doesn't have a unit number, rather
than triggering an assertion failure.

PR: 194506
Reported by: Anthony Cornehl <accornehl@gmail.com>
Sponsored by: EMC / Isilon Storage Division

9 years agoAvoid leaking data from the kernel environment: When we convert the
cperciva [Wed, 22 Oct 2014 23:35:32 +0000 (23:35 +0000)]
Avoid leaking data from the kernel environment: When we convert the
initial static environment to a dynamic one, zero the static environment
buffer, and zero individual values when kern_unsetenv and freeenv are
called.

Tested by: kmoore (VM memory dump + grep)
Tested by: cperciva (kernel panic dump + grep)

9 years agoClip the settings for the NFS rsize, wsize mount options
rmacklem [Wed, 22 Oct 2014 22:27:51 +0000 (22:27 +0000)]
Clip the settings for the NFS rsize, wsize mount options
to a power of 2. For non-power of 2 settings, intermittent
page faults have been reported. Although the bug that causes
these page faults/crashes has not been identified, it does
not appear to occur when rsize, wsize is a power of 2.

Reported by: tcberner@gmail.com
MFC after: 2 weeks

9 years agoRevert r273481 so it can be recoded using fls(), which
rmacklem [Wed, 22 Oct 2014 21:57:35 +0000 (21:57 +0000)]
Revert r273481 so it can be recoded using fls(), which
some feel will make it more readable.

9 years agoRename log2 to tal_log2.
melifaro [Wed, 22 Oct 2014 21:20:37 +0000 (21:20 +0000)]
Rename log2 to tal_log2.

Submitted by: luigi

9 years agoThe NetBSD libc tests use several definitions/macros that aren't available in
ngie [Wed, 22 Oct 2014 21:04:54 +0000 (21:04 +0000)]
The NetBSD libc tests use several definitions/macros that aren't available in
FreeBSD

Add the missing compat definitions/macros to lib/libnetbsd so the testcases
can be compiled with libnetbsd without having to invent ad hoc #define's, or
having to convert things over to FreeBSD idioms

Reviewed by: brooks
Phabric: D993
Sponsored by: EMC / Isilon Storage Division

9 years agoClip the settings for the NFS rsize, wsize mount options
rmacklem [Wed, 22 Oct 2014 20:47:11 +0000 (20:47 +0000)]
Clip the settings for the NFS rsize, wsize mount options
to a power of 2. For non-power of 2 settings, intermittent
page faults have been reported. Although the bug that causes
these page faults/crashes has not been identified, it does
not appear to occur when rsize, wsize is a power of 2.

Reported by: tcberner@gmail.com
MFC after: 2 weeks

9 years agocxgbe/iw_cxgbe: wake up waiters after flushing the qp.
np [Wed, 22 Oct 2014 18:55:44 +0000 (18:55 +0000)]
cxgbe/iw_cxgbe: wake up waiters after flushing the qp.

Obtained from: Chelsio

9 years agosince we cast a pointer, use the correct signedness
luigi [Wed, 22 Oct 2014 18:55:36 +0000 (18:55 +0000)]
since we cast a pointer, use the correct signedness
(this was already in, and got lost in a recent update).

9 years agoFix linking static test binaries with atf.test.mk
ngie [Wed, 22 Oct 2014 18:11:10 +0000 (18:11 +0000)]
Fix linking static test binaries with atf.test.mk

Check for -static in LDFLAGS or LDFLAGS.<test>, then pass in the appropriate
dependency (LIBATF or LDATF)

This unbreaks the build with some of the NetBSD tests that need to be compiled
statically

Reviewed by: imp, jmmv
Phabric: D991
Sponsored by: EMC / Isilon Storage Division

9 years agonetback: change xnb naming convention
royger [Wed, 22 Oct 2014 17:09:12 +0000 (17:09 +0000)]
netback: change xnb naming convention

Current FreeBSD netback names the interface with xnb<device unit>, but
this is not suitable for usage with the Xen toolstack, which expects
something similar to <prefix><domid><handle>. In order to solve this,
change the netback naming convention to use xnb<domid>.<handle>.

Sponsored by: Citrix Systems R&D

dev/xen/netback/netback.c:
 - Change netback to use the nomenclature stated above.

9 years agoxen: implement the privcmd user-space device
royger [Wed, 22 Oct 2014 17:07:20 +0000 (17:07 +0000)]
xen: implement the privcmd user-space device

This device is only attached to priviledged domains, and allows the
toolstack to interact with Xen. The two functions of the privcmd
interface is to allow the execution of hypercalls from user-space, and
the mapping of foreign domain memory.

Sponsored by: Citrix Systems R&D

i386/include/xen/hypercall.h:
amd64/include/xen/hypercall.h:
 - Introduce a function to make generic hypercalls into Xen.

xen/interface/xen.h:
xen/interface/memory.h:
 - Import the new hypercall XENMEM_add_to_physmap_range used by
   auto-translated guests to map memory from foreign domains.

dev/xen/privcmd/privcmd.c:
 - This device has the following functions:
   - Allow user-space applications to make hypercalls into Xen.
   - Allow user-space applications to map memory from foreign domains,
     this is accomplished using the newly introduced hypercall
     (XENMEM_add_to_physmap_range).

xen/privcmd.h:
 - Public ioctl interface for the privcmd device.

x86/xen/hvm.c:
 - Remove declaration of hypercall_page, now it's declared in
   hypercall.h.

conf/files:
 - Add the privcmd device to the build process.

9 years agoxen: add a Xen to BSD error translation
royger [Wed, 22 Oct 2014 16:58:52 +0000 (16:58 +0000)]
xen: add a Xen to BSD error translation

Since Xen and FreeBSD error codes are completely different add a
translation layer in order to convert Xen error codes into native
FreeBSD error codes. This will be used by the privcmd device, which
needs to return the hypercall errors into user-space.

Sponsored by: Citrix Systems R&D

xen/error.h:
 - Import Xen error codes.
 - Create a table to map Xen error codes into FreeBSD native error
   codes.
 - Create an inline function that performs the translation.

9 years agoxen: import a proper event channel user-space device
royger [Wed, 22 Oct 2014 16:57:11 +0000 (16:57 +0000)]
xen: import a proper event channel user-space device

The user-space event channel device is used by applications to receive
and send event channel interrupts. This device is based on the Linux
evtchn device.

Sponsored by: Citrix Systems R&D

xen/evtchn/evtchn_dev.c:
 - Remove the old event channel device, which was already disabled in
   the build system.

dev/xen/evtchn/evtchn_dev.c:
 - Import a new event channel device based on the one present in
   Linux.
 - This device allows the following operations:
   - Bind VIRQ event channels (ioctl).
   - Bind regular event channels (ioctl).
   - Create and bind new event channels (ioctl).
   - Unbind event channels (ioctl).
   - Send notifications to event channels (ioctl).
   - Reset the device shared memory ring (ioctl).
   - Unmask event channels (write).
   - Receive event channel upcalls (read).
 - The new code is MP safe, and can be used concurrently.

conf/files:
 - Add the new device to the build system.

9 years agoxen: allow to register event channels without handlers
royger [Wed, 22 Oct 2014 16:51:52 +0000 (16:51 +0000)]
xen: allow to register event channels without handlers

This is needed by the event channel user-space device, that requires
registering event channels without unmasking them. intr_add_handler
will unconditionally unmask the event channel, so we avoid calling it
if no filter/handler is provided, and then the user will be in charge
of calling it when ready.

In order to do this, we need to change the opaque type
xen_intr_handle_t to contain the event channel port instead of the
opaque cookie returned by intr_add_handler, since now registration of
event channels without handlers are allowed. The cookie will now be
stored inside of the private xenisrc struct. Also, introduce a new
function called xen_intr_add_handler that allows adding a
filter/handler after the event channel has been registered.

Sponsored by: Citrix Systems R&D

x86/xen/xen_intr.c:
 - Leave the event channel without a handler if no filter/handler is
   provided to xen_intr_bind_isrc.
 - Don't perform an evtchn_mask_port, intr_add_handler will already do
   it.
 - Change the opaque type xen_intr_handle_t to contain a pointer to
   the event channel port number, and make the necessary changes to
   related functions.
 - Introduce a new function called xen_intr_add_handler that can be
   used to add filter/handlers to an event channel after registration.

xen/xen_intr.h:
 - Add prototype of xen_intr_add_handler.