Commit Graph

114264 Commits

Author SHA1 Message Date
Justin Hibbits
0a82e6f09a Use trunc_page() instead of rolling my own in pmap_track_page() 2016-12-05 02:27:50 +00:00
Andriy Voskoboinyk
c057023b75 rsu: fix RSSI reporting, partially revert r288414.
- Append RCR_APP_PHYSTS bit after firmware loading - otherwise
firmware will reset the register and this modification will be lost.
(without it Rx PHY descriptor section will contain garbage).
- Check if R92S_RXDW0_PHYST bit is set (like it is done in rtwn(4)) -
even if infosz is non-zero the section may not contain anything useful.
- In case, if descriptor is absent (A-MPDU?) use last calibrated RSSI
(rtwn(4) uses RSSI from the previous (sub)frame; probably, this
approach should be used here too).

Tested with Asus USB-N10, STA mode.
2016-12-04 21:40:49 +00:00
Konstantin Belousov
435da98564 Restructure the code to handle reporting of non-exited processes from
wait(2).
- Do not acquire the process spinlock if neither WTRAPPED nor WUNTRACED
  options were passed [1].
- Extract the code to report alive process into a new helper
  report_alive_proc() and use it for trapped, stopped and continued
  childrens.

Note that the process spinlock is required around the WTRAPPED and
WUNTRACED tests, because P_STOPPED_TRACE and P_STOPPED_SIG flags are
set before other threads are stopped at the suspension point, and that
threads increment p_suspcount while owning only the process spinlock,
the process lock is dropped by them.  If the spinlock is not taken for
tests, the syscall thread might miss both p_suspcount increment and
wakeup in wakeup in thread_suspend_switch().

Based on the submission by:	mjg [1]
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-04 20:44:58 +00:00
Michal Meloun
6f1eb3052e Fixes for NVIDIA Tegra124 clocks:
- EMC clock have standard peripheral clock block. Use it.
 - Implement full frequency set method for PLLD2. This PLL
   is used as HDMI pixel clock so we must be able to set it
   to wide range of frequencies, within 5% tolerance allowed
   by HDMI specification. Due to this, full state space search
   (over m, n, p fields) is necessary.

MFC after: 3 weeks
2016-12-04 16:04:22 +00:00
Michal Meloun
3b29466b94 Clock framework fixes:
- The clk_test_freq() (aka CLK_SET_DRYRUN) doesn't change frequency,
   don't cache it result.
 - Fix busy condition for clk_set_freq().

MFC after: 3 weeks
2016-12-04 16:02:59 +00:00
Michal Meloun
bea8daa364 Add IDs for HDA codecs found on Nvidia Tegra SoCs.
MFC after: 2 weeks
2016-12-04 15:28:30 +00:00
Michal Meloun
bdbc1b764d Implement fake pmap_mapdev_attr() for ARMv6.
This function is referenced, but never called from DRM2 code. Also,
real behavior of pmap_mapdev_attr() in ARM world is unclear as we don't
have any additional attribute for a device memory type.

MFC after: 2 weeks
2016-12-04 15:27:39 +00:00
Pyun YongHyeon
6861837c7a Fix too low volume on MSI H170 GAMING M3 board by poking vendor
specific COEF.
2016-12-04 05:55:18 +00:00
Pyun YongHyeon
b899778526 Recognize RealTek ALC1150 7.1 channel HD audio codec. 2016-12-04 05:46:30 +00:00
Conrad Meyer
e2a65c0031 ioat(4): Compile on i386
Truncate BUS_SPACE_MAXADDR_40BIT to essentially BUS_SPACE_MAXADDR_32BIT on
platforms with 32-bit bus_addr_t (i.e., i386).

PR:		215034
Reported by:	ngie@
Sponsored by:	Dell EMC Isilon
2016-12-04 04:04:57 +00:00
Justin Hibbits
aa38c69b74 Fix a typo (move parenthesis to correct location in the line).
Before this, it would cause the one consumer of this API in powerpc usage
(dev/dpaa) to set the PTE WIMG flags to empty instead of --M-, making the
cache-enabled buffer portals non-coherent.
2016-12-04 02:15:46 +00:00
Enji Cooper
006aa95c01 Unbreak "make depend" with sys/modules/ioat by adding opt_ddb.h to SRCS
MFC after: 2 weeks
2016-12-04 02:08:40 +00:00
Ravi Pokala
4d12189b6c Build smbios.ko as a module for amd64 and i386
For whatever reason, smapi, smbios, vpd are all under the "bios" directory.
smapi is only for i386, so the entire "bios" directory is only built for
i386. Break smapi out, and make only it i386-specific. Then, build the
"bios" directory for both amd64 and i386.

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D8609
2016-12-03 17:54:08 +00:00
Andriy Voskoboinyk
4786190d2f rtwn: fix bitmap size calculation.
Tested with RTL8188CE, STA mode.
2016-12-03 17:27:10 +00:00
Andriy Voskoboinyk
6127805391 rsu: fix frame processing in the Rx path (similar to r292207).
- Fill in Rx radiotap header correctly (for every packet in a chain;
not once per chain).
- Fix rate / flags fields in Rx radiotap.
- Add debug messages for discarded frames.
- Pass received control (< sizeof(struct ieee80211_frame)) frames
to net80211 (if allowed by device filter; cannot happen yet).

Tested with Asus USB-N10.

Differential Revision:	https://reviews.freebsd.org/D5723
2016-12-03 16:02:53 +00:00
Kevin Lo
3094a376e4 Fix logic error so the R92C_TDECTRL register value is updated correctly.
Reviewed by:	avos
2016-12-03 14:41:53 +00:00
Andriy Voskoboinyk
bcb071810a rsu: remove unused structures / variables. 2016-12-03 14:26:58 +00:00
Adrian Chadd
707210ff0e [ath] use the correct AMPDU frame limit for the given node, rather than the global config.
This is important in hostap, ibss, (11s at some magical future date, etc)
where different nodes may have smaller limits.

Oops!

MFC after:	1 week
Relnotes:	Yes
2016-12-03 02:47:41 +00:00
Adrian Chadd
4774b99992 [net80211] prepare for 11ac aware NICs that want to know per-vdev channel and centre frequencies.
* ic_freq is the centre of the primary channel, not the centre of the
  HT40/HT80/etc channel.  Add a method to access that.
* Add a method to access the centre of the primary channel, including
  knowing the centre of the 5/10/20/40/80, versus the primary channel.
  Ie, it's the centre of the 40, 80, 160MHz channel.
* Add a method to access the centre frequency of the secondary 80MHz
  channel - we don't support VHT yet, but when we do.
* Add methods to access the current channel and the per-dev desired
  channel.  Ideally drivers that do full offload with a per-vap channel
  configuration should use the vap channel, NOT ic_curchan.
  Non-offload drivers that require net80211 to change the channel should
  be accessing ic_curchan.
2016-12-03 02:45:18 +00:00
Luiz Otavio O Souza
3c27ea76f0 Allow simultaneous access to switch device, there is no reason to prevent
it.

Remove bogus wrappers and use the kernel defaults.

While here, use DEVMETHOD_END.

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-03 01:55:38 +00:00
Eric van Gyzen
ff07dd913e thr_set_name(): silently truncate the given name as needed
Instead of failing with ENAMETOOLONG, which is swallowed by
pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
bytes.  This is more likely what the user wants, and saves the
caller from truncating it before the call (which was the only
recourse).

Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
so the user might find the documentation for this behavior.

Reviewed by:	jilles
MFC after:	3 days
Sponsored by:	Dell EMC
2016-12-03 01:14:21 +00:00
Pedro F. Giffuni
fca15474a0 ext2fs: renumber the license clauses to avoid skipping #3.
This is to keep consistency with other files, and help license-checking
utilities determine the number of clauses that apply.

No functional change.
2016-12-02 19:47:23 +00:00
Mateusz Guzik
a2d3554542 vfs: provide fake locking primitives for the crossmp vnode
Since the vnode is only expected to be shared locked, we can save a
little overhead by only pretending we are locking in the first place.

Reviewed by:	kib
Tested by:	pho
2016-12-02 18:03:15 +00:00
Alan Cox
8804a2b030 Eliminate a stale comment; vm_radix_prealloc() was replaced in r254141.
MFC after:	3 days
2016-12-02 16:29:30 +00:00
Ryan Stone
669f39b29c Revert r309372
The bug intended to be fixed by r309372 was already addressed by r296178,
so revert my change.

Reported by:	seph
2016-12-02 15:38:34 +00:00
Warner Losh
158c18ffb4 dd is currently a bootstrap tool. It really doesn't have any business
being a bootstrap tool. However, for reproducible build output,
FreeBSD added dd status=none because it was otherwise difficult to
suppress the status information, but retain any errors that might
happen. There's no real reason that dd has to be a build tool, other
than we use status=none unconditional. Remove dd from a bootstrap tool
entirely by only using status=none when available. This may also help
efforts to build the system on non-FreeBSD hosts as well.

Differential Revision: https://reviews.freebsd.org/D8605
2016-12-02 14:44:38 +00:00
Julian Elischer
426b3d047a Changes to allow the patching of packets with an offset (and other changes.. see man page)
PR:	206185
Submitted by:	Dmitry Vagin <daemon-hammer@ya.ru>
MFC after:	 1 week
Relnotes:	yes (also ng_checksum node)
2016-12-02 10:47:10 +00:00
Hans Petter Selasky
de83258d59 Remove useless NULL checks.
NULL is not returned when allocating memory passing the M_WAITOK flag.

Submitted by:		trasz @
Differential Revision:  https://reviews.freebsd.org/D5772
Sponsored by:           Mellanox Technologies
MFC after:		1 week
2016-12-02 09:41:54 +00:00
Hans Petter Selasky
0e493ed3a5 Fix return value from ng_uncallout().
callout_stop() recently started returning -1 when the callout is already
stopped, which is not handled by the netgraph code. Properly filter
the return value. Netgraph callers only want to know if the callout
was cancelled and not draining or already stopped.

Discussed with:		julian, glebius
MFC after:		2 weeks
2016-12-02 09:29:22 +00:00
Hans Petter Selasky
c6e6b4fe3b Fix for endless recursion in the ACPI GPE handler during boot.
When handling a GPE ACPI interrupt object the EcSpaceHandler()
function can be called which checks the EC_EVENT_SCI bit and then
recurse on the EcGpeQueryHandler() function. If there are multiple GPE
events pending the EC_EVENT_SCI bit will be set at the next call to
EcSpaceHandler() causing it to recurse again via the
EcGpeQueryHandler() function. This leads to a slow never ending
recursion during boot which prevents proper system startup, because
the EC_EVENT_SCI bit never gets cleared in this scenario.

The behaviour is reproducible with the ALASKA AMI in combination with
a newer Skylake based mainboard in the following way:

Enter BIOS and adjust the clock one hour forward. Save and exit the
BIOS. System fails to boot due to the above mentioned bug in
EcGpeQueryHandler() which was observed recursing multiple times.

This patch adds a simple recursion guard to the EcGpeQueryHandler()
function and also also adds logic to detect if new GPE events occurred
during the execution of EcGpeQueryHandler() and then loop on this
function instead of recursing.

Reviewed by:		jhb
MFC after:		2 weeks
2016-12-02 08:21:08 +00:00
Michael Tuexen
4ddd5aadea Fix the handling of TCP FIN-segments in the CLOSED state
When a TCP segment with the FIN bit set was received in the CLOSED state,
a TCP RST-ACK-segment is sent. When computing SEG.ACK for this, the
FIN counts as one byte. This accounting was missing and is fixed by this
patch.

Reviewed by:		hiren
MFC after:		1 month
Sponsored by:		Netflix, Inc.
Differential Revision:	https://svn.freebsd.org/base/head
2016-12-02 08:02:31 +00:00
Marcel Moolenaar
d6d35f1561 Fix use-after-free bugs in pfsync(4)
Use after free happens for state that is deleted. The reference
count is what prevents the state from being freed. When the
state is dequeued, the reference count is dropped and the memory
freed. We can't dereference the next pointer or re-queue the
state.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8671
2016-12-02 06:15:59 +00:00
Kenneth D. Merry
28db0a5e74 Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support.
This adds support to camcontrol(8) and libcam(3) for getting and setting
the time on SCSI protocol drives.  This is more commonly found on tape
drives, but is a SPC (SCSI Primary Commands) command, and may be found
on any device that speaks SCSI.

The new camcontrol timestamp subcommand allows getting the current device
time or setting the time to the current system time or any arbitrary time.

sbin/camcontrol/Makefile:
	Add timestamp.c.

sbin/camcontrol/camcontrol.8:
	Document the new timestamp subcommand.

sbin/camcontrol/camcontrol.c:
	Add the timestamp subcommand to camcontrol.

sbin/camcontrol/camcontrol.h:
	Add the timestamp() function prototype.

sbin/camcontrol/timestamp.c:
	Timestamp setting and reporting functionality.

sys/cam/scsi/scsi_all.c:
	Add two new CCB building functions, scsi_set_timestamp() and
	scsi_report_timestamp().  Also, add a new helper function,
	scsi_create_timestamp().

sys/cam/scsi/scsi_all.h:
	Add CDB and parameter data for the the set and report timestamp
	commands.

	Add function declarations for the new CCB building and helper
	functions.

Submitted by:	Sam Klopsch
Sponsored by:	Spectra Logic
MFC After:	2 weeks
2016-12-01 22:20:27 +00:00
Ryan Stone
86a6fcd4ff Fix a false positive in a buf_ring assert
buf_ring contains an assert that checks whether an item being
enqueued already exists on the ring.  There is a subtle bug in
this assert.  An item can be returned by a peek() function and
freed, and then the consumer thread can be preempted before
calling advance().  If this happens the item appears to still be
on the queue, but another thread may allocate the item from the
free pool and wind up trying to enqueue it again, causing the
assert to trigger incorrectly.

Fix this by skipping the head of the consumer's portion of the
ring, as this index is what will be returned by peek().

Sponsored by:	Dell EMC Isilon
MFC After:	1 week
Differential Revision:	https://reviews.freebsd.org/D8685
Reviewed by:	hselasky
2016-12-01 21:08:42 +00:00
Alan Cox
563a19d546 During vm_page_cache()'s call to vm_radix_insert(), if vm_page_alloc() was
called to allocate a new page of radix trie nodes, there could be a call to
vm_radix_remove() on the same trie (of PG_CACHED pages) as the in-progress
vm_radix_insert().  With the removal of PG_CACHED pages, we can simplify
vm_radix_insert() and vm_radix_remove() by removing the flags on the root of
the trie that were used to detect this case and the code for restarting
vm_radix_insert() when it happened.

Reviewed by:	kib, markj
Tested by:	pho
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8664
2016-12-01 17:26:37 +00:00
Alexey Dokuchaev
a48f5e1ffa - Mention mismatching numbers in MSR vs. ACPI _PSS count warning: seeing
actual numbers would help debugging (also, `MSR' and `ACPI' are standard
  abbreviations and thus should be properly capitalized)
- Rephrase unsupported AMD CPUs message and wrap as an overly long line:
  `sorry' 1) is wrongly spelled after period (starts with a small letter)
  and 2) carries emotional "tinge" that is unnecessary and even bogus in
  debug message; `implemented' is not the best word as `supported' suits
  better in this context
- Improve readability when reporting resulted P-state transition (debug)

Approved by:	jhb
2016-12-01 14:31:05 +00:00
Ed Maste
c0eb4aa41b EFI loaders: parse rela relocations on amd64
Prior to this change the loader self relocation code interpreted amd64's
rela relocations as if they were rel relocations, discarding the addend.
This "works" because GNU ld 2.17.50 stores the addend value in both the
r_addend field of the relocation (as expected) and at the target of the
relocation.

Other linkers, and possibly other versions of GNU ld, won't have this
behaviour, so interpret the relocations correctly.

Reported by:	George Rimar
Reviewed by:	andrew
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8681
2016-12-01 14:28:37 +00:00
Sepherosa Ziehau
34d68912be hyperv/hn: Add 'options RSS' support.
Reviewed by:	adrian
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8676
2016-12-01 05:37:29 +00:00
Sepherosa Ziehau
8e7d313625 hyperv/hn: Don't hold txdesc, if no BPFs are attached.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8675
2016-12-01 03:39:34 +00:00
Luiz Otavio O Souza
7f67614061 MDIO_PHYACCESS_ACK is only valid for read access, remove it from
miibus_writereg.

Reduce the DELAY() between reads while waiting for MII access.

Spotted by:	yongari
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-01 03:34:04 +00:00
Sepherosa Ziehau
85e4ae1e13 hyperv/hn: Add HN_DEBUG kernel option.
If bufring is used for per-TX ring descs, don't update "available"
counter, which is only used to help debugging.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8674
2016-12-01 03:27:16 +00:00
Luiz Otavio O Souza
71462f5652 The RX_FREEBUFFER registers are a write to increment field.
Writing the full queue size to it every time was makeing it overflow with a
lot of bogus values.

This fixes the interrupt storms on irq 40.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-01 02:35:15 +00:00
Conrad Meyer
58a639b77c ioat(4): Fix 'bogus completion_pending' KASSERT
Fix ioat_release to only set is_completion_pending if DMAs were actually
queued.  Otherwise, the spurious flag could trigger an assert in the
reset path on INVARIANTS kernels.

Reviewed by:	bdrewery, Suraj Raju @ Isilon
Sponsored by:	Dell EMC Isilon
2016-11-30 21:59:52 +00:00
Andrew Turner
a54b7de02a Fix the PCI host generic FDT driver to call into the common code and not
recurse into itself.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 14:18:52 +00:00
Andrew Turner
d2314cb3b9 Fix the alloc function the ThunderX PCIe driver calls, the previous
function may not exist when FDT is removed from the kernel.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 14:17:06 +00:00
Andrew Turner
2daeee1a33 Mark the Alpine ethernet driver as FDT only. It calls
alpine_serdes_resource_get which is defined in an FDT only file.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 10:17:03 +00:00
Andrew Turner
c430fbd38c Move the FDT specific parts of the GIC diver softc to the FDT attachment.
This allows the driver to be built in a kernel with no FDT support, e.g.
on arm64 with just ACPI.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 09:47:29 +00:00
Andrew Turner
592022614f Only include FDT headders when building for FDT.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-30 09:45:18 +00:00
Alexander Motin
b6fe583c55 Add gmirror create subcommand, alike to gstripe, gconcat, etc.
It is quite specific mode of operation without storing on-disk metadata.
It can be useful in some cases in combination with some external control
tools handling mirror creation and disks hot-plug.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2016-11-30 09:27:08 +00:00
Sepherosa Ziehau
14c85e527e hyperv/storvsc: Don't use timedwait.
The timeout is unnecessary.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8656
2016-11-30 08:21:15 +00:00