Commit Graph

237588 Commits

Author SHA1 Message Date
Niclas Zeising
4651a02f07 Enable evdev on ppc64
Enable evdev on ppc64 as well, similar to what was done for amd64 and i386
in r340387.

Evdev can be used by X and is used by wayland to handle input devices.

Approved by:	mmacy
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18026
2018-11-19 15:36:58 +00:00
Tijl Coosemans
e3b385fc95 Do proper copyin of control message data in the Linux sendmsg syscall.
Instead of calling m_append with a user address, allocate an mbuf cluster
and copy data into it using copyin.  For the SCM_CREDS case, instead of
zeroing a stack variable and appending that to the mbuf, zero part of the
mbuf cluster directly.  One mbuf cluster is also the size limit used by
the FreeBSD sendmsg syscall (uipc_syscalls.c:sockargs()).

PR:		217901
Reviewed by:	kib
MFC after:	3 days
2018-11-19 15:31:54 +00:00
Hans Petter Selasky
90acd1d139 Minor code factoring. No functional change.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-11-19 09:36:09 +00:00
Hans Petter Selasky
2205f61a31 Be more verbose when a sysctl fails to unregister.
Print name of sysctl in question.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-11-19 09:35:16 +00:00
Eugene Grosbein
d642b94209 Unbreak ng_source(4) for 64-bit platforms including amd64. 2018-11-19 07:27:50 +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
Jayachandran C.
be7af100ad gitv3_its: fixes for multiple GIC ITS blocks
First pass of support for multiple GIC ITS blocks with ACPI.
Changes are to:
 * register the correct subset of interrupts with pic_register
   in case of ACPI.
 * initialize just the cpu interface for the first ITS, when
   domain information is not avialable. This has to be done
   until we split the per-CPU init to do LPI setup just once.
 * remove duplicate check for the GIC ITS domain, the sc_cpus
   are setup from domain, so the check again in per-CPU init
   seems unnecessary.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17841
2018-11-19 03:52:56 +00:00
Jayachandran C.
bd158cddc4 pci_host_generic : move activate/release to generic code
Now that the ACPI and FDT implementations for activating and
deactivating resources are the same, we can move it to
pci_host_generic.c.  No functional changes.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17793
2018-11-19 03:43:10 +00:00
Jayachandran C.
f916d05797 pci_host_generic, acpi_resource: drop unneeded code
Now that we are handling PCI resources in pci_host_generic_acpi.c, we
don't need these change (made by r336129)

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17792
2018-11-19 03:34:15 +00:00
Jayachandran C.
185c34f7c8 acpica, pci_host_generic_acpi: redo pci_host_generic_acpi.c
This is a major update for pci_host_generic_acpi.c, the current
implementation has some gaps that are better fixed up in one go.
The changes are to:
 * Follow x86 method of not adding PCI resources to PCI host bridge in
   ACPI code. This has been moved to pci_host_generic_acpi.c, where we
   walk thru its resources of the host bridge and add them.
 * Fixup code in pci_host_generic_acpi.c to read all decoded ranges
   and update the 'ranges' property. This allows us to share most of
   the code with generic implementation (and the FDT one).
 * Parse and setup IO ranges and bus ranges when walking the resources
   above. Drop most of the changes related to this from acpica code.
 * Add the ECAM memory area as mem resource 0. Implement the logic to
   get the ECAM area from MCFG (using bus range which we now decode),
   or from _CBA (using _BBN/bus range). Drop aarch64 ifdefs from acpica
   code which did part of this.
 * Switch resource activation to similar code as FDT implementation,
   this can be moved into generic implementation in a later pass.
 * Drop the mechanism of using the 7th bit of bus number as the domain,
   this is not correct and will work only in very specific cases. Use
   _SEG as PCI domain and use the bus ranges of the host bridge to
   provide start bus number.

This commit should not make any functional change to dev/acpica/acpi.c
for other architectures, almost all the changes there are to revert
earlier additions in this file done for aarch64.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17791
2018-11-19 03:16:16 +00:00
Jayachandran C.
d4d6ad3f05 acpica: rework INTRNG interrupts
On arm64 (where INTRNG is enabled), the interrupts have to be mapped
with ACPI_BUS_MAP_INTR() before adding them as resources to devices.

The earlier code did the mapping before calling acpi_set_resource(),
which bypassed code that checked for PCI link interrupts.

To fix this, move the call to map interrupts into acpi_set_resource()
and that requires additional work to lookup interrupt properties.
The changes here are to:
 * extend acpi_lookup_irq_handler() to lookup an irq in the ACPI
   resources
 * create a helper function acpi_map_intr() which uses the updated
   acpi_lookup_irq_handler() to look up an irq, and then map it
   with ACPI_BUS_MAP_INTR()
 * use acpi_map_intr() in acpi_pcib_route_interrupt() to map
   pci link interrupts.

With these changes, we can drop the ifdefs in acpi_resource.c, and
we can also drop the call for mapping interrupts in generic_timer.c

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17790
2018-11-19 03:02:47 +00:00
Jayachandran C.
697c57e5c7 pci_host_generic*: basic implementation of bus range
Both ACPI and FDT support bus ranges for pci host bridges. Update
pci_host_generic*.[ch] with a default implementation to support this.
This will be used in the next set of changes for ACPI based host
bridge. No functional changes in this commit.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17657
2018-11-19 02:55:18 +00:00
Jayachandran C.
ad785aafe3 pci_host_generic: allocate resources against devices
Fix up pci_host_generic.c and pci_host_generic_fdt.c to allocate
resources against devices that requested them. Currently the
allocation happens against the pcib, which is incorrect.

This is needed for the upcoming changes for fixing up
pci_host_generic_acpi.c

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17656
2018-11-19 02:43:34 +00:00
Jayachandran C.
f3c5181ab9 pci_host_generic: remove unneeded ThunderX2 quirk
The current quirk implementation writes a fixed address to the PCI BAR
to fix a firmware bug. The PCI BARs are allocated by firmware and will
change depending on PCI devices present. So using a fixed address here
is not correct.

This quirk worked around a firmware bug that programmed the MSI-X bar
of the SATA controller incorrectly. The newer firmware does not have
this issue, so it is better to drop this quirk altogether.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D17655
2018-11-19 02:38:02 +00:00
Kyle Evans
9c1535e9ab bectl(8): Add some regression tests
These tests operate on a file-backed zpool that gets created in the kyua
temp dir. root and ZFS support are both required for these tests. Current
tests cover create, destroy, export/import, jail, list (kind of), mount,
rename, and jail.

List tests should later be extended to cover formatting and the different
list flags, but for now only covers basic "are create/destroy actually
reflected properly"

MFC after:	3 days
2018-11-19 02:30:12 +00:00
Kyle Evans
af43c24d3d libbe(3): Properly account for altroot when creating new BEs
Previously we would blindly copy the 'mountpoint' property, which includes
the altroot. The altroot needs to be snipped off prior to setting it on the
new BE, though, or you'll end up with a new BE and a mountpoint of /mnt with
altroot=/mnt

MFC after:	3 days
2018-11-19 02:16:20 +00:00
Kyle Evans
cc624025b4 bectl(3)/libbe(3): Allow BE root to be specified
Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:

- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
  since it defaults to the rootfs and cross-pool cloning doesn't work like
  that (IIRC)

Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.

bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt

this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.

MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18029
2018-11-19 02:12:08 +00:00
Kevin Bowling
2a24f4d911 Retire sbsndptr() KPI
As of r340465 all consumers use sbsndptr_adv and sbsndptr_noadv

Reviewed by:	gallatin
Approved by:	krion (mentor)
Differential Revision:	https://reviews.freebsd.org/D17998
2018-11-19 00:54:31 +00:00
Alex Richardson
6edf284675 Fix -DNO_CLEAN amd64 build after r340463
Without this change I got the following error:
clang-7: error: no such file or directory: '..../lib/libc/amd64/string/bzero.S'

Reviewed By:	mjg
Differential Revision: https://reviews.freebsd.org/D18031
2018-11-18 19:55:03 +00:00
Mariusz Zaborski
ce57fd97fe brandelf: capsicumize it 2018-11-18 12:23:03 +00:00
Mariusz Zaborski
d72ba183ff brandelf: fix style nits
No functional change intended.

Reviewed by:	emaste, markj
Differential Revision:	https://reviews.freebsd.org/D17966
2018-11-18 12:03:12 +00:00
Mariusz Zaborski
fd253945ac Update the names in the LIMITS and EXAMPLES sections after r340363.
Reported by:	markj
2018-11-18 11:11:27 +00:00
Mark Johnston
e5fff57dd0 Change dumpon(8)'s handling of -g.
Rather than using a special value to denote "use the default router",
treat the absence of the -g option to mean the same thing.  The
in-kernel netdump client will always attempt to reach the server
directly before falling back to the configured gateway anyway.  This
change makes it cleaner to support a hostname value for -g.

Reviewed by:	cem
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18025
2018-11-18 01:58:48 +00:00
Alan Cox
92e78c1012 Tidy up vm_map_simplify_entry() and its recently introduced helper
functions.  Notably, reflow the text of some comments so that they
occupy fewer lines, and introduce an assertion in one of the new
helper functions so that it is not misused by a future caller.

In collaboration with:	Doug Moore <dougm@rice.edu>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17635
2018-11-18 01:27:17 +00:00
Marius Strobl
835998c210 Add a quirk handling for AMDI0040 controllers allowing them to do HS400.
Submitted by:	Shreyank Amartya (original version)
2018-11-18 00:52:27 +00:00
Alan Somers
02419b46cf mount_fusefs.8: expand HISTORY section
Note that fuse was available from ports long before joining the base system.
Also, update the upstream URL.

MFC after:	2 weeks
2018-11-17 21:35:01 +00:00
Kyle Evans
efd6500d03 libbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2)
Go through the ZFS layer instead; given a BE, we can derive the dataset,
zfs_open it, then zfs_unmount. ZFS takes care of the dirty details and
likely gets it more correct than we did for more interesting setups.

MFC after:	3 days
2018-11-17 19:19:37 +00:00
Kyle Evans
51aecc893a libbe(3): rewrite init to support chroot usage
libbe(3) currently uses zfs_be_root and locates which of its children is
currently mounted at "/". This is reasonable, but not correct in the case of
a chroot, for two reasons:

- chroot root may be of a different zpool than zfs_be_root
- chroot root will not show up as mounted at "/"

Fix both of these by rewriting libbe_init to work from the rootfs down.
zfs_path_to_zhandle on / will resolve to the dataset mounted at the new
root, rather than the real root. From there, we can derive the BE root/pool
and grab the bootfs off of the new pool. This does no harm in the average
case, and opens up bectl to operating on different pools for scenarios where
one may be, for instance, updating a pool that generally gets re-rooted into
from a separate UFS root or zfs bootpool.

While here, I've also:
- Eliminated the check for /boot and / to be on the same partition. This
  leaves one open to a setup where /boot (and consequently, kernel/modules)
  are not included in the boot environment. This may very well be an
  intentional setup done by someone that knows what they're doing, we should
  not kill BE usage because of it.

- Eliminated the validation bits of BEs and snapshots that enforced
  'mountpoint' to be "/" -- this broke when trying to operate on an imported
  pool with an altroot, but we need not be this picky.

Reported by:	philip
Reviewed by:	philip, allanjude (previous version)
Tested by:	philip
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18012
2018-11-17 19:15:29 +00:00
Marius Strobl
f426dff83b - Restore setting the clock for devices which support the default/legacy
transfer mode only (lost with r321385). [1]
- Similarly, don't try to set the power class on MMC devices that comply
  to version 4.0 of the system specification but are operated in default/
  legacy transfer or 1-bit bus mode as no power class is specified for
  these cases. Trying to set a power class nevertheless resulted in an -
  albeit harmless - error message.

PR:	231713 [1]
2018-11-17 17:21:36 +00:00
Bjoern A. Zeeb
945aad9c62 Improve the comment for arpresolve_full() in if_ether.c.
No functional changes.

MFC after:	6 weeks
2018-11-17 16:13:09 +00:00
Bjoern A. Zeeb
90d99b6587 Retire arpresolve_addr(), which is not used anywhere, from if_ether.c. 2018-11-17 16:08:36 +00:00
Yuri Pankov
adeebb8308 Make mbstowcs_basic test pass, now that we have more ctype definitions.
Reported by:	jenkins
Approved by:	kib (mentor, implicit)
2018-11-17 12:59:59 +00:00
Yuri Pankov
dbcf594ac9 Use UnicodeData.txt to create UTF-8 ctype map.
This should provide more complete coverage of currently defined Unicode
characters as compared to manually assembled one we use currently.

Comparison of original and new UTF-8 ctype maps by character class:

TYPE    ORIG    NEW
alnum   94229   126029
alpha   93557   125419
blank   4       2
cntrl   73      137685
digit   469     622
graph   109615  137203
lower   1478    2145
print   109641  137222
punct   3428    797
rune    110481  274907
space   33      24
upper   983     1781
xdigit  469     622

Large number of added cntrl definitions is due to the fact that private-use
planes are currently defined as such, this can change in the future.

Discussed with:	bapt
Approved by:	kib (mentor, implicit)
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D17842
2018-11-17 10:36:00 +00:00
Brooks Davis
583d748778 Fix stray tab.
Reported by:	jbeich
MFC after:	3 days
MFC with:	r340489
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18011
2018-11-17 00:03:04 +00:00
Brooks Davis
b56f51f1b7 Fix freebsd32 support for PCIOCGETCONF.
This fixes regresssions in pciconf -l and some ports as reported on
freebsd-current:

https://lists.freebsd.org/pipermail/freebsd-current/2018-November/072144.html

Reported by:	jbeich
Reviewed by:	kib (also proposed an idential patch)
Tested by:	jbeich
MFC after:	3 days
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18011
2018-11-16 23:58:51 +00:00
John Baldwin
e13507f6f0 Axe MINIMUM_MSI_INT.
Just allow MSI interrupts to always start at the end of the I/O APIC
pins.  Since existing machines already have more than 255 I/O APIC
pins, IRQ 255 is no longer reliably invalid, so just remove the
minimum starting value for MSI.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D17991
2018-11-16 23:39:39 +00:00
Konstantin Belousov
2343757338 Align IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.
SDM rev. 068 was released yesterday and it contains the description of
the MSR 0x10a IA32_ARCH_CAP. This change adds symbolic definitions for
all bits present in the document, and decode them in the CPU
identification lines printed on boot.

But also, the document defines SSB_NO as bit 4, while FreeBSD used but
2 to detect the need to work-around Speculative Store Bypass
issue.  Change code to use the bit from SDM.

Similarly, the document describes bit 3 as an indicator that L1TF
issue is not present, in particular, no L1D flush is needed on
VMENTRY.  We used RDCL_NO to avoid flushing, and again I changed the
code to follow new spec from SDM.

In fact my Apollo Lake machine with latest ucode shows this:
    IA32_ARCH_CAPS=0x19<RDCL_NO,SKIP_L1DFL_VME,SSB_NO>

Reviewed by:	bwidawsk
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D18006
2018-11-16 21:27:11 +00:00
John Baldwin
d09389fd05 Consolidate on a single set of constants for SCMD fields.
Both ccr(4) and the TOE TLS code had separate sets of constants for
fields in SCMD messages.

Sponsored by:	Chelsio Communications
2018-11-16 19:08:52 +00:00
Mark Johnston
5211f8dccb Add regression tests for r340313 and r340483.
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17926
2018-11-16 19:04:12 +00:00
Mark Johnston
634bb9e435 Rename the SO_REUSEPORT_LB test file to be consistent with other tests.
MFC after:	1 week
2018-11-16 18:59:58 +00:00
Jonathan T. Looney
2157f3c36a Add some additional length checks to the IPv4 fragmentation code.
Specifically, block 0-length fragments, even when the MF bit is clear.
Also, ensure that every fragment with the MF bit clear ends at the same
offset and that no subsequently-received fragments exceed that offset.

Reviewed by:	glebius, markj
MFC after:	3 days
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D17922
2018-11-16 18:32:48 +00:00
Mateusz Guzik
2c054ce924 proc: always store parent pid in p_oppid
Doing so removes the dependency on proctree lock from sysctl process list
export which further reduces contention during poudriere -j 128 runs.

Reviewed by:	kib (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17825
2018-11-16 17:07:54 +00:00
Warner Losh
14343799dc Remove do-nothing nvme_modevent.
nvme_modevent no longer does anything interesting, remove it.

Sponsored by: Netflix
2018-11-16 16:51:44 +00:00
Hans Petter Selasky
0df8bab666 Define asm macro in the LinuxKPI.
Submitted by:		Johannes Lundberg <johalun0@gmail.com>
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-11-16 16:23:45 +00:00
Hans Petter Selasky
1799873e3a Implement ktime_get_ts64() function macro in the LinuxKPI.
Submitted by:		Johannes Lundberg <johalun0@gmail.com>
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-11-16 16:19:16 +00:00
Mateusz Piotrowski
03840eefd7 development(7): Replace "reboot" with "shutdown -r now"
We generally document shutdown(8) instead of reboot(8) as it's better for
interactive use.

In modern FreeBSD is matters a lot less, it's mostly just convention. One
minor thing is that shutdown(8) produces a global message, while reboot(8)
does not. It is believed that historically, some versions of reboot did not
do appropriate safe shutdown checks and just rebooted.

It's also just consistency: for example the handbook[1] documents shutdown.

There is actually another important difference between reboot and shutdown
-r now: reboot does not run /etc/rc.shutdown. This is because reboot has
its own shutdown procedure and does not signal init like init 6 and
shutdown -r now do (except in the case of rerooting via reboot -r).

A few years ago jilles@ proposed changing reboot's default to signalling
init (preserving reboot -q which just invokes the reboot system call), but
this was not accepted. Perhaps this can be tried again for 13.0.

[1]: https://www.freebsd.org/doc/handbook/boot-shutdown.html

Reported by:	eadler
Reviewed by:	eadler, jilles
Approved by:	krion (mentor)
Differential Revision:	https://reviews.freebsd.org/D16843
2018-11-16 14:29:28 +00:00
Andrey V. Elsukov
ad43bf348b Allow configuration of several ipsec interfaces with the same tunnel
endpoints.

This can be used to configure several IPsec tunnels between two hosts
with different security associations.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2018-11-16 14:21:57 +00:00
Stanislav Galabov
3154bc4680 Implement support for sysctl hw.model for Mediatek/Ralink SoCs
These SoCs have CHIPID registers, which store the Chip model, according
to the manufacturer; make use of those in order to better identify
the chip we're actually running on.

If we're unable to read the CHIPID registers for some reason we will
use the string "unknown " as a value for hw.model.

Reported by:	yamori813@yahoo.co.jp
Sponsored by:	Smartcom - Bulgaria AD
2018-11-16 11:17:18 +00:00
Vincenzo Maffione
4657bceacf ifnet(9): Add description of IFCAP_NETMAP
Describe IFCAP_NETMAP adding a cross reference to netmap(4).

Reviewed by:	bcr, 0mp
Approved by:	gnn (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D17988
2018-11-16 10:20:35 +00:00
Mike Karels
456e896d6d Fix flags collision causing inability to enable CBQ in ALTQ
The CBQ BORROW flag conflicts with the RMCF_CODEL flag; the
two sets of definitions actually define the same things. The symptom
is that a kernel with CBQ support and not CODEL fails to load a QoS
policy with the obscure error "pfctl: DIOCADDALTQ: Cannot allocate memory."
If ALTQ_DEBUG is enabled, the error becomes a little clearer:
"rmc_newclass: CODEL not configured for CBQ!" is printed by the kernel.
There really shouldn't be two sets of macros that have to be defined
consistently, but the include structure isn't right for exporting
CBQ flags to altq_rmclass.h. Re-align the definitions, and add
CTASSERTs in the kernel to ensure that the definitions are consistent.

PR:		215716
Reviewed by:	pkelsey
MFC after:	2 weeks
Sponsored by:	Forcepoint LLC
Differential Revision:	https://reviews.freebsd.org/D17758
2018-11-16 03:42:29 +00:00