Commit Graph

104385 Commits

Author SHA1 Message Date
Dmitry Chagin
81338031c4 Switch linuxulator to use the native 1:1 threads.
The reasons:
1. Get rid of the stubs/quirks with process dethreading,
   process reparent when the process group leader exits and close
   to this problems on wait(), waitpid(), etc.
2. Reuse our kernel code instead of writing excessive thread
   managment routines in Linuxulator.

Implementation details:

1. The thread is created via kern_thr_new() in the clone() call with
   the CLONE_THREAD parameter. Thus, everything else is a process.
2. The test that the process has a threads is done via P_HADTHREADS
   bit p_flag of struct proc.
3. Per thread emulator state data structure is now located in the
   struct thread and freed in the thread_dtor() hook.
   Mandatory holdig of the p_mtx required when referencing emuldata
   from the other threads.
4. PID mangling has changed. Now Linux pid is the native tid
   and Linux tgid is the native pid, with the exception of the first
   thread in the process where tid and pid are one and the same.

Ugliness:

   In case when the Linux thread is the initial thread in the thread
   group thread id is equal to the process id. Glibc depends on this
   magic (assert in pthread_getattr_np.c). So for system calls that
   take thread id as a parameter we should use the special method
   to reference struct thread.

Differential Revision:	https://reviews.freebsd.org/D1039
2015-05-24 14:53:16 +00:00
Dmitry Chagin
91d1786f65 In preparation for switching linuxulator to the use the native 1:1
threads add a hook for cleaning thread resources before the thread die.

Differential Revision:	https://reviews.freebsd.org/D1038
2015-05-24 14:51:29 +00:00
Dmitry Chagin
8c032af773 In preparation for switching linuxulator to the use the native 1:1
threads add per thread emulator state data.

Differential Revision:	https://reviews.freebsd.org/D1037
Reviewed by:	trasz
2015-05-24 14:49:21 +00:00
Dmitry Chagin
64cfe4dc38 Regen for r283379. 2015-05-24 14:47:00 +00:00
Dmitry Chagin
2003907d45 Implement a Linux version of sched_getparam() && sched_setparam().
Temporarily use the first thread in proc.

Differential Revision:	https://reviews.freebsd.org/D1036
Reviewed by:	trasz
2015-05-24 14:45:57 +00:00
Dmitry Chagin
111c86e3d1 Remove a now unused include.
Differential Revision:	https://reviews.freebsd.org/D1035
Reviewed by:	trasz
2015-05-24 14:44:57 +00:00
Dmitry Chagin
a93e83c8d7 In preparation for switching linuxulator to the use the native 1:1
threads split sys_sched_getparam(), sys_sched_setparam(),
sys_sched_getscheduler(), sys_sched_setscheduler() to their kern_*
counterparts and add targettd parameter to allow specify the target
thread directly by callee.

Differential Revision:	https://reviews.freebsd.org/D1034
Reviewed by:	trasz
2015-05-24 14:44:06 +00:00
Dmitry Chagin
37588665e4 Regen for r283375. 2015-05-24 14:43:06 +00:00
Dmitry Chagin
e7b198ab02 In preparation for switching linuxulator to the use the native 1:1
threads use MI linux_sched_rr_get_interval() in i386.

Differential Revision:	https://reviews.freebsd.org/D1033
Reviewed by:	trasz
2015-05-24 14:40:41 +00:00
Dmitry Chagin
1aa90eca33 In preparation for switching linuxulator to the use the native 1:1
threads refactor kern_sched_rr_get_interval() and sys_sched_rr_get_interval().
Add a kern_sched_rr_get_interval() counterpart which takes a targettd
parameter to allow specify target thread directly by callee (new Linuxulator).

Linuxulator temporarily uses first thread in proc.

Move linux_sched_rr_get_interval() to the MI part.

Differential Revision:	https://reviews.freebsd.org/D1032
Reviewed by:	trasz
2015-05-24 14:39:26 +00:00
Dmitry Chagin
09baafb471 In preparation for switching linuxulator to the use the native 1:1
threads introduce kern_thr_alloc() which will be used later in the
linux_clone().

Differential Revision:	https://reviews.freebsd.org/D1029
Reviewed by:	trasz
2015-05-24 14:37:45 +00:00
Dmitry Chagin
95be6d2b1f In preparation for switching linuxulator to the use the native 1:1
threads split sys_thr_exit() up into sys_thr_exit() and kern_thr_exit().
Move
Where the second will be used in linux_exit() system call later.

Differential Revision:	https://reviews.freebsd.org/D1028
Reviewed by:	trasz
2015-05-24 14:36:33 +00:00
Dmitry Chagin
8c744294fe Regen for r283370. 2015-05-24 14:34:46 +00:00
Dmitry Chagin
161acbb670 In preparation for switching linuxulator to the use the native 1:1
threads introduce linux_exit() stub instead of sys_exit() call
(which terminates process).
In the new linuxulator exit() system call terminates the calling
thread (not a whole process).

Differential Revision:	https://reviews.freebsd.org/D1027
Reviewed by:	trasz
2015-05-24 14:33:19 +00:00
Dmitry Chagin
1d80c8a8f0 In preparation for switching linuxulator to the use the native 1:1
threads print the thread id in addition to the pid in debug messages.
2015-05-24 14:29:35 +00:00
Andrew Turner
31289e44b0 Enable SMP on the qemu virt platform. We use the device tree to find which
cpus to enable, and PSCI to start them.
2015-05-24 12:33:12 +00:00
Andrew Turner
66fb2f18cd Remove trailing whitespace from sys/arm/arm 2015-05-24 12:20:11 +00:00
Andrew Turner
ad25ff4509 Add more cp15_ functions, and use them in cpufunc.c where possible. 2015-05-24 12:12:01 +00:00
Alexander V. Chernikov
0bf993fcc1 Fix SIOCGI2C structure requirement.
In reality, SIOCGI2C ioctl requires struct ifreq as many other
ioctls. Doing copyin() on (significantly) larger struct ifstat sometimes
triggered EFAULT.

Reported by:	Olivier Cochard-Labbé <olivier at cochard.me>
MFC after:	1 week
2015-05-24 11:24:14 +00:00
Andrew Turner
7ad1ac7d6a Rework the PSCI cpu on code to allow it to work before device drivers have
started. This allows this functions to be used with the regular ARM SMP
initialisation sequence.
2015-05-24 11:08:06 +00:00
Andrew Turner
6177d84d6e Include the ofw cpu driver. This allows us to get a list of cpus enabled
by qemu, however we may not be running on them.
2015-05-24 11:04:45 +00:00
Ganbold Tsagaankhuu
505050e877 Add kernel config and dts files for an aml8726-m3
based device.
Following u-boot commands allow FreeBSD boot on
Yiyate Android TV Box (aml8726-m3):

tv open 480p
mmc rescan 0
fatload mmc 0 0x80100000 kernel.bin
go 0x80100000

The current FreeBSD driver doesn't program the video
clocks so the u-boot tv command is necessary in order
for the frame buffer to be useful (otherwise it can
be skipped).

The SD card for the Yiyate Android TV Box doesn't need
anything special beyond creating a FAT16 and a UFS
filesystem.

Differential Revision:	https://reviews.freebsd.org/D2636
Submitted by:	John Wehle
2015-05-24 08:45:19 +00:00
Ganbold Tsagaankhuu
3a9ac40382 This implements default-state support as described in:
https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds-gpio.txt

Without this booting the VSATV102 causes the blue "working" led to turn
off when the kernel starts up. With this the led (which is turned on by
the firmware) stays on since that's the default state specified in the FDT.

Expanded the meaning of the led_create_state state parameter in order
to implement support for "keep". The original values were:

== 0             Off
!= 0             On

The new values are:

== -1            don't change / keep current setting
== 0             Off
!= -1 && != 0    On

This should have no effect on acpi_asus_attach which only calls
led_create_state with state set to 1. Updated acpi_ibm_attach
in order to avoid surprises.

Differential Revision:	https://reviews.freebsd.org/D2615
Submitted by:	John Wehle
Reviewed by:	gonzo, loos
2015-05-24 07:45:42 +00:00
Ganbold Tsagaankhuu
236c6f68db Enable leds for VSATV102 in dts.
Differential Revision:	 https://reviews.freebsd.org/D2614
Submitted by:	John Wehle
2015-05-24 07:09:16 +00:00
Andrew Turner
e81032ad24 Fix a lock up where we enter swapper() with interrupts disabled.
In smp_rendezvous_cpus we expect to wait for all cpus to enter
smp_rendezvous_action. If we call this holding a proc lock swapper may
attempt to also lock it, however as interrupts are disabled the cpu never
handles the ipi. Because smp_rendezvous_action waits for all signaled
cpus before contining it may get caught waiting for the cpu running swapper
as the proc mutex will be unlocked after smp_rendezvous_cpus finishes.

The fix is to enable interrupts in the configure stage as we should be
doing.

MFC after:	1 week
2015-05-23 23:08:16 +00:00
Andrew Turner
f22cb06aeb Use the wait-for-event instruction to put the core we have just enabled
to sleep while it waits to start scheduling. The boot core can then use
the send-event instruction to wake the cores when they should enter the
scheduler.

MFC after:	1 week
2015-05-23 22:28:59 +00:00
Rick Macklem
262a84286d The NFS client generated directory block(s) with d_fileno == 0
so that it would not return less data than requested.
Since returning less directory data than requested is not a problem
for FreeBSD and even UFS no longer returns directory structures
with d_fileno == 0, this patch stops the client from doing this.
Although entries with d_fileno == 0 should not be a problem,
the man pages no longer document that these entries should be
ignored, so there was a concern that these entries might be an
issue in the future.

Suggested by:	trasz
Tested by:	trasz
MFC after:	2 weeks
2015-05-23 21:58:41 +00:00
Sergey Kandaurov
7440be2dcb Update P_TOTAL_STOP commentary. 2015-05-23 21:04:15 +00:00
Konstantin Belousov
3077f938b4 If thread requested to not stop on non-boundary, then not only
stopping signals should obey, but also all forms of single-threading.
Otherwise, thread might sleep interruptible while owning some
resources, and single-threading thread could try to access them.
An example is owning vnode lock while dumping core.

Submitted by:	Conrad Meyer
Review:	https://reviews.freebsd.org/D2612
Tested by:	pho
MFC after:	1 week
2015-05-23 19:09:04 +00:00
Alan Cox
940be86497 Simplify the allocation of page table pages for mips64. Specifically,
when allocation fails, it suffices to perform VM_WAIT.  The direct map
covers the entirely of physical memory, so unlike 32-bit mips any
physical page can be used as a page table page.
2015-05-23 16:54:46 +00:00
Pedro F. Giffuni
0a95ab74df ddb: de-register 2015-05-23 14:59:27 +00:00
Andrew Turner
66cbed6659 Remove an unused header. 2015-05-23 14:48:03 +00:00
Andrey V. Elsukov
79077edc1a Properly update TX statistics for wlan(4).
ieee80211_pwrsave() can fail due to queue overflow, check its return code
and increment oerrors counter when it fails. Also handle more error cases
and update oerrors counter when we don't send mbuf due to some errors.
Return ENETDOWN when parent interface isn't ready. Update obytes and omcasts
counters in corresponding places.

PR:		184626
Differential Revision:	https://reviews.freebsd.org/D2621
Reviewed by:	adrian
MFC after:	1 week
2015-05-23 09:49:40 +00:00
Adrian Chadd
967e8d3778 Add support for the tuning cap for Hornet/AR9331 boards.
This dramatically improves RX sensitivity and behaviour on the
AR9331 hardware I have, including the Carambola 2.

Tested:

* AR9331, Carambola 2 board

Submitted by:	Zilvinas Valinskas <zilvinas.valinskas@gmail.com>
2015-05-23 08:02:54 +00:00
Neel Natu
47b9935d9b Exceptions don't deliver an error code in real mode.
MFC after:	1 week
2015-05-23 01:17:50 +00:00
Warner Losh
ee960398a0 Fix typo in symbol name. It helps to hit save in all your buffers
before committing.
2015-05-22 21:10:14 +00:00
Neel Natu
f149ce540e Remove the verification of instruction length after instruction decode. The
check has been bogus since r273375.

MFC after:	1 week
2015-05-22 21:09:11 +00:00
Warner Losh
d36eec691a Export the eflags field from the elf header. This allows better
discrimination between different subarch binaries, at least for mips
and arm. Arm is implemented, mips is still tbd, so not currently
exported. aarch64 does not export this because aarch64 binaries use
different tags and flags than arm.

Differential Revision: https://reviews.freebsd.org/D2611
2015-05-22 20:50:35 +00:00
Pedro F. Giffuni
7fb888588c ddb: Use NULL for pointers
Hinted by:	DragonflyBSD
2015-05-22 19:04:06 +00:00
Neel Natu
1c73ea3ef8 Don't rely on the 'VM-exit instruction length' field in the VMCS to always
have an accurate length on an EPT violation. This is not needed by the
instruction decoding code because it also has to work with AMD/SVM that
does not provide a valid instruction length on a Nested Page Fault.

In collaboration with:	Leon Dang (ldang@nahannisys.com)
Discussed with:		grehan
MFC after:		1 week
2015-05-22 17:34:22 +00:00
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Sean Bruno
316f4c880a Bump rx_overruns when indicated by the ICR mask.
PR:		199716
MFC after:	3 days
Sponsored by:	Limelight Networks
2015-05-22 17:01:43 +00:00
Andrew Turner
7c909980ef Add a miibus_statchg and use it to enable Gigabit mode when appropriate.
MFC after:	1 week
2015-05-22 14:25:23 +00:00
John Baldwin
21119d0641 Expand ktr_mask to be a 64-bit unsigned integer.
The mask does not really need to be updated with atomic operations and
the downside of losing races during transitions is not great (it is
not marked volatile, so those races are pretty wide open as it is).

Differential Revision:	https://reviews.freebsd.org/D2595
Reviewed by:	emaste, neel, rpaulo
MFC after:	2 weeks
2015-05-22 11:09:41 +00:00
John Baldwin
c209e3e2e6 Only reparent a traced process to its old parent if the tracing process is
not the old parent. Otherwise, proc_reap() will leave the zombie in place
resulting in the process' status being returned twice to its parent.

Add test cases for PT_TRACE_ME and PT_ATTACH which are fixed by
this change.

Differential Revision:	https://reviews.freebsd.org/D2594
Reviewed by:	kib
MFC after:	2 weeks
2015-05-22 11:04:54 +00:00
John Baldwin
312827253b Always set p_oppid when attaching to an existing process via procfs
tracing.  This matches the behavior of ptrace(PT_ATTACH).  Also,
the procfs detach request assumes p_oppid is always set.

Reviewed by:	kib
MFC after:	2 weeks
2015-05-22 11:03:51 +00:00
Andrew Rybchenko
1217b24e51 sfxge: relax assertion to allow RST flag in TSO packets
Kernel under stress load, mixed MC reboot and sfupdate really
generates TSO packet with RST flag.
It will generate many TCP packets with RST flag set.
May be RST flag should be set in the last segment only, but it could be
dropped. So, it is safer to keep the flag in all packets to be sure that
connection is reset.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2609
2015-05-22 07:39:21 +00:00
Warner Losh
c0b346c47d Need to handle the !FDT case still too... I thought in r270025 we
wouldn't need it, but it appears that we still do for the moment...
2015-05-22 05:02:53 +00:00
Oleksandr Tymoshenko
5b03aba6c8 Switch TI platform support code from using FreeBSD's custom-baked DTS
files to vendor-provided ones. It should make easier to adopt platform
code to new revisions of hardware and to use DTS overlays for various
Beaglebone extensions (shields/capes).

Original dts filenames were not changed, they're now wrappers over dts
files provided by TI. So make sure you update .dtb files on your
devices as part of kernel update

GPIO addressing was changed: instead of one global /dev/gpioc0 there
are per-bank instances of /dev/gpiocX. Each bank has 32 pins so for
instance pin 121 on /dev/gpioc0 in old addressing scheme is now pin 25
on /dev/gpioc3

On Pandaboard serial console devices was changed from /dev/ttyu0 to
/dev/ttyu2 so you'll have to update /etc/ttys to get login prompt
on serial port in multiuser mode. Single user mode serial console
should work as-is

Differential Revision:	https://reviews.freebsd.org/D2146
Reviewed by:	rpaulo, ian, Michal Meloun, Svatopluk Kraus
2015-05-22 03:16:18 +00:00
Oleksandr Tymoshenko
2569f51471 Add helper method fdt_find_child to make access to child nodes easier.
Some FDT nodes have complex properties organized as a child sub-nodes
(e.g. timing for LCD panel) we need easy way to obtain handles for
these sub-nodes
2015-05-22 02:00:44 +00:00
David C Somayajulu
bfdeba0cb3 Add stat counters for Jumbo Frames using SGE ring.
Also remove the checks for IFCAP_LRO in bxe_alloc_fp_buffers() and bxe_pf_rx_q_prep() since both TPA and Jumbo can use SGE ring.

Submitted by:gary.zambrano@qlogic.com
Approved by:davidcs@freebsd.org
MFC after:5 days
2015-05-22 01:44:07 +00:00
Rick Macklem
86b9457f5b The NFS client wasn't handling getdirentries(2) requests for sizes
that are not an exact multiple of DIRBLKSIZ correctly. Fortunately
readdir(3) always uses an exact multiple of DIRBLKSIZ, so few applications
were affected. This patch fixes this problem by reducing the size
of the directory read to an exact multiple of DIRBLKSIZ.

Tested by:	trasz
Reported by:	trasz
Reviewed by:	trasz
MFC after:	2 weeks
2015-05-21 23:14:18 +00:00
David C Somayajulu
3d60b1448f Limit the size of the posted receive buffers in Rx Rings to MJUMPAGESIZE. Previously for jumbo MTUs, the rx ring buffers were
MTU + any required pad. Now when this size greater than MJUMPAGESIZE, the packet is spanned across multiple buffers and the
mbufs are stiched together.

Submitted by:gary.zambrano@qlogic.com
Approved by:davidcs@freebsd.org
2015-05-21 20:47:19 +00:00
Luiz Otavio O Souza
ba6fc1c73c Raise the SDHCI timeout to 10 seconds and add a sysctl to allow changing
this value at runtime.

The SD card specification says that a block write or a block erase can take
up to 250ms to complete and thus, under some circumstances, the existent 2
seconds timeout was triggering with normal usage.

This change fixes the sporadic controller timeout that happens on RPi and
RPi 2.

Discussed with:		ian (some time ago)
2015-05-21 20:09:36 +00:00
Jung-uk Kim
9cf4cabed7 Do not probe Intel PIIX4 south bridge quirks on amd64. These quirky south
bridges only supported Intel Pentium and Pentium II era processors and there
is no reason for hardware virtualizations to emulate these quirks.

MFC after:	1 week
2015-05-21 19:31:10 +00:00
Neel Natu
b32d1908d5 Emulate the "CMP r/m, reg" instruction (opcode 39H).
Reported and tested by:	Leon Dang (ldang@nahannisys.com)
MFC after:	1 week
2015-05-21 18:23:37 +00:00
Dimitry Andric
4deaeac3c5 Ensure that the static structs emitted by the MODULE_DEPEND() and
MODULE_VERSION() macros don't end up as .comm symbols, when all the
version fields are zero.

Normally, such symbols will end up in .bss, but for kernel module
version objects, this can lead to "garbage" version numbers.

Fix this by instructing the compiler to always put these structs in the
.data segment instead.

Reported by:	delphij, ae
MFC after:	1 week
2015-05-21 17:40:53 +00:00
Luiz Otavio O Souza
6a11fa4e31 Add the MMC/SD driver for Allwinner SoCs.
This is based on the patch sent by Alexander Fedorov with the following
fixes/improvements:

 - Better error handling;
 - Clock is derived from PLL6 (obtained from netbsd);
 - No more unnecessary busy loops on interrupt handler;
 - style(9) fixes and code cleanup.

I also want to thanks Martin Galvan who has sent an alternative
implementation with some interesting fixes.

Tested on CubieBoard2, Banana-Pi (thanks to netgate!) and Cubieboard1
(Pratik Singhal).

This is intended to pave the way for the upcoming GSoC work (and make
easier the build of images for the supported boards).

PR:		196081
Submitted by:	Alexander Fedorov <alexander.fedorov@rtlservice.com>
2015-05-21 17:39:42 +00:00
John Baldwin
c636f94bd2 Revert r282971. It depends on condvar consumers not destroying condvars
until all threads sleeping on a condvar have resumed execution after being
awakened.  However, there are cases where that guarantee is very hard to
provide.
2015-05-21 16:43:26 +00:00
John-Mark Gurney
b6fb3fe0bd remove stray ; that came in r272673... 2015-05-21 15:38:43 +00:00
Pedro F. Giffuni
cd508278c1 ddb: finish converting boolean values.
The replacement started at r283088 was necessarily incomplete without
replacing boolean_t with bool.  This also involved cleaning some type
mismatches and ansifying old C function declarations.

Pointed out by:	bde
Discussed with:	bde, ian, jhb
2015-05-21 15:16:18 +00:00
Ganbold Tsagaankhuu
c9254c8540 Add missing break statement.
Submitted by:	  John Wehle
2015-05-21 07:35:20 +00:00
Ganbold Tsagaankhuu
3c17c95097 Add driver for usbclock generator for earlier amlogic chip.
Differential Revision:	https://reviews.freebsd.org/D2590
Submitted by:		John Wehle
2015-05-21 07:23:50 +00:00
Ganbold Tsagaankhuu
e39d48908b Remove unnecessary break statements.
Submitted by:	   John Wehle
2015-05-21 07:09:01 +00:00
Ganbold Tsagaankhuu
37da2ff61a The RTC initialization values are based on the SoC which can be
determined at runtime so there's no need to set the values in
each DTS.
Tested on YYHD18 (aml8726-m3), VSATV102 (aml8726-m6), and
ODROIDC1 (aml8726-m8b).

Differential Revision:	https://reviews.freebsd.org/D2588
Submitted by:		John Wehle
2015-05-21 07:01:08 +00:00
Konstantin Belousov
2c20bd8b99 Do grammar fix in the comment to record the right commit message for
r283162.

Fix a cosmetic issue with vm_page_alloc() calling vm_page_free_toq()
with the page not completely satisfying vm_page_free() assertions.
The page is not owned by the object, since insertion failed.  But
besides m->object reset to NULL, we should also set VPO_UNMANAGED flag
for consistency.

Reported by:	pho
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-20 23:15:56 +00:00
Konstantin Belousov
da47499040 Remove the write-only variable phent. We currently do not check the
size of the program header's entries.

Reported by:	adrian (by using gcc 4.9)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-20 23:03:22 +00:00
Mariusz Zaborski
963bc7a03f Fix memory leak.
Approved by:	pjd (mentor)
2015-05-20 17:48:22 +00:00
Mariusz Zaborski
1acd888ff5 Style.
Approved by:	pjd (mentor)
2015-05-20 17:47:01 +00:00
Mariusz Zaborski
823870acb8 Always use the nv_free function.
Approved by:	pjd (mentor)
2015-05-20 17:44:58 +00:00
Mariusz Zaborski
2afcf984b3 Correct variable name in the interface.
Approved by:	pjd (mentor)
2015-05-20 17:42:40 +00:00
Ed Maste
8ff01f5d20 Avoid trying to build cxbge on 32-bit MIPS
It lacks required 64-bit atomics.

Reviewed by:	imp (earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2585
2015-05-20 12:54:22 +00:00
Andrey V. Elsukov
dc4ea824d4 In the reply to SADB_X_SPDGET message use the same sequence number that
was in the request. Some IKE deamons expect it will the same. Linux and
NetBSD also follow this behaviour.

PR:		137309
MFC after:	2 weeks
2015-05-20 11:59:53 +00:00
Gleb Smirnoff
be887eca0b EVENTHANDLER_REGISTER() doesn't fail. 2015-05-20 09:42:33 +00:00
Rui Paulo
c71d7e6735 ti_pruss: pass the correct IRQ to userland.
Also, fix several problems with the kqueue notification.

Submitted by:	Manuel Stühn freebsdnewbie at freenet.de
2015-05-20 06:23:01 +00:00
Ganbold Tsagaankhuu
206e21a41a D2432 (Patch for Amlogic single core PIC) moved the SMP option out
of AML8726 and into board specific config files since some boards
(e.g. YYHD18) use the aml8726-m3 which only have a single core.

r283057 applied most of D2432, however while it removed SMP from
AML8726, it missed adding the SMP option to the board specific
config files.

Differential Revision:	https://reviews.freebsd.org/D2589
Submitted by:	John Wehle
2015-05-20 05:49:52 +00:00
Hiren Panchasara
2645638064 Add a new sysctl net.inet.tcp.hostcache.purgenow=1 to expire and purge all
entries in hostcache immediately.

In collaboration with:	bz, rwatson
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Limelight Networks
2015-05-20 01:08:01 +00:00
Warner Losh
25b2c4df89 Re-select the SD card before getting the SD status. On a couple Atmel
boards, this prevents some error messages during enumeration and also
gives us the correct erase block size. They appear to be harmless
elsewhere.

# Note: we treat too many commands as 'can't fail' if they don't work
# after a couple of retries. We need to fix that, but not today...
2015-05-19 21:16:53 +00:00
Warner Losh
4f3f6e1768 Add NFS server to mix (for easier, in-place updates). Move to
partition 2 for root (since partition 1 is reserved for FAT
files the Atmel ROMs can load).
2015-05-19 21:16:51 +00:00
Warner Losh
60c481355c Improve comment about unmapped I/O and fix typos.
Submitted by: Matteo Riondato
MFC After: 2 days
2015-05-19 21:16:37 +00:00
Hiren Panchasara
c52102dd25 Correct the wording as we are increasing the window size.
Reviewed by:	jhb
Sponsored by:	Limelight Networks
2015-05-19 19:17:20 +00:00
John Baldwin
a1febbf667 Fix two bugs that could result in PMC sampling effectively stopping.
In both cases, the the effect of the bug was that a very small positive
number was written to the counter. This means that a large number of
events needed to occur before the next sampling interrupt would trigger.
Even with very frequently occurring events like clock cycles wrapping all
the way around could take a long time. Both bugs occurred when updating
the saved reload count for an outgoing thread on a context switch.

First, the counter-independent code compares the current reload count
against the count set when the thread switched in and generates a delta
to apply to the saved count. If this delta causes the reload counter
to go negative, it would add a full reload interval to wrap it around to
a positive value. The fix is to add the full reload interval if the
resulting counter is zero.

Second, occasionally the raw counter value read during a context switch
has actually wrapped, but an interrupt has not yet triggered. In this
case the existing logic would return a very large reload count (e.g.
2^48 - 2 if the counter had overflowed by a count of 2). This was seen
both for fixed-function and programmable counters on an E5-2643.
Workaround this case by returning a reload count of zero.

PR:		198149
Differential Revision:	https://reviews.freebsd.org/D2557
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Norse Corp, Inc.
2015-05-19 19:15:19 +00:00
John Baldwin
2b1df86c17 Use the proper mask when reloading sampling PMCs for Core CPUs.
Differential Revision:	https://reviews.freebsd.org/D2492
Reviewed by:	emaste
MFC after:	1 month
2015-05-19 19:01:22 +00:00
John Baldwin
0ceb54c2cf Use fixed enum values for PMC_CLASSES().
This removes one of the frequent causes of ABI breakage when new CPU
types are added to hwpmc(4).

Differential Revision:	https://reviews.freebsd.org/D2586
Reviewed by:	davide, emaste, gnn (earlier version)
MFC after:	2 weeks
2015-05-19 18:58:18 +00:00
John Baldwin
4e8e1ebd71 Remove executable property from several ixl(4) source files.
Differential Revision:	https://reviews.freebsd.org/D2583
Reviewed by:	erj
2015-05-19 18:35:18 +00:00
Andrey V. Elsukov
4ec5fcbe09 Remove unneded mbuf length adjustment, M_PREPEND() already did that.
PR:		139387
MFC after:	1 week
2015-05-19 17:14:27 +00:00
Luigi Rizzo
62f42cf8ee use proper types to represent function pointers 2015-05-19 16:51:30 +00:00
Alan Somers
7a9c38e681 Properly null-terminate strings in a kernel dump header. A version string
longer than 192 bytes will cause the version field of a dump header to
overflow. strncpy doesn't null terminate it, so savecore will print a
corrupted info file. Using strlcpy fixes the bug.

Differential Revision:	https://reviews.freebsd.org/D2560
Reviewed by:		markj
MFC after:		3 weeks
Sponsored by:		Spectra Logic
2015-05-19 16:23:47 +00:00
Luigi Rizzo
352bc63d72 remove a redundant ; at the end of a function
MFC after:	1 week
2015-05-19 15:29:00 +00:00
Ruslan Bukin
bc88bb2bf3 Add Performance Monitoring Counters support for AArch64.
Family-common and CPU-specific counters implemented.

Supported CPUs: ARM Cortex A53/57/72.

Reviewed by:	andrew, bz, emaste, gnn, jhb
Sponsored by:	ARM Limited
Differential Revision:	https://reviews.freebsd.org/D2555
2015-05-19 15:25:47 +00:00
Luigi Rizzo
bebf3c825f remove an extra ; after MODULE_DEPEND
(would otherwise generate a warning with more verbose compiler flags)

MFC after:	1 week
2015-05-19 14:49:31 +00:00
Ed Maste
2e02bd2204 Add GRP_COMDAT section group flag to ELF header
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2582
2015-05-19 14:23:33 +00:00
Konstantin Belousov
d9e8bbb64d When sleeping in Sx state using MWAIT instruction, accept fast wakeup
requests from writes to the monitored line.

Submitted by:	avg
2015-05-19 14:21:00 +00:00
Gleb Smirnoff
3dd01a884c Use MTX_SYSINIT() instead of mtx_init() to separate mutex initialization
from associated structures initialization.  The mutexes are global, while
the structures are per-vnet.

Submitted by:	Nikos Vassiliadis <nvass gmx.com>
2015-05-19 14:04:21 +00:00
Gleb Smirnoff
30fe681e44 During module unload unlock rules before destroying UMA zones, which
may sleep in uma_drain(). It is safe to unlock here, since we are already
dehooked from pfil(9) and all pf threads had quit.

Sponsored by:	Nginx, Inc.
2015-05-19 14:02:40 +00:00
Andrey V. Elsukov
153c57b5b4 Read GEOM_UNCOMPRESS metadata using several requests that fit into
MAXPHYS. For large compressed images the metadata size can be bigger
than MAXPHYS and this triggers KASSERT in g_read_data().
Also use g_free() to free memory allocated by g_read_data().

PR:		199476
MFC after:	2 weeks
2015-05-19 09:28:52 +00:00
Hans Petter Selasky
68691fe0ce Fix for DWC OTG device side isochronous transfers. The even or odd
isochronous frame bit needs to be flipped.

MFC after:	3 days
2015-05-19 09:22:06 +00:00
Andrey V. Elsukov
5bae2b34a4 Change SA's state before sending SADB_EXPIRE message. This state will
be reported to keying daemon.

MFC after:	2 weeks
2015-05-19 08:37:03 +00:00
Andrey V. Elsukov
664802113f Teach key_expire() send SADB_EXPIRE message with the SADB_EXT_LIFETIME_HARD
extension header type. The key_flush_sad() now will send SADB_EXPIRE
message when HARD lifetime expires. This is required by RFC 2367 and some
keying daemons rely on these messages. HARD lifetime messages have
precedence over SOFT lifetime messages, so now they will be checked first.
Also now SADB_EXPIRE messages will be send even the SA has not been used,
because keying daemons might want to rekey such SA.

PR:		200282, 200283
Submitted by:	Tobias Brunner <tobias at strongswan dot org>
MFC after:	2 weeks
2015-05-19 08:30:04 +00:00
Adrian Chadd
d395135696 Convert routerstation to use geom_uncompress. 2015-05-19 06:45:56 +00:00
Adrian Chadd
946b5412be Migrate RSPRO to use the uncompress module, not uzip.
(This is hand-in-hand with what I'm about to do with freebsd-wifi-build.)
2015-05-19 06:45:06 +00:00
Adrian Chadd
3d191bf47c QCA955x / AP135 platform tidyups.
* Change mips24k -> mips74k for hwpmc, but leave it disabled for now.
* don't build pci by default.
* build pci and qca955x_pci for AP135, as theres a PCIe NIC.
* don't build a hwpmc module, it doesn't really work out well
  for the mips boards at the moment.
* add ipfw and DEFAULT_TO_ACCEPT.
2015-05-19 05:41:00 +00:00
Adrian Chadd
3cbe641352 The AP135 PCIe NIC isn't an ath device, it's an 11ac part (linux ath10k.)
So, don't try to attach hints to it here.
2015-05-19 05:33:07 +00:00
Adrian Chadd
b2c9e1e324 Add initial support for the QCA955x PCIe host controller.
The QCA955x looks a lot like the AR724x PCIe controller, except it
supports two root complexes.  Unfortunately I only have one, so
although this code has started down the path of supporting more than
one, it's definitely not yet ready.

Tested:

* AP135 board (QCA9558 SoC), with the 11ac NIC swapped for an AR9380
  PCIe NIC.

Notes:

* Yes, this driver isn't very pretty.  I decided to commit what I have
  versus holding onto something that isn't yet finished.  It is enough
  to bring up the above NIC and interrupt routing works, so it's a good
  start.

* However, yes, the DDR flush routine hooks need to be fixed up.
  I don't think I'm firing the right one at the moment.
2015-05-19 05:31:58 +00:00
Jung-uk Kim
a371a5fd85 Merge ACPICA 20150515. 2015-05-18 23:46:11 +00:00
Pedro F. Giffuni
2b490bc747 ddb: stop boolean screaming.
TRUE --> true
FALSE--> false

Hinted by:	NetBSD
2015-05-18 22:27:46 +00:00
Luiz Otavio O Souza
2b6bbe110f Remove unnecessary devices from allwinner kernels. 2015-05-18 18:25:38 +00:00
Ian Lepore
501c31ad4a Enable the NETIF_OPEN_CLOSE_ONCE option for ubldr. This keeps the network
interface open continuously instead of closing it after each filesystem
access and reopening it before the next (causing it to re-obtain network
params each time).  This vastly speeds up netbooting.
2015-05-18 16:43:21 +00:00
Hans Petter Selasky
2624de5c56 Make the FIFO configuration a bit more flexible for the DWC OTG in
device side mode.
2015-05-18 16:18:04 +00:00
Ian Lepore
dfad72a7d7 Add a routine to obtain netboot parameters from the U-Boot env vars. Call
it from the uboot net_init() implementation.  The routine uses the standard
U-Boot env vars plus a freebsd-specific variable named "rootpath" (the
corresponding u-boot variable for that would be "bootfile" except that it
refers to ubldr, so a new name was needed to communicate the path to ubldr).

This allows ubldr to load a kernel from nfs without requiring a dhcp or
bootp server to provide the server ip and rootpath parameters.
2015-05-18 16:12:41 +00:00
Hans Petter Selasky
8dca9c27c9 Fix an off-by-one error by adding proper range checks when parsing the
HDA association descriptors. This fixes a crash during device probe
for some HDA PCI devices.

Reported by:	David Wolfskill <david@catwhisker.org>
Reviewed by:	mav @
MFC after:	1 week
2015-05-18 16:02:44 +00:00
Gleb Smirnoff
78680d05d1 A miss from r283061: don't dereference NULL is pf_get_mtag() fails.
PR:		200222
Submitted by:	Franco Fichtner <franco opnsense.org>
2015-05-18 15:51:27 +00:00
Ian Lepore
b32852bef6 Refactor net_getparams() to make it easier to get params from sources other
than bootp and rarp.

The code which splits a serverip:/rootpath string into rootip and a plain
pathname is now a separate net_parse_rootpath() function that can be
called by others.  The code that sets the kernel env vars needed for
nfs_diskless is moved into net_open() so that the variables get set no
matter where the params came from.

There was already code in net_open() that allowed for the possibility that
some other entity has set up the network-related global variables.  It uses
the rootip variable as the key, assuming that if it is set all the other
required variables are set too.  These changes don't alter the existing
behavior, they just make it easier to actually write some new code to get
the params from another source (such as the U-Boot environment).
2015-05-18 15:46:43 +00:00
Gleb Smirnoff
b7f69c506d Don't dereference NULL is pf_get_mtag() fails.
PR:		200222
Submitted by:	Franco Fichtner <franco opnsense.org>
2015-05-18 15:05:12 +00:00
Mateusz Guzik
747c0dd67c fd: fix imbalanced fdp unlock in F_SETLK and F_GETLK
MFC after:	3 days
2015-05-18 14:27:04 +00:00
Mateusz Guzik
c3293b83c4 Tidy up sys_umask a little bit
Consistently use saved fdp pointer as it cannot change. If it could change the
code would be already incorrect.

No functional changes.
2015-05-18 13:43:33 +00:00
Andrew Turner
a6ffc42f7a Clean up the Amlogic interrupt controller driver to handle the case where
we have both the Amlogic pic and a GIC. This may be the case in some
configurations.

Differential Revision:	https://reviews.freebsd.org/D2432
Submitted by:	John Wehle <john@feith.com>
2015-05-18 11:04:07 +00:00
Wei Hu
17b8760445 Add support for SCSI disk hot add and remove. Also add padding according to
the requirement of different hypervisor releases.

Submitted by:	whu
Reviewed by:	royger
Approved by:	royger
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D2512
2015-05-18 10:31:23 +00:00
Andrew Turner
87c74046b6 Clean up the style to be "include<space><tab>" and remove options already
in std.armv6.
2015-05-18 08:12:08 +00:00
Andrew Rybchenko
8a343f93e6 sfxge: do not advertise LRO capability if LRO is compiled out
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2565
2015-05-18 06:07:02 +00:00
Andrew Rybchenko
921f3bd2df sfxge: automatically turn off TSO when Tx checksum offload is disabled
Also return error if TSO is requested without Tx checksum offload.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2564
2015-05-18 06:04:20 +00:00
Andrew Rybchenko
4cefd52431 sfxge: allow to disable checksum offloads over VLAN
It just affects capabilities of the created VLAN interface.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2563
2015-05-18 06:03:21 +00:00
Andrew Rybchenko
f080384c8f sfxge: fix overflow queue freeze
If TxQ lock is obtained, deferred packet list shold be serviced even if
the packet addition fails because of overflow.

Without the patch freeze happens if:
 - queue is not blocked (i.e. completion does not trigger unblock and service)
 - put-list overflow (1024 entries)
 - sfxge_tx_packet_add() acquires TxQ lock just as it is released it in
   sfxge_tx_qdpl_service() on the second CPU but before pending check
 - sfxge_tx_packet_add() swizzles put-list to get-list, fails because of
   non-tcp get-list overflow and returns without packet list service
 - sfxge_tx_qdpl_service() on the second CPU checks that there are no
   pending packets in the put-list and returns

Other possible solution is to guaranee that maximum length of the put-list
is less than maximum length of any get-list.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2562
2015-05-18 06:02:22 +00:00
Ian Lepore
45f8d9f9a8 An ARM kernel can be loaded at any 2MB boundary, make ubldr aware of that.
Previously, ubldr would use the virtual addresses in the elf headers by
masking off the high bits and assuming the result was a physical address
where the kernel should be loaded.  That would sometimes discard
significant bits of the physical address, but the effects of that were
undone by archsw copy code that would find a large block of memory and
apply an offset to the source/dest copy addresses.  The result was that
things were loaded at a different physical address than requested by the
higher code layers, but that worked because other adjustments were applied
later (such as when jumping to the entry point).  Very confusing, and
somewhat fragile.

Now the archsw copy routines are just simple copies, and instead
archsw.arch_loadaddr is implemented to choose a load address.  The new
routine uses some of the code from the old offset-translation routine to
find the largest block of ram, but it excludes ubldr itself from that
range, and also excludes   If ubldr splits the largest block of ram in
two, the kernel is loaded into the bottom of whichever resulting block is
larger.

As part of eliminating ubldr itself from the ram ranges, export the heap
start/end addresses in a pair of new global variables.

This change means that the virtual addresses in the arm kernel elf headers
now have no meaning at all, except for the entry point address.  There is
an implicit assumption that the entry point is in the first text page, and
that the address in the the header can be turned into an offset by masking
it with PAGE_MASK.  In the future we can link all arm kernels at a virtual
address of 0xC0000000 with no need to use any low-order part of the
address to influence where in ram the kernel gets loaded.
2015-05-17 19:59:05 +00:00
Andrew Turner
b7112ead32 Clean up struct syscall_args:
1. Align to a 64-bit address so 64-bit data will be correctly aligned.
 2. Add a comment explaining why.
 3. Remove an unneeded value from the struct.

This fixes an issue where the struct may not be correctly aligned on the
stack in the syscall function. This may lead to accesing a 64-bit value
at a non 64-bit. This will raise an exception and panic the kernel.

We have been lucky where on arm and armv6 both clang and gcc correctly
align the data, even without us asking to, however, on armeb with clang to
not be the case. This tells the compiler we really do need this to be
aligned.

Reported and tested by:	jmg (on armeb with clang)
MFC after:	1 Week [1, 2]
2015-05-17 18:35:58 +00:00
Ian Lepore
afd1f4a7e3 Do not set preload_addr_relocate for ARM. Apparently there was a time
when loader(8) passed physical addresses in loader metadata for arm, but
that is no longer true; all metadata has already been adjusted to vitual
addresses by loader.

I can't track down the exact revision in loader where a change from physical
to virtual metadata addresses happened.  The code involved is very twisty
and complicated.  I suspect the change was an unintended consequence of the
r247301, r247413, r248118 series of changes I made a couple years ago.
2015-05-17 17:03:37 +00:00
Adrian Chadd
623d2d40af Increment the vm stats "v_intr" counter so the global system interrupt
statistics work again.

I'm not sure why/when this broke, only that it used to work fine.

This commit is brought to you by Maker Faire Bay Area 2015.
2015-05-16 23:51:24 +00:00
Warner Losh
d3eacc0e47 Don't allow unmapped I/O. The pmap isn't quite up to the task. Add a
comment to this effect and switch the default. My old AT91SAM9G20
now boots, fsck's the SD card and runs w/o an issue for the first
time since a 9.1-ish stable build I did a few years ago.

Problems with unmapped I/O:
o un-page-aligned I/O requests to devices fail (notably fsck
  and newfs).
o write-back caching was totally broken. write-through caching
  needed to be enabled.
o Even page-aligned I/O requests sometimes failed for reasons
  not thoroughly investigated.

Suggested by: ian@
MFC after: 2 days
2015-05-16 21:24:32 +00:00
Ian Lepore
7ca89258e5 Re-link ubldr when any of its libraries change. 2015-05-16 21:08:33 +00:00
Rui Paulo
fe3155baa8 acpi_ibm: whitespace. 2015-05-16 20:06:39 +00:00
Bjoern A. Zeeb
ccc1c723b6 More tr -d '\r' t make config happy and
some re-alignment whitespace changes.
2015-05-16 20:04:49 +00:00
Alexander V. Chernikov
5446b3f1d4 * Update SFF-8024 Identifier constants.
* Fix SFF_8436_CC_EXT in SFF-8436 memory map.
* Add SFF-8436/8636 bits (revision compliance/nominal bitrate).
* Do some small style/type fixes.
2015-05-16 13:11:35 +00:00
Andrew Rybchenko
c379e930e7 sfxge: avoid usage of ifm_data
The driver uses ifm_data to save capabilities mask calculated during
initialization when supported phy modes are discovered.
The patch simply calculates it when either media or options are changed.

Reviewed by:    glebius
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2540
2015-05-16 10:35:30 +00:00
Thomas Quinot
b9c6f643f1 Minor comments fixes 2015-05-16 10:31:15 +00:00
Bjoern A. Zeeb
73f1e30fa6 tr -d '\r' makes config a lot more happy. 2015-05-16 10:27:27 +00:00
Andrew Rybchenko
ef97c04bc5 sfxge: add local variable with changed capabilities mask
It is required for the next patch which adds dependency of TSO
capabilities from Tx checksum offloads.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2553
2015-05-16 06:04:53 +00:00
Adrian Chadd
64b9bdcf18 Various iwn(4) fixes.
* simplify channel logic for determining RF gain setting in scan setup
* don't set TX timer on error
* free node references for unsent frames on device stop
* set maxfrags to IWN_MAX_SCATTER-1 (first segment is used by TX command)
* add missing IWN_UNLOCK() from interrupt path when the hardware
  disappears.
* pass control frames to host
* nitems() instead of local macro

Tested:

* Intel 5100, STA mode

PR:		kern/196264
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-16 05:59:25 +00:00
Andrew Rybchenko
0e4ebe6c4d sfxge: move mbuf free to sfxge_if_transmit()
It is a preparation to the next patch which will service packet queue even
if packet addtion fails.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2552
2015-05-16 05:43:20 +00:00
Andrew Rybchenko
deee1de4bf sfxge: get rid of locked variable in sfxge_tx_packet_add()
Now each branch has one and only one possible TxQ lock state.
It simplifies understanding of the code.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2551
2015-05-16 05:37:47 +00:00
Andrew Rybchenko
b5bae9f4f2 sfxge: support Rx checksum offloads disabling
We can't disable it in HW, but we can ignore result.
Discard Rx descriptor checksum flags if Rx checksum offload is off.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2544
2015-05-16 05:36:40 +00:00
Adrian Chadd
4f5e270a93 Update the comments to match what the code ended up becoming.
-1 is now "no locality information available".

Sponsored by:	Norse Corp, Inc.
2015-05-15 21:33:19 +00:00
Pedro F. Giffuni
4ea76c2d38 Break apart the gnu_inline attribute and use "artificial" if available.
Missing #endif (in wrong place)

Pointed hat:	me
2015-05-15 20:53:43 +00:00
Pedro F. Giffuni
24bbddbbd1 Break apart the gnu_inline attribute and use "artificial" if available.
Missing #endif

Reported by:	jhb, jenkins
Pointed hat:	me
2015-05-15 20:47:25 +00:00
Pedro F. Giffuni
ee90489bc4 Make use of GCC alloc_align attribute
This lets the compiler know about the alignment of pointers returned
by aligned_alloc(3), posix_memalign(3). and contigmalloc(9)

Currently this is only supported in recent gcc but we are ready to
use it if clang implements it.

Relnotes:	yes
2015-05-15 20:43:37 +00:00
Pedro F. Giffuni
77ac67e29d Break apart the gnu_inline attribute and use "artificial" if available.
In general it is bad practice to use the gnu_inline attribute but we
will need it in special cases like FORTIFY_SOURCE. In this specific
case it is also useful to have the "artificial" attribute:

"This attribute is useful for small inline wrappers which if possible
should appear during debugging as a unit, depending on the debug info
format it will either mean marking the function as artificial or using the
caller location for all instructions within the inlined body."

This attribute appears to be currently implemented only in GCC. Use it
only in conjuntion with gnu_inline in the cases where it is available,
which is similar in spirit in how it's used in glibc.
2015-05-15 19:51:05 +00:00
Zbigniew Bodek
4d892e4f22 Introduce support for the Alpine PoC from Annapurna Labs
The Alpine Platform-On-Chip offers multicore processing
(quad ARM Cortex-A15), 1/10Gb Ethernet, SATA 3, PCI-E 3,
DMA engines, Virtualization, Advanced Power Management and other.

This code drop involves basic platform support including:
SMP, IRQs, SerDes, SATA. As of now it is missing the PCIe support.
Part of the functionality is provided by the low-level code (HAL)
delivered by the chip vendor (Annapurna Labs) and is a subject to
change in the future (is planned to be moved to sys/contrib directory).

The review log for this commit is available here:
https://reviews.freebsd.org/D2340

Reviewed by:    andrew, ian, imp
Obtained from:  Semihalf
Sponsored by:   Annapurna Labs
2015-05-15 18:25:48 +00:00
Ian Lepore
a8a4800fff Add assertions that the addresses passed to tlb maintenance are page-aligned.
Perform cache writebacks and invalidations in the correct (inner to outer
or vice versa) order, and add comments that explain that.

Consistantly use 'va' as the variable name for virtual addresses.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-15 18:10:00 +00:00
Ian Lepore
a22f81968f Retrieve the cache parms in the proper arch-specific way.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-15 18:07:58 +00:00
George V. Neville-Neil
a9b294b433 Summary: Remove spurious, extra, next header comments.
Correct the name of the pad length field.
2015-05-15 18:04:49 +00:00
Pedro F. Giffuni
1d8055035f Replace a CONSTCOND for a void value as a replacement for __unreachable builtin
This only applies if we are not using clang or gcc but it lets us use the
__unreachable() buitin in expressions.

Suggested by:	tijl
2015-05-15 17:51:03 +00:00
Patrick Kelsey
dd4fcbc594 When a netmap process terminates without the full set of buffers it
was granted via rings and ni_bufs_list_head represented in those rings
and lists (e.g., via SIGKILL), those buffers are no longer available
for subsequent users for the lifetime of the system. To mitigate this
resource leak, reset the allocator state when the last ref to that
allocator is released.

Note that this only recovers leaked resources for an allocator when
there are no longer any users of that allocator, so there remain
circumstances in which leaked allocator resources may not ever be
recovered - consider a set of multiple netmap processes that are all
using the same allocator (say, the global allocator) where members of
that set may be killed and restarted over time but at any given point
there is one member of that set running.

Based on intial work by adrian@.

Reviewed by: Giuseppe Lettieri (g.lettieri@iet.unipi.it), luigi
Approved by: jmallett (mentor)
MFC after: 1 week
Sponsored by: Norse Corp, Inc.
2015-05-15 15:36:57 +00:00
Ruslan Bukin
a8c5ea04b4 Provide the number of interrupt resources added to the list
by using extra argument, so caller will know that.
2015-05-15 13:55:18 +00:00
John Baldwin
5c894ee2ef Previously, cv_waiters was only updated by cv_signal or cv_wait. If a
thread awakened due to a time out, then cv_waiters was not decremented.
If INT_MAX threads timed out on a cv without an intervening cv_broadcast,
then cv_waiters could overflow. To fix this, have each sleeping thread
decrement cv_waiters when it resumes.

Note that previously cv_waiters was protected by the sleepq chain lock.
However, that lock is not held when threads resume from sleep. In
addition, the interlock is also not always reacquired after resuming
(cv_wait_unlock), nor is it always held by callers of cv_signal() or
cv_broadcast(). Instead, use atomic ops to update cv_waiters. Since
the sleepq chain lock is still held on every increment, it should
still be safe to compare cv_waiters against zero while holding the
lock in the wakeup routines as the only way the race should be lost
would result in extra calls to sleepq_signal() or sleepq_broadcast().

Differential Revision:	https://reviews.freebsd.org/D2427
Reviewed by:	benno
Reported by:	benno (wrap of cv_waiters in the field)
MFC after:	2 weeks
2015-05-15 13:50:37 +00:00
Alexander Motin
5b157f2144 Close some potential races around socket start/close.
There are some reports about panics on ic->ic_socket NULL derefence.
This kind of races is the only way I can imagine it to happen.

MFC after:	2 weeks
2015-05-15 13:36:50 +00:00
Andrey V. Elsukov
c1b4f79dfa Add an ability accept encapsulated packets from different sources by one
gif(4) interface. Add new option "ignore_source" for gif(4) interface.
When it is enabled, gif's encapcheck function requires match only for
packet's destination address.

Differential Revision:	https://reviews.freebsd.org/D2004
Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2015-05-15 12:19:45 +00:00
Konstantin Belousov
100ac78be1 On amd64, make proc0 pmap initialization slightly more correct. In
particular, switch to the proc0 pmap to have expected %cr3 and PCID
for the thread0 during initialization, and the up to date pm_active
mask.

pmap_pinit0() should be done after proc0->p_vmspace is assigned so
that the amd64 pmap_activate() find the correct curproc pmap.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-15 08:30:29 +00:00
Konstantin Belousov
f83e0dcb3a Implement the support for PCID in UP kernels.
Requested by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-15 07:57:47 +00:00
Konstantin Belousov
84cdea97e5 Right now, the process' p_boundary_count counter is decremented by the
suspended thread itself, on the return path from
thread_suspend_check().  A consequence is that return from
thread_single_end(SINGLE_BOUNDARY) may leave p_boundary_count
non-zero, it might be even equal to the threads count.

Now, assume that we have two threads in the process, both calling
execve(2).  Suppose that the first thread won the race to be the
suspension thread, and that afterward its exec failed for any reason.
After the first thread did thread_single_end(SINGLE_BOUNDARY), second
thread becomes the process suspension thread and checks
p_boundary_count.  The non-zero value of the count allows the
suspension loop to finish without actually suspending some threads.
In other words, we enter exec code with some threads not suspended.

Fix this by decrementing p_boundary_count in the
thread_single_end()->thread_unsuspend_one() during marking the thread
as runnable.  This way, a return from thread_single_end() guarantees
that the counter is cleared.  We do not care whether the unsuspended
thread has a chance to run.

Add some asserts to ensure the state of the process when single
boundary suspension is lifted.  Also make thread_unuspend_one()
static.

In collaboration with:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-15 07:54:31 +00:00
Andrew Rybchenko
d6e9f7362a sfxge: split sfxge_tx_qdpl_put() into *_locked() and *_unlocked()
It simplifies understanding of the sfxge_tx_packet_add() logic and
avoids passing of 'locked' to called function.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2547
2015-05-15 06:50:59 +00:00
Andrew Rybchenko
22bc53cb48 sfxge: do not change CSUM_TSO when IFCAP_TSOx is changed
It is simply not required since the kernel checks corresponding
IFCAP_TSOx capability and CSUM_TSO in hw-assisted offloads.
Note that CSUM_TSO is two bits (CSUM_IP_TSO|CSUM_IP6_TSO) and both bits
are set in IPv4 and IPv6 mbufs.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2546
2015-05-15 06:49:43 +00:00
Andrew Rybchenko
3b3390c115 sfxge: LRO may be done only if checksums are OK
Also it is cheaper to check Rx descriptor flags than TCP protocol in IP
header.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2542
2015-05-15 06:48:36 +00:00
Marcelo Araujo
3d6b500ff9 Free vsi->queues after use.
Differential Revision:	D2344
Reviewed by:		erj
2015-05-15 06:11:47 +00:00
Ganbold Tsagaankhuu
3f67197271 It appears to be armv7_sleep is a duplication of armv7_cpu_sleep.
For consistency with the naming conventions used by the other
implementations kill armv7_sleep and keep armv7_cpu_sleep.

Differential Revision:	https://reviews.freebsd.org/D2537
Submitted by:	John Wehle
Reviewed by:	ian@, andrew@
2015-05-15 00:39:51 +00:00
Jim Harris
6e3471bd0b Add nvme and nvd drivers to GENERIC for amd64 and i386.
MFC after:	3 days
Sponsored by:	Intel
2015-05-14 20:19:22 +00:00
Ed Maste
9afb8b24ad Add ELF machine EM_IAMCU, 32-bit Intel MCU
It is e_machine 6, which was previously reserved for 486.
2015-05-14 18:29:05 +00:00
Roger Pau Monné
dbf82bde19 netfront: wait for backend to connect before sending ARP
Netfront has to wait for the backend to switch to state XenbusStateConnected
before sending the ARP request, or else the backend might not be connected
and thus the packet will be lost.

Sponsored by: Citrix Systems R&D
MFC after: 1 week
2015-05-14 16:29:11 +00:00
Pedro F. Giffuni
732b31de5d Add new __unreachable() builtin
This is one of the few post gcc4.2 builtins that has been implemented by
clang:

__builtin_unreachable is used to indicate that a specific point in the
program cannot be reached, even if the compiler might otherwise think it
can. This is useful to improve optimization and eliminates certain
warnings.

Hinted by:	NetBSD
Differential Revision:	https://reviews.freebsd.org/D2536
2015-05-14 15:49:48 +00:00
Jonathan Anderson
60aa2c85fa Allow sizeof(cpuset_t) to be queried in capability mode.
This allows functions that retrieve and inspect pthread_attr_t objects to
work correctly: querying the cpuset_t size is part of querying CPU
affinity information, which is part of creating a complete pthread_attr_t.

Approved by: rwatson (mentor)
Reviewed by: pjd
Sponsored by: NSERC
2015-05-14 15:14:03 +00:00
Andrew Rybchenko
db7e53aa3f sfxge: advertise IPv6 Rx and Tx checksum offload support
Tx checksum offload may be enabled/disabled.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2543
2015-05-14 14:16:09 +00:00
Edward Tomasz Napierala
ba8f0eb8fc Build GENERIC with RACCT/RCTL support by default. Note that it still
needs to be enabled by adding "kern.racct.enable=1" to /boot/loader.conf.

Differential Revision:	https://reviews.freebsd.org/D2407
Reviewed by:	emaste@, wblock@
MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2015-05-14 14:03:55 +00:00
Andrew Rybchenko
b2b5a4c060 sfxge: IPv4 Tx checksum offload may be disabled in fact
Split IFCAP_HWCSUM to IFCAP_RXCSUM and IFCAP_TXCSUM to highlight Tx and Rx.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D2541
2015-05-14 13:49:00 +00:00
Andrew Rybchenko
588644a4b6 sfxge: add local variable with Rx descriptor flags
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-05-14 13:28:29 +00:00
Andrew Rybchenko
ab2310e8bf sfxge: add missing const qualifier to sfxge_link_mode
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-05-14 12:59:17 +00:00
Andrew Turner
ebbeae2083 Remove OUTPUT_FORMAT from theARM EFI linker script, it breaks building
for big-endian arm.
2015-05-14 12:43:39 +00:00
Alexander Motin
a87627b26b Do not promote large async writes to sync.
Present implementation of large sync writes is too strict and so can be
quite slow.  Instead of doing that, execute large async write in chunks,
syncing each chunk separately.

It would be good to fix large sync writes too, but I leave it to somebody
with more skills in this area.

Reviewed by:	rmacklem
MFC after:	1 week
2015-05-14 10:04:42 +00:00
Steven Hartland
c017a87e08 Add copyright info missing from r282205
Add the copyright info missing from ZoL origin version.

MFC after:	2 days
Sponsored by:	Multiplay
2015-05-14 08:13:01 +00:00
Zbigniew Bodek
42cb216a43 Add support for ARM GICv3 interrupt controller used in some ARM64 chips
GICv3 allows to distribute interrupts to more than 8 cores served by
the previous GIC revisions. GICv3 introduces additional logic in form
of Re-Distributors associated with particular CPUs to determine
the highest priority interrupts and manage PPIs and LPIs
(Locality-specific Peripheral Interrupts). Interrupts routing is
based on CPUs' affinity numbers. CPU interface was changed to be
accessible via CPU System Registers and this is the preferred
(and supported) method in this driver.

Obtained from: Semihalf
Reviewed by:   andrew, emaste, ian, imp
Sponsored by:  The FreeBSD Foundation
2015-05-13 18:57:03 +00:00
Andrew Turner
a5b53ce40c Use the correct node wen reading the compatible property. 2015-05-13 16:02:55 +00:00
Pedro F. Giffuni
5b7350414e Adjust visibility macros.
The GCC visibility attributes were introduced in GCC 4.0.
Apparently the "protected" attribute was introduced only
until GCC 4.2, but we are not currently using it.

MFC after:	1 week
2015-05-13 15:26:44 +00:00
Luigi Rizzo
8ff71b031e bugfix (only affecting the "lookup" option in the userspace version of ipfw):
the conditional block should not include the 'else' otherwise
the code does a 'break;' without completing the check
2015-05-13 11:53:25 +00:00
Ganbold Tsagaankhuu
2b84fc91ca Delete cpu_do_powersave which is set but never used/tested
serving no useful purpose.

Differential Revision:	https://reviews.freebsd.org/D2516
Submitted by:		John Wehle
Reviewed by:		ian@
2015-05-13 05:46:04 +00:00
Luiz Otavio O Souza
ee0f1e8e43 Fix the vmstat -i output on ARM.
The consumers of hw.intrnames expect a NULL byte at end of the string
containing the interrupt names.

On ARM all the interrupt name slots are initialized and this leave no room
for the terminating NULL byte, which makes vmstat read beyond the end of
intrnames.

PR:		199891
Tested on:	RPi 2 and BeagleBone Black
2015-05-13 02:25:54 +00:00
Luiz Otavio O Souza
98d1292d0a Fix the SMP initialization on RPi 2 (BCM2836).
Invalidate the CPU cache before start the others CPUs.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-13 01:48:47 +00:00
Luiz Otavio O Souza
6a4b96ad82 Add support for the power button on BeagleBone Black.
Shutdown and turn off the board when the power button is pressed.

Submitted by:	Michal Meloun <meloun@miracle.cz>
Relnotes:	yes
2015-05-13 01:10:28 +00:00
Alexander V. Chernikov
e09c1944a3 Remove ptei->value check from ipfw_link_table_values():
even if there was non-zero number of restarts, we would unref/clear
  all value references and start ipfw_link_table_values() once again
  with (mostly) cleared "tei" buffer.
 Additionally, ptei->ptv stores only to-be-added values, not existing ones.
 This is a forgotten piece of previous value refconting implementation,
  and now it is simply incorrect.
2015-05-12 20:42:42 +00:00
Adrian Chadd
c3ebe01919 Do not check sequence number for QoS Null frames; set it for generated QoS Null
frames to 0

From IEEE Std. 802.11-2012, 8.3.2.1 "Data frame format", p. 415 (513):
"The Sequence Control field for QoS (+)Null frames is ignored by the receiver
upon reception."

At this moment, any <mode>_input() function interprets them as regular QoS data
frames with TID = 0. As a result, stations, that use another TX sequence for
QoS Null frames (e.g. wpi(4), where (QoS) Null frames are generated by the
firmware), may experience significant packet loss with any other NIC in hostap
mode.

Tested:

* wpi(4) (author)
* iwn(4) - Intel 5100, STA mode (me)

PR:		kern/200128
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-12 16:55:50 +00:00
Hans Petter Selasky
d27c74649b Apply proper locking when iterating the multicast addresses and add a
missing check for NULL from a non-blocking "kzalloc()" function call.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
Found by:	glebius @
2015-05-12 11:52:34 +00:00
Ganbold Tsagaankhuu
e4bc6b4c01 Disable WPI in case of aml8726-m3.
The aml8726-m3 SoC is identified as a Cortex A9-r2 rev 4 CPU and
it hangs sometimes during the boot when WFI is used by the kernel.

Differential Revision:	  https://reviews.freebsd.org/D2473
Submitted by:		  John Wehle
Suggested by:		  ian@
2015-05-12 08:53:54 +00:00
Michael Tuexen
fcbbf5af1d Ensure that the COOKIE-ACK can be sent over UDP if the COOKIE-ECHO was
received over UDP.
Thanks to Felix Weinrank for makeing me aware of the problem and to
Irene Ruengeler for providing the fix.

MFC after: 1 week
2015-05-12 08:08:16 +00:00
Andrey V. Elsukov
eccfe69a5c Add new socket ioctls SIOC[SG]TUNFIB to set FIB number of encapsulated
packets on tunnel interfaces. Add support of these ioctls to gre(4),
gif(4) and me(4) interfaces. For incoming packets M_SETFIB() should use
if_fib value from ifnet structure, use proper value in gre(4) and me(4).

Differential Revision:	https://reviews.freebsd.org/D2462
No objection from:	#network
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2015-05-12 07:37:27 +00:00
Hiroki Sato
1c27e6c39f Fix a panic when VIMAGE is enabled.
Spotted by:	Nikos Vassiliadis
2015-05-12 03:35:45 +00:00
Hiroki Sato
59333867ff - Remove ND6_IFF_IGNORELOOP. This functionality was useless in practice
because a link where looped back NS messages are permanently observed
  does not work with either NDP or ARP for IPv4.

- draft-ietf-6man-enhanced-dad is now RFC 7527.

Discussed with:	hiren
MFC after:	3 days
2015-05-12 03:31:57 +00:00
Justin Hibbits
809923ca02 Add a PCI bridge for the Freescale PCIe Root Complex
Summary:
The Freescale PCIe Root Complex shows up as a Processor class device, PowerPC
subclass, so the generic PCI code ignores it for a bridge.  This adds support
for it.

As part of this, update the Freescale PCI hostbridge driver, to allow probing
beyond the root complex, instead of only allowing "proper" PCI-PCI bridges.

Reviewers: #powerpc, marcel, nwhitehorn

Reviewed By: nwhitehorn

Subscribers: imp

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

Relnotes:	yes
2015-05-11 20:58:05 +00:00
Alan Cox
dfb378345f Retire pmap_lazyfix(). This function only existed in the new armv6 pmap
because the i386 pmap on which the new armv6 pmap is based had it, and in
r281707 pmap_lazyfix() was removed from the i386 pmap.

Discussed with:	kib
Submitted by:	Michal Meloun (via Svatopluk Kraus)
2015-05-11 19:55:01 +00:00
Andrew Turner
ae4fa2223a Add the kernel support for Thumb-2. It is only supported on ARMv7 as the
main ARMv6 target, the Raspberry Pi, doesn't support Thumb-2.

This as been tested with a Thumb-2 userland, however building one is
currently unsupported as there are known toolchain issues breaking some
binaries. Further work will also be needed to decide on the method of
selecting which instruction set to build for, and to benchmark both to
find how building everything as Thumb-2 will affect performance.

Relnotes:	yes
2015-05-11 19:20:30 +00:00
Andrew Turner
8465de8e6c Mark thumb entry points as such when building for thumb, otherwise mark
them as arm.
2015-05-11 19:04:32 +00:00
Andrew Turner
827422e3fd Use the Thumb compliant version of the add instruction. We can only use
"add Rd, Rn, Rm" from within an IT (if-then) block.
2015-05-11 19:00:02 +00:00
Andrew Turner
ec94f63bca List both registers to use in the 64-bit atomic instructions. We will need
these to build for Thumb-2.
2015-05-11 18:52:06 +00:00
Andrew Turner
8a56ddde27 Add the ofw_bus_subr.h change missed in r282770. 2015-05-11 15:47:55 +00:00
Andrew Turner
044a49cd24 Hide code only used on i386 and amd64. 2015-05-11 14:36:34 +00:00
Andrew Turner
72a638c7f4 Add ofw_bus_find_compatible to find a compatible ofw node. This will be
used on ARM to help find the correct node to use to start secondary CPUs
as this happens before device enumeration.
2015-05-11 14:10:54 +00:00
Andrew Turner
6bd9126da9 cpu-v6.h should only be used in the kernel, add an error to enforce this. 2015-05-11 12:44:02 +00:00
Andriy Gapon
defce67748 zfs ioctls: use fget_write / fget_read instead of getf wrapper for fget
This allows to ensure that we do not write to a file that was opened
for reading only or vice versa.

Also, use the correct capability in in zfs_ioc_send_new().

Differential Revision:	https://reviews.freebsd.org/D2382
Reviewed by:	delphij
MFC after:	17 days
Sponsored by:	ClusterHQ
2015-05-11 10:07:31 +00:00
Andrew Turner
f71b16e05e Move to use __ARM_ARCH in more places in the kernel. 2015-05-11 08:57:23 +00:00
Andrew Turner
a40f7273f1 Use the ACLE spelling of _ARM_ARCH_6: "__ARM_ARCH >= 6" 2015-05-11 08:51:24 +00:00
Mark Johnston
5a9f9cb38e Remove some commented-out upstream code for handling traps from usermode
DTrace probes. This handling is already done in trap() on i386 and amd64.
2015-05-10 22:27:48 +00:00
Mark Johnston
760a181bb2 msecs_to_jiffies() is implemented using tvtohz(9), which always returns a
positive value since it adds the current tick to its result. This differs
from the behaviour in Linux, whose implementation does not add the extra
tick, so subtract the extra tick in the OFED compat layer implementation.
This addresses some incorrect handling of IB MAD timeouts, since some IB
code depends on msecs_to_jiffies(0) returning 0.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-05-10 22:21:00 +00:00
Adrian Chadd
2808a02bf4 Prepare for supporting driver-overridden curchan when submitting scan
results.

Right now the scan infrastructure assumes the channel is under net80211
control, and that when receiving beacon frames for scanning, the
current channel is indeed what ic_curchan is set to.

But firmware NICs with firmware scan support need more than this -
they can do background scans whilst hiding the off-channel behaviour
from net80211.  Ie, net80211 still thinks everything is associated
and on the main channel, but it's getting scan results from all the
background traffic.

However sta_add() pays attention to ic_curchan and discards scan
results that aren't on the right channel.  CCK beacon frames can be
decoded from adjacent channels so the receive path and sta_add
discard these as appropriate.  This is fine for software scanning
like for ath(4), but not for firmware NICs.  So with those, the
whole concept of background firmware scanning won't work without
major hacks (eg, overriding ic_curchan before calling the beacon
input / scan add.)

As part of my scan overhaul, modify sta_add() and the scan_add()
APIs to take an explicit current channel.  The normal RX path
will set it to ic_curchan so it's a no-op.  However, drivers may
decide to (eventually!) override the scan method to set the
"right" current channel based on what the firmware reports the
scan state is.

So for example, iwn, rsu and other NICs will eventually do this:

* driver issues scan start firmware command;
* firmware sends a "scan start on channel X" notify;
* firmware sends a bunch of beacon RX's as part of
  the scan results;
* .. and the driver will replace scan_add() curchan with channel X,
  so scan results are correct.
* firmware sends a "scan start on channel Y" notify;
* firmware sends more beacons...
* .. the driver replaces scan_add() curchan with channel Y.

Note:

* Eventually, net80211 should eventually grow the idea of a per-packet
  current channel.  It's possible in various modes (eg WAVE, P2P, etc)
  that individual frames can come in from different channels and that
  is under firmware control rather than driver/net80211 control, so
  we should support that.
2015-05-10 22:07:53 +00:00
Mark Johnston
979b8eaf4b find_next_bit() and find_next_zero_bit(): if the caller-specified offset
lies within the last block of the bit set and no bits are set beyond the
offset, terminate the search immediately instead of continuing as though
there are further blocks in the set and subsequently returning an incorrect
result.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-05-10 22:04:42 +00:00
Adrian Chadd
def4ea7f78 Fix typo introduced in previous commit.
PR:		kern/199632
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-10 21:05:32 +00:00
Rui Paulo
017d485987 synaptics: more support for semi-MT trackpads.
Several improvements to the Synaptics driver to support
semi-multitouch trackpads and some other fixes:

- Two finger scrolling support for "semi-MT" touchpads. Those include
many of the older Synaptics touchpads before "true" multitouch support
(indicated by capMultiFinger). Semi-MT touchpads can report a second
finger position, but the X or Y coordinate may be swapped with some
coordinate of the first finger. This is a result of how the hardware
works internally. Therefore, all that can be reliably extracted is the
bounding box of the two finger positions. Semi-MT touchpads can be
recognized by the capAdvancedGestures capability bit. After setting the
mode byte, advanced gestures mode has to be enabled. Then, data packets
compatible with the capMultiFinger format are sent, so the same two
finger scrolling code can be leveraged. Enabling advanced gestures mode
on true multitouch touchpads should be harmless. Linux seems to always
enable advanced gestures mode.

- Put mode setting logic into own functions synaptics_preferred_mode()
and synaptics_set_mode() to have this in one place.
synaptics_passthrough_on() and synaptics_passthrough_off() currently
always use 0xc1 as the mode byte, which may be wrong for touchpads that
don't have capExtended.

- Expose X and Y resolution of touchpad to userland. Also expose minimum
and maximum X and Y coordinates. This is useful for programs in
userspace that read raw PSM packets (with PSM_LEVEL_NATIVE enabled) and
need to interpret the coordinates.

- Also send "extended w mode" packets (see section 3.2.9 of
511-000275-01_RevB.pdf) to userspace if PSM_LEVEL_NATIVE is enabled.
This is useful for userspace programs/drivers such as
xf86-input-synaptics that can handle these packets.

- Fix parsing of nExtendedQueries, and request extended/continued
capability bits depending on this value.

- capReportsMax, capClearPad, capAdvancedGestures and capCoveredPad must
be extracted from status[0] and not status[2], I think.

Submitted by:	Jan Kokemüller jan.kokemueller at gmail.com
2015-05-10 20:36:57 +00:00
Ian Lepore
31825f28cf Create a relocatable instance of ubldr for ARM. The original ubldr,
static-linked to run at a fixed position, is still installed to maintain
compatibility with existing configurations.  The makefile now also creates
and installs ubldr.bin, a stripped binary (no elf headers) with an entry
point offset of 0 that can be loaded by u-boot at any address and launched
with "go ${loadaddr}".

To use ubldr.bin, U-Boot must still be built with the CONFIG_API option,
but no longer needs the CONFIG_ELF option.
2015-05-10 19:14:28 +00:00
Hans Petter Selasky
b1b7114036 Ensure the result from signed subtraction under modulus does not
become negative.

Submitted by:		Oliver Pinter <oliver.pinter@hardenedbsd.org>
MFC after:		3 days
2015-05-10 17:11:04 +00:00
Ian Lepore
16bf8dd6dc Don't check the return value from self_reloc(), it can't fail and doesn't
return a value.

Despite what I said in my prior commit, it turns out this one platform
was checking the return value from the old self-reloc code (which returned
a hard-coded 0).
2015-05-10 13:30:21 +00:00
Ian Lepore
5b1c03fd13 The self-relocation code is not efi-specific, move it to boot/common.
The function was defined as taking 4 parameters and returning EFI_STATUS,
but all existing callers (in asm code) passed only two parameters and don't
use the return value. The function signature now matches that usage, and
doesn't refer to efi-specific types.

Parameters and variables now use the cannonical typenames set up by elf.h
(Elf_Word, Elf_Addr, etc) instead of raw C types. Hopefully this will
prevent suprises as new platforms come along and use this code.

The function was renamed from _reloc() to self_reloc() to emphasize its
difference from the other elf relocation code found in boot/common.

Differential Revision:	https://reviews.freebsd.org/D2490
2015-05-10 13:24:26 +00:00
Hans Petter Selasky
a998d1031c Put recycle pointer in own memory area which is not mmap'able. 2015-05-10 12:45:21 +00:00
Andrew Turner
ace157c3a9 Use the new gic option on all configs that need it. 2015-05-10 12:13:27 +00:00
Andrew Turner
1486e4bb63 Use the new gic option. While here remove extra whitespace from the ned of
a few lines.
2015-05-10 09:37:54 +00:00
Andrew Turner
e4ca149905 Add the gic to files.arm under "device gic" and use it with the
CUBIEBOARD2 config. This is common across a few SoCs so should be a common
option.
2015-05-10 09:33:03 +00:00
Andrew Turner
5357ace59e First pass clenup over the Marvell db-88f6xxx kernel configs. 2015-05-10 09:23:49 +00:00
Konstantin Belousov
f116422f38 Initialize pcids array for the proc0 pmap.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-10 09:09:07 +00:00
Konstantin Belousov
78ac908e9b Tweak assert to also print the thread address.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-10 09:05:57 +00:00
Konstantin Belousov
7b445033ff On exec, single-threading must be enforced before arguments space is
allocated from exec_map.  If many threads try to perform execve(2) in
parallel, the exec map is exhausted and some threads sleep
uninterruptible waiting for the map space.  Then, the thread which won
the race for the space allocation, cannot single-thread the process,
causing deadlock.

Reported and tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-05-10 09:00:40 +00:00
Andrew Turner
70ad407c86 Clean up the style to use "options<space><tab>". 2015-05-10 08:48:00 +00:00
Konstantin Belousov
9cddade79a Satisfy vm_object uma zone destructor requirements after r282660 when
vnode object creation raced.

Reported by:	pho
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
2015-05-10 08:21:03 +00:00
Adrian Chadd
bfca9c9400 Turn ieee80211_start_scan_locked() into a swscan module private method.
It turns out that ieee80211_start_scan_locked() is only ever called by
the swscan code and it won't likely be required by firmware scanning
implementations.

So, don't bother keeping it in ieee80211_scan.c and it likely won't
become an API call.

Tested:

* Intel 5100, STA mode
* AR5416, STA mode
2015-05-10 06:59:34 +00:00
Adrian Chadd
3265af355a Attempt to address Bug #176201 - don't advertise what the AP announced
to us. Instead, advertise what we can do based on what the AP says and what
we're capped at by the VAP settings.

For non-STA modes we still advertise what our VAP settings are.

It may be that I've over-complicated this and instead of capping things
we can just always announce what we're capable of.  But this should at least
stop the blatantly wrong handling of A-MPDU parameters.

(I'll happily simplify things if someone can dig up a replacement, better
compliant behaviour.)

PR:		kern/176201
2015-05-10 06:57:53 +00:00
Justin Hibbits
45bf6d59de Fix a couple bugs in 64-bit powerpc fasttrap argument retrieval.
Found by code inspection.
2015-05-10 04:33:01 +00:00
Luiz Otavio O Souza
1b53f6c5a3 Remove unnecessary code and make use of generic implementations for
bus_alloc_resource(), bus_release_resource() and bus_set_resource()
(bus_generic_rl_alloc_resource(), bus_generic_rl_release_resource() and
bus_generic_rl_set_resource() respectively).

Do not print the resources for nomatch devices.

Use the inherited method for bus_get_resource_list() on ofw_iicbus.c.

Submitted by:	jhb and Michal Meloun (D2033)
2015-05-10 02:19:27 +00:00
Konstantin Belousov
b40a715c11 Correct the assertion. We should compare the pmap' curcpu pcid value
against 0, not the pmap.

Noted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-09 21:36:44 +00:00
Andrew Turner
532248e092 Pass over the at91 kernels to reduce the diff between them. 2015-05-09 21:24:55 +00:00
Glen Barber
88feae84be Merge ^/projects/release-arm-redux into ^/head.
Of note:

- This commit adds native FreeBSD/arm release build support without
  requiring out-of-tree utilities.

- Part of this merge removes the WANDBOARD-{SOLO,DUAL,QUAD} kernel
  configuration files, for which the IMX6 kernel configuration file
  should be used instead.

- The resulting images have a 'freebsd' user (password 'freebsd'),
  to allow ssh(1) access when console access is not available (VGA
  or serial).  The default 'root' user password is set to 'root'.

- The /etc/ttys file for arm images now enable both ttyv0 and ttyu0
  by default.

Help from:	many (boot testing, feedback, etc.)
Sponsored by:	The FreeBSD Foundation
2015-05-09 21:08:12 +00:00
Konstantin Belousov
44ec2b63c5 The vmem callback to reclaim kmem arena address space on low or
fragmented conditions currently just wakes up the pagedaemon.  The
kmem arena is significantly smaller then the total available physical
memory, which means that there are loads where kmem arena space could
be exhausted, while there is a lot of pages available still.  The
woken up pagedaemon sees vm_pages_needed != 0, verifies the condition
vm_paging_needed() which is false, clears the pass and returns back to
sleep, not calling neither uma_reclaim() nor lowmem handler.

To handle low kmem arena conditions, create additional pagedaemon
thread which calls uma_reclaim() directly.  The thread sleeps on the
dedicated channel and kmem_reclaim() wakes the thread in addition to
the pagedaemon.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-05-09 20:08:36 +00:00
Konstantin Belousov
a546448b8d Rewrite amd64 PCID implementation to follow an algorithm described in
the Vahalia' "Unix Internals" section 15.12 "Other TLB Consistency
Algorithms".  The same algorithm is already utilized by the MIPS pmap
to handle ASIDs.

The PCID for the address space is now allocated per-cpu during context
switch to the thread using pmap, when no PCID on the cpu was ever
allocated, or the current PCID is invalidated.  If the PCID is reused,
bit 63 of %cr3 can be set to avoid TLB flush.

Each cpu has PCID' algorithm generation count, which is saved in the
pmap pcpu block when pcpu PCID is allocated.  On invalidation, the
pmap generation count is zeroed, which signals the context switch code
that already allocated PCID is no longer valid.  The implication is
the TLB shootdown for the given cpu/address space, due to the
allocation of new PCID.

The pm_save mask is no longer has to be tracked, which (significantly)
reduces the targets of the TLB shootdown IPIs.  Previously, pm_save
was reset only on pmap_invalidate_all(), which made it accumulate the
cpuids of all processors on which the thread was scheduled between
full TLB shootdowns.

Besides reducing the amount of TLB shootdowns and removing atomics to
update pm_saves in the context switch code, the algorithm is much
simpler than the maintanence of pm_save and selection of the right
address space in the shootdown IPI handler.

Reviewed by:	alc
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-05-09 19:11:01 +00:00
Konstantin Belousov
6841f70168 Remove unused define.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-05-09 18:38:35 +00:00
Konstantin Belousov
ac437c0754 Do not return from thread_single(SINGLE_BOUNDARY) until all stopped
thread are guarenteed to be removed from the processors.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-09 18:32:13 +00:00
Konstantin Belousov
b57a73f8e7 If x86 CPU implementation of the MWAIT instruction reasonably
interacts with interrupts, query ACPI and use MWAIT for entrance into
Cx sleep states.  Support C1 "I/O then halt" mode.  See Intel'
document 302223-007 "Intelб╝ Processor Vendor-Specific ACPI Interface
Specification" for description.

Move the acpi_cpu_c1() function into x86/cpu_machdep.c and use
it instead of inlining "sti; hlt" sequence in several places.

In the acpi(4) man page, besides documenting the dev.cpu.N.cx_methods
sysctl, correct the names for dev.cpu.N.{cx_usage,cx_lowest,cx_supported}
sysctls.

Both jkim and avg have some other patches implementing the mwait
functionality; this work is unrelated.  Linux does not rely on the
ACPI to provide correct tables describing Cx modes.  Instead, the
driver has pre-defined knowledge of the CPU models, it was supplied by
Intel.

Tested by:    pho (previous versions)
Sponsored by:	The FreeBSD Foundation
2015-05-09 12:28:48 +00:00
Bjoern A. Zeeb
62699f3424 Convert remaining hwpmc(4) debug printfs over to KTR to unbreak the build
for at least powerpc kernels.   Missed in r282658.

MFC after:	10 days
2015-05-09 09:21:59 +00:00
Luiz Otavio O Souza
8b651535df Pass the resources requests to the upper bus.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-09 03:39:18 +00:00
Luiz Otavio O Souza
3bb6bf473f Handle IRQ resources on iicbus and ofw_iicbus.
Based on a patch submitted by Michal Meloun <meloun@miracle.cz>.
2015-05-09 03:05:44 +00:00
Luiz Otavio O Souza
5791e134f7 Replace spaces with tabs, removes an extra blank line.
No functional changes.
2015-05-08 21:51:37 +00:00
Ian Lepore
148e6c42e4 Move the text section to the start of the output file, so that when you
create a stripped .bin file from it the entry point is the first byte of
the file.  (Will allow "load $addr $file ; go $addr" in u-boot.)
2015-05-08 19:43:53 +00:00
John Baldwin
e735691b61 Place VM objects on the object list when created and never remove them.
This is ok since objects come from a NOFREE zone and allows objects to
be locked while traversing the object list without triggering a LOR.

Ensure that objects on the list are marked DEAD while free or stillborn,
and that they have a refcount of zero.  This required updating most of
the pagers to explicitly mark an object as dead when deallocating it.
(Only the vnode pager did this previously.)

Differential Revision:	https://reviews.freebsd.org/D2423
Reviewed by:	alc, kib (earlier version)
MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc.
2015-05-08 19:43:37 +00:00
John Baldwin
4a3690dfa1 Convert hwpmc(4) debug printfs over to KTR.
Differential Revision:	https://reviews.freebsd.org/D2487
Reviewed by:	davide, emaste
MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc.
2015-05-08 19:40:00 +00:00
Glen Barber
c083dc0321 Use the IMX6 kernel configuration for the WANDBOARD build,
since it supports all of these board variants.

While here, remove the WANDBOARD-{QUAD,SOLO,DUAL} kernel
configuration files.

Discussed with:	ian
Sponsored by:	The FreeBSD Foundation
2015-05-08 18:55:09 +00:00
Zbigniew Bodek
1ca4eb3acc Port x86 busdma to ARM64
The x86 busdma subsystem allows using multiple implementations.
By default the classic bounce buffer approach is used, however
on systems with IOMMU it could be in runtime switched to more
efficient hardware accelerated implementation.

This commit adds ARM64 port of the x86 busdma framework and bounce
buffer backend. It is ready to use on IO coherent systems. If the
IO coherency cannot be guaranteed, the cache management operations have
to be added to this code in places marked by /* XXX ARM64TODO (...) */
comments. Also IOMMU support might be added by registering another
busdma implementation like it is already done on the x86.

Reviewed by:   andrew, emaste
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
2015-05-08 18:47:19 +00:00
Hans Petter Selasky
8c20de927a Ensure the USB audio driver doesn't attach twice on the same USB
device by grabbing all the USB audio device interfaces.

MFC after:	1 week
2015-05-08 17:48:48 +00:00
Hans Petter Selasky
9dd1273385 Add support for more than 8 audio channels per PCM stream for USB
audio class compliant devices under FreeBSD. Tested using 16 recording
and 16 playback audio channels simultaneously.

MFC after:	2 weeks
2015-05-08 17:07:11 +00:00
Hans Petter Selasky
4ece1a889b Extend the maximum number of allowed PCM channels in a PCM stream to
127 and decrease the maximum number of sub-channels to 1. These
definitions are only used inside the kernel and can be changed later
if more than one sub-channel is desired. This has been done to allow
so-called USB audio rack modules to work with FreeBSD.

Bump the FreeBSD version to force recompiling all external modules.

MFC after:	2 weeks
Reviewed by:	mav
2015-05-08 17:00:33 +00:00
Hans Petter Selasky
e4a5ee711a The "SYSCTL_INT()" default value is only used for read only SYSCTLs
and is not applicable unless the integer pointer is NULL. Set it to
zero to avoid confusion. While at it remove extra semicolon at the end
of the "VT_SYSCTL_INT()" macro.

MFC after:		1 week
2015-05-08 16:37:40 +00:00
Hans Petter Selasky
4ee69cc712 Prevent switching to NULL or own window in the "vt_proc_window_switch"
function. This fixes an issue where X11 keyboard input can appear
stuck. The cause of the problem is a duplicate TTY device window
switch IOCTL during boot, which leaves the "vt_switch_timer" running,
because the current window is already selected. While at it factor out
some NULL checks.

PR:			200032
Differential Revision:	https://reviews.freebsd.org/D2480
Reported by:		several people
MFC after:		1 week
Reviewed by:		emaste
2015-05-08 16:19:01 +00:00
John Baldwin
680f1afd94 Move hwpmc(4) debugging code under a new HWPMC_DEBUG option instead of
the broader DEBUG option.

Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc.
2015-05-08 15:57:23 +00:00
Roger Pau Monné
0df8b29da3 xen: introduce a newbus function to allocate unused memory
In order to map memory from other domains when running on Xen FreeBSD uses
unused physical memory regions. Until now this memory has been allocated
using bus_alloc_resource, but this is not completely safe as we can end up
using unreclaimed MMIO or ACPI regions.

Fix this by introducing a new newbus method that can be used by Xen drivers
to request for unused memory regions. On amd64 we make sure this memory
comes from regions above 4GB in order to prevent clashes with MMIO/ACPI
regions. On i386 there's nothing we can do, so just fall back to the
previous mechanism.

Sponsored by: Citrix Systems R&D
Tested by: Gustau Pérez <gperez@entel.upc.edu>
2015-05-08 14:48:40 +00:00
Andriy Gapon
96b60db0d7 MFV r282630: 5809 Blowaway full receive in v1 pool causes kernel panic
MFC after:	5 days
2015-05-08 14:03:14 +00:00
Kevin Lo
997d8c7a89 - Fix a wrong R92C_USTIME_TSF register definition
- Fix intitial transmit rate to an 11g rate for the RTL8188EU
- Add a comment about response rate settings
2015-05-08 09:01:00 +00:00
Adrian Chadd
cf82d8112e oops - how'd i miss this. Sorry! 2015-05-08 06:02:23 +00:00
Ganbold Tsagaankhuu
bd14d14fcd This follows the gic and ti/aintc code by adding additional barriers to the
Amlogic pic driver.

Differential Revision:	https://reviews.freebsd.org/D2472
Submitted by:		John Wehle
2015-05-08 04:38:01 +00:00
Ganbold Tsagaankhuu
2a77d72739 The interrupt-parent is set globally so it's unnecessary to also set it at each node.
Differential Revision:	https://reviews.freebsd.org/D2471
Submitted by:		John Wehle
2015-05-08 04:22:11 +00:00
Adrian Chadd
415d7ccab2 Add initial memory locality cost awareness to the VM, and include
a basic ACPI SLIT table parser.

For now this just exports the map via sysctl; it'll eventually be useful
to userland when there's more useful NUMA support in -HEAD.

* Add an optional mem_locality map;
* add a mapping function taking from/to domain and returning the
  relative cost, or -1 if it's not available;
* Add a very basic SLIT parser to x86 ACPI.

Differential Revision:	https://reviews.freebsd.org/D2460
Reviewed by:	rpaulo, stas, jhb
Sponsored by:	Norse Corp, Inc (hardware, coding); Dell (hardware)
2015-05-08 00:56:56 +00:00
Luiz Otavio O Souza
962940ce6c Add the SMP support for Raspberry Pi 2 (BCM2836).
Tested with the build of some ports and a buildworld.

Submitted by:	Daisuke Aoyama <aoyama@peach.ne.jp>
2015-05-07 22:11:44 +00:00
Andrey V. Elsukov
089bb672c4 m_dup() is supposed to give a writable copy of an mbuf chain. It uses
m_dup_pkthdr(), that uses M_COPYFLAGS mask to copy m_flags field.
If original mbuf chain has M_RDONLY flag, its copy also will have it.
Reset this flag explicitly.

MFC after:	2 weeks
2015-05-07 18:35:01 +00:00
Ed Maste
185bf88e33 Correct PL310_POWER_CTRL offset
Offet for the power control register was specified incorrectly (it had
the same value as the prefetch control register.) This change corrects
the offset value to 0xF80, per the ARM PL310 documentation.

Submitted by:	Steve Kiernan <stevek@juniper.net>
Obtained from:	Juniper Networks, Inc.
2015-05-07 16:56:20 +00:00
Andrey V. Elsukov
654bdb5abb Mark data checksum as valid for multicast packets, that we send back
to myself via simloop.
Also remove duplicate check under #ifdef DIAGNOSTIC.

PR:		180065
MFC after:	1 week
2015-05-07 14:17:43 +00:00
Hans Petter Selasky
415bcd89a6 Add support for DYMO LabelWriter PnP.
MFC after:		2 weeks
2015-05-07 12:54:27 +00:00
Andrew Turner
d667b90d53 Clean up the ARM kernel configs to use 'include<space><tab>"file"'. 2015-05-07 12:38:23 +00:00
Andrey V. Elsukov
db037aa4ed Remove unneded #ifdef INET6 and IPSEC. This file compiled only when
both options are defined.
Include opt_sctp.h and sctp_crc32.h to enable #ifdef SCTP code block
and delayed checksum calculation for SCTP.
2015-05-07 12:15:45 +00:00
Neel Natu
ede0403309 Check 'td_owepreempt' and yield the vcpu thread if it is set.
This is done explicitly because a vcpu thread can be in a critical section
for the entire time slice alloted to it. This in turn can delay the handling
of the 'td_owepreempt'.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D2430
2015-05-06 23:40:24 +00:00
Mateusz Guzik
edf1796d3e Fix up panics when fork fails due to hitting proc limit
The function clearning credentials on failure asserts the process is a
zombie, which is not true when fork fails.

Changing creds to NULL is unnecessary, but is still being done for
consistency with other code.

Pointy hat: mjg
Reported by: pho
2015-05-06 21:03:19 +00:00
Alexander Motin
0631de4a79 Handle EDQUOT backend storage errors same as ENOSPC.
MFC after:	1 week
2015-05-06 19:47:31 +00:00
Neel Natu
9c4d547896 Deprecate the 3-way return values from vm_gla2gpa() and vm_copy_setup().
Prior to this change both functions returned 0 for success, -1 for failure
and +1 to indicate that an exception was injected into the guest.

The numerical value of ERESTART also happens to be -1 so when these functions
returned -1 it had to be translated to a positive errno value to prevent the
VM_RUN ioctl from being inadvertently restarted. This made it easy to introduce
bugs when writing emulation code.

Fix this by adding an 'int *guest_fault' parameter and setting it to '1' if
an exception was delivered to the guest. The return value is 0 or EFAULT so
no additional translation is needed.

Reviewed by:	tychon
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D2428
2015-05-06 16:25:20 +00:00
Zbigniew Bodek
c4b8fcd66c Add new CP15 operations and DB_SHOW_COMMAND to print CP15 registers
Submitted by:   Wojciech Macek <wma@semihalf.com>
Reviewed by:    imp, Michal Meloun <meloun@miracle.cz>
Obtained from:  Semihalf
2015-05-06 15:17:28 +00:00
Andrew Turner
fe5d5d7d05 AcpiGbl_FACS will not be defined when building using the reduced hardware
model. This may be the case on ARM.
2015-05-06 14:14:14 +00:00
Andrew Turner
ef74544931 If the power management timer is unsupported the PmTimerLength value will
be zero.
2015-05-06 14:09:54 +00:00
Andrey V. Elsukov
b347bc3b7a Pass mtag argument into m_tag_locate() to continue the search from
the last found mtag.
2015-05-06 14:02:57 +00:00
Glen Barber
2252f43bdc MFH: r282315-r282534
Sponsored by:	The FreeBSD Foundation
2015-05-06 11:50:30 +00:00
Kashyap D Desai
dbcc81dfdc Corrected indentation on conflicted source files.
Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:46:28 +00:00
Kashyap D Desai
1bebd87179 Configured the mrsas(4) driver to support UNMAPPED I/O and updated driver version.
Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:45:56 +00:00
Kashyap D Desai
ecea5be464 1. All LSI namings are converted to AVAGO Tech.
2. Fix in AEN path(suggested by John Baldwin).
3. Fix IOCTL path w.r.t Sense key handling

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:45:13 +00:00
Kashyap D Desai
2f863eb8d8 Bug fixes found internally as detailed below:
1. While disabling interrupt the FW disables interrupts for only 16 vectors.
In case of Invader which supports 96 MSI-x vectors, some spurious interrupts
may come on other vectors even after interrupt disable. So, driver uses a flag
and ignores the spurious interrupts.
2. Reply queue depth is made double the number of commands supported by FW.
3. Misplaced interrupt enable code is now moved down in the OCR path.
4. Updated error handling code in OCR path.
5. Removed un-necessary print.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:44:08 +00:00
Kashyap D Desai
daeed97380 Driver calls mrsas_complete_cmd() to call mrsas_wakeup() for each MFI frame that was
issued through the ioctl() interface prior to the kill adapter. This ensures
userspace ioctl() system calls issued just before a kill adapter don't get stuck in
wait state and IOCTLs are returned to application.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:43:19 +00:00
Kashyap D Desai
af51c29f66 In OCR(Online Controller Reset) path, driver sets adapter state to
MEGASAS_HBA_OPERATIONAL before getting new RAID map.
There will be a small window where IO will come from OS with old RAID map.
This patch will update adapter state to MEGASAS_HBA_OPERATIONAL,
only after driver has new RAID map to avoid any IOs getting build using old RAID map.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:42:44 +00:00
Kashyap D Desai
16dc2814ee Current driver does fast path read load balancing between arm and mirror disk
for two Drive Raid-1 configuration only.

Now, Driver support fast path read load balancing for all (any number of disk) Raid-1 configuration.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:41:27 +00:00
Kashyap D Desai
77cf7df804 Now Driver expose Secure Jbod Support via driver_operations in MFI INIT Frame.
FW expose Secure Jbod support via Controller properity.

Firmware expect IOs to be received from different IO path than
conventional fast path queue, in case of SED drives.

To have Secure jbod support user need driver and firmware support.

Reviewed by:    ambrisko
MFC after:  2 weeks
Sponsored by:   AVAGO Technologies
2015-05-06 10:36:53 +00:00
Kashyap D Desai
5844115e3a This patch adds the feature to provide PCI information via IOCTL query.
Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2015-05-06 10:32:27 +00:00
Gleb Smirnoff
d2596d179a Fix the KASSERT and improve wording in r282426.
Submitted by:	alc
2015-05-06 08:07:11 +00:00
Alexander V. Chernikov
b45fa3fad6 Fix panic when prepare_batch_buffer() returns error. 2015-05-06 07:53:43 +00:00
Neel Natu
ea91ca92ba Do a proper emulation of guest writes to MSR_EFER.
- Must-Be-Zero bits cannot be set.
- EFER_LME and EFER_LMA should respect the long mode consistency checks.
- EFER_NXE, EFER_FFXSR, EFER_TCE can be set if allowed by CPUID capabilities.
- Flag an error if guest tries to set EFER_LMSLE since bhyve doesn't enforce
  segment limits in 64-bit mode.

MFC after:	2 weeks
2015-05-06 05:40:20 +00:00
Neel Natu
712bd51ada Add macros for AMD-specific bits in MSR_EFER: LMSLE, FFXSR and TCE.
AMDID_FFXSR is at bit 25 so correct its value to 0x02000000.

MFC after:	1 week
2015-05-06 05:12:29 +00:00
Ganbold Tsagaankhuu
c1e22c8ece This patch adds support for the extended baud rate register
available on the aml8726-m6 (and later) SoC which allows for
lower speeds.

Differential Revision:	https://reviews.freebsd.org/D2433
Submitted by:	John Wehle
2015-05-06 01:07:59 +00:00
Ian Lepore
955691fecd Add the code necessary to run the imx6 chip at its lowest clock/power
operating point (396MHz/950mV).
2015-05-05 23:27:49 +00:00
Hans Petter Selasky
0de2373fa2 Add new USB ID.
PR:		199843
MFC after:	1 week
2015-05-05 19:34:23 +00:00
Andrew Turner
9e67e4202d Start to reduce the diff between the Atmel kernel configs. 2015-05-05 18:29:51 +00:00
Andrew Turner
6193335c45 The VIRT kernel config targets armv6. 2015-05-05 18:04:47 +00:00
Andrew Turner
5c1bbeb74b Move the first batch of common armv6 options to std.armv6. 2015-05-05 17:59:02 +00:00
Ian Lepore
65c3de4e62 Create std.arm and std.armv6 config files and include the right one from
each of the existing kernel configs.  This gives a place to put config
that applies to the entire arch.

Add the ARM_NEW_PMAP option to std.armv6.  This is working well in early
testing and it's time for wide exposure, but it's still nice to be able
to fall back to the old implementation for testing when a problem comes
along.  Eventually the option and the old implementation will go away.

The opportunity now exists to move a whole lot of boilerplate from all the
arm kernel config files into std.arm*, but that's a commit for another day.
2015-05-05 16:09:25 +00:00
Andrew Turner
f17e3a0a4b Add DEV_ACPI to opt_acpi.h to be used to detect when ACPI is enabled in
the kernel.
2015-05-05 14:19:22 +00:00
Andrew Turner
1c110e85d9 Update the comment on what CPUs this driver supports. 2015-05-05 14:17:15 +00:00
Andrew Turner
2c0d026b52 Move the point we attach the ofw driver on arm64 to nexus.c. This will
allow us to have a single place to decide to use ofw or acpi.
2015-05-05 11:13:16 +00:00
Andrew Turner
3bbcb38d72 Add FDT to the list of known GUIDs. 2015-05-05 11:07:43 +00:00
Andriy Gapon
24dd1a8242 zfs: do not hold an extra reference on a root vnode while a filesystem is mounted
At present zfs_domount() acquires a reference on the filesystem's root vnode
and that reference is kept until zfs_umount.
The latter calls vflush(rootrefs = 1) to dispose of the extra reference.

There is no explanation of why that reference is kept - what problem it
solves or what behavior it improves.
Also, that logic is FreeBSD specific.

There is one real problem with that reference, though.
zfs recv -F may receive a full, non-incremental stream to a mounted filesystem.
In that case the received root object is likely to have a different z_gen
attribute value. Because of that, zfs_rezget will leave the previous root znode
and vnode disassociated from the actual object (z_sa_hdl == NULL).
Thus, future calls to VFS_ROOT() -> zfs_root() will produce a new vnode-znode
pair, while the old one will be kept alive by the outstanding reference.
So, the outstanding reference will not actually be for the new root vnode
(or, more precisely, vnodes - because a root vnode may be recycled and a newer
one can be created).
As a result, when vflush(rootrefs = 1) s called there will be two problems:

- a leaked reference on the old root vnode preventing a graceful unmount
- insufficient references on the actual root vnode leading to a crash upon
  access to the vnode after it is destroyed by vgone() + vdrop()

The second issue will actually override the first one.

Differential Revision:	https://reviews.freebsd.org/D2353
Reviewed by:		delphij, kib, smh
MFC after:	17 days
2015-05-05 11:01:06 +00:00