]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r319671:
mav [Sat, 17 Feb 2018 23:05:19 +0000 (23:05 +0000)]
MFC r319671:
SHA-512 and Skein have been supported by the boot loader for some time.

6 years agoMFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,
kib [Sat, 17 Feb 2018 18:00:01 +0000 (18:00 +0000)]
MFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,
328166,328177,328199,328202,328205,328468,328470,328624,328625,328627,
328628,329214,329297,329365:

Meltdown mitigation by PTI, PCID optimization of PTI, and kernel use of IBRS
for some mitigations of Spectre.

Tested by:      emaste, Arshan Khanifar <arshankhanifar@gmail.com>
Discussed with: jkim
Sponsored by: The FreeBSD Foundation

6 years agoBump the FreeBSD version after r329383 to indicate that the
hselasky [Sat, 17 Feb 2018 09:58:53 +0000 (09:58 +0000)]
Bump the FreeBSD version after r329383 to indicate that the
cmpxchg() macro is now fully functional in the LinuxKPI.

This is a direct commit.

Sponsored by:   Mellanox Technologies

6 years agoMFC r329264: libsa: Fix IP recv timeout
kevans [Sat, 17 Feb 2018 02:14:01 +0000 (02:14 +0000)]
MFC r329264: libsa: Fix IP recv timeout

[This is slightly modified to not set `t` in the middle of the loop so that
the connection will eventually timeout after MAXTMO]

readip() doesn't, at the moment, properly indicate to callers that it has
timed out. One can tell that it's timed out if errno == EAGAIN when it
returns, but this is not ideal. Restructure it a little bit to explicitly
set errno to ETIMEDOUT if we've exhausted tleft.

I found two places that care about where it timed out or not: sendrecv in
net.c and sendrecv_tftp. Both are structured to pass smaller timeout values
to readip while tracking a larger timeout. Neither of them were able to do
this properly with readip not indicating ETIMEDOUT, so fix it.

While here, straighten out the time (t/t1) usage in sendrecv_tftp.

This would have manifested itself in periodic failures to NFS/TFTP boot for
no apparent reason because MINTMO/MAXTMO were not actually being respected
properly. Problems were not reported with NFS, only TFTP.

6 years agoMFC r329009
brd [Fri, 16 Feb 2018 18:49:50 +0000 (18:49 +0000)]
MFC r329009

mountd(8): Produce vaguely meaningful error messages

Approved by: cem, will

6 years agoiw_cxgbe: Follow-up fix to r329017, which updated the code associated
np [Fri, 16 Feb 2018 18:23:27 +0000 (18:23 +0000)]
iw_cxgbe:  Follow-up fix to r329017, which updated the code associated
with QP flush.

This is a direct commit to stable/11.

Sponsored by: Chelsio Communications

6 years agoMFC r315718, r316031:
markj [Fri, 16 Feb 2018 16:41:19 +0000 (16:41 +0000)]
MFC r315718, r316031:
Add support for 8- and 16-bit atomic_(f)cmpset to x86.

6 years agoMFC r324610:
mjg [Fri, 16 Feb 2018 16:16:33 +0000 (16:16 +0000)]
MFC r324610:

    Reduce traffic on vm_cnt.v_free_count

    The variable is modified with the highly contended page free queue lock.
    It unnecessarily shares a cacheline with purely read-only fields and is
    re-read after the lock is dropped in the page allocation code making the
    hold time longer.

    Pad the variable just like the others and store the value as found with
    the lock held instead of re-reading.

    Provides a modest 1%-ish speed up in concurrent page faults.

Due to KBI constraints the field is not moved in this commit, only re-read is
avoided.

6 years agoMFC r327875,r327905,r327914:
mjg [Fri, 16 Feb 2018 16:07:58 +0000 (16:07 +0000)]
MFC r327875,r327905,r327914:

    mtx: use fcmpset to cover setting MTX_CONTESTED

===

    rwlock: try regular read unlock even in the hard path

    Saves on turnstile trips if the lock got more readers.

===

    sx: retry hard shared unlock just like in r327905 for rwlocks

6 years agoMFC r327874:
mjg [Fri, 16 Feb 2018 16:05:02 +0000 (16:05 +0000)]
MFC r327874:

    vfs: tidy up vdrop

    Skip vfs_refcount_release_if_not_last if the interlock is held and just
    go straight to refcount_release.

    While here do cosmetic rearrangement of _vhold to better show it contains
    equivalent behaviour.

6 years agoMFC 318090,319475: Use const with some read-only buffers in opencrypto APIs.
jhb [Thu, 15 Feb 2018 21:27:24 +0000 (21:27 +0000)]
MFC 318090,319475: Use const with some read-only buffers in opencrypto APIs.

318090:
Use const with some read-only buffers in opencrypto APIs.

- Mark the source buffer for a copyback operation as const in the kernel
  API.
- Use const with input-only buffers in crypto ioctl structures used with
  /dev/crypto.

319475:
Fix some new errors and a warning in cryptotest.

- Use a new 'char *key' to allocate storage for keys and assign the
  pointer to the session2_op 'const char *' members after the key is
  initialized.
- Mark the 'find' variable used in crfind() static so that crfind()
  doesn't return a pointer to stack garbage.

Sponsored by: Chelsio Communications

6 years agoMFC r328622: vmm/svm: post LAPIC interrupts using event injection
avg [Thu, 15 Feb 2018 17:09:48 +0000 (17:09 +0000)]
MFC r328622: vmm/svm: post LAPIC interrupts using event injection

PR: 215972

6 years agoMFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing
avg [Thu, 15 Feb 2018 15:33:17 +0000 (15:33 +0000)]
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected.  A new disk(9) flag is added to mark write protected
disks.  A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page.  We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037

6 years agoMFC r323350:
hselasky [Thu, 15 Feb 2018 09:12:07 +0000 (09:12 +0000)]
MFC r323350:
Remove unsafe access to the LinuxKPI file structure from ibcore.
selwakeup() is now done by the wake_up() family of functions.

Sponsored by: Mellanox Technologies

6 years agoMFC r325637:
hselasky [Thu, 15 Feb 2018 09:09:42 +0000 (09:09 +0000)]
MFC r325637:
Mark ipoib device as initialized on device open.

Set the IPOIB_FLAG_INITIALIZED on dev_open and clear it on dev_stop to
avoid a race between ipoib load and the underlying device driver.

The device module must dispatch the IB_EVENT_PORT_ACTIVE event before ipoib
module is loaded. Otherwise, the flush will fail since no one set the
IPOIB_FLAG_INITIALIZED.

Submitted by: Slava Shwartsman <slavash@mellanox.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r325805:
hselasky [Thu, 15 Feb 2018 09:07:37 +0000 (09:07 +0000)]
MFC r325805:
Set the default VNET in krping before calling ifunit_ref(). Else using IPv6
link-local addresses when VIMAGE is enabled will cause a so-called NULL
pointer dereferencing issue.

Sponsored by: Mellanox Technologies

6 years agoMFC r325806:
hselasky [Thu, 15 Feb 2018 09:05:29 +0000 (09:05 +0000)]
MFC r325806:
Make sure a valid VNET is set before trying to access the V_ip6_v6only
variable. Access the variable directly instead of going through the sysctl()
interface in the kernel.

Sponsored by: Mellanox Technologies

6 years agoMFC r325807:
hselasky [Thu, 15 Feb 2018 09:04:06 +0000 (09:04 +0000)]
MFC r325807:
Make sure the ib_wr_opcode enum is signed by adding a negative dummy element.
Different compilers may optimise the enum type in different ways. This ensures
coherency when range checking the value of enums in ibcore.

Sponsored by: Mellanox Technologies

6 years agoMFC r325724:
hselasky [Thu, 15 Feb 2018 09:00:11 +0000 (09:00 +0000)]
MFC r325724:
Implement missing KDGETMODE IOCTL in VT.

Obtained from: Johannes Lundberg <yohanesu75@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r328163:
hselasky [Thu, 15 Feb 2018 08:56:03 +0000 (08:56 +0000)]
MFC r328163:
Add new USB ID to U3G driver.

PR: 134299
Sponsored by: Mellanox Technologies

6 years agoMFC r328830:
hselasky [Thu, 15 Feb 2018 08:50:43 +0000 (08:50 +0000)]
MFC r328830:
Add new USB ID.

PR: 225641
Submitted by: Ryan <ryanwinter@outlook.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r328591:
hselasky [Thu, 15 Feb 2018 08:46:20 +0000 (08:46 +0000)]
MFC r328591:
Move the mlx5 core device pointer first in the mlx5en priv. This help simplify
checks to recognize own network devices when using mlx5ib. This patch fixes
an issues where mlx5ib fails to recognize mceX network devices for use with
RoCE.

Sponsored by: Mellanox Technologies

6 years agoMFC r328774:
hselasky [Thu, 15 Feb 2018 08:43:23 +0000 (08:43 +0000)]
MFC r328774:
Slightly bump the maximum OID path for loading tunable SYSCTLs.

Coming updates to the mlx5en(4) driver will require this.

Sponsored by: Mellanox Technologies

6 years agoMFC r327444, r327449, r327454
gonzo [Wed, 14 Feb 2018 23:51:44 +0000 (23:51 +0000)]
MFC r327444, r327449, r327454

r327444:
vt(4): add support for configurable console palette

Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a
number from 0 to 15. The value is either comma-separated list decimal
numbers ranging from 0 to 255 that represent values of red, green, and
blue components respectively (i.e. "128,128,128") or 6-digit hex triplet
commonly used to represent colors in HTML or xterm settings (i.e. #808080)

Each tunable overrides one of the 16 hardcoded palette codes and can be set
in loader.conf(5)

Reviewed by: bcr(docs), jilles, manu, ray
Differential Revision: https://reviews.freebsd.org/D13645

r327449:
Unbreak build broken by r327444

During review iterations function signature has changed in definition
but not in actual call. Fix call to match the definition.

Reported by: Herbert J. Skuhra
Pointyhat to: gonzo

r327454:
Fix GCC build broken by r32744

Indicate in function declaration that vt_palette_init does not take any arguments

6 years agoMFC r320387:
gonzo [Wed, 14 Feb 2018 21:39:10 +0000 (21:39 +0000)]
MFC r320387:

[arm] Use correct index value when checking range validity

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D9145

6 years agoMFC r314933-r314934
gonzo [Wed, 14 Feb 2018 21:14:28 +0000 (21:14 +0000)]
MFC r314933-r314934

r314933:
[spigen] make spigen device ready to be compiled as a module

- Add flag to indicate that device is opened by userland
- Replace "always fail" detach method with proper detach implementation

r314934:
[spigen] Add spigen module

spigen provides userland API to SPI bus. Make it available as a loadable
module so people using official ARM images can enabled it on devices like
BBB or RPi without re-building kernel

6 years agoMFC r308895 by manu:
gonzo [Wed, 14 Feb 2018 20:01:39 +0000 (20:01 +0000)]
MFC r308895 by manu:

Enable the use of spigen on FDT platform

6 years agoMFC r325321:
skra [Wed, 14 Feb 2018 15:14:20 +0000 (15:14 +0000)]
MFC r325321:

  Take into account race conditions in case of accessed or modified bit
  emulation in fast path of data/prefetch abort common routine. Process these
  bits only if related page table entries are consistent with provided abort
  info. In case of inconsistency, do nothing and let processor to signal new
  abort if still needed.

6 years agoAdd DT_VERS_1_13 to libdtrace to unbreak the build.
markj [Wed, 14 Feb 2018 14:29:11 +0000 (14:29 +0000)]
Add DT_VERS_1_13 to libdtrace to unbreak the build.

This is a direct commit to stable/11.

PR: 225889

6 years agoMFC r328971:
hselasky [Wed, 14 Feb 2018 09:53:23 +0000 (09:53 +0000)]
MFC r328971:
Fix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to
actually return the computed result instead of the input value.

This is a regression issue after r289572.

Found by: gcc6
Sponsored by: Mellanox Technologies

6 years agoMFC r328995:
markj [Wed, 14 Feb 2018 00:32:19 +0000 (00:32 +0000)]
MFC r328995:
Fix the WITH_SORT_THREADS build.

PR: 201664

6 years agoMFC r312667 (by pfg):
markj [Wed, 14 Feb 2018 00:31:37 +0000 (00:31 +0000)]
MFC r312667 (by pfg):
sort - Don't live-loop threads.

6 years agoMFC r327888, r327972, r327973:
markj [Tue, 13 Feb 2018 22:43:07 +0000 (22:43 +0000)]
MFC r327888, r327972, r327973:
Add "jid" and "jailname" variables to DTrace.

6 years agoMFC r328052: kldxref: handle modules with md_cval at end of allocated secs
emaste [Tue, 13 Feb 2018 22:40:33 +0000 (22:40 +0000)]
MFC r328052: kldxref: handle modules with md_cval at end of allocated secs

Attempting to retrieve an md_cval string from a kernel module with
kldxref would throw a offset error for modules created using lld, since
this value would be placed at the end of all allocated sections.

Add an ef_read_seg_string method to the ef interface, to allow reading
strings of varying size without attempting to read beyond the segment's
bounds.

PR: 224875
Submitted by: Mitchell Horne <mhorne063@gmail.com>
Sponsored by: The FreeBSD Foundation

6 years agoMFC r327503: kldxref: correct function names in warning messages
emaste [Tue, 13 Feb 2018 22:37:54 +0000 (22:37 +0000)]
MFC r327503: kldxref: correct function names in warning messages

Sponsored by: The FreeBSD Foundation

6 years agoMFC: r329022
jkim [Tue, 13 Feb 2018 21:14:27 +0000 (21:14 +0000)]
MFC: r329022

Remove an empty directory.

6 years agoMFC: r329024
jkim [Tue, 13 Feb 2018 21:11:27 +0000 (21:11 +0000)]
MFC: r329024

Remove c_rehash(1) to not confuse users.

6 years agoMFC 328917:
bryanv [Tue, 13 Feb 2018 15:55:31 +0000 (15:55 +0000)]
MFC 328917:

Correct structure name used in bus_map_resource(9) example

6 years agoMFC r325654:
hselasky [Tue, 13 Feb 2018 15:18:11 +0000 (15:18 +0000)]
MFC r325654:
Add API functions to modify the transport interface send object, TIS,
in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325658:
hselasky [Tue, 13 Feb 2018 15:16:10 +0000 (15:16 +0000)]
MFC r325658:
Make physical address of init segment available in the priv of mlx5 core.
This change is needed by mlx5ib(4).

Sponsored by: Mellanox Technologies

6 years agoMFC r325652:
hselasky [Tue, 13 Feb 2018 15:14:32 +0000 (15:14 +0000)]
MFC r325652:
Prevent mlx5 core from accessing host memory after shutdown by disabling
PCI busmaster.

Sponsored by: Mellanox Technologies

6 years agoMFC r325651:
hselasky [Tue, 13 Feb 2018 15:13:15 +0000 (15:13 +0000)]
MFC r325651:
Set ATOMIC endian mode in mlx5 core.

The hardware is capable of 2 requestor endianness modes for standard 8
byte atomics: BE (0x0) and host endianness (0x1). Read the supported
modes from hca atomic capabilities and configure HW to host endianness
mode if supported.

Sponsored by: Mellanox Technologies

6 years agoMFC r325649:
hselasky [Tue, 13 Feb 2018 15:11:00 +0000 (15:11 +0000)]
MFC r325649:
Make local variable 64-bits to avoid masking away bits in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325653:
hselasky [Tue, 13 Feb 2018 15:09:03 +0000 (15:09 +0000)]
MFC r325653:
Add API functions to set and query dropless port mode in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325650:
hselasky [Tue, 13 Feb 2018 15:07:39 +0000 (15:07 +0000)]
MFC r325650:
Add const keyword to input-only argument in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325648:
hselasky [Tue, 13 Feb 2018 15:05:23 +0000 (15:05 +0000)]
MFC r325648:
Implement support for decoding general port notification event in
the mlx5 core module.

Sponsored by: Mellanox Technologies

6 years agoMFC r325662:
hselasky [Tue, 13 Feb 2018 14:57:34 +0000 (14:57 +0000)]
MFC r325662:
Add more and update existing mlx5 core firmware structure definitions and bits.
This change is part of coming ibcore and mlx5ib updates.

Sponsored by: Mellanox Technologies

6 years agoMFC r325657:
hselasky [Tue, 13 Feb 2018 14:47:44 +0000 (14:47 +0000)]
MFC r325657:
Add API function to query port performance counters for infiniband and RoCE
traffic in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325656:
hselasky [Tue, 13 Feb 2018 14:46:29 +0000 (14:46 +0000)]
MFC r325656:
Add API functions to query and modify local loopback of multicast and
unicast traffic in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325655:
hselasky [Tue, 13 Feb 2018 14:45:05 +0000 (14:45 +0000)]
MFC r325655:
Add API function to query virtual port counters in mlx5 core.

Sponsored by: Mellanox Technologies

6 years agoMFC r325638 and r325976:
hselasky [Tue, 13 Feb 2018 14:37:21 +0000 (14:37 +0000)]
MFC r325638 and r325976:
Refactor the flowsteering APIs used by mlx5en(4). This change is needed by
the coming ibcore and mlx5ib updates in order to support traffic redirection
to so-called raw ethernet QPs.

Remove unused E-switch related routines and files while at it.

Sponsored by: Mellanox Technologies

6 years agoMFC r328913:
kib [Tue, 13 Feb 2018 12:54:03 +0000 (12:54 +0000)]
MFC r328913:
Move signal trampolines out of locore.s into separate source file.

6 years agostand: Clean up some unintentional inconsistencies
kevans [Tue, 13 Feb 2018 04:28:13 +0000 (04:28 +0000)]
stand: Clean up some unintentional inconsistencies

This is a direct commit to stable/11 to address the following final
unintended inconsistencies between stable/11 and head:

- Some unused LIBSTAND= cruft left in efi/loader/Makefie
- A comment that flew in with unrelated changes
- An #include that may go away now that stand is basically self-contained

6 years agoRevert MFC r328911 from r329183
kevans [Tue, 13 Feb 2018 04:10:10 +0000 (04:10 +0000)]
Revert MFC r328911 from r329183

jhb@ had specified an MFC timer of 1-month, and I clobbered his efforts by
MFC'ing it way prematurely. Back out that part of r329183 so it may be MFC'd
when jhb is ready.

6 years agoMFC r328937: Fix queue length reporting in mps(4) and mpr(4).
mav [Tue, 13 Feb 2018 02:11:39 +0000 (02:11 +0000)]
MFC r328937: Fix queue length reporting in mps(4) and mpr(4).

Both drivers were found to report CAM bigger queue depth then they really
can handle.  It made them later under high load with many disks return
some of submitted requests back with CAM_REQUEUE_REQ status for later
resubmission.

6 years agoMFC Loader Fixes Final: r327612,r327703,r327704,r327878,r327879,r327881,
kevans [Mon, 12 Feb 2018 20:51:28 +0000 (20:51 +0000)]
MFC Loader Fixes Final: r327612,r327703,r327704,r327878,r327879,r327881,
r328007,r328029,r328030,r328031,r328061,r328156,r328169,r328288,r328289,
r328290,r328291,r328292,r328411,r328536,r328603,r328614,r328642,r328769,
r328779,r328780,r328781,r328782,r328783,r328806,r328808,r328826,r328835,
r328911,r328986,r328987,r328990,r328999,r329000,r329019,r329050,r329054,
r329060

r327612: Invent new #defines for the biospci_{read,write}_config function

r327703: Define __dmadat after #include'ing ufsread.c.

r327704: Fix printf missing format variables warnings.

r327878: Add GUID for UEFI boot manager variables.

r327879: Report the boot order and where we are in that boot order.

r327881: Allow this file to be included

r328007: Fix booting on some arm64 systems after r327879 by fixing the call
to utf8_to_ucs2

r328029: When returning an error and freeing allocated memory from
ucs2_to_utf8, NULL the return pointer.

r328030: Check the return value from utf8_to_ucs2 instead of whether or not
uv is NULL.

r328031: Need to free uv after we're done using it.

r328061: utf8_to_ucs2() should check for malloc failure

r328156: stand: Move sections around to fix stand/ build with ld.lld on
armv7

r328169: Remove extra copy of bootinfo.c. It's a bit rotted copy of the one
in efi/loader.

r328288: Fix some resource leaks.

r328289: Don't leak memory when displaying help.

r328290: On malloc failure, be sure to close the include file that triggered
it.

r328291: getenv does not return tainted data in the boot loader. Attempt to
clue Coverity into that fact.

r328292: There's no tainted data here, tag it as such to avoid false
positives.

r328411: loader.efi: add missing EFI GUIDs

r328536: loader: support for mixed-endianness ELF/loader and POWER8

r328603: Add missing non-POWERPC case to give the scr value something
non-zero.

r328614: Move libstand.3 to libsa.3. Update libsa.3 to include functions

r328642: Break out the interpreters (simple and forth) w/o ifdefs.

r328769: Centralize several variables.

r328779: Retire pnp.4th and the code needed only for 4th words used here.

r328780: These 4th words were an attempt to allow integration into the boot
loader scripts. However, that path won't be taken after all it
seems.

r328781: Remove pcibios forth support.

r328782: Now that we no longer conditionally compile some files outside of
ficl

r328783: Invent new LDR_INTERP for the loader interpreter to use.

r328806: We need more heap space to properly load newer powerpc kernels.

r328808: Implement strcoll as strcmp.

r328826: Make cross-endian loader changes apply only to powerpc

r328835: Fix regression introduced in r328806, preventing boot on many
platforms.

r328911: Ignore relocation tables for non-memory-resident sections.

r328986: Fix relative location of USB sources after recent move.

r328987: A more definitions to kernel emulation shim in order to build
stand/usb.

r328990: Move the stand/usb test loader into its own directory.

r328999: Fix indentation to FreeBSD standard for interp files

r329000: Move simple interpreter 'perform' into interp.c and call it

r329019: Move to tabs for indentation and to 8-space notches, per style(9).

r329050: Fix build of userboot.so

r329054: Set script.lang in the environment to either 'forth' or 'simple' to
reflect what scripting language was compiled into the loader.

r329060: loader: fix endianness conversion

PR: 225323

6 years agoCorrect date in ObsoleteFiles
kevans [Mon, 12 Feb 2018 19:50:43 +0000 (19:50 +0000)]
Correct date in ObsoleteFiles

Getting a little ahead of myself here- correct the date to today.

6 years agoMFC: r328695,r328720,r328784,r328795 share/examples/bhyve/vmrun.sh additions
rgrimes [Mon, 12 Feb 2018 19:08:17 +0000 (19:08 +0000)]
MFC: r328695,r328720,r328784,r328795 share/examples/bhyve/vmrun.sh additions
and cleanups

r328695:
Add option '-n' network device emulation type which has a default
of virtio-net
PR: 225558
Submitted by: Johannes Lundberg <johalun0@gmail.com>

r328720:
Add -n <network device emulation type> to usage synopsis
forgotten in r328695.

Fix long lines in usage.
Consistently use "default:" rather than "default is"

r328784:
Clean up long lines.

r328795:
Fold constants and unify vnc variable names.

Approved by: grehan (mentor)

PR: 225558

6 years agoMFC: r316746 Add UEFI support to vmrun.sh
rgrimes [Mon, 12 Feb 2018 18:52:59 +0000 (18:52 +0000)]
MFC: r316746 Add UEFI support to vmrun.sh

Adds:
 -E: Use UEFI mode
 -f: path to UEFI firmware image (default: path to uefi-edk2-bhyve package)
 -F: UEFI framebuffer size (default: w=1024,h=768)
 -L: IP to listen for VNC connections on (default: 127.0.0.1)
 -P: Port to listen for VNC connections on (default: 5900)
 -T: Enable tablnet device (for VNC)
 -v: Wait for VNC client before booting VM

Submitted by: Shawn Webb <shawn.webb@hardenedbsd.org>
Approved by: grehan(mentor),allanjude(original committer)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D10378

6 years agoMFC r328799:
brooks [Mon, 12 Feb 2018 18:40:19 +0000 (18:40 +0000)]
MFC r328799:

Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32.

Stop leaking kernel pointers though theses sysctls and make sure that the
padding in the structures is zeroed on allocation to avoid other leaks.

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

6 years agoMFC r327705,r328447: Fix BERI bootloader build
kevans [Mon, 12 Feb 2018 18:30:20 +0000 (18:30 +0000)]
MFC r327705,r328447: Fix BERI bootloader build

r327705: Use <stand.h> instead of <inttypes.h> and <stdio.h> in boot code.
r328447: BERI isn't BTX, so we don't have to provide exit().

6 years agoMFC Loader Fixes 2017q4p7: r324844,r326089,r326926,r326440,r326484,r326494,
kevans [Mon, 12 Feb 2018 17:44:35 +0000 (17:44 +0000)]
MFC Loader Fixes 2017q4p7: r324844,r326089,r326926,r326440,r326484,r326494,
r326588,r326708,r326784,r326914,r327390,r328446,r326090,r326143,r326144,
r326182,r326384,r326421,r326440,r326441,r326442,r326443,r326444,r326445,
r326446,r326447,r326448,r326484,r326485,r326486,r326487,r326488,r326490,
r326491,r326492,r326493,r326494,r326495,r326504,r326507,r326509,r326584,
r326585,r326586,r326587,r326588,r326589,r326590,r326591,r326592,r326593,
r326594,r326600,r326616,r326671,r326707,r326708,r326709,r326710,r326711,
r326712,r326714,r326720,r326768,r326772,r326784,r326792,r326812,r326854,
r326855,r326856,r326858,r326886,r326887,r326914,r326926,r326927,r326960,
r326961,r326962,r326963,r327351,r327453,r327390,r327523,r327524,r326489,
r327880,r328437,r328438,r328439,r328441,r328446,r328448,r328449,r328612,
r328613,r328615

While here, undo our libfdt hack of not including <stdlib.h> if we're
compiling _STANDALONE.

r324844: When building standalone, don't define errno. Let the definition from
stand.h override. This is similar to what we do in the kernel.

r326089: loader.efi: efipart does not recognize partitionless disks

r326090: net_parse_rootpath() has no parameters

r326143: Fix theoretical integer overflow issues. If the product here is

r326144: Mark the func pointer as __dead2. It looks up loader_main, which

r326182: Modify all FreeBSD bootloaders on PowerPC AIM (Book-S) systems

r326384: Use const pointers to avoid casting away constness.

r326421: loader.efi: efipart should exclude iPXE stub block protocol

r326440: Remove stale dependency on ufsread.c

r326441: Minor flags cleanup

r326442: Cleanup CFALGS usage here

r326443: We don't need both _STAND and _STANDALONE, use the latter.

r326444: Move geli to common DO32 stuff

r326445: Fix random() and srandom() prototypes to match the standard.

r326446: Undefine _STANDALONE since this is test code.

r326447: Tweaks to the beri boot loader so that it builds w/o warnings.

r326448: Fix all warnings related to geli and ZFS support on x86.

r326484: Const poison the propname.

r326485: Delcare md_load in libofw.h. Make all prototypes match for ofw

r326486: Include machine/md_var to pick up __syncicache prototype.

r326487: Cast mdp (a vm_offset_t) to void * to match prototype.

r326488: e_entry can be smaller than a pointer. Cast it to an intptr_t

r326490: Declare our strange brand of main().

r326491: Disconnet ps3 from the build. There's too many warnings to fix.

r326492: Cast void * pointer to char * so the arg matches the %s format.

r326493: Provide a md_load64 prototype.

r326494: Mark two things as unused (since they are only sometimes used)

r326495: Now it's safe to bump WARNS to 1.

r326504: Switch to proper MK_LOADER_GELI tests.

r326507: increase maximum size of zfsboot

r326509: loader.efi: add note about iPXE into the efipart.c

r326584: When building standalone, include stand.h rather than the kernel

r326585: Include ficl.h before anything else

r326586: No need to include the userland md5.h, the kernel one is just fine.

r326587: Use the kernel relative paths, rather than the userland relative
paths

r326588: Need to include skein in the include path

r326589: Make sure we include the right path for skein.h

r326590: Prefer stdint.h to inttypes.h

r326591: This isn't NetBSD specific code. Include these for any kernel /

r326592: Don't inherit CFLAGS. This a specialized test program.

r326593: Stop building with the standard system headers.

r326594: Now that we offer a semi-sane standards-ish set of #include files,
stop hacking includes with sed.

r326600: Since this is contrib code, create an upstreamable version of my

r326616: dhcp_try_rfc1048() is not used any more

r326671: Avoid setting -Wno-tentative-definition-incomplete-type with gcc.

r326707: Add partial support signal.h functioanlity. Pull in
machine/signal.h

r326708: Remove _KERNEL hack now that errno.h does the right thing when
built standalone.

r326709: Provide implementations for iscntrl, ispunct and isgraph.

r326710: Put the files we're copying over into a few variables and clean
hings up.

r326711: Const poison a couple of interfaces.

r326712: Create interp class.

r326714: boot1.c needs EFI_ZFS_BOOT too, so add it globally.

r326720: This path belongs in ficl/Makefile, not the common defines for
users

r326768: Fix a comment to be more accurate

r326772: Fix regression with lua import

r326784: Revert part of 362772. It was causing problems for includes

r326792: Attempt to unbreak buildworld

r326812: Revert r326792, r326784, r326772, r326712

r326854: libefi: make efichar.h more usable in stand code

r326855: Cargo cut a fix for the regressions r326585 caused.

r326856: Fix comments after bump in size.

r326858: Revert r326855: Cargo cut a fix for the regressions r326585 caused.

r326886: Panic in sbrk if setheap hasn't been called yet. This is preferable
o a mysterious crash

r326887: Remove the 'mini libstand in libstand' that util.[ch] provided.

r326914: Move loader-only defines to loader.mk from defs.mk

r326926: Move loader help file definitions to being 100% inside of
loader.mk.

r326927: libficl is only ever used in a loader (never a boot) program. Move
it.

r326960: Simplify things a little. The RETURN macro isn't required.

r326961: Interact is always called with NULL. Simplify code a little

r326962: Hoist btx include stuff to i386/Makefile.inc

r326963: No need to use relative paths like this here.

r327351: Fix ubldr. uboot/lib uses defines for the loader.

r327453: Add a validbcd() routine that uses the bcd2bin_data[] array

r327390: Garbage-collect loader.ps3. It is currently disconnected from the
build and kboot replaces.

r327523: Don't clobber system LDFLAGS for beri boot loaders.

r327524: Use 'extern uint8_t' instead of 'extern void' for external symbols.

r326489: Allow this file to be used in libsa without warning...

r327880: Move getsecs() prototype to stand.h from net.h so it can be used

r328437: Split panic routine

r328438: Implement abort() as a call to panic.

r328439: Provide abs form stdlib.h.

r328441: abort() should be marked __dead2 since it won't return.

r328446: Now that exit is __dead2, we need to tag ub_exit() as __dead2.

r328448: Make exit() never return until host_exit can be written.

r328449: Tag unreachable places as such. I left the while (1); in place

r328612: Move strtold wrapper from strtol.c to its own strtold.c.

r328613: Kill copies of strtol and strtoul.

r328615: Update stand.h for changes for strto*l

PR: 223969

6 years agoMFC r325718: Fix typo in filename.
kevans [Mon, 12 Feb 2018 15:48:12 +0000 (15:48 +0000)]
MFC r325718: Fix typo in filename.

Noticed by: Shawn Webb (again)

6 years agoMFC r326666:
hselasky [Mon, 12 Feb 2018 13:59:04 +0000 (13:59 +0000)]
MFC r326666:
mlx4: Remove redundant declarations to fix GCC build

These were made redundant in r325841.

Reviewed by: hselasky
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13401

6 years agoMFC r306486-r325841:
hselasky [Mon, 12 Feb 2018 13:56:57 +0000 (13:56 +0000)]
MFC r306486-r325841:
Update the mlx4, mlx4ib(4) and mlx4en(4) drivers to match FreeBSD-head
prior to the Linux 4.9 RoCE/infiniband upgrade.

Sponsored by: Mellanox Technologies

MFC r306486:
Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4
like other PCI network drivers. The sys/ofed directory is now mainly
reserved for generic infiniband code, with exception of the mthca driver.

- Add new manual page, mlx4en(4), describing how to configure and load
mlx4en.

- All relevant driver C-files are now prefixed mlx4, mlx4_en and
mlx4_ib respectivly to avoid object filename collisions when compiling
the kernel. This also fixes an issue with proper dependency file
generation for the C-files in question.

- Device mlxen is now device mlx4en and depends on device mlx4, see
mlx4en(4). Only the network device name remains unchanged.

- The mlx4 and mlx4en modules are now built by default on i386 and
amd64 targets. Only building the mlx4ib module depends on
WITH_OFED=YES .

Sponsored by: Mellanox Technologies

MFC r310425:
mlx: avoid use of __DATE__ to make build reproducible

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

MFC r310488:
mlx(4): remove date from log message

Further to r310425, go one step further and just remove the date.

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

MFC r324200:
Implement SIOCGIFRSS{KEY,HASH} for the mlx4en(4) driver.

Differential Revision: https://reviews.freebsd.org/D12176
Sponsored by: Mellanox Technologies

MFC r324201:
Setup mbuf hash type properly when receiving IP packets in the mlx4en(4) driver.

Submitted by: sephe@
Differential Revision: https://reviews.freebsd.org/D12229
Sponsored by: Mellanox Technologies

MFC r324621:
mlx4: use enum constants instead of const vars for case exprs

Follow up from r324201 to fix compilation with gcc, which complains
about non-ICE case expressions.

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

MFC r325841:
Update the mlx4 core and mlx4en(4) modules towards Linux v4.9.

Background:
The coming ibcore update forces an update of mlx4ib(4) which in turn requires
an updated mlx4 core module. This also affects the mlx4en(4) module because
commonly used APIs are updated. This commit is a middle step updating the
mlx4 modules towards the new ibcore.

This change contains no major new features.

Changes in mlx4:
  a) Improved error handling when mlx4 PCI devices are
  detached inside VMs.
  b) Major update of codebase towards Linux 4.9.

Changes in mlx4ib(4):
  a) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Changes in mlx4en(4):
  a) Update flow steering code in mlx4en to use new APIs for
  registering MAC addresses and IP addresses.
  b) Update all statistics counters to be 64-bit.
  c) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Sponsored by: Mellanox Technologies

6 years agoMFC r328876:
ae [Mon, 12 Feb 2018 12:41:53 +0000 (12:41 +0000)]
MFC r328876:
  Modify ip6_get_prevhdr() to be able use it safely.

  Instead of returning pointer to the previous header, return its offset.
  In frag6_input() use m_copyback() and determined offset to store next
  header instead of accessing to it by pointer and assuming that the memory
  is contiguous.

  In rip6_input() use offset returned by ip6_get_prevhdr() instead of
  calculating it from pointers arithmetic, because IP header can belong
  to another mbuf in the chain.

  Reported by: Maxime Villard <max at m00nbsd dot net>

6 years agoMFC r328880:
kib [Mon, 12 Feb 2018 10:34:15 +0000 (10:34 +0000)]
MFC r328880:
On munlock(), unwire correct page.

6 years agoMFC r328505,r328659: stand/fdt improvements
kevans [Mon, 12 Feb 2018 05:55:44 +0000 (05:55 +0000)]
MFC r328505,r328659: stand/fdt improvements

r328505: stand/fdt: Check /compatible property on overlay if it exists

r328659: stand/fdt: Rip out FDT VA tracking

6 years agoMFC r326038,r326069,r326072: More stand simplification and fixes
kevans [Mon, 12 Feb 2018 01:17:06 +0000 (01:17 +0000)]
MFC r326038,r326069,r326072: More stand simplification and fixes

r326038: Move some more common stuff up to Makefile.inc.

r326069: Fix gptzfsboot for cases with GELI.

r326072: Unbreak riscv build in universe.

6 years agoMFC r325834,r325997,326502: Move sys/boot to stand/
kevans [Mon, 12 Feb 2018 01:08:44 +0000 (01:08 +0000)]
MFC r325834,r325997,326502: Move sys/boot to stand/

This is effectively a direct commit to stable/11, due to differences between
stable/11 and head. Changes to DTS in sys/boot/fdt/dts were often
accompanied by kernel changes. Many of these were also risc-v updates that
likely had many more dependencies to MFC.

Because of this, sys/boot/fdt/dts remains as-is while everything else in
sys/boot relocates to stand/.

r325834: Move sys/boot to stand. Fix all references to new location

r325997: Remove empty directories.

r326502: Document the sys/boot -> stand move in hier.7 and the top-level README.

6 years agoRe-sync loader.mk and ficl.mk to where they should be
kevans [Sun, 11 Feb 2018 22:38:16 +0000 (22:38 +0000)]
Re-sync loader.mk and ficl.mk to where they should be

This is a direct commit to stable/11 due to changes lost during an MFC of a
move.

6 years agoCorrect check: BOOT_FORTH is MK_FORTH in makefiles.
kevans [Sun, 11 Feb 2018 22:16:24 +0000 (22:16 +0000)]
Correct check: BOOT_FORTH is MK_FORTH in makefiles.

This is a direct commit to stable/11.

6 years agoMFC Loader Fixes 2017q4p6: r324649,r324650,r324651,r324652,r324653,r324654,
kevans [Sun, 11 Feb 2018 20:58:00 +0000 (20:58 +0000)]
MFC Loader Fixes 2017q4p6: r324649,r324650,r324651,r324652,r324653,r324654,
r324700,r324702,r324709,r324717,r324719,r324841,r324842,r324843,r324845,
r324850,r324876,r324877,r324878,r324879,r324880,r324881,r324883,r324980,
r324981,r324982,r324995,r325014,r325093,r325094,r325114,r325170,r325171,
r325172,r325173,r325174,r325175,r325176,r325248,r325286,r325310,r325332,
r325338,r325339,r325376,r325377,r325379,r325380,r325382,r325478,r325479,
r325480,r325482,r325483,r325484,r325485,r325556,r325641,r325681,r325685,
r325686,r325687,r325688,r325689,r325690,r325691,r325692,r325693,r325694,
r325743,r325744,r325748,r325775,r325779,r325780

r324649: Move common/Makefile.inc to sys/boot/loader.mk.

r324650: tweak style

r324651: create defs.mk for common definitions

r324652: Move all the ficl common code into ficl.mk

r324653: LOADER_foo_SUPPORTED

r324654: Explicitly inlcude SYSDIR in the include path

r324700: loader: initialize dv_cleanup in md.c to eliminate clang warning

r324702: We need to include disk.o in libuboot.a when we're building with
support for disk access.

r324709: Revert "Unify boot1 with loader" change r324646

r324717: libsa/ip.c: misplaced comment, ip_v is half char, not ip_p

r324719: libsa/ip: stop read loop on bad fragments

r324841: Use BOOTDIR more consistently in defs.mk rather than repeat
sys/boot.

r324842: Introduce BOOTOBJ: The top level object directory for the boot tree

r324843: Stopgap fix to the mistmatch between LOADER_GELI_SUPPORT and
LOADER_NO_GELI_SUPPORT.

r324845: Use BOOTOBJ and BOOTDIR to find geli includes and libraries.

r324850: Define LIBSA32 to LIBSA on i386 to fix build.

r324876: Move fdt and uboot defines into common uboot.mk.

r324877: End source directories with SRC rather than a hodgepodge of names

r324878: Make at91 boot loader compile again.

r324879: Prefer SRCTOP paths for bits we're grabbing from libc.

r324880: Use BOOTSRC here.

r324881: Use SYSDIR instead of ${.CURDIR}/../..<etc>/sys.

r324883: Use preferred defined paths, rather than relative paths in fdt.

r324980: Use BOOTDIR consistently.

r324981: Move BINDIR definition to defs.mk, and override where it isn't
/boot

r324982: Remove sys/boot/arm/at91 and ixp425

r324995: loader.efi: Make framebuffer commands available for arm64

r325014: Add a 'place holder' arm struct efi_fb until a real one comes

r325093: Define new EFI variables

r325094: Cleanup non-arch Makefiles

r325114: Use defs.mk defins in most MD code

r325170: Use defs.mk values for userboot

r325171: Use defs.mk name and prefer bsd.init.mk

r325172: Remove the -nostdlib stuff I added. Instead, fix LDFLAGS to be
honored correctly with the new Makefile.inc include order.

r325173: We don't need to build a special ficl for userboot.

r325174: Minor cleanup

r325175: For amd64, compile both zfs and zfs32 libraries.

r325176: Actually add zfs32/Makefile

r325248: loader ptblread() is broken with >512B sectors

r325286: efipart_strategy is using wrong offset with >512B sectors

r325310: zfs.c:vdev_read() needs to be careful about large sectors

r325332: loader: re-enable gzip support for x86

r325338: loader: fix BOOTSRC -> BOOTOBJ in a library path

r325339: This used to have bzip2 support too.

r325376: WIP: centralize machine links

r325377: mostly libsa

r325379: Revert "mostly libsa"

r325380: Revert "WIP: centralize machine links"

r325382: Cleanup stray libstand names to be libsa names.

r325478: Powerpc is a 32-bit boot loader.

r325479: Define LIBFICL32 to be libficl.a on i386 and libficl32.a on amd64.

r325480: Use DO32 for all the places that we need to flag we're building a
32-bit version of a library.

r325482: Move machine and other link creation to defs.mk

r325483: MACHINE can never be powerpc64, so cleanup code that thinks it can.

r325484: Prefer bsd.init.mk to src.opts.mk

r325485: Centralize all 32-bit builds on 64-bit platform stuff.

r325556: loader: set options before including bsd.init.mk

r325641: loader.efi: efi_devpath_is_prefix should return bool

r325681: boot1: avoid using NULL device path

r325685: libsa32 isn't needed for i386. It's already a 32-bit platform.

r325686: Simplify this if to a direct assignment.

r325687: Remove all the empty help files from the powerpc build.

r325688: FDT support doesn't make sense for ps3, remove it.

r325689: Remove LOADER_FDT_SUPPORT as a Makefile variable.

r325690: Remove LOADER_ZFS_SUPPORT as a Makefile variable

r325691: Remove useless PNP define here.

r325692: Replace LOADER_FIREWIRE_SUPPORT variable

r325693: Move LOADER_{NO,}_GELI_SUPPORT to MK_LOADER_GELI

r325694: Install the 4th files in sys/boot/forth instead of each loader

r325743: Make sure the proper loader.rc gets installed.

r325744: boot1: also check for NULL device

r325748: Use proper include file.

r325775: Add loader.conf to the list of files that are MD.

r325779: Add /boot/dts to the list of default modules.

r325780: Don't add /boot/dt*s* but /boot/dt*b*. Stupid think-o.

6 years agoFix paths after r329132
kevans [Sun, 11 Feb 2018 20:35:14 +0000 (20:35 +0000)]
Fix paths after r329132

This is a direct commit to stable/11 due to svn's handling of merging this
move being less than ideal.

6 years agoMFC r324648: Rename top level Makefile.ficl to ficl.mk.
kevans [Sun, 11 Feb 2018 20:06:36 +0000 (20:06 +0000)]
MFC r324648: Rename top level Makefile.ficl to ficl.mk.

6 years agoMFC Loader Fixes 2017q4p5: r324557,r324558,r324559,r324646,r324647
kevans [Sun, 11 Feb 2018 20:04:34 +0000 (20:04 +0000)]
MFC Loader Fixes 2017q4p5: r324557,r324558,r324559,r324646,r324647

r324557: Rename exit to efi_exit to avoid clashing with libsa exit
    definition

r324558: Define prototype for exit and ensure references

r324559: Move panic back into libsa. It's documented in libstand(3) to
belong there.

r324646: Unify boot1 with loader.

r324647: Move orphaned man pages into new man directory from common.

6 years agoMFC Loader Fixes 2017q4p4: r324552,r324553,r324554,r324555,r324556
kevans [Sun, 11 Feb 2018 20:00:26 +0000 (20:00 +0000)]
MFC Loader Fixes 2017q4p4: r324552,r324553,r324554,r324555,r324556

r324552: Kill the userboot copy of libstand.

r324553: Rename libstand.a to libsa.a and libstand32.a to libsa32.a

r324554: Move crc32.c, util.c and gpt.c over to libsa.

r324555: Honor CFLAGS modifications in Makefile.inc by using += here.

r324556: Move ufsread.c

6 years agoMFC r324551: Move lib/libstand to sys/boot/libsa
kevans [Sun, 11 Feb 2018 19:51:29 +0000 (19:51 +0000)]
MFC r324551: Move lib/libstand to sys/boot/libsa

6 years agoMFC Loader Fixes 2017q4p3: r324460,r324471
kevans [Sun, 11 Feb 2018 19:35:42 +0000 (19:35 +0000)]
MFC Loader Fixes 2017q4p3: r324460,r324471

r324460: Rather than laying whack-a-mole with including the path to stand.h,
always include it.

r324471: Fix typos: `stand alon{e,g}` should be spelled like `standalone`

6 years agoMFC Loader Fixes 2017q4p2: r324453, r324454
kevans [Sun, 11 Feb 2018 19:33:24 +0000 (19:33 +0000)]
MFC Loader Fixes 2017q4p2: r324453, r324454

r324453: Create sys/boot/libsa and build libstand.a there

r324454: Disconnect libstand from the build.

6 years agoMFC Loader Fixes 2017q4p1: r324321,r324359,r324360,r324388,r324449,r324450,
kevans [Sun, 11 Feb 2018 19:29:58 +0000 (19:29 +0000)]
MFC Loader Fixes 2017q4p1: r324321,r324359,r324360,r324388,r324449,r324450,
r324451,r324452

r324321: This README file was quite relevant for FreeBSD 3 or 4. No more.

r324359: Add efi_devpath_is_prefix

r324360: Encapsulate  ZFS preferences into efi_zfs_is_preferred

r324388: Unbreak building efiboot with MK_ZFS == no

r324449: Prefer ${LIBSTAND} to -lstand

r324450: Define SASRC and use it

r324451: Add missing -I${SASRC} in a couple of places so that stand.h
doesn't accidentally come in via host pollution.

r324452: Define LIBSA* and use them instead of overloaded LIBSTAND

6 years agoFix regression issue after r328973:
hselasky [Sun, 11 Feb 2018 10:23:32 +0000 (10:23 +0000)]
Fix regression issue after r328973:

The lint target does no longer exist in FreeBSD head
and the __alloc_size2() support for lint was missing
when r328973 was MFCed. Add support for __alloc_size2() to
the lint target.

This is a direct commit.

Found by: antoine@
Pointy hat: hselasky@
Sponsored by: Mellanox Technologies

6 years agoMFC r308926:
eadler [Sun, 11 Feb 2018 07:04:48 +0000 (07:04 +0000)]
MFC r308926:

Add Intel Atom Cherryview SOC HSUART support

PR: 207910
Submitted by: johannes@brilliantservice.co.jp

6 years agoMFC r304007:
eadler [Sun, 11 Feb 2018 07:00:40 +0000 (07:00 +0000)]
MFC r304007:

Correct the history of where ps first appeared.

PR: 211741
Submitted by: Sevan Janiyan <venture37@geeklan.co.uk>

6 years agoBack out MFC r324558: Define prototype for exit and ensure references
kevans [Sun, 11 Feb 2018 03:21:06 +0000 (03:21 +0000)]
Back out MFC r324558: Define prototype for exit and ensure references

This went terribly wrong

6 years agoMFC r326615: De-const to match changes in userboot.h
kevans [Sun, 11 Feb 2018 03:10:27 +0000 (03:10 +0000)]
MFC r326615: De-const to match changes in userboot.h

6 years agoBack out exit() change in r329114; stable/11 was not ready for this one yet
kevans [Sun, 11 Feb 2018 03:09:08 +0000 (03:09 +0000)]
Back out exit() change in r329114; stable/11 was not ready for this one yet

This is a direct commit to stable/11.

6 years agoMFC Loader Fixes 2017q3: r320547,r320553,r321621,r321844,r321969,r321991,
kevans [Sun, 11 Feb 2018 02:27:50 +0000 (02:27 +0000)]
MFC Loader Fixes 2017q3: r320547,r320553,r321621,r321844,r321969,r321991,
r322037,r322038,r322039,r322040,r322056,r322074,r322542,r322592,r322593,
r322896,r322923,r323671,r322930,r322931,r322932,r322933,r322934,r322935,
r322936,r322937,r322938,r322939,r322941,r323062,r323063,r323064,r323065,
r323100,r323131,r323174,r323258,r323261,r323272,r323367,r323379,r323389,
r323407,r323428,r323436,r323494,r323496,r323497,r323541,r323554,r323589,
r323707,r323867,r323885,r323886,r323895,r323896,r323897,r323905,r323906,
r323907,r323908,r323909,r323952,r323991,r324099,r324558,r326445,r326609,
r326610

This batch includes a special kludge to fix powerpc loader build; <stdlib.h>
was included after <stand.h> there, causing problems with DEBUG_MALLOC bits.
Include <stdlib.h> a little bit earlier to fix the build with the intention
of removing this when eventually libsa silently replaces stdlib.h with
stand.h.

r320547: Link EFI/uboot loaders with -znotext

r320553: Integer underflow in efipart_realstrategy when I/O starts after end
of disk

r321621: Always set the receive mask in loader.efi.

r321844: Clean up style in print_state(..) and pager_printf(..)

r321969: Fix the return types for printf and putchar to match their libc

r321991: Revert r321969

r322037: Add stpcpy and stpncpy to libstand

r322038: Add definitions and utilities for EFI drivers

r322039: Move EFI ZFS functions to libefi

r322040: Add EFI utility functions to libefi

r322056: Move EFI fmtdev functionality to libefi

r322074: libefi/time.c cstyle cleanup

r322542: loader.efi: repace XXX with real comments in trap.c

r322592: Remove unused defines.

r322593: Define proposed GUID for FreeBSD boot loader variables.

r322896: Make spinconsole platform independent and hook it up into EFI
loader

r322923: Hide length of geli passphrase during boot.

r323671: Fix language used in the r322923.

r322930: Move efi_main into efi/loader

r322931: Cleanup efi_main return type

r322932: Use the loader.efi conventions for the various EFI tables.

r322933: No need for MK_ZFS around these: they are by their nature only
active when MK_ZFS is true.

r322934: _STAND is sometimes defined on the command line. Make the define
here match.

r322935: Fix warnings due to type mismatch.

r322936: Remove useless 'static' for an enum definition.

r322937: Forward declare struct dsk to avoid warnings when building libi386.

r322938: Link in libefi for boot1

r322939: Use efi_devpath_str for debug path info.

r322941: Eliminate redunant device path matching.

r323062: Make efichar.c routines available to libefi.

r323063: boot1.efi: print more info about where boot1.efi is loaded from

r323064: Exit rather than panic for most errors.

r323065: Save where we're booted from

r323100: libstand: nfs_readlink() should return proper return code

r323131: Revert r322941: Eliminate redundant device matching functions

r323174: Fix loader bug causing too many pages allocation when bootloader
is U-Boot

r323258: ucs2len

r323261: Fix armv6 build

r323272: Be consistent and do return (1);

r323367: Mark init_chroot and init_script variables as deprecated.

r323379: It's been pointed out that init_script at least is useful w/o

r323389: loader.efi: chain loader should provide proper device handle

r323407: boot1 generate-fat: generate all templates at once

r323428: r323389 breaks the kernel build when WITHOUT_ZFS is defined in
src.conf

r323436: boot1: remove BOOT1_MAXSIZE default value

r323494: loader should support large_dnode

r323496: libstand: tftp_open() can leak pkt on error

r323497: libefi: efipart_open should check the status from disk_open

r323541: libefi: efipart_realstrategy rsize pointer may be NULL

r323554: Increase EFI boot file size frok 128k to 384k

r323589: loader: biosmem.c cstyle cleanup

r323707: loader: biosmem allocate heap just below 4GB

r323867: libefi: devicename.c cleanups

r323885: libefi: efi_devpath_match() should return bool

r323886: libefi: efipart.c should use calloc()

r323895: libefi: efi_devpath_match local len should be unsigned

r323896: r323885 did miss efilib.h update

r323897: efilib.h: typo in structure member description

r323905: libefi: pdinfo_t pd_unit and pd_open should be unsigned

r323906: libefi: efipart_strategy() should return ENXIO when there is no
media

r323907: libefi: efipart.c cstyle fix for efipart_print_common()

r323908: libefi: efipart_hdinfo_add_filepath should check strtol result

r323909: libefi: define EISA PNP constants

r323952: After the r317886 support for TFTP and NFS can be enable
simultaneously.

r323991: libefi: efipart_floppy() will should not pass acpi pointer if the
HID test fails

r324099: Compile loader as Little-Endian on PPC64/POWER8

r324558: Define prototype for exit and ensure references

r326445: Fix random() and srandom() prototypes to match the standard.

r326609: Make putenv and getenv match the userland definition

r326610: Fix random() prototype to match the system.

PR: 219000 221001 222215
Relnotes: yes ("The length of the geli passphrase is hidden during boot")

6 years agoMFC r328895: Correct Russia spelling in regdomain.xml
emaste [Sat, 10 Feb 2018 22:34:47 +0000 (22:34 +0000)]
MFC r328895: Correct Russia spelling in regdomain.xml

PR: 225658

6 years agoMFC r303725 (oshogbo): Fix misleading description of the -b option in the
kevans [Sat, 10 Feb 2018 15:23:30 +0000 (15:23 +0000)]
MFC r303725 (oshogbo): Fix misleading description of the -b option in the
geli init command.

6 years agoMFC Loader Fixes 2017q2: r316437,r316577,r316578,r316585,r316590,r316612,
kevans [Sat, 10 Feb 2018 04:56:07 +0000 (04:56 +0000)]
MFC Loader Fixes 2017q2: r316437,r316577,r316578,r316585,r316590,r316612,
r316625,r316628,r316654,r316682,r316704,r316771,r317092,r317097,r317099,
r317652,r317785,r317886,r317887,r318142,r318320,r318356,r318678,r318754,
r318982,r318986,r318987,r318988,r318989,r318990,r318991,r318992,r318993,
r318994,r318999,r319083,r319084,r319085,r320011,r320234,r320288,r320304,
r320467,r320482

r316437: Small cleanup to make i386/loader match efi/loader boot environment
code

r316577: loader: part.c cstyle cleanup

r316578: loader: want mechanism to avoid RA with bcache

r316585: loader: zfs reader should check all labels

r316590: libstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory

r316612: In r298230 the value of HEAP_MIN was changed from 3MB to 64MB.
Correct a comment.

r316625: Do not use -msoft-float with intention of disabling FP on aarch64

r316628: Silence GCC warning by initializing the local variable.

r316654: loader: r316585 did miss userboot update

r316682: loader: r316585 did miss sparc/ofw

r316704: loader.efi: only fetch zfs pool guid for the actual boot device

r316771: loader: Avoid possible overflow via environment variable

r317092: loader: zfs reader vdev_probe should check for minimum device size

r317097: loader: F_READ/F_WRITE should be checked against masked flag

r317099: loader: uboot disk ioctl should call disk_ioctl

r317652: loader.efi: ResetSystem does not use data with EFI_SUCCESS

r317785: zfsboot: drvsize() may be unusable on some systems

r317886: distinguish NFS versus TFTP boot by rootpath

r317887: loader: network read rework

r318142: libstand: NULL pointer dereference in rarp

r318320: loader: add ip layer code into libstand

r318356: libstand: increase nfs max read size to 16k

r318678: Replacing iterating over rootpath by strsep(3).

r318754: Pass -N directly to ld via -Wl rather than passing it to the
compiler driver.

r318982: Pass a "FREEBSD" user-class in PXE dhcp request

r318986: add a comment on vendor index 19 and 20 to avoid confusion

r318987: Support URI scheme for root-path in netbooting

r318988: Always build tftpfs support along with nfs for pxeboot

r318989: Always issue the pxe request

r318990: Partially revert r314948

r318991: Document recent changes on pxeboot

r318992: Capitalize DHCP

r318993: Use the usual FreeBSD spelling for the DHCP user class

r318994: Catch with the change in the user class

r318999: Update the comments concerning net_parse_rootpath to reflect what
it is now

r319083: Followup on the user-class changes

r319084: Small cleanup in dev_net.c

r319085: use the same option list for dhcp discovery and request

r320011: Add chain loader support for loader

r320234: Make structure padding explicit in EFI_MEMORY_DESCRIPTOR

r320288: Allow Clang's integrated assembler to assemble boot0

r320304: loader.efi: Disable smbios for arm

r320467: loader: chain load relocate data declaration is bad

r320482: As with arm64 mark the EFI PE header as allocated on arm.

PR: 218473

6 years agoMFC Loader Fixes 2017q1: r311458,r312237,r312314,r312374,r312947,r313042,
kevans [Sat, 10 Feb 2018 04:37:44 +0000 (04:37 +0000)]
MFC Loader Fixes 2017q1: r311458,r312237,r312314,r312374,r312947,r313042,
r313047,r313166,r313328,r313332,r313333,r313337,r313348,r313349,r313389,
r313442,r313451,r313575,r313645,r313710,r314114,r314213,r314275,r314945,
r314948,r315008,r315408,r315427,r315645,r315646,r315648,r315653,r315850,
r316064,r316078,r316079,r316100,r316104,r316111,r316112,r316171,r316279,
r316280,r316287,r316311,r316343,r316424,r316436

r311458: Use compiler driver to link BERI boot loaders

r312237: loader.efi: find_currdev() can leak memory

r312314: loader: move device path definitions to include/efidevp.h

r312374: loader: efi devpath api usage should be more aware of NULL pointers

r312947: Remove "-Xassembler -G0" from CFLAGS.

r313042: loader.efi environment related cleanups

r313047: loader: disk/part api needs to use uint64_t offsets

r313166: loader: libefi/env.c warnings in arm build

r313328: loader: Implement disk_ioctl() to support DIOCGSECTORSIZE and
DIOCGMEDIASIZE.

r313332: loader: bcache read ahead block count should take account the large
sectors

r313333: loader: Replace EFI part devices.

r313337: loader: 313329 missed ZFS guard in loader/main.c

r313348: loader: biosdisk fix for 2+TB disks

r313349: loader: disk io should not use alloca()

r313389: efipart is also using the '%S' printf format, add -Wno-format for
it.

r313442: loader: possible NULL pointer dereference in efipart.c

r313451: loader: possible NULL pointer dereference in bcache.c

r313575: makefs: make the buffer functions look exactly like the kernel ones

r313645: loader: implement MEDIA_FILEPATH_DP support in efipart

r313710: loader: cstyle fixes and DIOCGMEDIASIZE should use uint64_t

r314114: Use LDFLAGS with CC instead of _LDFLAGS.

r314213: Remove control+r handling from geliboot's pwgets()

r314275: Remove unused macro from common/drv.c.

r314945: Some style(9) fixes. No functional changes.

r314948: Try to extract the RFC1048 data from PXE.

r315008: r314948 seems to be missing a variable or two that will break

r315408: loader: remove open_disk cache

r315427: loader: biosdisk should report IO error from INT13

r315645: loader: disk_cleanup was left in userboot_disk.c

r315646: loader: pxe.h constants have wrong values

r315648: libstand: verify value provided by nfs.read_size

r315653: loader: verify the value from dhcp.interface-mtu and use snprintf
o set mtu

r315850: The original author abused Nd (one-line description, used by
makewhatis)

r316064: Fix build with path names with 'align' or 'nop' in them.

r316078: gpt*boot: Save a bit more memory when LOADER_NO_GELI_SUPPORT is
specified

r316079: Simply retire the sedification of the boot2.s file.

r316100: Remove -fno-guess-branch-probability and -fno-unit-at-a-time.

r316104: Use `NO_WCAST_ALIGN` instead of spelling it out as -Wno-cast-align
in CFLAGS

r316111: loader: move bios getsecs into time.c

r316112: loader: ls command should display file types properly

r316171: xfsread inlined uses more space, so remove the inline tag.

r316279: loader: efipart should check disk size from partition table

r316280: loader: simplify efi_zfs_probe and avoid double probing for zfs.

r316287: Remove OLD_NFSV2 from loader and libstand

r316311: Add explicit_bzero() to libstand, and switch GELIBoot to using it

r316343: Implement boot-time encryption key passing (keybuf)

r316424: Fix sparc64 build broken by r316343 and r316076

r316436: Restore EFI boot environment functionality broken in r313333

PR: 216940 217298 217935

6 years agoMFC libstand catch-up: r305116,306534,306538,306552,306638
kevans [Sat, 10 Feb 2018 01:52:58 +0000 (01:52 +0000)]
MFC libstand catch-up: r305116,306534,306538,306552,306638

r305116: recvtftp() is broken for large files, report file size
r306534: cd9660_open should check for padding
r306538: cstyle fix of cd9660_open in libstand
r306552: Fix remaining cstyle issues in libstand/cd9660.c
r306638: Fix remaining bugs in libstand/cd9660.c reported by Bruce Evans.

PR: 200500

6 years agoMFC r325795 (by imp):
mav [Sat, 10 Feb 2018 00:39:34 +0000 (00:39 +0000)]
MFC r325795 (by imp):
Belatedly add opt_nvme.h to fix building nvme.ko outside of a kernel
build.

6 years agoMFC r327606: Handle misconfigured/nonexistent pcidev for comconsole instead
kevans [Fri, 9 Feb 2018 17:25:34 +0000 (17:25 +0000)]
MFC r327606: Handle misconfigured/nonexistent pcidev for comconsole instead
of BTX panic.

[This is effectively a direct commit to stable/11 due to path restructuring
in head. Diffs have simply been applied to previous location]

PR: 203319

6 years agoMFC r306325, r306329-r306330, r306333, r306620-r306622, r307544, r307550, r318137...
manu [Fri, 9 Feb 2018 09:15:43 +0000 (09:15 +0000)]
MFC r306325, r306329-r306330, r306333, r306620-r306622, r307544, r307550, r318137, r319125, r319295

r306325 by marcel:
Replace the use of linker sets with constructors for both the
formats and schemes.  Formats and schemes are registered at
runtime now, rather than collected at link time.

r306329 by marcel:
Eliminate the use of EDOOFUS.  The error code was used to signal
programming errors, but is really a poor substitute for assert.
And less portable as well.

r306330 by marcel:
Avoid depending on the <sys/endian.h> header for le*enc and be*enc.
Not only is the header unportable, the encoding/decoding functions
are as well.  Instead, duplicate the handful of small inlines we
need into a private header called endian.h.

Aside: an alternative approach is to move the encoding/decoding
functions to a separate system header.  While the header is still
nonportable, such an approach would make it possible to re-use the
definitions by playing games with include paths. This may be the
preferred approach if more (build) utilities need this.  This
change does not preclude that.  In fact, it makes it easier.

r306333 by marcel:
Portability changes:
1.  macOS nor Linux have MAP_NOCORE nor MAP_NOSYNC. Define as 0.
2.  macOS doesn't have SEEK_DATA nor SEEK_HOLE. Define as -1
    so that lseek will return -1 (with errno set to EINVAL).
3.  gcc correctly warns that error is assigned but not used in
    image_copyout_region().  Fix by returning on the first error.

r306620 by marcel:
Replace STAILQ with TAILQ. TAILQs are portable enough that they can
be used on both macOS and Linux. STAILQs are not. In particular,
STAILQ_LAST does not next on Linux. Since neither STAILQ_FOREACH_SAFE
nor TAILQ_FOREACH_SAFE exist on Linux, replace its use with a regular
TAILQ_FOREACH. The _SAFE variant was only used for having the next
pointer in a local variable.

r306621 by marcel:
Prefer <stdint.h> over <sys/types.h>. While here remove redundant
inclusion of <sys/queue.h>.

Move the inclusion of the disk partitioning headers out of order
and inbetween standard headers and local header. They will change
in a subsequent commit.

r306622 by marcel:
Replace OFF_MAX with INT64_MAX. The former is defined on Linux.

r307544 by marcel:
 o  Provide a private definition for UUIDs (mkimg_uuid_t) because
    UUIDs are not portable.
 o  Move mkimg_uuid() to a new file and merge both gpt_uuid_enc()
    and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives
    in the same file.
 o  Move the OS-specific implementation of generating a UUID to
    osdep_uuidgen() and provide the implementations for FreeBSD,
    macOS and Linux.
 o  Expect the partitioning scheme headers to be found by having
    a search to the directory in which the headers live. This
    avoids conflicts on non-FreeBSD machines.

r307550 by imp:
Add a new flag to mkimg (-a num) to specify the active partition for
those partitioning schemes that have this concept. Implement it as an
override for mbr's setting 0x80 in the flags for the first partition
when we have boot code.

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

r318137:
mkimg: Add -C argument to specify maximum capacity

Add a -C option to specify a maximum capacity for the final image file.
It is useful to control the size of the generated image for sdcard or
when we will add dynamic size partition.

Add --capacity which is a shorthand to define min and max capacity at
the same time.

Reviewed by: bapt, marcel, wblock (manpages)
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D10509

r319125:
mkimg: Correct an off by one error in the PMBR size

The PMBR last sector should be number of sector - 1 (As stated in UEFI Spec
2.6 page 118 table 17).
This fixes warning printed by linux tools like parted or fdisk.

Sponsored by: Gandi.net

r319295 by ngie:
Update the usr.bin/mkimg golden test output files after ^/head@r319125

^/head@r319125 changed the location of the backup pmbr, requiring the
output files to be regenerated, since they're binary disk dumps.

The output files were regenerated with "make rebase"--fixed in
^/head@r319294.

MFC with: r319125, r319294
PR: 219673
Sponsored by: Dell EMC Isilon

6 years agoMFC r328611: Try to preallocate receive memory early.
mav [Fri, 9 Feb 2018 03:07:12 +0000 (03:07 +0000)]
MFC r328611: Try to preallocate receive memory early.

We may not have enough contiguous memory later, when NTB connection get
established.  It is quite likely that NTB windows are symmetric and this
allocation remain, but even if not, we will just reallocate it later.

6 years agoMFC r328450: Use bus_dmamem_alloc(9) KPI instead of contigmalloc(9).
mav [Fri, 9 Feb 2018 03:06:45 +0000 (03:06 +0000)]
MFC r328450: Use bus_dmamem_alloc(9) KPI instead of contigmalloc(9).

I suppose it should make this code NUMA-aware with recent NUMA drop-in,
trying to allocate shared memory buffers from domain closer to NT-bridge.

6 years agoMFC r309062: Release laundered vnode pages to the head of the inactive
kevans [Thu, 8 Feb 2018 17:14:56 +0000 (17:14 +0000)]
MFC r309062: Release laundered vnode pages to the head of the inactive
queue.

The swap pager enqueues laundered pages near the head of the inactive queue
to avoid another trip through LRU before reclamation. This change adds
support for this behaviour to the vnode pager and makes use of it in UFS and
ext2fs. Some ioflag handling is consolidated into a common subroutine so
that this support can be easily extended to other filesystems which make use
of the buffer cache. No changes are needed for ZFS since its putpages
routine always undirties the pages before returning, and the laundry
thread requeues the pages appropriately in this case.

6 years agoiw_cxgbe: Manually backport changes related to QP flush. This fixes a
np [Thu, 8 Feb 2018 14:39:07 +0000 (14:39 +0000)]
iw_cxgbe: Manually backport changes related to QP flush.  This fixes a
panic where poll_cq sees an empty RQ while processing an incoming SEND
for a QP that is being taken down.

This is a direct commit to stable/11.

Sponsored by: Chelsio Communications