]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoChange reg in Marvell Armada38X pcie FDT
Marcin Wojtas [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'
Marcin Wojtas [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
Marcin Wojtas [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
Marcin Wojtas [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 agoMake Marvell armv7 timer and wdt registers definitions common
Marcin Wojtas [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).
Hans Petter Selasky [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
Marcin Wojtas [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
Marcin Wojtas [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
Emmanuel Vadot [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 Tetlow [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.
Warner Losh [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
Warner Losh [Wed, 4 Apr 2018 02:35:48 +0000 (02:35 +0000)]
Fix minor whitespace nits

6 years agoCorrect the ilog2() for calculating memory sizes.
Justin Hibbits [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.
Pedro F. Giffuni [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"
Oleksandr Tymoshenko [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
Marcin Wojtas [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
Marcin Wojtas [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
Marcin Wojtas [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.
Jung-uk Kim [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
Marcin Wojtas [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
Marcin Wojtas [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
Conrad Meyer [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
Marcin Wojtas [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
Marcin Wojtas [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
Marcin Wojtas [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 Tjoelker [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
Marcin Wojtas [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
Marcin Wojtas [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
Marcin Wojtas [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.
Alexander Motin [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.

6 years agoAdd the etdump utility for dumping El Torito boot catalog information.
Benno Rice [Tue, 3 Apr 2018 21:08:10 +0000 (21:08 +0000)]
Add the etdump utility for dumping El Torito boot catalog information.

This can be used to check existing images but will be used in the future to
find EFI ESP images placed in El Torito catalogs so they can be used for
hybrid boot purposes.

Reviewed by: imp (code), sbruno (man page), bcr (man page)
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14952

6 years agoRemove redundant check.
Cy Schubert [Tue, 3 Apr 2018 20:59:46 +0000 (20:59 +0000)]
Remove redundant check.

Reported by: kib@
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785

6 years agoThe correct symbol version for FreeBSD 12 is 1.5.
Cy Schubert [Tue, 3 Apr 2018 20:53:53 +0000 (20:53 +0000)]
The correct symbol version for FreeBSD 12 is 1.5.

Reported by: kib@
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785

6 years agoCorrect the version number for gets_s(3).
Cy Schubert [Tue, 3 Apr 2018 20:38:25 +0000 (20:38 +0000)]
Correct the version number for gets_s(3).

Reported by: kib@
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785

6 years agoInclude update to stdio.h missed in r331936.
Cy Schubert [Tue, 3 Apr 2018 20:14:37 +0000 (20:14 +0000)]
Include update to stdio.h missed in r331936.

In my attempt to limit the commit in r331936 to only the gets_s()
commit and not include unrelated patches in my tree, this patch
was missed.

Reported by: pfg
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785

6 years agoAdd gets_s(3) to the man page title (noticed by ed@).
Cy Schubert [Tue, 3 Apr 2018 19:51:23 +0000 (19:51 +0000)]
Add gets_s(3) to the man page title (noticed by ed@).

While I'm at it correct the update date in the man page.

Reported by: ed@
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785

6 years agoAdd new gets_s(3) stdio function.
Cy Schubert [Tue, 3 Apr 2018 18:52:38 +0000 (18:52 +0000)]
Add new gets_s(3) stdio function.

This implements the gets_s(3) function as documented at
http://en.cppreference.com/w/c/io/gets. It facilitates the
optional removal of gets(3).

Reviewed by: ed
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D12785

6 years agovtfontcvt: allow .bdf characters less than full height
Ed Maste [Tue, 3 Apr 2018 18:43:00 +0000 (18:43 +0000)]
vtfontcvt: allow .bdf characters less than full height

Sponsored by: The FreeBSD Foundation

6 years agoWrap long lines.
Mark Johnston [Tue, 3 Apr 2018 18:41:27 +0000 (18:41 +0000)]
Wrap long lines.

MFC after: 3 days

6 years agofix i386 build with CPU_ELAN (LINT for instance) after r331878
Andriy Gapon [Tue, 3 Apr 2018 17:16:06 +0000 (17:16 +0000)]
fix i386 build with CPU_ELAN (LINT for instance) after r331878

x86/cpu_machdep.c now needs to include elan_mmcr.h when CPU_ELAN is set.
While here, also remove the now unneeded inclusion of isareg.h in i386
and amd64 vm_machdep.c.

Reported by: lwhsu
MFC after: 14 days
X-MFC with: r331878

6 years agor330675 introduced an extra window check in the LRO code to ensure it
Jonathan T. Looney [Tue, 3 Apr 2018 13:54:38 +0000 (13:54 +0000)]
r330675 introduced an extra window check in the LRO code to ensure it
captured and reported the highest window advertisement with the same
SEQ/ACK.  However, the window comparison uses modulo 2**16 math, rather
than directly comparing the absolute values.  Because windows use
absolute values and not modulo 2**16 math (i.e. they don't wrap), we
need to compare the absolute values.

Reviewed by: gallatin
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D14937

6 years agoRemove fdt_is_enabled, fdt_reg_to_rl, and fdt_get_unit. These are not used
Andrew Turner [Tue, 3 Apr 2018 13:30:40 +0000 (13:30 +0000)]
Remove fdt_is_enabled, fdt_reg_to_rl, and fdt_get_unit. These are not used
by anything in the tree.

Sponsored by: DARPA, AFRL

6 years agoSwitch users of fdt_is_enabled to use ofw_bus_node_status_okay. These are
Andrew Turner [Tue, 3 Apr 2018 11:01:50 +0000 (11:01 +0000)]
Switch users of fdt_is_enabled to use ofw_bus_node_status_okay. These are
equivalent, so to prepare to remove the former move users to call the
latter.

Sponsored by: DARPA, AFRL

6 years agofix signatures of cpu_reset_real and cpu_reset_proxy, broken in r331878
Andriy Gapon [Tue, 3 Apr 2018 06:46:26 +0000 (06:46 +0000)]
fix signatures of cpu_reset_real and cpu_reset_proxy, broken in r331878

When I moved these functions from i386 and amd64 to x86 I dropped their
prototype declarations (that were correct) and left only their definitions
that became incorrect.

Reported by: bde
MFC after: 15 days
X-MFC with: r331878

6 years agoFix accidental USB port resets by GPIO on Zynq/Zedboard boards
Oleksandr Tymoshenko [Tue, 3 Apr 2018 04:31:54 +0000 (04:31 +0000)]
Fix accidental USB port resets by GPIO on Zynq/Zedboard boards

The Zynq/Zedboard GPIO driver attempts to tri-state all GPIO pins on
boot up but the order in which I reset the hardware can cause the pins
to be briefly held low before being tri-stated.  This is a problem on
boards that use GPIO pins to reset devices.

In particular, the Zybo and ZC-706 boards use a GPIO pin as a USB PHY
reset.  If U-boot enables the USB port before booting the kernel, the
GPIO driver attach causes a glitch on the USB PHY reset and the USB
port loses power.  My fix is to have the GPIO driver leave the pins in
whatever configuration U-boot placed them.

PR: 225713
Submitted by: Thomas Skibo <thoma555-bsd@yahoo.com>
MFC after: 1 week

6 years agoDefault loader.conf: Drop efi_max_resolution to 1x1
Kyle Evans [Tue, 3 Apr 2018 02:41:32 +0000 (02:41 +0000)]
Default loader.conf: Drop efi_max_resolution to 1x1

Effectively disabling the mode changing bits in the loader. No matter which
way we go with it, it seems to be wrong- either the firmware doesn't change
the resolution and reports the resolution we requested, or the firmware
changes the resolution and doesn't report the resolution we requested. It
some cases, it does the right thing, but the bad cases outweight those.

Interested individuals can still set efi_max_resolution to 1080p or whatnot
in loader.conf(5) to restore the new behavior, but the new behavior does not
work out well for many cases.

Discussed with: imp

6 years agocxgbe: Implement tcp_info handler for connections handled by t4_tom.
Navdeep Parhar [Tue, 3 Apr 2018 01:22:15 +0000 (01:22 +0000)]
cxgbe: Implement tcp_info handler for connections handled by t4_tom.

The TCB is read using a memory window right now.  A better alternate to
get self-consistent, uncached information would be to use a GET_TCB
request but waiting for a reply from hw while holding non-sleepable
locks is quite inconvenient.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14817

6 years agoAdd a hook to allow the toedev handling an offloaded connection to
Navdeep Parhar [Tue, 3 Apr 2018 01:08:54 +0000 (01:08 +0000)]
Add a hook to allow the toedev handling an offloaded connection to
provide accurate TCP_INFO.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14816

6 years agoAdd support for a pmap direct map for 64-bit Book-E
Justin Hibbits [Tue, 3 Apr 2018 00:45:38 +0000 (00:45 +0000)]
Add support for a pmap direct map for 64-bit Book-E

As with AIM64, map the DMAP at the beginning of the fourth "quadrant" of
memory, and move the KERNBASE to the the start of KVA.

Eventually we may run the kernel out of the DMAP, but for now, continue
booting as it has been.

6 years agoImport CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
Olivier Houchard [Mon, 2 Apr 2018 23:40:50 +0000 (23:40 +0000)]
Import CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
It should fix ck_pr_[load|store]_ptr on mips and riscv, make sure no
*fence instructions are used on i386, as older cpus don't support it, and
make sure we don't rely on gcc builtins that can lead to calls to
libatomic when linked with -O0.

MFC after: 1 week

6 years agoImport CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
Olivier Houchard [Mon, 2 Apr 2018 23:35:32 +0000 (23:35 +0000)]
Import CK as of commit b19ed4c6a56ec93215ab567ba18ba61bf1cfbac8
It should fix ck_pr_[load|store]_ptr on mips and riscv, make sure no
*fence instructions are used on i386, as older cpus don't support it, and
make sure we don't rely on gcc builtins that can lead to calls to
libatomic when linked with -O0.

6 years agoFix formatting in snd_hda.4
Benjamin Kaduk [Mon, 2 Apr 2018 22:59:33 +0000 (22:59 +0000)]
Fix formatting in snd_hda.4

Submitted by: 0mp
Reviewed by: skreuzer
Differential Revision: https://reviews.freebsd.org/D14922

6 years agoBring some order to horizontal and vertical spacing in hier(7).
Edward Tomasz Napierala [Mon, 2 Apr 2018 21:33:16 +0000 (21:33 +0000)]
Bring some order to horizontal and vertical spacing in hier(7).

MFC after: 2 weeks

6 years agoEnsure the background laundering threshold is positive after a scan.
Mark Johnston [Mon, 2 Apr 2018 15:07:41 +0000 (15:07 +0000)]
Ensure the background laundering threshold is positive after a scan.

The division added in r331732 meant that we wouldn't attempt a
background laundering until at least v_free_target - v_free_min clean
pages had been freed by the page daemon since the last laundering. If
the inactive queue is depleted but not completely empty (e.g., because
it contains busy pages), it can thus take a long time to meet this
threshold. Restore the pre-r331732 behaviour of using a non-zero
background laundering threshold if at least one inactive queue scan has
elapsed since the last attempt at background laundering.

Submitted by: tijl (original version)

6 years agounify amd64 and i386 cpu_reset() in x86/cpu_machdep.c
Andriy Gapon [Mon, 2 Apr 2018 13:45:23 +0000 (13:45 +0000)]
unify amd64 and i386 cpu_reset() in x86/cpu_machdep.c

Because I didn't see any reason not too.
I've been making some changes to the code and couldn't help but notice
that the i386 and am64 code was nearly identical.

MFC after: 17 days

6 years agoAdd the missing header for malloc(9). It was pulled in through header
Andrew Turner [Mon, 2 Apr 2018 13:36:48 +0000 (13:36 +0000)]
Add the missing header for malloc(9). It was pulled in through header
pollution that doesn't seem to exist in some configurations.

6 years agox86 cpu_reset: if failed to switch to BSP proceed to cpu_reset_real
Andriy Gapon [Mon, 2 Apr 2018 08:06:18 +0000 (08:06 +0000)]
x86 cpu_reset: if failed to switch to BSP proceed to cpu_reset_real

If cpu_reset() is called on an AP and if it somehow fails to wake the
BSP, then it's better to attempt the reset on the AP than just sit there
spinning on an unusable and undebuggable system.

MFC after: 16 days

6 years agox86 cpu_reset_proxy: no need to stop_cpus() the original processor
Andriy Gapon [Mon, 2 Apr 2018 07:45:13 +0000 (07:45 +0000)]
x86 cpu_reset_proxy: no need to stop_cpus() the original processor

The processor is "parked" in a spin-loop already and that's sufficient
for the reset.  There is nothing that stop_cpus() would add here, only
extra complexity and fragility.
The original processor does not need to enable interrupts now, in fact,
it must not do that.

MFC after: 2 weeks

6 years agoUse UMA_SLAB_SPACE macro. No functional change here.
Gleb Smirnoff [Mon, 2 Apr 2018 05:15:25 +0000 (05:15 +0000)]
Use UMA_SLAB_SPACE macro. No functional change here.

6 years agoIn uma_startup_count() handle special case when zone will fit into
Gleb Smirnoff [Mon, 2 Apr 2018 05:14:31 +0000 (05:14 +0000)]
In uma_startup_count() handle special case when zone will fit into
single slab, but with alignment adjustment it won't. Again, when
there is only one item in a slab alignment can be ignored. See
previous revision of this file for more info.

PR: 227116

6 years agoHandle a special case when a slab can fit only one allocation,
Gleb Smirnoff [Mon, 2 Apr 2018 05:11:59 +0000 (05:11 +0000)]
Handle a special case when a slab can fit only one allocation,
and zone has a large alignment. With alignment taken into
account uk_rsize will be greater than space in a slab. However,
since we have only one item per slab, it is always naturally
aligned.

Code that will panic before this change with 4k page:

z = uma_zcreate("test", 3984, NULL, NULL, NULL, NULL, 31, 0);
uma_zalloc(z, M_WAITOK);

A practical scenario to hit the panic is a machine with 56 CPUs
and 2 NUMA domains, which yields in zone size of 3984.

PR: 227116
MFC after: 2 weeks

6 years agoFix the build on arches with default unsigned char. Capture the fubyte()
Ian Lepore [Sun, 1 Apr 2018 18:53:27 +0000 (18:53 +0000)]
Fix the build on arches with default unsigned char.  Capture the fubyte()
return value in an int as well as the char, and test the full int value
for fubyte() failure.

6 years agoAdd opt_platform.h for several modules that have #ifdef FDT in the source.
Ian Lepore [Sun, 1 Apr 2018 18:22:24 +0000 (18:22 +0000)]
Add opt_platform.h for several modules that have #ifdef FDT in the source.

Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com>

6 years agoAdd a uma cache of free pages in the DEFAULT freepool. This gives us
Jeff Roberson [Sun, 1 Apr 2018 04:50:05 +0000 (04:50 +0000)]
Add a uma cache of free pages in the DEFAULT freepool.  This gives us
per-cpu alloc and free of pages.  The cache is filled with as few trips
to the phys allocator as possible by the use of a new
vm_phys_alloc_npages() function which allocates as many as N pages.

This code was originally by markj with the import function rewritten by
me.

Reviewed by: markj, kib
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14905

6 years agoAdd the flag ZONE_NOBUCKETCACHE. This flag instructions UMA not to keep
Jeff Roberson [Sun, 1 Apr 2018 04:47:05 +0000 (04:47 +0000)]
Add the flag ZONE_NOBUCKETCACHE.  This flag instructions UMA not to keep
a cache of fully populated buckets.  This will be used in a follow-on
commit.

The flag idea was originally from markj.

Reviewed by: markj, kib
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon

6 years agolualoader: Don't try to lookup a nil logo
Kyle Evans [Sun, 1 Apr 2018 01:21:00 +0000 (01:21 +0000)]
lualoader: Don't try to lookup a nil logo

6 years agolualoader: Split logodefs out into logo-* files
Kyle Evans [Sun, 1 Apr 2018 01:07:15 +0000 (01:07 +0000)]
lualoader: Split logodefs out into logo-* files

This commit splits all of the logodefs/graphics out into their own own files
and provides a method for these files to register their logodefs with the
drawer. Graphics are now loaded on demand if they don't exist in the current
set of logodefs.

The drawer module becomes a little easier to navigate through without all of
the graphics mixed in. It's also easy to do one-off graphics like the
9.2 Die Hard tribute by dteske@ without adding even more to our memory
requirements.

6 years agoThe Uninorth ID was really for Uninorth 2.
Warner Losh [Sun, 1 Apr 2018 00:25:47 +0000 (00:25 +0000)]
The Uninorth ID was really for Uninorth 2.

Submitted by: Sevan Janiyan
Differential Revision: https://reviews.freebsd.org/D14919

6 years agolualoader: Simplify some expressions
Kyle Evans [Sun, 1 Apr 2018 00:22:51 +0000 (00:22 +0000)]
lualoader: Simplify some expressions

- No need for a 'goto' when our entire loop body is then wrapped in a
  conditional.

- No need to leave commented out prints laying around

- If an expression is clearly going to be either nil or an expression that
  isn't likely to be a boolean, we might as well use `or` to specify a
  default value for the expression. e.g. `loader.getenv(...) or "no"`

6 years agolualoader: revert whitespace change that snuck in
Kyle Evans [Sat, 31 Mar 2018 23:50:20 +0000 (23:50 +0000)]
lualoader: revert whitespace change that snuck in

6 years agolualoader: Don't assume that {module}_load is set
Kyle Evans [Sat, 31 Mar 2018 23:49:00 +0000 (23:49 +0000)]
lualoader: Don't assume that {module}_load is set

The previous iteration of this assumed that {module}_load was set. In the
old world order of default loader.conf(5), this was probably a safe
assumption given that we had almost every module explicitly not-loaded in
it.

In the new world order, this is no longer the case, so one could delete a
_load line inadvertently while leaving a _name, _type, _flags, _before,
_after, or _error. This would have caused a confusing Lua error and borked
module loading.

6 years agolualoader: Do case-insensitive comparison of "yes"
Kyle Evans [Sat, 31 Mar 2018 23:40:05 +0000 (23:40 +0000)]
lualoader: Do case-insensitive comparison of "yes"

6 years agoDon't verify td_locks accounting after a panic.
Mark Johnston [Sat, 31 Mar 2018 23:24:28 +0000 (23:24 +0000)]
Don't verify td_locks accounting after a panic.

Reported by: pho
X-MFC with: r331738

6 years agofwohcireg.h is 99% the same between the boot loader and the
Warner Losh [Sat, 31 Mar 2018 22:02:59 +0000 (22:02 +0000)]
fwohcireg.h is 99% the same between the boot loader and the
kernel. Delete it and fix up the 1% difference because there's no need
for them to be different.

6 years agoFix memory leaks in route(8).
Alexander V. Chernikov [Sat, 31 Mar 2018 15:06:14 +0000 (15:06 +0000)]
Fix memory leaks in route(8).

Submitted by: Tom Rix (trix_juniper.net)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9676

6 years agoSynchronise with NetBSD's version of EFI handling for El Torito images.
Benno Rice [Sat, 31 Mar 2018 15:04:41 +0000 (15:04 +0000)]
Synchronise with NetBSD's version of EFI handling for El Torito images.

When I implemented my EFI support I failed to check if the upstream version
of makefs in NetBSD had done the same. Override my version with theirs to
make it easier to stay in sync with them in the future.

Reviewed by: imp, mav
Obtained from: NetBSD
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14913

6 years agoRemove MK_AUTO_OBJ from env passed to PORTS_MODULES
Jason A. Harmening [Sat, 31 Mar 2018 05:17:12 +0000 (05:17 +0000)]
Remove MK_AUTO_OBJ from env passed to PORTS_MODULES

This fixes a failure to resolve object file paths seen when buildkernel
(which sets MK_AUTO_OBJ=yes) and installkernel (which sets MK_AUTO_OBJ=no)
are run as separate steps.  r329232 partially fixed this scenario by removing
MAKEOBJDIR, but it seems the AUTO_OBJ setting also needs to be on the same
page for the build and install steps.

Reviewed by: bdrewery
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14143

6 years agoDocument and enforce assumptions about struct (in6_)ifreq.
Brooks Davis [Fri, 30 Mar 2018 21:38:53 +0000 (21:38 +0000)]
Document and enforce assumptions about struct (in6_)ifreq.

- The two types must be type-punnable for shared members of ifr_ifru.
  This allows compatibility accessors to be shared.

- There must be no padding gap between ifr_name and ifr_ifru.  This is
  assumed in tcpdump's use of SIOCGIFFLAGS output which attempts to be
  broadly portable.  This is true for all current architectures, but very
  large (256-bit) fat-pointers could violate this invariant.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14910

6 years agoAdd deprecation notices for Arcnet and FDDI drivers.
Brooks Davis [Fri, 30 Mar 2018 20:27:47 +0000 (20:27 +0000)]
Add deprecation notices for Arcnet and FDDI drivers.

We intend to remove support before FreeBSD 12 is branched.

Reviewed by: imp, emaste
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14890

6 years agoFall back to ether_ioctl() by default.
Brooks Davis [Fri, 30 Mar 2018 20:24:29 +0000 (20:24 +0000)]
Fall back to ether_ioctl() by default.

The common pratice in ethernet device drivers is to fall back to
ether_ioctl() to implement generic ioctls not implemented by the driver
and to fail if no handler exists.

Convert these drivers to follow that practice rather than calling
ether_ioctl() for specific cases.

vxge(4) aready had the default case, but it was only called on failure
to match.

Reviewed by: imp
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14895

6 years agoOptimise use of Giant in the LinuxKPI.
Hans Petter Selasky [Fri, 30 Mar 2018 20:11:12 +0000 (20:11 +0000)]
Optimise use of Giant in the LinuxKPI.

- Make sure Giant is locked when calling PCI device methods.
Newbus currently requires this.

- Avoid unlocking Giant right before aquiring the sleepqueue lock.
This can save a task switch.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRemove unused structure field in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:58:58 +0000 (19:58 +0000)]
Remove unused structure field in mlx5core.

MFC after: 3 days
Sponsored by: Mellanox Technologies

6 years agoBump mlx5core driver version.
Hans Petter Selasky [Fri, 30 Mar 2018 19:55:31 +0000 (19:55 +0000)]
Bump mlx5core driver version.

MFC after: 3 days
Sponsored by: Mellanox Technologies

6 years agoFix for use after free in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:50:45 +0000 (19:50 +0000)]
Fix for use after free in mlx5core.

Make sure the command completion handler is not called when the device is
in internal error state. This can easily trigger use after free situations.

MFC after: 3 days
Sponsored by: Mellanox Technologies

6 years agoMake sure Giant is locked when allocating bus resources in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:49:35 +0000 (19:49 +0000)]
Make sure Giant is locked when allocating bus resources in mlx5core.

During health care IRQ resources will be reallocated.
Newbus requires that Giant is locked before accessing
these resources.

MFC after: 3 days
Sponsored by: Mellanox Technologies

6 years agoCollect firmware dump when mlx5core is in device error state.
Hans Petter Selasky [Fri, 30 Mar 2018 19:48:25 +0000 (19:48 +0000)]
Collect firmware dump when mlx5core is in device error state.

Firmware dump collecting should be triggered in case firmware syndrome
with request for reset bit is set.

MFC after: 3 days
Submitted by: slavash@
Sponsored by: Mellanox Technologies

6 years agoReorganize health recovery in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:45:48 +0000 (19:45 +0000)]
Reorganize health recovery in mlx5core.

- Move the semaphore locking and unlocking to the same function.
- Flags are no longer needed if the reset and crdump will be done in the
  same function.

MFC after: 3 days
Submitted by: slavash@
Sponsored by: Mellanox Technologies

6 years agoPrepare for FW dump in error state in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:43:15 +0000 (19:43 +0000)]
Prepare for FW dump in error state in mlx5core.

- Move firmware dump prep and cleanup to init_one() and remove_one() so that
the init and cleanup will happen only upon driver reload.
- Add some prints to indicate firmware dump.

MFC after: 3 days
Submitted by: slavash@
Sponsored by: Mellanox Technologies

6 years agoProperly check if crspace is supported in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:39:27 +0000 (19:39 +0000)]
Properly check if crspace is supported in mlx5core.

The old code checked for MLX5_CR_SPACE_DOMAIN which is irrelevant here.
However, if dev->vsec_addr would be 0, an access to wrong offset would
happen.

MFC after: 3 days
Submitted by: slavash@
Sponsored by: Mellanox Technologies

6 years agoAdd missing newline character in print in mlx5core.
Hans Petter Selasky [Fri, 30 Mar 2018 19:35:31 +0000 (19:35 +0000)]
Add missing newline character in print in mlx5core.

MFC after: 3 days
Submitted by: slavash@
Sponsored by: Mellanox Technologies

6 years agoAdd logic for "families" for GCE images.
Glen Barber [Fri, 30 Mar 2018 19:08:37 +0000 (19:08 +0000)]
Add logic for "families" for GCE images.

This allows for GCE consumers to easily detect the latest major
version of FreeBSD when using the gcloud command line utility.

To ensure snapshot builds do not conflict with release-style
builds (ALPHA, BETA, RC, RELEASE), the '-snap' suffix is appended
to the GCE image family name.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoUse an accessor function to access ifr_data.
Brooks Davis [Fri, 30 Mar 2018 18:50:13 +0000 (18:50 +0000)]
Use an accessor function to access ifr_data.

This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size).  This is believed to be sufficent to
fully support ifconfig on 32-bit systems.

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

6 years agoRemove a comment that suggests checking that a non-pointer is non-NULL.
Brooks Davis [Fri, 30 Mar 2018 18:26:29 +0000 (18:26 +0000)]
Remove a comment that suggests checking that a non-pointer is non-NULL.

Reviewed by: melifaro, markj, hrs, ume
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14904

6 years agoocs_fc(4): Fix GCC build (-Wredundant-decls)
Conrad Meyer [Fri, 30 Mar 2018 16:44:54 +0000 (16:44 +0000)]
ocs_fc(4): Fix GCC build (-Wredundant-decls)

These objects are defined earlier in the same file; an extern declaration
after definition is redundant.

Broken in r331766 (introduction of ocs_fc(4)).

Sponsored by: Dell EMC Isilon

6 years agoefinet: Do not return only if ReceiveFilter fails
Emmanuel Vadot [Fri, 30 Mar 2018 16:37:08 +0000 (16:37 +0000)]
efinet: Do not return only if ReceiveFilter fails

If the network interface or the uefi implementation do not support the
ReceiveFilter interface do not return only and just print a message.
U-Boot doesn't support is and likely never will. Also even if this fails
it doesn't mean that network in EFI isn't supported.

6 years agoBring in the Broadcom/Emulex Fibre Channel driver, ocs_fc(4).
Kenneth D. Merry [Fri, 30 Mar 2018 15:28:25 +0000 (15:28 +0000)]
Bring in the Broadcom/Emulex Fibre Channel driver, ocs_fc(4).

The ocs_fc(4) driver supports the following hardware:

Emulex 16/8G FC GEN 5 HBAS
LPe15004 FC Host Bus Adapters
LPe160XX FC Host Bus Adapters

Emulex 32/16G FC GEN 6 HBAS
LPe3100X FC Host Bus Adapters
LPe3200X FC Host Bus Adapters

The driver supports target and initiator mode, and also supports FC-Tape.

Note that the driver only currently works on little endian platforms.  It
is only included in the module build for amd64 and i386, and in GENERIC
on amd64 only.

Submitted by: Ram Kishore Vegesna <ram.vegesna@broadcom.com>
Reviewed by: mav
MFC after: 5 days
Relnotes: yes
Sponsored by: Broadcom
Differential Revision: https://reviews.freebsd.org/D11423

6 years agoFix missing n after \ of Eric Turgeon entry
Eric Turgeon [Fri, 30 Mar 2018 14:41:16 +0000 (14:41 +0000)]
Fix missing n after \ of Eric Turgeon entry

Approved by: bapt (mentor)

6 years agoAdding Eric Turgeon (ericbsd) to calendar.freebsd
Eric Turgeon [Fri, 30 Mar 2018 13:37:33 +0000 (13:37 +0000)]
Adding Eric Turgeon (ericbsd) to calendar.freebsd

Approved by: bapt (mentor)

6 years agoAdd Eric Turgeon (ericbsd) in committers-ports.dot with mentor/mentee.
Eric Turgeon [Fri, 30 Mar 2018 11:30:48 +0000 (11:30 +0000)]
Add Eric Turgeon (ericbsd) in committers-ports.dot with mentor/mentee.

Approved by: bapt (mentor)

6 years agoalign i386 cpu_reset() with amd64 version
Andriy Gapon [Fri, 30 Mar 2018 11:25:30 +0000 (11:25 +0000)]
align i386 cpu_reset() with amd64 version

Maybe this code could be moved to x86.

MFC after: 1 week