Commit Graph

2418 Commits

Author SHA1 Message Date
Xin LI
880c6c1b06 Delete unneeded #include <sys/inflate.h> from sys/mips.
PR:		229763
Submitted by:	Yoshihiro Ota <ota at j.email.ne.jp>
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D20190
2019-05-23 05:17:18 +00:00
Conrad Meyer
daec92844e Include ktr.h in more compilation units
Similar to r348026, exhaustive search for uses of CTRn() and cross reference
ktr.h includes.  Where it was obvious that an OS compat header of some kind
included ktr.h indirectly, .c files were left alone.  Some of these files
clearly got ktr.h via header pollution in some scenarios, or tinderbox would
not be passing prior to this revision, but go ahead and explicitly include it
in files using it anyway.

Like r348026, these CUs did not show up in tinderbox as missing the include.

Reported by:	peterj (arm64/mp_machdep.c)
X-MFC-With:	r347984
Sponsored by:	Dell EMC Isilon
2019-05-21 20:38:48 +00:00
Conrad Meyer
e12be3218a Include eventhandler.h in more compilation units
This was enumerated with exhaustive search for sys/eventhandler.h includes,
cross-referenced against EVENTHANDLER_* usage with the comm(1) utility.  Manual
checking was performed to avoid redundant includes in some drivers where a
common os_bsd.h (for example) included sys/eventhandler.h indirectly, but it is
possible some of these are redundant with driver-specific headers in ways I
didn't notice.

(These CUs did not show up as missing eventhandler.h in tinderbox.)

X-MFC-With:	r347984
2019-05-21 01:18:43 +00:00
Adrian Chadd
50f76a3926 [mediatek] Add support for non-flash devices on the SPI bus of the Mediatek SoCs.
The existing SPI support only worked for directly attached flash chips.
it didn't implement clock programming or chipselect.  It also supports
transfers with unbalanced tx/rx command sizes.

Submitted by:	<yamori813@yahoo.co.jp>
Differential Revision:	https://reviews.freebsd.org/D20101
2019-05-20 17:43:58 +00:00
Conrad Meyer
e2e050c8ef Extract eventfilter declarations to sys/_eventfilter.h
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions.  The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended).  Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed.  __FreeBSD_version has been bumped.
2019-05-20 00:38:23 +00:00
Conrad Meyer
fa3ac573a2 mips: Implement basic pmap_kenter_device, pmap_kremove_device
Unbreak mips.BERI_DE4_SDROOT build, which uses device xdma. Device xdma
depends on the pmap_kenter_device APIs.

Reported by:	tinderbox (local)
Sponsored by:	Dell EMC Isilon
2019-05-16 19:10:48 +00:00
Adrian Chadd
8771e6389b [ar71xx_gpio] Add AR9341/AR9342 to the list of chips for programming function/output enable.
This is reqired to use the gpiofunc behaviour for configuring GPIO
pins at boot time.

Submitted by:	<yamori813@yahoo.co.jp>
Differential Revision:	https://reviews.freebsd.org/D20170
2019-05-15 16:51:08 +00:00
Mark Johnston
11a5fc4fb9 Catch up with r347241.
MFC with:	r347241
2019-05-13 01:18:17 +00:00
Kyle Evans
251a32b5b2 tun/tap: merge and rename to tuntap
tun(4) and tap(4) share the same general management interface and have a lot
in common. Bugs exist in tap(4) that have been fixed in tun(4), and
vice-versa. Let's reduce the maintenance requirements by merging them
together and using flags to differentiate between the three interface types
(tun, tap, vmnet).

This fixes a couple of tap(4)/vmnet(4) issues right out of the gate:
- tap devices may no longer be destroyed while they're open [0]
- VIMAGE issues already addressed in tun by kp

[0] emaste had removed an easy-panic-button in r240938 due to devdrn
blocking. A naive glance over this leads me to believe that this isn't quite
complete -- destroy_devl will only block while executing d_* functions, but
doesn't block the device from being destroyed while a process has it open.
The latter is the intent of the condvar in tun, so this is "fixed" (for
certain definitions of the word -- it wasn't really broken in tap, it just
wasn't quite ideal).

ifconfig(8) also grew the ability to map an interface name to a kld, so
that `ifconfig {tun,tap}0` can continue to autoload the correct module, and
`ifconfig vmnet0 create` will now autoload the correct module. This is a
low overhead addition.

(MFC commentary)

This may get MFC'd if many bugs in tun(4)/tap(4) are discovered after this,
and how critical they are. Changes after this are likely easily MFC'd
without taking this merge, but the merge will be easier.

I have no plans to do this MFC as of now.

Reviewed by:	bcr (manpages), tuexen (testing, syzkaller/packetdrill)
Input also from:	melifaro
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D20044
2019-05-08 02:32:11 +00:00
Conrad Meyer
d6745408c7 Add a COMPAT_FREEBSD12 kernel option.
Use it wherever COMPAT_FREEBSD11 is currently specified, like r309749.

Reviewed by:	imp, jhb, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D20120
2019-05-02 18:10:23 +00:00
Conrad Meyer
3782136ff1 random(4): Restore availability tradeoff prior to r346250
As discussed in that commit message, it is a dangerous default.  But the
safe default causes enough pain on a variety of platforms that for now,
restore the prior default.

Some of this is self-induced pain we should/could do better about; for
example, programmatic CI systems and VM managers should introduce entropy
from the host for individual VM instances.  This is considered a future work
item.

On modern x86 and Power9 systems, this may be wholly unnecessary after
D19928 lands (even in the non-ideal case where early /boot/entropy is
unavailable), because they have fast hardware random sources available early
in boot.  But D19928 is not yet landed and we have a host of architectures
which do not provide fast random sources.

This change adds several tunables and diagnostic sysctls, documented
thoroughly in UPDATING and sys/dev/random/random_infra.c.

PR:		230875 (reopens)
Reported by:	adrian, jhb, imp, and probably others
Reviewed by:	delphij, imp (earlier version), markm (earlier version)
Discussed with:	adrian
Approved by:	secteam(delphij)
Relnotes:	yeah
Security:	related
Differential Revision:	https://reviews.freebsd.org/D19944
2019-04-18 20:48:54 +00:00
Allan Jude
5e02af0dda The Atheros AR7241 has 20 GPIO pins
AR724X_GPIO_PINS used for this family is defined as 18
The datasheet for the AR7241 describes 20 pins, allow all to be used.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka
Differential Revision:	https://reviews.freebsd.org/D17580
2019-03-25 07:48:52 +00:00
Warner Losh
8b3a3ef841 Remove duplicate options. 2019-03-23 18:32:28 +00:00
Warner Losh
c071191be5 Add device xz. This was somehow missed in the last round.
Submitted by: Brandon Bergren
2019-03-23 18:32:24 +00:00
Konstantin Belousov
fd8d844f76 amd64 KPTI: add control from procctl(2).
Add the infrastructure to allow MD procctl(2) commands, and use it to
introduce amd64 PTI control and reporting.  PTI mode cannot be
modified for existing pmap, the knob controls PTI of the new vmspace
created on exec.

Requested by:	jhb
Reviewed by:	jhb, markj (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D19514
2019-03-16 11:44:33 +00:00
Konstantin Belousov
6f1fe3305a amd64: Add md process flags and first P_MD_PTI flag.
PTI mode for the process pmap on exec is activated iff P_MD_PTI is set.

On exec, the existing vmspace can be reused only if pti mode of the
pmap matches the P_MD_PTI flag of the process.  Add MD
cpu_exec_vmspace_reuse() callback for exec_new_vmspace() which can
vetoed reuse of the existing vmspace.

MFC note: md_flags change struct proc KBI.

Reviewed by:	jhb, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D19514
2019-03-16 11:31:01 +00:00
Juli Mallett
ce92b1bf56 Remove obsolete wrappers for 64-bit loads/stores which were only used by the
removed (r342255) SiByte port.

Reviewed by:	imp
2019-03-16 06:09:45 +00:00
Konstantin Belousov
0e05133ab6 mips: remove dead comment and definitions.
Reviewed by:	brooks, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D19584
2019-03-14 19:07:41 +00:00
Brooks Davis
5e0d22c1b4 Style(9): add a missing space between argument declerations. 2019-03-14 15:56:34 +00:00
Brooks Davis
17f254d840 Remove an unused struct proc *p1 in cpu_fork().
The only reference to p1 after a dead store was in a comment so update
the comment to refer to td1.

Submitted by:	sbruno
Differential Revision:	https://reviews.freebsd.org/D16226
2019-03-14 15:55:30 +00:00
Edward Tomasz Napierala
1699546def Remove sv_pagesize, originally introduced with r100384.
In all of the architectures we have today, we always use PAGE_SIZE.
While in theory one could define different things, none of the
current architectures do, even the ones that have transitioned from
32-bit to 64-bit like i386 and arm. Some ancient mips binaries on
other systems used 8k instead of 4k, but we don't support running
those and likely never will due to their age and obscurity.

Reviewed by:	imp (who also contributed the commit message)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D19280
2019-03-01 16:16:38 +00:00
Konstantin Belousov
e8643b01e6 Modularize xz.
Embedded lzma decompression library becomes a module usable by other
consumers, in addition to geom_uzip.

Most important code changes are
- removal of XZ_DEC_SINGLE define, we need the code to work
  with XZ_DEC_DYNALLOC;
- xz_crc32_init() call is removed from geom_uzip, xz module handles
  initialization on its own.

xz is no longer embedded into geom_uzip, instead the depend line for
the module is provided, and corresponding kernel option is added to
each MIPS kernel config file using geom_uzip.

The commit also carries unrelated cleanup by removing excess "device geom_uzip"
in places which were missed in r344479.

Reviewed by:	cem, hselasky, ray, slavash (previous versions)
Sponsored by:	Mellanox Technologies
Differential revision:	https://reviews.freebsd.org/D19266
MFC after:	3 weeks
2019-02-26 19:55:03 +00:00
Maxim Sobolev
c5235dce89 o Get rid of silly comment which seems to have got life of its own via
copy-and-paste process;

o Return geom_uzip(4) usage back to how manual page prescribes it to be
  used while I am here.
2019-02-23 00:00:49 +00:00
Konstantin Belousov
e7a9df16e6 Add kernel support for Intel userspace protection keys feature on
Skylake Xeons.

See SDM rev. 68 Vol 3 4.6.2 Protection Keys and the description of the
RDPKRU and WRPKRU instructions.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D18893
2019-02-20 09:51:13 +00:00
Konstantin Belousov
72091bb393 Enable enabling ASLR on non-x86 architectures.
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
2019-02-14 14:44:53 +00:00
Nathan Whitehorn
f68992cf66 Performance improvements for octe(4):
- Distribute RX load across multiple cores, if present. This reverts
  r217212, which is no longer relevant (I think because of the newer
  SDK).
- Use newer APIs for pinning taskqueue entries to specific cores.
- Deepen RX buffers.

This more than doubles NAT forwarding throughput on my EdgeRouter Lite from,
with typical packet mixture, 90 Mbps to over 200 Mbps. The result matches
forwarding throughput in Linux without the UBNT hardware offload on the same
hardware, and thus likely reflects hardware limits.

Reviewed by:	jhibbits
2019-02-10 20:13:59 +00:00
Warner Losh
8590b14e9d Remove a few stray "All Rights Reserved." declarations on stuff I've
written.
2019-02-05 21:28:29 +00:00
Konstantin Belousov
c75f49f7d8 Make iflib a loadable module.
iflib is already a module, but it is unconditionally compiled into the
kernel.  There are drivers which do not need iflib(4), and there are
situations where somebody might not want iflib in kernel because of
using the corresponding driver as module.

Reviewed by:	marius
Discussed with:	erj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D19041
2019-01-31 19:05:56 +00:00
Oleksandr Tymoshenko
e4376aaa32 [mips] Fix error condition check that always evaluates to false
Use proper logical operand when checking the value of srcid

PR:		200988
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 20:14:28 +00:00
Oleksandr Tymoshenko
817f9fcca7 [mips] Unbreak kernel build for CI20
- Include header required for boot_parse_XXX functions
- Use boot_parse_args when parsing argc/argv style arguments
- Remove unused function
2019-01-25 20:10:57 +00:00
Oleksandr Tymoshenko
04a50a5272 [mips] Fix counter mask in jz4780 timer driver
Fix dublicate value in what is apparent copypaste mistake. The last value
in mask is supposed to be for counter 7, not counter 3.

PR:		229790
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 20:02:55 +00:00
Oleksandr Tymoshenko
fc606bb11b [mips] remove check that is always false (unsinged < 0)
cpuid and local cpu variable are unsigned so checking if value is less than zero
always yields false.

PR:		211088
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 19:58:56 +00:00
Oleksandr Tymoshenko
f848b45958 [mips] remove dublicate values in enable mask in nlm_usb_intr_en
PR:		230572
Submitted by:	David Binderman <dcb314@hotmail.com>
MFC after:	1 week
2019-01-25 19:36:20 +00:00
Andriy Voskoboinyk
86d535ab47 Garbage collect AH_SUPPORT_AR5416 config option.
It does nothing since r318857.
2019-01-25 13:48:40 +00:00
Andriy Voskoboinyk
4945f79a4c Remove IEEE80211_AMPDU_AGE config option.
It is noop since r297774.
2019-01-20 15:17:56 +00:00
Warner Losh
c3efee6ed9 Add note to 32-bit mips smp config files documenting the status 2018-12-19 23:22:14 +00:00
Warner Losh
0741ca101c 32-bit mips SMP is unsupported
Per discussions on mips@, 32-bit mips SMP is now unsupported. The
files in the tree will compile for a while longer, but when the
atomic_swap_64 or similar atomic enters into the MI part of the tree,
as currently foreseen sometime next year, these ports will start to no
longer link. The JZ4780 is the only such system we have.

The UP version of this chip is unaffected by this, and will remain
supported.

Discussed on: mips@
Relnotes: yes
2018-12-19 23:15:49 +00:00
Warner Losh
8e1165bf5b Remove old config file for SENTRY5
This is an older broadcom part that implements the mips32 ISA. 32-bit
FreeBSD/mips now requires mips32r2, so retire this config. Most of the
broadcom port is shared with newer ports, so what little code may be
unique to this part has not been GC'd at this time.

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543
2018-12-19 22:54:34 +00:00
Warner Losh
31733a7d2e Remove support for running 32-bit kernels on 64-bit hardware.
This was useful in bring up. However, it causes more issues than the
support is worth (64-bit atomics being chief among them).

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543
2018-12-19 22:54:29 +00:00
Warner Losh
a9ab417679 Remove the GXEMUL support.
gxemul was a nice stop-gap while qemu support for mips was firmed
up. Now MALTA* + qemu is the platform of choice retire gxemul support.
It's unknown when this was last confirmed working.

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543
2018-12-19 22:54:23 +00:00
Warner Losh
0bb183ed8d Remove support for the now very old SiByte MIPS platform. It's not
relevant and is unused. It's also getting in the way of progress in
some admittedly minor ways. Better to retire it to reduce the burden
on the project.

Discussed on: freebsd-mips@
Differential Revision: https://reviews.freebsd.org/D18543
2018-12-19 22:54:03 +00:00
Mateusz Guzik
628888f0e0 Remove iBCS2, part2: general kernel
Reviewed by:	kib (previous version)
Sponsored by:	The FreeBSD Foundation
2018-12-19 21:57:58 +00:00
Warner Losh
3d060215a5 atomic_cmpset return value is also an int. 2018-12-14 19:48:42 +00:00
Warner Losh
2fb9d3808a atomic_fcmpset* return int, not the type of *.
fcmpset returns true/false as a int, so make the return types and
variables match the int to be consistent with other arch.

Reviewed by: cognet@
Differential Revision: https://reviews.freebsd.org/D18557
2018-12-14 19:14:51 +00:00
Warner Losh
a1128e850e Correctly implemenet atomic_swap_long for mips64.
MIPS64 has 64-bit longs, so use uint64_t for it, otherwise uint32_t.
sizeof(long) == sizeof(ptr) for all platforms, so define
atomic_swap_ptr in terms of atomic_swap_long.

Submitted by: hps@
2018-12-13 00:42:26 +00:00
Warner Losh
d11278054b Remove stray hints files. 2018-12-10 21:33:01 +00:00
Hans Petter Selasky
d7a9bfee8f Implement atomic_swap_xxx() for all platforms.
Differential Revision:	https://reviews.freebsd.org/D18450
Reviewed by:		kib@
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-12-10 13:38:13 +00:00
Sean Bruno
1a8177b128 Add CAPABILITIES to the ERL kernel config so that tools that have been
modified with Capsicum work on this target platform.

This came up after the conversion of wc(8).
2018-11-28 13:25:10 +00:00
Eric van Gyzen
f5e7d8bdb5 Prevent kernel stack disclosure in getcontext/swapcontext
Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.

MFC after:	2 days
Security:	FreeBSD-EN-18:12.mem
Security:	CVE-2018-17155
Sponsored by:	Dell EMC Isilon
2018-11-26 20:50:55 +00:00
Stanislav Galabov
ef4e6c8fe8 Fix access to cpu_model[] in mtk_soc_set_cpu_model()
There may be cases where cpu_model[] may not be 32bit aligned, so it is
better to not try to access it as such in order to avoid unaligned access.

Sponsored by:	Smartcom - Bulgaria AD
2018-11-19 06:48:48 +00:00