]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoRemove everything related to channels from the pwmc public interface, now
ian [Tue, 18 Jun 2019 00:11:00 +0000 (00:11 +0000)]
Remove everything related to channels from the pwmc public interface, now
that there is a pwmc(4) instance per channel and the channel number is
maintained as a driver ivar rather than being passed in from userland.

4 years agoAdd ACPI support for USB driver.
takawata [Mon, 17 Jun 2019 23:03:30 +0000 (23:03 +0000)]
Add ACPI support for USB driver.
This adds ACPI device path on devinfo(8) output and
show  value of _UPC(usb port capabilities), _PLD (physical location of device)
when hw.usb.debug >= 1 .

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D20630

4 years agoFix passing ${CONF_FILES} (which contains MAKE_CONF and
gjb [Mon, 17 Jun 2019 22:53:39 +0000 (22:53 +0000)]
Fix passing ${CONF_FILES} (which contains MAKE_CONF and
SRC_CONF, __MAKE_CONF and SRCCONF, respectively) through
to arm_install_base() and chroot_arm_build_release().
This prevents failures when the target image is intended
to be build with make.conf(5) and src.conf(5) overrides,
which are correctly handled for non-embedded image builds.

Reported and tested by: Daniel Engberg
PR: 238615
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoAdd NetBSD 8.1 & DragonFly BSD 5.6
sevan [Mon, 17 Jun 2019 21:46:13 +0000 (21:46 +0000)]
Add NetBSD 8.1 & DragonFly BSD 5.6

4 years agoFix tab
sevan [Mon, 17 Jun 2019 21:38:33 +0000 (21:38 +0000)]
Fix tab

4 years agorandom(4): Fortuna: allow increased concurrency
cem [Mon, 17 Jun 2019 20:29:13 +0000 (20:29 +0000)]
random(4): Fortuna: allow increased concurrency

Add experimental feature to increase concurrency in Fortuna.  As this
diverges slightly from canonical Fortuna, and due to the security
sensitivity of random(4), it is off by default.  To enable it, set the
tunable kern.random.fortuna.concurrent_read="1".  The rest of this commit
message describes the behavior when enabled.

Readers continue to update shared Fortuna state under global mutex, as they
do in the status quo implementation of the algorithm, but shift the actual
PRF generation out from under the global lock.  This massively reduces the
CPU time readers spend holding the global lock, allowing for increased
concurrency on SMP systems and less bullying of the harvestq kthread.

It is somewhat of a deviation from FS&K.  I think the primary difference is
that the specific sequence of AES keys will differ if READ_RANDOM_UIO is
accessed concurrently (as the 2nd thread to take the mutex will no longer
receive a key derived from rekeying the first thread).  However, I believe
the goals of rekeying AES are maintained: trivially, we continue to rekey
every 1MB for the statistical property; and each consumer gets a
forward-secret, independent AES key for their PRF.

Since Chacha doesn't need to rekey for sequences of any length, this change
makes no difference to the sequence of Chacha keys and PRF generated when
Chacha is used in place of AES.

On a GENERIC 4-thread VM (so, INVARIANTS/WITNESS, numbers not necessarily
representative), 3x concurrent AES performance jumped from ~55 MiB/s per
thread to ~197 MB/s per thread.  Concurrent Chacha20 at 3 threads went from
roughly ~113 MB/s per thread to ~430 MB/s per thread.

Prior to this change, the system was extremely unresponsive with 3-4
concurrent random readers; each thread had high variance in latency and
throughput, depending on who got lucky and won the lock.  "rand_harvestq"
thread CPU use was high (double digits), seemingly due to spinning on the
global lock.

After the change, concurrent random readers and the system in general are
much more responsive, and rand_harvestq CPU use dropped to basically zero.

Tests are added to the devrandom suite to ensure the uint128_add64 primitive
utilized by unlocked read functions to specification.

Reviewed by: markm
Approved by: secteam(delphij)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D20313

4 years agoAllow the hostapd program to be specified. This allows users to use
cy [Mon, 17 Jun 2019 20:11:02 +0000 (20:11 +0000)]
Allow the hostapd program to be specified. This allows users to use
hostapd from ports instead of the one in base. The default is the hostapd
in base.

PR: 238571
MFC after: 1 week

4 years agoMake ipf_objbytes a constant. ipf_objbytes is a table of internal data
cy [Mon, 17 Jun 2019 20:10:55 +0000 (20:10 +0000)]
Make ipf_objbytes a constant. ipf_objbytes is a table of internal data
structures that are saved across reboots by ipfs(8). The table is not
changed at runtime.

MFC after: 3 days

4 years agoSeparate kernel crc32() implementation to its own header (gsb_crc32.h) and
delphij [Mon, 17 Jun 2019 19:49:08 +0000 (19:49 +0000)]
Separate kernel crc32() implementation to its own header (gsb_crc32.h) and
rename the source to gsb_crc32.c.

This is a prerequisite of unifying kernel zlib instances.

PR: 229763
Submitted by: Yoshihiro Ota <ota at j.email.ne.jp>
Differential Revision: https://reviews.freebsd.org/D20193

4 years agopci.4: Use plural configuration registers
zeising [Mon, 17 Jun 2019 17:35:55 +0000 (17:35 +0000)]
pci.4: Use plural configuration registers

It is customary to use plural when talking about PCI configure registers.

Reported by: scottl
MFC after: 2 weeks
X-MFC-with: r349133

4 years agoAdd some missing MLINKs for tree(3).
markj [Mon, 17 Jun 2019 16:57:44 +0000 (16:57 +0000)]
Add some missing MLINKs for tree(3).

MFC after: 3 days

4 years agopci.4: wordsmith and add missing words
zeising [Mon, 17 Jun 2019 16:54:51 +0000 (16:54 +0000)]
pci.4: wordsmith and add missing words

Add missing words after PCI in the description of the PCIOCWRITE and
PCIOCATTACHED ioctls.
Use singular in PCIOCREAD, we only read one register at the time.

Reviewed by: bcr, bjk, rgrimes, cem
MFC after: 2 weeks
X-MFC-with: r349133
Differential Revision: https://reviews.freebsd.org/D20671

4 years agoPut periods at the ends of argument descriptions. Explain the relationship
ian [Mon, 17 Jun 2019 16:50:58 +0000 (16:50 +0000)]
Put periods at the ends of argument descriptions.  Explain the relationship
between the period and duty arguments.

4 years agoFollow changes in the pwmc(4) driver in relation to device filenames.
ian [Mon, 17 Jun 2019 16:43:33 +0000 (16:43 +0000)]
Follow changes in the pwmc(4) driver in relation to device filenames.

The driver now names its cdev nodes pwmcX.Y where X is unit number and
Y is the channel within that unit.  Change the default device name from
pwmc0 to pwmc0.0.  The driver now puts cdev files and label aliases in
the /dev/pwm directory, so allow the user to provide unqualified names
with -f and automatically prepend the /dev/pwm part for them.

Update the examples in the manpage to show the new device name format
and location within /dev/pwm.

4 years agoPut the pwmc cdev filenames under the pwm directory along with any label
ian [Mon, 17 Jun 2019 16:26:43 +0000 (16:26 +0000)]
Put the pwmc cdev filenames under the pwm directory along with any label
names.  I.e., everything related to pwm now goes in /dev/pwm.  This will
make it easier for userland tools to turn an unqualified name into a fully
qualified pathname, whether it's the base pwmcX.Y name or a label name.

4 years agorandom(4): Generalize algorithm-independent APIs
cem [Mon, 17 Jun 2019 15:09:12 +0000 (15:09 +0000)]
random(4): Generalize algorithm-independent APIs

At a basic level, remove assumptions about the underlying algorithm (such as
output block size and reseeding requirements) from the algorithm-independent
logic in randomdev.c.  Chacha20 does not have many of the restrictions that
AES-ICM does as a PRF (Pseudo-Random Function), because it has a cipher
block size of 512 bits.  The motivation is that by generalizing the API,
Chacha is not penalized by the limitations of AES.

In READ_RANDOM_UIO, first attempt to NOWAIT allocate a large enough buffer
for the entire user request, or the maximal input we'll accept between
signal checking, whichever is smaller.  The idea is that the implementation
of any randomdev algorithm is then free to divide up large requests in
whatever fashion it sees fit.

As part of this, two responsibilities from the "algorithm-generic" randomdev
code are pushed down into the Fortuna ra_read implementation (and any other
future or out-of-tree ra_read implementations):

  1. If an algorithm needs to rekey every N bytes, it is responsible for
  handling that in ra_read(). (I.e., Fortuna's 1MB rekey interval for AES
  block generation.)

  2. If an algorithm uses a block cipher that doesn't tolerate partial-block
  requests (again, e.g., AES), it is also responsible for handling that in
  ra_read().

Several APIs are changed from u_int buffer length to the more canonical
size_t.  Several APIs are changed from taking a blockcount to a bytecount,
to permit PRFs like Chacha20 to directly generate quantities of output that
are not multiples of RANDOM_BLOCKSIZE (AES block size).

The Fortuna algorithm is changed to NOT rekey every 1MiB when in Chacha20
mode (kern.random.use_chacha20_cipher="1").  This is explicitly supported by
the math in FS&K ยง9.4 (Ferguson, Schneier, and Kohno; "Cryptography
Engineering"), as well as by their conclusion: "If we had a block cipher
with a 256-bit [or greater] block size, then the collisions would not
have been an issue at all."

For now, continue to break up reads into PAGE_SIZE chunks, as they were
before.  So, no functional change, mostly.

Reviewed by: markm
Approved by: secteam(delphij)
Differential Revision: https://reviews.freebsd.org/D20312

4 years agorandom(4): Add regression tests for uint128 implementation, Chacha CTR
cem [Mon, 17 Jun 2019 14:59:45 +0000 (14:59 +0000)]
random(4): Add regression tests for uint128 implementation, Chacha CTR

Add some basic regression tests to verify behavior of both uint128
implementations at typical boundary conditions, to run on all architectures.

Test uint128 increment behavior of Chacha in keystream mode, as used by
'kern.random.use_chacha20_cipher=1' (r344913) to verify assumptions at edge
cases.  These assumptions are critical to the safety of using Chacha as a
PRF in Fortuna (as implemented).

(Chacha's use in arc4random is safe regardless of these tests, as it is
limited to far less than 4 billion blocks of output in that API.)

Reviewed by: markm
Approved by: secteam(gordon)
Differential Revision: https://reviews.freebsd.org/D20392

4 years agoMFV r349134:
mm [Mon, 17 Jun 2019 11:46:37 +0000 (11:46 +0000)]
MFV r349134:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1212: RAR5 reader - window_mask was not updated correctly
            (OSS-Fuzz 15278)
  OSS-Fuzz 15120: RAR reader - extend use after free bugfix

MFC after: 1 week (together with r348993)

4 years agoUpdate vendor/libarchive/dist to git 809f0dc32fff7434aef45a7c688fa285c7208af7
mm [Mon, 17 Jun 2019 11:29:32 +0000 (11:29 +0000)]
Update vendor/libarchive/dist to git 809f0dc32fff7434aef45a7c688fa285c7208af7

Relevant vendor changes:
  PR #1212: RAR5 reader - window_mask was not updated correctly
            (OSS-Fuzz 15278)
  OSS-Fuzz 15120: RAR reader - extend use after free bugfix
  Add HAVE_UNLINKAT to config_freebsd.h

4 years agopci(4): Document PCIOCATTACHED
zeising [Mon, 17 Jun 2019 05:41:47 +0000 (05:41 +0000)]
pci(4): Document PCIOCATTACHED

Document the PCIOCATTACHED ioctl(2) in the pci(4) manual.
PCIOCATTACHED is used to query if a driver has attached to a PCI.

Reviewed by: bcr, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20652

4 years agoAdd back a const qualifier I somehow fumbled away between test-building
ian [Mon, 17 Jun 2019 03:48:44 +0000 (03:48 +0000)]
Add back a const qualifier I somehow fumbled away between test-building
and committing recent changes.

4 years agoImplement the ofw_bus_get_node method in aw_pwm(4) so that ofw_pwmbus can
ian [Mon, 17 Jun 2019 03:40:00 +0000 (03:40 +0000)]
Implement the ofw_bus_get_node method in aw_pwm(4) so that ofw_pwmbus can
find its metadata for instantiating children.

4 years agoAdd ofw_pwmbus to enumerate pwmbus devices on systems configured with fdt
ian [Mon, 17 Jun 2019 03:32:05 +0000 (03:32 +0000)]
Add ofw_pwmbus to enumerate pwmbus devices on systems configured with fdt
data.  Also, add fdt support to pwmc.

4 years agoEliminate a redundant call to pmap_invalidate_page() from
alc [Mon, 17 Jun 2019 01:58:25 +0000 (01:58 +0000)]
Eliminate a redundant call to pmap_invalidate_page() from
pmap_ts_referenced().

MFC after: 14 days
Differential Revision: https://reviews.freebsd.org/D12725

4 years agoThree changes to arm64's pmap_unwire():
alc [Sun, 16 Jun 2019 22:13:27 +0000 (22:13 +0000)]
Three changes to arm64's pmap_unwire():

Implement wiring changes on superpage mappings.  Previously, a superpage
mapping was unconditionally demoted by pmap_unwire(), even if the wiring
change applied to the entire superpage mapping.

Rewrite a comment to use the arm64 names for bits in a page table entry.
Previously, the bits were referred to by their x86 names.

Use atomic_"op"_64() instead of atomic_"op"_long() to update a page table
entry in order to match the prevailing style in this file.

MFC after: 10 days

4 years agoFix bug on newbus device deletion: we should delete the child's devinfo
nwhitehorn [Sun, 16 Jun 2019 21:56:45 +0000 (21:56 +0000)]
Fix bug on newbus device deletion: we should delete the child's devinfo
on deletion, not the parent's.

MFC after: 3 weeks

4 years agoRemove tabs from BSD.var.dist
antoine [Sun, 16 Jun 2019 20:01:45 +0000 (20:01 +0000)]
Remove tabs from BSD.var.dist

Reported by: zeising

4 years agoRework pwmbus and pwmc so that each child will handle a single PWM channel.
ian [Sun, 16 Jun 2019 19:44:42 +0000 (19:44 +0000)]
Rework pwmbus and pwmc so that each child will handle a single PWM channel.

Previously, there was a pwmc instance for each instance of pwm hardware
regardless of how many pwm channels that hardware supported.  Now there
will be a pwmc instance for each channel when the hardware supports
multiple channels.  With a separate instance for each channel, we can have
"named channels" in userland by making devfs alias entries in /dev/pwm.

These changes add support for ivars to pwmbus, and use an ivar to track the
channel number for each child.  It also adds support for hinted children.

In pwmc, the driver checks for a label hint, and if present, it's used to
create an alias for the cdev in /dev/pwm.  It's not anticipated that hints
will be heavily used, but it's easy to do and allows quick ad-hoc creation
of named channels from userland by using kenv to create hint.pwmc.N.label=
hints.  Upcoming changes will add FDT support, and most labels will
probably be specified that way.

4 years agoIn iostat(8) output, skip the decimal point and the fractional part
trasz [Sun, 16 Jun 2019 17:32:05 +0000 (17:32 +0000)]
In iostat(8) output, skip the decimal point and the fractional part
for tps >= 100 and MB/s >= 1000, to prevent them for widening too much.

MFC after: 2 weeks

4 years agoThree enhancements to arm64's pmap_protect():
alc [Sun, 16 Jun 2019 16:45:01 +0000 (16:45 +0000)]
Three enhancements to arm64's pmap_protect():

Implement protection changes on superpage mappings.  Previously, a superpage
mapping was unconditionally demoted by pmap_protect(), even if the
protection change applied to the entire superpage mapping.

Precompute the bit mask describing the protection changes rather than
recomputing it for every page table entry that is changed.

Skip page table entries that already have the requested protection changes
in place.

Reviewed by: andrew, kib
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D20657

4 years agoIn detach(), call bus_generic_detach() before deleting the iicbus child.
ian [Sun, 16 Jun 2019 16:02:50 +0000 (16:02 +0000)]
In detach(), call bus_generic_detach() before deleting the iicbus child.
This gives the bus and its children the chance to return EBUSY to abort
the detach if they're in the middle of doing some IO.

4 years agoRename pwmbus.h to ofw_pwm.h, because after all the recent changes, there
ian [Sun, 16 Jun 2019 15:56:59 +0000 (15:56 +0000)]
Rename pwmbus.h to ofw_pwm.h, because after all the recent changes, there
is nothing left in the file that related to pwmbus at all.  It just contains
prototypes for the functions implemented in dev/pwm.ofw_pwm.c, so name it
accordingly and fix the include protect wrappers to match.

A new pwmbus.h will be coming along in a future commit.

4 years agovtfontcvt: correct typo in hex parsing update
emaste [Sun, 16 Jun 2019 15:14:49 +0000 (15:14 +0000)]
vtfontcvt: correct typo in hex parsing update

PR: 205707
Submitted by: Dmitry Wagin
MFC with: 349100
Event: Berlin Devsummit 2019

4 years agovtfontcvt: improve .bdf validation
emaste [Sun, 16 Jun 2019 13:51:45 +0000 (13:51 +0000)]
vtfontcvt: improve .bdf validation

Previously if we had a BBX entry that had invalid values (e.g. bounding
box outside of font bounding box) and failed sscanf (e.g., because it
had fewer than four values) we skipped the BBX value validation and then
triggered an assertion failure.

Reported by: afl
MFC with: r349100
Event: Berlin Devsummit 2019
Sponsored by: The FreeBSD Foundation

4 years agovtfontcvt: improve .bdf verification
emaste [Sun, 16 Jun 2019 13:35:53 +0000 (13:35 +0000)]
vtfontcvt: improve .bdf verification

Previously we would crash if the BBX y-offset was outside of the font
bounding box.

Reported by: afl
MFC with: r349100
Event: Berlin Devsummit 2019
Sponsored by: The FreeBSD Foundation

4 years agoallow vt(4) fonts to be built from .bdf files
emaste [Sun, 16 Jun 2019 12:44:49 +0000 (12:44 +0000)]
allow vt(4) fonts to be built from .bdf files

vtfontcvt(8) can convert both .bdf and .hex inputs to binary vt(4) .fnt
files.

Event: Berlin Devsummit 2019
Sponsored by: The FreeBSD Foundation

4 years agovtfontcvt: initialize another variable to quiet GCC warning
emaste [Sun, 16 Jun 2019 12:26:46 +0000 (12:26 +0000)]
vtfontcvt: initialize another variable to quiet GCC warning

I believe this case could be triggered by a broken .bdf font.

PR: 205707
Reported by: ci.freebsd.org
MFC with: 349100
Event: Berlin Devsummit 2019
Sponsored by: The FreeBSD Foundation

4 years agoDifferentiate package versions for ALPHA/BETA/PRERELEASE/RC phases.
rene [Sun, 16 Jun 2019 11:53:22 +0000 (11:53 +0000)]
Differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases.

Currently APLHA packages are treated as CURRENT or STABLE versions,
resulting in e.g. 13.0.s20190615125609. This version number is indeed
different from the next version number but ALPHA2 would be nicer IMO.

For the BETA, PRERELEASE and RC phases the packages are versioned the
same as for releases, so 11.3-BETA1 is 11.3 and so is 11.3-RC1, meaning
that pkg cannot easiliy upgrade from the former the next. This happened
on my Raspberry Pi which runs pkgbase.

Submitted by: rene
Approved by: manu
Event: Berlin hackathon 2019
Differential Revision: https://reviews.freebsd.org/D20651

4 years agovtfontcvt: initialize bbwbytes to avoid GCC 4.2.1 uninitialized warning
emaste [Sun, 16 Jun 2019 10:43:18 +0000 (10:43 +0000)]
vtfontcvt: initialize bbwbytes to avoid GCC 4.2.1 uninitialized warning

PR: 205707
MFC with: 349100
Event: Berlin Devsummit 2019
Sponsored by: The FreeBSD Foundation

4 years agovtfontcvt: improve BDF and hex font parsing
emaste [Sun, 16 Jun 2019 09:17:26 +0000 (09:17 +0000)]
vtfontcvt: improve BDF and hex font parsing

Support larger font sizes.

PR: 205707
Submitted by: Dmitry Wagin (original version)
MFC after: 2 weeks
Event: Berlin Devsummit 2019
Differential Revision: https://reviews.freebsd.org/D20650

4 years agosymlinkat(2) is not covered.
bdrewery [Sun, 16 Jun 2019 05:12:17 +0000 (05:12 +0000)]
symlinkat(2) is not covered.

4 years agoAdd macOS-like three finger drag trackpad gesture to psm(4)
philip [Sun, 16 Jun 2019 03:06:05 +0000 (03:06 +0000)]
Add macOS-like three finger drag trackpad gesture to psm(4)

Submitted by: Yan Ka Chiu <nyan@myuji.xyz>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20648

4 years agoBuild SoC-specific modules with GENERIC for the SoCs that have them.
ian [Sun, 16 Jun 2019 01:23:45 +0000 (01:23 +0000)]
Build SoC-specific modules with GENERIC for the SoCs that have them.

4 years agoAdd module makefiles for Texas Instruments ARM SoCs.
ian [Sun, 16 Jun 2019 01:22:44 +0000 (01:22 +0000)]
Add module makefiles for Texas Instruments ARM SoCs.

The natural place to look for them based on how other SoCs are organized
would be sys/modules/ti, but that's already taken.  Drop a clue into
modules/ti/Makefile directing people to modules/arm_ti if they're looking
for ARM modules.

4 years agoSplit the dtb MODULES_EXTRA line to a series of += lines, making it easier
ian [Sun, 16 Jun 2019 01:05:53 +0000 (01:05 +0000)]
Split the dtb MODULES_EXTRA line to a series of += lines, making it easier
to maintain and keep in alphabetical order, and paving the way for adding
some other modules that aren't dtb-related.

4 years agoAdd module makefiles for pwm.
ian [Sun, 16 Jun 2019 00:53:09 +0000 (00:53 +0000)]
Add module makefiles for pwm.

4 years agoThis code no longer uses fdt/ofw stuff, no need to include ofw headers.
ian [Sun, 16 Jun 2019 00:43:05 +0000 (00:43 +0000)]
This code no longer uses fdt/ofw stuff, no need to include ofw headers.

4 years agoMake channel number unsigned, and spell unsigned int u_int. This should
ian [Sun, 16 Jun 2019 00:32:19 +0000 (00:32 +0000)]
Make channel number unsigned, and spell unsigned int u_int.  This should
have been part of r349088.

4 years agoThe pwm interface was replaced with pwmbus, include the right header file.
ian [Sun, 16 Jun 2019 00:27:11 +0000 (00:27 +0000)]
The pwm interface was replaced with pwmbus, include the right header file.

4 years agoMake pwm channel numbers unsigned.
ian [Sat, 15 Jun 2019 23:02:09 +0000 (23:02 +0000)]
Make pwm channel numbers unsigned.

4 years agoRestructure the pwm device hirearchy and interfaces.
ian [Sat, 15 Jun 2019 22:25:39 +0000 (22:25 +0000)]
Restructure the pwm device hirearchy and interfaces.

The pwm and pwmbus interfaces were nearly identical, this merges them into a
single pwmbus interface.  The pwmbus driver now implements the pwmbus
interface by simply passing all calls through to its parent (the hardware
driver).  The channel_count method moves from pwm to pwmbus, and the
get_bus method is deleted (just no longer needed).

The net effect is that the interface for doing pwm stuff is now the same
regardless of whether you're a child of pwmbus, or some random driver
elsewhere in the hierarchy that is bypassing the pwmbus layer and is talking
directly to the hardware driver via cross-hierarchy connections established
using fdt data.

The pwmc driver is now a child of pwmbus, instead of being its sibling
(that's why the get_bus method is no longer needed; pwmc now gets the
device_t of the bus using device_get_parent()).

4 years agoDestroy the cdev on device detach. Also, make the driver and devclass
ian [Sat, 15 Jun 2019 21:51:55 +0000 (21:51 +0000)]
Destroy the cdev on device detach.  Also, make the driver and devclass
static, because nothing outside this file needs them.

4 years agoRename the channel_max method to channel_count, because that's what it's
ian [Sat, 15 Jun 2019 21:36:14 +0000 (21:36 +0000)]
Rename the channel_max method to channel_count, because that's what it's
returning.  (If the channel count is 2, then the max channel number is 1.)

4 years agoGive the aw_pwm driver a module version.
ian [Sat, 15 Jun 2019 21:31:04 +0000 (21:31 +0000)]
Give the aw_pwm driver a module version.

4 years agoSpell unsigned int as u_int and channel as chan; eliminates the need to wrap
ian [Sat, 15 Jun 2019 21:19:23 +0000 (21:19 +0000)]
Spell unsigned int as u_int and channel as chan; eliminates the need to wrap
some long lines.

4 years agoUnwrap prototype lines so that return type and function name are on the
ian [Sat, 15 Jun 2019 20:54:33 +0000 (20:54 +0000)]
Unwrap prototype lines so that return type and function name are on the
same line.  No functional changes.

4 years agoMake pwmbus driver and devclass vars static; they're not mentioned in any
ian [Sat, 15 Jun 2019 20:53:26 +0000 (20:53 +0000)]
Make pwmbus driver and devclass vars static; they're not mentioned in any
header file, so they can't be used outside this file anyway.

4 years agoAdd a missing #include. I suspect this used to get included via some header
ian [Sat, 15 Jun 2019 20:20:36 +0000 (20:20 +0000)]
Add a missing #include.  I suspect this used to get included via some header
pollution that was cleaned up recently, and this file got missed in the
cleanup because it's not attached to the build unless you specifically
request this device in a custom kernel config.

4 years agoUse device_delete_children() instead of a locally-rolled copy of it that
ian [Sat, 15 Jun 2019 20:17:00 +0000 (20:17 +0000)]
Use device_delete_children() instead of a locally-rolled copy of it that
leaks the device-list memory.

4 years agoRemove pwmbus_attach_bus(), it no longer has any callers. Also remove a
ian [Sat, 15 Jun 2019 20:13:42 +0000 (20:13 +0000)]
Remove pwmbus_attach_bus(), it no longer has any callers.  Also remove a
couple prototypes for functions that never existed (and never will).

4 years agoMove/rename the sys/pwm.h header file to dev/pwm/pwmc.h. The file contains
ian [Sat, 15 Jun 2019 19:46:59 +0000 (19:46 +0000)]
Move/rename the sys/pwm.h header file to dev/pwm/pwmc.h.  The file contains
ioctl definitions and related datatypes that allow userland control of pwm
hardware via the pwmc device.  The new name and location better reflects its
assocation with a single device driver.

4 years agoDo not include pwm.h here, it is purely a userland interface file containing
ian [Sat, 15 Jun 2019 19:43:33 +0000 (19:43 +0000)]
Do not include pwm.h here, it is purely a userland interface file containing
ioctl defintions for the pwmc driver. It is not part of the pwmbus interface.

4 years agoRemove pcf8563reg.h, the driver it was associated with was replaced in 2017
ian [Sat, 15 Jun 2019 19:16:02 +0000 (19:16 +0000)]
Remove pcf8563reg.h, the driver it was associated with was replaced in 2017
with the nxprtc multi-chip driver.

4 years agoPreviously, when pmap_remove_pages() destroyed a dirty superpage mapping,
alc [Sat, 15 Jun 2019 17:26:42 +0000 (17:26 +0000)]
Previously, when pmap_remove_pages() destroyed a dirty superpage mapping,
it only called vm_page_dirty() on the first of the superpage's constituent
4KB pages.  This revision corrects that error, calling vm_page_dirty() on
all of superpage's constituent 4KB pages.

MFC after: 3 days

4 years agocsu: Add proper .depend tracking for each object.
bdrewery [Sat, 15 Jun 2019 17:08:39 +0000 (17:08 +0000)]
csu: Add proper .depend tracking for each object.

This doesn't appear to have ever worked. After a .depend is generated
there will be duplicate .c dependencies so only use the first one.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoAllow DEPENDOBJS/DEPENDSRCS to work with only OBJS set and no SRCS.
bdrewery [Sat, 15 Jun 2019 17:08:35 +0000 (17:08 +0000)]
Allow DEPENDOBJS/DEPENDSRCS to work with only OBJS set and no SRCS.

Default to tracking .depend.* for OBJS rather than SRCS.

This helps cover some special case builds like gnu/lib/csu which
do more of a PROGS-like thing with bsd.prog.mk.

It is possible this causes out-of-tree Makefiles to have problems if they use
this pattern:
foo.o: foo.c
${CC} -o ${.TARGET} ${.ALLSRC}
This may cause multiple source files to be compiled due to finding the
'foo.o: foo.c' dependency both in the Makefile at the .depend file. Or
it may try compiling headers. This can be worked around by either of these:
foo.o: foo.c
${CC} -o ${.TARGET} ${.ALLSRC:N*.h:[1]}
Or
foo.o: foo.c
${CC} -o ${.TARGET} ${.CURDIR}/foo.c
In the latter case the ${.CURDIR} may need to be a different path. The
first case covers automatically using .PATH.

Sponsored by: DellEMC

4 years agoSupport reading in .depend files.
bdrewery [Sat, 15 Jun 2019 17:08:32 +0000 (17:08 +0000)]
Support reading in .depend files.

This is for an upcoming change that fixes .depend handling in here.
It will cause some duplicate sources which need to be trimmed out.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoMETA_MODE: Delete build targets that fail.
bdrewery [Sat, 15 Jun 2019 17:08:28 +0000 (17:08 +0000)]
META_MODE: Delete build targets that fail.

If a meta mode change is triggered but then the build fails then the
next build will not retrigger meta mode. This only prevented by
removing the target on rebuild or on the failure to rebuild.

Sponsored by: DellEMC

4 years agoAdd various CFLAGS/LDADD overrides for the output target file.
bdrewery [Sat, 15 Jun 2019 17:08:24 +0000 (17:08 +0000)]
Add various CFLAGS/LDADD overrides for the output target file.

Sponsored by: DellEMC

4 years agoAvoid generating DEPENDFILES='.depend.' when there's no DEPENDOBJS.
bdrewery [Sat, 15 Jun 2019 17:08:21 +0000 (17:08 +0000)]
Avoid generating DEPENDFILES='.depend.' when there's no DEPENDOBJS.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoSimilar to r335710 avoid ccache when linking a .cc file directly.
bdrewery [Sat, 15 Jun 2019 17:08:18 +0000 (17:08 +0000)]
Similar to r335710 avoid ccache when linking a .cc file directly.

Sponsored by: DellEMC

4 years agoFix .depend files to work for build tools.
bdrewery [Sat, 15 Jun 2019 17:08:13 +0000 (17:08 +0000)]
Fix .depend files to work for build tools.

This is somewhat of a follow-up to r335746.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoDon't force OBJS_DEPEND_GUESS headers onto all objects.
bdrewery [Sat, 15 Jun 2019 17:08:02 +0000 (17:08 +0000)]
Don't force OBJS_DEPEND_GUESS headers onto all objects.

This is in the case of not having any .depend.foo.o yet.  Don't force add *.h
as a dependency for those. They are built in beforebuild already when in
SRCS/DPSRCS.

This change allows custom rules, like in bin/sh/Makefile for mksyntax, to not
have cyclic dependency problems when connected to the .depend.* handling.

This is purposely not copied to sys/conf/kern.post.mk as it handles
generating headers slightly differently.

MFC after: 2 weeks
Sponsored by: DellEMC

4 years agoHandle failure to enable the clock or obtain its frequency.
ian [Sat, 15 Jun 2019 16:59:03 +0000 (16:59 +0000)]
Handle failure to enable the clock or obtain its frequency.

4 years agoDon't call pwmbus_attach_bus(), because it may not be present if this
ian [Sat, 15 Jun 2019 16:56:00 +0000 (16:56 +0000)]
Don't call pwmbus_attach_bus(), because it may not be present if this
driver is compiled into the kernel but pwmbus will be loaded as a module
when needed (and because of that, pwmbus_attach_bus() is going away in
the near future).  Instead, just directly do what that function did:
register the fdt xfef handle, and attach the pwmbus.

4 years agoIn detach(), check for failure of bus_generic_detach(), only release
ian [Sat, 15 Jun 2019 16:36:29 +0000 (16:36 +0000)]
In detach(), check for failure of bus_generic_detach(), only release
resources if they got allocated (because detach() gets called from attach()
to handle various failures), and delete the pwmbus child if it got created.

4 years agoAllow pwm(9) components to be selected individually, while 'device pwm'
ian [Sat, 15 Jun 2019 16:16:29 +0000 (16:16 +0000)]
Allow pwm(9) components to be selected individually, while 'device pwm'
still includes it all.

4 years agonetmap.4: Fix a typo as FreeBSD Linux is not a thing
0mp [Sat, 15 Jun 2019 12:09:22 +0000 (12:09 +0000)]
netmap.4: Fix a typo as FreeBSD Linux is not a thing

Approved by: src (emaste)
Event: Berlin Devsummit 2019

4 years ago- Replace unused and only ever written to members of public iflib(9)
marius [Sat, 15 Jun 2019 11:07:41 +0000 (11:07 +0000)]
- Replace unused and only ever written to members of public iflib(9)
  structs with placeholders (in the latter case, IFLIB_MAX_TX_BYTES
  etc. are also only ever used for these write-only members if at all,
  so both these macros and members can just go). Using these spares
  may render it possible to merge certain iflib(9) fixes to stable/12.
  Otherwise, changes extending struct if_irq or struct if_shared_ctx
  in any way would break KBI as instances of these are allocated by
  the driver front-ends (by contrast, struct if_pkt_info as well as
  struct if_softc_ctx instances are provided by iflib(9) and, thus,
  may grow at least at the end without breaking KBI).
- Make the pvi_name in struct pci_vendor_info const char * as device
  identifiers in hardware lookup tables aren't to be expected to ever
  change at runtime.
- Similarly, make the pci_vendor_info_t of struct if_shared_ctx which
  is used to point to the struct pci_vendor_info arrays provided by
  the driver front-ends const.
- Remove the ETH_ADDR_LEN macro from iflib.h; this was duplicating
  ETHER_ADDR_LEN of <net/ethernet.h> with iflib(9) actually only
  consuming the latter macro.
- Make the name argument of iflib_io_tqg_attach(9) const, matching
  the taskqgroup_attach_cpu(9) this function wraps as well as e. g.
  iflib_config_gtask_init(9).
- Remove the orphaned iflib_qset_lock_get() prototype.
- Remove some extraneous empty lines.

4 years agoAdd <sys/dnv.h> required for libnv to SYSINCS, too, apparently missed
marius [Sat, 15 Jun 2019 09:45:00 +0000 (09:45 +0000)]
Add <sys/dnv.h> required for libnv to SYSINCS, too, apparently missed
in r336335.

4 years agovtfontcvt: add comments in add_glyph
emaste [Sat, 15 Jun 2019 09:15:58 +0000 (09:15 +0000)]
vtfontcvt: add comments in add_glyph

During review for PR 205707.

Event: Berlin Devsummit 2019

4 years agoIn ask(): override default option if any of alwaysyes/alwaysno/rdonly is
delphij [Sat, 15 Jun 2019 07:23:06 +0000 (07:23 +0000)]
In ask(): override default option if any of alwaysyes/alwaysno/rdonly is
set.

MFC after: 2 weeks

4 years agoBlankspace. No actual code change.
delphij [Sat, 15 Jun 2019 06:51:46 +0000 (06:51 +0000)]
Blankspace.  No actual code change.

MFC after: 2 weeks

4 years agoCritical comments were lost in r349203. This patch seeks to restore
dougm [Sat, 15 Jun 2019 04:30:13 +0000 (04:30 +0000)]
Critical comments were lost in r349203. This patch seeks to restore
the lost information in new comments.

Reported by: alc
Reviewed by: alc
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20632

4 years agoLightly hide the 'var' inside the macros to read the arm special registers.
julian [Sat, 15 Jun 2019 00:47:39 +0000 (00:47 +0000)]
Lightly hide the 'var' inside the macros to read the arm special registers.
I just happenned to have 3rd party code using 'var' as the output variable
which drew my attention to this. variables defined inside macros should be
prefixed to avoid getting shadowed varable wanrings from clang.

4 years agoEdvard Hagerup Grieg parses as given name, mother's maiden name, surname
grog [Fri, 14 Jun 2019 23:53:19 +0000 (23:53 +0000)]
Edvard Hagerup Grieg parses as given name, mother's maiden name, surname

4 years agoBatch the TLB invalidations that are performed by pmap_protect() rather
alc [Fri, 14 Jun 2019 22:06:43 +0000 (22:06 +0000)]
Batch the TLB invalidations that are performed by pmap_protect() rather
than performing them one at a time.

MFC after: 10 days

4 years agoopen(2): fix the description of O_FSYNC
asomers [Fri, 14 Jun 2019 20:35:37 +0000 (20:35 +0000)]
open(2): fix the description of O_FSYNC

The man page claims that with O_FSYNC (aka O_SYNC) the kernel will not cache
written data. However, that's not true. Nor does POSIX require it.
Perhaps it was true when that section of the man page was written in r69336
(I haven't checked). But it's not true now.  Now the effect is simply that
writes are sent to disk immediately and synchronously, but they're still
cached.

See also: https://pubs.opengroup.org/onlinepubs/9699919799/
See also: ffs_write in sys/ufs/ffs/ffs_vnops.c

Reviewed by: cem
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20641

4 years agoMinimize aggsum_compare(&arc_size, arc_c) calls.
mav [Fri, 14 Jun 2019 20:04:28 +0000 (20:04 +0000)]
Minimize aggsum_compare(&arc_size, arc_c) calls.

For busy ARC situation when arc_size close to arc_c is desired.  But
then it is quite likely that aggsum_compare(&arc_size, arc_c) will need
to flush per-CPU buckets to find exact comparison result.  Doing that
often in a hot path penalizes whole idea of aggsum usage there, since it
replaces few simple atomic additions with dozens of lock acquisitions.

Replacing aggsum_compare() with aggsum_upper_bound() in code increasing
arc_p when ARC is growing (arc_size < arc_c) according to PMC profiles
allows to save ~5% of CPU time in aggsum code during sequential write
to 12 ZVOLs with 16KB block size on large dual-socket system.

I suppose there some minor arc_p behavior change due to lower precision
of the new code, but I don't think it is a big deal, since it should
affect only very small window in time (aggsum buckets are flushed every
second) and in ARC size (buckets are limited to 10 average ARC blocks
per CPU).

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoAlike to ZoL disable metaslab allocation tracing code.
mav [Fri, 14 Jun 2019 19:57:32 +0000 (19:57 +0000)]
Alike to ZoL disable metaslab allocation tracing code.

It is too generous to collect in production debug traces that can only
be read with kernel debugger.  Illumos includes special code in their
mdb debugger to read it, we don't.

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

4 years agoProperly align struct multilist_sublist to cache line.
mav [Fri, 14 Jun 2019 17:09:39 +0000 (17:09 +0000)]
Properly align struct multilist_sublist to cache line.

Manual Illumos alignment does not fit us due to different kmutex_t size.

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

4 years agoClarify that the -r and -R options can be used only to create level 0 dumps.
mckusick [Fri, 14 Jun 2019 06:10:15 +0000 (06:10 +0000)]
Clarify that the -r and -R options can be used only to create level 0 dumps.

Suggested by: phk
MFC after:    3 days

4 years agoChange the arm64 pmap so that updates to the global count of wired pages are
alc [Fri, 14 Jun 2019 04:01:08 +0000 (04:01 +0000)]
Change the arm64 pmap so that updates to the global count of wired pages are
not performed directly by the pmap.  Instead, they are performed by
vm_page_free_pages_toq().  (This is the same approach that we use on x86.)

Reviewed by: kib, markj
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D20627

4 years agoAvoid using the prev field of vm_map_entry_t in two functions that
dougm [Fri, 14 Jun 2019 03:15:54 +0000 (03:15 +0000)]
Avoid using the prev field of vm_map_entry_t in two functions that
iterate over consecutive vm_map entries, and that can easily just
'remember' the prev value instead of looking it up.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20628

4 years agoUpdate td_runtime of running thread on each statclock().
mav [Fri, 14 Jun 2019 01:09:10 +0000 (01:09 +0000)]
Update td_runtime of running thread on each statclock().

Normally td_runtime is updated on context switch, but there are some kernel
threads that due to high absolute priority may run for many seconds without
context switches (yes, that is bad, but that is true), which means their
td_runtime was not updated all that time, that made them invisible for top
other then as some general CPU usage.

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

4 years agoAdd opt_cam.h so we can build this outside of a kernel build.
imp [Thu, 13 Jun 2019 22:03:53 +0000 (22:03 +0000)]
Add opt_cam.h so we can build this outside of a kernel build.

4 years agoCreate a function for creating objects to back map entries, and one
dougm [Thu, 13 Jun 2019 20:09:07 +0000 (20:09 +0000)]
Create a function for creating objects to back map entries, and one
for giving cred to a map entry backed by an object, and use them
instead of the code duplicated inline now.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20370

4 years agobhyve: move common code to net_utils.c
vmaffione [Thu, 13 Jun 2019 17:39:32 +0000 (17:39 +0000)]
bhyve: move common code to net_utils.c

Both virtio_net and e82545 network frontends have code to validate and
generate MAC addresses. These functionalities are replicated in the two
files, so we move them in a separate compilation unit.

Reviewed by: rgrimes, bryanv, imp, kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20626

4 years agoDon't print the request we may be aborting in ciss_notify_abort as
imp [Thu, 13 Jun 2019 05:19:42 +0000 (05:19 +0000)]
Don't print the request we may be aborting in ciss_notify_abort as
part of ciss_detach. It's a left-over debug that isn't needed and also
discloses a kernel address. Only root could provoke as part of a
devctl or kldunload.

Submitted by: Fuqian Huang
MFC After: 1 week

4 years agoIncrease the timeout for READ NATIVE MAX
imp [Thu, 13 Jun 2019 05:19:36 +0000 (05:19 +0000)]
Increase the timeout for READ NATIVE MAX

READ NATIVE MAX can take longer than a second if the queued NCQ I/Os
take longer than a second to drain.