svn commit: r330834 - head/sys/dev/vt/hw/vga

2018-03-13 Thread Roger Pau Monné
Author: royger
Date: Tue Mar 13 09:38:53 2018
New Revision: 330834
URL: https://svnweb.freebsd.org/changeset/base/330834

Log:
  vt_vga: check if VGA is available from ACPI FADT table
  
  On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
  available or not.
  
  Sponsored by: Citrix systems R&D
  Reviewed by:  marcel
  Differential revision:https://reviews.freebsd.org/D14397

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==
--- head/sys/dev/vt/hw/vga/vt_vga.c Tue Mar 13 09:29:56 2018
(r330833)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Tue Mar 13 09:38:53 2018
(r330834)
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_acpi.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -46,6 +48,10 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#if ((defined(__amd64__) || defined(__i386__)) && defined(DEV_ACPI))
+#include 
+#endif
+
 struct vga_softc {
bus_space_tag_t  vga_fb_tag;
bus_space_handle_t   vga_fb_handle;
@@ -1196,11 +1202,39 @@ vga_initialize(struct vt_device *vd, int textmode)
return (0);
 }
 
+static bool
+vga_acpi_disabled(void)
+{
+#if ((defined(__amd64__) || defined(__i386__)) && defined(DEV_ACPI))
+   ACPI_TABLE_FADT *fadt;
+   vm_paddr_t physaddr;
+   uint16_t flags;
+
+   physaddr = acpi_find_table(ACPI_SIG_FADT);
+   if (physaddr == 0)
+   return (false);
+
+   fadt = acpi_map_table(physaddr, ACPI_SIG_FADT);
+   if (fadt == NULL) {
+   printf("vt_vga: unable to map FADT ACPI table\n");
+   return (false);
+   }
+
+   flags = fadt->BootFlags;
+   acpi_unmap_table(fadt);
+
+   if (flags & ACPI_FADT_NO_VGA)
+   return (true);
+#endif
+
+   return (false);
+}
+
 static int
 vga_probe(struct vt_device *vd)
 {
 
-   return (CN_INTERNAL);
+   return (vga_acpi_disabled() ? CN_DEAD : CN_INTERNAL);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330835 - in head: share/man/man4 sys/x86/isa

2018-03-13 Thread Roger Pau Monné
Author: royger
Date: Tue Mar 13 09:42:33 2018
New Revision: 330835
URL: https://svnweb.freebsd.org/changeset/base/330835

Log:
  at_rtc: check in ACPI FADT boot flags if the RTC is present
  
  Or else disable the device. Note that the detection can be bypassed by
  setting the hw.atrtc.enable option in the loader configuration file.
  More information can be found on atrtc(4).
  
  Sponsored by: Citrix Systems R&D
  Reviewed by:  ian
  Differential revision:https://reviews.freebsd.org/D14399

Modified:
  head/share/man/man4/atrtc.4
  head/sys/x86/isa/atrtc.c

Modified: head/share/man/man4/atrtc.4
==
--- head/share/man/man4/atrtc.4 Tue Mar 13 09:38:53 2018(r330834)
+++ head/share/man/man4/atrtc.4 Tue Mar 13 09:42:33 2018(r330835)
@@ -33,13 +33,18 @@
 .Sh SYNOPSIS
 This driver is a mandatory part of i386/amd64 kernels.
 .Pp
-The following tunable is settable from the
+The following tunables are settable from the
 .Xr loader 8 :
 .Bl -ohang
 .It Va hint.atrtc. Ns Ar X Ns Va .clock
 controls event timers functionality support.
 Setting to 0, disables it.
 Default value is 1.
+.It Va hw.atrtc.enable
+Forces enabling or disabling of the device(s).
+Setting to 0 disables it, setting to 1 enables it, bypassing any platform
+configuration hints.
+Default value is -1 (autodetect).
 .El
 .Sh DESCRIPTION
 This driver uses RTC hardware to supply kernel with time-of-day clock

Modified: head/sys/x86/isa/atrtc.c
==
--- head/sys/x86/isa/atrtc.cTue Mar 13 09:38:53 2018(r330834)
+++ head/sys/x86/isa/atrtc.cTue Mar 13 09:42:33 2018(r330835)
@@ -32,6 +32,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_acpi.h"
 #include "opt_isa.h"
 
 #include 
@@ -55,6 +56,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "clock_if.h"
 
+#ifdef DEV_ACPI
+#include 
+#endif
+
 /*
  * atrtc_lock protects low-level access to individual hardware registers.
  * atrtc_time_lock protects the entire sequence of accessing multiple registers
@@ -63,6 +68,10 @@ __FBSDID("$FreeBSD$");
 static struct mtx atrtc_lock;
 MTX_SYSINIT(atrtc_lock_init, &atrtc_lock, "atrtc", MTX_SPIN);
 
+/* Force RTC enabled/disabled. */
+static int atrtc_enabled = -1;
+TUNABLE_INT("hw.atrtc.enabled", &atrtc_enabled);
+
 struct mtx atrtc_time_lock;
 MTX_SYSINIT(atrtc_time_lock_init, &atrtc_time_lock, "atrtc_time", MTX_DEF);
 
@@ -249,11 +258,43 @@ static struct isa_pnp_id atrtc_ids[] = {
{ 0 }
 };
 
+static bool
+atrtc_acpi_disabled(void)
+{
+#ifdef DEV_ACPI
+   ACPI_TABLE_FADT *fadt;
+   vm_paddr_t physaddr;
+   uint16_t flags;
+
+   physaddr = acpi_find_table(ACPI_SIG_FADT);
+   if (physaddr == 0)
+   return (false);
+
+   fadt = acpi_map_table(physaddr, ACPI_SIG_FADT);
+   if (fadt == NULL) {
+   printf("at_rtc: unable to map FADT ACPI table\n");
+   return (false);
+   }
+
+   flags = fadt->BootFlags;
+   acpi_unmap_table(fadt);
+
+   if (flags & ACPI_FADT_NO_CMOS_RTC)
+   return (true);
+#endif
+
+   return (false);
+}
+
 static int
 atrtc_probe(device_t dev)
 {
int result;
-   
+
+   if ((atrtc_enabled == -1 && atrtc_acpi_disabled()) ||
+   (atrtc_enabled == 0))
+   return (ENXIO);
+
result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids);
/* ENOENT means no PnP-ID, device is hinted. */
if (result == ENOENT) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330837 - head/stand/i386/libi386

2018-03-13 Thread Toomas Soome
Author: tsoome
Date: Tue Mar 13 09:58:29 2018
New Revision: 330837
URL: https://svnweb.freebsd.org/changeset/base/330837

Log:
  biosdisk.c should not set d_opendata.
  
  Same as 330807, d_opendata is owned by open_disk and we should not
  set it.
  
  Mstand/i386/libi386/biosdisk.c

Modified:
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/i386/libi386/biosdisk.c
==
--- head/stand/i386/libi386/biosdisk.c  Tue Mar 13 09:46:09 2018
(r330836)
+++ head/stand/i386/libi386/biosdisk.c  Tue Mar 13 09:58:29 2018
(r330837)
@@ -404,7 +404,6 @@ bd_open(struct open_file *f, ...)
 */
disk.dd.d_dev = dev->dd.d_dev;
disk.dd.d_unit = dev->dd.d_unit;
-   disk.dd.d_opendata = NULL;
disk.d_slice = -1;
disk.d_partition = -1;
disk.d_offset = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330842 - head/sys/kern

2018-03-13 Thread Ed Maste
Author: emaste
Date: Tue Mar 13 13:09:10 2018
New Revision: 330842
URL: https://svnweb.freebsd.org/changeset/base/330842

Log:
  Use C99 designated initializers for struct execsw
  
  It it makes use slightly more clear and facilitates grepping.

Modified:
  head/sys/kern/imgact_aout.c
  head/sys/kern/imgact_binmisc.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/imgact_gzip.c
  head/sys/kern/imgact_shell.c

Modified: head/sys/kern/imgact_aout.c
==
--- head/sys/kern/imgact_aout.c Tue Mar 13 12:38:26 2018(r330841)
+++ head/sys/kern/imgact_aout.c Tue Mar 13 13:09:10 2018(r330842)
@@ -337,5 +337,8 @@ exec_aout_imgact(struct image_params *imgp)
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw aout_execsw = { exec_aout_imgact, "a.out" };
+static struct execsw aout_execsw = {
+   .ex_imgact = exec_aout_imgact,
+   .ex_name = "a.out"
+};
 EXEC_SET(aout, aout_execsw);

Modified: head/sys/kern/imgact_binmisc.c
==
--- head/sys/kern/imgact_binmisc.c  Tue Mar 13 12:38:26 2018
(r330841)
+++ head/sys/kern/imgact_binmisc.c  Tue Mar 13 13:09:10 2018
(r330842)
@@ -753,5 +753,8 @@ SYSUNINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw imgact_binmisc_execsw = { imgact_binmisc_exec, KMOD_NAME 
};
+static struct execsw imgact_binmisc_execsw = {
+   .ex_imgact = imgact_binmisc_exec,
+   .ex_name = KMOD_NAME
+};
 EXEC_SET(imgact_binmisc, imgact_binmisc_execsw);

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Tue Mar 13 12:38:26 2018(r330841)
+++ head/sys/kern/imgact_elf.c  Tue Mar 13 13:09:10 2018(r330842)
@@ -2426,8 +2426,8 @@ __elfN(check_note)(struct image_params *imgp, Elf_Bran
  * Tell kern_execve.c about it, with a little help from the linker.
  */
 static struct execsw __elfN(execsw) = {
-   __CONCAT(exec_, __elfN(imgact)),
-   __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
+   .ex_imgact = __CONCAT(exec_, __elfN(imgact)),
+   .ex_name = __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
 };
 EXEC_SET(__CONCAT(elf, __ELF_WORD_SIZE), __elfN(execsw));
 

Modified: head/sys/kern/imgact_gzip.c
==
--- head/sys/kern/imgact_gzip.c Tue Mar 13 12:38:26 2018(r330841)
+++ head/sys/kern/imgact_gzip.c Tue Mar 13 13:09:10 2018(r330842)
@@ -387,5 +387,8 @@ Flush(void *vp, u_char * ptr, u_long siz)
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw gzip_execsw = {exec_gzip_imgact, "gzip"};
+static struct execsw gzip_execsw = {
+   .ex_imgact = exec_gzip_imgact,
+   .ex_name = "gzip"
+};
 EXEC_SET(execgzip, gzip_execsw);

Modified: head/sys/kern/imgact_shell.c
==
--- head/sys/kern/imgact_shell.cTue Mar 13 12:38:26 2018
(r330841)
+++ head/sys/kern/imgact_shell.cTue Mar 13 13:09:10 2018
(r330842)
@@ -255,5 +255,8 @@ exec_shell_imgact(struct image_params *imgp)
 /*
  * Tell kern_execve.c about it, with a little help from the linker.
  */
-static struct execsw shell_execsw = { exec_shell_imgact, "#!" };
+static struct execsw shell_execsw = {
+   .ex_imgact = exec_shell_imgact,
+   .ex_name = "#!"
+};
 EXEC_SET(shell, shell_execsw);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330843 - head/sys/dev/efidev

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Tue Mar 13 15:01:23 2018
New Revision: 330843
URL: https://svnweb.freebsd.org/changeset/base/330843

Log:
  efirtc: Pass a dummy tmcap pointer to efi_get_time_locked
  
  As noted in the comment, UEFI spec claims the capabilities pointer is
  optional, but some implementations will choke and attempt to dereference it
  without checking. This specific problem was found on a Lenovo Thinkpad X220
  that would panic in efirtc_identify.

Modified:
  head/sys/dev/efidev/efirt.c

Modified: head/sys/dev/efidev/efirt.c
==
--- head/sys/dev/efidev/efirt.c Tue Mar 13 13:09:10 2018(r330842)
+++ head/sys/dev/efidev/efirt.c Tue Mar 13 15:01:23 2018(r330843)
@@ -259,12 +259,19 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca
 int
 efi_get_time(struct efi_tm *tm)
 {
+   struct efi_tmcap dummy;
int error;
 
if (efi_runtime == NULL)
return (ENXIO);
EFI_TIME_LOCK()
-   error = efi_get_time_locked(tm, NULL);
+   /*
+* UEFI spec states that the Capabilities argument to GetTime is
+* optional, but some UEFI implementations choke when passed a NULL
+* pointer. Pass a dummy efi_dmcap, even though we won't use it,
+* to workaround such implementations.
+*/
+   error = efi_get_time_locked(tm, &dummy);
EFI_TIME_UNLOCK()
return (error);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330844 - head/sys/dev/efidev

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Tue Mar 13 15:02:46 2018
New Revision: 330844
URL: https://svnweb.freebsd.org/changeset/base/330844

Log:
  Correct minor typo in comment, efi_dmcap -> efi_tmcap

Modified:
  head/sys/dev/efidev/efirt.c

Modified: head/sys/dev/efidev/efirt.c
==
--- head/sys/dev/efidev/efirt.c Tue Mar 13 15:01:23 2018(r330843)
+++ head/sys/dev/efidev/efirt.c Tue Mar 13 15:02:46 2018(r330844)
@@ -268,7 +268,7 @@ efi_get_time(struct efi_tm *tm)
/*
 * UEFI spec states that the Capabilities argument to GetTime is
 * optional, but some UEFI implementations choke when passed a NULL
-* pointer. Pass a dummy efi_dmcap, even though we won't use it,
+* pointer. Pass a dummy efi_tmcap, even though we won't use it,
 * to workaround such implementations.
 */
error = efi_get_time_locked(tm, &dummy);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330845 - in head/sys/powerpc: aim ofw powerpc

2018-03-13 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Mar 13 15:03:58 2018
New Revision: 330845
URL: https://svnweb.freebsd.org/changeset/base/330845

Log:
  Execute PowerPC64/AIM kernel from direct map region when possible.
  
  When the kernel can be in real mode in early boot, we can execute from
  high addresses aliased to the kernel's physical memory. If that high
  address has the first two bits set to 1 (0xc...), those addresses will
  automatically become part of the direct map. This reduces page table
  pressure from the kernel and it sets up the kernel to be used with
  radix translation, for which it has to be up here.
  
  This is accomplished by exploiting the fact that all PowerPC kernels are
  built as position-independent executables and relocate themselves
  on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
  VA/PA is random and set by the bootloader. Very early, it processes
  its ELF relocations to operate wherever it happens to find itself.
  This patch uses that mechanism to re-enter and re-relocate the kernel
  a second time witha new base address set up in the early parts of
  powerpc_init().
  
  Reviewed by:  jhibbits
  Differential Revision:D14647

Modified:
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/locore64.S
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/ofw/ofwcall64.S
  head/sys/powerpc/powerpc/machdep.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:02:46 2018
(r330844)
+++ head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:03:58 2018
(r330845)
@@ -160,15 +160,72 @@ extern void   *dlmisstrap, *dlmisssize;
 extern void*dsmisstrap, *dsmisssize;
 
 extern void *ap_pcpu;
+extern void __restartkernel(vm_offset_t, vm_offset_t, vm_offset_t, void *, 
uint32_t, register_t offset, register_t msr);
 
+void aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry,
+void *mdp, uint32_t mdp_cookie);
 void aim_cpu_init(vm_offset_t toc);
 
 void
+aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void 
*mdp,
+uint32_t mdp_cookie)
+{
+   register_t  scratch;
+
+   /*
+* If running from an FDT, make sure we are in real mode to avoid
+* tromping on firmware page tables. Everything in the kernel assumes
+* 1:1 mappings out of firmware, so this won't break anything not
+* already broken. This doesn't work if there is live OF, since OF
+* may internally use non-1:1 mappings.
+*/
+   if (ofentry == 0)
+   mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
+
+#ifdef __powerpc64__
+   /*
+* If in real mode, relocate to high memory so that the kernel
+* can execute from the direct map.
+*/
+   if (!(mfmsr() & PSL_DR) &&
+   (vm_offset_t)&aim_early_init < DMAP_BASE_ADDRESS)
+   __restartkernel(fdt, 0, ofentry, mdp, mdp_cookie,
+   DMAP_BASE_ADDRESS, mfmsr());
+#endif
+
+   /* Various very early CPU fix ups */
+   switch (mfpvr() >> 16) {
+   /*
+* PowerPC 970 CPUs have a misfeature requested by Apple that
+* makes them pretend they have a 32-byte cacheline. Turn this
+* off before we measure the cacheline size.
+*/
+   case IBM970:
+   case IBM970FX:
+   case IBM970MP:
+   case IBM970GX:
+   scratch = mfspr(SPR_HID5);
+   scratch &= ~HID5_970_DCBZ_SIZE_HI;
+   mtspr(SPR_HID5, scratch);
+   break;
+   #ifdef __powerpc64__
+   case IBMPOWER7:
+   case IBMPOWER7PLUS:
+   case IBMPOWER8:
+   case IBMPOWER8E:
+   /* XXX: get from ibm,slb-size in device tree */
+   n_slbs = 32;
+   break;
+   #endif
+   }
+}
+
+void
 aim_cpu_init(vm_offset_t toc)
 {
size_t  trap_offset, trapsize;
vm_offset_t trap;
-   register_t  msr, scratch;
+   register_t  msr;
uint8_t *cache_check;
int cacheline_warn;
#ifndef __powerpc64__
@@ -198,32 +255,6 @@ aim_cpu_init(vm_offset_t toc)
 * Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64)
 */
psl_userstatic &= ~0x783fUL;
-
-   /* Various very early CPU fix ups */
-   switch (mfpvr() >> 16) {
-   /*
-* PowerPC 970 CPUs have a misfeature requested by Apple that
-* makes them pretend they have a 32-byte cacheline. Turn this
-* off before we measure the cacheline size.
-*/
-   case IBM970:
-   case IBM970FX:
-   case IBM970MP:
-   case IBM970GX:
-   scratch = m

svn commit: r330846 - head/sbin/nvmecontrol

2018-03-13 Thread Alexander Motin
Author: mav
Date: Tue Mar 13 15:29:13 2018
New Revision: 330846
URL: https://svnweb.freebsd.org/changeset/base/330846

Log:
  Add some argument checks to be more user-friendly.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/format.c

Modified: head/sbin/nvmecontrol/format.c
==
--- head/sbin/nvmecontrol/format.c  Tue Mar 13 15:03:58 2018
(r330845)
+++ head/sbin/nvmecontrol/format.c  Tue Mar 13 15:29:13 2018
(r330846)
@@ -81,9 +81,13 @@ format(int argc, char *argv[])
pil = strtol(optarg, NULL, 0);
break;
case 'E':
+   if (ses == 2)
+   errx(1, "-E and -C are mutually exclusive");
ses = 1;
break;
case 'C':
+   if (ses == 1)
+   errx(1, "-E and -C are mutually exclusive");
ses = 2;
break;
default:
@@ -109,19 +113,7 @@ format(int argc, char *argv[])
 */
if (strstr(target, NVME_NS_PREFIX) == NULL) {
nsid = NVME_GLOBAL_NAMESPACE_TAG;
-
-   /* We have no previous parameters, so use defaults. */
-   if (lbaf < 0)
-   lbaf = 0;
-   if (mset < 0)
-   mset = 0;
-   if (pi < 0)
-   pi = 0;
-   if (pil < 0)
-   pil = 0;
} else {
-   parse_ns_str(target, path, &nsid);
-
/*
 * We send FORMAT commands to the controller, not the namespace,
 * since it is an admin cmd.  The namespace ID will be specified
@@ -129,25 +121,34 @@ format(int argc, char *argv[])
 * string to get the controller substring and namespace ID.
 */
close(fd);
+   parse_ns_str(target, path, &nsid);
open_dev(path, &fd, 1, 1);
+   }
 
-   /* Check that controller can execute this command. */
-   read_controller_data(fd, &cd);
-   if (((cd.fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT)
-& NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) && ses == 0) {
-   fprintf(stderr, "H/w doesn't support per-NS format\n");
-   exit(1);
-   } else if (((cd.fna >> NVME_CTRLR_DATA_FNA_ERASE_ALL_SHIFT)
-& NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) && ses != 0) {
-   fprintf(stderr, "H/w doesn't support per-NS erase\n");
-   exit(1);
-   }
+   /* Check that controller can execute this command. */
+   read_controller_data(fd, &cd);
+   if (((cd.oacs >> NVME_CTRLR_DATA_OACS_FORMAT_SHIFT) &
+   NVME_CTRLR_DATA_OACS_FORMAT_MASK) == 0)
+   errx(1, "controller does not support format");
+   if (((cd.fna >> NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_SHIFT) &
+   NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_MASK) == 0 && ses == 2)
+   errx(1, "controller does not support cryptographic erase");
 
+   if (nsid != NVME_GLOBAL_NAMESPACE_TAG) {
+   if (((cd.fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT) &
+   NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) && ses == 0)
+   errx(1, "controller does not support per-NS format");
+   if (((cd.fna >> NVME_CTRLR_DATA_FNA_ERASE_ALL_SHIFT) &
+   NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) && ses != 0)
+   errx(1, "controller does not support per-NS erase");
+
/* Try to keep previous namespace parameters. */
read_namespace_data(fd, nsid, &nsd);
if (lbaf < 0)
lbaf = (nsd.flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT)
& NVME_NS_DATA_FLBAS_FORMAT_MASK;
+   if (lbaf > nsd.nlbaf)
+   errx(1, "LBA format is out of range");
if (mset < 0)
mset = (nsd.flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT)
& NVME_NS_DATA_FLBAS_EXTENDED_MASK;
@@ -157,6 +158,17 @@ format(int argc, char *argv[])
if (pil < 0)
pil = (nsd.dps >> NVME_NS_DATA_DPS_PIT_SHIFT)
& NVME_NS_DATA_DPS_PIT_MASK;
+   } else {
+
+   /* We have no previous parameters, so default to zeroes. */
+   if (lbaf < 0)
+   lbaf = 0;
+   if (mset < 0)
+   mset = 0;
+   if (pi < 0)
+   pi = 0;
+   if (pil < 0)
+   pil = 0;
}
 
memset(&pt, 0, sizeof(pt));
___

svn commit: r330864 - in head/stand: common efi/boot1 efi/loader/arch/arm ficl/aarch64 ficl/amd64 ficl/arm ficl/i386 ficl/mips ficl/mips64 ficl/powerpc ficl/riscv ficl/sparc64 i386/btx/lib i386/lib...

2018-03-13 Thread Warner Losh
Author: imp
Date: Tue Mar 13 16:33:00 2018
New Revision: 330864
URL: https://svnweb.freebsd.org/changeset/base/330864

Log:
  Prefer uintXX_t to u_intXX_t
  
  A foolish consistency is the hobgoblin of little minds, adored by
  little statesmen and philosophers and divines. With consistency a
  great soul has simply nothing to do. -- Ralph Waldo Emerson

Modified:
  head/stand/common/bootstrap.h
  head/stand/common/isapnp.c
  head/stand/common/load_elf.c
  head/stand/common/load_elf_obj.c
  head/stand/common/metadata.c
  head/stand/common/misc.c
  head/stand/common/pnp.c
  head/stand/efi/boot1/ufs_module.c
  head/stand/efi/loader/arch/arm/exec.c
  head/stand/ficl/aarch64/sysdep.c
  head/stand/ficl/amd64/sysdep.c
  head/stand/ficl/arm/sysdep.c
  head/stand/ficl/i386/sysdep.c
  head/stand/ficl/mips/sysdep.c
  head/stand/ficl/mips64/sysdep.c
  head/stand/ficl/powerpc/sysdep.c
  head/stand/ficl/riscv/sysdep.c
  head/stand/ficl/sparc64/sysdep.c
  head/stand/i386/btx/lib/btxv86.h
  head/stand/i386/libi386/biosacpi.c
  head/stand/i386/libi386/biosdisk.c
  head/stand/i386/libi386/biospnp.c
  head/stand/i386/libi386/bootinfo32.c
  head/stand/i386/libi386/bootinfo64.c
  head/stand/i386/libi386/elf64_freebsd.c
  head/stand/i386/libi386/multiboot.c
  head/stand/i386/libi386/pxe.c
  head/stand/i386/loader/main.c
  head/stand/libsa/arp.c
  head/stand/libsa/bootp.c
  head/stand/libsa/bootparam.c
  head/stand/libsa/dosfs.h
  head/stand/libsa/ext2fs.c
  head/stand/libsa/net.h
  head/stand/libsa/rpc.c
  head/stand/ofw/libofw/openfirm.c
  head/stand/powerpc/boot1.chrp/boot1.c
  head/stand/powerpc/kboot/ppc64_elf_freebsd.c
  head/stand/powerpc/ofw/elf_freebsd.c
  head/stand/powerpc/ofw/main.c
  head/stand/powerpc/ofw/ppc64_elf_freebsd.c
  head/stand/sparc64/boot1/boot1.c
  head/stand/sparc64/loader/main.c
  head/stand/uboot/lib/elf_freebsd.c
  head/stand/userboot/userboot/bootinfo32.c
  head/stand/userboot/userboot/bootinfo64.c
  head/stand/userboot/userboot/elf64_freebsd.c

Modified: head/stand/common/bootstrap.h
==
--- head/stand/common/bootstrap.h   Tue Mar 13 16:31:54 2018
(r330863)
+++ head/stand/common/bootstrap.h   Tue Mar 13 16:33:00 2018
(r330864)
@@ -150,7 +150,7 @@ voidpnp_addident(struct pnpinfo 
*pi, char *ident);
 struct pnpinfo *pnp_allocinfo(void);
 void   pnp_freeinfo(struct pnpinfo *pi);
 void   pnp_addinfo(struct pnpinfo *pi);
-char   *pnp_eisaformat(u_int8_t *data);
+char   *pnp_eisaformat(uint8_t *data);
 
 /*
  *  < 0- No ISA in system
@@ -168,7 +168,7 @@ extern int  isapnp_readport;
 struct file_metadata 
 {
 size_t md_size;
-u_int16_t  md_type;
+uint16_t   md_type;
 struct file_metadata   *md_next;
 char   md_data[1]; /* data are immediately 
appended */
 };
@@ -210,7 +210,7 @@ struct preloaded_file
 struct file_format
 {
 /* Load function must return EFTYPE if it can't handle the module supplied 
*/
-int(* l_load)(char *filename, u_int64_t dest, struct 
preloaded_file **result);
+int(* l_load)(char *filename, uint64_t dest, struct 
preloaded_file **result);
 /* Only a loader that will load a kernel (first module) should have an 
exec handler */
 int(* l_exec)(struct preloaded_file *mp);
 };
@@ -239,20 +239,20 @@ void file_removemetadata(struct preloaded_file *fp);
 #define ELF_RELOC_RELA 2
 
 /* Relocation offset for some architectures */
-extern u_int64_t __elfN(relocation_offset);
+extern uint64_t __elfN(relocation_offset);
 
 struct elf_file;
 typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx);
 
-int__elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file 
**result);
-int__elfN(obj_loadfile)(char *filename, u_int64_t dest,
+int__elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file 
**result);
+int__elfN(obj_loadfile)(char *filename, uint64_t dest,
struct preloaded_file **result);
 int__elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr,
const void *reldata, int reltype, Elf_Addr relbase,
Elf_Addr dataaddr, void *data, size_t len);
-int __elfN(loadfile_raw)(char *filename, u_int64_t dest,
+int __elfN(loadfile_raw)(char *filename, uint64_t dest,
struct preloaded_file **result, int multiboot);
-int __elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest);
+int __elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest);
 #endif
 
 /*

Modified: head/stand/common/isapnp.c
==
--- head/stand/common/isapnp.c  Tue Mar 13 16:31:54 2018(r330863)
+++ head/stand/common/isapnp.c  Tue Mar 13 16:33:00 2018(r33

svn commit: r330866 - in head/sys: amd64/linux amd64/linux32 i386/linux kern sys

2018-03-13 Thread Ed Maste
Author: emaste
Date: Tue Mar 13 16:40:29 2018
New Revision: 330866
URL: https://svnweb.freebsd.org/changeset/base/330866

Log:
  Use C99 boolean type for translate_osrel
  
  Migrate to modern types before creating MD Linuxolator bits for new
  architectures.
  
  Reviewed by:  cem
  Sponsored by: Turing Robotic Industries Inc.
  Differential Revision:https://reviews.freebsd.org/D14676

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/i386/linux/linux_sysvec.c
  head/sys/kern/imgact_elf.c
  head/sys/sys/imgact_elf.h

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Tue Mar 13 16:33:41 2018
(r330865)
+++ head/sys/amd64/linux/linux_sysvec.c Tue Mar 13 16:40:29 2018
(r330866)
@@ -121,7 +121,7 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioct
 static register_t * linux_copyout_strings(struct image_params *imgp);
 static int elf_linux_fixup(register_t **stack_base,
struct image_params *iparams);
-static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
+static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static voidlinux_vdso_install(void *param);
 static voidlinux_vdso_deinstall(void *param);
 static voidlinux_set_syscall_retval(struct thread *td, int error);
@@ -846,7 +846,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER
 static char GNULINUX_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
 
-static boolean_t
+static bool
 linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
 {
const Elf32_Word *desc;
@@ -857,7 +857,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel
 
desc = (const Elf32_Word *)p;
if (desc[0] != GNULINUX_ABI_DESC)
-   return (FALSE);
+   return (false);
 
/*
 * For Linux we encode osrel as follows (see linux_mib.c):
@@ -865,7 +865,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel
 */
*osrel = desc[1] * 100 + desc[2] * 1000 + desc[3];
 
-   return (TRUE);
+   return (true);
 }
 
 static Elf_Brandnote linux64_brandnote = {

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Tue Mar 13 16:33:41 2018
(r330865)
+++ head/sys/amd64/linux32/linux32_sysvec.c Tue Mar 13 16:40:29 2018
(r330866)
@@ -127,7 +127,7 @@ static void linux_sendsig(sig_t catcher, ksiginfo_
 static voidexec_linux_setregs(struct thread *td,
   struct image_params *imgp, u_long stack);
 static voidlinux32_fixlimit(struct rlimit *rl, int which);
-static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
+static boollinux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static voidlinux_vdso_install(void *param);
 static voidlinux_vdso_deinstall(void *param);
 
@@ -1043,7 +1043,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER
 static char GNU_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
 
-static boolean_t
+static bool
 linux32_trans_osrel(const Elf_Note *note, int32_t *osrel)
 {
const Elf32_Word *desc;
@@ -1054,7 +1054,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr
 
desc = (const Elf32_Word *)p;
if (desc[0] != GNULINUX_ABI_DESC)
-   return (FALSE);
+   return (false);
 
/*
 * For Linux we encode osrel as follows (see linux_mib.c):
@@ -1062,7 +1062,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr
 */
*osrel = desc[1] * 100 + desc[2] * 1000 + desc[3];
 
-   return (TRUE);
+   return (true);
 }
 
 static Elf_Brandnote linux32_brandnote = {

Modified: head/sys/i386/linux/linux_sysvec.c
==
--- head/sys/i386/linux/linux_sysvec.c  Tue Mar 13 16:33:41 2018
(r330865)
+++ head/sys/i386/linux/linux_sysvec.c  Tue Mar 13 16:40:29 2018
(r330866)
@@ -115,7 +115,7 @@ static void linux_sendsig(sig_t catcher, ksiginfo_
 static voidexec_linux_setregs(struct thread *td,
struct image_params *imgp, u_long stack);
 static register_t *linux_copyout_strings(struct image_params *imgp);
-static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
+static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static voidlinux_vdso_install(void *param);
 static voidlinux_vdso_deinstall(void *param);
 
@@ -1017,7 +1017,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER
 static char GNU_ABI_VENDOR[] = "GNU";
 static int GNULINUX_ABI_DESC = 0;
 
-static boolean_t
+static bool
 linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
 {
cons

svn commit: r330868 - in head: stand/efi/loader sys/amd64/amd64 sys/arm64/arm64

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Tue Mar 13 17:10:52 2018
New Revision: 330868
URL: https://svnweb.freebsd.org/changeset/base/330868

Log:
  EFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services
  
  This fixes a problem encountered on the Lenovo Thinkpad X220/Yoga 11e where
  runtime services would try to inexplicably jump to other parts of memory
  where it shouldn't be when attempting to enumerate EFI vars, causing a
  panic.
  
  The virtual mapping is enabled by default and can be disabled by setting
  efi_disable_vmap in loader.conf(5).
  
  Reviewed by:  kib (earlier version)
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D14677

Modified:
  head/stand/efi/loader/bootinfo.c
  head/sys/amd64/amd64/efirt_machdep.c
  head/sys/arm64/arm64/efirt_machdep.c

Modified: head/stand/efi/loader/bootinfo.c
==
--- head/stand/efi/loader/bootinfo.cTue Mar 13 17:04:14 2018
(r330867)
+++ head/stand/efi/loader/bootinfo.cTue Mar 13 17:10:52 2018
(r330868)
@@ -236,17 +236,48 @@ bi_copymodules(vm_offset_t addr)
return(addr);
 }
 
+static EFI_STATUS
+efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
+{
+   EFI_MEMORY_DESCRIPTOR *desc, *viter, *vmap;
+   EFI_STATUS ret;
+   int curr, ndesc, nset;
+
+   nset = 0;
+   desc = mm;
+   ndesc = sz / mmsz;
+   vmap = malloc(sz);
+   if (vmap == NULL)
+   /* This isn't really an EFI error case, but pretend it is */
+   return (EFI_OUT_OF_RESOURCES);
+   viter = vmap;
+   for (curr = 0; curr < ndesc;
+   curr++, desc = NextMemoryDescriptor(desc, mmsz)) {
+   if ((desc->Attribute & EFI_MEMORY_RUNTIME) != 0) {
+   ++nset;
+   desc->VirtualStart = desc->PhysicalStart;
+   *viter = *desc;
+   viter = NextMemoryDescriptor(viter, mmsz);
+   }
+   }
+   ret = RS->SetVirtualAddressMap(nset * mmsz, mmsz, mmver, vmap);
+   free(vmap);
+   return (ret);
+}
+
 static int
 bi_load_efi_data(struct preloaded_file *kfp)
 {
EFI_MEMORY_DESCRIPTOR *mm;
EFI_PHYSICAL_ADDRESS addr;
EFI_STATUS status;
+   const char *efi_novmap;
size_t efisz;
UINTN efi_mapkey;
UINTN mmsz, pages, retry, sz;
UINT32 mmver;
struct efi_map_header *efihdr;
+   bool do_vmap;
 
 #if defined(__amd64__) || defined(__aarch64__)
struct efi_fb efifb;
@@ -266,6 +297,11 @@ bi_load_efi_data(struct preloaded_file *kfp)
}
 #endif
 
+   do_vmap = true;
+   efi_novmap = getenv("efi_disable_vmap");
+   if (efi_novmap != NULL)
+   do_vmap = strcasecmp(efi_novmap, "YES") != 0;
+
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
 
/*
@@ -321,6 +357,13 @@ bi_load_efi_data(struct preloaded_file *kfp)
}
status = BS->ExitBootServices(IH, efi_mapkey);
if (EFI_ERROR(status) == 0) {
+   /*
+* This may be disabled by setting efi_disable_vmap in
+* loader.conf(5). By default we will setup the virtual
+* map entries.
+*/
+   if (do_vmap)
+   efi_do_vmap(mm, sz, mmsz, mmver);
efihdr->memory_size = sz;
efihdr->descriptor_size = mmsz;
efihdr->descriptor_version = mmver;

Modified: head/sys/amd64/amd64/efirt_machdep.c
==
--- head/sys/amd64/amd64/efirt_machdep.cTue Mar 13 17:04:14 2018
(r330867)
+++ head/sys/amd64/amd64/efirt_machdep.cTue Mar 13 17:10:52 2018
(r330868)
@@ -165,7 +165,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int 
descsz)) {
if ((p->md_attr & EFI_MD_ATTR_RT) == 0)
continue;
-   if (p->md_virt != NULL) {
+   if (p->md_virt != NULL && (uint64_t)p->md_virt != p->md_phys) {
if (bootverbose)
printf("EFI Runtime entry %d is mapped\n", i);
goto fail;

Modified: head/sys/arm64/arm64/efirt_machdep.c
==
--- head/sys/arm64/arm64/efirt_machdep.cTue Mar 13 17:04:14 2018
(r330867)
+++ head/sys/arm64/arm64/efirt_machdep.cTue Mar 13 17:10:52 2018
(r330868)
@@ -169,7 +169,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int 
descsz)) {
if ((p->md_attr & EFI_MD_ATTR_RT) == 0)
continue;
-   if (p->md_virt != NULL) {
+   if (p->md_virt

Re: svn commit: r330845 - in head/sys/powerpc: aim ofw powerpc

2018-03-13 Thread Justin Hibbits
This broke the powerpc (32-bit) build.

On Tue, Mar 13, 2018 at 10:03 AM, Nathan Whitehorn
 wrote:
> Author: nwhitehorn
> Date: Tue Mar 13 15:03:58 2018
> New Revision: 330845
> URL: https://svnweb.freebsd.org/changeset/base/330845
>
> Log:
>   Execute PowerPC64/AIM kernel from direct map region when possible.
>
>   When the kernel can be in real mode in early boot, we can execute from
>   high addresses aliased to the kernel's physical memory. If that high
>   address has the first two bits set to 1 (0xc...), those addresses will
>   automatically become part of the direct map. This reduces page table
>   pressure from the kernel and it sets up the kernel to be used with
>   radix translation, for which it has to be up here.
>
>   This is accomplished by exploiting the fact that all PowerPC kernels are
>   built as position-independent executables and relocate themselves
>   on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
>   VA/PA is random and set by the bootloader. Very early, it processes
>   its ELF relocations to operate wherever it happens to find itself.
>   This patch uses that mechanism to re-enter and re-relocate the kernel
>   a second time witha new base address set up in the early parts of
>   powerpc_init().
>
>   Reviewed by:  jhibbits
>   Differential Revision:D14647
>
> Modified:
>   head/sys/powerpc/aim/aim_machdep.c
>   head/sys/powerpc/aim/locore64.S
>   head/sys/powerpc/aim/mmu_oea64.c
>   head/sys/powerpc/ofw/ofwcall64.S
>   head/sys/powerpc/powerpc/machdep.c
>
> Modified: head/sys/powerpc/aim/aim_machdep.c
> ==
> --- head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:02:46 2018
> (r330844)
> +++ head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 15:03:58 2018
> (r330845)
> @@ -160,15 +160,72 @@ extern void   *dlmisstrap, *dlmisssize;
>  extern void*dsmisstrap, *dsmisssize;
>
>  extern void *ap_pcpu;
> +extern void __restartkernel(vm_offset_t, vm_offset_t, vm_offset_t, void *, 
> uint32_t, register_t offset, register_t msr);
>
> +void aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry,
> +void *mdp, uint32_t mdp_cookie);
>  void aim_cpu_init(vm_offset_t toc);
>
>  void
> +aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void 
> *mdp,
> +uint32_t mdp_cookie)
> +{
> +   register_t  scratch;
> +
> +   /*
> +* If running from an FDT, make sure we are in real mode to avoid
> +* tromping on firmware page tables. Everything in the kernel assumes
> +* 1:1 mappings out of firmware, so this won't break anything not
> +* already broken. This doesn't work if there is live OF, since OF
> +* may internally use non-1:1 mappings.
> +*/
> +   if (ofentry == 0)
> +   mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
> +
> +#ifdef __powerpc64__
> +   /*
> +* If in real mode, relocate to high memory so that the kernel
> +* can execute from the direct map.
> +*/
> +   if (!(mfmsr() & PSL_DR) &&
> +   (vm_offset_t)&aim_early_init < DMAP_BASE_ADDRESS)
> +   __restartkernel(fdt, 0, ofentry, mdp, mdp_cookie,
> +   DMAP_BASE_ADDRESS, mfmsr());
> +#endif
> +
> +   /* Various very early CPU fix ups */
> +   switch (mfpvr() >> 16) {
> +   /*
> +* PowerPC 970 CPUs have a misfeature requested by Apple that
> +* makes them pretend they have a 32-byte cacheline. Turn this
> +* off before we measure the cacheline size.
> +*/
> +   case IBM970:
> +   case IBM970FX:
> +   case IBM970MP:
> +   case IBM970GX:
> +   scratch = mfspr(SPR_HID5);
> +   scratch &= ~HID5_970_DCBZ_SIZE_HI;
> +   mtspr(SPR_HID5, scratch);
> +   break;
> +   #ifdef __powerpc64__
> +   case IBMPOWER7:
> +   case IBMPOWER7PLUS:
> +   case IBMPOWER8:
> +   case IBMPOWER8E:
> +   /* XXX: get from ibm,slb-size in device tree */
> +   n_slbs = 32;
> +   break;
> +   #endif
> +   }
> +}
> +
> +void
>  aim_cpu_init(vm_offset_t toc)
>  {
> size_t  trap_offset, trapsize;
> vm_offset_t trap;
> -   register_t  msr, scratch;
> +   register_t  msr;

scratch is used in powerpc, but not powerpc64.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330870 - head/sys/powerpc/aim

2018-03-13 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Mar 13 18:24:21 2018
New Revision: 330870
URL: https://svnweb.freebsd.org/changeset/base/330870

Log:
  Restore missing temporary variable, deleted by accident in r330845. This
  unbreaks the ppc32 AIM build.
  
  Reported by:  jhibbits

Modified:
  head/sys/powerpc/aim/aim_machdep.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 17:57:53 2018
(r330869)
+++ head/sys/powerpc/aim/aim_machdep.c  Tue Mar 13 18:24:21 2018
(r330870)
@@ -228,9 +228,10 @@ aim_cpu_init(vm_offset_t toc)
register_t  msr;
uint8_t *cache_check;
int cacheline_warn;
-   #ifndef __powerpc64__
+#ifndef __powerpc64__
+   register_t  scratch;
int ppc64;
-   #endif
+#endif
 
trap_offset = 0;
cacheline_warn = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330871 - head/sys/vm

2018-03-13 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 13 18:27:23 2018
New Revision: 330871
URL: https://svnweb.freebsd.org/changeset/base/330871

Log:
  Revert the chunk from r330410 in vm_page_reclaim_run().
  
  There, the pages freed might be managed but the page's lock is not
  owned.  For KPI correctness, the page lock is requried around the call
  to vm_page_free_prep(), which is asserted.  Reclaim loop already did
  the work which could be done by vm_page_free_prep(), so the lock is
  not needed and the only consequence of not owning it is the assert
  trigger.
  
  Instead of adding the locking to satisfy the assert, revert to the
  code that calls vm_page_free_phys() directly.
  
  Reported by:  pho
  Discussed with:   jeff
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Tue Mar 13 18:24:21 2018(r330870)
+++ head/sys/vm/vm_page.c   Tue Mar 13 18:27:23 2018(r330871)
@@ -2538,7 +2538,17 @@ unlock:
}
if (m_mtx != NULL)
mtx_unlock(m_mtx);
-   vm_page_free_pages_toq(&free, false);
+   if ((m = SLIST_FIRST(&free)) != NULL) {
+   vmd = VM_DOMAIN(domain);
+   vm_domain_free_lock(vmd);
+   do {
+   MPASS(vm_phys_domain(m) == domain);
+   SLIST_REMOVE_HEAD(&free, plinks.s.ss);
+   vm_page_free_phys(vmd, m);
+   } while ((m = SLIST_FIRST(&free)) != NULL);
+   vm_domain_free_wakeup(vmd);
+   vm_domain_free_unlock(vmd);
+   }
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330872 - head/bin/ps

2018-03-13 Thread John Baldwin
Author: jhb
Date: Tue Mar 13 18:30:26 2018
New Revision: 330872
URL: https://svnweb.freebsd.org/changeset/base/330872

Log:
  Add a "jail" keyword to list the name of a jail rather than its ID.
  
  Inspired by:  mwlucas
  Reviewed by:  jamie
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14683

Modified:
  head/bin/ps/extern.h
  head/bin/ps/keyword.c
  head/bin/ps/print.c
  head/bin/ps/ps.1

Modified: head/bin/ps/extern.h
==
--- head/bin/ps/extern.hTue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/extern.hTue Mar 13 18:30:26 2018(r330872)
@@ -55,6 +55,7 @@ char   *emulname(KINFO *, VARENT *);
 VARENT *find_varentry(VAR *);
 const   char *fmt_argv(char **, char *, char *, size_t);
 double  getpcpu(const KINFO *);
+char*jailname(KINFO *, VARENT *);
 char*kvar(KINFO *, VARENT *);
 char*label(KINFO *, VARENT *);
 char*loginclass(KINFO *, VARENT *);

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Tue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/keyword.c   Tue Mar 13 18:30:26 2018(r330872)
@@ -108,6 +108,7 @@ static VAR var[] = {
{"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock),
LONG, "ld", 0},
{"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0},
+   {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0},
{"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0},
{"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc),
SHORT, "d", 0},

Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Tue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/print.c Tue Mar 13 18:30:26 2018(r330872)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused)
return (strdup("-"));
}
return (strdup(k->ki_p->ki_loginclass));
+}
+
+char *
+jailname(KINFO *k, VARENT *ve __unused)
+{
+   char *name;
+
+   if (k->ki_p->ki_jid == 0)
+   return (strdup("-"));
+   name = jail_getname(k->ki_p->ki_jid);
+   if (name == NULL)
+   return (strdup("-"));
+   return (name);
 }

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Tue Mar 13 18:27:23 2018(r330871)
+++ head/bin/ps/ps.1Tue Mar 13 18:30:26 2018(r330872)
@@ -29,7 +29,7 @@
 .\" @(#)ps.1   8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd January 23, 2018
+.Dd March 13, 2018
 .Dt PS 1
 .Os
 .Sh NAME
@@ -576,6 +576,8 @@ group name (from egid) (alias
 .It Cm inblk
 total blocks read (alias
 .Cm inblock )
+.It Cm jail
+jail name
 .It Cm jid
 jail ID
 .It Cm jobc
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330875 - head/usr.sbin/usbconfig

2018-03-13 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar 13 19:49:06 2018
New Revision: 330875
URL: https://svnweb.freebsd.org/changeset/base/330875

Log:
  Add "usbconfig dump_all_desc", a subcommand to dump all device and config
  descriptors.
  
  Reviewed by:  hselasky@
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/usbconfig/usbconfig.8
  head/usr.sbin/usbconfig/usbconfig.c

Modified: head/usr.sbin/usbconfig/usbconfig.8
==
--- head/usr.sbin/usbconfig/usbconfig.8 Tue Mar 13 19:28:03 2018
(r330874)
+++ head/usr.sbin/usbconfig/usbconfig.8 Tue Mar 13 19:49:06 2018
(r330875)
@@ -97,6 +97,8 @@ Remove a quirk.
 Add quirk for the currently selected USB device.
 .It Cm remove_quirk Ar quirk_name
 Remove a quirk for the currently selected USB device.
+.It Cm dump_all_desc
+Display the device and configuration descriptors.
 .It Cm dump_quirk_names
 Display the list of supported quirk names.
 .It Cm dump_device_quirks

Modified: head/usr.sbin/usbconfig/usbconfig.c
==
--- head/usr.sbin/usbconfig/usbconfig.c Tue Mar 13 19:28:03 2018
(r330874)
+++ head/usr.sbin/usbconfig/usbconfig.c Tue Mar 13 19:49:06 2018
(r330875)
@@ -77,6 +77,7 @@ struct options {
uint8_t got_power_on:1;
uint8_t got_dump_device_quirks:1;
uint8_t got_dump_quirk_names:1;
+   uint8_t got_dump_all_desc:1;
uint8_t got_dump_device_desc:1;
uint8_t got_dump_curr_config:1;
uint8_t got_dump_all_config:1;
@@ -112,6 +113,7 @@ enum {
T_SHOW_IFACE_DRIVER,
T_DUMP_QUIRK_NAMES,
T_DUMP_DEVICE_QUIRKS,
+   T_DUMP_ALL_DESC,
T_DUMP_DEVICE_DESC,
T_DUMP_CURR_CONFIG_DESC,
T_DUMP_ALL_CONFIG_DESC,
@@ -144,6 +146,7 @@ static const struct token token[] = {
{"remove_quirk", T_REMOVE_QUIRK, 1},
{"dump_quirk_names", T_DUMP_QUIRK_NAMES, 0},
{"dump_device_quirks", T_DUMP_DEVICE_QUIRKS, 0},
+   {"dump_all_desc", T_DUMP_ALL_DESC, 0},
{"dump_device_desc", T_DUMP_DEVICE_DESC, 0},
{"dump_curr_config_desc", T_DUMP_CURR_CONFIG_DESC, 0},
{"dump_all_config_desc", T_DUMP_ALL_CONFIG_DESC, 0},
@@ -283,6 +286,7 @@ usage(void)
"  remove_quirk " "\n"
"  dump_quirk_names" "\n"
"  dump_device_quirks" "\n"
+   "  dump_all_desc" "\n"
"  dump_device_desc" "\n"
"  dump_curr_config_desc" "\n"
"  dump_all_config_desc" "\n"
@@ -489,7 +493,8 @@ flush_command(struct libusb20_backend *pbe, struct opt
}
}
dump_any =
-   (opt->got_dump_device_desc ||
+   (opt->got_dump_all_desc ||
+   opt->got_dump_device_desc ||
opt->got_dump_curr_config ||
opt->got_dump_all_config ||
opt->got_dump_info);
@@ -508,6 +513,10 @@ flush_command(struct libusb20_backend *pbe, struct opt
} else if (opt->got_dump_curr_config) {
printf("\n");
dump_config(pdev, 0);
+   } else if (opt->got_dump_all_desc) {
+   printf("\n");
+   dump_device_desc(pdev);
+   dump_config(pdev, 1);
}
if (dump_any) {
printf("\n");
@@ -694,6 +703,12 @@ main(int argc, char **argv)
if (opt->got_get_template)
duplicate_option(argv[n]);
opt->got_get_template = 1;
+   opt->got_any++;
+   break;
+   case T_DUMP_ALL_DESC:
+   if (opt->got_dump_all_desc)
+   duplicate_option(argv[n]);
+   opt->got_dump_all_desc = 1;
opt->got_any++;
break;
case T_DUMP_DEVICE_DESC:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330876 - head/sys/dev/isp

2018-03-13 Thread Brooks Davis
Author: brooks
Date: Tue Mar 13 19:56:10 2018
New Revision: 330876
URL: https://svnweb.freebsd.org/changeset/base/330876

Log:
  Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.
  
  For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
  When the caddr_t stores an int, dereferencing addr as an (int *) results
  in truncation on little-endian 64-bit systems and corruption (owing to
  extracting top bits) on big-endian 64-bit systems. In practice the
  value of chan was probably always zero on systems of the latter type as
  all such FreeBSD platforms use a register-based calling convention.
  
  Reviewed by:  mav
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14673

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Tue Mar 13 19:49:06 2018
(r330875)
+++ head/sys/dev/isp/isp_freebsd.c  Tue Mar 13 19:56:10 2018
(r330876)
@@ -444,7 +444,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int
 
case ISP_RESCAN:
if (IS_FC(isp)) {
-   chan = *(int *)addr;
+   chan = *(intptr_t *)addr;
if (chan < 0 || chan >= isp->isp_nchan) {
retval = -ENXIO;
break;
@@ -461,7 +461,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int
 
case ISP_FC_LIP:
if (IS_FC(isp)) {
-   chan = *(int *)addr;
+   chan = *(intptr_t *)addr;
if (chan < 0 || chan >= isp->isp_nchan) {
retval = -ENXIO;
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330878 - head/lib/libdpv

2018-03-13 Thread Devin Teske
Author: dteske
Date: Tue Mar 13 20:31:07 2018
New Revision: 330878
URL: https://svnweb.freebsd.org/changeset/base/330878

Log:
  Fix typo and lint/igor warnings

Modified:
  head/lib/libdpv/dpv.3

Modified: head/lib/libdpv/dpv.3
==
--- head/lib/libdpv/dpv.3   Tue Mar 13 20:16:07 2018(r330877)
+++ head/lib/libdpv/dpv.3   Tue Mar 13 20:31:07 2018(r330878)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Jan 26, 2016
+.Dd Mar 13, 2018
 .Dt DPV 3
 .Os
 .Sh NAME
@@ -36,7 +36,8 @@
 .In dpv.h
 .Ft int
 .Fo dpv
-.Fa "struct dpv_config *config, struct dpv_file_node *file_list"
+.Fa "struct dpv_config *config"
+.Fa "struct dpv_file_node *file_list"
 .Fc
 .Ft void
 .Fo dpv_free
@@ -60,8 +61,7 @@ or
 The
 .Fn dpv
 .Fa config
-argument contains the following properties for configuring global display
-features:
+argument properties for configuring global display features:
 .Bd -literal -offset indent
 struct dpv_config {
 uint8_t  keep_tite; /* Cleaner exit for scripts */
@@ -113,11 +113,12 @@ member of the
 .Fn dpv
 .Fa config
 argument is a mask of bit fields indicating various processing options.
-Possible flags are as follows:
+Possible flags are:
 .Bl -tag -width DPV_NO_OVERRUN
 .It Dv DPV_TEST_MODE
 Enable test mode.
-In test mode, the
+In test mode,
+the
 .Fn action
 callback of the
 .Fa config
@@ -126,18 +127,21 @@ Appends
 .Dq [TEST MODE]
 to the status line
 .Po
-to override, set the
+to override,
+set the
 .Va status_format
 member of the
 .Fn dpv
 .Fa config
 argument;
-e.g., to
+for example,
+to
 .Dv DPV_STATUS_DEFAULT
 .Pc .
 .It Dv DPV_WIDE_MODE
 Enable wide mode.
-In wide mode, the length of the
+In wide mode,
+the length of the
 .Va aprompt
 and
 .Va pprompt
@@ -169,7 +173,8 @@ does not support color
 environment variable is ignored
 .Pc .
 .It Dv DPV_NO_OVERRUN
-When enabled, callbacks for the current
+When enabled,
+callbacks for the current
 .Vt dpv_file_node
 are terminated when
 .Fn action
@@ -189,7 +194,7 @@ argument to
 .Fn dpv
 is a pointer to a
 .Dq linked-list ,
-described as follows in
+described in
 .In dpv.h :
 .Bd -literal -offset indent
 struct dpv_file_node {
@@ -206,7 +211,8 @@ struct dpv_file_node {
 For each of the items in the
 .Fa file_list
 .Dq linked-list
-argument, the
+argument,
+the
 .Fn action
 callback member of the
 .Fn dpv
@@ -214,7 +220,7 @@ callback member of the
 argument is called.
 The
 .Fn action
-function should perform a
+function performs a
 .Dq nominal
 action on the file and return.
 The return value of
@@ -231,7 +237,7 @@ provides a reference to the current
 .Vt dpv_file_node
 being processed.
 .Fa out
-provides a file descriptor where the data should go.
+provides a file descriptor where the data goes.
 .Pp
 If the
 .Va output
@@ -244,7 +250,7 @@ the
 .Fa out
 file descriptor of
 .Fn action
-will be zero and should be ignored.
+will be zero and can be ignored.
 If
 .Fa output
 was set to DPV_OUTPUT_FILE,
@@ -257,14 +263,16 @@ was set to DPV_OUTPUT_SHELL,
 will be an open file descriptor to a pipe for a spawned shell program.
 When
 .Fa out
-is greater than zero, you should write any data you have read back to
+is greater than zero,
+write data that has been read back to
 .Fa out .
 .Pp
 To abort
 .Fn dpv ,
 either from the
 .Fn action
-callback or asynchronously from a signal handler, two globals are provided via
+callback or asynchronously from a signal handler,
+two globals are provided via
 .In dpv.h :
 .Bd -literal -offset indent
 extern int dpv_interrupt; /* Set to TRUE in interrupt handler */
@@ -272,11 +280,12 @@ extern int dpv_abort; /* Set to true in callback t
 .Ed
 .Pp
 These globals are not automatically reset and must be manually maintained.
-Don't forget to reset these globals before subsequent invocations of
+Do not forget to reset these globals before subsequent invocations of
 .Fn dpv
 when making multiple calls from the same program.
 .Pp
-In addition, the
+In addition,
+the
 .Va status
 member of the
 .Fn action
@@ -284,7 +293,7 @@ member of the
 argument can be used to control callbacks for the current file.
 The
 .Va status
-member can be set to any of the following from
+member can be set to any of the below from
 .In dpv.h :
 .Bd -literal -offset indent
 enum dpv_status {
@@ -296,13 +305,17 @@ enum dpv_status {
 .Pp
 The default
 .Fa status
-is zero, DPV_STATUS_RUNING, which keeps the callbacks coming for the current
+is zero,
+DPV_STATUS_RUNNING,
+which keeps the callbacks coming for the current
 .Fn file .
 Setting
 .Ql file->status
 to anything other than DPV_STATUS_RUNNING will cause
 .Fn dpv
-to loop to the next file, effecting the next callback, if any.
+to loop to the next file,
+effecting the next callback,
+if any.
 .Pp
 The
 .Fn action
@@ -318,7 +331,7 @@ Percentages are reported through the
 return value of the
 .Fn action
 callback.
-Throughput statistics are calculated from the following global
+Throughput st

svn commit: r330879 - head/lib/libfigpar

2018-03-13 Thread Devin Teske
Author: dteske
Date: Tue Mar 13 20:35:32 2018
New Revision: 330879
URL: https://svnweb.freebsd.org/changeset/base/330879

Log:
  Fix lint/igor warnings

Modified:
  head/lib/libfigpar/figpar.3

Modified: head/lib/libfigpar/figpar.3
==
--- head/lib/libfigpar/figpar.3 Tue Mar 13 20:31:07 2018(r330878)
+++ head/lib/libfigpar/figpar.3 Tue Mar 13 20:35:32 2018(r330879)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Nov 2, 2015
+.Dd Mar 13, 2018
 .Dt FIGPAR 3
 .Os
 .Sh NAME
@@ -38,22 +38,30 @@
 .In figpar.h
 .Ft int
 .Fo parse_config
-.Fa "struct figpar_config options[], const char *path"
-.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option, uint32_t line"
-.Fa "char *directive, char *value\*[rp], uint8_t processing_options"
+.Fa "struct figpar_config options[]"
+.Fa "const char *path"
+.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option"
+.Fa "uint32_t line"
+.Fa "char *directive"
+.Fa "char *value\*[rp]"
+.Fa "uint8_t processing_options"
 .Fc
 .Ft "struct figpar_config *"
 .Fo get_config_option
-.Fa "struct figpar_config options[], const char *directive"
+.Fa "struct figpar_config options[]"
+.Fa "const char *directive"
 .Fc
 .In string_m.h
 .Ft int
 .Fo replaceall
-.Fa "char *source, const char *find, const char *replace"
+.Fa "char *source"
+.Fa "const char *find"
+.Fa "const char *replace"
 .Fc
 .Ft unsigned int
 .Fo strcount
-.Fa "const char *source, const char *find"
+.Fa "const char *source"
+.Fa "const char *find"
 .Fc
 .Ft void
 .Fo strexpand
@@ -70,7 +78,8 @@
 .Sh DESCRIPTION
 The
 .Nm
-library provides a light-weight, portable framework for parsing configuration
+library provides a light-weight,
+portable framework for parsing configuration
 files.
 The library uses
 .Xr open 2 ,
@@ -87,8 +96,9 @@ provides raw data to a set of callback functions.
 These callback functions can in-turn initiate abort through their return value,
 allowing custom syntax validation during parsing.
 .Pp
-Configuration directives, types, and callback functions are provided through
-data structures defined in
+Configuration directives,
+types,
+and callback functions are provided through data structures defined in
 .In figpar.h :
 .Bd -literal -offset indent
 struct figpar_config {
@@ -132,7 +142,7 @@ argument to
 .Fn parse_config
 is a mask of bit fields which indicate various
 processing options.
-The possible flags are as follows:
+The possible flags are:
 .Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON
 .It Dv FIGPAR_BREAK_ON_EQUALS
 An equals sign
@@ -151,7 +161,8 @@ Normally directives are matched case insensitively usi
 .Xr fnmatch 3 .
 This flag enables directive matching to be case sensitive.
 .It Dv FIGPAR_REQUIRE_EQUALS
-If a directive is not followed by an equals, processing is aborted.
+If a directive is not followed by an equals,
+processing is aborted.
 .It Dv FIGPAR_STRICT_EQUALS
 Equals must be part of the directive to be considered a delimiter between
 directive and value.
@@ -159,7 +170,7 @@ directive and value.
 .Pp
 The
 .Fa options
-struct array pointer can be NULL and every directive will invoke the
+struct array pointer can be NULL and every directive will run the
 .Fn unknown
 function argument.
 .Pp
@@ -168,13 +179,16 @@ The directive for each figpar_config item in the
 options argument is matched against each parsed directive using
 .Xr fnmatch 3
 until a match is found.
-If a match is found, the
+If a match is found,
+the
 .Fn action
-function for that figpar_config directive is invoked with the line number,
-directive, and value.
-Otherwise if no match, the
+function for that figpar_config directive is run with the line number,
+directive,
+and value.
+Otherwise if no match,
+the
 .Fn unknown
-function is invoked
+function is run
 .Pq with the same arguments .
 .Pp
 If either
@@ -197,19 +211,20 @@ is entirely optional as-is the use of
 .Fa "enum figpar_cfgtype"
 or
 .Fa "union figpar_cfgvalue" .
-For example, you could choose to pass a NULL pointer to
+For example,
+a NULL pointer can be passed to
 .Fn parse_config
-for the first argument and then provide a simple
+for the first argument while providing a simple
 .Fa unknown
 function based on
 .Xr queue 3
-that populates a singly-linked list of your own struct containing the
+that populates a singly-linked list of a struct containing the
 .Fa directive
 and
 .Fa value .
 .Pp
-In addition, the following miscellaneous string manipulation routines are
-provided by
+In addition,
+miscellaneous string manipulation routines are provided by
 .In string_m.h :
 .Bl -tag -width strexpandnl()
 .It Fn replaceall
@@ -224,8 +239,7 @@ Count the number of occurrences of one string that app
 .Fa source
 string.
 Return value is the total count.
-An example use would be if you need to know how large a block of memory needs
-to be for a
+An example use would be to show how large a block of memory needs to be for a
 .Fn replaceall
 series.
 .It Fn strexpan

svn commit: r330880 - head/sys/dev/md

2018-03-13 Thread Brooks Davis
Author: brooks
Date: Tue Mar 13 20:39:06 2018
New Revision: 330880
URL: https://svnweb.freebsd.org/changeset/base/330880

Log:
  Don't overflow the kernel struct mdio in the MDIOCLIST ioctl.
  
  Always terminate the list with -1 and document the ioctl behavior.
  This preserves existing behavior as seen from userspace with the
  addition of the unconditional termination which will not be seen by
  working consumers of MDIOCLIST.
  
  Because this ioctl can only be performed by root (in default
  configurations) and is not used in the base system this bug is not
  deemed to warrant either a security advisory or an eratta notice.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Discussed with:   security-officer (gordon)
  MFC after:3 days
  Security: kernel heap buffer overflow
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14685

Modified:
  head/sys/dev/md/md.c

Modified: head/sys/dev/md/md.c
==
--- head/sys/dev/md/md.cTue Mar 13 20:35:32 2018(r330879)
+++ head/sys/dev/md/md.cTue Mar 13 20:39:06 2018(r330880)
@@ -1750,13 +1750,24 @@ err_after_new:
strlen(sc->file) + 1);
return (error);
case MDIOCLIST:
+   /*
+* Write the number of md devices to mdio->md_pad[0].
+* Write the unit number of the first (MDNPAD - 2) units
+* to mdio->md_pad[1::(MDNPAD - 2)] and terminate the
+* list with -1.
+*
+* XXX: There is currently no mechanism to retrieve unit
+* numbers for more than (MDNPAD - 2) units.
+*
+* XXX: Due to the use of LIST_INSERT_HEAD in mdnew(), the
+* list of visible unit numbers not stable.
+*/
i = 1;
LIST_FOREACH(sc, &md_softc_list, list) {
-   if (i == MDNPAD - 1)
-   mdio->md_pad[i] = -1;
-   else
+   if (i < MDNPAD - 1)
mdio->md_pad[i++] = sc->unit;
}
+   mdio->md_pad[MIN(i, MDNPAD - 1)] = -1;
mdio->md_pad[0] = i - 1;
return (0);
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330881 - head/sys/sys

2018-03-13 Thread Brooks Davis
Author: brooks
Date: Tue Mar 13 20:54:18 2018
New Revision: 330881
URL: https://svnweb.freebsd.org/changeset/base/330881

Log:
  md_pad is used by MDIOCLIST and not available for future use.
  
  MFC after:1 week

Modified:
  head/sys/sys/mdioctl.h

Modified: head/sys/sys/mdioctl.h
==
--- head/sys/sys/mdioctl.h  Tue Mar 13 20:39:06 2018(r330880)
+++ head/sys/sys/mdioctl.h  Tue Mar 13 20:54:18 2018(r330881)
@@ -64,7 +64,7 @@ struct md_ioctl {
int md_fwheads; /* firmware heads */
int md_fwsectors;   /* firmware sectors */
char*md_label;  /* label of the device */
-   int md_pad[MDNPAD]; /* padding for future ideas */
+   int md_pad[MDNPAD]; /* storage for MDIOCLIST */
 };
 
 #define MD_NAME"md"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330882 - head/sys/dev/cxgbe/tom

2018-03-13 Thread John Baldwin
Author: jhb
Date: Tue Mar 13 21:42:38 2018
New Revision: 330882
URL: https://svnweb.freebsd.org/changeset/base/330882

Log:
  Simplify error handling in t4_tom.ko module loading.
  
  - Change t4_ddp_mod_load() to return void instead of always returning
success.  This avoids having to pretend to have proper support for
unloading when only part of t4_tom_mod_load() has run.
  - If t4_register_uld() fails, don't invoke t4_tom_mod_unload() directly.
The module handling code in the kernel invokes MOD_UNLOAD on a module
whose MOD_LOAD fails with an error already.
  
  Reviewed by:  np (part of a larger patch)
  MFC after:1 month
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_ddp.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_ddp.c
==
--- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 13 20:54:18 2018
(r330881)
+++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Mar 13 21:42:38 2018
(r330882)
@@ -1939,7 +1939,7 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job
return (0);
 }
 
-int
+void
 t4_ddp_mod_load(void)
 {
 
@@ -1948,7 +1948,6 @@ t4_ddp_mod_load(void)
TAILQ_INIT(&ddp_orphan_pagesets);
mtx_init(&ddp_orphan_pagesets_lock, "ddp orphans", NULL, MTX_DEF);
TASK_INIT(&ddp_orphan_task, 0, ddp_free_orphan_pagesets, NULL);
-   return (0);
 }
 
 void

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 13 20:54:18 2018
(r330881)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Mar 13 21:42:38 2018
(r330882)
@@ -1170,7 +1170,6 @@ t4_aio_queue_tom(struct socket *so, struct kaiocb *job
 static int
 t4_tom_mod_load(void)
 {
-   int rc;
struct protosw *tcp_protosw, *tcp6_protosw;
 
/* CPL handlers */
@@ -1178,9 +1177,7 @@ t4_tom_mod_load(void)
t4_init_listen_cpl_handlers();
t4_init_cpl_io_handlers();
 
-   rc = t4_ddp_mod_load();
-   if (rc != 0)
-   return (rc);
+   t4_ddp_mod_load();
 
tcp_protosw = pffindproto(PF_INET, IPPROTO_TCP, SOCK_STREAM);
if (tcp_protosw == NULL)
@@ -1202,11 +1199,7 @@ t4_tom_mod_load(void)
ifaddr_evhandler = EVENTHANDLER_REGISTER(ifaddr_event,
t4_tom_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY);
 
-   rc = t4_register_uld(&tom_uld_info);
-   if (rc != 0)
-   t4_tom_mod_unload();
-
-   return (rc);
+   return (t4_register_uld(&tom_uld_info));
 }
 
 static void

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 13 20:54:18 2018
(r330881)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Mar 13 21:42:38 2018
(r330882)
@@ -389,7 +389,7 @@ void t4_free_page_pods(struct ppod_reservation *);
 int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *,
 struct mbuf **, struct mbuf **, int *);
 int t4_aio_queue_ddp(struct socket *, struct kaiocb *);
-int t4_ddp_mod_load(void);
+void t4_ddp_mod_load(void);
 void t4_ddp_mod_unload(void);
 void ddp_assert_empty(struct toepcb *);
 void ddp_init_toep(struct toepcb *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330883 - head/stand/userboot/userboot

2018-03-13 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 13 22:54:29 2018
New Revision: 330883
URL: https://svnweb.freebsd.org/changeset/base/330883

Log:
  Fix typo that misteriously passes compilation.

Modified:
  head/stand/userboot/userboot/main.c

Modified: head/stand/userboot/userboot/main.c
==
--- head/stand/userboot/userboot/main.c Tue Mar 13 21:42:38 2018
(r330882)
+++ head/stand/userboot/userboot/main.c Tue Mar 13 22:54:29 2018
(r330883)
@@ -159,7 +159,7 @@ extract_currdev(void)
//bzero(&dev, sizeof(dev));
 
 #if defined(USERBOOT_ZFS_SUPPORT)
-   CT_ASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
+   CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
if (userboot_zfs_found) {
struct zfs_devdesc zdev;

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-13 Thread John Baldwin
Author: jhb
Date: Tue Mar 13 23:05:51 2018
New Revision: 330884
URL: https://svnweb.freebsd.org/changeset/base/330884

Log:
  Support for TLS offload of TOE connections on T6 adapters.
  
  The TOE engine in Chelsio T6 adapters supports offloading of TLS
  encryption and TCP segmentation for offloaded connections.  Sockets
  using TLS are required to use a set of custom socket options to upload
  RX and TX keys to the NIC and to enable RX processing.  Currently
  these socket options are implemented as TCP options in the vendor
  specific range.  A patched OpenSSL library will be made available in a
  port / package for use with the TLS TOE support.
  
  TOE sockets can either offload both transmit and reception of TLS
  records or just transmit.  TLS offload (both RX and TX) is enabled by
  setting the dev.t6nex..tls sysctl to 1 and requires TOE to be
  enabled on the relevant interface.  Transmit offload can be used on
  any "normal" or TLS TOE socket by using the custom socket option to
  program a transmit key.  This permits most TOE sockets to
  transparently offload TLS when applications use a patched SSL library
  (e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
  library).  Receive offload can only be used with TOE sockets using the
  TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
  list of TCP port numbers.  Any connection with either a local or
  remote port number in that list will be created as a TLS socket rather
  than a plain TOE socket.  Note that although this sysctl accepts an
  arbitrary list of port numbers, the sysctl(8) tool is only able to set
  sysctl nodes to a single value.  A TLS socket will hang without
  receiving data if used by an application that is not using a patched
  SSL library.  Thus, the tls_rx_ports node should be used with care.
  For a server mostly concerned with offloading TLS transmit, this node
  is not needed as plain TOE sockets will fall back to software crypto
  when using an unpatched SSL library.
  
  New per-interface statistics nodes are added giving counts of TLS
  packets and payload bytes (payload bytes do not include TLS headers or
  authentication tags/MACs) offloaded via the TOE engine, e.g.:
  
  dev.cc.0.stats.rx_tls_octets: 149
  dev.cc.0.stats.rx_tls_records: 13
  dev.cc.0.stats.tx_tls_octets: 26501823
  dev.cc.0.stats.tx_tls_records: 1620
  
  TLS transmit work requests are constructed by a new variant of
  t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.
  
  TLS transmit work requests require a buffer containing IVs.  If the
  IVs are too large to fit into the work request, a separate buffer is
  allocated when constructing a work request.  This buffer is associated
  with the transmit descriptor and freed when the descriptor is ACKed by
  the adapter.
  
  Received TLS frames use two new CPL messages.  The first message is a
  CPL_TLS_DATA containing the decryped payload of a single TLS record.
  The handler places the mbuf containing the received payload on an
  mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
  which includes a copy of the TLS header and indicates if there were
  any errors.  The handler for this message places the TLS header into
  the socket buffer followed by the saved mbuf with the payload data.
  Both of these handlers are contained in tom/t4_tls.c.
  
  A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
  including send_rx_credits(), a new send_rx_modulate(), and
  t4_close_conn().
  
  TLS keys for both transmit and receive are stored in onboard memory
  in the NIC in the "TLS keys" memory region.
  
  In some cases a TLS socket can hang with pending data available in the
  NIC that is not delivered to the host.  As a workaround, TLS sockets
  are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
  any data is read from a TLS socket.  In addition, a fallback timer will
  periodically send CPL_RX_DATA_ACK messages to the NIC for connections
  that are still in the handshake phase.  Once the connection has
  finished the handshake and programmed RX keys via the socket option,
  the timer is stopped.
  
  A new function select_ulp_mode() is used to determine what sub-mode a
  given TOE socket should use (plain TOE, DDP, or TLS).  The existing
  set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
  handles initialization of TLS-specific state when necessary in
  addition to DDP-specific state.
  
  Since TLS sockets do not receive individual TCP segments but always
  receive full TLS records, they can receive more data than is available
  in the current window (e.g. if a 16k TLS record is received but the
  socket buffer is itself 16k).  To cope with this, just drop the window
  to 0 when this happens, but track the overage and "eat" the overage as
  it is read from the socket buffer not opening the window (or adding
  rx_credits) for the overage bytes.
  
  Reviewed by:  np (earlier version)
  Spons

svn commit: r330885 - head/sys/modules/cam

2018-03-13 Thread Warner Losh
Author: imp
Date: Tue Mar 13 23:36:15 2018
New Revision: 330885
URL: https://svnweb.freebsd.org/changeset/base/330885

Log:
  We need opt_compat.h after r330819 and 330820.
  
  Add opt_compat.h to fix the stand-alone build case.
  
  Sponsored by: Netflix.

Modified:
  head/sys/modules/cam/Makefile

Modified: head/sys/modules/cam/Makefile
==
--- head/sys/modules/cam/Makefile   Tue Mar 13 23:05:51 2018
(r330884)
+++ head/sys/modules/cam/Makefile   Tue Mar 13 23:36:15 2018
(r330885)
@@ -8,6 +8,7 @@ KMOD=   cam
 
 # See sys/conf/options for the flags that go into the different opt_*.h files.
 SRCS=  opt_cam.h
+SRCS=  opt_compat.h
 SRCS+= opt_ada.h
 SRCS+= opt_scsi.h
 SRCS+= opt_cd.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330886 - head/share/examples

2018-03-13 Thread Devin Teske
Author: dteske
Date: Tue Mar 13 23:37:33 2018
New Revision: 330886
URL: https://svnweb.freebsd.org/changeset/base/330886

Log:
  Install files added in SVN's r295373, r295457, r295542
  
  Reported by:  woodsb02
  MFC after:3 days
  X-MFC to: stable/11

Modified:
  head/share/examples/Makefile

Modified: head/share/examples/Makefile
==
--- head/share/examples/MakefileTue Mar 13 23:36:15 2018
(r330885)
+++ head/share/examples/MakefileTue Mar 13 23:37:33 2018
(r330886)
@@ -76,6 +76,12 @@ XFILES=  BSD_daemon/FreeBSD.pfa \
indent/indent.pro \
ipfw/change_rules.sh \
jails/README \
+   jails/VIMAGE \
+   jails/jail.xxx.conf \
+   jails/jib \
+   jails/jng \
+   jails/rc.conf.jails \
+   jails/rcjail.xxx.conf \
kld/Makefile \
kld/cdev/Makefile \
kld/cdev/README \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330887 - head/usr.sbin/cxgbetool

2018-03-13 Thread Navdeep Parhar
Author: np
Date: Wed Mar 14 00:04:58 2018
New Revision: 330887
URL: https://svnweb.freebsd.org/changeset/base/330887

Log:
  cxgbetool(8): Add the ability to decode hardware TCBs.
  
  Obtained from:Chelsio Communications
  MFC after:1 week
  Sponsored by: Chelsio Communications

Added:
  head/usr.sbin/cxgbetool/tcb_common.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcb_common.h   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbinfot4.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbinfot5.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbinfot6.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbshowt4.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbshowt5.c   (contents, props changed)
  head/usr.sbin/cxgbetool/tcbshowt6.c   (contents, props changed)
Modified:
  head/usr.sbin/cxgbetool/Makefile
  head/usr.sbin/cxgbetool/cxgbetool.c
Directory Properties:
  head/usr.sbin/cxgbetool/reg_defs_t5.c   (props changed)
  head/usr.sbin/cxgbetool/reg_defs_t6.c   (props changed)

Modified: head/usr.sbin/cxgbetool/Makefile
==
--- head/usr.sbin/cxgbetool/MakefileTue Mar 13 23:37:33 2018
(r330886)
+++ head/usr.sbin/cxgbetool/MakefileWed Mar 14 00:04:58 2018
(r330887)
@@ -2,6 +2,11 @@
 
 PROG=  cxgbetool
 MAN=   cxgbetool.8
+SRCS=  cxgbetool.c
+SRCS+= tcb_common.c
+SRCS+= tcbinfot4.c tcbshowt4.c
+SRCS+= tcbinfot5.c tcbshowt5.c
+SRCS+= tcbinfot6.c tcbshowt6.c
 CFLAGS+= -I${SRCTOP}/sys/dev/cxgbe -I${SRCTOP}/sys -I.
 WARNS?= 2
 

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==
--- head/usr.sbin/cxgbetool/cxgbetool.c Tue Mar 13 23:37:33 2018
(r330886)
+++ head/usr.sbin/cxgbetool/cxgbetool.c Wed Mar 14 00:04:58 2018
(r330887)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "t4_ioctl.h"
+#include "tcb_common.h"
 
 #define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo))
 #definemax(x, y) ((x) > (y) ? (x) : (y))
@@ -2102,6 +2103,7 @@ memdump(int argc, const char *argv[])
 static void
 show_tcb(uint32_t *buf, uint32_t len)
 {
+   unsigned char *tcb = (unsigned char *)buf;
const char *s;
int i, n = 8;
 
@@ -2112,6 +2114,10 @@ show_tcb(uint32_t *buf, uint32_t len)
}
printf("\n");
}
+   set_tcb_info(TIDTYPE_TCB, chip_id);
+   set_print_style(PRNTSTYL_COMP);
+   swizzle_tcb(tcb);
+   parse_n_display_xcb(tcb);
 }
 
 #define A_TP_CMM_TCB_BASE 0x7d10

Added: head/usr.sbin/cxgbetool/tcb_common.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/cxgbetool/tcb_common.cWed Mar 14 00:04:58 2018
(r330887)
@@ -0,0 +1,703 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 Chelsio Communications, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "tcb_common.h"
+
+/***:---
+ ***: externals
+ ***:---
+ */
+
+extern _TCBVAR g_tcb_info4[];
+extern _TCBVAR g_scb_info4[];
+extern _TCBVAR g_fcb_info4[];
+extern void t4_display_tcb_aux_0(_TCBVAR *tvp,int aux);
+extern void t4_display_tcb_aux_1(_TCBVAR *tvp,int aux);
+extern void t4_display_tcb_aux_2(_TCBVAR *tvp,int aux);
+extern void t4_display_tcb_aux_3(_TCBVAR *tvp,int aux);
+
+extern _TCBVAR g_tcb_info5[];
+extern _TCBVA

Re: svn commit: r330885 - head/sys/modules/cam

2018-03-13 Thread Brooks Davis
On Tue, Mar 13, 2018 at 11:36:15PM +, Warner Losh wrote:
> Author: imp
> Date: Tue Mar 13 23:36:15 2018
> New Revision: 330885
> URL: https://svnweb.freebsd.org/changeset/base/330885
> 
> Log:
>   We need opt_compat.h after r330819 and 330820.
>   
>   Add opt_compat.h to fix the stand-alone build case.

Sorry about that.  I only tested with buildkernel.  I'll MFC this before
either of those.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r330891 - head/stand/uboot/common

2018-03-13 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 02:35:49 2018
New Revision: 330891
URL: https://svnweb.freebsd.org/changeset/base/330891

Log:
  ubldr: Bump heap size from 512K to 1M
  
  lualoader in itself only uses another ~200K, but there seems to be no reason
  not to bump it a little higher to give us some more wiggle room.
  
  With this, I can boot using a menu-enabled lualoader, no problem and
  reasonably fast. Some heap usage datapoints from the review:
  
  forthloader, no menus, kernel loaded:
  heap base at 0x1203d5b0, top at 0x1208e000, used 330320
  
  lualoader, no menus, kernel loaded:
  heap base at 0x42050028, top at 0x420ab000, used 372696
  
  lualoader, menus, kernel loaded:
  heap base at 0x42050028, top at 0x420d5000, used 544728
  
  Since then, the no menu case for lualoader should have decreased slightly as
  I've made some changes to make sure that it no longer loads any of th emenu
  bits with beastie disabled.
  
  While here, split heap size out into a HEAP_SIZE macro.
  
  Reviewed by:  ian, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14471

Modified:
  head/stand/uboot/common/main.c

Modified: head/stand/uboot/common/main.c
==
--- head/stand/uboot/common/main.c  Wed Mar 14 01:38:47 2018
(r330890)
+++ head/stand/uboot/common/main.c  Wed Mar 14 02:35:49 2018
(r330891)
@@ -41,6 +41,10 @@ __FBSDID("$FreeBSD$");
 #definenitems(x)   (sizeof((x)) / sizeof((x)[0]))
 #endif
 
+#ifndef HEAP_SIZE
+#defineHEAP_SIZE   (1 * 1024 * 1024)
+#endif
+
 struct uboot_devdesc currdev;
 struct arch_switch archsw; /* MI/MD interface boundary */
 int devs_no;
@@ -421,7 +425,7 @@ main(int argc, char **argv)
 * of our bss and the bottom of the u-boot stack to avoid overlap.
 */
uboot_heap_start = round_page((uintptr_t)end);
-   uboot_heap_end   = uboot_heap_start + 512 * 1024;
+   uboot_heap_end   = uboot_heap_start + HEAP_SIZE;
setheap((void *)uboot_heap_start, (void *)uboot_heap_end);
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r330885 - head/sys/modules/cam

2018-03-13 Thread Warner Losh
On Mar 13, 2018 6:07 PM, "Brooks Davis"  wrote:

On Tue, Mar 13, 2018 at 11:36:15PM +, Warner Losh wrote:
> Author: imp
> Date: Tue Mar 13 23:36:15 2018
> New Revision: 330885
> URL: https://svnweb.freebsd.org/changeset/base/330885
>
> Log:
>   We need opt_compat.h after r330819 and 330820.
>
>   Add opt_compat.h to fix the stand-alone build case.

Sorry about that.  I only tested with buildkernel.  I'll MFC this before
either of those.


Don't fret. I was on the review and missed it too.

Warner
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330894 - in head/sys/contrib/zstd: . contrib/meson doc doc/images lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests zlibWrapper zlibWr...

2018-03-13 Thread Conrad Meyer
Author: cem
Date: Wed Mar 14 03:00:17 2018
New Revision: 330894
URL: https://svnweb.freebsd.org/changeset/base/330894

Log:
  Update to Zstandard 1.3.3
  
  Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin().
  The issue is tracked upstream at https://github.com/facebook/zstd/pull/884 .
  Otherwise, these are vanilla Zstandard 1.3.3 files.
  
  Note that the 1.3.4 release should be due out soon.
  
  Sponsored by: Dell EMC Isilon

Added:
  head/sys/contrib/zstd/doc/images/zstd_logo86.png   (contents, props changed)
  head/sys/contrib/zstd/lib/compress/zstd_compress_internal.h
 - copied, changed from r330893, 
head/sys/contrib/zstd/lib/compress/zstd_compress.h
  head/sys/contrib/zstd/tests/seqgen.c   (contents, props changed)
  head/sys/contrib/zstd/tests/seqgen.h   (contents, props changed)
Deleted:
  head/sys/contrib/zstd/lib/compress/zstd_compress.h
Modified:
  head/sys/contrib/zstd/Makefile
  head/sys/contrib/zstd/NEWS
  head/sys/contrib/zstd/README.md
  head/sys/contrib/zstd/circle.yml
  head/sys/contrib/zstd/contrib/meson/meson.build
  head/sys/contrib/zstd/doc/zstd_compression_format.md
  head/sys/contrib/zstd/doc/zstd_manual.html
  head/sys/contrib/zstd/lib/BUCK
  head/sys/contrib/zstd/lib/common/bitstream.h
  head/sys/contrib/zstd/lib/common/mem.h
  head/sys/contrib/zstd/lib/common/pool.c
  head/sys/contrib/zstd/lib/common/xxhash.c
  head/sys/contrib/zstd/lib/common/zstd_common.c
  head/sys/contrib/zstd/lib/common/zstd_internal.h
  head/sys/contrib/zstd/lib/compress/zstd_compress.c
  head/sys/contrib/zstd/lib/compress/zstd_double_fast.c
  head/sys/contrib/zstd/lib/compress/zstd_double_fast.h
  head/sys/contrib/zstd/lib/compress/zstd_fast.c
  head/sys/contrib/zstd/lib/compress/zstd_fast.h
  head/sys/contrib/zstd/lib/compress/zstd_lazy.c
  head/sys/contrib/zstd/lib/compress/zstd_lazy.h
  head/sys/contrib/zstd/lib/compress/zstd_ldm.h
  head/sys/contrib/zstd/lib/compress/zstd_opt.c
  head/sys/contrib/zstd/lib/compress/zstd_opt.h
  head/sys/contrib/zstd/lib/compress/zstdmt_compress.c
  head/sys/contrib/zstd/lib/compress/zstdmt_compress.h
  head/sys/contrib/zstd/lib/decompress/zstd_decompress.c
  head/sys/contrib/zstd/lib/deprecated/zbuff_compress.c
  head/sys/contrib/zstd/lib/dictBuilder/zdict.c
  head/sys/contrib/zstd/lib/legacy/zstd_v01.c
  head/sys/contrib/zstd/lib/legacy/zstd_v02.c
  head/sys/contrib/zstd/lib/legacy/zstd_v03.c
  head/sys/contrib/zstd/lib/legacy/zstd_v04.c
  head/sys/contrib/zstd/lib/legacy/zstd_v05.c
  head/sys/contrib/zstd/lib/legacy/zstd_v06.c
  head/sys/contrib/zstd/lib/legacy/zstd_v07.c
  head/sys/contrib/zstd/lib/zstd.h
  head/sys/contrib/zstd/programs/BUCK
  head/sys/contrib/zstd/programs/Makefile
  head/sys/contrib/zstd/programs/bench.c
  head/sys/contrib/zstd/programs/bench.h
  head/sys/contrib/zstd/programs/dibio.c
  head/sys/contrib/zstd/programs/fileio.c
  head/sys/contrib/zstd/programs/fileio.h
  head/sys/contrib/zstd/programs/platform.h
  head/sys/contrib/zstd/programs/util.h
  head/sys/contrib/zstd/programs/zstd.1
  head/sys/contrib/zstd/programs/zstd.1.md
  head/sys/contrib/zstd/programs/zstdcli.c
  head/sys/contrib/zstd/tests/Makefile
  head/sys/contrib/zstd/tests/decodecorpus.c
  head/sys/contrib/zstd/tests/fullbench.c
  head/sys/contrib/zstd/tests/fuzzer.c
  head/sys/contrib/zstd/tests/paramgrill.c
  head/sys/contrib/zstd/tests/playTests.sh
  head/sys/contrib/zstd/tests/zbufftest.c
  head/sys/contrib/zstd/tests/zstreamtest.c
  head/sys/contrib/zstd/zlibWrapper/BUCK
  head/sys/contrib/zstd/zlibWrapper/examples/zwrapbench.c
  head/sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c

Modified: head/sys/contrib/zstd/Makefile
==
--- head/sys/contrib/zstd/Makefile  Wed Mar 14 02:56:43 2018
(r330893)
+++ head/sys/contrib/zstd/Makefile  Wed Mar 14 03:00:17 2018
(r330894)
@@ -72,9 +72,12 @@ zstdmt:
 zlibwrapper:
$(MAKE) -C $(ZWRAPDIR) test
 
+.PHONY: check
+check: shortest
+
 .PHONY: test shortest
 test shortest:
-   $(MAKE) -C $(PRGDIR) allVariants
+   $(MAKE) -C $(PRGDIR) allVariants MOREFLAGS="-g -DZSTD_DEBUG=1"
$(MAKE) -C $(TESTDIR) $@
 
 .PHONY: examples
@@ -127,11 +130,6 @@ uninstall:
 travis-install:
$(MAKE) install PREFIX=~/install_test_dir
 
-.PHONY: gppbuild
-gppbuild: clean
-   g++ -v
-   CC=g++ $(MAKE) -C programs all CFLAGS="-O3 -Wall -Wextra -Wundef 
-Wshadow -Wcast-align -Werror"
-
 .PHONY: gcc5build
 gcc5build: clean
gcc-5 -v
@@ -163,7 +161,7 @@ aarch64build: clean
CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
 
 ppcbuild: clean
-   CC=powerpc-linux-gnu-gcc CLAGS="-m32 -Wno-attributes -Werror" $(MAKE) 
allzstd
+   CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) 
allzstd
 
 ppc64build: clean
CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd

Modified: head/sys/contrib/zstd/NEWS

Re: svn commit: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-13 Thread O. Hartmann
On Tue, 13 Mar 2018 23:05:51 + (UTC)
John Baldwin  wrote:

> Author: jhb
> Date: Tue Mar 13 23:05:51 2018
> New Revision: 330884
> URL: https://svnweb.freebsd.org/changeset/base/330884
> 
> Log:
>   Support for TLS offload of TOE connections on T6 adapters.
>   
>   The TOE engine in Chelsio T6 adapters supports offloading of TLS
>   encryption and TCP segmentation for offloaded connections.  Sockets
>   using TLS are required to use a set of custom socket options to upload
>   RX and TX keys to the NIC and to enable RX processing.  Currently
>   these socket options are implemented as TCP options in the vendor
>   specific range.  A patched OpenSSL library will be made available in a
>   port / package for use with the TLS TOE support.
>   
>   TOE sockets can either offload both transmit and reception of TLS
>   records or just transmit.  TLS offload (both RX and TX) is enabled by
>   setting the dev.t6nex..tls sysctl to 1 and requires TOE to be
>   enabled on the relevant interface.  Transmit offload can be used on
>   any "normal" or TLS TOE socket by using the custom socket option to
>   program a transmit key.  This permits most TOE sockets to
>   transparently offload TLS when applications use a patched SSL library
>   (e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
>   library).  Receive offload can only be used with TOE sockets using the
>   TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
>   list of TCP port numbers.  Any connection with either a local or
>   remote port number in that list will be created as a TLS socket rather
>   than a plain TOE socket.  Note that although this sysctl accepts an
>   arbitrary list of port numbers, the sysctl(8) tool is only able to set
>   sysctl nodes to a single value.  A TLS socket will hang without
>   receiving data if used by an application that is not using a patched
>   SSL library.  Thus, the tls_rx_ports node should be used with care.
>   For a server mostly concerned with offloading TLS transmit, this node
>   is not needed as plain TOE sockets will fall back to software crypto
>   when using an unpatched SSL library.
>   
>   New per-interface statistics nodes are added giving counts of TLS
>   packets and payload bytes (payload bytes do not include TLS headers or
>   authentication tags/MACs) offloaded via the TOE engine, e.g.:
>   
>   dev.cc.0.stats.rx_tls_octets: 149
>   dev.cc.0.stats.rx_tls_records: 13
>   dev.cc.0.stats.tx_tls_octets: 26501823
>   dev.cc.0.stats.tx_tls_records: 1620
>   
>   TLS transmit work requests are constructed by a new variant of
>   t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.
>   
>   TLS transmit work requests require a buffer containing IVs.  If the
>   IVs are too large to fit into the work request, a separate buffer is
>   allocated when constructing a work request.  This buffer is associated
>   with the transmit descriptor and freed when the descriptor is ACKed by
>   the adapter.
>   
>   Received TLS frames use two new CPL messages.  The first message is a
>   CPL_TLS_DATA containing the decryped payload of a single TLS record.
>   The handler places the mbuf containing the received payload on an
>   mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
>   which includes a copy of the TLS header and indicates if there were
>   any errors.  The handler for this message places the TLS header into
>   the socket buffer followed by the saved mbuf with the payload data.
>   Both of these handlers are contained in tom/t4_tls.c.
>   
>   A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
>   including send_rx_credits(), a new send_rx_modulate(), and
>   t4_close_conn().
>   
>   TLS keys for both transmit and receive are stored in onboard memory
>   in the NIC in the "TLS keys" memory region.
>   
>   In some cases a TLS socket can hang with pending data available in the
>   NIC that is not delivered to the host.  As a workaround, TLS sockets
>   are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
>   any data is read from a TLS socket.  In addition, a fallback timer will
>   periodically send CPL_RX_DATA_ACK messages to the NIC for connections
>   that are still in the handshake phase.  Once the connection has
>   finished the handshake and programmed RX keys via the socket option,
>   the timer is stopped.
>   
>   A new function select_ulp_mode() is used to determine what sub-mode a
>   given TOE socket should use (plain TOE, DDP, or TLS).  The existing
>   set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
>   handles initialization of TLS-specific state when necessary in
>   addition to DDP-specific state.
>   
>   Since TLS sockets do not receive individual TCP segments but always
>   receive full TLS records, they can receive more data than is available
>   in the current window (e.g. if a 16k TLS record is received but the
>   socket buffer is itself 16k).  To cope with this, just 

Re: svn commit: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-13 Thread O. Hartmann
On Wed, 14 Mar 2018 06:25:10 +0100
"O. Hartmann"  wrote:

> On Tue, 13 Mar 2018 23:05:51 + (UTC)
> John Baldwin  wrote:
> 
> > Author: jhb
> > Date: Tue Mar 13 23:05:51 2018
> > New Revision: 330884
> > URL: https://svnweb.freebsd.org/changeset/base/330884
> > 
> > Log:
> >   Support for TLS offload of TOE connections on T6 adapters.
> >   
> >   The TOE engine in Chelsio T6 adapters supports offloading of TLS
> >   encryption and TCP segmentation for offloaded connections.  Sockets
> >   using TLS are required to use a set of custom socket options to upload
> >   RX and TX keys to the NIC and to enable RX processing.  Currently
> >   these socket options are implemented as TCP options in the vendor
> >   specific range.  A patched OpenSSL library will be made available in a
> >   port / package for use with the TLS TOE support.
> >   
> >   TOE sockets can either offload both transmit and reception of TLS
> >   records or just transmit.  TLS offload (both RX and TX) is enabled by
> >   setting the dev.t6nex..tls sysctl to 1 and requires TOE to be
> >   enabled on the relevant interface.  Transmit offload can be used on
> >   any "normal" or TLS TOE socket by using the custom socket option to
> >   program a transmit key.  This permits most TOE sockets to
> >   transparently offload TLS when applications use a patched SSL library
> >   (e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
> >   library).  Receive offload can only be used with TOE sockets using the
> >   TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
> >   list of TCP port numbers.  Any connection with either a local or
> >   remote port number in that list will be created as a TLS socket rather
> >   than a plain TOE socket.  Note that although this sysctl accepts an
> >   arbitrary list of port numbers, the sysctl(8) tool is only able to set
> >   sysctl nodes to a single value.  A TLS socket will hang without
> >   receiving data if used by an application that is not using a patched
> >   SSL library.  Thus, the tls_rx_ports node should be used with care.
> >   For a server mostly concerned with offloading TLS transmit, this node
> >   is not needed as plain TOE sockets will fall back to software crypto
> >   when using an unpatched SSL library.
> >   
> >   New per-interface statistics nodes are added giving counts of TLS
> >   packets and payload bytes (payload bytes do not include TLS headers or
> >   authentication tags/MACs) offloaded via the TOE engine, e.g.:
> >   
> >   dev.cc.0.stats.rx_tls_octets: 149
> >   dev.cc.0.stats.rx_tls_records: 13
> >   dev.cc.0.stats.tx_tls_octets: 26501823
> >   dev.cc.0.stats.tx_tls_records: 1620
> >   
> >   TLS transmit work requests are constructed by a new variant of
> >   t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.
> >   
> >   TLS transmit work requests require a buffer containing IVs.  If the
> >   IVs are too large to fit into the work request, a separate buffer is
> >   allocated when constructing a work request.  This buffer is associated
> >   with the transmit descriptor and freed when the descriptor is ACKed by
> >   the adapter.
> >   
> >   Received TLS frames use two new CPL messages.  The first message is a
> >   CPL_TLS_DATA containing the decryped payload of a single TLS record.
> >   The handler places the mbuf containing the received payload on an
> >   mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
> >   which includes a copy of the TLS header and indicates if there were
> >   any errors.  The handler for this message places the TLS header into
> >   the socket buffer followed by the saved mbuf with the payload data.
> >   Both of these handlers are contained in tom/t4_tls.c.
> >   
> >   A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
> >   including send_rx_credits(), a new send_rx_modulate(), and
> >   t4_close_conn().
> >   
> >   TLS keys for both transmit and receive are stored in onboard memory
> >   in the NIC in the "TLS keys" memory region.
> >   
> >   In some cases a TLS socket can hang with pending data available in the
> >   NIC that is not delivered to the host.  As a workaround, TLS sockets
> >   are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
> >   any data is read from a TLS socket.  In addition, a fallback timer will
> >   periodically send CPL_RX_DATA_ACK messages to the NIC for connections
> >   that are still in the handshake phase.  Once the connection has
> >   finished the handshake and programmed RX keys via the socket option,
> >   the timer is stopped.
> >   
> >   A new function select_ulp_mode() is used to determine what sub-mode a
> >   given TOE socket should use (plain TOE, DDP, or TLS).  The existing
> >   set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
> >   handles initialization of TLS-specific state when necessary in
> >   addition to DDP-specific state.
> >   
> >   Since TLS sockets do not receive ind