Commit Graph

220035 Commits

Author SHA1 Message Date
Adrian Chadd
99baf303e7 [iwm] Implement apmg_wake_up_wa workaround properly for 7000 family.
* Add iwm_pcie_set_cmd_in_flight() and iwm_pcie_clear_cmd_in_flight()
  helper methods.

* Use ring->queued tracking in the command queue to set/clear the
  cmd_hold_nic_awake bit at the right points.

Taken-From: Linux iwlwifi

Obtained from:	DragonflyBSD commit ce43f57f5308b579ea21e8a5a29969114ba2247d
2017-02-08 06:53:23 +00:00
Adrian Chadd
82ba706cba [iwm] Use iwm_mvm_scan_stop_wait to properly abort scans.
* Add IWM_FLAG_SCAN_RUNNING to sc->sc_flags to track whether the firmware
  is currently running a scan, in order to decide wheter iwm_scan_end
  needs to abort a running scan.

* In iwm_scan_end, if the scan is still running, we now abort it, in order
  to keep the firmware scanning state in sync.

* Try to make things a bit simpler, by reacting on the
  IWM_SCAN_OFFLOAD_COMPLETE and IWM_SCAN_COMPLETE_UMAC notifications,
  instead of IWM_SCAN_ITERATION_COMPLETE and
  IWM_SCAN_ITERATION_COMPLETE_UMAC. This should be fine since we always
  only tell the firmware to do a single scan iteration anyway.

Obtained from:	DragonflyBSD commit 1f249c981c4e89e7cde1836a75b61cac36dc7ac5
2017-02-08 06:50:59 +00:00
Adrian Chadd
4b17c18882 [iwm] Add scan abort functions, to properly cancel a running scan.
* Uses the notification wait api to wait for the corresponding scan
  complete notification after sending the abort command.

Taken-From: Linux iwlwifi

Obtained from:	DragonflyBSD commit b484d09d54301740f036ddf02008117f563960c2
2017-02-08 06:44:50 +00:00
Adrian Chadd
760f56b7b8 [iwm] Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.
* This also fixes one of many small nic lock handling bugs, and matches
  iwlwifi's code.

Obtained from:	DragonflyBSD git 50787d03cd0a0366c9cc4a055bb6977e5f65c85d
2017-02-08 06:43:02 +00:00
Justin Hibbits
9569e13dce Add elf*-powerpc-freebsd targets to the elftoolchain target list
FreeBSD uses the full target triple when generating embedded rootfs images
(MFS_IMAGE= make option).  Without this change objcopy errors out with:

objcopy: elf64-poewrpc-freebsd: invalid target name

MFC after:	2 weeks
2017-02-08 03:21:29 +00:00
Ravi Pokala
0ee82391df Fix indentation (only line in file w/ 8-space indent rather than hard-tab).
MFH:		1 week
2017-02-08 00:02:54 +00:00
John Baldwin
dcbe5188da Defer startup of gjournal switcher kproc.
Don't start switcher kproc until the first GEOM is created.

Reviewed by:	pjd
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8576
2017-02-07 22:45:59 +00:00
John Baldwin
885f13dc96 Copy the e_machine and e_flags fields from the binary into an ELF core dump.
In the kernel, cache the machine and flags fields from ELF header to use in
the ELF header of a core dump. For gcore, the copy these fields over from
the ELF header in the binary.

This matters for platforms which encode ABI information in the flags field
(such as o32 vs n32 on MIPS).

Reviewed by:	kib
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D9392
2017-02-07 20:34:03 +00:00
Enji Cooper
e0f389edab Improve libnetbsd compatibility with NetBSD
This change is being made to diff reduce/reduce duplication in
contrib/netbsd-tests and to facilitate further porting of software from
NetBSD

Add the following headers:
- sys/event.h:
-- sys/types.h is required for kqueue on FreeBSD, but not NetBSD.
- sys/types.h:
-- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD.
   Pull in sys/param.h to have parity with NetBSD.
- sys/wait.h:
-- Define wrusage as __wrusage for parity with NetBSD typedef.
- glob.h
-- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef.
- pthread.h:
-- Pull in pthread_np.h for _np functions defined separately on FreeBSD.

Improve compatibility with NetBSD in the following headers:

- sha1.h:
-- define SHA1_CTX as SHA_CTX
-- define SHA1Final as SHA1_Final
- sha2.h:
-- #include sha384 to pick up all of the SHA 384 bit macros and definitions.
- util.h:
-- Add sys/types.h to util.h to pollute the header for types used in
   flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them
   for the functions.

MFC after:      2 weeks
Sponsored by:   Dell EMC Isilon
2017-02-07 19:42:41 +00:00
Emmanuel Vadot
58256cf76e Rename timer.c to a10_timer.c
Requested by: andrew
2017-02-07 19:28:32 +00:00
Eric van Gyzen
edf0313b70 Fix garbage IP addresses in UDP log_in_vain messages
If multiple threads emit a UDP log_in_vain message concurrently,
the IP addresses could be garbage due to concurrent usage of a
single string buffer inside inet_ntoa().  Use inet_ntoa_r() with
two stack buffers instead.

Reported by:	Mark Martinec <Mark.Martinec+freebsd@ijs.si>
MFC after:	3 days
Relnotes:	yes
Sponsored by:	Dell EMC
2017-02-07 18:57:57 +00:00
Enji Cooper
fa841eb67a Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
YYINT on FreeBSD is int, not short

I'll work with the upstream maintainer or come up with a build
method of modifying their definitions on install instead of
having to modify tests to match our forked YYINT definition.

PR:		216891
Sponsored by:	Dell EMC Isilon
2017-02-07 18:37:46 +00:00
Enji Cooper
e58164041c Don't expect :inplace_symlink_src to fail anymore (post-r313277)
The S_ISREG check was restored, such that the code will again fail with
in-place replacements on symlinks

MFC after:	12 days
X-MFC with:	r313277
Sponsored by:	Dell EMC Isilon
2017-02-07 18:23:44 +00:00
Andrew Turner
f17e4f0759 Push reading of ESR_EL1 to assembly. Among other uses this will allow us
to expose this to signal handlers, e.g. for the clang sanitizers.

Sponsored by:	DARPA, AFRL
2017-02-07 18:19:11 +00:00
Alan Somers
9d6c66cb9f Add fibs_test:udp_dontroute6, another IPv6 multi-FIB test
PR:		196361
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-02-07 17:40:59 +00:00
Emmanuel Vadot
beaa6e1e64 subr_sfbus.c need sys/proc.h for struct thread definition.
This fixes kernel build for armv6.

Discussed with: kib
2017-02-07 17:31:24 +00:00
Emmanuel Vadot
b816ce78eb Switch to the Linux device tree upstream names for Allwinner boards.
Newer u-boot that uses the u-boot-master port uses these names.
2017-02-07 17:15:13 +00:00
Mateusz Guzik
dbccc8105c rwlock: implement RW_LOCK_WRITER_RECURSED bit
This moves recursion handling out of the inlined wunlock path and in
particular saves a read and a branch.

Discussed with:
2017-02-07 17:04:31 +00:00
Mateusz Guzik
f743ea9638 Bump struct thread alignment to 32.
This gives additional bits to use in locking primitives which store
the lock thread pointer in the lock value.

Discussed with:	kib
2017-02-07 17:03:22 +00:00
Mateusz Guzik
3c798b2b1f locks: follow up r313386
Unfinished diff was committed by accident. The loop in lock_delay
was changed to decrement, but the loop iterator was still incrementing.
2017-02-07 16:01:07 +00:00
Emmanuel Vadot
9f0b20a57c efipart is also using the '%S' printf format, add -Wno-format for it.
This fix building for armv6.
2017-02-07 15:16:01 +00:00
Mateusz Guzik
8e5a3e9a9d locks: change backoff to exponential
Previous implementation would use a random factor to spread readers and
reduce chances of starvation. This visibly reduces effectiveness of the
mechanism.

Switch to the more traditional exponential variant. Try to limit starvation
by imposing an upper limit of spins after which spinning is half of what
other threads get. Note the mechanism is turned off by default.

Reviewed by:	kib (previous version)
2017-02-07 14:49:36 +00:00
Andrew Turner
5267f6243d Add support for PLATFORM and PLATFORM_SMP to the Altera SOCFPGA SoC. This
will help with moving it to GENERIC.

Reviewed by:	br
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9461
2017-02-07 12:04:04 +00:00
Enji Cooper
9a41ce4a69 Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type
The %t{d,u} (ptrdiff_t) tests fail for the following reasons:
- ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on
  LP64 architectures.
- intmax_t is by definition fixed to int64_t on all architectures.
- Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t
  when parsing/representing the value.

PR:		191674
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 05:39:00 +00:00
Enji Cooper
1eca9a9a49 Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use
The reasoning here was the same as what was done in r313376:
- Gather as many results as possible instead of failing early and
  not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
  test result.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 04:25:21 +00:00
Enji Cooper
87e886953f Expect :floatunditf to fail on FreeBSD/i386
The precision error on FreeBSD/i386 doesn't match the expected output in
long double form.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 04:15:41 +00:00
Enji Cooper
0653d1fb68 Fix :hexadecimal_floating_point on i386
Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.

While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gather as many results as possible instead of failing early and
  not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
  test result.

Tested on:	amd64, i386
MFC after: 	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 03:46:48 +00:00
Enji Cooper
d5f154d3cf hcreate(3): fix the ERRORS section and bump .Dd
- Add missing comma between functions that trigger ENOMEM error.
- Fix the description for ESRCH. The action that triggers this error is
  FIND, not SEARCH (SEARCH does not exist).

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 02:32:49 +00:00
Adrian Chadd
f45d974ee9 [ath] prepare for station side quiet time support.
* Track the current quiet time configuration in the ath_vap struct.
* Add an accessor method for calling the quiet time HAL method.
2017-02-07 02:21:34 +00:00
Enji Cooper
916aa57754 Sort sys/ #includes some more
MFC after:	1 week
X-MFC with:	r313358
Sponsored by:	Dell EMC Isilon
2017-02-07 01:28:55 +00:00
George V. Neville-Neil
c499408f8b Fix the ifdef protection and remove superfluous extern statements
Reported by:	Konstantin Belousov
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-02-07 01:21:18 +00:00
Enji Cooper
688e4de4e7 Sort sys/ #includes and zap an unnecessary trailing space nearby
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 00:47:33 +00:00
Enji Cooper
72e282471c Use a flexible array for TypeNames instead of hardcoding the array length
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 00:42:55 +00:00
Enji Cooper
bc64f428ad Fix typos in comments (returing -> returning)
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 00:09:48 +00:00
Adrian Chadd
33e3a18876 [iwm] fix path. 2017-02-06 21:02:26 +00:00
Edward Tomasz Napierala
69cdfcef2e Add kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), kern_vm_munlock(),
kern_vm_munmap(), and kern_vm_madvise(), and use them in various compats
instead of their sys_*() counterparts.

Reviewed by:	ed, dchagin, kib
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9378
2017-02-06 20:57:12 +00:00
Edward Tomasz Napierala
1110d0029a Make root_mount_hold() work after boot. This is important for two
reasons. First is rerooting into USB-mounted device that happens
to be not yet enumerated. The second is when mounting with (non-root)
filesystem on USB device on a hub that's enumerated later than the root
mount: the rc scripts explicitly mount for the root mount holds to be
released, but each USB bus takes the hold asynchronously, and if that
happens after root mount, it would just get ignored.

Reviewed by:	marcel
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9388
2017-02-06 20:44:34 +00:00
Edward Tomasz Napierala
4f9d7bad48 In r290196 the root mount hold mechanism was changed to make it not wait
for mount hold release if the root device already exists.  So, unless your
rootdev is not on USB - ie in the usual case - the root mount won't wait
for USB.  However, the old behaviour was sometimes used as "wait until USB
is fully enumerated", and r290196 broke that.

This commit adds vfs.root_mount_always_wait tunable, to force the kernel
to always wait for root mount holds, even if the root is already there.

Reviewed by:	kib
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9387
2017-02-06 20:36:59 +00:00
Toomas Soome
7b02037ef8 loader: disk io should not use alloca()
The alloca() does give us pointer and we have no practical way to check if the
area is actually available, resulting in corruption in corner cases.

Unfortunately we do not have too many options right now, but to use one page.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9455
2017-02-06 18:44:15 +00:00
Toomas Soome
35c46ba5bd loader: biosdisk fix for 2+TB disks
This fix is implementing partition based boundary check for
disk IO and updates disk mediasize (if needed), based on information
from partition table.

As it appeared, the signed int based approach still has corner cases,
and the wrapover based behavior is non-standard.

The idea for this fix is based on two assumptions:

The bug about media size is hitting large (2+TB) disks, lesser disks
hopefully, are not affected.

Large disks are using GPT (which does include information about disk size).
Since our concern is about boot support and boot disks are partitioned,
implementing partition boundaries based IO verification should make the
media size issues mostly disappear.

However, for large disk case, we do have the disk size available from GPT table.
If non-GPT cases will appear, we still can make approximate calculation about
disk size based on defined partition(s), however, this is not the objective
of this patch, and can be added later if there is any need.

This patch does implement disk media size adjustment (if needed) in bd_open(),
and boundary check in bd_realstrategy().

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8595
2017-02-06 18:29:43 +00:00
Andrew Turner
2c40450667 Remove arm64_tlb_flushID_SE, it's unused and may be wrong.
Sponsored by:	ABT Systems Ltd
2017-02-06 17:50:09 +00:00
Navdeep Parhar
eaf5669483 cxgbe/t4_tom: Fix CLIP entry refcounting on the passive side. Every
IPv6 connection being handled by the TOE should have a reference on its
CLIP entry.

Sponsored by:	Chelsio Communications
2017-02-06 17:48:25 +00:00
Konstantin Belousov
3b7a388b3e Update arm and arm64 counters MD bits.
On arm64 use atomics.  Then, both arm and arm64 do not need a critical
section around update.  Replace all cpus loop by CPU_FOREACH().
This brings arm and arm64 counter(9) implementation closer to current
amd64, but being more RISC-y, arm* version cannot avoid atomics.

Reported by:	Alexandre Martins <alexandre.martins@stormshield.eu>
Reviewed by:	andrew
Tested by:	Alexandre Martins, andrew
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-02-06 17:20:37 +00:00
Andrew Turner
ff95aff79e Temporary disable gicv3_its.c when FDT is missing from the kernel until
INTRNG supports ACPI.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2017-02-06 15:24:52 +00:00
Stanislav Galabov
59cd18b093 sys/arm/arm/identcpu-v4.c: fix identify_arm_cpu()
identify_arm_cpu() in sys/arm/arm/identcpu-v4.c incorrectly uses a
u_int8_t variable to store the result of cpu_get_control().
It should really use a u_int variable, the same way as done for cpu_ident()
in the same function, as both cpuid and control registers are 32-bit..
This issue causes users of identcpu-v4 to incorrectly report things such as
icache status (bit 12 in cpu control register) and basically anything
defined in bits above bit 7 :-)

Reviewed by:	manu
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D9460
2017-02-06 14:58:24 +00:00
Andrew Turner
db6a9c12ba Only build the ACPI PCI drivers on x86, they are unlikely to be used on
arm64 without dignificant changes.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2017-02-06 14:41:34 +00:00
Alexander Kabaev
7b6d9d0c3a Use 64bit store instruction in atomic_fcmpset_64.
Reported by: br
2017-02-06 14:00:28 +00:00
Andrew Turner
c0d5237034 Only allow the pic type to be either a PIC or MSI type. All interrupt
controller drivers handle either MSI/MSI-X interrupts, or regular
interrupts, as such enforce this in the interrupt handling framework.
If a later driver was to handle both it would need to create one of each.

This will allow future changes to allow the xref space to overlap, but
refer to different drivers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
X-Differential Revision:	https://reviews.freebsd.org/D8616
2017-02-06 13:08:48 +00:00
Sean Bruno
84c90bee4d gxemul:
Add a format string to call to g_new_providerf() found when compiling
mips64 target with clang.

Reviewed by:	brooks
2017-02-06 11:37:20 +00:00
Toomas Soome
8df1c280b8 loader: 313329 missed ZFS guard in loader/main.c
Missing guard added.

Reviewed by:	imp, allanjude
Approved by:	imp (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9458
2017-02-06 10:57:54 +00:00