]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoFix enough warnings that we can build syslogd on all targets at WARNS=6.
ed [Sat, 7 Apr 2018 09:03:51 +0000 (09:03 +0000)]
Fix enough warnings that we can build syslogd on all targets at WARNS=6.

This also fixes the build on MIPS.

Reported by: cy (MIPS build failure)

6 years agoRemove the thread argument from ifr_buffer_*() accessors.
brooks [Fri, 6 Apr 2018 23:25:54 +0000 (23:25 +0000)]
Remove the thread argument from ifr_buffer_*() accessors.

They are always used in a context where curthread is the correct thread.
This makes them more similar to the ifr_data_get_ptr() accessor.

6 years agoAdd a way to temporarily suspend and resume virtual CPUs.
jhb [Fri, 6 Apr 2018 22:03:43 +0000 (22:03 +0000)]
Add a way to temporarily suspend and resume virtual CPUs.

This is used as part of implementing run control in bhyve's debug
server.  The hypervisor now maintains a set of "debugged" CPUs.
Attempting to run a debugged CPU will fail to execute any guest
instructions and will instead report a VM_EXITCODE_DEBUG exit to
the userland hypervisor.  Virtual CPUs are placed into the debugged
state via vm_suspend_cpu() (implemented via a new VM_SUSPEND_CPU ioctl).
Virtual CPUs can be resumed via vm_resume_cpu() (VM_RESUME_CPU ioctl).

The debug server suspends virtual CPUs when it wishes them to stop
executing in the guest (for example, when a debugger attaches to the
server).  The debug server can choose to resume only a subset of CPUs
(for example, when single stepping) or it can choose to resume all
CPUs.  The debug server must explicitly mark a CPU as resumed via
vm_resume_cpu() before the virtual CPU will successfully execute any
guest instructions.

Reviewed by: avg, grehan
Tested on: Intel (jhb), AMD (avg)
Differential Revision: https://reviews.freebsd.org/D14466

6 years agoifconf(): correct handling of sockaddrs smaller than struct sockaddr.
brooks [Fri, 6 Apr 2018 20:26:56 +0000 (20:26 +0000)]
ifconf(): correct handling of sockaddrs smaller than struct sockaddr.

Portable programs that use SIOCGIFCONF (e.g. traceroute) assume
that each pseudo ifreq is of length MAX(sizeof(struct ifreq),
sizeof(ifr_name) + ifr_addr.sa_len).  For short sockaddrs we copied
too much from the source sockaddr resulting in a heap leak.

I believe only one such sockaddr exists (struct sockaddr_sco which
is 8 bytes) and it is unclear if such sockaddrs end up on interfaces
in practice.  If it did, the result would be an 8 byte heap leak on
current architectures.

admbugs: 869
Reviewed by: kib
Obtained from: CheriBSD
MFC after: 3 days
Security: kernel heap leak
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14981

6 years agoRe-sort LOADER options
kevans [Fri, 6 Apr 2018 19:49:57 +0000 (19:49 +0000)]
Re-sort LOADER options

These have become unsorted from everything else. This is desync'd from
stable/11 due to some hand-merging that was done there, so the MFC of this
will look slightly different.

MFC after: 3 days

6 years agoDo not fail devices just for errors in descriptor format.
mav [Fri, 6 Apr 2018 19:47:44 +0000 (19:47 +0000)]
Do not fail devices just for errors in descriptor format.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

6 years agopf tests: Basic ioctl validation
kp [Fri, 6 Apr 2018 19:37:15 +0000 (19:37 +0000)]
pf tests: Basic ioctl validation

Basic validation tests for DIOCRADDADDRS, DIOCRDELADDRS, DIOCRSETADDRS,
DIOCRGETADDRS, DIOCRGETASTATS, DIOCRCLRASTATS, DIOCRTSTADDRS,
DIOCRINADEFINE, DIOCXBEGIN and DIOCXROLLBACK.

MFC after: 1 week

6 years agopf: Improve ioctl validation
kp [Fri, 6 Apr 2018 19:36:35 +0000 (19:36 +0000)]
pf: Improve ioctl validation

Ensure that multiplications for memory allocations cannot overflow, and
that we'll not try to allocate M_WAITOK for potentially overly large
allocations.

MFC after: 1 week

6 years agopf tests: Try to provoke a memory leak
kp [Fri, 6 Apr 2018 19:22:22 +0000 (19:22 +0000)]
pf tests: Try to provoke a memory leak

There was a memory leak in the DIOCRADDTABLES ioctl() code which could
be triggered by trying to add tables with the same name.
Try to provoke this memory leak. It was fixed in r331225.

MFC after: 1 week

6 years agopf tests: Basic ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT
kp [Fri, 6 Apr 2018 19:21:29 +0000 (19:21 +0000)]
pf tests: Basic ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT

Validate the DIOCIGETIFACES and DIOCXCOMMIT ioctls with invalid values.

MFC after: 1 week

6 years agopf: Improve ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT
kp [Fri, 6 Apr 2018 19:20:45 +0000 (19:20 +0000)]
pf: Improve ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT

These ioctls can process a number of items at a time, which puts us at
risk of overflow in mallocarray() and of impossibly large allocations
even if we don't overflow.

There's no obvious limit to the request size for these, so we limit the
requests to something which won't overflow. Change the memory allocation
to M_NOWAIT so excessive requests will fail rather than stall forever.

MFC after: 1 week

6 years agoAdd an unused _COMPAT_LINUX32 option to ensure opt_compat.h exists on
brooks [Fri, 6 Apr 2018 19:11:22 +0000 (19:11 +0000)]
Add an unused _COMPAT_LINUX32 option to ensure opt_compat.h exists on
platforms without COMPAT_LINUX32.

Reported by: kib

6 years agoMove most of the contents of opt_compat.h to opt_global.h.
brooks [Fri, 6 Apr 2018 17:35:35 +0000 (17:35 +0000)]
Move most of the contents of opt_compat.h to opt_global.h.

opt_compat.h is mentioned in nearly 180 files. In-progress network
driver compabibility improvements may add over 100 more so this is
closer to "just about everywhere" than "only some files" per the
guidance in sys/conf/options.

Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
is created on all architectures.

Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
set of compiled files.

Reviewed by: kib, cem, jhb, jtl
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14941

6 years agoSupport -DNO_CLEAN builds across r332119.
brooks [Fri, 6 Apr 2018 17:23:47 +0000 (17:23 +0000)]
Support -DNO_CLEAN builds across r332119.

6 years agoIf a user closes the socket before we call tcp_usr_abort(), then
jtl [Fri, 6 Apr 2018 17:20:37 +0000 (17:20 +0000)]
If a user closes the socket before we call tcp_usr_abort(), then
tcp_drop() may unlock the INP.  Currently, tcp_usr_abort() does not
check for this case, which results in a panic while trying to unlock
the already-unlocked INP (not to mention, a use-after-free violation).

Make tcp_usr_abort() check the return value of tcp_drop(). In the case
where tcp_drop() returns NULL, tcp_usr_abort() can skip further steps
to abort the connection and simply unlock the INP_INFO lock prior to
returning.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Netflix, Inc.

6 years agoRemove caching from getlogin(2).
brooks [Fri, 6 Apr 2018 17:17:34 +0000 (17:17 +0000)]
Remove caching from getlogin(2).

This caching has existed since the CSRG import, but serves no obvious
purpose. Sure, setlogin() is called rarely, but calls to getlogin()
should also be infrequent. The required invalidation was not
implemented on aarch64, arm, mips, amd riscv so updates would never
occur if getlogin() was called before setlogin().

Reported by: Ali Mashtizadeh <ali@mashtizadeh.com>
Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14965

6 years agoPush RFC 5424 message format from logmsg() into fprintlog().
ed [Fri, 6 Apr 2018 17:16:50 +0000 (17:16 +0000)]
Push RFC 5424 message format from logmsg() into fprintlog().

Now that all of parsemsg() parses both RFC 3164 and 5424 messages and
hands them to logmsg(), alter the latter to properly forward all RFC
5424 message attributes to fprintlog(). While there, make some minor
cleanups to this code:

- Instead of extending the existing code that compares hostnames and
  message bodies for deduplication, print all of the relevant message
  fields into a single string that we can compare ('saved').

- No longer let the behaviour of fprintflog() depend on whether
  'msg == NULL' to print repetition messages, Simply decompose this
  function into fprintlog_first() and fprintlog_successive(). This
  makes the interpretation of function arguments less magical and also
  allows us to get consistent behaviour across RFC 3164 and 5424 when
  adding support for the RFC 5424 output format.

- As RFC 5424 syslog messages have a dedicated application name field,
  alter the repetition messages to be printed on behalf of syslogd on
  the current system. Change these messages to use the local hostname,
  so that it's obvious which syslogd instance detected the repetition.
  Remove f_prevhost, as it has now become unnecessary.

- Remove a useless strdup(). Deconsting the message string is safe in
  this specific case.

6 years agoPat the watchdog less while producing a coredump. Prior to this change,
jtl [Fri, 6 Apr 2018 17:06:22 +0000 (17:06 +0000)]
Pat the watchdog less while producing a coredump.  Prior to this change,
we patted the watchdog approximately once per 4KB page of memory.  After
this change, we pat the watchdog approximately once per 128MB of memory.
On a sample machine, this translated to patting the watchdog approximately
every 5.4 seconds, which "seems reasonable". We can choose a different
value in the future, if warranted.

This has extensive field experience. It is a performance improvement, and
has not caused any known problems.

Reviewed by: imp, kib
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D14988

6 years agoCheck that in_pcbfree() is only called once for each PCB. If that
jtl [Fri, 6 Apr 2018 16:48:11 +0000 (16:48 +0000)]
Check that in_pcbfree() is only called once for each PCB.  If that
assumption is violated, "bad things" could follow.

I believe such an assert would have detected some of the problems jch@
was chasing in PR 203175 (see r307551).  We also use it in our internal
TCP development efforts.  And, in case a bug does slip through to
released code, this change silently ignores subsequent calls to
in_pcbfree().

Reviewed by: rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D14990

6 years agoRemove some places where error messages are prefixed with "syslogd".
ed [Fri, 6 Apr 2018 16:26:46 +0000 (16:26 +0000)]
Remove some places where error messages are prefixed with "syslogd".

Due to using RFC 5424, the application name is stored in a dedicated
field. It can simply be passed as an argument to logmsg() now.

6 years agoProperly respect the passed in hostname for RFC 5424 messages.
ed [Fri, 6 Apr 2018 16:24:03 +0000 (16:24 +0000)]
Properly respect the passed in hostname for RFC 5424 messages.

Only override the hostname in case none is provided or when remote
hostnames should be ignored.

6 years agox86: fix trampoline memory allocation after r332073
royger [Fri, 6 Apr 2018 16:22:14 +0000 (16:22 +0000)]
x86: fix trampoline memory allocation after r332073

Add the missing breaks in the for loops, in order to exit the loop
when a suitable entry is found.

Also switch amd64 native_start_all_aps to use PHYS_TO_DMAP in order to
find the virtual address of the boot_trampoline and the initial page
tables.

Reported and tested by: pho
Sponsored by: Citrix Systems R&D

6 years agopf tests: Basic ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS...
kp [Fri, 6 Apr 2018 15:57:20 +0000 (15:57 +0000)]
pf tests: Basic ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS and DIOCRSETTFLAGS

Validate the DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS and
DIOCRSETTFLAGS ioctls with invalid values. These may succeed (because
the kernel uses the minimally required size, not the specified size),
but should not trigger kernel panics.

MFC after: 1 week

6 years agopf: Improve ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS and...
kp [Fri, 6 Apr 2018 15:54:30 +0000 (15:54 +0000)]
pf: Improve ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS and DIOCRSETTFLAGS

These ioctls can process a number of items at a time, which puts us at
risk of overflow in mallocarray() and of impossibly large allocations
even if we don't overflow.

Limit the allocation to required size (or the user allocation, if that's
smaller). That does mean we need to do the allocation with the rules
lock held (so the number doesn't change while we're doing this), so it
can't M_WAITOK.

MFC after: 1 week

6 years agolualoader: Fix menu skipping with loader.conf(5) vars
kevans [Fri, 6 Apr 2018 15:19:48 +0000 (15:19 +0000)]
lualoader: Fix menu skipping with loader.conf(5) vars

Earlier efforts to stop loading the menu broke the ability to skip the menu
with, e.g., beastie_disable in loader.conf(5) as it was decided before
configuration was read.

Defer bringing in the menu module until we've loaded configuration so that
we can make a more informed decision on whether the menu should be skipped
or not.

6 years agoaw_sid(4): Use prctl read for all reads when it's required
kevans [Fri, 6 Apr 2018 15:17:09 +0000 (15:17 +0000)]
aw_sid(4): Use prctl read for all reads when it's required

It was later found that some operation on the OrangePi one will cause
direct accesses to the eeprom to return wrong data again, so reading it all
once via prctl at attach time is no longer sufficient.

6 years agoIn cases where an application issues certain IPMI commands at a high
jtl [Fri, 6 Apr 2018 15:15:21 +0000 (15:15 +0000)]
In cases where an application issues certain IPMI commands at a high
enough rate, the IPMI code can print large numbers of messages to the
console, such as:
  ipmi0: KCS: Failed to read completion code
  ipmi0: KCS error: ff
  ipmi0: KCS: Failed to read completion code
  ipmi0: KCS error: ff

These seem to be innocuous from a system standpoint, and the user-
space code can deal with the failures. Therefore, suppress printing
these messages to the console unless bootverbose is enabled.

Obtained from: Netflix, Inc.

6 years agopf tests: Basic ioctl validation tests
kp [Fri, 6 Apr 2018 15:03:48 +0000 (15:03 +0000)]
pf tests: Basic ioctl validation tests

Validate the DIOCRADDTABLES and DIOCRDELTABLES ioctls with invalid size
values. All of these requests should fail.

MFC after: 1 week

6 years agopf: Improve ioctl validation for DIOCRADDTABLES and DIOCRDELTABLES
kp [Fri, 6 Apr 2018 15:01:45 +0000 (15:01 +0000)]
pf: Improve ioctl validation for DIOCRADDTABLES and DIOCRDELTABLES

The DIOCRADDTABLES and DIOCRDELTABLES ioctls can process a number of
tables at a time, and as such try to allocate <number of tables> *
sizeof(struct pfr_table). This multiplication can overflow. Thanks to
mallocarray() this is not exploitable, but an overflow does panic the
system.

Arbitrarily limit this to 65535 tables. pfctl only ever processes one
table at a time, so it presents no issues there.

MFC after: 1 week

6 years agoLet syslog(3) use RFC 5424.
ed [Fri, 6 Apr 2018 13:00:45 +0000 (13:00 +0000)]
Let syslog(3) use RFC 5424.

With r332099 changing syslogd(8) to parse RFC 5424 formatted syslog
messages, go ahead and also change the syslog(3) libc function to
generate them. Compared to RFC 3164, RFC 5424 has various advantages,
such as sub-second precision for log entry timestamps.

As this change could have adverse effects when not updating syslogd(8)
or using a different system logging daemon, add a notice to UPDATING and
increase __FreeBSD_version.

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

6 years agoAdd RFC 5424 syslog message parsing to syslogd.
ed [Fri, 6 Apr 2018 12:57:01 +0000 (12:57 +0000)]
Add RFC 5424 syslog message parsing to syslogd.

Syslogd currently uses the RFC 3164 format for its log messages.One
limitation of RFC 3164 is that it cannot be used to log entries with
sub-second precision timestamps. One of our users has expressed a desire
for doing this for doing some basic performance measurements.

This change attempts to make a first cut at switching to RFC 5424 based
logging. The first step is to alter syslogd's input path to properly
parse such messages. It alters the logmsg() prototype to match the
fields of RFC 5424. The parsemsg() function is extended to parse both
RFC 3164 and 5424 messages and call into logmsg() accordingly.

Additional changes include:

- Introducing proper parsing of timestamps, so that they can be printed
  in any desired output format. This means we need to infer the year and
  timezone for RFC 3164 timestamps.
- Removing ISKERNEL. This can now be realised by simply providing an
  APP-NAME (== "kernel").
- Extending RFC 3164 parsing to trim off the TAG prefix and using that
  to derive APP-NAME and PROCID.
- Increase MAXLINE. RFC 5424 mentions we should support 2k messages.

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

6 years agoremove GiB/MiB macros from param.h
royger [Fri, 6 Apr 2018 11:20:06 +0000 (11:20 +0000)]
remove GiB/MiB macros from param.h

And instead define them in the files where they are used.

Requested by: bde

6 years agostand: pass --no-rosegment for i386 bits when linking with lld
emaste [Fri, 6 Apr 2018 02:57:58 +0000 (02:57 +0000)]
stand: pass --no-rosegment for i386 bits when linking with lld

btxld does not correctly handle input with other than 2 PT_LOAD
segments.  Passing --no-rosegment lets lld produce output eqivalent to
ld.bfd: 2 PT_LOAD segments and no PT_GNU_RELRO.

PR: 225775
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14956

6 years agoAdd 32-bit compat for ioctls that take struct ifgroupreq.
brooks [Thu, 5 Apr 2018 22:14:55 +0000 (22:14 +0000)]
Add 32-bit compat for ioctls that take struct ifgroupreq.

Use an accessor to access ifgr_group and ifgr_groups.

Use an macro CASE_IOC_IFGROUPREQ(cmd) in place of case statements such
as "case SIOCAIFGROUP:". This avoids poluting the switch statements
with large numbers of #ifdefs.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14960

6 years agoifconf(): Always zero the whole struct ifreq.
brooks [Thu, 5 Apr 2018 21:58:28 +0000 (21:58 +0000)]
ifconf(): Always zero the whole struct ifreq.

The previous split of zeroing ifr_name and ifr_addr seperately is safe
on current architectures, but would be unsafe if pointers were larger
than 8 bytes. Combining the zeroing adds no real cost (a few
instructions) and makes the security property easier to verify.

Reviewed by: kib, emaste
Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14912

6 years agoAdded SAL annotatations to system calls.
brooks [Thu, 5 Apr 2018 20:31:45 +0000 (20:31 +0000)]
Added SAL annotatations to system calls.

Modify makesyscalls.sh to strip out SAL annotations.

No functional change.

This is based on work I started in CheriBSD and use to validate fat
pointers at the syscall boundary.  Tal Garfinkel reviewed the changes,
added annotations to COMPAT* syscalls and is using them in a record and
playback framework.  One can envision other uses such as a WITNESS-like
validator for copyin/out as speculated on in the review.

As this time we are only annotating sys/kern/syscalls.master as that is
sufficient for userspace work.  If kernel use cases materialize, we can
annotate other syscalls.master as needed.

Submitted by: Tal Garfinkel <talg@cs.stanford.edu>
Sponsored by: DARPA, AFRL (in part)
Differential Revision: https://reviews.freebsd.org/D14285

6 years agoAdd an ISO9660 "partition table" type to loader.
benno [Thu, 5 Apr 2018 19:45:30 +0000 (19:45 +0000)]
Add an ISO9660 "partition table" type to loader.

When booted via isoboot(8) loader will be handed a disk that simply contains
an ISO9660 image. Currently this confuses it greatly. Teach it how to spot
that it's in this situation and that ISO9660 has one "partition" covering
the whole disk.

Reviewed by: imp
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14915

6 years agoAdd isoboot(8) for booting BIOS systems from HDDs containing ISO images.
benno [Thu, 5 Apr 2018 19:40:46 +0000 (19:40 +0000)]
Add isoboot(8) for booting BIOS systems from HDDs containing ISO images.

This is part of a project for adding the ability to create hybrid CD/USB boot
images. In the BIOS case when booting from something that isn't a CD we need
some extra boot code to actually find our next stage (loader) within an
ISO9660 filesystem. This code will reside in a GPT partition (similar to
gptboot(8) from which it is derived) and looks for /boot/loader in an
ISO9660 filesystem on the image.

Reviewed by: imp
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14914

6 years agoVarious style(9) fixes.
benno [Thu, 5 Apr 2018 19:29:22 +0000 (19:29 +0000)]
Various style(9) fixes.

Reviewed by: strip --strip-debug -o - gptboot.o | md5
Sponsored by: iXsystems, Inc.

6 years agoUse consistent whitespace.
benno [Thu, 5 Apr 2018 19:27:24 +0000 (19:27 +0000)]
Use consistent whitespace.

Reviewed by: strip --strip-debug -o - gptboot.o | md5
Sponsored by: iXsystems, Inc.

6 years agoAllow -DNO_CLEAN buildworld after r332080.
brooks [Thu, 5 Apr 2018 18:19:48 +0000 (18:19 +0000)]
Allow -DNO_CLEAN buildworld after r332080.

6 years agoRemove architecture specific shmat.S files.
brooks [Thu, 5 Apr 2018 18:17:46 +0000 (18:17 +0000)]
Remove architecture specific shmat.S files.

These files are identical to the generated system calls.
In the case of MIPS, the file was already disconnected from the build.

Submitted by: Ali Mashtizadeh <ali@mashtizadeh.com>
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D14976

6 years agoFix the definitions of get_cpu() and put_cpu().
markj [Thu, 5 Apr 2018 17:26:03 +0000 (17:26 +0000)]
Fix the definitions of get_cpu() and put_cpu().

They are supposed to disable preemption.

Reported by: rstone
MFC after: 5 days

6 years agoAdd support for the Coresight technology from ARM Ltd.
br [Thu, 5 Apr 2018 15:45:54 +0000 (15:45 +0000)]
Add support for the Coresight technology from ARM Ltd.

ARM Coresight is a solution for debug and trace of complex SoC designs.

This includes a collection of drivers for ARM Coresight interconnect
devices within a small Coresight framework.

Supported devices are:
o Embedded Trace Macrocell v4 (ETMv4)
o Funnel
o Dynamic Replicator
o Trace Memory Controller (TMC)
o CPU debug module

Devices are connected to each other internally in SoC and the
configuration of each device endpoints is described in FDT.

Typical trace flow (as found on Qualcomm Snapdragon 410e):
CPU0 -> ETM0 -> funnel1 -> funnel0 -> ETF -> replicator -> ETR -> DRAM
CPU1 -> ETM1 -^
CPU2 -> ETM2 -^
CPU3 -> ETM3 -^

Note that both Embedded Trace FIFO (ETF) and Embedded Trace Router (ETR)
are hardware configurations of TMC.

This is required for upcoming HWPMC tracing support.

This is tested on single-core system only.

Reviewed by: andrew (partially)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14618

6 years agoExit with usage when extra arguments are on command line
rgrimes [Thu, 5 Apr 2018 15:00:08 +0000 (15:00 +0000)]
Exit with usage when extra arguments are on command line
preventing mistakes such as "halt 0p" for "halt -p".
Approved by: bde (mentor), phk (mentor)
MFC after: 1 week

6 years agox86: improve reservation of AP trampoline memory
royger [Thu, 5 Apr 2018 14:39:51 +0000 (14:39 +0000)]
x86: improve reservation of AP trampoline memory

So that it doesn't rely on physmap[1] containing an address below
1MiB. Instead scan the full physmap and search for a suitable address
to place the trampoline code (below 1MiB) and the initial memory pages
(below 4GiB).

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D14878

6 years agointroduce GiB and MiB macros
royger [Thu, 5 Apr 2018 14:31:54 +0000 (14:31 +0000)]
introduce GiB and MiB macros

This macros convert from GiB or MiB into bytes.

Sponsored by: Citrix Systems R&D

6 years agoSquash error from geom by sizing ident strings to DISK_IDENT_SIZE.
sbruno [Thu, 5 Apr 2018 13:56:40 +0000 (13:56 +0000)]
Squash error from geom by sizing ident strings to DISK_IDENT_SIZE.

Display attribute in future error strings and differentiate g_handleattr()
error messages for ease of debugging in the future.

"g_handleattr: md1 bio_length 24 strlen 31 -> EFAULT"

Reported by: swills
Reviewed by: imp cem avg
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14962

6 years agoFix ERESTART for lcall $7,$0 syscalls.
kib [Thu, 5 Apr 2018 11:03:21 +0000 (11:03 +0000)]
Fix ERESTART for lcall $7,$0 syscalls.

The lcall trampoline enters kernel by int $0x80, which sets up invalid
length of the instruction for %rip rewind.

Reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoMake the INTO instruction operational in 32bit mode.
kib [Thu, 5 Apr 2018 11:03:05 +0000 (11:03 +0000)]
Make the INTO instruction operational in 32bit mode.

Having the IDT entry specify ring 0 DPL caused delivery of #GP instead
of #OF.

The instruction is not valid in 64bit mode, which probably explains
why the IDT entry for #OF was initially set this way.  It is
interesting to note that the BOUND instruction works with the IDT #BR
entry DPL 0, most likely CPU considers #BR from BOUND as generated by
a machine, not user.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoremove special handling for stale ptrace dependencies
emaste [Thu, 5 Apr 2018 03:26:42 +0000 (03:26 +0000)]
remove special handling for stale ptrace dependencies

r318957 added special handling for stale ptrace dependency files to
support a -DNO_CLEAN build in a tree last built before r305012.  That
revision is now over a year and a half old, so retire the special case.

Sponsored by: The FreeBSD Foundation

6 years agoRenumber soft-update types starting at 1 instead of 0 to avoid confusion
mckusick [Thu, 5 Apr 2018 00:32:01 +0000 (00:32 +0000)]
Renumber soft-update types starting at 1 instead of 0 to avoid confusion
of zero'ed memory appearing to have a valid soft-update type.

Also correct some comments.

Reviewed by: kib

6 years agocxgbe(4): Always display an error message if SIOCSIFFLAGS will leave
np [Wed, 4 Apr 2018 22:52:24 +0000 (22:52 +0000)]
cxgbe(4): Always display an error message if SIOCSIFFLAGS will leave
IFF_UP and IFF_DRV_RUNNING out of sync.  ifhwioctl in the kernel pays no
attention to the return code from the driver ioctl during SIOCSIFFLAGS
so these messages are the only indication that the ioctl was called but
failed.

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoAllow -DNO_CLEAN builds over r332048.
brooks [Wed, 4 Apr 2018 22:46:30 +0000 (22:46 +0000)]
Allow -DNO_CLEAN builds over r332048.

6 years agoRemove architecture specific sigreturn.S files.
brooks [Wed, 4 Apr 2018 22:45:08 +0000 (22:45 +0000)]
Remove architecture specific sigreturn.S files.

All of these files are identical (modulo license blocks and VCS IDs) to
the files generated by lib/libc/sys/Makefile.inc and serve no purpose.

Reported by: Ali Mashtizadeh <ali@mashtizadeh.com>
Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14953

6 years agonetmap: align if_ptnet guest driver to the upstream code (commit 0e15788)
vmaffione [Wed, 4 Apr 2018 21:31:12 +0000 (21:31 +0000)]
netmap: align if_ptnet guest driver to the upstream code (commit 0e15788)

The change upgrades the driver to use the split Communication Status
Block (CSB) format. In this way the variables written by the guest
and read by the host are allocated in a different cacheline than
the variables written by the host and read by the guest; this is
needed to avoid cache thrashing.

Approved by: hrs (mentor)

6 years agoAdd a missing MODULE_DEPEND().
ian [Wed, 4 Apr 2018 21:19:33 +0000 (21:19 +0000)]
Add a missing MODULE_DEPEND().

6 years agoFix kernel memory disclosure in tcp_ctloutput
emaste [Wed, 4 Apr 2018 21:12:35 +0000 (21:12 +0000)]
Fix kernel memory disclosure in tcp_ctloutput

strcpy was used to copy a string into a buffer copied to userland, which
left uninitialized data after the terminating 0-byte.  Use the same
approach as in tcp_subr.c: strncpy and explicit '\0'.

admbugs: 765, 822
MFC after: 1 day
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reported by: Vlad Tsyrklevich
Security: Kernel memory disclosure
Sponsored by: The FreeBSD Foundation

6 years agoTypo.
markj [Wed, 4 Apr 2018 20:15:41 +0000 (20:15 +0000)]
Typo.

MFC after: 3 days

6 years agoFix kernel memory disclosure in linux_ioctl_socket
emaste [Wed, 4 Apr 2018 19:58:25 +0000 (19:58 +0000)]
Fix kernel memory disclosure in linux_ioctl_socket

strlcpy is used to copy a string into a buffer to be copied to userland,
previously leaving uninitialized data after the terminating NUL.  Zero
the buffer first to avoid a kernel memory disclosure.

admbugs: 765, 811
MFC after: 1 day
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reported by: Vlad Tsyrklevich
Sponsored by: The FreeBSD Foundation

6 years agopthread.h: minor indentation cleanups.
pfg [Wed, 4 Apr 2018 15:16:04 +0000 (15:16 +0000)]
pthread.h: minor indentation cleanups.

No functional change.

X-MFC with: r331969

6 years agolinux_ioctl_hdio: fix kernel memory disclosure
emaste [Wed, 4 Apr 2018 14:41:48 +0000 (14:41 +0000)]
linux_ioctl_hdio: fix kernel memory disclosure

Stack-allocated struct linux_hd_big_geometry has undeclared padding
copied to userland.

admbugs: 765
Reported by: Vlad Tsyrklevich
MFC after: 1 day
Security: Kernel memory disclosure
Sponsored by: The FreeBSD Foundation

6 years agoAdd new shared library -- libopencsd.
br [Wed, 4 Apr 2018 14:31:56 +0000 (14:31 +0000)]
Add new shared library -- libopencsd.

OpenCSD is an ARM CoreSight(tm) trace packets decoder.

- Connect libopencsd to the arm64 build.
- Install opencsd headers to /usr/include/opencsd/

Sponsored by: DARPA, AFRL

6 years agoRemove fdt_pm_is_enabled as it's Marvell specific. Replace the only call to
andrew [Wed, 4 Apr 2018 13:37:59 +0000 (13:37 +0000)]
Remove fdt_pm_is_enabled as it's Marvell specific. Replace the only call to
it with a call to the helper function fdt_pm_is_enabled would call.

Sponsored by: DARPA, AFRL

6 years agoEnable Marvell gpio driver to work with many controllers
mw [Wed, 4 Apr 2018 13:20:29 +0000 (13:20 +0000)]
Enable Marvell gpio driver to work with many controllers

This patch moves all global data structures into mv_gpio_softc,
and puts device_t parameter to functions calls everywhere where needed.
As a result, we can create multiple driver instances.

Removed names in function declaration to keep style.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14755

6 years agoImprove interrupt and resource allocation in Marvell GPIO driver
mw [Wed, 4 Apr 2018 13:12:49 +0000 (13:12 +0000)]
Improve interrupt and resource allocation in Marvell GPIO driver

This patch adds support for more than one interrupts
in GPIO controller. It reads necessary information (such as cell size)
from FDT, so there are no magic numbers.

Note that interrupts are still not working, but this patch makes
one good step in correct direction

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14754

6 years agoIntroduce port debouncing mechanism in mv_gpio driver
mw [Wed, 4 Apr 2018 13:08:51 +0000 (13:08 +0000)]
Introduce port debouncing mechanism in mv_gpio driver

This patch introduces gpio debouncing mechanism
with fixed memory allocation in critical section.

When you press button, value at gpio pin connected to button
is changing many times which will cause in unexpected behaviour.
Debouncing mechanism will prevent this phenomenon

Submitted by: Patryk Duda <pdk@semihalf.com>
      Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14753

6 years agoMatch Marvell Armada38X PCIE ranges in dts with Linux
mw [Wed, 4 Apr 2018 13:01:14 +0000 (13:01 +0000)]
Match Marvell Armada38X PCIE ranges in dts with Linux

If driver cannot determine ranges based on fdt, it will calculate
them based on number and type of current port.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14752

6 years agoImport OpenCSD -- an ARM CoreSight(tm) Trace Decode Library.
br [Wed, 4 Apr 2018 12:55:31 +0000 (12:55 +0000)]
Import OpenCSD -- an ARM CoreSight(tm) Trace Decode Library.

Sponsored by: DARPA, AFRL

6 years agoChange reg in Marvell Armada38X pcie FDT
mw [Wed, 4 Apr 2018 12:54:18 +0000 (12:54 +0000)]
Change reg in Marvell Armada38X pcie FDT

Ranges in pcie-controller are unused, so could be changed to match Linux
device tree represntation. Same with interrupt-cells and interrupt-parent.
In PCI controller driver ocd_data are used for matching driver and
choose proper resources acquisition function.
fdt_win_process_child have new argument which provide information
about fdt node containing addresses of MMIO registers.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: manu [DT part]
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14751

6 years agoAdd api for creating resource list based on 'assigned-addresses'
mw [Wed, 4 Apr 2018 12:47:41 +0000 (12:47 +0000)]
Add api for creating resource list based on 'assigned-addresses'

According to device tree binding 'assigned-addresses' can refer to PCIE MMIO
register space. New function ofw_bus_assigned_addresses_to_rl is
provided to support it.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14750

6 years agoMatch Marvell Armada38X PCI compatible with Linux
mw [Wed, 4 Apr 2018 12:41:42 +0000 (12:41 +0000)]
Match Marvell Armada38X PCI compatible with Linux

In Linux FDT pcie does not have compatible string.
Configuration of windows in mv_common was based on fdt compatible.
Now pcie windows are configured by their parent: pcie_controller.
Processing is moved to fdt_win_process_child. fdt_win_process now
only walk through the tree. SOC_NODE_PCI is position of pcie function in
soc_node_spec array.

PCIe probe cannot use ofw_bus_search_compatible, because it needs to
check also device type and parents compatible.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: manu [DT part]
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14749

6 years agoAdd support of PCI_RES_BUS to Marvell PCI driver
mw [Wed, 4 Apr 2018 12:36:55 +0000 (12:36 +0000)]
Add support of PCI_RES_BUS to Marvell PCI driver

GENERIC ARM config use NEW_PCIB driver (https://wiki.freebsd.org/NEW_PCIB).
To satisfy it, allocation and deallocation of PCI_RES_BUS is necessary.
Conditional compilation is added for backward compatibility with ARMv5
configs.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: jhb
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14748

6 years agoImport OpenCSD -- an ARM CoreSight Trace Decode library.
br [Wed, 4 Apr 2018 12:33:46 +0000 (12:33 +0000)]
Import OpenCSD -- an ARM CoreSight Trace Decode library.

Git ID 900407e9d6400f6541138d6c2e483a9fc2d699a4

Sponsored by: DARPA, AFRL

6 years agoMake Marvell armv7 timer and wdt registers definitions common
mw [Wed, 4 Apr 2018 12:30:52 +0000 (12:30 +0000)]
Make Marvell armv7 timer and wdt registers definitions common

Define timers registers for both SoCs and choose proper one during runtime
based on information from FDT.
In WDT driver there are different function for ArmadaXP and other ARMv5 SoCs.
In timer driver registers definitions are stored in resource_spec structure
and chosen during runtime.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14746

6 years agoBump driver version number in mlx5en(4).
hselasky [Wed, 4 Apr 2018 10:45:06 +0000 (10:45 +0000)]
Bump driver version number in mlx5en(4).

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoMake Marvell Armada reset registers usage generic
mw [Wed, 4 Apr 2018 10:14:43 +0000 (10:14 +0000)]
Make Marvell Armada reset registers usage generic

Define reset registers for both Armada38X and ArmadaXP and
choose proper one during runtime based on information from FDT.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14745

6 years agoUse PLATFORM for initializing Marvell ArmadaXP and Armada38X
mw [Wed, 4 Apr 2018 08:40:49 +0000 (08:40 +0000)]
Use PLATFORM for initializing Marvell ArmadaXP and Armada38X

Spliting armv5 and armv7 machdep is necessary for adding Armada38X and
ArmadaXP to GENERIC config.
PLATFORM framework checks SOC type in FDT and will select proper
initialization function implementation during runtime.
Pointers to SoC specific implementation are stored in array of
platform_method_t and provided to framework by FDT_PLATFORM_DEF macro.
PLATFORM framework supports also reset function. To simplify implementation
cpu_reset is moved from mv_common to armv5 and armv7 machdep.

Armada38X and ArmadaXP share now common list of files, so resolve all
dependencies as well.

Submitted by: Rafal Kozik <rk@semihalf.com>
      Marcin Wojtas <mw@semihalf.com>
Reviewed by: mw
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14744

6 years agoregulator: Disable unused regulator
manu [Wed, 4 Apr 2018 06:44:24 +0000 (06:44 +0000)]
regulator: Disable unused regulator

bootloaders such as u-boot might enable regulators, or simply regulators could
be enabled by default by the PMIC, even if we don't have a driver for
the device or subsystem.
Disable unused regulators just before going to userland.
A tunable hw.regulator.disable_unused is added to not disable them in case
this causes problems on some board but the default behavior is to disable
everything unused.
I prefer to break thinks now and fix them rather than never switch to the
case were we disable regulators.

Tested on : Pine64-LTS (an idle board goes from ~0.33A to ~0.27A)
Tested on : BananaPi M2
Differential Revision: https://reviews.freebsd.org/D14781

6 years agoLimit glyph count in vtfont_load to avoid integer overflow.
gordon [Wed, 4 Apr 2018 05:21:46 +0000 (05:21 +0000)]
Limit glyph count in vtfont_load to avoid integer overflow.

Invalid font data passed to PIO_VFONT can result in an integer overflow
in glyphsize.  Characters may then be drawn on the console using glyph
map entries that point beyond the end of allocated glyph memory,
resulting in a kernel memory disclosure.

Submitted by: emaste
Reported by: Dr. Silvio Cesare of InfoSect
Security: CVE-2018-6917
Security: FreeBSD-SA-18:04.vt
Sponsored by: The FreeBSD Foundation

6 years agoAdd nvme_da back.
imp [Wed, 4 Apr 2018 02:37:05 +0000 (02:37 +0000)]
Add nvme_da back.

Now that it can co-exist in the kernel with nvd, add it back to the
cam module.

Sponsored by: Netflix

6 years agoFix minor whitespace nits
imp [Wed, 4 Apr 2018 02:35:48 +0000 (02:35 +0000)]
Fix minor whitespace nits

6 years agoCorrect the ilog2() for calculating memory sizes.
jhibbits [Wed, 4 Apr 2018 02:13:27 +0000 (02:13 +0000)]
Correct the ilog2() for calculating memory sizes.

TLB1 can handle ranges up to 4GB (through e5500, larger in e6500), but
ilog2() took a unsigned int, which maxes out at 4GB-1, but truncates
silently.  Increase the input range to the largest supported, at least for
64-bit targets.  This lets the DMAP be completely mapped, instead of only
1GB blocks with it assuming being fully mapped.

6 years agopthread.h: drop nullability attributes.
pfg [Wed, 4 Apr 2018 02:00:10 +0000 (02:00 +0000)]
pthread.h: drop nullability attributes.

These have been found to be practically useless. We were actually
following the Android bionic library and had some interest in replicating
the same warnings and behaviour but Android has since removed them.

We are still keeping some uses of nullability attributes in other headers,
somewhat in line with Apple's libc.

MFC after: 1 week
Hinted by: bionic (git 3f66e74b903905e763e104396aff52a81718cfde)

6 years agoFix arm64 buildkernel target with "nooptions KDB"
gonzo [Wed, 4 Apr 2018 01:13:28 +0000 (01:13 +0000)]
Fix arm64 buildkernel target with "nooptions KDB"

Make kdb_trap in breakpoint exception handler conditional. If "options KDB"
is not present just panic with message that debugger is not enabled.

PR: 224653

6 years agoFix kernel modules names for Marvell armv7
mw [Tue, 3 Apr 2018 23:49:35 +0000 (23:49 +0000)]
Fix kernel modules names for Marvell armv7

Two modules with the same name cannot be loaded, so Marvell specific drivers
cannot have the same name as the generic drivers.
Files with the same name, even in different folders overlaps their .o files,
so in order to prepare for supporting Marvell platforms in GENERIC armv7
config, modify conflicting names.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14743

6 years agoSplit out delay code in Marvell timer driver for PLATFORM
mw [Tue, 3 Apr 2018 23:29:34 +0000 (23:29 +0000)]
Split out delay code in Marvell timer driver for PLATFORM

The PLATFORM code will perform the software loop in the early boot,
so extract the actual delay code to handle situation, when
the timers are already initialized.

Obtained from: Semihalf
Sponsored by: Stormshield

6 years agoAdd missing flag check in Marvell PCIE driver
mw [Tue, 3 Apr 2018 23:27:07 +0000 (23:27 +0000)]
Add missing flag check in Marvell PCIE driver

Flag was introduced in r331953, but eventually not used.

Obtained from: Semihalf
Sponsored by: Stormshield

6 years agoCatch up with Clang 6.0.
jkim [Tue, 3 Apr 2018 23:11:08 +0000 (23:11 +0000)]
Catch up with Clang 6.0.

MFC after: 3 days

6 years agoMake Marvell AmadaXP timer driver more generic
mw [Tue, 3 Apr 2018 22:21:12 +0000 (22:21 +0000)]
Make Marvell AmadaXP timer driver more generic

Store pointers to SoC specific functions in mv_timer_config structure
and determine proper config in runtime based on compatible string from FDT.
Compatible string for ArmadaXP timers is changed to match Linux FDT.
Armada 38x uses generic Cortex-A9 timer and separate watchdog drivers, so
it does not need to be supported by timer driver.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14741

6 years agoMake Marvell Armada watchdog driver more generic
mw [Tue, 3 Apr 2018 22:15:53 +0000 (22:15 +0000)]
Make Marvell Armada watchdog driver more generic

Store platform dependent functions and constants in mv_wdt_config
structure and select proper configuration on runtime based on
compatible string provided in FDT.
Marvell Armada38X and ArmadaXP non-repetitive registers are moved to
generic part of code.
To support armv5 as well, use proper compatible string:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/watchdog/orion_wdt.c?h=v4.13-rc3#n456

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14740

6 years agocryptosoft: Remove a dead store
cem [Tue, 3 Apr 2018 22:11:39 +0000 (22:11 +0000)]
cryptosoft: Remove a dead store

Introduced in r331639 by removing an instance of undefined behavior.

While we're here, the variable scope can be entirely moved inside the loop.

Reported by: Coverity
CID: 1387985
Sponsored by: Dell EMC Isilon

6 years agoMake get_tclk and get_cpu_freq generic for Marvell armv7 SoCs
mw [Tue, 3 Apr 2018 22:10:50 +0000 (22:10 +0000)]
Make get_tclk and get_cpu_freq generic for Marvell armv7 SoCs

In GENERIC kernel choosing proper get_tclk and get_cpu_freq implementation must
be done in runtime. Kernel for both SoC need to have implementation of each
other functions, so common file list mv/files.arm7 is added.
Marvell armv5 SoC have their own non-generic implementation of those function.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14739

6 years agoMake mv_common.c generic for Marvell Armada38X and ArmadaXP
mw [Tue, 3 Apr 2018 21:54:36 +0000 (21:54 +0000)]
Make mv_common.c generic for Marvell Armada38X and ArmadaXP

Preparation for adding Armada38X and ArmadaXP SoC to GENERIC config.
Supported platform are listed in soc_family enum.
struct decode_win_spec contains platform specific functions and constants.
Function mv_check_soc_family checks SoC type and chooses proper structure
in runtime, as well as platform-dependent functions.
Unnecessary dummy functions are removed.
Because of changing registers name to more generic new definition of
FDT_DEVMAP_MAX in mv_machdep is added.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14738

6 years agoMake validation in Marvell mv_common.c generic
mw [Tue, 3 Apr 2018 21:46:28 +0000 (21:46 +0000)]
Make validation in Marvell mv_common.c generic

Validate only drivers used by given platform.
Pointers to validation function
are added to soc_node_spec structure.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14737

6 years agorc.subr.8: Improve documentation of ${name}_limits and ${name}_login_class
jilles [Tue, 3 Apr 2018 21:44:43 +0000 (21:44 +0000)]
rc.subr.8: Improve documentation of ${name}_limits and ${name}_login_class

Submitted by: 0mp
Differential Revision: https://reviews.freebsd.org/D14928

6 years agoSplit get_sar_value function for Marvell ArmadaXP and Armada38X
mw [Tue, 3 Apr 2018 21:38:11 +0000 (21:38 +0000)]
Split get_sar_value function for Marvell ArmadaXP and Armada38X

get_sar_value is implemented only for ArmadaXP and Armada38X. Splitting it for
two different functions and change registers names result in more generic code.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14736

6 years agoMake Marvell mv_pci.c driver generic
mw [Tue, 3 Apr 2018 21:25:15 +0000 (21:25 +0000)]
Make Marvell mv_pci.c driver generic

PCI ports differ between Marvell SoCs, but have the same compatible in FDT.
Identification is made based on parent compatible during attach.
For ArmadaXP skipping enable procedure is necessary. To achieve it
sc_skip_enable_procedure flag is used.
For Armada38x find root procedure is necessary. For other SoCs root link is
always at slot 0. sc_enable_find_root_slot flag is used to select proper
behaviour.
Marvell armv5 platforms does not support msi.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14735

6 years agoEnable ArmadaXP using INTRNG interrupt controller
mw [Tue, 3 Apr 2018 21:17:19 +0000 (21:17 +0000)]
Enable ArmadaXP using INTRNG interrupt controller

Defining INTRNG remove some necessary registers and declarations of
pic_init_secondary, pic_ipi_send, pic_ipi_read and pic_ipi_clear.
Because Marvell ArmadaXP and Armada38X always use INTRNG, include all
INTRNG code and remove code that does not use it.
Separate pic registers declarations for Armada38X are unnecessary, it
works properly with ArmadaXP config.

Submitted by: Rafal Kozik <rk@semihalf.com>
Reviewed by: andrew
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14734

6 years ago9434 Speculative prefetch is blocked by device removal code.
mav [Tue, 3 Apr 2018 21:16:41 +0000 (21:16 +0000)]
9434 Speculative prefetch is blocked by device removal code.

Device removal code does not set spa_indirect_vdevs_loaded for pools
that never experienced device removal.  At least one visual consequence
of it is completely blocked speculative prefetcher.  This patch sets
the variable in such situations.