]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFhead@r313433
ngie [Wed, 8 Feb 2017 08:55:05 +0000 (08:55 +0000)]
MFhead@r313433

7 years ago[iwm] Remove 1s delay after fw loading. Can't reproduce issues on AC8260.
adrian [Wed, 8 Feb 2017 07:09:10 +0000 (07:09 +0000)]
[iwm] Remove 1s delay after fw loading. Can't reproduce issues on AC8260.

The 1s delay was added in the update to version 16 fw, where Family 8000
support was added.

Obtained from: DragonflyBSD commit bb480ca679a7ea530bdca6e41082d5755e9751dc

7 years ago[iwm] SCAN_ABORT_UMAC response doesn't use a wide id
adrian [Wed, 8 Feb 2017 07:08:13 +0000 (07:08 +0000)]
[iwm] SCAN_ABORT_UMAC response doesn't use a wide id

Obtained from: DragonflyBSD commit cef47a9cbb0a3ce5f18369fed9403d2764884bc2

7 years ago[iwm] back this out to version 16 for now.
adrian [Wed, 8 Feb 2017 07:07:23 +0000 (07:07 +0000)]
[iwm] back this out to version 16 for now.

Since I'm manually playing the dragonflybsd iwm/iwmfw commits forward, I'm ..
well, this.  This right here.

7 years ago[iwm] Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.
adrian [Wed, 8 Feb 2017 07:05:56 +0000 (07:05 +0000)]
[iwm] Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.

* Will be needed for loading version 22 of 7265D firmware.

Obtained from: DragonflyBSD commit 1d244c8133cf15d00d46836bc48958188cf9f510

7 years ago[iwm] bump firmware to version 17.
adrian [Wed, 8 Feb 2017 07:04:06 +0000 (07:04 +0000)]
[iwm] bump firmware to version 17.

7 years ago[iwm] add version 17 firmware.
adrian [Wed, 8 Feb 2017 07:03:52 +0000 (07:03 +0000)]
[iwm] add version 17 firmware.

7 years ago[iwm] add this 3 megabyte firmware image.
adrian [Wed, 8 Feb 2017 07:03:09 +0000 (07:03 +0000)]
[iwm] add this 3 megabyte firmware image.

7 years ago[iwm] add version 17 firmware.
adrian [Wed, 8 Feb 2017 07:02:09 +0000 (07:02 +0000)]
[iwm] add version 17 firmware.

7 years ago[iwm] add version 17 firmware.
adrian [Wed, 8 Feb 2017 07:01:58 +0000 (07:01 +0000)]
[iwm] add version 17 firmware.

7 years ago[iwm] add version 17 firmware.
adrian [Wed, 8 Feb 2017 07:01:31 +0000 (07:01 +0000)]
[iwm] add version 17 firmware.

7 years ago[iwm] Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.
adrian [Wed, 8 Feb 2017 06:57:21 +0000 (06:57 +0000)]
[iwm] Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.

* Add the command groups enum, and the iwm_phy_ops_subcmd_ids enum
  to if_iwmreg.h definitions.

* The IWM_DTS_MEASUREMENT_NOTIF_WIDE notification will be generated by
  version 17 firmware.

Taken-From: Linux iwlwifi

Obtained from: DragonflyBSD commit 4d8d6f9def2ffb60aaf2d88f72f069a96c0b4e3f

7 years ago[iwm] Very basic DTS thermal sensor support (prints temp as debug msg).
adrian [Wed, 8 Feb 2017 06:56:28 +0000 (06:56 +0000)]
[iwm] Very basic DTS thermal sensor support (prints temp as debug msg).

* Adds IWM_DEBUG_TEMP debug message type, for printing messages related
  to temperature sensors and thermal/TDP infos.

* The firmware regularly sends us DTS measurement notifications, so just
  print the temperature value as a debugging message.

(Adrian's addition):

* Eventually this can be used by the driver to limit transmit rate / power to
  try and do some thermal throttling.

Obtained from: DragonflyBSD commit efb7d4eb5c3140889a8880e12fd83c7bbfd0059d

7 years ago[iwm] Only for family 7000 power-down busmaster DMA clocks when stopping.
adrian [Wed, 8 Feb 2017 06:54:08 +0000 (06:54 +0000)]
[iwm] Only for family 7000 power-down busmaster DMA clocks when stopping.

Taken-From: Linux iwlwifi

Obtained from: DragonflyBSD commit 4c45994fcc77373ae2fb0901db15368c9731f641

7 years ago[iwm] Implement apmg_wake_up_wa workaround properly for 7000 family.
adrian [Wed, 8 Feb 2017 06:53:23 +0000 (06:53 +0000)]
[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

7 years ago[iwm] Use iwm_mvm_scan_stop_wait to properly abort scans.
adrian [Wed, 8 Feb 2017 06:50:59 +0000 (06:50 +0000)]
[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

7 years ago[iwm] Add scan abort functions, to properly cancel a running scan.
adrian [Wed, 8 Feb 2017 06:44:50 +0000 (06:44 +0000)]
[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

7 years ago[iwm] Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.
adrian [Wed, 8 Feb 2017 06:43:02 +0000 (06:43 +0000)]
[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

7 years agoAdd elf*-powerpc-freebsd targets to the elftoolchain target list
jhibbits [Wed, 8 Feb 2017 03:21:29 +0000 (03:21 +0000)]
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

7 years agoFix indentation (only line in file w/ 8-space indent rather than hard-tab).
rpokala [Wed, 8 Feb 2017 00:02:54 +0000 (00:02 +0000)]
Fix indentation (only line in file w/ 8-space indent rather than hard-tab).

MFH: 1 week

7 years agoDefer startup of gjournal switcher kproc.
jhb [Tue, 7 Feb 2017 22:45:59 +0000 (22:45 +0000)]
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

7 years agoCopy the e_machine and e_flags fields from the binary into an ELF core dump.
jhb [Tue, 7 Feb 2017 20:34:03 +0000 (20:34 +0000)]
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

7 years agoMFhead@r313404
ngie [Tue, 7 Feb 2017 19:47:30 +0000 (19:47 +0000)]
MFhead@r313404

7 years agoRemove placeholder compat header for stdio.h
ngie [Tue, 7 Feb 2017 19:47:04 +0000 (19:47 +0000)]
Remove placeholder compat header for stdio.h

In the end, dealing with fparseln was more bikeshed worthy than I
anticipated, and polling stdio.h with libutil.h caused me more
grief than necessary. Keeping the compat header around for no
reason other than include_next'ing the stdio.h header in FreeBSD
makes no sense.

7 years agoImprove libnetbsd compatibility with NetBSD
ngie [Tue, 7 Feb 2017 19:42:41 +0000 (19:42 +0000)]
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

7 years agoRename timer.c to a10_timer.c
manu [Tue, 7 Feb 2017 19:28:32 +0000 (19:28 +0000)]
Rename timer.c to a10_timer.c

Requested by: andrew

7 years agoOops... put the atf_tc_expect_fail in the testcase definition, not the
ngie [Tue, 7 Feb 2017 19:02:59 +0000 (19:02 +0000)]
Oops... put the atf_tc_expect_fail in the testcase definition, not the
test suite definition

7 years agoFix garbage IP addresses in UDP log_in_vain messages
vangyzen [Tue, 7 Feb 2017 18:57:57 +0000 (18:57 +0000)]
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

7 years agoExpect the t_precision long double checks to fail on FreeBSD/i386
ngie [Tue, 7 Feb 2017 18:57:52 +0000 (18:57 +0000)]
Expect the t_precision long double checks to fail on FreeBSD/i386

There are some potential issues with the test (as brd@ has pointed out
elsewhere) with precision, etc not being set before the test, but as
always, more research is required.

7 years agoMFhead@r313398
ngie [Tue, 7 Feb 2017 18:47:16 +0000 (18:47 +0000)]
MFhead@r313398

7 years agoApply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
ngie [Tue, 7 Feb 2017 18:37:46 +0000 (18:37 +0000)]
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

7 years agoDon't expect :inplace_symlink_src to fail anymore (post-r313277)
ngie [Tue, 7 Feb 2017 18:23:44 +0000 (18:23 +0000)]
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

7 years agoPush reading of ESR_EL1 to assembly. Among other uses this will allow us
andrew [Tue, 7 Feb 2017 18:19:11 +0000 (18:19 +0000)]
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

7 years agoAdd fibs_test:udp_dontroute6, another IPv6 multi-FIB test
asomers [Tue, 7 Feb 2017 17:40:59 +0000 (17:40 +0000)]
Add fibs_test:udp_dontroute6, another IPv6 multi-FIB test

PR: 196361
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agosubr_sfbus.c need sys/proc.h for struct thread definition.
manu [Tue, 7 Feb 2017 17:31:24 +0000 (17:31 +0000)]
subr_sfbus.c need sys/proc.h for struct thread definition.
This fixes kernel build for armv6.

Discussed with: kib

7 years agoSwitch to the Linux device tree upstream names for Allwinner boards.
manu [Tue, 7 Feb 2017 17:15:13 +0000 (17:15 +0000)]
Switch to the Linux device tree upstream names for Allwinner boards.
Newer u-boot that uses the u-boot-master port uses these names.

7 years agorwlock: implement RW_LOCK_WRITER_RECURSED bit
mjg [Tue, 7 Feb 2017 17:04:31 +0000 (17:04 +0000)]
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:

7 years agoBump struct thread alignment to 32.
mjg [Tue, 7 Feb 2017 17:03:22 +0000 (17:03 +0000)]
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

7 years agolocks: follow up r313386
mjg [Tue, 7 Feb 2017 16:01:07 +0000 (16:01 +0000)]
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.

7 years agoefipart is also using the '%S' printf format, add -Wno-format for it.
manu [Tue, 7 Feb 2017 15:16:01 +0000 (15:16 +0000)]
efipart is also using the '%S' printf format, add -Wno-format for it.
This fix building for armv6.

7 years agolocks: change backoff to exponential
mjg [Tue, 7 Feb 2017 14:49:36 +0000 (14:49 +0000)]
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)

7 years agoAdd support for PLATFORM and PLATFORM_SMP to the Altera SOCFPGA SoC. This
andrew [Tue, 7 Feb 2017 12:04:04 +0000 (12:04 +0000)]
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

7 years agoAdd #else case in run(..) to fix test on non-{amd64,arm64,mips} after
ngie [Tue, 7 Feb 2017 06:34:02 +0000 (06:34 +0000)]
Add #else case in run(..) to fix test on non-{amd64,arm64,mips} after
recent refactoring to the test

7 years agoMFhead@r313380
ngie [Tue, 7 Feb 2017 06:04:13 +0000 (06:04 +0000)]
MFhead@r313380

7 years agoExpect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type
ngie [Tue, 7 Feb 2017 05:39:00 +0000 (05:39 +0000)]
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

7 years agoWrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use
ngie [Tue, 7 Feb 2017 04:25:21 +0000 (04:25 +0000)]
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

7 years agoExpect :floatunditf to fail on FreeBSD/i386
ngie [Tue, 7 Feb 2017 04:15:41 +0000 (04:15 +0000)]
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

7 years agoFix :hexadecimal_floating_point on i386
ngie [Tue, 7 Feb 2017 03:46:48 +0000 (03:46 +0000)]
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

7 years agoExpect :hsearch_r_nonexistent to fail on FreeBSD
ngie [Tue, 7 Feb 2017 02:57:11 +0000 (02:57 +0000)]
Expect :hsearch_r_nonexistent to fail on FreeBSD

The docs and the behavior mismatch; as noted in the bug, the behavior
for hsearch_r matches Linux, whereas the docs seem to match NetBSD
requirements wise.

PR: 216872

7 years agohcreate(3): fix the ERRORS section and bump .Dd
ngie [Tue, 7 Feb 2017 02:32:49 +0000 (02:32 +0000)]
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

7 years ago[ath] prepare for station side quiet time support.
adrian [Tue, 7 Feb 2017 02:21:34 +0000 (02:21 +0000)]
[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.

7 years agoUncomment more of the hsearch_r testcases
ngie [Tue, 7 Feb 2017 02:00:14 +0000 (02:00 +0000)]
Uncomment more of the hsearch_r testcases

Call hdestroy/hdestroy_r on FreeBSD instead of hdestroy(1?)(_r).

All but hdestroy_r_nonexistent pass as-is.

7 years agoMFhead@r313360
ngie [Tue, 7 Feb 2017 01:33:39 +0000 (01:33 +0000)]
MFhead@r313360

7 years agoSort sys/ #includes some more
ngie [Tue, 7 Feb 2017 01:28:55 +0000 (01:28 +0000)]
Sort sys/ #includes some more

MFC after: 1 week
X-MFC with: r313358
Sponsored by: Dell EMC Isilon

7 years agoFix the ifdef protection and remove superfluous extern statements
gnn [Tue, 7 Feb 2017 01:21:18 +0000 (01:21 +0000)]
Fix the ifdef protection and remove superfluous extern statements

Reported by: Konstantin Belousov
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoSort sys/ #includes and zap an unnecessary trailing space nearby
ngie [Tue, 7 Feb 2017 00:47:33 +0000 (00:47 +0000)]
Sort sys/ #includes and zap an unnecessary trailing space nearby

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoUse a flexible array for TypeNames instead of hardcoding the array length
ngie [Tue, 7 Feb 2017 00:42:55 +0000 (00:42 +0000)]
Use a flexible array for TypeNames instead of hardcoding the array length

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoFix typos in comments (returing -> returning)
ngie [Tue, 7 Feb 2017 00:09:48 +0000 (00:09 +0000)]
Fix typos in comments (returing -> returning)

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years ago[iwm] fix path.
adrian [Mon, 6 Feb 2017 21:02:26 +0000 (21:02 +0000)]
[iwm] fix path.

7 years agoAdd kern_vm_mmap2(), kern_vm_mprotect(), kern_vm_msync(), kern_vm_munlock(),
trasz [Mon, 6 Feb 2017 20:57:12 +0000 (20:57 +0000)]
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

7 years agoMake root_mount_hold() work after boot. This is important for two
trasz [Mon, 6 Feb 2017 20:44:34 +0000 (20:44 +0000)]
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

7 years agoIn r290196 the root mount hold mechanism was changed to make it not wait
trasz [Mon, 6 Feb 2017 20:36:59 +0000 (20:36 +0000)]
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

7 years agoloader: disk io should not use alloca()
tsoome [Mon, 6 Feb 2017 18:44:15 +0000 (18:44 +0000)]
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

7 years agoloader: biosdisk fix for 2+TB disks
tsoome [Mon, 6 Feb 2017 18:29:43 +0000 (18:29 +0000)]
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

7 years agoRemove arm64_tlb_flushID_SE, it's unused and may be wrong.
andrew [Mon, 6 Feb 2017 17:50:09 +0000 (17:50 +0000)]
Remove arm64_tlb_flushID_SE, it's unused and may be wrong.

Sponsored by: ABT Systems Ltd

7 years agocxgbe/t4_tom: Fix CLIP entry refcounting on the passive side. Every
np [Mon, 6 Feb 2017 17:48:25 +0000 (17:48 +0000)]
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

7 years agoUpdate arm and arm64 counters MD bits.
kib [Mon, 6 Feb 2017 17:20:37 +0000 (17:20 +0000)]
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

7 years agoTemporary disable gicv3_its.c when FDT is missing from the kernel until
andrew [Mon, 6 Feb 2017 15:24:52 +0000 (15:24 +0000)]
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

7 years agosys/arm/arm/identcpu-v4.c: fix identify_arm_cpu()
sgalabov [Mon, 6 Feb 2017 14:58:24 +0000 (14:58 +0000)]
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

7 years agoOnly build the ACPI PCI drivers on x86, they are unlikely to be used on
andrew [Mon, 6 Feb 2017 14:41:34 +0000 (14:41 +0000)]
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

7 years agoUse 64bit store instruction in atomic_fcmpset_64.
kan [Mon, 6 Feb 2017 14:00:28 +0000 (14:00 +0000)]
Use 64bit store instruction in atomic_fcmpset_64.

Reported by: br

7 years agoOnly allow the pic type to be either a PIC or MSI type. All interrupt
andrew [Mon, 6 Feb 2017 13:08:48 +0000 (13:08 +0000)]
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

7 years agogxemul:
sbruno [Mon, 6 Feb 2017 11:37:20 +0000 (11:37 +0000)]
gxemul:

Add a format string to call to g_new_providerf() found when compiling
mips64 target with clang.

Reviewed by: brooks

7 years agoloader: 313329 missed ZFS guard in loader/main.c
tsoome [Mon, 6 Feb 2017 10:57:54 +0000 (10:57 +0000)]
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

7 years agoAdd ObsoleteFiles entries for bdes(1) missed in r313329
allanjude [Mon, 6 Feb 2017 10:51:53 +0000 (10:51 +0000)]
Add ObsoleteFiles entries for bdes(1) missed in r313329

Reported by: delphij
Reviewed by: bapt, imp
Differential Revision: https://reviews.freebsd.org/D9457

7 years agolocks: fix recursion support after recent changes
mjg [Mon, 6 Feb 2017 09:40:14 +0000 (09:40 +0000)]
locks: fix recursion support after recent changes

When a relevant lockstat probe is enabled the fallback primitive is called with
a constant signifying a free lock. This works fine for typical cases but breaks
with recursion, since it checks if the passed value is that of the executing
thread.

Read the value if necessary.

7 years agoloader: Replace EFI part devices.
tsoome [Mon, 6 Feb 2017 09:18:47 +0000 (09:18 +0000)]
loader: Replace EFI part devices.

Rewrite EFI part device interface to present disk devices in more
user friendly way.

We keep list of three types of devices: floppy, cd and disk, the
visible names: fdX: cdX: and diskX:

Use common/disk.c and common/part.c interfaces to manage the
partitioning.

The lsdev -l will additionally list the device path.

Reviewed by: imp, allanjude
Approved by: imp (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8581

7 years agoloader: bcache read ahead block count should take account the large sectors
tsoome [Mon, 6 Feb 2017 08:58:40 +0000 (08:58 +0000)]
loader: bcache read ahead block count should take account the large sectors

The loader bcache is implementing simple read-ahead to boost the cache.
The bcache is built based on 512B block sizes, and the read ahead is attempting
to read number of cache blocks, based on amount of the free bcache space.

However, there are devices using larger sector sizes than 512B, most obviously
the CD media is based on 2k sectors. This means the read-ahead can not be just
random number of blocks, but we should use value suitable also for use with
larger sectors, as for example, with CD devices, we should read multiple of 2KB.
Since the sector size from disk interface is not too reliable, i guess we can
just use "good enough" value, so the implementation is rounding down the read
ahead block count to be multiple of 16.

This means we have covered sector sizes to 8k.

In addition, the update does implement the end of cache marker, to help to
detect the possible memory corruption - I have not seen it happening so far,
but it does not hurt to have the detection mechanism in place.

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9179

7 years agoAdd removed headers into the ObsoleteFiles.inc.
ae [Mon, 6 Feb 2017 08:56:04 +0000 (08:56 +0000)]
Add removed headers into the ObsoleteFiles.inc.

7 years agoMerge projects/ipsec into head/.
ae [Mon, 6 Feb 2017 08:49:57 +0000 (08:49 +0000)]
Merge projects/ipsec into head/.

 Small summary
 -------------

o Almost all IPsec releated code was moved into sys/netipsec.
o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel
  option IPSEC_SUPPORT added. It enables support for loading
  and unloading of ipsec.ko and tcpmd5.ko kernel modules.
o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by
  default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type
  support was removed. Added TCP/UDP checksum handling for
  inbound packets that were decapsulated by transport mode SAs.
  setkey(8) modified to show run-time NAT-T configuration of SA.
o New network pseudo interface if_ipsec(4) added. For now it is
  build as part of ipsec.ko module (or with IPSEC kernel).
  It implements IPsec virtual tunnels to create route-based VPNs.
o The network stack now invokes IPsec functions using special
  methods. The only one header file <netipsec/ipsec_support.h>
  should be included to declare all the needed things to work
  with IPsec.
o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed.
  Now these protocols are handled directly via IPsec methods.
o TCP_SIGNATURE support was reworked to be more close to RFC.
o PF_KEY SADB was reworked:
  - now all security associations stored in the single SPI namespace,
    and all SAs MUST have unique SPI.
  - several hash tables added to speed up lookups in SADB.
  - SADB now uses rmlock to protect access, and concurrent threads
    can do SA lookups in the same time.
  - many PF_KEY message handlers were reworked to reflect changes
    in SADB.
  - SADB_UPDATE message was extended to support new PF_KEY headers:
    SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They
    can be used by IKE daemon to change SA addresses.
o ipsecrequest and secpolicy structures were cardinally changed to
  avoid locking protection for ipsecrequest. Now we support
  only limited number (4) of bundled SAs, but they are supported
  for both INET and INET6.
o INPCB security policy cache was introduced. Each PCB now caches
  used security policies to avoid SP lookup for each packet.
o For inbound security policies added the mode, when the kernel does
  check for full history of applied IPsec transforms.
o References counting rules for security policies and security
  associations were changed. The proper SA locking added into xform
  code.
o xform code was also changed. Now it is possible to unregister xforms.
  tdb_xxx structures were changed and renamed to reflect changes in
  SADB/SPDB, and changed rules for locking and refcounting.

Reviewed by: gnn, wblock
Obtained from: Yandex LLC
Relnotes: yes
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D9352

7 years agoRemove bdes(1)
allanjude [Mon, 6 Feb 2017 08:27:19 +0000 (08:27 +0000)]
Remove bdes(1)

The use of DES for anything is discouraged, especially with a static IV of 0

If you still need bdes(1) to decrypt Kirk's video lectures, see
security/bdes in ports.

This commit brought to you by the FOSDEM DevSummit and the
"remove unneeded dependancies on openssl in base" working group

Reviewed by: bapt, brnrd
Relnotes: yes
Sponsored by: FOSDEM DevSummit
Differential Revision: https://reviews.freebsd.org/D9424

7 years agoloader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE.
tsoome [Mon, 6 Feb 2017 08:26:45 +0000 (08:26 +0000)]
loader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE.

Need interface to extract information about disk abstraction,
to read disk or partition size depending on the provided argument
and adjust disk size based on information in partition table.

The disk handle from disk_open() has d_offset field to point to
partition start. So we can use this fact to return either whole disk
size or partition size. For this we only need to record partition size
we get from disk_open() anyhow.

In addition, this will also make it possible to adjust the disk media size
based on information from partition table. The problem with disk size is
about some BIOS systems reporting bogus disk size for 2+TB disks, but
since such disks are using GPT partitioning, and GPT does have information
about disk size (alternate LBA + 1), we can use this fact to record disk
size based on partition table.

This patch does exactly this: implements DIOCGSECTORSIZE and DIOCGMEDIASIZE
ioctl, and DIOCGMEDIASIZE will report either disk media size or partition size.

Adds ptable_getsize() call to read partition size in bytes from ptable pointer.
Updates disk_open() to use ptable_getsize() to update mediasize value.

Implements GPT detection function to update ptable size (used by
ptable_getsize()) according to alternate lba (which is location of backup copy
of GPT header table).

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D8594

7 years agoReflect actual NetBSD revision we already have.
delphij [Mon, 6 Feb 2017 07:02:17 +0000 (07:02 +0000)]
Reflect actual NetBSD revision we already have.

MFC after: 3 days

7 years agoo Add mkimg to the cross tools, and use the TMPPATH as PATH to pick up
imp [Mon, 6 Feb 2017 06:15:38 +0000 (06:15 +0000)]
o Add mkimg to the cross tools, and use the TMPPATH as PATH to pick up
  mkimg for building on systems like FreeBSD 11.0 that don't have my
  -a changes.
o Set NANO_ROOT and NANO_ALTROOT for std-* since their values don't
  change when we set NANO_SLICE*.

PR: 216829
PR: 216830

7 years ago[iwm] Use notification wait API to wait for calibration to complete.
adrian [Mon, 6 Feb 2017 05:35:11 +0000 (05:35 +0000)]
[iwm] Use notification wait API to wait for calibration to complete.

Tested:

* 7260, STA mode (2g, 5g)

Obtained from: DragonflyBSD commit 1e0cf8ec6fcd77978f5336297ece61a415790f84

7 years ago[iwm] Add implementation of the notification wait api from iwlwifi.
adrian [Mon, 6 Feb 2017 05:27:07 +0000 (05:27 +0000)]
[iwm] Add implementation of the notification wait api from iwlwifi.

Obtained from: Linux iwlwifi
Obtained from: DragonflyBSD commit 94dc1dadceb57b688036211262d678bc6bbdde37

7 years agocxgbe(4): Allow tunables that control the number of queues to be set to
np [Mon, 6 Feb 2017 05:19:29 +0000 (05:19 +0000)]
cxgbe(4):  Allow tunables that control the number of queues to be set to
'-n' to tell the driver to create _up to_ 'n' queues if enough cores are
available.  For example, setting hw.cxgbe.nrxq10g="-32" will result in
16 queues if the system has 16 cores, 32 if it has 32.

There is no change in the default number of queues of any type.

MFC after: 1 week
Sponsored by: Chelsio Communications

7 years ago[iwm] Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.
adrian [Mon, 6 Feb 2017 05:09:42 +0000 (05:09 +0000)]
[iwm] Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.

* This matches the function declaration in Linux's iwlwifi.

Obtained from: DragonflyBSD commit de7995a5e0ebf2d0016a87a0142a98c75db58fb4

7 years ago[iwm] Store paging_mem_size field in firmware image information struct.
adrian [Mon, 6 Feb 2017 05:08:21 +0000 (05:08 +0000)]
[iwm] Store paging_mem_size field in firmware image information struct.

Obtained from: DragonflyBSD commit a8524cc6c440e5ce9490ba2b0507c99ff6777c6d

7 years ago[iwm] Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.
adrian [Mon, 6 Feb 2017 05:07:15 +0000 (05:07 +0000)]
[iwm] Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.

* IWM_UCODE_SECT_MAX -> IWM_UCODE_SECTION_MAX

* IWM_UCODE_TYPE_* -> IWM_UCODE_* (except for IWM_UCODE_TYPE_MAX which
  stays).

Obtained from: DragonflyBSD commit ff4d1fc3ed002c9fb362423da6c45d711b65658a

7 years ago[iwm] Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.
adrian [Mon, 6 Feb 2017 05:03:41 +0000 (05:03 +0000)]
[iwm] Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.

* This fixes the phy_cfg field sent in the iwm_send_phy_cfg_cmd()
  command, which wasn't taking into account the valid_rx_ant and
  valid_tx_ant masks from nvm_data before.

Tested:

* 7260, STA mode, 2G and 5G

Obtained from: DragonflyBSD commit cbb82693c18fd71b4eb86855b82d03995f352d65

7 years ago[iwm] Use chipset configuration structs like iwlwifi does.
adrian [Mon, 6 Feb 2017 03:29:50 +0000 (03:29 +0000)]
[iwm] Use chipset configuration structs like iwlwifi does.

* This makes it a bit easier to factor out common parts for e.g. the
  7000 chipset family.

* Add iwm7265d config, and recognize the 7265D chipset variant via the
  hardware revision.

Tested:

* 7260, STA mode (2ghz)

Obtained from: Dragonflybsd commit cc8d6ccf5583fd45964f3bde9b057ee4f834c0e0

7 years ago[iwm] Sync nvm parsing code with Linux iwlwifi.
adrian [Mon, 6 Feb 2017 03:06:11 +0000 (03:06 +0000)]
[iwm] Sync nvm parsing code with Linux iwlwifi.

* sc->sc_nvm becomes sc->nvm_data and is now a pointer instead of an
  inlined struct.

* Add sc->eeprom_size and sc->nvm_hw_section_num configuration values to
  struct iwm_softc.

* For now continue to avoid negative error return-values, and use pointer
  variables for some return values, as before.

* Continue to omit LAR (location aware regulatory) related code as well.

Tested:

* Intel 7260, STA mode (2GHz)

Obtained from: dragonflybsd commit 39f8331b1a6f295291e08c377da12a8e7a5436c0

7 years ago[iwm] make sure we call iwm_detach_local() only once.
adrian [Mon, 6 Feb 2017 02:20:05 +0000 (02:20 +0000)]
[iwm] make sure we call iwm_detach_local() only once.

Obtained from: DragonflyBSD git ebd4ceab76a6f161362029cbfd08efaedaab0519

7 years ago[iwm] Sync if_iwm_phy_db code with Linux iwlwifi.
adrian [Mon, 6 Feb 2017 02:14:34 +0000 (02:14 +0000)]
[iwm] Sync if_iwm_phy_db code with Linux iwlwifi.

Obtained from: Dragonflybsd commit c1019b6bfff36c856f7b4fccbdf3bb13ac27750c

7 years ago[iwm] The HW Revision stepping constants should be in if_iwmreg.h.
adrian [Mon, 6 Feb 2017 02:01:22 +0000 (02:01 +0000)]
[iwm] The HW Revision stepping constants should be in if_iwmreg.h.

Obtained from: dragonflybsd 84292f0c38594c462c719c0e59da5908b93aba5f

7 years ago[iwm] TODO for QOS support.
adrian [Mon, 6 Feb 2017 01:57:59 +0000 (01:57 +0000)]
[iwm] TODO for QOS support.

7 years ago[iwm] free node reference if rxparams addition fails.
adrian [Mon, 6 Feb 2017 01:57:41 +0000 (01:57 +0000)]
[iwm] free node reference if rxparams addition fails.

7 years agoAdd tsw_busy support to usb_serial (ucom).
ian [Sun, 5 Feb 2017 15:45:31 +0000 (15:45 +0000)]
Add tsw_busy support to usb_serial (ucom).

The tty layer uses tsw_busy to poll for busy/idle status of the transmitter
hardware during close() and tcdrain(). The ucom layer defines ULSR_TXRDY and
ULSR_TSRE bits for the line status register; when both are set, the
transmitter is idle. Not all chip drivers maintain those bits in the sc_lsr
field, and if the bits never get set the transmitter will always appear
busy, causing hangs in tcdrain().

These changes add a new sc_flag bit, UCOM_FLAG_LSRTXIDLE. When this flag is
set, ucom_busy() uses the lsr bits to return busy vs. idle state, otherwise
it always returns idle (which is effectively what happened before this
change because tsw_busy wasn't implemented).

For the uftdi chip driver, these changes stop masking out the tx idle bits
when processing the status register (because now they're useful), and it
calls ucom_use_lsr_txbits() to indicate the bits are maintained by the
driver and can be used by ucom_busy().

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

7 years agoRegen after r313284.
dchagin [Sun, 5 Feb 2017 14:19:19 +0000 (14:19 +0000)]
Regen after r313284.

MFC after: 2 week