svn commit: r354013 - head/sys/netinet/tcp_stacks

2019-10-23 Thread Randall Stewart
Author: rrs
Date: Thu Oct 24 05:54:30 2019
New Revision: 354013
URL: https://svnweb.freebsd.org/changeset/base/354013

Log:
  Fix a small bug in bbr when running under a VM. Basically what
  happens is we are more delayed in the pacer calling in so
  we remove the stack from the pacer and recalculate how
  much time is left after all data has been acknowledged. However
  the comparision was backwards so we end up with a negative
  value in the last_pacing_delay time which causes us to
  add in a huge value to the next pacing time thus stalling
  the connection.
  
  Reported by:  vm2.fina...@gmail.com

Modified:
  head/sys/netinet/tcp_stacks/bbr.c

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Thu Oct 24 04:12:38 2019
(r354012)
+++ head/sys/netinet/tcp_stacks/bbr.c   Thu Oct 24 05:54:30 2019
(r354013)
@@ -11814,12 +11814,13 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr 
uint32_t del;
 
del = lcts - 
bbr->rc_pacer_started;
-   if (del > 
bbr->r_ctl.rc_last_delay_val) {
+   if 
(bbr->r_ctl.rc_last_delay_val > del) {

BBR_STAT_INC(bbr_force_timer_start);

bbr->r_ctl.rc_last_delay_val -= del;
bbr->rc_pacer_started = 
lcts;
} else {
/* We are late */
+   
bbr->r_ctl.rc_last_delay_val = 0;

BBR_STAT_INC(bbr_force_output);

(void)tp->t_fb->tfb_tcp_output(tp);
}
@@ -12278,8 +12279,9 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva
 * We are early setup to adjust 
 * our slot time.
 */
+   uint64_t merged_val;
+   
bbr->r_ctl.rc_agg_early += 
(bbr->r_ctl.rc_last_delay_val - delay_calc);
-   bbr->r_ctl.rc_last_delay_val = 0;
bbr->r_agg_early_set = 1;
if (bbr->r_ctl.rc_hptsi_agg_delay) {
if (bbr->r_ctl.rc_hptsi_agg_delay >= 
bbr->r_ctl.rc_agg_early) {
@@ -12292,9 +12294,13 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva
bbr->r_ctl.rc_hptsi_agg_delay = 0;
}
}
+   merged_val = bbr->rc_pacer_started;
+   merged_val <<= 32;
+   merged_val |= bbr->r_ctl.rc_last_delay_val;
bbr_log_pacing_delay_calc(bbr, inp->inp_hpts_calls,
-bbr->r_ctl.rc_agg_early, cts, 
3, 0,
+bbr->r_ctl.rc_agg_early, cts, 
delay_calc, merged_val,
 bbr->r_agg_early_set, 3);
+   bbr->r_ctl.rc_last_delay_val = 0;
BBR_STAT_INC(bbr_early);
delay_calc = 0;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354007 - in stable/12/stand: . common efi/loader i386/loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:57:56 2019
New Revision: 354007
URL: https://svnweb.freebsd.org/changeset/base/354007

Log:
  MFC r346759: loader: implement map-vdisk and unmap-vdisk commands
  
  illumos update: https://www.illumos.org/issues/10598
  
  Add map-vdisk and unmap-vdisk commands to create virtual disk interface on
  top of file. This will allow to use disk image from file system to load and
  start the kernel.
  
  By mapping file, we create vdiskX device, the device will be listed by lsdev
  [-v] and can be accessed directly as ls vdisk0p1:/path or can be used as
  value for currdev variable.
  
  vdisk strategy function does not use bcache as we have bcache used with
  backing file. vdisk can be unmapped when all consumers have closed the open
  files.
  
  In first iteration we do not support the zfs images because zfs pools do
  keep the device open (there is no "zpool export" mechanism). Adding zfs
  support is relatively simple, we just need to run zfs disk probe after
  mapping is done.

Added:
  stable/12/stand/common/vdisk.c
 - copied unchanged from r346759, head/stand/common/vdisk.c
Modified:
  stable/12/stand/common/help.common
  stable/12/stand/efi/loader/conf.c
  stable/12/stand/i386/loader/conf.c
  stable/12/stand/loader.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/help.common
==
--- stable/12/stand/common/help.common  Thu Oct 24 03:52:32 2019
(r354006)
+++ stable/12/stand/common/help.common  Thu Oct 24 03:57:56 2019
(r354007)
@@ -99,6 +99,13 @@
List loaded modules. If [-v] is specified, print more details.
 
 

+# Tmap-vdisk DMap virtual disk
+
+   map-vdisk filename
+
+   Map file as virtual disk.
+
+
 # Tmore DPage files
 
more  [ ...]
@@ -395,6 +402,13 @@
unload
 
This command removes any kernel and all loaded modules from memory.
+
+
+# Tunmap-vdisk DUnmap virtual disk
+
+   unmap-vdisk diskname
+
+   Delete virtual disk mapping.
 
 

 # Tunset DUnset a variable

Copied: stable/12/stand/common/vdisk.c (from r346759, head/stand/common/vdisk.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/stand/common/vdisk.c  Thu Oct 24 03:57:56 2019
(r354007, copy of r346759, head/stand/common/vdisk.c)
@@ -0,0 +1,417 @@
+/*-
+ * Copyright 2019 Toomas Soome 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int vdisk_init(void);
+static int vdisk_strategy(void *, int, daddr_t, size_t, char *, size_t *);
+static int vdisk_open(struct open_file *, ...);
+static int vdisk_close(struct open_file *);
+static int vdisk_ioctl(struct open_file *, u_long, void *);
+static int vdisk_print(int);
+
+struct devsw vdisk_dev = {
+   .dv_name = "vdisk",
+   .dv_type = DEVT_DISK,
+   .dv_init = vdisk_init,
+   .dv_strategy = vdisk_strategy,
+   .dv_open = vdisk_open,
+   .dv_close = vdisk_close,
+   .dv_ioctl = vdisk_ioctl,
+   .dv_print = vdisk_print,
+   .dv_cleanup = NULL
+};
+
+typedef STAILQ_HEAD(vdisk_info_list, vdisk_info) vdisk_info_list_t;
+
+typedef 

svn commit: r354004 - in stable/12/stand/efi/loader/arch: arm i386

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:48:28 2019
New Revision: 354004
URL: https://svnweb.freebsd.org/changeset/base/354004

Log:
  MFC r344560, r344718
  
  r344560:
  stand: Remove unused i386 EFI MD bits
  
  r328169 removed the copy of bootinfo that would've made this somewhat
  functional. However, this is irrelevant- earlier work in r292338 was done to
  exit boot services in the MI bi_load() rather than having N copies of the
  GetMemoryMap/ExitBootServices dance.
  
  i386 never quite caught up to that; ldr_enter was still being called but
  the prereq for that, ldr_bootinfo, was no longer. As a consequence, this
  ExitBootServices() was being called with a mapkey=0, clearly bogus, and
  reportedly breaking the boot in some instances.
  
  r344718:
  EFI: don't call printf after ExitBootServices, since it uses Boot Services
  
  ExitBootServices terminates all boot services including console access.
  Attempting to call printf afterwards can result in a crash, depending on the
  implementation.
  
  Move any printf statements to before we call bi_load, and remove any that
  depend on calling bi_load first.

Deleted:
  stable/12/stand/efi/loader/arch/i386/efimd.c
Modified:
  stable/12/stand/efi/loader/arch/arm/exec.c
  stable/12/stand/efi/loader/arch/i386/Makefile.inc
  stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/arch/arm/exec.c
==
--- stable/12/stand/efi/loader/arch/arm/exec.c  Thu Oct 24 03:44:32 2019
(r354003)
+++ stable/12/stand/efi/loader/arch/arm/exec.c  Thu Oct 24 03:48:28 2019
(r354004)
@@ -74,16 +74,19 @@ __elfN(arm_exec)(struct preloaded_file *fp)
e = (Elf_Ehdr *)>md_data;
 
efi_time_fini();
+
+   entry = efi_translate(e->e_entry);
+
+   printf("Kernel entry at 0x%x...\n", (unsigned)entry);
+   printf("Kernel args: %s\n", fp->f_args);
+
if ((error = bi_load(fp->f_args, , )) != 0) {
efi_time_init();
return (error);
}
 
-   entry = efi_translate(e->e_entry);
-   printf("Kernel entry at 0x%x...\n", (unsigned)entry);
-   printf("Kernel args: %s\n", fp->f_args);
-   printf("modulep: %#x\n", modulep);
-   printf("relocation_offset %llx\n", __elfN(relocation_offset));
+   /* At this point we've called ExitBootServices, so we can't call
+* printf or any other function that uses Boot Services */
 
dev_cleanup();
 

Modified: stable/12/stand/efi/loader/arch/i386/Makefile.inc
==
--- stable/12/stand/efi/loader/arch/i386/Makefile.inc   Thu Oct 24 03:44:32 
2019(r354003)
+++ stable/12/stand/efi/loader/arch/i386/Makefile.inc   Thu Oct 24 03:48:28 
2019(r354004)
@@ -1,7 +1,6 @@
 # $FreeBSD$
 
 SRCS+= start.S \
-   efimd.c \
elf32_freebsd.c \
exec.c
 

Modified: stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c
==
--- stable/12/stand/efi/loader/arch/i386/elf32_freebsd.cThu Oct 24 
03:44:32 2019(r354003)
+++ stable/12/stand/efi/loader/arch/i386/elf32_freebsd.cThu Oct 24 
03:48:28 2019(r354004)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 
 extern void __exec(caddr_t addr, ...);
 extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp);
-extern int ldr_enter(const char *kernel);
 
 static int elf32_exec(struct preloaded_file *amp);
 static int elf32_obj_exec(struct preloaded_file *amp);
@@ -76,16 +75,19 @@ elf32_exec(struct preloaded_file *fp)
 ehdr = (Elf_Ehdr *)&(md->md_data);
 
 efi_time_fini();
+
+entry = ehdr->e_entry & 0xff;
+
+printf("Start @ 0x%x ...\n", entry);
+
 err = bi_load(fp->f_args, , );
 if (err != 0) {
efi_time_init();
return(err);
 }
-entry = ehdr->e_entry & 0xff;
 
-printf("Start @ 0x%x ...\n", entry);
-
-ldr_enter(fp->f_name);
+/* At this point we've called ExitBootServices, so we can't call
+ * printf or any other function that uses Boot Services */
 
 dev_cleanup();
 __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, 
kernend);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354001 - stable/12/stand/libsa

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:40:20 2019
New Revision: 354001
URL: https://svnweb.freebsd.org/changeset/base/354001

Log:
  MFC (proactively; not required yet) r339673: Fix stand/ build after r339671.
  
  ffs_subr.c requires calculate_crc32c() from libkern.  Unfortunately we
  cannot just add libkern/crc32.c to libstand because crc32.o is already
  compiled from contrib/zlib/crc32.c. Use the include trick to rename
  the source.
  
  Note that libstand also provides crc32.c which seems to be unused.

Added:
  stable/12/stand/libsa/crc32_libkern.c
 - copied unchanged from r339673, head/stand/libsa/crc32_libkern.c
Modified:
  stable/12/stand/libsa/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/Makefile
==
--- stable/12/stand/libsa/Makefile  Thu Oct 24 03:38:16 2019
(r354000)
+++ stable/12/stand/libsa/Makefile  Thu Oct 24 03:40:20 2019
(r354001)
@@ -148,9 +148,9 @@ SRCS+=ffs_subr.c ffs_tables.c
 
 CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2
 
-# explicit_bzero
+# explicit_bzero and calculate_crc32c
 .PATH: ${SYSDIR}/libkern
-SRCS+=  explicit_bzero.c
+SRCS+=  explicit_bzero.c crc32_libkern.c
 
 # Maybe GELI
 .if ${MK_LOADER_GELI} == "yes"

Copied: stable/12/stand/libsa/crc32_libkern.c (from r339673, 
head/stand/libsa/crc32_libkern.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/stand/libsa/crc32_libkern.c   Thu Oct 24 03:40:20 2019
(r354001, copy of r339673, head/stand/libsa/crc32_libkern.c)
@@ -0,0 +1,3 @@
+/* $FreeBSD$ */
+
+#include "../../sys/libkern/crc32.c"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354000 - stable/12/stand/libsa

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:38:16 2019
New Revision: 354000
URL: https://svnweb.freebsd.org/changeset/base/354000

Log:
  MFC r339970: Remove unnecessary include from libstand.

Modified:
  stable/12/stand/libsa/ip.c
  stable/12/stand/libsa/net.c
  stable/12/stand/libsa/udp.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/ip.c
==
--- stable/12/stand/libsa/ip.c  Thu Oct 24 03:37:17 2019(r353999)
+++ stable/12/stand/libsa/ip.c  Thu Oct 24 03:38:16 2019(r354000)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 

Modified: stable/12/stand/libsa/net.c
==
--- stable/12/stand/libsa/net.c Thu Oct 24 03:37:17 2019(r353999)
+++ stable/12/stand/libsa/net.c Thu Oct 24 03:38:16 2019(r354000)
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 

Modified: stable/12/stand/libsa/udp.c
==
--- stable/12/stand/libsa/udp.c Thu Oct 24 03:37:17 2019(r353999)
+++ stable/12/stand/libsa/udp.c Thu Oct 24 03:38:16 2019(r354000)
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353988 - in stable/12/stand: efi efi/boot1 efi/gptboot efi/include efi/libefi i386/gptboot libsa

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:16:23 2019
New Revision: 353988
URL: https://svnweb.freebsd.org/changeset/base/353988

Log:
  MFC r348658-r348659, r348674-r348675, r348678, r348760, r348766, r348768,
  r348811-r348812, r348814, r349008
  
  r348658:
  Introduce efi_devpath_same_disk
  
  This is like efi_devpath_match, but allows differing device media
  paths. Those just specify the partition information.
  
  r348659:
  Use newly minted efi_devpath_same_disk() instead of
  efi_devpath_match(). This fixes a regression in r347193.
  
  r348674:
  Don't shadow a global zfsmount variable.
  
  r348675:
  ufs_module.c can't currently be compiled with -Wcast-align, but the
  code is safe enough. Turn off the warning for now until I can find the
  right construct to silence it in the code.
  
  r348678:
  Eliminate unused uuid parameters from gptread and gptread_table.  We
  only need it for the gptfind() function, where it's used.
  
  r348760:
  Use simple malloc/free instead of dropping down to the UEFI
  BootServices AllocatePool/FreePool calls. They are simpler to use and
  result in the same thing happening.
  
  r348766:
  Remove left-over status variables
  
  r348768:
  Rework the reporting of the priority.
  
  Simplify the code a bit and rework how we report the results
  of the probing.
  
  r348811:
  Break out the disk selection protocol from the rest of boot1.
  
  Segregate the disk probing and selection protocol from the rest of the
  boot loader.
  
  r348812:
  Create gptboot.efi
  
  This is a primary boot loader that is intended to implement the
  gptboot partition selection algorithm just like we did for BIOS
  booting. While the preferred method for UEFI is to use the UEFI Boot
  Manager protocol, there are situations where that can't be done: some
  BIOS makers interfere with the protocol in unhelpful ways, there's a
  new standard for a zero variable write from the client OS, and finally
  for USB drives that might be mobile between systems with multiple
  partitions there needs to be a media stable way to select.
  
  r348814:
  Add stuff to disable warning for %S
  
  Add the customary warnings to disable format checking on armv7. Code
  move to new files, and the unconditional setting of WARNS to 6
  provoked it on tinerbox...
  
  r349008:
  Fix gcc build by removing redeclaration

Added:
  stable/12/stand/efi/boot1/proto.c
 - copied unchanged from r348812, head/stand/efi/boot1/proto.c
  stable/12/stand/efi/boot1/proto.h
 - copied unchanged from r348812, head/stand/efi/boot1/proto.h
  stable/12/stand/efi/gptboot/
 - copied from r348812, head/stand/efi/gptboot/
Modified:
  stable/12/stand/efi/Makefile
  stable/12/stand/efi/boot1/Makefile
  stable/12/stand/efi/boot1/boot1.c
  stable/12/stand/efi/boot1/boot_module.h
  stable/12/stand/efi/boot1/ufs_module.c
  stable/12/stand/efi/boot1/zfs_module.c
  stable/12/stand/efi/include/efilib.h
  stable/12/stand/efi/libefi/devpath.c
  stable/12/stand/i386/gptboot/gptboot.c
  stable/12/stand/libsa/gpt.c
  stable/12/stand/libsa/gpt.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/Makefile
==
--- stable/12/stand/efi/MakefileThu Oct 24 03:09:31 2019
(r353987)
+++ stable/12/stand/efi/MakefileThu Oct 24 03:16:23 2019
(r353988)
@@ -9,7 +9,7 @@ NO_OBJ=t
 .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500
 
 SUBDIR.${MK_FDT}+= fdt
-SUBDIR.yes+=   libefi boot1
+SUBDIR.yes+=   libefi boot1 gptboot
 SUBDIR.${MK_FORTH}+= loader_4th
 SUBDIR.${MK_LOADER_LUA}+= loader_lua
 SUBDIR.yes+=   loader_simp

Modified: stable/12/stand/efi/boot1/Makefile
==
--- stable/12/stand/efi/boot1/Makefile  Thu Oct 24 03:09:31 2019
(r353987)
+++ stable/12/stand/efi/boot1/Makefile  Thu Oct 24 03:16:23 2019
(r353988)
@@ -5,7 +5,7 @@
 BOOT1?=boot1
 PROG=  ${BOOT1}.sym
 INTERNALPROG=
-WARNS?=6
+WARNS= 6
 
 CFLAGS+=   -DEFI_BOOT1
 # We implement a slightly non-standard %S in that it always takes a
@@ -13,8 +13,13 @@ CFLAGS+= -DEFI_BOOT1
 # seems to matter on arm64 where wchar_t defaults to an int instead
 # of a short. There's no good cast to use here so just ignore the
 # warnings for now.
+CWARNFLAGS.proto.c+=   -Wno-format
 CWARNFLAGS.boot1.c+=   -Wno-format
 
+# Disable bogus alignment issues
+CWARNFLAGS.ufs_module.c += -Wno-format
+CWARNFLAGS.ufs_module.c += -Wno-cast-align
+
 # Disable warnings that are currently incompatible with the zfs boot code
 CWARNFLAGS.zfs_module.c += -Wno-array-bounds
 CWARNFLAGS.zfs_module.c += -Wno-cast-align
@@ -25,7 +30,7 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-parameter
 CWARNFLAGS.zfs_module.c += -Wno-unused-function
 
 # architecture-specific loader code
-SRCS+= boot1.c self_reloc.c start.S ufs_module.c devpath.c
+SRCS+= boot1.c 

svn commit: r353993 - in stable/12/stand: i386/zfsloader sparc64/zfsloader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:26:45 2019
New Revision: 353993
URL: https://svnweb.freebsd.org/changeset/base/353993

Log:
  MFC r352037, r352145: Remove empty zfsloader directories

Deleted:
  stable/12/stand/i386/zfsloader/
  stable/12/stand/sparc64/zfsloader/
Modified:
Directory Properties:
  stable/12/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353985 - stable/12/stand/libsa/zfs

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:06:37 2019
New Revision: 353985
URL: https://svnweb.freebsd.org/changeset/base/353985

Log:
  MFC r348352, r348354
  
  r348352:
  loader: zfs_alloc and zfs_free should use panic
  
  The zfs alloc and free code print out the error and get stuck in infinite
  loop; use panic() instead.
  
  r348354:
  loader: malloc+memset is calloc in spa_create
  
  Replace malloc + memset pair with calloc.

Modified:
  stable/12/stand/libsa/zfs/zfsimpl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==
--- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:04:36 2019
(r353984)
+++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:06:37 2019
(r353985)
@@ -174,8 +174,7 @@ zfs_alloc(size_t size)
char *ptr;
 
if (zfs_temp_ptr + size > zfs_temp_end) {
-   printf("ZFS: out of temporary buffer space\n");
-   for (;;) ;
+   panic("ZFS: out of temporary buffer space");
}
ptr = zfs_temp_ptr;
zfs_temp_ptr += size;
@@ -189,8 +188,7 @@ zfs_free(void *ptr, size_t size)
 
zfs_temp_ptr -= size;
if (zfs_temp_ptr != ptr) {
-   printf("ZFS: zfs_alloc()/zfs_free() mismatch\n");
-   for (;;) ;
+   panic("ZFS: zfs_alloc()/zfs_free() mismatch");
}
 }
 
@@ -1341,9 +1339,8 @@ spa_create(uint64_t guid, const char *name)
 {
spa_t *spa;
 
-   if ((spa = malloc(sizeof(spa_t))) == NULL)
+   if ((spa = calloc(1, sizeof(spa_t))) == NULL)
return (NULL);
-   memset(spa, 0, sizeof(spa_t));
if ((spa->spa_name = strdup(name)) == NULL) {
free(spa);
return (NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354012 - stable/12/stand/forth

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 04:12:38 2019
New Revision: 354012
URL: https://svnweb.freebsd.org/changeset/base/354012

Log:
  MFC r352420: loader_4th: scan_buffer can leave empty string on stack
  
  When the file processing is done, we will have string with lenght 0 in stack
  and we will attempt to
  allocate 0 bytes.

Modified:
  stable/12/stand/forth/support.4th
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/forth/support.4th
==
--- stable/12/stand/forth/support.4th   Thu Oct 24 04:08:24 2019
(r354011)
+++ stable/12/stand/forth/support.4th   Thu Oct 24 04:12:38 2019
(r354012)
@@ -363,6 +363,7 @@ variable fd
 ;
 
 : line_buffer_resize  ( len -- len )
+  dup 0= if exit then
   >r
   line_buffer .len @ if
 line_buffer .addr @
@@ -376,6 +377,7 @@ variable fd
 ;
 
 : append_to_line_buffer  ( addr len -- )
+  dup 0= if 2drop exit then
   line_buffer strget
   2swap strcat
   line_buffer .len !
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354003 - stable/12/sys/kern

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:44:32 2019
New Revision: 354003
URL: https://svnweb.freebsd.org/changeset/base/354003

Log:
  MFC r349344: Add missing include of sys/boot.h
  
  This change was dropped out in a rebase and I didn't catch that before
  I committed.

Modified:
  stable/12/sys/kern/kern_mib.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_mib.c
==
--- stable/12/sys/kern/kern_mib.c   Thu Oct 24 03:41:54 2019
(r354002)
+++ stable/12/sys/kern/kern_mib.c   Thu Oct 24 03:44:32 2019
(r354003)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_config.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353983 - in stable/12/stand: common efi/libefi i386/libi386 powerpc userboot/userboot

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:01:40 2019
New Revision: 353983
URL: https://svnweb.freebsd.org/changeset/base/353983

Log:
  MFC r345066, r347219-r347220, r347223, r347388-r347389, r347391, r347393,
  r347553, r348040
  
  r345066:
  stand: Improve some debugging experience
  
  Some of these files using _DEBUG defined a DEBUG() macro to serve as a
  debug-printf. -DDEBUG is useful to enable some debugging output across
  multiple ELF/common parts, so switch the DEBUG-as-printf macros over to
  something more like DPRINTF that is more commonly used for this kind of
  thing and less likely to conflict.
  
  userboot/elf64_freebsd debugging also assumed %llx for uint64; use PRIx64
  instead.
  
  r347219:
  loader: use safer DPRINTF body for non-debug case
  
  r347220:
  loader: bcache code does not need to check argument for free()
  
  r347223:
  command_bcache() does not use argv
  
  Therefore mark argv __unused.
  
  r347388:
  loader: implement proper 8 char tab stops
  
  The current console code is printing out 8 spaces for tab, calculate
  the amount of spaces based on tab stops.
  
  r347389:
  loader: ptable_print() needs two tabs sometimes
  
  Since the partition/slice names do vary in length, check the length
  of the fixed part of the line against 3 * 8, if the lenth is less than
  3 tab stops, print out extra tab.
  
  use snprintf() instead of sprintf.
  
  r347391:
  loader: no-TERM_EMU is broken now
  
  If TERM_EMU is not defined, we do not have curx variable. Use conout mode
  for efi and expose get_pos() for i386.
  
  r347393:
  loader: use DPRINTF in biosdisk.c and define safe DPRINTF
  
  r345066 did miss biosdisk.c.
  
  Also define DPRINTF as ((void)0) for case we do not want debug printouts.
  
  r347553:
  loader: fix memory handling errors in module.c
  
  file_loadraw():
  check for file_alloc() and strdup() results.
  we leak 'name'.
  
  mod_load() does leak 'filename'.
  
  mod_loadkld() does not need to check fp, file_discard() does check.
  
  r348040:
  stand: TARGET_ARCH is spelled MACHINE_ARCH in Makefiles

Modified:
  stable/12/stand/common/bcache.c
  stable/12/stand/common/disk.c
  stable/12/stand/common/interp_forth.c
  stable/12/stand/common/module.c
  stable/12/stand/common/part.c
  stable/12/stand/efi/libefi/efi_console.c
  stable/12/stand/i386/libi386/biosdisk.c
  stable/12/stand/i386/libi386/vidconsole.c
  stable/12/stand/powerpc/Makefile
  stable/12/stand/userboot/userboot/elf64_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/bcache.c
==
--- stable/12/stand/common/bcache.c Thu Oct 24 02:53:07 2019
(r353982)
+++ stable/12/stand/common/bcache.c Thu Oct 24 03:01:40 2019
(r353983)
@@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$");
 /* #define BCACHE_DEBUG */
 
 #ifdef BCACHE_DEBUG
-# define DEBUG(fmt, args...)   printf("%s: " fmt "\n" , __func__ , ## args)
+# define DPRINTF(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args)
 #else
-# define DEBUG(fmt, args...)
+# define DPRINTF(fmt, args...) ((void)0)
 #endif
 
 struct bcachectl
@@ -384,7 +384,7 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, si
 /* bypass large requests, or when the cache is inactive */
 if (bc == NULL ||
((size * 2 / bcache_blksize) > bcache_nblks)) {
-   DEBUG("bypass %zu from %qu", size / bcache_blksize, blk);
+   DPRINTF("bypass %zu from %qu", size / bcache_blksize, blk);
bcache_bypasses++;
rw &= F_MASK;
return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize));
@@ -441,10 +441,8 @@ static void
 bcache_free_instance(struct bcache *bc)
 {
 if (bc != NULL) {
-   if (bc->bcache_ctl)
-   free(bc->bcache_ctl);
-   if (bc->bcache_data)
-   free(bc->bcache_data);
+   free(bc->bcache_ctl);
+   free(bc->bcache_data);
free(bc);
 }
 }
@@ -459,7 +457,7 @@ bcache_insert(struct bcache *bc, daddr_t blkno)
 
 cand = BHASH(bc, blkno);
 
-DEBUG("insert blk %llu -> %u # %d", blkno, cand, bcache_bcount);
+DPRINTF("insert blk %llu -> %u # %d", blkno, cand, bcache_bcount);
 bc->bcache_ctl[cand].bc_blkno = blkno;
 bc->bcache_ctl[cand].bc_count = bcache_bcount++;
 }
@@ -476,7 +474,7 @@ bcache_invalidate(struct bcache *bc, daddr_t blkno)
 if (bc->bcache_ctl[i].bc_blkno == blkno) {
bc->bcache_ctl[i].bc_count = -1;
bc->bcache_ctl[i].bc_blkno = -1;
-   DEBUG("invalidate blk %llu", blkno);
+   DPRINTF("invalidate blk %llu", blkno);
 }
 }
 
@@ -484,7 +482,7 @@ bcache_invalidate(struct bcache *bc, daddr_t blkno)
 COMMAND_SET(bcachestat, "bcachestat", "get disk block cache stats", 
command_bcache);
 
 static int
-command_bcache(int argc, char *argv[])
+command_bcache(int argc, char *argv[] __unused)
 {
 if (argc != 1) {
command_errmsg = "wrong number of arguments";

Modified: 

svn commit: r353997 - stable/12/stand/efi/boot1

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:32:02 2019
New Revision: 353997
URL: https://svnweb.freebsd.org/changeset/base/353997

Log:
  MFC r353544: boot1.efi: provide generic exit() and stub getchar()

Modified:
  stable/12/stand/efi/boot1/boot1.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/boot1/boot1.c
==
--- stable/12/stand/efi/boot1/boot1.c   Thu Oct 24 03:30:48 2019
(r353996)
+++ stable/12/stand/efi/boot1/boot1.c   Thu Oct 24 03:32:02 2019
(r353997)
@@ -293,6 +293,18 @@ add_device(dev_info_t **devinfop, dev_info_t *devinfo)
dev->next = devinfo;
 }
 
+void
+efi_exit(EFI_STATUS s)
+{
+   BS->Exit(IH, s, 0, NULL);
+}
+
+void
+exit(int error __unused)
+{
+   efi_exit(EFI_LOAD_ERROR);
+}
+
 /*
  * OK. We totally give up. Exit back to EFI with a sensible status so
  * it can try the next option on the list.
@@ -308,7 +320,12 @@ efi_panic(EFI_STATUS s, const char *fmt, ...)
va_end(ap);
printf("\n");
 
-   BS->Exit(IH, s, 0, NULL);
+   efi_exit(s);
+}
+
+int getchar(void)
+{
+   return (-1);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353999 - stable/12/stand/i386

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:37:17 2019
New Revision: 353999
URL: https://svnweb.freebsd.org/changeset/base/353999

Log:
  MFC r340834: Disable build-id in i386 binary boot components
  
  A user may enable build-id for all builds by adding
  LDFLAGS=-Wl,--build-id=sha1 to /etc/make.conf.  In this case the build-id
  note ends added up to mbr and pmbr's .text, which makes it too large (it
  ends up being 532 bytes). To avoid this explicitly turn off build-id for
  these components.

Modified:
  stable/12/stand/i386/Makefile.inc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/Makefile.inc
==
--- stable/12/stand/i386/Makefile.inc   Thu Oct 24 03:32:47 2019
(r353998)
+++ stable/12/stand/i386/Makefile.inc   Thu Oct 24 03:37:17 2019
(r353999)
@@ -2,6 +2,8 @@
 #
 # $FreeBSD$
 
+.include "bsd.linker.mk"
+
 LOADER_ADDRESS?=0x20
 LDFLAGS+=  -nostdlib
 LDFLAGS.lld+=  -Wl,--no-rosegment
@@ -23,6 +25,9 @@ LDSCRIPT= ${BOOTSRC}/i386/boot.ldscript
 # LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary
 # LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections
 LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
+.if ${LINKER_FEATURES:Mbuild-id} != ""
+LDFLAGS_BIN+=-Wl,--build-id=none
+.endif
 LD_FLAGS_BIN=-static -N --gc-sections
 
 .if ${MACHINE_CPUARCH} == "amd64"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353982 - in stable/12/stand/efi: boot1 include libefi loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:53:07 2019
New Revision: 353982
URL: https://svnweb.freebsd.org/changeset/base/353982

Log:
  MFC r346702-r346704, r346879-r346881, r347023, r347059-r347062,
  r347193-r347194, r347201
  
  r346702:
  Add efi_freebsd_delenv
  
  Add a wrapper around efi_delenv akin to efi_freebsd_getenv and
  efi_getenv.
  
  r346703:
  Move initialization of the block device handles earlier (we're just
  snagging them from UEFI BIOS). Call the device type init routines
  earlier as well, as they don't depend on how the console is
  setup. This will allow us to read files earlier in boot, so any rare
  error messages that this might move only to the EFI console will be an
  acceptable price to pay. Also tweak the order of has_kbd so it resides
  next to the rest of the console code. It needs to be after we initialize
  the buffer cache.
  
  r346704:
  Add the proper range of years for Netflix's copyright on this
  file. Note that I wrote it.
  
  r346879:
  Read in and parse /efi/freebsd/loader.env from the boot device's
  partition as if it were on the command line.
  
  Fetch FreeBSD-LoaderEnv UEFI enviornment variable. If set, read in
  loader environment variables from it. Otherwise read in
  /efi/freebsd/loader.env. Both are read relative to the device
  loader.efi loaded from (they aren't full UEFI device paths)
  
  Next fetch FreeBSD-NextLoaderEnv UEFI environment variable. If
  present, read the file it points to in as above and delete the UEFI
  environment variable so it only happens once.
  
  This lets one set environment variables in the bootloader.
  Unfortunately, we don't have all the mechanisms in place to parse the
  file, nor do we have the magic pattern matching in place that
  loader.conf has. Variables are of the form foo=bar. No quotes are
  supported, so spaces aren't allowed, for example. Also, variables like
  foo_load=yes are intercepted when we parse the loader.conf file and
  things are done based on that. Since those aren't done here, variables
  that cause an action to happen won't work.
  
  r346880:
  Implement uefi_rootdev
  
  If uefi_rootdev is set in the environment, then treat it like a device
  path. Convert the string to a device path and see if we can find a
  device that matches. If so, use that device at our root dev no matter
  what. If it's bad in any way, the boot will fail.
  
  r346881:
  Implement uefi_ignore_boot_mgr env variable.
  
  When set, we ignore all the hints that the UEFI boot manager has set
  for us. We also always fail back to the OK prompt when we can't find
  the right thing to boot rather than failing back to the UEFI boot
  manager. This has the side effect of also expanding the cases where we
  fail back to the OK prompt to include when we're booted under UEFI,
  but UEFI::BootCurrent isn't set in the environment and we can't find a
  proper place to boot from.
  
  r347023:
  stand: correct mis-merge from r346879
  
  Small mis-merge from multiple WIP resulted in block io media handles getting
  double-initialized. This resulted in some installations oddly landing at the
  mountroot prompt.
  
  r347059:
  Remove stray '*'
  
  We're storing an EFI_HANDLE, not an pointer to a handle. Since
  EFI_HANDLE is a void * anyway, this has little practical effect since
  the conversion to / from void * and void ** is silent.
  
  r347060:
  When we can't get memory, trying again right away is going to
  fail. Rather than print N failure messages, bail on the first one.
  
  r347061:
  Substitute boot1 with ${BOOT1}
  
  Allow for other names to be built, so parameterize this makefile to
  avoid hard coding boot1.
  
  r347062:
  Use SRC+= rather than SRC=
  
  To allow boot1/Makefile to be included, use SRC+= rathern than SRC=
  so the including Makefile can add additional sources to the build.
  
  r347193:
  Reach over and pull in devpath.c from libefi
  
  This allows us to remove three nearly identical functions because the
  differences don't matter, and the size difference is trivial.
  
  r347194:
  We only ever need one devinfo per handle. So allocate it outside of
  looping over the filesystem modules rather than doing a malloc + free
  each time through the loop. In addition, nothing changes from loop to
  loop, so setup the new devinfo outside the loop as well.
  
  r347201:
  Simplify boot1 allocation of handles.
  
  There's no need to pre-malloc the number of handles. Instead call
  LocateHandles twice, once to get the size, and once to get the
  data.

Modified:
  stable/12/stand/efi/boot1/Makefile
  stable/12/stand/efi/boot1/boot1.c
  stable/12/stand/efi/boot1/boot_module.h
  stable/12/stand/efi/include/efilib.h
  stable/12/stand/efi/libefi/efienv.c
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/boot1/Makefile
==
--- stable/12/stand/efi/boot1/Makefile  Thu Oct 24 

svn commit: r354008 - in stable/12/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 04:00:49 2019
New Revision: 354008
URL: https://svnweb.freebsd.org/changeset/base/354008

Log:
  MFC EFI HTTP Support: r349349, r349395, r349404, r349564-r349566, r349613,
  r350444
  
  r349349:
  loader: add HTTP support using UEFI
  
  Add support for an HTTP "network filesystem" using the UEFI's HTTP
  stack.
  
  This also supports HTTPS, but TianoCore EDK2 implementations currently
  crash while fetching loader files.
  Only IPv4 is supported at the moment. IPv6 support is planned for a
  follow-up changeset.
  
  Note that we include some headers from the TianoCore EDK II project in
  stand/efi/include/Protocol verbatim, including links to the license instead
  of including the full text because that's their preferred way of
  communicating it, despite not being normal FreeBSD project practice.
  
  r349395:
  Disconnect EFI HTTP support
  
  The EFI HTTP code has been causing boot failures for people, so disable it
  while a fix is being worked on.
  
  r349404:
  Re-enable loader efi http boot and fix dv_open bug if dv_init failed
  
  The code in efihttp.c was assuming that dv_open wouldn't be called if
  dv_init failed. But the dv_init return value is currently ignored.
  
  Add a new variable, `efihttp_init_done` and only proceed in dv_open if
  it's true. This fixes the loader on systems without efi http support.
  
  r349564:
  Clean efihttp pointer-sign warnings
  
  The Http protocol structure is using unsigned char strings, Use type casts
  where needed.
  
  r349565:
  efihttp: comparison of integers of different signs
  
  message.HeaderCount is UINTN (unsigned int), so should be i.
  
  r349566:
  efihttp: mark unused arguments with __unused
  
  we do have __unused, lets use it.
  
  r349613:
  efihttp: mac and err can be used uninitialized
  
  While there, also check if mac != NULL, and use pointer compare for ipv4
  and dns.
  
  r350444:
  Fix EFI loader build when LOADER_NET_SUPPORT=no.

Added:
  stable/12/stand/efi/include/Protocol/Http.h
 - copied unchanged from r349349, head/stand/efi/include/Protocol/Http.h
  stable/12/stand/efi/include/Protocol/Ip4Config2.h
 - copied unchanged from r349349, 
head/stand/efi/include/Protocol/Ip4Config2.h
  stable/12/stand/efi/include/Protocol/ServiceBinding.h
 - copied unchanged from r349349, 
head/stand/efi/include/Protocol/ServiceBinding.h
  stable/12/stand/efi/libefi/efihttp.c
 - copied, changed from r349349, head/stand/efi/libefi/efihttp.c
Modified:
  stable/12/stand/efi/include/efidevp.h
  stable/12/stand/efi/include/efilib.h
  stable/12/stand/efi/libefi/Makefile
  stable/12/stand/efi/loader/conf.c
  stable/12/stand/libsa/stand.h
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/stand/efi/include/Protocol/Http.h (from r349349, 
head/stand/efi/include/Protocol/Http.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/stand/efi/include/Protocol/Http.h Thu Oct 24 04:00:49 2019
(r354008, copy of r349349, head/stand/efi/include/Protocol/Http.h)
@@ -0,0 +1,523 @@
+/* $FreeBSD$ */
+/** @file
+  This file defines the EFI HTTP Protocol interface. It is split into
+  the following two main sections:
+  HTTP Service Binding Protocol (HTTPSB)
+  HTTP Protocol (HTTP)
+
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+  (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution. The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.5
+
+**/
+
+#ifndef __EFI_HTTP_PROTOCOL_H__
+#define __EFI_HTTP_PROTOCOL_H__
+
+#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \
+  { \
+0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 
0x1c } \
+  }
+
+#define EFI_HTTP_PROTOCOL_GUID \
+  { \
+0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 
0x5b } \
+  }
+
+typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL;
+
+///
+/// EFI_HTTP_VERSION
+///
+typedef enum {
+  HttpVersion10,
+  HttpVersion11,
+  HttpVersionUnsupported
+} EFI_HTTP_VERSION;
+
+///
+/// EFI_HTTP_METHOD
+///
+typedef enum {
+  HttpMethodGet,
+  HttpMethodPost,
+  HttpMethodPatch,
+  HttpMethodOptions,
+  HttpMethodConnect,
+  HttpMethodHead,
+  HttpMethodPut,
+  HttpMethodDelete,
+  HttpMethodTrace,
+  HttpMethodMax
+} EFI_HTTP_METHOD;
+
+///
+/// EFI_HTTP_STATUS_CODE
+///
+typedef enum {
+  HTTP_STATUS_UNSUPPORTED_STATUS = 0,
+  HTTP_STATUS_100_CONTINUE,
+  HTTP_STATUS_101_SWITCHING_PROTOCOLS,
+ 

svn commit: r353998 - stable/12/stand/efi/loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:32:47 2019
New Revision: 353998
URL: https://svnweb.freebsd.org/changeset/base/353998

Log:
  MFC r353697: Allow loader.efi to identify non-standard boot setup
  
  PATH_BOOTABLE_TOKEN can be set to a non-standard
  path that identifies a device as bootable.

Modified:
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/main.c
==
--- stable/12/stand/efi/loader/main.c   Thu Oct 24 03:32:02 2019
(r353997)
+++ stable/12/stand/efi/loader/main.c   Thu Oct 24 03:32:47 2019
(r353998)
@@ -239,6 +239,9 @@ sanity_check_currdev(void)
struct stat st;
 
return (stat(PATH_DEFAULTS_LOADER_CONF, ) == 0 ||
+#ifdef PATH_BOOTABLE_TOKEN
+   stat(PATH_BOOTABLE_TOKEN, ) == 0 || /* non-standard layout */
+#endif
stat(PATH_KERNEL, ) == 0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353979 - in stable/12/stand/efi: boot1 include libefi loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:43:38 2019
New Revision: 353979
URL: https://svnweb.freebsd.org/changeset/base/353979

Log:
  MFC r346345-r346346, r346353, r346407-r346409, r346430, r346573, r346575
  
  r346345:
  Add a more generic efi_setenv function.
  
  efi_setenv allows any UEFI variable to be set.
  
  r346346:
  Add efi_delenv
  
  Add an interface to remove / delete UEFI variables.
  
  r346353:
  Minor tweak to the debug
  
  Make it clear we're loading from UFS.
  
  r346407:
  Add define for CONST.
  
  Newer interfaces take CONST parameters, so define CONST to minimize
  differences between our headers and the standards docs.
  
  r346408:
  Add UEFI definitions related to converting string to DEVICE_PATH
  
  Add definitions from UEFI 2.7 Errata B standards doc for converting a
  text string to a device path. Added clearly missing 'e' at the end of
  Device to resolve mismatch in that document in
  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL element names.
  
  r346409:
  Add wrapper functions to convert strings to EFI_DEVICE_PATH
  
  In anticipation of new functionality, create routines to convert char *
  and a CHAR16 * to a EFI_DEVICE_PATH
EFI_DEVICE_PATH *efi_name_to_devpath(const char *path);
EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path);
void efi_devpath_free(EFI_DEVICE_PATH *dp);
  The first two return an EFI_DEVICE_PATH for the passed in paths. The
  third frees up the storage the first two return when the caller is
  done with it.
  
  r346430:
  Start to reduce the number of #ifdef EFI_ZFS_BOOT
  
  There's a number of EFI_ZFS_BOOT #ifdefs that aren't needed, or can be
  eliminated with some trivial #defines. Remove the EFI_ZFS_BOOT ifdefs
  that aren't needed. Replace libzfs.h include which is not safe to
  include without EFI_ZFS_BOOT with efizfs.h which is and now
  conditionally included libzfs.h. Define efizfs_set_preferred away
  and define efi_zfs_probe to NULL when ZFS is compiled out.
  
  r346573:
  Move setting of console earlier in boot.
  
  There's no reason we can't setup the console first thing after the
  arch flags are setup. We set it undconditionally to efi. This is a
  good default, and will get us error messages to at least the efi
  console no matter what. This will also prime the pump so that as other
  variables are set, they will take effect and the console will be
  correct as soon as those env vars are set. Also remove the redundant
  setting of the console to efi when we know the console is efi.
  
  r346575:
  Create boot_img as a global variable
  
  Get the information from the image that we're booting and store it in
  a global variable. Prefer using this to passing it around. Remove the
  special case for zfs that set the preferred boot handle by having it
  uses this global variable diretly.

Modified:
  stable/12/stand/efi/boot1/ufs_module.c
  stable/12/stand/efi/include/efi.h
  stable/12/stand/efi/include/efidef.h
  stable/12/stand/efi/include/efidevp.h
  stable/12/stand/efi/include/efilib.h
  stable/12/stand/efi/include/efizfs.h
  stable/12/stand/efi/libefi/devicename.c
  stable/12/stand/efi/libefi/devpath.c
  stable/12/stand/efi/libefi/efienv.c
  stable/12/stand/efi/libefi/efizfs.c
  stable/12/stand/efi/loader/conf.c
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/boot1/ufs_module.c
==
--- stable/12/stand/efi/boot1/ufs_module.c  Thu Oct 24 02:36:42 2019
(r353978)
+++ stable/12/stand/efi/boot1/ufs_module.c  Thu Oct 24 02:43:38 2019
(r353979)
@@ -148,7 +148,7 @@ load(const char *filepath, dev_info_t *dev, void **buf
 #ifdef EFI_DEBUG
{
CHAR16 *text = efi_devpath_name(dev->devpath);
-   DPRINTF("Loading '%s' from %S\n", filepath, text);
+   DPRINTF("UFS Loading '%s' from %S\n", filepath, text);
efi_free_devpath_name(text);
}
 #endif

Modified: stable/12/stand/efi/include/efi.h
==
--- stable/12/stand/efi/include/efi.h   Thu Oct 24 02:36:42 2019
(r353978)
+++ stable/12/stand/efi/include/efi.h   Thu Oct 24 02:43:38 2019
(r353979)
@@ -62,6 +62,11 @@ Revision History
 #include "efiuga.h"
 
 /*
+ * Global variables
+ */
+extern EFI_LOADED_IMAGE *boot_img;
+
+/*
  * FreeBSD UUID
  */
 #define FREEBSD_BOOT_VAR_GUID \

Modified: stable/12/stand/efi/include/efidef.h
==
--- stable/12/stand/efi/include/efidef.hThu Oct 24 02:36:42 2019
(r353978)
+++ stable/12/stand/efi/include/efidef.hThu Oct 24 02:43:38 2019
(r353979)
@@ -63,6 +63,7 @@ typedef VOID*EFI_EVENT;
 #define IN
 #define OUT
 #define OPTIONAL
+#define CONST const
 #endif
 
 

Modified: 

svn commit: r353991 - in stable/12: stand/common stand/efi/loader sys/kern sys/sys

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:21:30 2019
New Revision: 353991
URL: https://svnweb.freebsd.org/changeset/base/353991

Log:
  MFC r349343: Use a common kernel path between loader and kernel

Modified:
  stable/12/stand/common/paths.h
  stable/12/stand/efi/loader/main.c
  stable/12/sys/kern/kern_mib.c
  stable/12/sys/sys/boot.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/paths.h
==
--- stable/12/stand/common/paths.h  Thu Oct 24 03:20:27 2019
(r353990)
+++ stable/12/stand/common/paths.h  Thu Oct 24 03:21:30 2019
(r353991)
@@ -29,11 +29,14 @@
 #ifndef _PATHS_H_
 #define_PATHS_H_
 
+#include   /* To get kernel path */
+
 #define PATH_DOTCONFIG "/boot.config"
 #define PATH_CONFIG"/boot/config"
 #define PATH_LOADER"/boot/loader"
 #define PATH_LOADER_EFI"/boot/loader.efi"
 #define PATH_LOADER_ZFS"/boot/zfsloader"
-#define PATH_KERNEL"/boot/kernel/kernel"
+#define PATH_LOADER_CONF "/boot/loader.conf"
+#define PATH_DEFAULTS_LOADER_CONF "/boot/defaults/loader.conf"
 
 #endif /* _PATHS_H_ */

Modified: stable/12/stand/efi/loader/main.c
==
--- stable/12/stand/efi/loader/main.c   Thu Oct 24 03:20:27 2019
(r353990)
+++ stable/12/stand/efi/loader/main.c   Thu Oct 24 03:21:30 2019
(r353991)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -237,8 +238,8 @@ sanity_check_currdev(void)
 {
struct stat st;
 
-   return (stat("/boot/defaults/loader.conf", ) == 0 ||
-   stat("/boot/kernel/kernel", ) == 0);
+   return (stat(PATH_DEFAULTS_LOADER_CONF, ) == 0 ||
+   stat(PATH_KERNEL, ) == 0);
 }
 
 #ifdef EFI_ZFS_BOOT

Modified: stable/12/sys/kern/kern_mib.c
==
--- stable/12/sys/kern/kern_mib.c   Thu Oct 24 03:20:27 2019
(r353990)
+++ stable/12/sys/kern/kern_mib.c   Thu Oct 24 03:21:30 2019
(r353991)
@@ -136,7 +136,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_R
 SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available");
 #endif
 
-char kernelname[MAXPATHLEN] = "/boot/kernel/kernel";   /* XXX bloat */
+char kernelname[MAXPATHLEN] = PATH_KERNEL; /* XXX bloat */
 
 SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE,
 kernelname, sizeof kernelname, "Name of kernel file booted");

Modified: stable/12/sys/sys/boot.h
==
--- stable/12/sys/sys/boot.hThu Oct 24 03:20:27 2019(r353990)
+++ stable/12/sys/sys/boot.hThu Oct 24 03:21:30 2019(r353991)
@@ -32,6 +32,8 @@
 #ifndef _SYS_BOOT_H_
 #define _SYS_BOOT_H_
 
+#define PATH_KERNEL"/boot/kernel/kernel"
+
 int boot_env_to_howto(void);
 void boot_howto_to_env(int howto);
 int boot_parse_arg(char *v);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353973 - stable/12

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:30:53 2019
New Revision: 353973
URL: https://svnweb.freebsd.org/changeset/base/353973

Log:
  Record MFC of r343911, MFC'd in r346718

Modified:
Directory Properties:
  stable/12/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353981 - stable/12/stand/i386/zfsboot

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:49:13 2019
New Revision: 353981
URL: https://svnweb.freebsd.org/changeset/base/353981

Log:
  MFC r346969: zfsboot: to detect disk size, use GPT information first
  
  If we do have GPT on disk, read the disk size from it and do not
  call int13.
  
  Since int13 does report bogus informatiopn too often, rather trust the
  partition table. We are using the same strategy with loader.

Modified:
  stable/12/stand/i386/zfsboot/zfsboot.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/zfsboot/zfsboot.c
==
--- stable/12/stand/i386/zfsboot/zfsboot.c  Thu Oct 24 02:46:36 2019
(r353980)
+++ stable/12/stand/i386/zfsboot/zfsboot.c  Thu Oct 24 02:49:13 2019
(r353981)
@@ -478,6 +478,33 @@ copy_dsk(struct zfsdsk *zdsk)
 }
 
 /*
+ * Get disk size from GPT.
+ */
+static uint64_t
+drvsize_gpt(struct dsk *dskp)
+{
+#ifdef GPT
+   struct gpt_hdr hdr;
+   char *sec;
+
+   sec = dmadat->secbuf;
+   if (drvread(dskp, sec, 1, 1))
+   return (0);
+
+   memcpy(, sec, sizeof(hdr));
+   if (memcmp(hdr.hdr_sig, GPT_HDR_SIG, sizeof(hdr.hdr_sig)) != 0 ||
+   hdr.hdr_lba_self != 1 || hdr.hdr_revision < 0x0001 ||
+   hdr.hdr_entsz < sizeof(struct gpt_ent) ||
+   DEV_BSIZE % hdr.hdr_entsz != 0) {
+   return (0);
+   }
+   return (hdr.hdr_lba_alt + 1);
+#else
+   return (0);
+#endif
+}
+
+/*
  * Get disk size from eax=0x800 and 0x4800. We need to probe both
  * because 0x4800 may not be available and we would like to get more
  * or less correct disk size - if it is possible at all.
@@ -492,6 +519,11 @@ drvsize_ext(struct zfsdsk *zdsk)
int cyl, hds, sec;
 
dskp = >dsk;
+
+   /* Try to read disk size from GPT */
+   size = drvsize_gpt(dskp);
+   if (size != 0)
+   return (size);
 
v86.ctl = V86_FLAGS;
v86.addr = 0x13;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353969 - stable/12/stand

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:25:30 2019
New Revision: 353969
URL: https://svnweb.freebsd.org/changeset/base/353969

Log:
  MFC r341433: Move inclusion of src.opts.mk later.
  
  src.opts.mk includes bsd.own.mk. This in turn defines CTFCONVERT_CMD
  depending on the MK_CTF value. We then set MK_CTF to no, which has no
  real effect. The solution is to set all the MK_foo values before
  including src.opts.mk.
  
  This should stop the cdboot binary from exploding in size for releases built
  WITH_CTF=yes in src.conf.

Modified:
  stable/12/stand/defs.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/defs.mk
==
--- stable/12/stand/defs.mk Thu Oct 24 02:22:52 2019(r353968)
+++ stable/12/stand/defs.mk Thu Oct 24 02:25:30 2019(r353969)
@@ -1,12 +1,12 @@
 # $FreeBSD$
 
-.include 
-
-WARNS?=1
-
 .if !defined(__BOOT_DEFS_MK__)
 __BOOT_DEFS_MK__=${MFILE}
 
+# We need to define all the MK_ options before including src.opts.mk
+# because it includes bsd.own.mk which needs the right MK_ values,
+# espeically MK_CTF.
+
 MK_CTF=no
 MK_SSP=no
 MK_PROFILE=no
@@ -15,6 +15,10 @@ MAN=
 NO_PIC=
 INTERNALLIB=
 .endif
+
+.include 
+
+WARNS?=1
 
 BOOTSRC=   ${SRCTOP}/stand
 EFISRC=${BOOTSRC}/efi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353976 - stable/12/stand/common

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:33:57 2019
New Revision: 353976
URL: https://svnweb.freebsd.org/changeset/base/353976

Log:
  MFC r344892: stand/common/module: Apply style(9)

Modified:
  stable/12/stand/common/module.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/module.c
==
--- stable/12/stand/common/module.c Thu Oct 24 02:33:12 2019
(r353975)
+++ stable/12/stand/common/module.c Thu Oct 24 02:33:57 2019
(r353976)
@@ -102,63 +102,63 @@ COMMAND_SET(load, "load", "load a kernel or module", c
 static int
 command_load(int argc, char *argv[])
 {
-struct preloaded_file *fp;
-char   *typestr;
-char   *prefix;
-char   *skip;
-intdflag, dofile, dokld, ch, error;
+   struct preloaded_file *fp;
+   char*typestr;
+   char*prefix;
+   char*skip;
+   int dflag, dofile, dokld, ch, error;
 
-dflag = dokld = dofile = 0;
-optind = 1;
-optreset = 1;
-typestr = NULL;
-if (argc == 1) {
-   command_errmsg = "no filename specified";
-   return (CMD_CRIT);
-}
-prefix = skip = NULL;
-while ((ch = getopt(argc, argv, "dkp:s:t:")) != -1) {
-   switch(ch) {
-   case 'd':
-   dflag++;
-   break;
-   case 'k':
-   dokld = 1;
-   break;
-   case 'p':
-   prefix = optarg;
-   break;
-   case 's':
-   skip = optarg;
-   break;
-   case 't':
-   typestr = optarg;
-   dofile = 1;
-   break;
-   case '?':
-   default:
-   /* getopt has already reported an error */
-   return (CMD_OK);
+   dflag = dokld = dofile = 0;
+   optind = 1;
+   optreset = 1;
+   typestr = NULL;
+   if (argc == 1) {
+   command_errmsg = "no filename specified";
+   return (CMD_CRIT);
}
-}
-argv += (optind - 1);
-argc -= (optind - 1);
-
-/*
- * Request to load a raw file?
- */
-if (dofile) {
-   if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) {
-   command_errmsg = "invalid load type";
-   return (CMD_CRIT);
+   prefix = skip = NULL;
+   while ((ch = getopt(argc, argv, "dkp:s:t:")) != -1) {
+   switch(ch) {
+   case 'd':
+   dflag++;
+   break;
+   case 'k':
+   dokld = 1;
+   break;
+   case 'p':
+   prefix = optarg;
+   break;
+   case 's':
+   skip = optarg;
+   break;
+   case 't':
+   typestr = optarg;
+   dofile = 1;
+   break;
+   case '?':
+   default:
+   /* getopt has already reported an error */
+   return (CMD_OK);
+   }
}
+   argv += (optind - 1);
+   argc -= (optind - 1);
 
+   /*
+* Request to load a raw file?
+*/
+   if (dofile) {
+   if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) {
+   command_errmsg = "invalid load type";
+   return (CMD_CRIT);
+   }
+
 #ifdef LOADER_VERIEXEC
-   if (strncmp(typestr, "manifest", 8) == 0) {
-   if (dflag > 0)
-   ve_debug_set(dflag);
-   return (load_manifest(argv[1], prefix, skip, NULL));
-   }
+   if (strncmp(typestr, "manifest", 8) == 0) {
+   if (dflag > 0)
+   ve_debug_set(dflag);
+   return (load_manifest(argv[1], prefix, skip, NULL));
+   }
 #ifdef LOADER_VERIEXEC_PASS_MANIFEST
if (strncmp(typestr, "pass_manifest", 13) == 0) {
if (dflag > 0)
@@ -168,46 +168,46 @@ command_load(int argc, char *argv[])
 #endif
 #endif
 
-   fp = file_findfile(argv[1], typestr);
-   if (fp) {
-   snprintf(command_errbuf, sizeof(command_errbuf),
-   "warning: file '%s' already loaded", argv[1]);
-   return (CMD_WARN);
-   }
+   fp = file_findfile(argv[1], typestr);
+   if (fp) {
+   snprintf(command_errbuf, sizeof(command_errbuf),
+ "warning: file '%s' already loaded", argv[1]);
+   return (CMD_WARN);
+   }
 
-   if (file_loadraw(argv[1], typestr, 1) != NULL)
-   return (CMD_OK);
+   if (file_loadraw(argv[1], typestr, 1) != NULL)
+   return (CMD_OK);
 
-   /* Failing to load mfs_root is never going to end well! */
-   if (strcmp("mfs_root", typestr) == 0)
-   

svn commit: r353980 - in stable/12/stand: efi/loader fdt

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:46:36 2019
New Revision: 353980
URL: https://svnweb.freebsd.org/changeset/base/353980

Log:
  MFC r346701: loader: fdt: Add fdt_is_setup function
  
  When efi_autoload is called it will call fdt_setup_fdtp which setup the
  dtb and overlays. If a user already loaded at dtb or overlays or just
  printed the efi provided dtb, this will re-setup everything and also
  re-applying the overlays.
  Test that everything is setup before doing it again.

Modified:
  stable/12/stand/efi/loader/autoload.c
  stable/12/stand/fdt/fdt_loader_cmd.c
  stable/12/stand/fdt/fdt_platform.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/autoload.c
==
--- stable/12/stand/efi/loader/autoload.c   Thu Oct 24 02:43:38 2019
(r353979)
+++ stable/12/stand/efi/loader/autoload.c   Thu Oct 24 02:46:36 2019
(r353980)
@@ -50,7 +50,8 @@ efi_autoload(void)
 * imply that we're on a platform where FDT is a requirement.  If we
 * fix this, then the error handling here should be fixed accordingly.
 */
-   fdt_setup_fdtp();
+   if (fdt_is_setup() == 0)
+   fdt_setup_fdtp();
 #endif
return (0);
 }

Modified: stable/12/stand/fdt/fdt_loader_cmd.c
==
--- stable/12/stand/fdt/fdt_loader_cmd.cThu Oct 24 02:43:38 2019
(r353979)
+++ stable/12/stand/fdt/fdt_loader_cmd.cThu Oct 24 02:46:36 2019
(r353980)
@@ -510,6 +510,16 @@ fdt_apply_overlays()
 }
 
 int
+fdt_is_setup(void)
+{
+
+   if (fdtp != NULL)
+   return (1);
+
+   return (0);
+}
+
+int
 fdt_setup_fdtp()
 {
struct preloaded_file *bfp;

Modified: stable/12/stand/fdt/fdt_platform.h
==
--- stable/12/stand/fdt/fdt_platform.h  Thu Oct 24 02:43:38 2019
(r353979)
+++ stable/12/stand/fdt/fdt_platform.h  Thu Oct 24 02:46:36 2019
(r353980)
@@ -48,6 +48,7 @@ int fdt_load_dtb_addr(struct fdt_header *);
 int fdt_load_dtb_file(const char *);
 void fdt_load_dtb_overlays(const char *);
 int fdt_setup_fdtp(void);
+int fdt_is_setup(void);
 
 /* The platform library needs to implement these functions */
 int fdt_platform_load_dtb(void);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353972 - stable/12/stand/i386/libfirewire

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:28:28 2019
New Revision: 353972
URL: https://svnweb.freebsd.org/changeset/base/353972

Log:
  MFC r342865: biospci_write_config args were backwards
  
  biospci_write_config args swapped length and value to write. Some
  hardware coped just fine, while other hardware had issues.
  
  PR:   155441

Modified:
  stable/12/stand/i386/libfirewire/firewire.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/libfirewire/firewire.c
==
--- stable/12/stand/i386/libfirewire/firewire.c Thu Oct 24 02:27:16 2019
(r353971)
+++ stable/12/stand/i386/libfirewire/firewire.c Thu Oct 24 02:28:28 2019
(r353972)
@@ -107,9 +107,9 @@ fw_probe(int index, struct fwohci_softc *sc)
}
 
biospci_write_config(sc->locator,
-   0x4 /* command */,
-   0x6 /* enable bus master and memory mapped I/O */,
-   BIOSPCI_16BITS);
+   0x4 /* command */,
+   BIOSPCI_16BITS,
+   0x6 /* enable bus master and memory mapped I/O */);
 
biospci_read_config(sc->locator, 0x00 /*devid*/, BIOSPCI_32BITS,
>devid);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353978 - in stable/12/stand: common efi/loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:36:42 2019
New Revision: 353978
URL: https://svnweb.freebsd.org/changeset/base/353978

Log:
  MFC r345998-r346002, r346007-r346008: various loader improvements
  
  r345998:
  loader: malloc+bzero is calloc
  
  Replace malloc+bzero in module.c with calloc.
  
  r345999:
  loader: file_addmodule should check for memory allocation
  
  strdup() can return NULL.
  
  r346000:
  loader: remove pointer checks before free() in module.c
  
  free() does check for NULL argument, remove duplicate checks.
  
  r346001:
  loader: file_addmetadata() should check for memory allocation
  
  malloc() can return NULL.
  
  r346002:
  loader: mod_loadkld() error: we previously assumed 'last_file' could be null
  
  The last_file variable is used to reset the loadaddr variable back to
  original
  value; however, it is possible the last_file is NULL, so we can not blindly
  trust it. But then again, we can just save the original loadaddr and use
  the saved value for recovery.
  
  r346007:
  loader: add file_remove() function to undo file_insert_tail().
  
  346002 did miss the fact that we do not only undo the loadaddr, but also
  we need to remove the inserted module. Implement file_remove() to do the
  job.
  
  r346008:
  loader: command_lsefi: ret can be used uninitialized

Modified:
  stable/12/stand/common/module.c
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/module.c
==
--- stable/12/stand/common/module.c Thu Oct 24 02:34:48 2019
(r353977)
+++ stable/12/stand/common/module.c Thu Oct 24 02:36:42 2019
(r353978)
@@ -52,16 +52,18 @@ struct moduledir {
STAILQ_ENTRY(moduledir) d_link;
 };
 
-static int file_load(char *filename, vm_offset_t dest, 
struct preloaded_file **result);
-static int file_load_dependencies(struct preloaded_file 
*base_mod);
-static char *  file_search(const char *name, char **extlist);
-static struct kernel_module *  file_findmodule(struct preloaded_file *fp, char 
*modname, struct mod_depend *verinfo);
-static int file_havepath(const char *name);
-static char*mod_searchmodule(char *name, struct mod_depend 
*verinfo);
-static voidfile_insert_tail(struct preloaded_file *mp);
-struct file_metadata*  metadata_next(struct file_metadata *base_mp, 
int type);
-static voidmoduledir_readhints(struct moduledir *mdp);
-static voidmoduledir_rebuild(void);
+static int file_load(char *, vm_offset_t, struct preloaded_file **);
+static int file_load_dependencies(struct preloaded_file *);
+static char * file_search(const char *, char **);
+static struct kernel_module *file_findmodule(struct preloaded_file *, char *,
+struct mod_depend *);
+static int file_havepath(const char *);
+static char *mod_searchmodule(char *, struct mod_depend *);
+static void file_insert_tail(struct preloaded_file *);
+static void file_remove(struct preloaded_file *);
+struct file_metadata *metadata_next(struct file_metadata *, int);
+static void moduledir_readhints(struct moduledir *);
+static void moduledir_rebuild(void);
 
 /* load address should be tweaked by first module loaded (kernel) */
 static vm_offset_t loadaddr = 0;
@@ -70,10 +72,11 @@ static vm_offset_t  loadaddr = 0;
 static const char  *default_searchpath =
 "/boot/kernel;/boot/modules;/boot/dtb";
 #else
-static const char  *default_searchpath ="/boot/kernel;/boot/modules";
+static const char  *default_searchpath = "/boot/kernel;/boot/modules";
 #endif
 
-static STAILQ_HEAD(, moduledir) moduledir_list = 
STAILQ_HEAD_INITIALIZER(moduledir_list);
+static STAILQ_HEAD(, moduledir) moduledir_list =
+STAILQ_HEAD_INITIALIZER(moduledir_list);
 
 struct preloaded_file *preloaded_files = NULL;
 
@@ -534,8 +537,7 @@ mod_load(char *modname, struct mod_depend *verinfo, in
mp = file_findmodule(NULL, modname, verinfo);
if (mp) {
 #ifdef moduleargs
-   if (mp->m_args)
-   free(mp->m_args);
+   free(mp->m_args);
mp->m_args = unargv(argc, argv);
 #endif
snprintf(command_errbuf, sizeof(command_errbuf),
@@ -560,9 +562,10 @@ mod_load(char *modname, struct mod_depend *verinfo, in
 int
 mod_loadkld(const char *kldname, int argc, char *argv[])
 {
-   struct preloaded_file   *fp, *last_file;
-   int err;
+   struct preloaded_file   *fp;
+   int err;
char*filename;
+   vm_offset_t loadaddr_saved;
 
/*
 * Get fully qualified KLD name
@@ -583,22 +586,19 @@ mod_loadkld(const char *kldname, int argc, char *argv[
free(filename);
return (0);
}
-  

svn commit: r354011 - in stable/12/stand: efi/libefi libsa

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 04:08:24 2019
New Revision: 354011
URL: https://svnweb.freebsd.org/changeset/base/354011

Log:
  MFC r349928: Allow efi loader to get network params from uboot
  
  Summary:
  efi loader does not work with static network parameters. It always uses
  BOOTP/DHCP and also uses RARP as a fallback.  Problems with DHCP servers can
  cause the loader to fail to populate network parameters.

Modified:
  stable/12/stand/efi/libefi/efinet.c
  stable/12/stand/libsa/net.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/libefi/efinet.c
==
--- stable/12/stand/efi/libefi/efinet.c Thu Oct 24 04:05:53 2019
(r354010)
+++ stable/12/stand/efi/libefi/efinet.c Thu Oct 24 04:08:24 2019
(r354011)
@@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include "dev_net.h"
+
 static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL;
 
 static void efinet_end(struct netif *);
@@ -198,7 +200,75 @@ efinet_get(struct iodesc *desc, void **pkt, time_t tim
return (ret);
 }
 
+/*
+ * Loader uses BOOTP/DHCP and also uses RARP as a fallback to populate
+ * network parameters and problems with DHCP servers can cause the loader
+ * to fail to populate them. Allow the device to ask about the basic
+ * network parameters and if present use them.
+ */
 static void
+efi_env_net_params(struct iodesc *desc)
+{
+   char *envstr;
+   in_addr_t ipaddr, mask, gwaddr, serveraddr;
+   n_long rootaddr;
+
+   if ((envstr = getenv("rootpath")) != NULL)
+   strlcpy(rootpath, envstr, sizeof(rootpath));
+
+   /*
+* Get network parameters.
+*/
+   envstr = getenv("ipaddr");
+   ipaddr = (envstr != NULL) ? inet_addr(envstr) : 0;
+
+   envstr = getenv("netmask");
+   mask = (envstr != NULL) ? inet_addr(envstr) : 0;
+
+   envstr = getenv("gatewayip");
+   gwaddr = (envstr != NULL) ? inet_addr(envstr) : 0;
+
+   envstr = getenv("serverip");
+   serveraddr = (envstr != NULL) ? inet_addr(envstr) : 0;
+
+   /* No network params. */
+   if (ipaddr == 0 && mask == 0 && gwaddr == 0 && serveraddr == 0)
+   return;
+
+   /* Partial network params. */
+   if (ipaddr == 0 || mask == 0 || gwaddr == 0 || serveraddr == 0) {
+   printf("Incomplete network settings from U-Boot\n");
+   return;
+   }
+
+   /*
+* Set network parameters.
+*/
+   myip.s_addr = ipaddr;
+   netmask = mask;
+   gateip.s_addr = gwaddr;
+   servip.s_addr = serveraddr;
+
+   /*
+* There must be a rootpath. It may be ip:/path or it may be just the
+* path in which case the ip needs to be serverip.
+*/
+   rootaddr = net_parse_rootpath();
+   if (rootaddr == INADDR_NONE)
+   rootaddr = serveraddr;
+   rootip.s_addr = rootaddr;
+
+#ifdef EFINET_DEBUG
+   printf("%s: ip=%s\n", __func__, inet_ntoa(myip));
+   printf("%s: mask=%s\n", __func__, intoa(netmask));
+   printf("%s: gateway=%s\n", __func__, inet_ntoa(gateip));
+   printf("%s: server=%s\n", __func__, inet_ntoa(servip));
+#endif
+
+   desc->myip = myip;
+}
+
+static void
 efinet_init(struct iodesc *desc, void *machdep_hint)
 {
struct netif *nif = desc->io_netif;
@@ -206,6 +276,9 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
EFI_HANDLE h;
EFI_STATUS status;
UINT32 mask;
+
+   /* Attempt to get netboot params from env */
+   efi_env_net_params(desc);
 
if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) {
printf("Invalid network interface %d\n", nif->nif_unit);

Modified: stable/12/stand/libsa/net.h
==
--- stable/12/stand/libsa/net.h Thu Oct 24 04:05:53 2019(r354010)
+++ stable/12/stand/libsa/net.h Thu Oct 24 04:08:24 2019(r354011)
@@ -91,6 +91,7 @@ externstruct in_addr rootip;
 extern struct in_addr swapip;
 extern struct in_addr gateip;
 extern struct in_addr nameip;
+extern struct in_addr servip;
 extern n_long netmask;
 extern u_int intf_mtu;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354010 - in stable/12/stand: forth lua

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 04:05:53 2019
New Revision: 354010
URL: https://svnweb.freebsd.org/changeset/base/354010

Log:
  MFC r352599, r352601: loader interp color reset fixes
  
  r352599:
  loader_4th: menu items need to reset color attribute, not switch to white
  
  Forth menu kernel and BE entries, instead of resetting the color attribute,
  are switching to white color.
  
  r352601:
  loader_lua: lua color changes should end with reset
  
  The color change should have reset sequence, not switch to white.

Modified:
  stable/12/stand/forth/menu.4th
  stable/12/stand/forth/menu.rc
  stable/12/stand/lua/color.lua
  stable/12/stand/lua/logo-beastie.lua
  stable/12/stand/lua/logo-orb.lua
  stable/12/stand/lua/menu.lua
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/forth/menu.4th
==
--- stable/12/stand/forth/menu.4th  Thu Oct 24 04:04:53 2019
(r354009)
+++ stable/12/stand/forth/menu.4th  Thu Oct 24 04:05:53 2019
(r354010)
@@ -397,7 +397,7 @@ also menu-infrastructure definitions
setenv
 
\ Assign third to ansi_caption[x][y]
-   kerncapbuf 0 s" @[1mK@[37mernel: " [char] @ escc! strcat
+   kerncapbuf 0 s" @[1mK@[mernel: " [char] @ escc! strcat
kernmenuidx @ [char] 0 = if
s" default/@[32m"
else
@@ -405,7 +405,7 @@ also menu-infrastructure definitions
then
[char] @ escc! strcat
2over strcat
-   s" @[37m" [char] @ escc! strcat
+   s" @[m" [char] @ escc! strcat
kernidx @ kernmenuidx @ ansi_caption[x][y]
setenv
 

Modified: stable/12/stand/forth/menu.rc
==
--- stable/12/stand/forth/menu.rc   Thu Oct 24 04:04:53 2019
(r354009)
+++ stable/12/stand/forth/menu.rc   Thu Oct 24 04:05:53 2019
(r354010)
@@ -72,7 +72,7 @@ s" currdev" getenv dup 0> [if] drop 4 s" zfs:" compare
 set mainmenu_caption[7]="Select Boot [E]nvironment..."
 set mainmenu_command[7]="3 goto_menu"
 set mainmenu_keycode[7]=101
-set mainansi_caption[7]="Select Boot ^[1mE^[37mnvironment..."
+set mainansi_caption[7]="Select Boot ^[1mE^[mnvironment..."
 
 s" chain_disk" getenv? [if]
set mainmenu_caption[8]="Chain[L]oad ${chain_disk}"

Modified: stable/12/stand/lua/color.lua
==
--- stable/12/stand/lua/color.lua   Thu Oct 24 04:04:53 2019
(r354009)
+++ stable/12/stand/lua/color.lua   Thu Oct 24 04:05:53 2019
(r354010)
@@ -42,7 +42,7 @@ color.MAGENTA = 5
 color.CYAN= 6
 color.WHITE   = 7
 
-color.DEFAULT = 0
+color.DEFAULT = 9
 color.BRIGHT  = 1
 color.DIM = 2
 
@@ -67,7 +67,7 @@ function color.resetfg()
if color.disabled then
return ''
end
-   return color.escapefg(color.WHITE)
+   return color.escapefg(color.DEFAULT)
 end
 
 function color.escapebg(color_value)
@@ -81,7 +81,7 @@ function color.resetbg()
if color.disabled then
return ''
end
-   return color.escapebg(color.BLACK)
+   return color.escapebg(color.DEFAULT)
 end
 
 function color.escape(fg_color, bg_color, attribute)
@@ -101,7 +101,7 @@ function color.default()
if color.disabled then
return ""
end
-   return color.escape(color.WHITE, color.BLACK, color.DEFAULT)
+   return color.escape(color.DEFAULT, color.DEFAULT)
 end
 
 function color.highlight(str)

Modified: stable/12/stand/lua/logo-beastie.lua
==
--- stable/12/stand/lua/logo-beastie.luaThu Oct 24 04:04:53 2019
(r354009)
+++ stable/12/stand/lua/logo-beastie.luaThu Oct 24 04:05:53 2019
(r354010)
@@ -48,7 +48,7 @@ local beastie_color = {
 "\\   /   /\\",
 "   \027[36m__\027[31m( (_  / \\__/",
 " \027[36m,'  ,-'   |",
-" `--{__)\027[37m"
+" `--{__)\027[m"
 }
 
 drawer.addLogo("beastie", {

Modified: stable/12/stand/lua/logo-orb.lua
==
--- stable/12/stand/lua/logo-orb.luaThu Oct 24 04:04:53 2019
(r354009)
+++ stable/12/stand/lua/logo-orb.luaThu Oct 24 04:05:53 2019
(r354010)
@@ -44,7 +44,7 @@ local orb_color = {
 "   --  \027[31;1m-.\027[31m",
 "`:`  \027[31;1m`:`",
 "  \027[31;1m.-- `--.",
-" .---..\027[37m"
+" .---..\027[m"
 }
 
 drawer.addLogo("orb", {

Modified: stable/12/stand/lua/menu.lua

svn commit: r354009 - stable/12/stand/efi/loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 04:04:53 2019
New Revision: 354009
URL: https://svnweb.freebsd.org/changeset/base/354009

Log:
  MFC r349471, r351166: Tweak EFI_STAGING_SIZE
  
  r349471:
  Increase EFI_STAGING_SIZE to 100MB on x64
  
  To avoid failures when the large 18MB nvidia.ko module is being loaded,
  increase EFI_STAGING_SIZE from 64MB to 100MB on x64 systems.
  Leave the other platforms at 64MB.
  
  r351166:
  Reduce size of EFI_STAGING_SIZE to 32 on arm
  
  Reduce the size of the EFI_STAGING area we allocate on arm to 32. On arm SBC
  such as the NanoPi-NEOLTS the staging area allocation will fail on the 256MB
  model with a staging size of 64.

Modified:
  stable/12/stand/efi/loader/copy.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/copy.c
==
--- stable/12/stand/efi/loader/copy.c   Thu Oct 24 04:00:49 2019
(r354008)
+++ stable/12/stand/efi/loader/copy.c   Thu Oct 24 04:04:53 2019
(r354009)
@@ -176,7 +176,13 @@ out:
 #endif /* __i386__ || __amd64__ */
 
 #ifndef EFI_STAGING_SIZE
+#if defined(__amd64__)
+#defineEFI_STAGING_SIZE100
+#elif defined(__arm__)
+#defineEFI_STAGING_SIZE32
+#else
 #defineEFI_STAGING_SIZE64
+#endif
 #endif
 
 EFI_PHYSICAL_ADDRESS   staging, staging_end;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354006 - in stable/12/stand: common efi/libefi efi/loader i386/libi386 libsa/zfs mips/beri/loader uboot/common uboot/lib usb/storage userboot/userboot

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:52:32 2019
New Revision: 354006
URL: https://svnweb.freebsd.org/changeset/base/354006

Log:
  MFC r345477, r346675, r346984, r348748
  
  r345477:
  Distinguish between "no partition" and "choose best partition" with a
  constant.
  
  The values of the d_slice and d_partition fields of a disk_devdesc have a
  few values with special meanings in the disk_open() routine. Through various
  evolutions of the loader code over time, a d_partition value of -1 has
  meant both "use the first ufs partition found in the bsd label" and "don't
  open a bsd partition at all, open the raw slice."
  
  This defines a new special value of -2 to mean open the raw slice, and it
  gives symbolic names to all the special values used in d_slice and
  d_partition, and adjusts all existing uses of those fields to use the new
  constants.
  
  The phab review for this timed out without being accepted, but I'm still
  citing it below because there is useful commentary there.
  
  r346675:
  Restore the ability to open a raw disk or partition in loader(8).
  
  The disk_open() function searches for "the best partition" when slice and
  partition information is not provided as part of the device name.  As of
  r345477 the slice and partition fields of a disk_devdesc are initialized to
  D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which
  was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the
  raw partition' depending on the context.  So as an unintended side effect of
  r345477 it became basically impossible to ever open a disk or partition
  without doing the 'best partition' search.  One visible effect of that was
  the inability to open the raw disk to read the partition table correctly in
  zfs_probe_dev(), leading to failures to find the zfs pool unless it was on
  the first partition.
  
  Now instead of always initializing slice and partition to wildcards, the
  disk_parsedev() function initializes them based on the presence of a
  path/file name following the device.  If there is any path or filename
  following the ':' that ends the device name, then slice and partition are
  initialized to D_SLICEWILD and D_PARTWILD.  If there is nothing after the
  ':' then it is considered to be a request to open the raw device or
  partition itself (not a file stored within it), and the fields are
  initialized to D_SLICENONE and D_PARTNONE.
  
  With this change in place, all the tests in src/tools/boot are succesful
  again, including the recently-added cases of booting from a zfs pool on
  a partition other than slice 1 of the device.
  
  r346984:
  Use D_PARTISGPT rather than bare 255
  
  These three cases dovetail with other places in the code where we use
  or set D_PARTISGPT when we mean that the partitioning scheme is
  GPT. Use this #define to make the code easier to undertand.
  
  r348748:
  loader: disk_open() should honor D_PARTNONE
  
  The D_PARTNONE is documented to make it possible to open raw MBR
  partition, but the current disk_open() does not really implement this
  statement.
  
  The current code is checking partition against -1 (D_PARTNONE) but does
  attempt to open partition table in case we do have FreeBSD MBR partition
  type.
  Instead, we should check -2 (D_PARTWILD).
  
  In case we do have MBR + BSD label, this code is only working because
  by default, the first BSD partiton is created starting with relative sector
  0, and we can still access the BSD table from that MBR slice.
  
  PR:   236981

Modified:
  stable/12/stand/common/disk.c
  stable/12/stand/common/disk.h
  stable/12/stand/efi/libefi/efipart.c
  stable/12/stand/efi/loader/main.c
  stable/12/stand/i386/libi386/biosdisk.c
  stable/12/stand/libsa/zfs/zfs.c
  stable/12/stand/mips/beri/loader/beri_disk_cfi.c
  stable/12/stand/mips/beri/loader/beri_disk_sdcard.c
  stable/12/stand/uboot/common/main.c
  stable/12/stand/uboot/lib/disk.c
  stable/12/stand/usb/storage/umass_loader.c
  stable/12/stand/userboot/userboot/main.c
  stable/12/stand/userboot/userboot/userboot_disk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/disk.c
==
--- stable/12/stand/common/disk.c   Thu Oct 24 03:51:33 2019
(r354005)
+++ stable/12/stand/common/disk.c   Thu Oct 24 03:52:32 2019
(r354006)
@@ -142,15 +142,8 @@ ptable_print(void *arg, const char *pname, const struc
dev.dd.d_dev = pa->dev->dd.d_dev;
dev.dd.d_unit = pa->dev->dd.d_unit;
dev.d_slice = part->index;
-   dev.d_partition = -1;
+   dev.d_partition = D_PARTNONE;
if (disk_open(, partsize, sectsize) == 0) {
-   /*
-* disk_open() for partition -1 on a bsd slice assumes
-* you want the first bsd partition.  Reset things so
- 

svn commit: r353996 - stable/12

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:30:48 2019
New Revision: 353996
URL: https://svnweb.freebsd.org/changeset/base/353996

Log:
  MFC r352557, r353161: powerpc/loader stripping (and revert)

Modified:
Directory Properties:
  stable/12/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354002 - stable/12/stand/common

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:41:54 2019
New Revision: 354002
URL: https://svnweb.freebsd.org/changeset/base/354002

Log:
  MFC r341276:
  When handling CMD_CRIT error set command_errmsg to NULL after we dump it
  out, so that it does not result in error message printed twice.
  
  OK load doodoo
  can't find 'doodoo'
  can't find 'doodoo'
  OK

Modified:
  stable/12/stand/common/interp_forth.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/interp_forth.c
==
--- stable/12/stand/common/interp_forth.c   Thu Oct 24 03:40:20 2019
(r354001)
+++ stable/12/stand/common/interp_forth.c   Thu Oct 24 03:41:54 2019
(r354002)
@@ -142,6 +142,7 @@ bf_command(FICL_VM *vm)
switch (result) {
case CMD_CRIT:
printf("%s\n", command_errmsg);
+   command_errmsg = NULL;
break;
case CMD_FATAL:
panic("%s", command_errmsg);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354005 - in head/sys/powerpc: include mpc85xx

2019-10-23 Thread Justin Hibbits
Author: jhibbits
Date: Thu Oct 24 03:51:33 2019
New Revision: 354005
URL: https://svnweb.freebsd.org/changeset/base/354005

Log:
  powerpc/booke: Simplify the MPC85XX PCIe root complex driver
  
  Summary:
  Due to bugs in the enumeration code, fsl_pcib_init() was not configuring
  sub-bridges properly, so devices hanging off a separate bridge would not
  be found.  Since the generic PCI code already supports probing child
  buses, just delete this code and initialize only the device itself,
  letting the generic code handle all the additional probing and
  initializing.
  
  This also deletes setup for some PCI peripherals found on some MPC85XX
  evaluation boards.  The code can be resurrected if needed, but overly
  complicated this code in the first place.
  
  Reviewed by:  bdragon
  Differential Revision:https://reviews.freebsd.org/D22050

Modified:
  head/sys/powerpc/include/resource.h
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c

Modified: head/sys/powerpc/include/resource.h
==
--- head/sys/powerpc/include/resource.h Thu Oct 24 03:48:28 2019
(r354004)
+++ head/sys/powerpc/include/resource.h Thu Oct 24 03:51:33 2019
(r354005)
@@ -40,5 +40,6 @@
 #defineSYS_RES_DRQ 2   /* isa dma lines */
 #defineSYS_RES_MEMORY  3   /* i/o memory */
 #defineSYS_RES_IOPORT  4   /* i/o ports */
+#definePCI_RES_BUS 5   /* PCI bus numbers */
 
 #endif /* !_MACHINE_RESOURCE_H_ */

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Thu Oct 24 03:48:28 2019
(r354004)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Thu Oct 24 03:51:33 2019
(r354005)
@@ -144,10 +144,6 @@ struct fsl_pcib_softc {
int sc_busnr;
int sc_pcie;
uint8_t sc_pcie_capreg; /* PCI-E Capability Reg Set */
-
-   /* Devices that need special attention. */
-   int sc_devfn_tundra;
-   int sc_devfn_via_ide;
 };
 
 struct fsl_pcib_err_dr {
@@ -187,7 +183,6 @@ static int fsl_pcib_decode_win(phandle_t, struct fsl_p
 static void fsl_pcib_err_init(device_t);
 static void fsl_pcib_inbound(struct fsl_pcib_softc *, int, int, uint64_t,
 uint64_t, uint64_t);
-static int fsl_pcib_init(struct fsl_pcib_softc *, int, int);
 static void fsl_pcib_outbound(struct fsl_pcib_softc *, int, int, uint64_t,
 uint64_t, uint64_t);
 
@@ -277,8 +272,8 @@ fsl_pcib_attach(device_t dev)
 {
struct fsl_pcib_softc *sc;
phandle_t node;
-   uint32_t cfgreg;
-   int error, maxslot, rid;
+   uint32_t cfgreg, brctl;
+   int error, rid;
uint8_t ltssm, capptr;
 
sc = device_get_softc(dev);
@@ -336,16 +331,18 @@ fsl_pcib_attach(device_t dev)
PCIM_CMD_PORTEN;
fsl_pcib_cfgwrite(sc, 0, 0, 0, PCIR_COMMAND, cfgreg, 2);
 
-   sc->sc_devfn_tundra = -1;
-   sc->sc_devfn_via_ide = -1;
+   /* Reset the bus.  Needed for Radeon video cards. */
+   brctl = fsl_pcib_read_config(sc->sc_dev, 0, 0, 0,
+   PCIR_BRIDGECTL_1, 1);
+   brctl |= PCIB_BCR_SECBUS_RESET;
+   fsl_pcib_write_config(sc->sc_dev, 0, 0, 0,
+   PCIR_BRIDGECTL_1, brctl, 1);
+   DELAY(10);
+   brctl &= ~PCIB_BCR_SECBUS_RESET;
+   fsl_pcib_write_config(sc->sc_dev, 0, 0, 0,
+   PCIR_BRIDGECTL_1, brctl, 1);
+   DELAY(10);
 
-
-   /*
-* Scan bus using firmware configured, 0 based bus numbering.
-*/
-   maxslot = (sc->sc_pcie) ? 0 : PCI_SLOTMAX;
-   fsl_pcib_init(sc, sc->sc_busnr, maxslot);
-
if (sc->sc_pcie) {
ltssm = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_LTSSM, 1);
if (ltssm < LTSSM_STAT_L0) {
@@ -513,10 +510,7 @@ fsl_pcib_read_config(device_t dev, u_int bus, u_int sl
if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10)
return (~0);
devfn = DEVFN(bus, slot, func);
-   if (devfn == sc->sc_devfn_tundra)
-   return (~0);
-   if (devfn == sc->sc_devfn_via_ide && reg == PCIR_INTPIN)
-   return (1);
+
return (fsl_pcib_cfgread(sc, bus, slot, func, reg, bytes));
 }
 
@@ -529,126 +523,6 @@ fsl_pcib_write_config(device_t dev, u_int bus, u_int s
if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10)
return;
fsl_pcib_cfgwrite(sc, bus, slot, func, reg, val, bytes);
-}
-
-static void
-fsl_pcib_init_via(struct fsl_pcib_softc *sc, uint16_t device, int bus,
-int slot, int fn)
-{
-
-   if (device == 0x0686) {
-   fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x52, 0x34, 1);
-   fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x77, 0x00, 1);
-   fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x83, 0x98, 1);
-   

svn commit: r353995 - stable/12/stand/libsa

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:29:01 2019
New Revision: 353995
URL: https://svnweb.freebsd.org/changeset/base/353995

Log:
  MFC r352548: loader: fix typo in zalloc.

Modified:
  stable/12/stand/libsa/zalloc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zalloc.c
==
--- stable/12/stand/libsa/zalloc.c  Thu Oct 24 03:27:52 2019
(r353994)
+++ stable/12/stand/libsa/zalloc.c  Thu Oct 24 03:29:01 2019
(r353995)
@@ -125,7 +125,8 @@ znalloc(MemPool *mp, uintptr_t bytes, size_t align)
continue;
 
/*
-* Cut extra from head and create new memory node from reminder.
+* Cut extra from head and create new memory node from
+* remainder.
 */
 
if (extra != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353989 - stable/12/stand/libsa/zfs

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:19:45 2019
New Revision: 353989
URL: https://svnweb.freebsd.org/changeset/base/353989

Log:
  MFC r349217: Tell loader to ignore newer features enabled on the root pool.
  
  There are many new features in ZoF. Most, if not all, do not effect read
  only usage.
  Encryption in particular is enabled at the pool level but used at the
  dataset level.
  The loader obviously will not be able to boot if the boot dataset is
  encrypted, but
  should not care if some other dataset in the root pool is encrypted.

Modified:
  stable/12/stand/libsa/zfs/zfsimpl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==
--- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:16:23 2019
(r353988)
+++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:19:45 2019
(r353989)
@@ -117,6 +117,12 @@ static const char *features_for_read[] = {
"org.illumos:skein",
"org.zfsonlinux:large_dnode",
"com.joyent:multi_vdev_crash_dump",
+   "com.delphix:spacemap_histogram",
+   "com.delphix:zpool_checkpoint",
+   "com.delphix:spacemap_v2",
+   "com.datto:encryption",
+   "org.zfsonlinux:allocation_classes",
+   "com.datto:resilver_defer",
"com.delphix:device_removal",
"com.delphix:obsolete_counts",
NULL
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353990 - stable/12/stand/efi/libefi

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:20:27 2019
New Revision: 353990
URL: https://svnweb.freebsd.org/changeset/base/353990

Log:
  MFC r349201: efinet: Defer exclusively opening the network handles
  
  Don't commit to exclusive access to the network device handle by
  efinet until the loader has decided to load something through the
  network. This allows for the possibility of other users of the
  network device.

Modified:
  stable/12/stand/efi/libefi/efinet.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/libefi/efinet.c
==
--- stable/12/stand/efi/libefi/efinet.c Thu Oct 24 03:19:45 2019
(r353989)
+++ stable/12/stand/efi/libefi/efinet.c Thu Oct 24 03:20:27 2019
(r353990)
@@ -108,7 +108,25 @@ efinet_match(struct netif *nif, void *machdep_hint)
 static int
 efinet_probe(struct netif *nif, void *machdep_hint)
 {
+   EFI_SIMPLE_NETWORK *net;
+   EFI_HANDLE h;
+   EFI_STATUS status;
 
+   h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
+   /*
+* Open the network device in exclusive mode. Without this
+* we will be racing with the UEFI network stack. It will
+* pull packets off the network leading to lost packets.
+*/
+   status = BS->OpenProtocol(h, _guid, (void **),
+   IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
+   if (status != EFI_SUCCESS) {
+   printf("Unable to open network interface %d for "
+   "exclusive access: %lu\n", nif->nif_unit,
+   EFI_ERROR_CODE(status));
+   return (efi_status_to_errno(status));
+   }
+
return (0);
 }
 
@@ -269,7 +287,6 @@ efinet_dev_init()
struct netif_dif *dif;
struct netif_stats *stats;
EFI_DEVICE_PATH *devpath, *node;
-   EFI_SIMPLE_NETWORK *net;
EFI_HANDLE *handles, *handles2;
EFI_STATUS status;
UINTN sz;
@@ -304,19 +321,6 @@ efinet_dev_init()
if (DevicePathType(node) != MESSAGING_DEVICE_PATH ||
DevicePathSubType(node) != MSG_MAC_ADDR_DP)
continue;
-
-   /*
-* Open the network device in exclusive mode. Without this
-* we will be racing with the UEFI network stack. It will
-* pull packets off the network leading to lost packets.
-*/
-   status = BS->OpenProtocol(handles[i], _guid, (void **),
-   IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
-   if (status != EFI_SUCCESS) {
-   printf("Unable to open network interface %d for "
-   "exclusive access: %lu\n", i,
-   EFI_ERROR_CODE(status));
-   }
 
handles2[nifs] = handles[i];
nifs++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353977 - stable/12/stand/common

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:34:48 2019
New Revision: 353977
URL: https://svnweb.freebsd.org/changeset/base/353977

Log:
  MFC r345330: loader: fix loading of kernels with . in path
  
  The loader indended to search the kernel file name (only) for . but
  instead searched the entire path, so paths like
  "boot/test.elfv2/kernel" would not work.

Modified:
  stable/12/stand/common/load_elf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/load_elf.c
==
--- stable/12/stand/common/load_elf.c   Thu Oct 24 02:33:57 2019
(r353976)
+++ stable/12/stand/common/load_elf.c   Thu Oct 24 02:34:48 2019
(r353977)
@@ -868,14 +868,16 @@ fake_modname(const char *name)
sp++;
else
sp = name;
-   ep = strrchr(name, '.');
-   if (ep) {
-   if (ep == name) {
-   sp = invalid_name;
-   ep = invalid_name + sizeof(invalid_name) - 1;
-   }
-   } else
-   ep = name + strlen(name);
+
+   ep = strrchr(sp, '.');
+   if (ep == NULL) {
+   ep = sp + strlen(sp);
+   }
+   if (ep == sp) {
+   sp = invalid_name;
+   ep = invalid_name + sizeof(invalid_name) - 1;
+   }
+
len = ep - sp;
fp = malloc(len + 1);
if (fp == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353975 - stable/12/stand/common

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:33:12 2019
New Revision: 353975
URL: https://svnweb.freebsd.org/changeset/base/353975

Log:
  MFC r344268: loader: ptable_close() should check its argument

Modified:
  stable/12/stand/common/part.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/part.c
==
--- stable/12/stand/common/part.c   Thu Oct 24 02:32:22 2019
(r353974)
+++ stable/12/stand/common/part.c   Thu Oct 24 02:33:12 2019
(r353975)
@@ -788,6 +788,9 @@ ptable_close(struct ptable *table)
 {
struct pentry *entry;
 
+   if (table == NULL)
+   return;
+
while (!STAILQ_EMPTY(>entries)) {
entry = STAILQ_FIRST(>entries);
STAILQ_REMOVE_HEAD(>entries, entry);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353986 - stable/12/stand/libsa/zfs

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:08:11 2019
New Revision: 353986
URL: https://svnweb.freebsd.org/changeset/base/353986

Log:
  MFC r348381: Unexpand be32dec().

Modified:
  stable/12/stand/libsa/zfs/zfsimpl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==
--- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:06:37 2019
(r353985)
+++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:08:11 2019
(r353986)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
  * Stand-alone ZFS file reader.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -195,10 +196,7 @@ zfs_free(void *ptr, size_t size)
 static int
 xdr_int(const unsigned char **xdr, int *ip)
 {
-   *ip = ((*xdr)[0] << 24)
-   | ((*xdr)[1] << 16)
-   | ((*xdr)[2] << 8)
-   | ((*xdr)[3] << 0);
+   *ip = be32dec(*xdr);
(*xdr) += 4;
return (0);
 }
@@ -206,10 +204,7 @@ xdr_int(const unsigned char **xdr, int *ip)
 static int
 xdr_u_int(const unsigned char **xdr, u_int *ip)
 {
-   *ip = ((*xdr)[0] << 24)
-   | ((*xdr)[1] << 16)
-   | ((*xdr)[2] << 8)
-   | ((*xdr)[3] << 0);
+   *ip = be32dec(*xdr);
(*xdr) += 4;
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353987 - stable/12/stand/common

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:09:31 2019
New Revision: 353987
URL: https://svnweb.freebsd.org/changeset/base/353987

Log:
  MFC r348499: Fix comment parsing in interp_simple.c
  
  loader.rc has comment lines without a trailing space, which get
  interpreted as commands. Avoid this by only matching against the
  backslash character.

Modified:
  stable/12/stand/common/interp_simple.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/interp_simple.c
==
--- stable/12/stand/common/interp_simple.c  Thu Oct 24 03:08:11 2019
(r353986)
+++ stable/12/stand/common/interp_simple.c  Thu Oct 24 03:09:31 2019
(r353987)
@@ -114,7 +114,7 @@ interp_include(const char *filename)
line++;
flags = 0;
/* Discard comments */
-   if (strncmp(input+strspn(input, " "), "\\ ", 2) == 0)
+   if (strncmp(input+strspn(input, " "), "\\", 1) == 0)
continue;
cp = input;
/* Echo? */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353974 - stable/12

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:32:22 2019
New Revision: 353974
URL: https://svnweb.freebsd.org/changeset/base/353974

Log:
  Record MFC or r344839, MFC'd in r352788

Modified:
Directory Properties:
  stable/12/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353994 - in stable/12/stand: . i386/loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:27:52 2019
New Revision: 353994
URL: https://svnweb.freebsd.org/changeset/base/353994

Log:
  MFC r352032: loader: --gc-sections needs sections to work with
  
  --gc-sections is not really useful unless we generate sections with
  -ffunction-sections -fdata-sections
  
  While there, i386/loader would win from --gc-sections too.

Modified:
  stable/12/stand/defs.mk
  stable/12/stand/i386/loader/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/defs.mk
==
--- stable/12/stand/defs.mk Thu Oct 24 03:26:45 2019(r353993)
+++ stable/12/stand/defs.mk Thu Oct 24 03:27:52 2019(r353994)
@@ -65,6 +65,7 @@ CFLAGS+=  -Ddouble=jagged-little-pill -Dfloat=floaty-mc
 # Experience has shown that problems arise between ~520k to ~530k.
 CFLAGS.clang+= -Oz
 CFLAGS.gcc+=   -Os
+CFLAGS+=   -ffunction-sections -fdata-sections
 .endif
 
 # GELI Support, with backward compat hooks (mostly)

Modified: stable/12/stand/i386/loader/Makefile
==
--- stable/12/stand/i386/loader/MakefileThu Oct 24 03:26:45 2019
(r353993)
+++ stable/12/stand/i386/loader/MakefileThu Oct 24 03:27:52 2019
(r353994)
@@ -47,7 +47,7 @@ HELP_FILES=   ${.CURDIR}/help.i386
 CLEANFILES+=   ${LOADER} ${LOADER}.bin
 
 CFLAGS+=   -Wall
-LDFLAGS+=  -static -Ttext 0x0
+LDFLAGS+=  -static -Ttext 0x0 -Wl,--gc-sections
 
 # i386 standalone support library
 LIBI386=   ${BOOTOBJ}/i386/libi386/libi386.a
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353992 - stable/12/stand/efi/libefi

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:24:28 2019
New Revision: 353992
URL: https://svnweb.freebsd.org/changeset/base/353992

Log:
  MFC r351695-r351696
  
  r351695:
  loader.efi: some systems do not translate scan code 0x8 to backspace
  
  Add scancode translation for backspace.
  
  r351696:
  loader.efi: use and prefer coninex interface
  
  Add support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Modified:
  stable/12/stand/efi/libefi/efi_console.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/libefi/efi_console.c
==
--- stable/12/stand/efi/libefi/efi_console.cThu Oct 24 03:21:30 2019
(r353991)
+++ stable/12/stand/efi/libefi/efi_console.cThu Oct 24 03:24:28 2019
(r353992)
@@ -32,8 +32,10 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
+static EFI_GUID simple_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
 static SIMPLE_TEXT_OUTPUT_INTERFACE*conout;
 static SIMPLE_INPUT_INTERFACE  *conin;
+static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex;
 
 #ifdef TERM_EMU
 #defineDEFAULT_FGCOLOR EFI_LIGHTGRAY
@@ -115,6 +117,8 @@ efi_cons_probe(struct console *cp)
 static int
 efi_cons_init(int arg)
 {
+   EFI_STATUS status;
+
 #ifdef TERM_EMU
conout->SetAttribute(conout, EFI_TEXT_ATTR(DEFAULT_FGCOLOR,
DEFAULT_BGCOLOR));
@@ -125,7 +129,11 @@ efi_cons_init(int arg)
bg_c = DEFAULT_BGCOLOR;
 #endif
conout->EnableCursor(conout, TRUE);
-   return 0;
+   status = BS->OpenProtocol(ST->ConsoleInHandle, _input_ex_guid,
+   (void **), IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+   if (status != EFI_SUCCESS)
+   coninex = NULL;
+   return (0);
 }
 
 static void
@@ -478,27 +486,30 @@ keybuf_inschar(EFI_INPUT_KEY *key)
 {
 
switch (key->ScanCode) {
-   case 0x1: /* UP */
+   case SCAN_UP: /* UP */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'A';
break;
-   case 0x2: /* DOWN */
+   case SCAN_DOWN: /* DOWN */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'B';
break;
-   case 0x3: /* RIGHT */
+   case SCAN_RIGHT: /* RIGHT */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'C';
break;
-   case 0x4: /* LEFT */
+   case SCAN_LEFT: /* LEFT */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'D';
break;
-   case 0x17:
+   case SCAN_DELETE:
+   keybuf[0] = CHAR_BACKSPACE;
+   break;
+   case SCAN_ESC:
keybuf[0] = 0x1b;   /* esc */
break;
default:
@@ -521,6 +532,40 @@ efi_readkey(void)
return (false);
 }
 
+static bool
+efi_readkey_ex(void)
+{
+   EFI_STATUS status;
+   EFI_INPUT_KEY *kp;
+   EFI_KEY_DATA  key_data;
+   uint32_t kss;
+
+   status = coninex->ReadKeyStrokeEx(coninex, _data);
+   if (status == EFI_SUCCESS) {
+   kss = key_data.KeyState.KeyShiftState;
+   kp = _data.Key;
+   if (kss & EFI_SHIFT_STATE_VALID) {
+
+   /*
+* quick mapping to control chars, replace with
+* map lookup later.
+*/
+   if (kss & EFI_RIGHT_CONTROL_PRESSED ||
+   kss & EFI_LEFT_CONTROL_PRESSED) {
+   if (kp->UnicodeChar >= 'a' &&
+   kp->UnicodeChar <= 'z') {
+   kp->UnicodeChar -= 'a';
+   kp->UnicodeChar++;
+   }
+   }
+   }
+
+   keybuf_inschar(kp);
+   return (true);
+   }
+   return (false);
+}
+
 int
 efi_cons_getchar(void)
 {
@@ -531,8 +576,13 @@ efi_cons_getchar(void)
 
key_pending = 0;
 
-   if (efi_readkey())
-   return (keybuf_getchar());
+   if (coninex == NULL) {
+   if (efi_readkey())
+   return (keybuf_getchar());
+   } else {
+   if (efi_readkey_ex())
+   return (keybuf_getchar());
+   }
 
return (-1);
 }
@@ -540,6 +590,7 @@ efi_cons_getchar(void)
 int
 efi_cons_poll(void)
 {
+   EFI_STATUS status;
 
if (keybuf_ischar() || key_pending)
return (1);
@@ -549,10 +600,21 @@ efi_cons_poll(void)
 * WaitForKey().
 * CheckEvent() can clear the signaled state.
 */
-   if (conin->WaitForKey == NULL)
-   key_pending = efi_readkey();
-   else
-   key_pending = 

svn commit: r353984 - in stable/12/stand: common fdt

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 03:04:36 2019
New Revision: 353984
URL: https://svnweb.freebsd.org/changeset/base/353984

Log:
  MFC r348194, r348196, r348204, r348207: loader/fdt pnpmatch
  
  r348194:
  loader: Add pnp functions for autoloading modules based on linker.hints
  
  This adds some new commands to loader :
  
  - pnpmatch
 This takes a pnpinfo string as argument and tries to find a kernel module
 associated with it. -v and -d option are available and are the same as in
 devmatch (v is verbose, d dumps the hints).
  - pnpload
 This takes a pnpinfo string as argument and tries to load a kernel module
 associated with it.
  - pnpautoload
 This will attempt to load every kernel module for each buses. Each buses 
are
 probed, the probe function will generate pnpinfo string and load kernel 
module
 associated with it if it exists.
  
  Only simplebus for FDT system is implemented for now.
  Since we need the dtb and overlays to be applied before searching the tree
  fdt_devmatch_next will load and apply the dtb + overlays.
  
  All the pnp parsing code comes from devmatch and is the same at 99%.
  
  r348196:
  loader: Remove unused variable
  
  r348204:
  Remove yet another unused variable.
  
  r348207:
  Initialize a variable to fix build with GCC.

Modified:
  stable/12/stand/common/module.c
  stable/12/stand/fdt/fdt_loader_cmd.c
  stable/12/stand/fdt/fdt_platform.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/module.c
==
--- stable/12/stand/common/module.c Thu Oct 24 03:01:40 2019
(r353983)
+++ stable/12/stand/common/module.c Thu Oct 24 03:04:36 2019
(r353984)
@@ -39,6 +39,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(LOADER_FDT_SUPPORT)
+#include 
+#endif
+
 #include "bootstrap.h"
 
 #defineMDIR_REMOVED0x0001
@@ -52,18 +56,18 @@ struct moduledir {
STAILQ_ENTRY(moduledir) d_link;
 };
 
-static int file_load(char *, vm_offset_t, struct preloaded_file **);
-static int file_load_dependencies(struct preloaded_file *);
-static char * file_search(const char *, char **);
-static struct kernel_module *file_findmodule(struct preloaded_file *, char *,
-struct mod_depend *);
-static int file_havepath(const char *);
-static char *mod_searchmodule(char *, struct mod_depend *);
-static void file_insert_tail(struct preloaded_file *);
-static void file_remove(struct preloaded_file *);
-struct file_metadata *metadata_next(struct file_metadata *, int);
-static void moduledir_readhints(struct moduledir *);
-static void moduledir_rebuild(void);
+static int file_load(char *filename, vm_offset_t dest, 
struct preloaded_file **result);
+static int file_load_dependencies(struct preloaded_file 
*base_mod);
+static char *  file_search(const char *name, char **extlist);
+static struct kernel_module *  file_findmodule(struct preloaded_file *fp, char 
*modname, struct mod_depend *verinfo);
+static int file_havepath(const char *name);
+static char*mod_searchmodule(char *name, struct mod_depend 
*verinfo);
+static char *  mod_searchmodule_pnpinfo(const char *bus, const 
char *pnpinfo);
+static voidfile_insert_tail(struct preloaded_file *mp);
+static voidfile_remove(struct preloaded_file *fp);
+struct file_metadata*  metadata_next(struct file_metadata *base_mp, 
int type);
+static voidmoduledir_readhints(struct moduledir *mdp);
+static voidmoduledir_rebuild(void);
 
 /* load address should be tweaked by first module loaded (kernel) */
 static vm_offset_t loadaddr = 0;
@@ -344,6 +348,186 @@ command_lsmod(int argc, char *argv[])
return(CMD_OK);
 }
 
+COMMAND_SET(pnpmatch, "pnpmatch", "list matched modules based on pnpinfo", 
command_pnpmatch);
+
+static int pnp_dump_flag = 0;
+static int pnp_unbound_flag = 0;
+static int pnp_verbose_flag = 0;
+
+static int
+command_pnpmatch(int argc, char *argv[])
+{
+   char *module;
+   int ch;
+
+   pnp_verbose_flag = 0;
+   pnp_dump_flag = 0;
+   optind = 1;
+   optreset = 1;
+   while ((ch = getopt(argc, argv, "vd")) != -1) {
+   switch(ch) {
+   case 'v':
+   pnp_verbose_flag = 1;
+   break;
+   case 'd':
+   pnp_dump_flag = 1;
+   break;
+   case '?':
+   default:
+   /* getopt has already reported an error */
+   return(CMD_OK);
+   }
+   }
+   argv += (optind - 1);
+   argc -= (optind - 1);
+
+   module = mod_searchmodule_pnpinfo(argv[1], argv[2]);
+   if (module)
+   printf("Matched module: %s\n", module);
+  

svn commit: r353971 - in stable/12/stand/efi: include include/Guid include/Protocol libefi loader

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:27:16 2019
New Revision: 353971
URL: https://svnweb.freebsd.org/changeset/base/353971

Log:
  MFC r342054-r342055, r342742: loader diagnostics
  
  r342054:
  Print an error message in efi_main.c if we can't allocate memory for the
  heap
  
  With the default Qemu parameters, only 128MB RAM gets given to a VM. This
  causes
  the loader to be unable to allocate the 64MB it needs for the heap. This
  change
  makes the cause of the error more obvious.
  
  r342055:
  Cast error message in efi_main.c to CHAR16* to avoid build error
  
  r342742:
  loader.efi: efi variable rework and lsefi command added
  
  This update does add diag and debug capabilities to interpret the efi
  variables, configuration and protocols (lsefi).
  
  The side effect is that we add/update bunch of related headers.

Added:
  stable/12/stand/efi/include/Guid/
 - copied from r342742, head/stand/efi/include/Guid/
  stable/12/stand/efi/include/Protocol/
 - copied from r342742, head/stand/efi/include/Protocol/
  stable/12/stand/efi/include/efigpt.h
 - copied unchanged from r342742, head/stand/efi/include/efigpt.h
  stable/12/stand/efi/include/efiip.h
 - copied unchanged from r342742, head/stand/efi/include/efiip.h
  stable/12/stand/efi/include/efipoint.h
 - copied unchanged from r342742, head/stand/efi/include/efipoint.h
  stable/12/stand/efi/include/efitcp.h
 - copied unchanged from r342742, head/stand/efi/include/efitcp.h
  stable/12/stand/efi/include/efiudp.h
 - copied unchanged from r342742, head/stand/efi/include/efiudp.h
Modified:
  stable/12/stand/efi/include/efi.h
  stable/12/stand/efi/include/efiapi.h
  stable/12/stand/efi/include/eficon.h
  stable/12/stand/efi/include/efidef.h
  stable/12/stand/efi/include/efilib.h
  stable/12/stand/efi/include/efipciio.h
  stable/12/stand/efi/libefi/env.c
  stable/12/stand/efi/loader/efi_main.c
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/include/efi.h
==
--- stable/12/stand/efi/include/efi.h   Thu Oct 24 02:25:33 2019
(r353970)
+++ stable/12/stand/efi/include/efi.h   Thu Oct 24 02:27:16 2019
(r353971)
@@ -43,8 +43,10 @@ Revision History
 #include "efibind.h"
 #include "efidef.h"
 #include "efidevp.h"
+#include "efipciio.h"
 #include "efiprot.h"
 #include "eficon.h"
+#include "eficonsctl.h"
 #include "efiser.h"
 #include "efi_nii.h"
 #include "efipxebc.h"
@@ -53,6 +55,11 @@ Revision History
 #include "efifs.h"
 #include "efierr.h"
 #include "efigop.h"
+#include "efiip.h"
+#include "efiudp.h"
+#include "efitcp.h"
+#include "efipoint.h"
+#include "efiuga.h"
 
 /*
  * FreeBSD UUID

Modified: stable/12/stand/efi/include/efiapi.h
==
--- stable/12/stand/efi/include/efiapi.hThu Oct 24 02:25:33 2019
(r353970)
+++ stable/12/stand/efi/include/efiapi.hThu Oct 24 02:27:16 2019
(r353971)
@@ -218,9 +218,13 @@ VOID
 { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 
0x8C} }
 
 // Variable attributes
-#define EFI_VARIABLE_NON_VOLATILE   0x0001
-#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0002
-#define EFI_VARIABLE_RUNTIME_ACCESS 0x0004
+#define EFI_VARIABLE_NON_VOLATILE  0x0001
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS0x0002
+#define EFI_VARIABLE_RUNTIME_ACCESS0x0004
+#defineEFI_VARIABLE_HARDWARE_ERROR_RECORD  0x0008
+#defineEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0010
+#defineEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS  
0x0020
+#defineEFI_VARIABLE_APPEND_WRITE   0x0040
 
 // Variable size limitation
 #define EFI_MAXIMUM_VARIABLE_SIZE   1024
@@ -911,4 +915,282 @@ typedef struct _EFI_SYSTEM_TABLE {
 
 } EFI_SYSTEM_TABLE;
 
+/*
+ * unlisted GUID's..
+ */
+#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \
+{ 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7} 
}
+
+#define EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID \
+{ 0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe} 
}
+
+#define EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \
+{ 0x107a772b, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
+
+#define EFI_DRIVER_BINDING_PROTOCOL_GUID \
+  { 0x18A031AB, 0xB443, 0x4D1A, \
+{ 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } \
+  }
+
+#define EFI_TAPE_IO_PROTOCOL_GUID \
+  { 0x1e93e633, 0xd65a, 0x459e, \
+{ 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \
+  }
+
+#define EFI_SCSI_IO_PROTOCOL_GUID \
+  { 0x932f47e6, 0x2362, 0x4002, \
+{ 0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \
+  }
+
+#define EFI_USB2_HC_PROTOCOL_GUID \
+  { 0x3e745226, 0x9818, 0x45b6, \
+{ 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } \
+  

svn commit: r353968 - stable/12/stand/efi/libefi

2019-10-23 Thread Kyle Evans
Author: kevans
Date: Thu Oct 24 02:22:52 2019
New Revision: 353968
URL: https://svnweb.freebsd.org/changeset/base/353968

Log:
  MFC r339796: Simplify the EFI delay() function by calling BS->Stall()

Modified:
  stable/12/stand/efi/libefi/delay.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/libefi/delay.c
==
--- stable/12/stand/efi/libefi/delay.c  Wed Oct 23 23:20:49 2019
(r353967)
+++ stable/12/stand/efi/libefi/delay.c  Thu Oct 24 02:22:52 2019
(r353968)
@@ -33,15 +33,5 @@ __FBSDID("$FreeBSD$");
 void
 delay(int usecs)
 {
-   static EFI_EVENT ev = 0;
-   UINTN junk;
-
-   if (!ev) {
-   if (BS->CreateEvent(EVT_TIMER, TPL_APPLICATION, 0, 0, )
-   != EFI_SUCCESS)
-   return;
-   }
-
-   BS->SetTimer(ev, TimerRelative, usecs * 10);
-   BS->WaitForEvent(1, , );
+   BS->Stall(usecs);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353967 - head/sys/net

2019-10-23 Thread Eric Joyner
Author: erj
Date: Wed Oct 23 23:20:49 2019
New Revision: 353967
URL: https://svnweb.freebsd.org/changeset/base/353967

Log:
  iflib: call ether_ifdetach and netmap_detach before stop
  
  From Jake:
  Calling ether_ifdetach after iflib_stop leads to a potential race where
  a stale ifp pointer can remain in the route entry list for IPv6 traffic.
  This will potentially cause a page fault or other system instability if
  the ifp pointer is accessed.
  
  Move both iflib_netmap_detach and ether_ifdetach to be called prior to
  iflib_stop. This avoids the race above, and helps ensure that other ifp
  references are removed before stopping the interface.
  
  Submitted by: Jacob Keller 
  Reviewed by:  erj@, gallatin@, jhb@
  MFC after:3 days
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D22071

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Oct 23 23:10:12 2019(r353966)
+++ head/sys/net/iflib.cWed Oct 23 23:20:49 2019(r353967)
@@ -703,6 +703,7 @@ static int iflib_altq_if_transmit(if_t ifp, struct mbu
 #endif
 static int iflib_register(if_ctx_t);
 static void iflib_deregister(if_ctx_t);
+static void iflib_unregister_vlan_handlers(if_ctx_t ctx);
 static void iflib_init_locked(if_ctx_t ctx);
 static void iflib_add_device_sysctl_pre(if_ctx_t ctx);
 static void iflib_add_device_sysctl_post(if_ctx_t ctx);
@@ -5007,6 +5008,9 @@ iflib_pseudo_deregister(if_ctx_t ctx)
struct taskqgroup *tqg;
iflib_fl_t fl;
 
+   /* Unregister VLAN event handlers early */
+   iflib_unregister_vlan_handlers(ctx);
+
ether_ifdetach(ifp);
/* XXX drain any dependent tasks */
tqg = qgroup_if_io_tqg;
@@ -5080,12 +5084,16 @@ iflib_device_deregister(if_ctx_t ctx)
ctx->ifc_flags |= IFC_IN_DETACH;
STATE_UNLOCK(ctx);
 
+   /* Unregister VLAN handlers before calling iflib_stop() */
+   iflib_unregister_vlan_handlers(ctx);
+
+   iflib_netmap_detach(ifp);
+   ether_ifdetach(ifp);
+
CTX_LOCK(ctx);
iflib_stop(ctx);
CTX_UNLOCK(ctx);
 
-   iflib_netmap_detach(ifp);
-   ether_ifdetach(ifp);
iflib_rem_pfil(ctx);
if (ctx->ifc_led_dev != NULL)
led_destroy(ctx->ifc_led_dev);
@@ -5375,13 +5383,8 @@ iflib_register(if_ctx_t ctx)
 }
 
 static void
-iflib_deregister(if_ctx_t ctx)
+iflib_unregister_vlan_handlers(if_ctx_t ctx)
 {
-   if_t ifp = ctx->ifc_ifp;
-
-   /* Remove all media */
-   ifmedia_removeall(>ifc_media);
-
/* Unregister VLAN events */
if (ctx->ifc_vlan_attach_event != NULL) {
EVENTHANDLER_DEREGISTER(vlan_config, 
ctx->ifc_vlan_attach_event);
@@ -5391,6 +5394,19 @@ iflib_deregister(if_ctx_t ctx)
EVENTHANDLER_DEREGISTER(vlan_unconfig, 
ctx->ifc_vlan_detach_event);
ctx->ifc_vlan_detach_event = NULL;
}
+
+}
+
+static void
+iflib_deregister(if_ctx_t ctx)
+{
+   if_t ifp = ctx->ifc_ifp;
+
+   /* Remove all media */
+   ifmedia_removeall(>ifc_media);
+
+   /* Ensure that VLAN event handlers are unregistered */
+   iflib_unregister_vlan_handlers(ctx);
 
/* Release kobject reference */
kobj_delete((kobj_t) ctx, NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353966 - head/sys/netinet6

2019-10-23 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct 23 23:10:12 2019
New Revision: 353966
URL: https://svnweb.freebsd.org/changeset/base/353966

Log:
  frag6: add "big picture"
  
  Add some ASCII relation of how the bits plug together.  The terminology
  difference of "fragmented packets" and "fragment packets" is subtle.
  While here clear up more whitespace and comments.
  
  No functional change.
  
  MFC after:3 weeks
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Wed Oct 23 23:01:18 2019(r353965)
+++ head/sys/netinet6/frag6.c   Wed Oct 23 23:10:12 2019(r353966)
@@ -69,6 +69,22 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+/*
+ * A "big picture" of how IPv6 fragment queues are all linked together.
+ *
+ * struct ip6qbucket ip6qb[...];   hashed buckets
+ * 
+ * |
+ * +--- TAILQ(struct ip6q, packets) *q6;   tailq entries holding
+ *     fragmented packets
+ *  |  (1 per original packet)
+ *  |
+ *  +--- TAILQ(struct ip6asfrag, ip6q_frags) *af6; tailq entries of IPv6
+ *   |   *ip6af;fragment packets
+ *   | for one original packet
+ *   + *mbuf
+ */
+
 /* Reassembly headers are stored in hash buckets. */
 #defineIP6REASS_NHASH_LOG2 10
 #defineIP6REASS_NHASH  (1 << IP6REASS_NHASH_LOG2)
@@ -84,10 +100,10 @@ struct ip6qbucket {
 struct ip6asfrag {
TAILQ_ENTRY(ip6asfrag) ip6af_tq;
struct mbuf *ip6af_m;
-   int ip6af_offset;   /* offset in ip6af_m to next header */
-   int ip6af_frglen;   /* fragmentable part length */
-   int ip6af_off;  /* fragment offset */
-   boolip6af_mff;  /* more fragment bit in frag off */
+   int ip6af_offset;   /* Offset in ip6af_m to next header. */
+   int ip6af_frglen;   /* Fragmentable part length. */
+   int ip6af_off;  /* Fragment offset. */
+   boolip6af_mff;  /* More fragment bit in frag off. */
 };
 
 #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
@@ -309,7 +325,7 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp)
 
m = IP6_REASS_MBUF(af6);
 
-   /* clear no longer valid rcvif pointer */
+   /* Clear no longer valid rcvif pointer. */
if (m->m_pkthdr.rcvif == ifp)
m->m_pkthdr.rcvif = NULL;
}
@@ -563,6 +579,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
IP6QB_UNLOCK(bucket);
return (IPPROTO_DONE);
}
+
/*
 * If it is the first fragment, do the above check for each
 * fragment already stored in the reassembly queue.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353965 - head/sys/netinet6

2019-10-23 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct 23 23:01:18 2019
New Revision: 353965
URL: https://svnweb.freebsd.org/changeset/base/353965

Log:
  frag6: replace KAME hand-rolled queues with queue(9) TAILQs
  
  Remove the KAME custom circular queue for fragments and fragmented packets
  and replace them with a standard TAILQ.
  This make the code a lot more understandable and maintainable and removes
  further hand-rolled code from the the tree using a standard interface instead.
  
  Hide the still public structures under #ifdef _KERNEL as there is no
  use for them in user space.
  The naming is a bit confusing now as struct ip6q and the ip6q[] buckets
  array are not the same anymore;  sadly struct ip6q is also used by the
  MAC framework and we cannot rename it.
  
  Submitted by: jtl (initally)
  MFC after:3 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D16847 (jtl's 
original)

Modified:
  head/sys/netinet6/frag6.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Wed Oct 23 20:39:21 2019(r353964)
+++ head/sys/netinet6/frag6.c   Wed Oct 23 23:01:18 2019(r353965)
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
+ * Copyright (c) 2019 Netflix, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -72,28 +74,20 @@ __FBSDID("$FreeBSD$");
 #defineIP6REASS_NHASH  (1 << IP6REASS_NHASH_LOG2)
 #defineIP6REASS_HMASK  (IP6REASS_NHASH - 1)
 
-static void frag6_enq(struct ip6asfrag *, struct ip6asfrag *,
-uint32_t bucket __unused);
-static void frag6_deq(struct ip6asfrag *, uint32_t bucket __unused);
-static void frag6_insque_head(struct ip6q *, struct ip6q *,
-uint32_t bucket);
-static void frag6_remque(struct ip6q *, uint32_t bucket);
-static void frag6_freef(struct ip6q *, uint32_t bucket);
-
+TAILQ_HEAD(ip6qhead, ip6q);
 struct ip6qbucket {
-   struct ip6q ip6q;
+   struct ip6qhead packets;
struct mtx  lock;
int count;
 };
 
-struct ip6asfrag {
-   struct ip6asfrag *ip6af_down;
-   struct ip6asfrag *ip6af_up;
+struct ip6asfrag {
+   TAILQ_ENTRY(ip6asfrag) ip6af_tq;
struct mbuf *ip6af_m;
int ip6af_offset;   /* offset in ip6af_m to next header */
int ip6af_frglen;   /* fragmentable part length */
int ip6af_off;  /* fragment offset */
-   u_int16_t   ip6af_mff;  /* more fragment bit in frag off */
+   boolip6af_mff;  /* more fragment bit in frag off */
 };
 
 #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
@@ -132,7 +126,7 @@ VNET_DEFINE_STATIC(uint32_t,ip6qb_hashseed);
 #defineIP6QB_TRYLOCK(_b)   mtx_trylock(_ip6qb[(_b)].lock)
 #defineIP6QB_LOCK_ASSERT(_b)   mtx_assert(_ip6qb[(_b)].lock, 
MA_OWNED)
 #defineIP6QB_UNLOCK(_b)mtx_unlock(_ip6qb[(_b)].lock)
-#defineIP6QB_HEAD(_b)  (_ip6qb[(_b)].ip6q)
+#defineIP6QB_HEAD(_b)  (_ip6qb[(_b)].packets)
 
 /*
  * By default, limit the number of IP6 fragments across all reassembly
@@ -240,17 +234,15 @@ static void
 frag6_freef(struct ip6q *q6, uint32_t bucket)
 {
struct ip6_hdr *ip6;
-   struct ip6asfrag *af6, *down6;
+   struct ip6asfrag *af6;
struct mbuf *m;
 
IP6QB_LOCK_ASSERT(bucket);
 
-   for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6;
-af6 = down6) {
+   while ((af6 = TAILQ_FIRST(>ip6q_frags)) != NULL) {
 
m = IP6_REASS_MBUF(af6);
-   down6 = af6->ip6af_down;
-   frag6_deq(af6, bucket);
+   TAILQ_REMOVE(>ip6q_frags, af6, ip6af_tq);
 
/*
 * Return ICMP time exceeded error for the 1st fragment.
@@ -272,7 +264,9 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
 
free(af6, M_FRAG6);
}
-   frag6_remque(q6, bucket);
+
+   TAILQ_REMOVE(IP6QB_HEAD(bucket), q6, ip6q_tq);
+   V_ip6qb[bucket].count--;
atomic_subtract_int(_nfrags, q6->ip6q_nfrag);
 #ifdef MAC
mac_ip6q_destroy(q6);
@@ -288,10 +282,11 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
 static void
 frag6_cleanup(void *arg __unused, struct ifnet *ifp)
 {
-   struct ip6q *q6, *q6n, *head;
+   struct ip6qhead *head;
+   struct ip6q *q6;
struct ip6asfrag *af6;
struct mbuf *m;
-   int i;
+   uint32_t bucket;
 
KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
 
@@ -305,15 +300,13 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp)
 #endif
 

svn commit: r353964 - head/sys/vm

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 20:39:21 2019
New Revision: 353964
URL: https://svnweb.freebsd.org/changeset/base/353964

Log:
  Modify release_page() to handle a missing fault page.
  
  r353890 introduced a case where we may call release_page() with
  fs.m == NULL, since the fault handler may now lock the vnode prior
  to allocating a page for a page-in.
  
  Reported by:  jhb
  Reviewed by:  kib
  MFC with: r353890
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22120

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed Oct 23 20:37:15 2019(r353963)
+++ head/sys/vm/vm_fault.c  Wed Oct 23 20:39:21 2019(r353964)
@@ -154,11 +154,13 @@ static inline void
 release_page(struct faultstate *fs)
 {
 
-   vm_page_xunbusy(fs->m);
-   vm_page_lock(fs->m);
-   vm_page_deactivate(fs->m);
-   vm_page_unlock(fs->m);
-   fs->m = NULL;
+   if (fs->m != NULL) {
+   vm_page_xunbusy(fs->m);
+   vm_page_lock(fs->m);
+   vm_page_deactivate(fs->m);
+   vm_page_unlock(fs->m);
+   fs->m = NULL;
+   }
 }
 
 static inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353963 - head/sys/netinet6

2019-10-23 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct 23 20:37:15 2019
New Revision: 353963
URL: https://svnweb.freebsd.org/changeset/base/353963

Log:
  frag6: whitespace changes
  
  Remove trailing white space, add a blank line, and compress a comment.
  No functional changes.
  
  MFC after:10 days
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Wed Oct 23 19:35:26 2019(r353962)
+++ head/sys/netinet6/frag6.c   Wed Oct 23 20:37:15 2019(r353963)
@@ -106,7 +106,7 @@ VNET_DEFINE_STATIC(bool,frag6_on);
 #defineV_frag6_on  VNET(frag6_on)
 #endif
 
-/* System wide (global) maximum and count of packets in reassembly queues. */ 
+/* System wide (global) maximum and count of packets in reassembly queues. */
 static int ip6_maxfrags;
 static volatile u_int frag6_nfrags = 0;
 
@@ -215,7 +215,7 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait
if (m->m_len >= offset + sizeof(struct ip6_frag)) {
 
/* This is the only possible case with !PULLDOWN_TEST. */
-   ip6  = mtod(m, struct ip6_hdr *);
+   ip6 = mtod(m, struct ip6_hdr *);
bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
offset);
m->m_data += sizeof(struct ip6_frag);
@@ -395,9 +395,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
return (IPPROTO_DONE);
 #endif
 
-   /*
-* Store receive network interface pointer for later.
-*/
+   /* Store receive network interface pointer for later. */
srcifp = m->m_pkthdr.rcvif;
 
dstifp = NULL;
@@ -598,7 +596,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 
/* Set a valid receive interface pointer. */
merr->m_pkthdr.rcvif = srcifp;
-   
+
/* Adjust pointer. */
ip6err = mtod(merr, struct ip6_hdr *);
 
@@ -697,6 +695,7 @@ insert:
frag6_enq(ip6af, af6->ip6af_up, bucket);
atomic_add_int(_nfrags, 1);
q6->ip6q_nfrag++;
+
plen = 0;
for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6;
 af6 = af6->ip6af_down) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353962 - head/sys/arm64/conf

2019-10-23 Thread Ed Maste
Author: emaste
Date: Wed Oct 23 19:35:26 2019
New Revision: 353962
URL: https://svnweb.freebsd.org/changeset/base/353962

Log:
  arm64: enable options NUMA in GENERIC
  
  As with amd64 NUMA is required for reasonable operation on big-iron
  arm64 systems and is expected to have no significant impact on small
  systems.  Enable it now for wider testing in advance of FreeBSD 13.0.
  
  You can use the 'vm.ndomains' sysctl to see if multiple domains are in
  use - for example (from Cavium/Marvell ThunderX2):
  
  # sysctl vm.ndomains
  vm.ndomains: 2
  
  No objection: manu
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Wed Oct 23 19:23:31 2019(r353961)
+++ head/sys/arm64/conf/GENERIC Wed Oct 23 19:35:26 2019(r353962)
@@ -25,6 +25,7 @@ makeoptions   DEBUG=-g# Build kernel with 
gdb(1) debug
 makeoptionsWITH_CTF=1  # Run ctfconvert(1) for DTrace support
 
 optionsSCHED_ULE   # ULE scheduler
+optionsNUMA# Non-Uniform Memory Architecture 
support
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsVIMAGE  # Subsystem virtualization, e.g. VNET
 optionsINET# InterNETworking
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353961 - head/usr.bin/dtc

2019-10-23 Thread Warner Losh
Author: imp
Date: Wed Oct 23 19:23:31 2019
New Revision: 353961
URL: https://svnweb.freebsd.org/changeset/base/353961

Log:
  exit requires stdlib.h to be included to use.
  
  FreeBSD 10.3 requires this, and dtc is a bootstrap tool so it needs to compile
  there.

Modified:
  head/usr.bin/dtc/dtb.cc

Modified: head/usr.bin/dtc/dtb.cc
==
--- head/usr.bin/dtc/dtb.cc Wed Oct 23 19:17:10 2019(r353960)
+++ head/usr.bin/dtc/dtb.cc Wed Oct 23 19:23:31 2019(r353961)
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353960 - head/sys/amd64/amd64

2019-10-23 Thread Mateusz Guzik
Author: mjg
Date: Wed Oct 23 19:17:10 2019
New Revision: 353960
URL: https://svnweb.freebsd.org/changeset/base/353960

Log:
  amd64 pmap: per-domain pv chunk list
  
  This significantly reduces contention since chunks get created and removed
  all the time. See the review for sample results.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21976

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Oct 23 19:03:03 2019(r353959)
+++ head/sys/amd64/amd64/pmap.c Wed Oct 23 19:17:10 2019(r353960)
@@ -165,6 +165,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef NUMA
+#definePMAP_MEMDOM MAXMEMDOM
+#else
+#definePMAP_MEMDOM 1
+#endif
+
 static __inline boolean_t
 pmap_type_guest(pmap_t pmap)
 {
@@ -420,8 +426,30 @@ static int pmap_initialized;
  * Data for the pv entry allocation mechanism.
  * Updates to pv_invl_gen are protected by the pv list lock but reads are not.
  */
-static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks);
-static struct mtx __exclusive_cache_line pv_chunks_mutex;
+#ifdef NUMA
+static __inline int
+pc_to_domain(struct pv_chunk *pc)
+{
+
+   return (_vm_phys_domain(DMAP_TO_PHYS((vm_offset_t)pc)));
+}
+#else
+static __inline int
+pc_to_domain(struct pv_chunk *pc __unused)
+{
+
+   return (0);
+}
+#endif
+
+struct pv_chunks_list {
+   struct mtx pvc_lock;
+   TAILQ_HEAD(pch, pv_chunk) pvc_list;
+   int active_reclaims;
+} __aligned(CACHE_LINE_SIZE);
+
+struct pv_chunks_list __exclusive_cache_line pv_chunks[PMAP_MEMDOM];
+
 #ifdef NUMA
 struct pmap_large_md_page {
struct rwlock   pv_lock;
@@ -2044,10 +2072,12 @@ pmap_init(void)
}
 
/*
-* Initialize the pv chunk list mutex.
+* Initialize pv chunk lists.
 */
-   mtx_init(_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF);
-
+   for (i = 0; i < PMAP_MEMDOM; i++) {
+   mtx_init(_chunks[i].pvc_lock, "pmap pv chunk list", NULL, 
MTX_DEF);
+   TAILQ_INIT(_chunks[i].pvc_list);
+   }
pmap_init_pv_table();
 
pmap_initialized = 1;
@@ -4150,8 +4180,9 @@ reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked
  * exacerbating the shortage of free pv entries.
  */
 static vm_page_t
-reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp)
+reclaim_pv_chunk_domain(pmap_t locked_pmap, struct rwlock **lockp, int domain)
 {
+   struct pv_chunks_list *pvc;
struct pv_chunk *pc, *pc_marker, *pc_marker_end;
struct pv_chunk_header pc_marker_b, pc_marker_end_b;
struct md_page *pvh;
@@ -4166,7 +4197,6 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
uint64_t inuse;
int bit, field, freed;
bool start_di;
-   static int active_reclaims = 0;
 
PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED);
KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL"));
@@ -4186,10 +4216,11 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
 */
start_di = pmap_not_in_di();
 
-   mtx_lock(_chunks_mutex);
-   active_reclaims++;
-   TAILQ_INSERT_HEAD(_chunks, pc_marker, pc_lru);
-   TAILQ_INSERT_TAIL(_chunks, pc_marker_end, pc_lru);
+   pvc = _chunks[domain];
+   mtx_lock(>pvc_lock);
+   pvc->active_reclaims++;
+   TAILQ_INSERT_HEAD(>pvc_list, pc_marker, pc_lru);
+   TAILQ_INSERT_TAIL(>pvc_list, pc_marker_end, pc_lru);
while ((pc = TAILQ_NEXT(pc_marker, pc_lru)) != pc_marker_end &&
SLIST_EMPTY()) {
next_pmap = pc->pc_pmap;
@@ -4202,7 +4233,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
 */
goto next_chunk;
}
-   mtx_unlock(_chunks_mutex);
+   mtx_unlock(>pvc_lock);
 
/*
 * A pv_chunk can only be removed from the pc_lru list
@@ -4219,17 +4250,17 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
PMAP_LOCK(pmap);
if (start_di)
pmap_delayed_invl_start();
-   mtx_lock(_chunks_mutex);
+   mtx_lock(>pvc_lock);
continue;
} else if (pmap != locked_pmap) {
if (PMAP_TRYLOCK(pmap)) {
if (start_di)
pmap_delayed_invl_start();
-   mtx_lock(_chunks_mutex);
+   mtx_lock(>pvc_lock);
continue;
} else {
  

svn commit: r353959 - head/sys/amd64/include

2019-10-23 Thread Conrad Meyer
Author: cem
Date: Wed Oct 23 19:03:03 2019
New Revision: 353959
URL: https://svnweb.freebsd.org/changeset/base/353959

Log:
  amd64: Add CFI directives for libc syscall stubs
  
  No functional change (in program code).  Additional DWARF metadata is
  generated in the .eh_frame section.  Also, it is now a compile-time
  requirement that machine/asm.h ENTRY() and END() macros are paired.  (This
  is subject to ongoing discussion and may change.)
  
  This DWARF metadata allows llvm-libunwind to unwind program stacks when the
  program is executing the function.  The goal is to collect accurate
  userspace stacktraces when programs have entered syscalls.
  
  (The motivation for "Call Frame Information," or CFI for short -- not to be
  confused with Control Flow Integrity -- is to sufficiently annotate assembly
  functions such that stack unwinders can unwind out of the local frame
  without the requirement of a dedicated framepointer register; i.e.,
  -fomit-frame-pointer.  This is necessary for C++ exception handling or
  collecting backtraces.)
  
  For the curious, a more thorough description of the metadata and some
  examples may be found at [1] and documentation at [2].  You can also look at
  'cc -S -o - foo.c | less' and search for '.cfi_' to see the CFI directives
  generated by your C compiler.
  
  [1]: https://www.imperialviolet.org/2017/01/18/cfi.html
  [2]: https://sourceware.org/binutils/docs/as/CFI-directives.html
  
  Reviewed by:  emaste, kib (with reservations)
  Differential Revision:https://reviews.freebsd.org/D22122

Modified:
  head/sys/amd64/include/asm.h

Modified: head/sys/amd64/include/asm.h
==
--- head/sys/amd64/include/asm.hWed Oct 23 18:27:30 2019
(r353958)
+++ head/sys/amd64/include/asm.hWed Oct 23 19:03:03 2019
(r353959)
@@ -60,25 +60,36 @@
 #define _START_ENTRY   .text; .p2align 4,0x90
 
 #define _ENTRY(x)  _START_ENTRY; \
-   .globl CNAME(x); .type CNAME(x),@function; CNAME(x):
+   .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
+   .cfi_startproc
 
 #ifdef PROF
 #defineALTENTRY(x) _ENTRY(x); \
-   pushq %rbp; movq %rsp,%rbp; \
+   pushq %rbp; \
+   .cfi_def_cfa_offset 16; \
+   .cfi_offset %rbp, -16; \
+   movq %rsp,%rbp; \
call PIC_PLT(HIDENAME(mcount)); \
popq %rbp; \
+   .cfi_restore %rbp; \
+   .cfi_def_cfa_offset 8; \
jmp 9f
 #defineENTRY(x)_ENTRY(x); \
-   pushq %rbp; movq %rsp,%rbp; \
+   pushq %rbp; \
+   .cfi_def_cfa_offset 16; \
+   .cfi_offset %rbp, -16; \
+   movq %rsp,%rbp; \
call PIC_PLT(HIDENAME(mcount)); \
popq %rbp; \
+   .cfi_restore %rbp; \
+   .cfi_def_cfa_offset 8; \
9:
 #else
 #defineALTENTRY(x) _ENTRY(x)
 #defineENTRY(x)_ENTRY(x)
 #endif
 
-#defineEND(x)  .size x, . - x
+#defineEND(x)  .size x, . - x; .cfi_endproc
 /*
  * WEAK_REFERENCE(): create a weak reference alias from sym. 
  * The macro is not a general asm macro that takes arbitrary names,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r353640 - head/sys/kern

2019-10-23 Thread Peter Jeremy
On 2019-Oct-16 13:21:02 +, Andrew Turner  wrote:
>Author: andrew
>Date: Wed Oct 16 13:21:01 2019
>New Revision: 353640
>URL: https://svnweb.freebsd.org/changeset/base/353640
>
>Log:
>  Stop leaking information from the kernel through timespec
>  
>  The timespec struct holds a seconds value in a time_t and a nanoseconds
>  value in a long. On most architectures these are the same size, however
>  on 32-bit architectures other than i386 time_t is 8 bytes and long is
>  4 bytes.
>  
>  Most ABIs will then pad a struct holding an 8 byte and 4 byte value to
>  16 bytes with 4 bytes of padding. When copying one of these structs the
>  compiler is free to copy the padding if it wishes.

Are there any other structs passed from kernel to userland that include
padding?

-- 
Peter Jeremy


signature.asc
Description: PGP signature


Re: svn commit: r353937 - in head/share: man/man5 mk

2019-10-23 Thread Enji Cooper

> On Oct 23, 2019, at 10:02, Dimitry Andric  wrote:
> 
> Author: dim
> Date: Wed Oct 23 17:02:45 2019
> New Revision: 353937
> URL: https://svnweb.freebsd.org/changeset/base/353937
> 
> Log:
>  Build toolchain components as dynamically linked executables by default
> 
>  Summary:
>  Historically, we have built toolchain components such as cc, ld, etc as
>  statically linked executables.  One of the reasons being that you could
>  sometimes save yourself from botched upgrades, by e.g. recompiling a
>  "known good" libc and reinstalling it.
> 
>  In this day and age, we have boot environments, virtual machine
>  snapshots, cloud backups, and other much more reliable methods to
>  restore systems to working order.  So I think the time is ripe to flip
>  this default, and link the toolchain components dynamically, just like
>  almost all other executables on FreeBSD.
> 
>  Maybe at some point they can even become PIE executables by default! :)

There might be a different reason for this being the case than the one posed.

Using dynamic binaries instead of static binaries might actually regress 
performance in a way you don’t expect, depending on -j values, etc. Static 
binaries avoid the dynamic linker, which (obviously) results in a perf hit at 
scale, at the potential cost of the in-memory image. Static binaries could also 
better optimize away less optimal code paths, which could result in worse 
performing code.

Did you calculate the perf trade offs for the static binaries at low -j vs high 
-j, system and user time, etc?

Cheers,
-Enji

PS Thank you for keeping the SHARED_TOOLCHAIN option.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353958 - head/lib/libthr/arch/amd64/amd64

2019-10-23 Thread Conrad Meyer
Author: cem
Date: Wed Oct 23 18:27:30 2019
New Revision: 353958
URL: https://svnweb.freebsd.org/changeset/base/353958

Log:
  libthr: Add missing END() directive for umtx_op_err (amd64)
  
  Like r353929, related to D22122.  No functional change.
  
  Reviewed by:  emaste, kib (earlier version both)

Modified:
  head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S

Modified: head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S
==
--- head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Wed Oct 23 18:00:22 
2019(r353957)
+++ head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Wed Oct 23 18:27:30 
2019(r353958)
@@ -29,8 +29,11 @@
 #include 
 #include 
 
-#defineRSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err));   \
-   mov __CONCAT($SYS_,x),%rax; KERNCALL; ret; 
+#defineRSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \
+   mov __CONCAT($SYS_,x),%rax; \
+   KERNCALL; \
+   ret; \
+   END(__CONCAT(x, _err));
 
 #define KERNCALL   movq %rcx, %r10; syscall
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353957 - head/sys/vm

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 18:00:22 2019
New Revision: 353957
URL: https://svnweb.freebsd.org/changeset/base/353957

Log:
  Check for bogus_page in vnode_pager_generic_getpages_done().
  
  We now assert that a page is busy when updating its validity-tracking
  state, but bogus_page is not busied during a getpages operation.
  
  Reported by:  syzkaller
  Reviewed by:  alc, kib
  Discussed with:   jeff
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22124

Modified:
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Wed Oct 23 17:58:19 2019(r353956)
+++ head/sys/vm/vnode_pager.c   Wed Oct 23 18:00:22 2019(r353957)
@@ -1149,6 +1149,8 @@ vnode_pager_generic_getpages_done(struct buf *bp)
 
nextoff = tfoff + PAGE_SIZE;
mt = bp->b_pages[i];
+   if (mt == bogus_page)
+   continue;
 
if (nextoff <= object->un_pager.vnp.vnp_size) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353956 - head/sys/vm

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 17:58:19 2019
New Revision: 353956
URL: https://svnweb.freebsd.org/changeset/base/353956

Log:
  Verify identity after checking for WAITFAIL in vm_page_busy_acquire().
  
  A caller that does not guarantee that a page's identity won't change
  while sleeping for a busy lock must specify either NOWAIT or WAITFAIL.
  
  Reported by:  syzkaller
  Reviewed by:  alc, kib
  Discussed with:   jeff
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22124

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Wed Oct 23 17:53:20 2019(r353955)
+++ head/sys/vm/vm_page.c   Wed Oct 23 17:58:19 2019(r353956)
@@ -900,9 +900,11 @@ vm_page_busy_acquire(vm_page_t m, int allocflags)
(allocflags & VM_ALLOC_SBUSY) != 0, locked);
if (locked)
VM_OBJECT_WLOCK(obj);
-   MPASS(m->object == obj || m->object == NULL);
if ((allocflags & VM_ALLOC_WAITFAIL) != 0)
return (FALSE);
+   KASSERT(m->object == obj || m->object == NULL,
+   ("vm_page_busy_acquire: page %p does not belong to %p",
+   m, obj));
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353951 - vendor/lld/lld-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:50 2019
New Revision: 353951
URL: https://svnweb.freebsd.org/changeset/base/353951

Log:
  Tag stripped lld trunk r375505, the last commit before the upstream
  Subversion repository was made read-only, and the LLVM project migrated
  to GitHub.

Added:
  vendor/lld/lld-r375505/
 - copied from r353950, vendor/lld/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353955 - vendor/llvm-openmp/openmp-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:53:20 2019
New Revision: 353955
URL: https://svnweb.freebsd.org/changeset/base/353955

Log:
  Tag stripped LLVM openmp trunk r375505, the last commit before the
  upstream Subversion repository was made read-only, and the LLVM project
  migrated to GitHub.

Added:
  vendor/llvm-openmp/openmp-r375505/
 - copied from r353954, vendor/llvm-openmp/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353954 - in vendor/llvm-openmp/dist/runtime/src: . thirdparty/ittnotify

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:53:14 2019
New Revision: 353954
URL: https://svnweb.freebsd.org/changeset/base/353954

Log:
  Vendor import of stripped LLVM openmp trunk r375505, the last commit
  before the upstream Subversion repository was made read-only, and the
  LLVM project migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/openmp/trunk@375505

Added:
  vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_static.cpp
Deleted:
  vendor/llvm-openmp/dist/runtime/src/kmp_taskq.cpp
  vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_static.c
Modified:
  vendor/llvm-openmp/dist/runtime/src/kmp.h
  vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h
  vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h
  vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_lock.h
  vendor/llvm-openmp/dist/runtime/src/kmp_os.h
  vendor/llvm-openmp/dist/runtime/src/kmp_platform.h
  vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp
  vendor/llvm-openmp/dist/runtime/src/kmp_wait_release.h
  vendor/llvm-openmp/dist/runtime/src/ompt-general.cpp
  vendor/llvm-openmp/dist/runtime/src/ompt-internal.h
  vendor/llvm-openmp/dist/runtime/src/ompt-specific.cpp
  vendor/llvm-openmp/dist/runtime/src/ompt-specific.h
  vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_config.h
  vendor/llvm-openmp/dist/runtime/src/z_Linux_asm.S
  vendor/llvm-openmp/dist/runtime/src/z_Linux_util.cpp

Modified: vendor/llvm-openmp/dist/runtime/src/kmp.h
==
--- vendor/llvm-openmp/dist/runtime/src/kmp.h   Wed Oct 23 17:53:12 2019
(r353953)
+++ vendor/llvm-openmp/dist/runtime/src/kmp.h   Wed Oct 23 17:53:14 2019
(r353954)
@@ -2181,10 +2181,9 @@ struct kmp_dephash_entry {
 typedef struct kmp_dephash {
   kmp_dephash_entry_t **buckets;
   size_t size;
-#ifdef KMP_DEBUG
+  size_t generation;
   kmp_uint32 nelements;
   kmp_uint32 nconflicts;
-#endif
 } kmp_dephash_t;
 
 typedef struct kmp_task_affinity_info {
@@ -3342,7 +3341,7 @@ extern int __kmp_aux_set_affinity_mask_proc(int proc, 
 extern int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask);
 extern int __kmp_aux_get_affinity_mask_proc(int proc, void **mask);
 extern void __kmp_balanced_affinity(kmp_info_t *th, int team_size);
-#if KMP_OS_LINUX
+#if KMP_OS_LINUX || KMP_OS_FREEBSD
 extern int kmp_set_thread_affinity_mask_initial(void);
 #endif
 #endif /* KMP_AFFINITY_SUPPORTED */

Modified: vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp
==
--- vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cppWed Oct 23 
17:53:12 2019(r353953)
+++ vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cppWed Oct 23 
17:53:14 2019(r353954)
@@ -1968,7 +1968,7 @@ static void __kmp_dispatch_set_hierarchy_values() {
   __kmp_hier_max_units[kmp_hier_layer_e::LAYER_THREAD + 1] =
   nPackages * nCoresPerPkg * __kmp_nThreadsPerCore;
   __kmp_hier_max_units[kmp_hier_layer_e::LAYER_L1 + 1] = __kmp_ncores;
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS)
   if (__kmp_mic_type >= mic3)
 __kmp_hier_max_units[kmp_hier_layer_e::LAYER_L2 + 1] = __kmp_ncores / 2;
   else
@@ -1982,7 +1982,7 @@ static void __kmp_dispatch_set_hierarchy_values() {
   __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_THREAD + 1] = 1;
   __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_L1 + 1] =
   __kmp_nThreadsPerCore;
-#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
+#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS)
   if (__kmp_mic_type >= mic3)
 __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_L2 + 1] =
 2 * __kmp_nThreadsPerCore;

Modified: vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h
==
--- vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h  Wed Oct 23 17:53:12 
2019(r353953)
+++ vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h  Wed Oct 23 17:53:14 
2019(r353954)
@@ -160,6 +160,7 @@ class KMPHwlocAffinity : public KMPAffinity { (public)
 };
 #endif /* KMP_USE_HWLOC */
 
+#if KMP_OS_LINUX || KMP_OS_FREEBSD
 #if KMP_OS_LINUX
 /* On some of the older OS's that we build on, these constants aren't present
in  #included from . They must be the same on
@@ -234,6 +235,10 @@ class KMPHwlocAffinity : public KMPAffinity { (public)
 #endif /* __NR_sched_getaffinity */
 #error Unknown or unsupported architecture
 #endif /* 

svn commit: r353953 - vendor/lldb/lldb-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:53:12 2019
New Revision: 353953
URL: https://svnweb.freebsd.org/changeset/base/353953

Log:
  Tag stripped lldb trunk r375505, the last commit before the upstream
  Subversion repository was made read-only, and the LLVM project migrated
  to GitHub.

Added:
  vendor/lldb/lldb-r375505/
 - copied from r353952, vendor/lldb/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353952 - in vendor/lldb/dist: docs include/lldb include/lldb/API include/lldb/Breakpoint include/lldb/Core include/lldb/DataFormatters include/lldb/Expression include/lldb/Host include...

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:53:01 2019
New Revision: 353952
URL: https://svnweb.freebsd.org/changeset/base/353952

Log:
  Vendor import of stripped lldb trunk r375505, the last commit before the
  upstream Subversion repository was made read-only, and the LLVM project
  migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/lldb/trunk@375505

Added:
  vendor/lldb/dist/include/lldb/API/SBFile.h
  vendor/lldb/dist/include/lldb/Core/PropertiesBase.td
  vendor/lldb/dist/include/lldb/Host/LZMA.h
  vendor/lldb/dist/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
  vendor/lldb/dist/include/lldb/Symbol/CallFrameInfo.h
  vendor/lldb/dist/include/lldb/Utility/GDBRemote.h
  vendor/lldb/dist/source/API/SBFile.cpp
  vendor/lldb/dist/source/Core/CoreProperties.td
  vendor/lldb/dist/source/Host/common/LZMA.cpp
  vendor/lldb/dist/source/Interpreter/InterpreterProperties.td
  vendor/lldb/dist/source/Interpreter/OptionGroupPythonClassWithDict.cpp
  vendor/lldb/dist/source/Interpreter/OptionValueFileSpecList.cpp
  vendor/lldb/dist/source/Plugins/ABI/SysV-arc/
  vendor/lldb/dist/source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
  vendor/lldb/dist/source/Plugins/ABI/SysV-arc/ABISysV_arc.h
  vendor/lldb/dist/source/Plugins/ABI/SysV-arc/CMakeLists.txt
  vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
  vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
  
vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
  
vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h
  vendor/lldb/dist/source/Plugins/JITLoader/GDB/JITLoaderGDBProperties.td
  
vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp
  vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_i386.h
  
vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp
  
vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.h
  
vendor/lldb/dist/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td
  
vendor/lldb/dist/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLogProperties.td
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
  vendor/lldb/dist/source/Target/TargetProperties.td
  vendor/lldb/dist/source/Utility/GDBRemote.cpp
  vendor/lldb/dist/utils/TableGen/LLDBPropertyDefEmitter.cpp
  vendor/lldb/dist/utils/TableGen/LLDBTableGenUtils.cpp
  vendor/lldb/dist/utils/TableGen/LLDBTableGenUtils.h
Deleted:
  vendor/lldb/dist/include/lldb/Symbol/VerifyDecl.h
  vendor/lldb/dist/include/lldb/Utility/CleanUp.h
  vendor/lldb/dist/include/lldb/Utility/FileCollector.h
  vendor/lldb/dist/include/lldb/Utility/JSON.h
  vendor/lldb/dist/include/lldb/Utility/StreamGDBRemote.h
  vendor/lldb/dist/source/Commands/CommandObjectBugreport.cpp
  vendor/lldb/dist/source/Commands/CommandObjectBugreport.h
  vendor/lldb/dist/source/Interpreter/OptionValueFileSpecLIst.cpp
  
vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp
  
vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  vendor/lldb/dist/source/Symbol/VerifyDecl.cpp
  vendor/lldb/dist/source/Utility/FileCollector.cpp
  vendor/lldb/dist/source/Utility/JSON.cpp
  vendor/lldb/dist/source/Utility/StreamGDBRemote.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgContext.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgContext.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgSet.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgSet.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValBase.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValBase.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValConsume.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValConsume.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValFile.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValFile.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValListBase.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValListBase.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValListOfN.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValListOfN.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValNumber.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValNumber.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionLong.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionLong.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionShort.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionShort.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValPrintValues.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValPrintValues.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValString.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValString.h
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValThreadGrp.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdArgValThreadGrp.h
  vendor/lldb/dist/tools/lldb-mi/MICmdBase.cpp
  vendor/lldb/dist/tools/lldb-mi/MICmdBase.h
  

svn commit: r353944 - in vendor/compiler-rt/dist: include/fuzzer include/sanitizer lib/asan lib/builtins lib/builtins/aarch64 lib/builtins/arm lib/dfsan lib/fuzzer lib/fuzzer/utils lib/gwp_asan lib...

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:22 2019
New Revision: 353944
URL: https://svnweb.freebsd.org/changeset/base/353944

Log:
  Vendor import of stripped compiler-rt trunk r375505, the last commit
  before the upstream Subversion repository was made read-only, and the
  LLVM project migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/compiler-rt/trunk@375505

Added:
  vendor/compiler-rt/dist/include/fuzzer/
  vendor/compiler-rt/dist/include/fuzzer/FuzzedDataProvider.h
  vendor/compiler-rt/dist/include/sanitizer/ubsan_interface.h
  vendor/compiler-rt/dist/lib/asan/asan_activation.cpp
  vendor/compiler-rt/dist/lib/asan/asan_allocator.cpp
  vendor/compiler-rt/dist/lib/asan/asan_debugging.cpp
  vendor/compiler-rt/dist/lib/asan/asan_descriptions.cpp
  vendor/compiler-rt/dist/lib/asan/asan_errors.cpp
  vendor/compiler-rt/dist/lib/asan/asan_fake_stack.cpp
  vendor/compiler-rt/dist/lib/asan/asan_flags.cpp
  vendor/compiler-rt/dist/lib/asan/asan_fuchsia.cpp
  vendor/compiler-rt/dist/lib/asan/asan_globals.cpp
  vendor/compiler-rt/dist/lib/asan/asan_globals_win.cpp
  vendor/compiler-rt/dist/lib/asan/asan_interceptors.cpp
  vendor/compiler-rt/dist/lib/asan/asan_interceptors_memintrinsics.cpp
  vendor/compiler-rt/dist/lib/asan/asan_linux.cpp
  vendor/compiler-rt/dist/lib/asan/asan_mac.cpp
  vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cpp
  vendor/compiler-rt/dist/lib/asan/asan_malloc_mac.cpp
  vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cpp
  vendor/compiler-rt/dist/lib/asan/asan_memory_profile.cpp
  vendor/compiler-rt/dist/lib/asan/asan_new_delete.cpp
  vendor/compiler-rt/dist/lib/asan/asan_poisoning.cpp
  vendor/compiler-rt/dist/lib/asan/asan_posix.cpp
  vendor/compiler-rt/dist/lib/asan/asan_preinit.cpp
  vendor/compiler-rt/dist/lib/asan/asan_premap_shadow.cpp
  vendor/compiler-rt/dist/lib/asan/asan_report.cpp
  vendor/compiler-rt/dist/lib/asan/asan_rtems.cpp
  vendor/compiler-rt/dist/lib/asan/asan_rtl.cpp
  vendor/compiler-rt/dist/lib/asan/asan_shadow_setup.cpp
  vendor/compiler-rt/dist/lib/asan/asan_stack.cpp
  vendor/compiler-rt/dist/lib/asan/asan_stats.cpp
  vendor/compiler-rt/dist/lib/asan/asan_suppressions.cpp
  vendor/compiler-rt/dist/lib/asan/asan_thread.cpp
  vendor/compiler-rt/dist/lib/asan/asan_win.cpp
  vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cpp
  vendor/compiler-rt/dist/lib/asan/asan_win_dynamic_runtime_thunk.cpp
  vendor/compiler-rt/dist/lib/asan/asan_win_weak_interception.cpp
  vendor/compiler-rt/dist/lib/builtins/aarch64/fp_mode.c
  vendor/compiler-rt/dist/lib/builtins/arm/fp_mode.c
  vendor/compiler-rt/dist/lib/builtins/fp_mode.c
  vendor/compiler-rt/dist/lib/builtins/fp_mode.h
  vendor/compiler-rt/dist/lib/dfsan/dfsan.cpp
  vendor/compiler-rt/dist/lib/dfsan/dfsan_custom.cpp
  vendor/compiler-rt/dist/lib/dfsan/dfsan_interceptors.cpp
  vendor/compiler-rt/dist/lib/gwp_asan/scripts/
  vendor/compiler-rt/dist/lib/gwp_asan/scripts/symbolize.sh   (contents, props 
changed)
  vendor/compiler-rt/dist/lib/gwp_asan/stack_trace_compressor.cpp
  vendor/compiler-rt/dist/lib/gwp_asan/stack_trace_compressor.h
  vendor/compiler-rt/dist/lib/hwasan/hwasan_exceptions.cpp
  vendor/compiler-rt/dist/lib/interception/interception_linux.cpp
  vendor/compiler-rt/dist/lib/interception/interception_mac.cpp
  vendor/compiler-rt/dist/lib/interception/interception_type_test.cpp
  vendor/compiler-rt/dist/lib/interception/interception_win.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_allocator.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_common.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_common_linux.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_common_mac.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_linux.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_mac.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_malloc_mac.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_preinit.cpp
  vendor/compiler-rt/dist/lib/lsan/lsan_thread.cpp
  vendor/compiler-rt/dist/lib/msan/msan.cpp
  vendor/compiler-rt/dist/lib/msan/msan_allocator.cpp
  vendor/compiler-rt/dist/lib/msan/msan_chained_origin_depot.cpp
  vendor/compiler-rt/dist/lib/msan/msan_interceptors.cpp
  vendor/compiler-rt/dist/lib/msan/msan_linux.cpp
  vendor/compiler-rt/dist/lib/msan/msan_new_delete.cpp
  vendor/compiler-rt/dist/lib/msan/msan_poisoning.cpp
  vendor/compiler-rt/dist/lib/msan/msan_report.cpp
  vendor/compiler-rt/dist/lib/msan/msan_thread.cpp
  vendor/compiler-rt/dist/lib/profile/InstrProfilingRuntime.cpp
  vendor/compiler-rt/dist/lib/safestack/safestack.cpp
  vendor/compiler-rt/dist/lib/sanitizer_common/sancov_flags.cpp
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator.cpp
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_checks.cpp
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_report.cpp
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.cpp
  

svn commit: r353947 - vendor/libc++/libc++-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:35 2019
New Revision: 353947
URL: https://svnweb.freebsd.org/changeset/base/353947

Log:
  Tag stripped libc++ trunk r375505, the last commit before the upstream
  Subversion repository was made read-only, and the LLVM project migrated
  to GitHub.

Added:
  vendor/libc++/libc++-r375505/
 - copied from r353946, vendor/libc++/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353946 - in vendor/libc++/dist: include include/experimental include/ext src src/experimental src/filesystem

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:30 2019
New Revision: 353946
URL: https://svnweb.freebsd.org/changeset/base/353946

Log:
  Vendor import of stripped libc++ trunk r375505, the last commit before
  the upstream Subversion repository was made read-only, and the LLVM
  project migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/libcxx/trunk@375505

Added:
  vendor/libc++/dist/include/execution
Modified:
  vendor/libc++/dist/include/__config
  vendor/libc++/dist/include/__functional_base
  vendor/libc++/dist/include/__libcpp_version
  vendor/libc++/dist/include/__locale
  vendor/libc++/dist/include/__mutex_base
  vendor/libc++/dist/include/__split_buffer
  vendor/libc++/dist/include/__string
  vendor/libc++/dist/include/__threading_support
  vendor/libc++/dist/include/__tuple
  vendor/libc++/dist/include/algorithm
  vendor/libc++/dist/include/atomic
  vendor/libc++/dist/include/bit
  vendor/libc++/dist/include/chrono
  vendor/libc++/dist/include/cmath
  vendor/libc++/dist/include/cstdio
  vendor/libc++/dist/include/deque
  vendor/libc++/dist/include/experimental/coroutine
  vendor/libc++/dist/include/ext/hash_map
  vendor/libc++/dist/include/ext/hash_set
  vendor/libc++/dist/include/filesystem
  vendor/libc++/dist/include/fstream
  vendor/libc++/dist/include/functional
  vendor/libc++/dist/include/istream
  vendor/libc++/dist/include/map
  vendor/libc++/dist/include/memory
  vendor/libc++/dist/include/module.modulemap
  vendor/libc++/dist/include/mutex
  vendor/libc++/dist/include/new
  vendor/libc++/dist/include/numeric
  vendor/libc++/dist/include/ostream
  vendor/libc++/dist/include/random
  vendor/libc++/dist/include/regex
  vendor/libc++/dist/include/set
  vendor/libc++/dist/include/string
  vendor/libc++/dist/include/string_view
  vendor/libc++/dist/include/thread
  vendor/libc++/dist/include/tuple
  vendor/libc++/dist/include/type_traits
  vendor/libc++/dist/include/utility
  vendor/libc++/dist/include/vector
  vendor/libc++/dist/src/CMakeLists.txt
  vendor/libc++/dist/src/algorithm.cpp
  vendor/libc++/dist/src/chrono.cpp
  vendor/libc++/dist/src/condition_variable.cpp
  vendor/libc++/dist/src/debug.cpp
  vendor/libc++/dist/src/experimental/memory_resource.cpp
  vendor/libc++/dist/src/filesystem/directory_iterator.cpp
  vendor/libc++/dist/src/filesystem/int128_builtins.cpp
  vendor/libc++/dist/src/filesystem/operations.cpp
  vendor/libc++/dist/src/iostream.cpp
  vendor/libc++/dist/src/memory.cpp
  vendor/libc++/dist/src/mutex.cpp
  vendor/libc++/dist/src/shared_mutex.cpp
  vendor/libc++/dist/src/thread.cpp
  vendor/libc++/dist/src/utility.cpp
  vendor/libc++/dist/src/valarray.cpp

Modified: vendor/libc++/dist/include/__config
==
--- vendor/libc++/dist/include/__config Wed Oct 23 17:52:26 2019
(r353945)
+++ vendor/libc++/dist/include/__config Wed Oct 23 17:52:30 2019
(r353946)
@@ -32,7 +32,7 @@
 #  define _GNUC_VER_NEW 0
 #endif
 
-#define _LIBCPP_VERSION 9000
+#define _LIBCPP_VERSION 1
 
 #ifndef _LIBCPP_ABI_VERSION
 #  define _LIBCPP_ABI_VERSION 1
@@ -183,10 +183,6 @@
 #  define _LIBCPP_COMPILER_IBM
 #endif
 
-#ifndef _LIBCPP_CLANG_VER
-#define _LIBCPP_CLANG_VER 0
-#endif
-
 #if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
 #error "libc++ does not support using GCC with C++03. Please enable C++11"
 #endif
@@ -246,6 +242,7 @@
 
 #ifdef __FreeBSD__
 #  include 
+#  include 
 #  if _BYTE_ORDER == _LITTLE_ENDIAN
 #define _LIBCPP_LITTLE_ENDIAN
 #  else  // _BYTE_ORDER == _LITTLE_ENDIAN
@@ -483,11 +480,14 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
 
-// No apple compilers support ""d and ""y at this time.
-#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__)
-#define_LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
+// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and 
AppleClang 10.0.1
+#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \
+(defined(__apple_build_version__) && __apple_build_version__ < 1001)
+#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
 #endif
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
 #elif defined(_LIBCPP_COMPILER_GCC)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -523,6 +523,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
 #elif defined(_LIBCPP_COMPILER_MSVC)
 
 #define _LIBCPP_TOSTRING2(x) #x
@@ -548,6 +550,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
 #elif defined(_LIBCPP_COMPILER_IBM)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -568,6 +572,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
 
 #if 

svn commit: r353942 - in vendor/clang/dist: include/clang include/clang-c include/clang/AST include/clang/ASTMatchers include/clang/Analysis include/clang/Basic include/clang/CodeGen include/clang/...

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:09 2019
New Revision: 353942
URL: https://svnweb.freebsd.org/changeset/base/353942

Log:
  Vendor import of stripped clang trunk r375505, the last commit before
  the upstream Subversion repository was made read-only, and the LLVM
  project migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/cfe/trunk@375505

Added:
  vendor/clang/dist/include/clang-c/FatalErrorHandler.h
  vendor/clang/dist/include/clang/AST/CXXRecordDeclDefinitionBits.def
  vendor/clang/dist/include/clang/AST/OptionalDiagnostic.h
  vendor/clang/dist/include/clang/Analysis/PathDiagnostic.h
  vendor/clang/dist/include/clang/Basic/AArch64SVEACLETypes.def
  vendor/clang/dist/include/clang/Basic/AttributeCommonInfo.h
  vendor/clang/dist/include/clang/Basic/BuiltinsBPF.def
  vendor/clang/dist/include/clang/Basic/LangStandard.h
  vendor/clang/dist/include/clang/Basic/LangStandards.def
  vendor/clang/dist/include/clang/Basic/TypeNodes.td
  vendor/clang/dist/include/clang/Index/IndexingOptions.h
  
vendor/clang/dist/include/clang/Lex/PreprocessorExcludedConditionalDirectiveSkipMapping.h
  
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicCastInfo.h
  
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h
  
vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
  
vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
  
vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
  
vendor/clang/dist/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h  
 (contents, props changed)
  vendor/clang/dist/include/clang/Tooling/Transformer/
  vendor/clang/dist/include/clang/Tooling/Transformer/MatchConsumer.h
  vendor/clang/dist/include/clang/Tooling/Transformer/RangeSelector.h
  vendor/clang/dist/include/clang/Tooling/Transformer/RewriteRule.h
  vendor/clang/dist/include/clang/Tooling/Transformer/SourceCode.h
  vendor/clang/dist/include/clang/Tooling/Transformer/SourceCodeBuilders.h
  vendor/clang/dist/include/clang/Tooling/Transformer/Stencil.h
  vendor/clang/dist/include/clang/Tooling/Transformer/Transformer.h
  vendor/clang/dist/lib/AST/Interp/
  vendor/clang/dist/lib/AST/Interp/Block.cpp
  vendor/clang/dist/lib/AST/Interp/Block.h
  vendor/clang/dist/lib/AST/Interp/Boolean.h
  vendor/clang/dist/lib/AST/Interp/ByteCodeEmitter.cpp
  vendor/clang/dist/lib/AST/Interp/ByteCodeEmitter.h
  vendor/clang/dist/lib/AST/Interp/ByteCodeExprGen.cpp
  vendor/clang/dist/lib/AST/Interp/ByteCodeExprGen.h
  vendor/clang/dist/lib/AST/Interp/ByteCodeGenError.cpp
  vendor/clang/dist/lib/AST/Interp/ByteCodeGenError.h
  vendor/clang/dist/lib/AST/Interp/ByteCodeStmtGen.cpp
  vendor/clang/dist/lib/AST/Interp/ByteCodeStmtGen.h
  vendor/clang/dist/lib/AST/Interp/Context.cpp
  vendor/clang/dist/lib/AST/Interp/Context.h
  vendor/clang/dist/lib/AST/Interp/Descriptor.cpp
  vendor/clang/dist/lib/AST/Interp/Descriptor.h
  vendor/clang/dist/lib/AST/Interp/Disasm.cpp
  vendor/clang/dist/lib/AST/Interp/EvalEmitter.cpp
  vendor/clang/dist/lib/AST/Interp/EvalEmitter.h
  vendor/clang/dist/lib/AST/Interp/Frame.cpp
  vendor/clang/dist/lib/AST/Interp/Frame.h
  vendor/clang/dist/lib/AST/Interp/Function.cpp
  vendor/clang/dist/lib/AST/Interp/Function.h
  vendor/clang/dist/lib/AST/Interp/Integral.h
  vendor/clang/dist/lib/AST/Interp/Interp.cpp
  vendor/clang/dist/lib/AST/Interp/Interp.h
  vendor/clang/dist/lib/AST/Interp/InterpFrame.cpp
  vendor/clang/dist/lib/AST/Interp/InterpFrame.h
  vendor/clang/dist/lib/AST/Interp/InterpStack.cpp
  vendor/clang/dist/lib/AST/Interp/InterpStack.h
  vendor/clang/dist/lib/AST/Interp/InterpState.cpp
  vendor/clang/dist/lib/AST/Interp/InterpState.h
  vendor/clang/dist/lib/AST/Interp/Opcode.h
  vendor/clang/dist/lib/AST/Interp/Opcodes.td
  vendor/clang/dist/lib/AST/Interp/Pointer.cpp
  vendor/clang/dist/lib/AST/Interp/Pointer.h
  vendor/clang/dist/lib/AST/Interp/PrimType.cpp
  vendor/clang/dist/lib/AST/Interp/PrimType.h
  vendor/clang/dist/lib/AST/Interp/Program.cpp
  vendor/clang/dist/lib/AST/Interp/Program.h
  vendor/clang/dist/lib/AST/Interp/Record.cpp
  vendor/clang/dist/lib/AST/Interp/Record.h
  vendor/clang/dist/lib/AST/Interp/Source.cpp
  vendor/clang/dist/lib/AST/Interp/Source.h
  vendor/clang/dist/lib/AST/Interp/State.cpp
  vendor/clang/dist/lib/AST/Interp/State.h
  vendor/clang/dist/lib/Analysis/PathDiagnostic.cpp
  vendor/clang/dist/lib/Basic/LangStandards.cpp
  vendor/clang/dist/lib/Basic/Stack.cpp
  vendor/clang/dist/lib/DirectoryWatcher/windows/
  vendor/clang/dist/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp
  vendor/clang/dist/lib/Driver/ToolChains/InterfaceStubs.cpp
  vendor/clang/dist/lib/Driver/ToolChains/InterfaceStubs.h
  vendor/clang/dist/lib/Headers/ppc_wrappers/pmmintrin.h
  vendor/clang/dist/lib/Headers/ppc_wrappers/smmintrin.h
  vendor/clang/dist/lib/Headers/ppc_wrappers/tmmintrin.h
  vendor/clang/dist/lib/Sema/SemaConcept.cpp
  

svn commit: r353945 - vendor/compiler-rt/compiler-rt-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:26 2019
New Revision: 353945
URL: https://svnweb.freebsd.org/changeset/base/353945

Log:
  Tag stripped compiler-rt trunk r375505, the last commit before the
  upstream Subversion repository was made read-only, and the LLVM project
  migrated to GitHub.

Added:
  vendor/compiler-rt/compiler-rt-r375505/
 - copied from r353944, vendor/compiler-rt/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353949 - vendor/llvm-libunwind/libunwind-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:41 2019
New Revision: 353949
URL: https://svnweb.freebsd.org/changeset/base/353949

Log:
  Tag stripped LLVM libunwind trunk r375505, the last commit before the
  upstream Subversion repository was made read-only, and the LLVM project
  migrated to GitHub.

Added:
  vendor/llvm-libunwind/libunwind-r375505/
 - copied from r353948, vendor/llvm-libunwind/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353948 - vendor/llvm-libunwind/dist/src

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:37 2019
New Revision: 353948
URL: https://svnweb.freebsd.org/changeset/base/353948

Log:
  Vendor import of stripped LLVM libunwind trunk r375505, the last commit
  before the upstream Subversion repository was made read-only, and the
  LLVM project migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/libunwind/trunk@375505

Modified:
  vendor/llvm-libunwind/dist/src/AddressSpace.hpp
  vendor/llvm-libunwind/dist/src/RWMutex.hpp
  vendor/llvm-libunwind/dist/src/Unwind-EHABI.cpp
  vendor/llvm-libunwind/dist/src/UnwindCursor.hpp
  vendor/llvm-libunwind/dist/src/libunwind.cpp

Modified: vendor/llvm-libunwind/dist/src/AddressSpace.hpp
==
--- vendor/llvm-libunwind/dist/src/AddressSpace.hpp Wed Oct 23 17:52:35 
2019(r353947)
+++ vendor/llvm-libunwind/dist/src/AddressSpace.hpp Wed Oct 23 17:52:37 
2019(r353948)
@@ -27,11 +27,18 @@
 
 #if _LIBUNWIND_USE_DLADDR
 #include 
-#if defined(__unix__) &&  defined(__ELF__) && 
defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA)
+#if defined(__unix__) && defined(__ELF__) && 
defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA)
 #pragma comment(lib, "dl")
 #endif
 #endif
 
+#if defined(_LIBUNWIND_ARM_EHABI)
+struct EHABIIndexEntry {
+  uint32_t functionOffset;
+  uint32_t data;
+};
+#endif
+
 #ifdef __APPLE__
 #include 
 namespace libunwind {
@@ -462,12 +469,13 @@ inline bool LocalAddressSpace::findUnwindSections(pint
   (void)targetAddr;
   (void)info;
   return true;
-#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) &&  
\
-(__ANDROID_API__ < 21)
+#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__)
+  // For ARM EHABI, Bionic didn't implement dl_iterate_phdr until API 21. After
+  // API 21, dl_iterate_phdr exists, but dl_unwind_find_exidx is much faster.
   int length = 0;
   info.arm_section =
   (uintptr_t)dl_unwind_find_exidx((_Unwind_Ptr)targetAddr, );
-  info.arm_section_length = (uintptr_t)length;
+  info.arm_section_length = (uintptr_t)length * sizeof(EHABIIndexEntry);
   if (info.arm_section && info.arm_section_length)
 return true;
 #elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
@@ -497,32 +505,40 @@ inline bool LocalAddressSpace::findUnwindSections(pint
 #if !defined(Elf_Phdr)
 typedef ElfW(Phdr) Elf_Phdr;
 #endif
-#if !defined(Elf_Addr) && defined(__ANDROID__)
+#if !defined(Elf_Addr)
 typedef ElfW(Addr) Elf_Addr;
 #endif
 
+Elf_Addr image_base = pinfo->dlpi_addr;
+
+#if defined(__ANDROID__) && __ANDROID_API__ < 18
+if (image_base == 0) {
+  // Normally, an image base of 0 indicates a non-PIE executable. On
+  // versions of Android prior to API 18, the dynamic linker reported a
+  // dlpi_addr of 0 for PIE executables. Compute the true image base
+  // using the PT_PHDR segment.
+  // See https://github.com/android/ndk/issues/505.
+  for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
+const Elf_Phdr *phdr = >dlpi_phdr[i];
+if (phdr->p_type == PT_PHDR) {
+  image_base = reinterpret_cast(pinfo->dlpi_phdr) -
+  phdr->p_vaddr;
+  break;
+}
+  }
+}
+#endif
+
  #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
   #if !defined(_LIBUNWIND_SUPPORT_DWARF_INDEX)
#error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires 
_LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
   #endif
 size_t object_length;
-#if defined(__ANDROID__)
-Elf_Addr image_base =
-pinfo->dlpi_phnum
-? reinterpret_cast(pinfo->dlpi_phdr) -
-  reinterpret_cast(pinfo->dlpi_phdr)
-  ->p_offset
-: 0;
-#endif
 
 for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
   const Elf_Phdr *phdr = >dlpi_phdr[i];
   if (phdr->p_type == PT_LOAD) {
-uintptr_t begin = pinfo->dlpi_addr + phdr->p_vaddr;
-#if defined(__ANDROID__)
-if (pinfo->dlpi_addr == 0 && phdr->p_vaddr < image_base)
-  begin = begin + image_base;
-#endif
+uintptr_t begin = image_base + phdr->p_vaddr;
 uintptr_t end = begin + phdr->p_memsz;
 if (cbdata->targetAddr >= begin && cbdata->targetAddr < end) {
   cbdata->sects->dso_base = begin;
@@ -531,11 +547,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint
 }
   } else if (phdr->p_type == PT_GNU_EH_FRAME) {
 EHHeaderParser::EHHeaderInfo hdrInfo;
-uintptr_t eh_frame_hdr_start = pinfo->dlpi_addr + phdr->p_vaddr;
-#if defined(__ANDROID__)
-if (pinfo->dlpi_addr == 0 && phdr->p_vaddr < image_base)
-  eh_frame_hdr_start = eh_frame_hdr_start + image_base;
-#endif
+uintptr_t eh_frame_hdr_start = image_base + phdr->p_vaddr;
 

svn commit: r353950 - in vendor/lld/dist: . COFF Common ELF ELF/Arch docs include/lld/Common include/lld/Core include/lld/ReaderWriter lib/Driver lib/ReaderWriter lib/ReaderWriter/MachO lib/ReaderW...

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:45 2019
New Revision: 353950
URL: https://svnweb.freebsd.org/changeset/base/353950

Log:
  Vendor import of stripped lld trunk r375505, the last commit before the
  upstream Subversion repository was made read-only, and the LLVM project
  migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/lld/trunk@375505

Added:
  vendor/lld/dist/Common/DWARF.cpp
  vendor/lld/dist/ELF/ARMErrataFix.cpp
  vendor/lld/dist/ELF/ARMErrataFix.h
  vendor/lld/dist/include/lld/Common/DWARF.h
Modified:
  vendor/lld/dist/CMakeLists.txt
  vendor/lld/dist/COFF/CMakeLists.txt
  vendor/lld/dist/COFF/Config.h
  vendor/lld/dist/COFF/DLL.cpp
  vendor/lld/dist/COFF/DebugTypes.cpp
  vendor/lld/dist/COFF/Driver.cpp
  vendor/lld/dist/COFF/Driver.h
  vendor/lld/dist/COFF/DriverUtils.cpp
  vendor/lld/dist/COFF/ICF.cpp
  vendor/lld/dist/COFF/InputFiles.cpp
  vendor/lld/dist/COFF/InputFiles.h
  vendor/lld/dist/COFF/LTO.cpp
  vendor/lld/dist/COFF/MapFile.cpp
  vendor/lld/dist/COFF/MinGW.cpp
  vendor/lld/dist/COFF/Options.td
  vendor/lld/dist/COFF/PDB.cpp
  vendor/lld/dist/COFF/PDB.h
  vendor/lld/dist/COFF/SymbolTable.cpp
  vendor/lld/dist/COFF/SymbolTable.h
  vendor/lld/dist/COFF/Symbols.cpp
  vendor/lld/dist/COFF/Symbols.h
  vendor/lld/dist/COFF/Writer.cpp
  vendor/lld/dist/Common/CMakeLists.txt
  vendor/lld/dist/Common/ErrorHandler.cpp
  vendor/lld/dist/Common/Strings.cpp
  vendor/lld/dist/Common/TargetOptionsCommandFlags.cpp
  vendor/lld/dist/ELF/AArch64ErrataFix.cpp
  vendor/lld/dist/ELF/Arch/AArch64.cpp
  vendor/lld/dist/ELF/Arch/AMDGPU.cpp
  vendor/lld/dist/ELF/Arch/ARM.cpp
  vendor/lld/dist/ELF/Arch/AVR.cpp
  vendor/lld/dist/ELF/Arch/Hexagon.cpp
  vendor/lld/dist/ELF/Arch/MSP430.cpp
  vendor/lld/dist/ELF/Arch/Mips.cpp
  vendor/lld/dist/ELF/Arch/MipsArchTree.cpp
  vendor/lld/dist/ELF/Arch/PPC.cpp
  vendor/lld/dist/ELF/Arch/PPC64.cpp
  vendor/lld/dist/ELF/Arch/RISCV.cpp
  vendor/lld/dist/ELF/Arch/SPARCV9.cpp
  vendor/lld/dist/ELF/Arch/X86.cpp
  vendor/lld/dist/ELF/Arch/X86_64.cpp
  vendor/lld/dist/ELF/CMakeLists.txt
  vendor/lld/dist/ELF/CallGraphSort.cpp
  vendor/lld/dist/ELF/Config.h
  vendor/lld/dist/ELF/DWARF.cpp
  vendor/lld/dist/ELF/DWARF.h
  vendor/lld/dist/ELF/Driver.cpp
  vendor/lld/dist/ELF/DriverUtils.cpp
  vendor/lld/dist/ELF/EhFrame.cpp
  vendor/lld/dist/ELF/ICF.cpp
  vendor/lld/dist/ELF/InputFiles.cpp
  vendor/lld/dist/ELF/InputFiles.h
  vendor/lld/dist/ELF/InputSection.cpp
  vendor/lld/dist/ELF/InputSection.h
  vendor/lld/dist/ELF/LTO.cpp
  vendor/lld/dist/ELF/LinkerScript.cpp
  vendor/lld/dist/ELF/LinkerScript.h
  vendor/lld/dist/ELF/MapFile.cpp
  vendor/lld/dist/ELF/MarkLive.cpp
  vendor/lld/dist/ELF/Options.td
  vendor/lld/dist/ELF/OutputSections.cpp
  vendor/lld/dist/ELF/OutputSections.h
  vendor/lld/dist/ELF/Relocations.cpp
  vendor/lld/dist/ELF/Relocations.h
  vendor/lld/dist/ELF/ScriptLexer.cpp
  vendor/lld/dist/ELF/ScriptParser.cpp
  vendor/lld/dist/ELF/SymbolTable.cpp
  vendor/lld/dist/ELF/SymbolTable.h
  vendor/lld/dist/ELF/Symbols.cpp
  vendor/lld/dist/ELF/Symbols.h
  vendor/lld/dist/ELF/SyntheticSections.cpp
  vendor/lld/dist/ELF/SyntheticSections.h
  vendor/lld/dist/ELF/Target.cpp
  vendor/lld/dist/ELF/Writer.cpp
  vendor/lld/dist/ELF/Writer.h
  vendor/lld/dist/docs/ReleaseNotes.rst
  vendor/lld/dist/docs/WebAssembly.rst
  vendor/lld/dist/docs/conf.py
  vendor/lld/dist/docs/ld.lld.1
  vendor/lld/dist/include/lld/Common/ErrorHandler.h
  vendor/lld/dist/include/lld/Common/LLVM.h
  vendor/lld/dist/include/lld/Common/Strings.h
  vendor/lld/dist/include/lld/Common/TargetOptionsCommandFlags.h
  vendor/lld/dist/include/lld/Core/File.h
  vendor/lld/dist/include/lld/ReaderWriter/MachOLinkingContext.h
  vendor/lld/dist/lib/Driver/DarwinLdDriver.cpp
  vendor/lld/dist/lib/ReaderWriter/FileArchive.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/DebugInfo.h
  vendor/lld/dist/lib/ReaderWriter/MachO/GOTPass.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/LayoutPass.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/ObjCPass.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/ShimPass.cpp
  vendor/lld/dist/lib/ReaderWriter/MachO/TLVPass.cpp
  vendor/lld/dist/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  vendor/lld/dist/tools/lld/lld.cpp

Modified: vendor/lld/dist/CMakeLists.txt
==
--- vendor/lld/dist/CMakeLists.txt  Wed Oct 23 17:52:41 2019
(r353949)
+++ vendor/lld/dist/CMakeLists.txt  Wed Oct 23 17:52:45 2019
(r353950)
@@ -56,7 +56,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   

svn commit: r353943 - vendor/clang/clang-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:52:16 2019
New Revision: 353943
URL: https://svnweb.freebsd.org/changeset/base/353943

Log:
  Tag stripped clang trunk r375505, the last commit before the upstream
  Subversion repository was made read-only, and the LLVM project migrated
  to GitHub.

Added:
  vendor/clang/clang-r375505/
 - copied from r353942, vendor/clang/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353941 - vendor/llvm/llvm-r375505

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:51:52 2019
New Revision: 353941
URL: https://svnweb.freebsd.org/changeset/base/353941

Log:
  Tag stripped llvm trunk r375505, the last commit before the upstream
  Subversion repository was made read-only, and the LLVM project migrated
  to GitHub.

Added:
  vendor/llvm/llvm-r375505/
 - copied from r353940, vendor/llvm/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353939 - stable/11/usr.bin/rpcgen

2019-10-23 Thread Brooks Davis
Author: brooks
Date: Wed Oct 23 17:28:35 2019
New Revision: 353939
URL: https://svnweb.freebsd.org/changeset/base/353939

Log:
  MFC r353569:
  
  rpcgen: make compiler arglist allocation dynamic
  
  Limit argmax to an absurdly large value prevent overflow (no overflow
  possible on FreeBSD due to ARG_MAX).
  
  In CheriBSD we exceed the 19 non-NULL arguments in the static array.  Add
  a simple size doubling allocator and increase the default to 32.
  
  GC remnants of support for fixed arguments.
  
  Reviewed by:  archardson (prior version), James Clarke (prior version)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D21971

Modified:
  stable/11/usr.bin/rpcgen/rpc_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/rpcgen/rpc_main.c
==
--- stable/11/usr.bin/rpcgen/rpc_main.c Wed Oct 23 17:20:20 2019
(r353938)
+++ stable/11/usr.bin/rpcgen/rpc_main.c Wed Oct 23 17:28:35 2019
(r353939)
@@ -93,19 +93,13 @@ static int allnc = nitems(allnv);
  */
 static void addarg(const char *);  /* add another argument to the list */
 static void insarg(int, const char *); /* insert arg at specified location */
-static void clear_args(void);  /* clear argument list */
 static void checkfiles(const char *, const char *);
/* check if out file already exists */
 
+static char **arglist;
+static int argcount = 0;
+static int argmax = 0;
 
-
-#defineARGLISTLEN  20
-#defineFIXEDARGS   0
-
-static char *arglist[ARGLISTLEN];
-static int argcount = FIXEDARGS;
-
-
 int nonfatalerrors;/* errors */
 int inetdflag = 0; /* Support for inetd is disabled by default, use -I */
 int pmflag = 0;/* Support for port monitors is disabled by 
default */
@@ -141,7 +135,6 @@ main(int argc, const char *argv[])
struct commandline cmd;
 
(void) memset((char *), 0, sizeof (struct commandline));
-   clear_args();
if (!parseargs(argc, argv, ))
usage();
/*
@@ -273,16 +266,6 @@ add_warning(void)
f_print(fout, " */\n\n");
 }
 
-/* clear list of arguments */
-static void
-clear_args(void)
-{
-   int i;
-   for (i = FIXEDARGS; i < ARGLISTLEN; i++)
-   arglist[i] = NULL;
-   argcount = FIXEDARGS;
-}
-
 /* prepend C-preprocessor and flags before arguments */
 static void
 prepend_cpp(void)
@@ -921,21 +904,40 @@ do_registers(int argc, const char *argv[])
 }
 
 /*
- * Add another argument to the arg list
+ * Extend the argument list
  */
 static void
-addarg(const char *cp)
+moreargs(void)
 {
-   if (argcount >= ARGLISTLEN) {
-   warnx("too many defines");
+   char **newarglist;
+
+   argmax = argmax == 0 ? 32 : argmax << 1;
+   if (argmax > INT_MAX / 4) {
+   warnx("refusing to allocate too many arguments");
crash();
-   /*NOTREACHED*/
}
+   newarglist = realloc(arglist, argmax * sizeof(*arglist));
+   if (newarglist == NULL) {
+   warnx("unable to allocate arglist");
+   crash();
+   }
+   free(arglist);
+   arglist = newarglist;
+}
+
+/*
+ * Add another argument to the arg list
+ */
+static void
+addarg(const char *cp)
+{
+   if (argcount >= argmax)
+   moreargs();
+
if (cp != NULL)
arglist[argcount++] = xstrdup(cp);
else
arglist[argcount++] = NULL;
-
 }
 
 /*
@@ -946,11 +948,8 @@ insarg(int place, const char *cp)
 {
int i;
 
-   if (argcount >= ARGLISTLEN) {
-   warnx("too many defines");
-   crash();
-   /*NOTREACHED*/
-   }
+   if (argcount >= argmax)
+   moreargs();
 
/* Move up existing arguments */
for (i = argcount - 1; i >= place; i--)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353938 - head/sys/compat/linuxkpi/common/src

2019-10-23 Thread Ryan Stone
Author: rstone
Date: Wed Oct 23 17:20:20 2019
New Revision: 353938
URL: https://svnweb.freebsd.org/changeset/base/353938

Log:
  Add missing M_NOWAIT flag
  
  The LinuxKPI linux_dma code calls PCTRIE_INSERT with a
  mutex held, but does not set M_NOWAIT when allocating
  nodes, leading to a potential panic.  All of this code
  can handle an allocation failure here, so prefer an
  allocation failure to sleeping on memory.
  
  Also fix a related case where NOWAIT/WAITOK was not
  specified.  In this case it's not clear whether sleeping
  is allowed so be conservative and assume not.  There are
  a lot of other paths in this code that can fail due to
  a lack of memory anyway.
  
  Differential Revision: https://reviews.freebsd.org/D22127
  Reviewed by: imp
  Sponsored by: Dell EMC Isilon
  MFC After: 1 week

Modified:
  head/sys/compat/linuxkpi/common/src/linux_pci.c

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Oct 23 17:02:45 
2019(r353937)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Oct 23 17:20:20 
2019(r353938)
@@ -500,7 +500,7 @@ static void *
 linux_dma_trie_alloc(struct pctrie *ptree)
 {
 
-   return (uma_zalloc(linux_dma_trie_zone, 0));
+   return (uma_zalloc(linux_dma_trie_zone, M_NOWAIT));
 }
 
 static void
@@ -569,7 +569,10 @@ linux_dma_map_phys(struct device *dev, vm_paddr_t phys
if (bus_dma_id_mapped(priv->dmat, phys, len))
return (phys);
 
-   obj = uma_zalloc(linux_dma_obj_zone, 0);
+   obj = uma_zalloc(linux_dma_obj_zone, M_NOWAIT);
+   if (obj == NULL) {
+   return (0);
+   }
 
DMA_PRIV_LOCK(priv);
if (bus_dmamap_create(priv->dmat, 0, >dmamap) != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353937 - in head/share: man/man5 mk

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 17:02:45 2019
New Revision: 353937
URL: https://svnweb.freebsd.org/changeset/base/353937

Log:
  Build toolchain components as dynamically linked executables by default
  
  Summary:
  Historically, we have built toolchain components such as cc, ld, etc as
  statically linked executables.  One of the reasons being that you could
  sometimes save yourself from botched upgrades, by e.g. recompiling a
  "known good" libc and reinstalling it.
  
  In this day and age, we have boot environments, virtual machine
  snapshots, cloud backups, and other much more reliable methods to
  restore systems to working order.  So I think the time is ripe to flip
  this default, and link the toolchain components dynamically, just like
  almost all other executables on FreeBSD.
  
  Maybe at some point they can even become PIE executables by default! :)
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision: https://reviews.freebsd.org/D22061

Modified:
  head/share/man/man5/src.conf.5
  head/share/mk/src.opts.mk

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Wed Oct 23 16:57:11 2019
(r353936)
+++ head/share/man/man5/src.conf.5  Wed Oct 23 17:02:45 2019
(r353937)
@@ -1710,8 +1710,8 @@ as a set-user-ID root program.
 Set to not build the
 .Bx 4.4
 legacy docs.
-.It Va WITH_SHARED_TOOLCHAIN
-Set to build the toolchain binaries as dynamically linked executables.
+.It Va WITHOUT_SHARED_TOOLCHAIN
+Set to build the toolchain binaries as statically linked executables.
 The set includes
 .Xr cc 1 ,
 .Xr make 1

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed Oct 23 16:57:11 2019(r353936)
+++ head/share/mk/src.opts.mk   Wed Oct 23 17:02:45 2019(r353937)
@@ -166,6 +166,7 @@ __DEFAULT_YES_OPTIONS = \
 SENDMAIL \
 SERVICESDB \
 SETUID_LOGIN \
+SHARED_TOOLCHAIN \
 SHAREDOCS \
 SOURCELESS \
 SOURCELESS_HOST \
@@ -210,7 +211,6 @@ __DEFAULT_NO_OPTIONS = \
 OPENLDAP \
 REPRODUCIBLE_BUILD \
 RPCBIND_WARMSTART_SUPPORT \
-SHARED_TOOLCHAIN \
 SORT_THREADS \
 SVN \
 ZONEINFO_LEAPSECONDS_SUPPORT \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 16:57:11 2019
New Revision: 353936
URL: https://svnweb.freebsd.org/changeset/base/353936

Log:
  Bump clang's default target CPU for the i386 architecture (aka "x86") to
  i686, as per the discussion on the freebsd-arch mailing list.  Earlier
  in r352030, I had already bumped it to i586, to work around missing
  atomic 64 bit functions for the i386 architecture.
  
  Relnotes: yes

Modified:
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp

Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp
==
--- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cppWed Oct 
23 16:53:37 2019(r353935)
+++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cppWed Oct 
23 16:57:11 2019(r353936)
@@ -93,10 +93,11 @@ const char *x86::getX86TargetCPU(const ArgList ,
 return "x86-64";
 
   switch (Triple.getOS()) {
+  case llvm::Triple::FreeBSD:
+return "i686";
   case llvm::Triple::NetBSD:
   case llvm::Triple::OpenBSD:
-return "i486"; 
-  case llvm::Triple::FreeBSD:
+return "i486";
   case llvm::Triple::Haiku:
 return "i586";
   default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353935 - head/sys/dev/ksyms

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 16:53:37 2019
New Revision: 353935
URL: https://svnweb.freebsd.org/changeset/base/353935

Log:
  Set OBJ_NOSPLIT on the ksyms(4) VM object.
  
  The object does not provide anonymous memory.
  
  Reported by:  kib
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22123

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

Modified: head/sys/dev/ksyms/ksyms.c
==
--- head/sys/dev/ksyms/ksyms.c  Wed Oct 23 16:48:22 2019(r353934)
+++ head/sys/dev/ksyms/ksyms.c  Wed Oct 23 16:53:37 2019(r353935)
@@ -404,6 +404,7 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus
 {
struct tsizes ts;
struct ksyms_softc *sc;
+   vm_object_t object;
vm_size_t elfsz;
int error, try;
 
@@ -441,8 +442,10 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus
ksyms_size_calc();
elfsz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz;
 
-   sc->sc_obj = vm_object_allocate(OBJT_DEFAULT,
+   object = vm_object_allocate(OBJT_DEFAULT,
OFF_TO_IDX(round_page(elfsz)));
+   vm_object_set_flag(object, OBJ_NOSPLIT);
+   sc->sc_obj = object;
sc->sc_objsz = elfsz;
 
error = ksyms_snapshot(sc, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353933 - in head: share/man/man5 tools/build/options

2019-10-23 Thread Dimitry Andric
Author: dim
Date: Wed Oct 23 16:48:17 2019
New Revision: 353933
URL: https://svnweb.freebsd.org/changeset/base/353933

Log:
  Slightly expand description of WITH_SHARED_TOOLCHAIN, add a
  corresponding WITHOUT_SHARED_TOOLCHAIN description, and regenerate
  src.conf(5).
  
  MFC after: 3 days

Added:
  head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN   (contents, props changed)
Modified:
  head/share/man/man5/src.conf.5
  head/tools/build/options/WITH_SHARED_TOOLCHAIN

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Wed Oct 23 16:43:51 2019
(r353932)
+++ head/share/man/man5/src.conf.5  Wed Oct 23 16:48:17 2019
(r353933)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd October 1, 2019
+.Dd October 23, 2019
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -197,7 +197,7 @@ as part
 of the normal system build.
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, 
powerpc/powerpcspe and sparc64/sparc64.
+amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf and sparc64/sparc64.
 .It Va WITHOUT_BINUTILS_BOOTSTRAP
 Set to not build binutils (as, ld, and objdump)
 as part of the bootstrap process.
@@ -213,7 +213,7 @@ Set build binutils (as, ld, and objdump)
 as part of the bootstrap process.
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, 
powerpc/powerpcspe and sparc64/sparc64.
+amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf and sparc64/sparc64.
 .It Va WITHOUT_BLACKLIST
 Set this if you do not want to build
 .Xr blacklistd 8
@@ -268,7 +268,7 @@ and
 .Pa crtend.o .
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64.
+amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, 
riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, 
mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
 .It Va WITH_BSD_GREP
 Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
 .It Va WITHOUT_BSNMP
@@ -301,6 +301,9 @@ When set, it enforces these options:
 .It
 .Va WITHOUT_CASPER
 .El
+.It Va WITHOUT_CAROOT
+Set to not add the trusted certificates from the Mozilla NSS bundle to
+base.
 .It Va WITHOUT_CASPER
 Set to not build Casper program and related libraries.
 .It Va WITH_CCACHE_BUILD
@@ -410,7 +413,7 @@ is set explicitly)
 Set to build the Clang C/C++ compiler during the normal phase of the build.
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64 and powerpc/powerpcspe.
+amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
 .It Va WITHOUT_CLANG_BOOTSTRAP
 Set to not build the Clang C/C++ compiler during the bootstrap phase of
 the build.
@@ -418,7 +421,7 @@ To be able to build the system, either gcc or clang bo
 enabled unless an alternate compiler is provided via XCC.
 .Pp
 This is a default setting on
-mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64.
+riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, 
mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and 
sparc64/sparc64.
 .It Va WITH_CLANG_BOOTSTRAP
 Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
 .Pp
@@ -438,7 +441,7 @@ Set to build the ARCMigrate, Rewriter and StaticAnalyz
 Clang C/C++ compiler.
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, 

svn commit: r353934 - head/sys/net

2019-10-23 Thread Conrad Meyer
Author: cem
Date: Wed Oct 23 16:48:22 2019
New Revision: 353934
URL: https://svnweb.freebsd.org/changeset/base/353934

Log:
  Prevent a panic when a driver provides bogus debugnet parameters
  
  This is just a bandaid; we should fix the driver(s) too.  Introduced in
  r353685.
  
  PR:   241403
  X-MFC-With:   r353685
  Reported by:  np and others

Modified:
  head/sys/net/debugnet.c

Modified: head/sys/net/debugnet.c
==
--- head/sys/net/debugnet.c Wed Oct 23 16:48:17 2019(r353933)
+++ head/sys/net/debugnet.c Wed Oct 23 16:48:22 2019(r353934)
@@ -826,6 +826,15 @@ debugnet_any_ifnet_update(struct ifnet *ifp)
nmbuf = ncl * (4 + nrxr);
ncl *= nrxr;
 
+   /*
+* Bandaid for drivers that (incorrectly) advertise LinkUp before their
+* dn_init method is available.
+*/
+   if (nmbuf == 0 || ncl == 0 || clsize == 0) {
+   printf("%s: Bad dn_init result from %s (ifp %p), ignoring.\n",
+   __func__, if_name(ifp), ifp);
+   return;
+   }
dn_maybe_reinit_mbufs(nmbuf, ncl, clsize);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353932 - head

2019-10-23 Thread John Baldwin
Author: jhb
Date: Wed Oct 23 16:43:51 2019
New Revision: 353932
URL: https://svnweb.freebsd.org/changeset/base/353932

Log:
  Strip "sf" suffix when generating a target triple.
  
  This fixes the target triple used when compiling riscv64sf with clang.
  
  Discussed with:   mhorne
  MFC after:2 weeks
  Sponsored by: DARPA

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Oct 23 16:41:31 2019(r353931)
+++ head/Makefile.inc1  Wed Oct 23 16:43:51 2019(r353932)
@@ -129,9 +129,9 @@ TARGET_ABI= gnueabi
 .endif
 .endif
 MACHINE_ABI?=  unknown
-MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0
+MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0
 TARGET_ABI?=   unknown
-TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0
+TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0
 KNOWN_ARCHES?= aarch64/arm64 \
amd64 \
arm \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353931 - head/sys/riscv/include

2019-10-23 Thread John Baldwin
Author: jhb
Date: Wed Oct 23 16:41:31 2019
New Revision: 353931
URL: https://svnweb.freebsd.org/changeset/base/353931

Log:
  Fix atomic_*cmpset32 on riscv64 with clang.
  
  The lr.w instruction used to read the value from memory sign-extends
  the value read from memory.  GCC sign-extends the 32-bit comparison
  value passed in whereas clang currently does not.  As a result, if the
  value being compared has the MSB set, the comparison fails for
  matching 32-bit values when compiled with clang.
  
  Use a cast to explicitly sign-extend the unsigned comparison value.
  This works with both GCC and clang.
  
  There is commentary in the RISC-V spec that suggests that GCC's
  approach is more correct, but it is not clear if the commentary in the
  RISC-V spec is binding.
  
  Reviewed by:  mhorne
  Obtained from:Axiado
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D22084

Modified:
  head/sys/riscv/include/atomic.h

Modified: head/sys/riscv/include/atomic.h
==
--- head/sys/riscv/include/atomic.h Wed Oct 23 16:06:47 2019
(r353930)
+++ head/sys/riscv/include/atomic.h Wed Oct 23 16:41:31 2019
(r353931)
@@ -182,7 +182,7 @@ atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval
"bnez %1, 0b\n"
"1:"
: "=" (tmp), "=" (res), "+A" (*p)
-   : "rJ" (cmpval), "rJ" (newval)
+   : "rJ" ((long)(int32_t)cmpval), "rJ" (newval)
: "memory");
 
return (!res);
@@ -207,7 +207,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpv
"sw   %0, %3\n" /* Save old value */
"2:"
: "=" (tmp), "=" (res), "+A" (*p), "+A" (*cmpval)
-   : "rJ" (*cmpval), "rJ" (newval)
+   : "rJ" ((long)(int32_t)*cmpval), "rJ" (newval)
: "memory");
 
return (!res);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r353907 - head

2019-10-23 Thread John Baldwin
On 10/22/19 5:05 PM, Jung-uk Kim wrote:
> Author: jkim
> Date: Wed Oct 23 00:05:29 2019
> New Revision: 353907
> URL: https://svnweb.freebsd.org/changeset/base/353907
> 
> Log:
>   Belatedly remove stale debug symbols after r339270.
>   
>   Reported by:danfe
>   MFC after:  3 days

I still feel like these explicit entries shouldn't be needed
since the original .so files are marked as OLD_LIBS and we
add .debug entries for OLD_LIBS automatically.

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


svn commit: r353930 - head/sys/kern

2019-10-23 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 23 16:06:47 2019
New Revision: 353930
URL: https://svnweb.freebsd.org/changeset/base/353930

Log:
  Fix undefined behavior.
  
  Create a sequence point by ending a full expression for call to
  vspace() and use of the globals which are modified by vspace().
  
  Reported and reviewed by: imp
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D22126

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Oct 23 16:05:52 2019(r353929)
+++ head/sys/kern/vfs_subr.cWed Oct 23 16:06:47 2019(r353930)
@@ -1273,7 +1273,7 @@ vnlru_proc(void)
 {
struct mount *mp, *nmp;
unsigned long onumvnodes;
-   int done, force, trigger, usevnodes;
+   int done, force, trigger, usevnodes, vsp;
bool reclaim_nc_src;
 
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
@@ -1301,7 +1301,8 @@ vnlru_proc(void)
force = 1;
vstir = 0;
}
-   if (vspace() >= vlowat && force == 0) {
+   vsp = vspace();
+   if (vsp >= vlowat && force == 0) {
vnlruproc_sig = 0;
wakeup(_sig);
msleep(vnlruproc, _free_list_mtx,
@@ -1368,7 +1369,8 @@ vnlru_proc(void)
 * After becoming active to expand above low water, keep
 * active until above high water.
 */
-   force = vspace() < vhiwat;
+   vsp = vspace();
+   force = vsp < vhiwat;
}
 }
 
@@ -1447,8 +1449,10 @@ vtryrecycle(struct vnode *vp)
 static void
 vcheckspace(void)
 {
+   int vsp;
 
-   if (vspace() < vlowat && vnlruproc_sig == 0) {
+   vsp = vspace();
+   if (vsp < vlowat && vnlruproc_sig == 0) {
vnlruproc_sig = 1;
wakeup(vnlruproc);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353929 - head/lib/msun/amd64

2019-10-23 Thread Conrad Meyer
Author: cem
Date: Wed Oct 23 16:05:52 2019
New Revision: 353929
URL: https://svnweb.freebsd.org/changeset/base/353929

Log:
  libm: Add missing END() directives for amd64 routines
  
  No functional change.  Related to D22122.
  
  Reviewed by:  emaste, kib (earlier version both)

Modified:
  head/lib/msun/amd64/e_remainder.S
  head/lib/msun/amd64/e_remainderf.S
  head/lib/msun/amd64/e_remainderl.S
  head/lib/msun/amd64/e_sqrtl.S
  head/lib/msun/amd64/s_llrintl.S
  head/lib/msun/amd64/s_logbl.S
  head/lib/msun/amd64/s_lrintl.S
  head/lib/msun/amd64/s_remquol.S
  head/lib/msun/amd64/s_rintl.S

Modified: head/lib/msun/amd64/e_remainder.S
==
--- head/lib/msun/amd64/e_remainder.S   Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/e_remainder.S   Wed Oct 23 16:05:52 2019
(r353929)
@@ -51,5 +51,6 @@ ENTRY(remainder)
movsd   -8(%rsp),%xmm0
fstp%st
ret
+END(remainder)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/e_remainderf.S
==
--- head/lib/msun/amd64/e_remainderf.S  Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/e_remainderf.S  Wed Oct 23 16:05:52 2019
(r353929)
@@ -21,5 +21,6 @@ ENTRY(remainderf)
movss   -4(%rsp),%xmm0
fstp%st
ret
+END(remainderf)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/e_remainderl.S
==
--- head/lib/msun/amd64/e_remainderl.S  Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/e_remainderl.S  Wed Oct 23 16:05:52 2019
(r353929)
@@ -46,5 +46,6 @@ ENTRY(remainderl)
jne 1b
fstp%st(1)
ret
+END(remainderl)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/e_sqrtl.S
==
--- head/lib/msun/amd64/e_sqrtl.S   Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/e_sqrtl.S   Wed Oct 23 16:05:52 2019
(r353929)
@@ -31,5 +31,6 @@ ENTRY(sqrtl)
fldt8(%rsp)
fsqrt
ret
+END(sqrtl)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/s_llrintl.S
==
--- head/lib/msun/amd64/s_llrintl.S Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/s_llrintl.S Wed Oct 23 16:05:52 2019
(r353929)
@@ -33,5 +33,6 @@ ENTRY(llrintl)
fistpll (%rsp)
popq%rax
ret
+END(llrintl)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/s_logbl.S
==
--- head/lib/msun/amd64/s_logbl.S   Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/s_logbl.S   Wed Oct 23 16:05:52 2019
(r353929)
@@ -41,5 +41,6 @@ ENTRY(logbl)
fxtract
fstp%st
ret
+END(logbl)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/s_lrintl.S
==
--- head/lib/msun/amd64/s_lrintl.S  Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/s_lrintl.S  Wed Oct 23 16:05:52 2019
(r353929)
@@ -33,5 +33,6 @@ ENTRY(lrintl)
fistpll (%rsp)
popq%rax
ret
+END(lrintl)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/s_remquol.S
==
--- head/lib/msun/amd64/s_remquol.S Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/s_remquol.S Wed Oct 23 16:05:52 2019
(r353929)
@@ -60,5 +60,6 @@ ENTRY(remquol)
 /* Store the quotient and return. */
movl%eax,(%rdi)
ret
+END(remquol)
 
.section .note.GNU-stack,"",%progbits

Modified: head/lib/msun/amd64/s_rintl.S
==
--- head/lib/msun/amd64/s_rintl.S   Wed Oct 23 15:51:26 2019
(r353928)
+++ head/lib/msun/amd64/s_rintl.S   Wed Oct 23 16:05:52 2019
(r353929)
@@ -41,5 +41,6 @@ ENTRY(rintl)
fldt8(%rsp)
frndint
ret
+END(rintl)
 
.section .note.GNU-stack,"",%progbits
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353928 - head/sys/kern

2019-10-23 Thread Konstantin Belousov
Author: kib
Date: Wed Oct 23 15:51:26 2019
New Revision: 353928
URL: https://svnweb.freebsd.org/changeset/base/353928

Log:
  vn_printf(): Decode VI_TEXT_REF.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Oct 23 14:33:49 2019(r353927)
+++ head/sys/kern/vfs_subr.cWed Oct 23 15:51:26 2019(r353928)
@@ -3832,8 +3832,10 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
strlcat(buf, "|VI_DOINGINACT", sizeof(buf));
if (vp->v_iflag & VI_OWEINACT)
strlcat(buf, "|VI_OWEINACT", sizeof(buf));
+   if (vp->v_iflag & VI_TEXT_REF)
+   strlcat(buf, "|VI_TEXT_REF", sizeof(buf));
flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE |
-   VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT);
+   VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT | VI_TEXT_REF);
if (flags != 0) {
snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags);
strlcat(buf, buf2, sizeof(buf));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353927 - stable/11/sys/dev/usb/net

2019-10-23 Thread Ed Maste
Author: emaste
Date: Wed Oct 23 14:33:49 2019
New Revision: 353927
URL: https://svnweb.freebsd.org/changeset/base/353927

Log:
  MFC r333095: if_smsc: fix reset check
  
  In smsc_phy_init function, when the driver was trying to reset PHY, it
  didn't poll for the correct bit (BMCR_RESET) to be cleared.  Instead, it
  anded it with MII_BMCR (which is 0), so it just exited the loop.
  
  This issue was fixed in Linux in commit d94609200069.
  
  Submitted by: Arshan Khanifar
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/dev/usb/net/if_smsc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/net/if_smsc.c
==
--- stable/11/sys/dev/usb/net/if_smsc.c Wed Oct 23 14:16:34 2019
(r353926)
+++ stable/11/sys/dev/usb/net/if_smsc.c Wed Oct 23 14:33:49 2019
(r353927)
@@ -1304,7 +1304,7 @@ smsc_phy_init(struct smsc_softc *sc)
do {
uether_pause(>sc_ue, hz / 100);
bmcr = smsc_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, 
MII_BMCR);
-   } while ((bmcr & MII_BMCR) && ((ticks - start_ticks) < max_ticks));
+   } while ((bmcr & BMCR_RESET) && ((ticks - start_ticks) < max_ticks));
 
if (((usb_ticks_t)(ticks - start_ticks)) >= max_ticks) {
smsc_err_printf(sc, "PHY reset timed-out");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353926 - stable/11/sys/dev/vt

2019-10-23 Thread Ed Maste
Author: emaste
Date: Wed Oct 23 14:16:34 2019
New Revision: 353926
URL: https://svnweb.freebsd.org/changeset/base/353926

Log:
  MFC r353680: vt: remove comment that is not true since r259680
  
  r259680 added support to vt(4) for printing double-width characters.
  Remove comment that claims no support.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/dev/vt/vt_font.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/vt/vt_font.c
==
--- stable/11/sys/dev/vt/vt_font.c  Wed Oct 23 14:15:16 2019
(r353925)
+++ stable/11/sys/dev/vt/vt_font.c  Wed Oct 23 14:16:34 2019
(r353926)
@@ -90,11 +90,6 @@ vtfont_lookup(const struct vt_font *vf, term_char_t c)
unsigned int normal_map;
unsigned int bold_map;
 
-   /*
-* No support for printing right hand sides for CJK fullwidth
-* characters. Simply print a space and assume that the left
-* hand side describes the entire character.
-*/
src = TCHAR_CHARACTER(c);
if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) {
normal_map = VFNT_MAP_NORMAL_RIGHT;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353925 - stable/12/sys/dev/vt

2019-10-23 Thread Ed Maste
Author: emaste
Date: Wed Oct 23 14:15:16 2019
New Revision: 353925
URL: https://svnweb.freebsd.org/changeset/base/353925

Log:
  MFC r353680: vt: remove comment that is not true since r259680
  
  r259680 added support to vt(4) for printing double-width characters.
  Remove the comment that claims no support.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/dev/vt/vt_font.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/vt/vt_font.c
==
--- stable/12/sys/dev/vt/vt_font.c  Wed Oct 23 13:41:58 2019
(r353924)
+++ stable/12/sys/dev/vt/vt_font.c  Wed Oct 23 14:15:16 2019
(r353925)
@@ -92,11 +92,6 @@ vtfont_lookup(const struct vt_font *vf, term_char_t c)
unsigned int normal_map;
unsigned int bold_map;
 
-   /*
-* No support for printing right hand sides for CJK fullwidth
-* characters. Simply print a space and assume that the left
-* hand side describes the entire character.
-*/
src = TCHAR_CHARACTER(c);
if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) {
normal_map = VFNT_MAP_NORMAL_RIGHT;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353924 - in stable/12/sys: amd64/amd64 kern

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 13:41:58 2019
New Revision: 353924
URL: https://svnweb.freebsd.org/changeset/base/353924

Log:
  MFC r352623:
  Use elf_relocaddr() when handling R_X86_64_RELATIVE relocations.

Modified:
  stable/12/sys/amd64/amd64/elf_machdep.c
  stable/12/sys/kern/link_elf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/elf_machdep.c
==
--- stable/12/sys/amd64/amd64/elf_machdep.c Wed Oct 23 13:41:44 2019
(r353923)
+++ stable/12/sys/amd64/amd64/elf_machdep.c Wed Oct 23 13:41:58 2019
(r353924)
@@ -268,7 +268,6 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
 */
printf("kldload: unexpected R_COPY relocation\n");
return (-1);
-   break;
 
case R_X86_64_GLOB_DAT: /* S */
case R_X86_64_JMP_SLOT: /* XXX need addend + offset */
@@ -280,7 +279,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
break;
 
case R_X86_64_RELATIVE: /* B + A */
-   addr = relocbase + addend;
+   addr = elf_relocaddr(lf, relocbase + addend);
val = addr;
if (*where != val)
*where = val;

Modified: stable/12/sys/kern/link_elf.c
==
--- stable/12/sys/kern/link_elf.c   Wed Oct 23 13:41:44 2019
(r353923)
+++ stable/12/sys/kern/link_elf.c   Wed Oct 23 13:41:58 2019
(r353924)
@@ -1163,6 +1163,9 @@ elf_relocaddr(linker_file_t lf, Elf_Addr x)
 {
elf_file_t ef;
 
+   KASSERT(lf->ops->cls == (kobj_class_t)_elf_class,
+   ("elf_relocaddr: unexpected linker file %p", lf));
+
ef = (elf_file_t)lf;
if (x >= ef->pcpu_start && x < ef->pcpu_stop)
return ((x - ef->pcpu_start) + ef->pcpu_base);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353923 - stable/12/sys/kern

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 13:41:44 2019
New Revision: 353923
URL: https://svnweb.freebsd.org/changeset/base/353923

Log:
  MFC r353671:
  Use KOBJMETHOD_END in the kernel linker.

Modified:
  stable/12/sys/kern/link_elf.c
  stable/12/sys/kern/link_elf_obj.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/link_elf.c
==
--- stable/12/sys/kern/link_elf.c   Wed Oct 23 13:41:26 2019
(r353922)
+++ stable/12/sys/kern/link_elf.c   Wed Oct 23 13:41:44 2019
(r353923)
@@ -179,7 +179,7 @@ static kobj_method_t link_elf_methods[] = {
KOBJMETHOD(linker_ctf_get,  link_elf_ctf_get),
KOBJMETHOD(linker_symtab_get,   link_elf_symtab_get),
KOBJMETHOD(linker_strtab_get,   link_elf_strtab_get),
-   { 0, 0 }
+   KOBJMETHOD_END
 };
 
 static struct linker_class link_elf_class = {

Modified: stable/12/sys/kern/link_elf_obj.c
==
--- stable/12/sys/kern/link_elf_obj.c   Wed Oct 23 13:41:26 2019
(r353922)
+++ stable/12/sys/kern/link_elf_obj.c   Wed Oct 23 13:41:44 2019
(r353923)
@@ -163,7 +163,7 @@ static kobj_method_t link_elf_methods[] = {
KOBJMETHOD(linker_ctf_get,  link_elf_ctf_get),
KOBJMETHOD(linker_symtab_get,   link_elf_symtab_get),
KOBJMETHOD(linker_strtab_get,   link_elf_strtab_get),
-   { 0, 0 }
+   KOBJMETHOD_END
 };
 
 static struct linker_class link_elf_class = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353922 - stable/12/sys/powerpc/aim

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 13:41:26 2019
New Revision: 353922
URL: https://svnweb.freebsd.org/changeset/base/353922

Log:
  MFC r353650:
  Clear PGA_WRITEABLE in moea_pvo_remove().

Modified:
  stable/12/sys/powerpc/aim/mmu_oea.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/aim/mmu_oea.c
==
--- stable/12/sys/powerpc/aim/mmu_oea.c Wed Oct 23 13:40:39 2019
(r353921)
+++ stable/12/sys/powerpc/aim/mmu_oea.c Wed Oct 23 13:41:26 2019
(r353922)
@@ -2120,23 +2120,26 @@ moea_pvo_remove(struct pvo_entry *pvo, int pteidx)
pvo->pvo_pmap->pm_stats.wired_count--;
 
/*
+* Remove this PVO from the PV and pmap lists.
+*/
+   LIST_REMOVE(pvo, pvo_vlink);
+   RB_REMOVE(pvo_tree, >pvo_pmap->pmap_pvo, pvo);
+
+   /*
 * Save the REF/CHG bits into their cache if the page is managed.
+* Clear PGA_WRITEABLE if all mappings of the page have been removed.
 */
if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED) {
-   struct  vm_page *pg;
+   struct vm_page *pg;
 
pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN);
if (pg != NULL) {
moea_attr_save(pg, pvo->pvo_pte.pte.pte_lo &
(PTE_REF | PTE_CHG));
+   if (LIST_EMPTY(>md.mdpg_pvoh))
+   vm_page_aflag_clear(pg, PGA_WRITEABLE);
}
}
-
-   /*
-* Remove this PVO from the PV and pmap lists.
-*/
-   LIST_REMOVE(pvo, pvo_vlink);
-   RB_REMOVE(pvo_tree, >pvo_pmap->pmap_pvo, pvo);
 
/*
 * Remove this from the overflow list and return it to the pool
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353921 - stable/12/sys/amd64/amd64

2019-10-23 Thread Mark Johnston
Author: markj
Date: Wed Oct 23 13:40:39 2019
New Revision: 353921
URL: https://svnweb.freebsd.org/changeset/base/353921

Log:
  MFC r352622:
  Set NX in mappings created by pmap_kenter() and pmap_kenter_attr().

Modified:
  stable/12/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/pmap.c
==
--- stable/12/sys/amd64/amd64/pmap.cWed Oct 23 13:21:15 2019
(r353920)
+++ stable/12/sys/amd64/amd64/pmap.cWed Oct 23 13:40:39 2019
(r353921)
@@ -3135,7 +3135,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t pa)
pt_entry_t *pte;
 
pte = vtopte(va);
-   pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g);
+   pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g | pg_nx);
 }
 
 static __inline void
@@ -3146,7 +3146,7 @@ pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mo
 
pte = vtopte(va);
cache_bits = pmap_cache_bits(kernel_pmap, mode, 0);
-   pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g | cache_bits);
+   pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g | pg_nx | cache_bits);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r353640 - head/sys/kern

2019-10-23 Thread Konstantin Belousov
On Wed, Oct 23, 2019 at 11:18:06PM +1100, Bruce Evans wrote:
> On Tue, 22 Oct 2019, Alan Somers wrote:
> 
> > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner  wrote:
> >
> >> Author: andrew
> >> Date: Wed Oct 16 13:21:01 2019
> >> New Revision: 353640
> >> URL: https://svnweb.freebsd.org/changeset/base/353640
> >>
> >> Log:
> >>   Stop leaking information from the kernel through timespec
> >>
> >>   The timespec struct holds a seconds value in a time_t and a nanoseconds
> >>   value in a long. On most architectures these are the same size, however
> >>   on 32-bit architectures other than i386 time_t is 8 bytes and long is
> >>   4 bytes.
> >>
> >>   Most ABIs will then pad a struct holding an 8 byte and 4 byte value to
> >>   16 bytes with 4 bytes of padding. When copying one of these structs the
> >>   compiler is free to copy the padding if it wishes.
> 
> I doubt that most ABIs pad the struct in that case.  Pure 32-bit arches
> don't have any 64-bit memory or register operations, so they use 32-bit
> longs and don't pessimize structs with 64-bit types in them using padding.
> 
> If there are any such ABIs, then there are thousands if not millions more
> places to fix.  Every place where a timespec is written must be checked.
32bit ARM requires 8-byte alignment for 64bit integers AFAIR.  Also I
believe that this is the only such 32bit architecture supported by FreeBSD.

> 
> E.g., gettimeofday() reduces to microtime().  The implementation of
> microtime() happens to fill the timeval fields separately.  That always
> leaks kernel context if struct timeval has padding and nothing else
> zeros the padding.  And for gettimeofday() it is especially clear that
> nothing else zeros the padding.  sys_gettimeofday() allocates a timeval
> on the kernel stack; microtime() initializes its fields separately
> leaving any padding untouched; copyout() then copies out kernel context.
> 
> This commit attempts to fix the different problem that if lower levels
> like microtime() were pessimized to initialize the padding, then callers
> would have to be careful to preserve this by not using struct
> assignments for copying structs.  This is not easy to do.  bcopy() and
> copyout() should preserve memory, but there are no guarantees if the
> struct is accessed in other ways.  The fix in this commit can easily
> not work on arches that have the problem:
> 
>   bzero(); /* padding now all 0 */
>   tv.tv_sec = another_tv_sec;
>   /*
>* Padding now indeterminate (C99 6.2.6.1p6).  It is reasonable
>* for the implementation to use the padding on ABIs that have it,
>* 64-bit stores of registers with uncleared kernel context gives
>* gives the context leak.
>*/
>   tv.tv_nsec = another_tv_nsec;
> 
> I don't see anything in C99 that requires padding to remain unchanged
> even with no stores in the program.
> 
> This problem affects more than time_t's.  It affects all padding.
> 
> I next checked the simplest itimer call.  sys_getitimer() doesn't
> handle the problem, of course: it allocates a struct itimerval
> aitimerval the kernel stack; kern_getitimer() allocates a struct timeval
> ctv on the kernel stack; ctv is initialized 1 field at a time in most
> cases so its padding remains uninitialized; aitv is inititialized using
> a struct assignment in most cases so it has the problem that this
> commit attempts to fix.
> 
> This is just another bug in 64-bit time_t's, especially on 32-bit arches.
> Instead of 32-bit time_t's which work until 2038 or 2106, we have subtle
> security holes now.
> 
> Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353920 - head/sys/arm64/arm64

2019-10-23 Thread Andrew Turner
Author: andrew
Date: Wed Oct 23 13:21:15 2019
New Revision: 353920
URL: https://svnweb.freebsd.org/changeset/base/353920

Log:
  Stop enabling interrupts when reentering kdb on arm64
  
  When we raise a data abort from the kernel we need to enable interrupts,
  however we shouldn't be doing this when in the kernel debugger. In this
  case interrupts can lead to a further panic as they don't expect to be
  run from such a context.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/trap.c

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Wed Oct 23 09:56:53 2019(r353919)
+++ head/sys/arm64/arm64/trap.c Wed Oct 23 13:21:15 2019(r353920)
@@ -179,6 +179,8 @@ data_abort(struct thread *td, struct trapframe *frame,
if (lower)
map = >p_vmspace->vm_map;
else {
+   intr_enable();
+
/* The top bit tells us which range to use */
if (far >= VM_MAXUSER_ADDRESS) {
map = kernel_map;
@@ -316,7 +318,6 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
case EXCP_INSN_ABORT:
case EXCP_DATA_ABORT:
far = READ_SPECIALREG(far_el1);
-   intr_enable();
data_abort(td, frame, esr, far, 0,
exception == EXCP_INSN_ABORT);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r353640 - head/sys/kern

2019-10-23 Thread Andrew Turner



> On 22 Oct 2019, at 16:50, Alan Somers  > wrote:
> 
> On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner  > wrote:
> Author: andrew
> Date: Wed Oct 16 13:21:01 2019
> New Revision: 353640
> URL: https://svnweb.freebsd.org/changeset/base/353640 
> 
> 
> Log:
>   Stop leaking information from the kernel through timespec
> 
>   The timespec struct holds a seconds value in a time_t and a nanoseconds
>   value in a long. On most architectures these are the same size, however
>   on 32-bit architectures other than i386 time_t is 8 bytes and long is
>   4 bytes.
> 
>   Most ABIs will then pad a struct holding an 8 byte and 4 byte value to
>   16 bytes with 4 bytes of padding. When copying one of these structs the
>   compiler is free to copy the padding if it wishes.
> 
>   In this case the padding may contain kernel data that is then leaked to
>   userspace. Fix this by copying the timespec elements rather than the
>   entire struct.
> 
>   This doesn't affect Tier-1 architectures so no SA is expected.
> 
>   admbugs:  651
>   MFC after:1 week
>   Sponsored by: DARPA, AFRL
> 
> Good catch.  Might I ask how you found it, or who reported it? 

I found it via one of the tests. It uses memcmp to check the struct returned 
was identical to what it expected. On closer inspection I found the difference 
was in the padding.

Andrew 

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


Re: svn commit: r353640 - head/sys/kern

2019-10-23 Thread Bruce Evans

On Tue, 22 Oct 2019, Alan Somers wrote:


On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner  wrote:


Author: andrew
Date: Wed Oct 16 13:21:01 2019
New Revision: 353640
URL: https://svnweb.freebsd.org/changeset/base/353640

Log:
  Stop leaking information from the kernel through timespec

  The timespec struct holds a seconds value in a time_t and a nanoseconds
  value in a long. On most architectures these are the same size, however
  on 32-bit architectures other than i386 time_t is 8 bytes and long is
  4 bytes.

  Most ABIs will then pad a struct holding an 8 byte and 4 byte value to
  16 bytes with 4 bytes of padding. When copying one of these structs the
  compiler is free to copy the padding if it wishes.


I doubt that most ABIs pad the struct in that case.  Pure 32-bit arches
don't have any 64-bit memory or register operations, so they use 32-bit
longs and don't pessimize structs with 64-bit types in them using padding.

If there are any such ABIs, then there are thousands if not millions more
places to fix.  Every place where a timespec is written must be checked.

E.g., gettimeofday() reduces to microtime().  The implementation of
microtime() happens to fill the timeval fields separately.  That always
leaks kernel context if struct timeval has padding and nothing else
zeros the padding.  And for gettimeofday() it is especially clear that
nothing else zeros the padding.  sys_gettimeofday() allocates a timeval
on the kernel stack; microtime() initializes its fields separately
leaving any padding untouched; copyout() then copies out kernel context.

This commit attempts to fix the different problem that if lower levels
like microtime() were pessimized to initialize the padding, then callers
would have to be careful to preserve this by not using struct
assignments for copying structs.  This is not easy to do.  bcopy() and
copyout() should preserve memory, but there are no guarantees if the
struct is accessed in other ways.  The fix in this commit can easily
not work on arches that have the problem:

bzero(); /* padding now all 0 */
tv.tv_sec = another_tv_sec;
/*
 * Padding now indeterminate (C99 6.2.6.1p6).  It is reasonable
 * for the implementation to use the padding on ABIs that have it,
 * 64-bit stores of registers with uncleared kernel context gives
 * gives the context leak.
 */
tv.tv_nsec = another_tv_nsec;

I don't see anything in C99 that requires padding to remain unchanged
even with no stores in the program.

This problem affects more than time_t's.  It affects all padding.

I next checked the simplest itimer call.  sys_getitimer() doesn't
handle the problem, of course: it allocates a struct itimerval
aitimerval the kernel stack; kern_getitimer() allocates a struct timeval
ctv on the kernel stack; ctv is initialized 1 field at a time in most
cases so its padding remains uninitialized; aitv is inititialized using
a struct assignment in most cases so it has the problem that this
commit attempts to fix.

This is just another bug in 64-bit time_t's, especially on 32-bit arches.
Instead of 32-bit time_t's which work until 2038 or 2106, we have subtle
security holes now.

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


svn commit: r353919 - head/sys/dev/extres/regulator

2019-10-23 Thread Emmanuel Vadot
Author: manu
Date: Wed Oct 23 09:56:53 2019
New Revision: 353919
URL: https://svnweb.freebsd.org/changeset/base/353919

Log:
  regulator: Add a regnode_set_constraint function
  
  This method check that boot_on or always_on is set to 1 and if it
  is it will try to enable the regulator.
  The binding docs aren't clear on what to do but Linux enable the regulator
  if any of those properties is set so we want to do the same.
  The function first check the status to see if the regulator is
  already enabled it then get the voltage to check if it is in a acceptable
  range and then enables it.
  This will be either called from the regnode_init method (if it's needed by 
the platform)
  or by a SYSINIT at SI_SUB_LAST
  
  Reviewed by:  mmel
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D22106

Modified:
  head/sys/dev/extres/regulator/regulator.c
  head/sys/dev/extres/regulator/regulator.h

Modified: head/sys/dev/extres/regulator/regulator.c
==
--- head/sys/dev/extres/regulator/regulator.c   Wed Oct 23 09:54:50 2019
(r353918)
+++ head/sys/dev/extres/regulator/regulator.c   Wed Oct 23 09:56:53 2019
(r353919)
@@ -72,6 +72,7 @@ static int regnode_method_status(struct regnode *regno
 static int regnode_method_set_voltage(struct regnode *regnode, int min_uvolt,
 int max_uvolt, int *udelay);
 static int regnode_method_get_voltage(struct regnode *regnode, int *uvolt);
+static void regulator_constraint(void *dummy);
 static void regulator_shutdown(void *dummy);
 
 /*
@@ -154,9 +155,27 @@ SX_SYSINIT(regulator_topology, _topo_lock, "Re
 #define REGNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock))
 #define REGNODE_UNLOCK(_sc)sx_unlock(&((_sc)->lock))
 
+SYSINIT(regulator_constraint, SI_SUB_LAST, SI_ORDER_ANY, regulator_constraint,
+NULL);
 SYSINIT(regulator_shutdown, SI_SUB_LAST, SI_ORDER_ANY, regulator_shutdown,
 NULL);
 
+static void
+regulator_constraint(void *dummy)
+{
+   struct regnode *entry;
+   int rv;
+
+   REG_TOPO_SLOCK();
+   TAILQ_FOREACH(entry, _list, reglist_link) {
+   rv = regnode_set_constraint(entry);
+   if (rv != 0 && bootverbose)
+   printf("regulator: setting constraint on %s failed 
(%d)\n",
+   entry->name, rv);
+   }
+   REG_TOPO_UNLOCK();
+}
+
 /*
  * Disable unused regulator
  * We run this function at SI_SUB_LAST which mean that every driver that needs
@@ -778,6 +797,56 @@ regnode_set_voltage_checked(struct regnode *regnode, s
regnode_delay(udelay);
REGNODE_UNLOCK(regnode);
return (rv);
+}
+
+int
+regnode_set_constraint(struct regnode *regnode)
+{
+   int status, rv, uvolt;
+
+   if (regnode->std_param.boot_on != true &&
+   regnode->std_param.always_on != true)
+   return (0);
+
+   rv = regnode_status(regnode, );
+   if (rv != 0) {
+   if (bootverbose)
+   printf("Cannot get regulator status for %s\n",
+   regnode_get_name(regnode));
+   return (rv);
+   }
+
+   if (status == REGULATOR_STATUS_ENABLED)
+   return (0);
+
+   rv = regnode_get_voltage(regnode, );
+   if (rv != 0) {
+   if (bootverbose)
+   printf("Cannot get regulator voltage for %s\n",
+   regnode_get_name(regnode));
+   return (rv);
+   }
+
+   if (uvolt < regnode->std_param.min_uvolt ||
+ uvolt > regnode->std_param.max_uvolt) {
+   if (bootverbose)
+   printf("Regulator %s current voltage %d is not in the"
+   " acceptable range : %d<->%d\n",
+   regnode_get_name(regnode),
+   uvolt, regnode->std_param.min_uvolt,
+   regnode->std_param.max_uvolt);
+   return (ERANGE);
+   }
+
+   rv = regnode_enable(regnode);
+   if (rv != 0) {
+   if (bootverbose)
+   printf("Cannot enable regulator %s\n",
+   regnode_get_name(regnode));
+   return (rv);
+   }
+
+   return (0);
 }
 
 #ifdef FDT

Modified: head/sys/dev/extres/regulator/regulator.h
==
--- head/sys/dev/extres/regulator/regulator.h   Wed Oct 23 09:54:50 2019
(r353918)
+++ head/sys/dev/extres/regulator/regulator.h   Wed Oct 23 09:56:53 2019
(r353919)
@@ -116,6 +116,7 @@ int regnode_stop(struct regnode *regnode, int depth);
 int regnode_status(struct regnode *regnode, int *status);
 int regnode_get_voltage(struct regnode *regnode, int *uvolt);
 int regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt);
+int regnode_set_constraint(struct regnode *regnode);
 #ifdef FDT
 phandle_t 

svn commit: r353918 - head/sys/arm/allwinner

2019-10-23 Thread Emmanuel Vadot
Author: manu
Date: Wed Oct 23 09:54:50 2019
New Revision: 353918
URL: https://svnweb.freebsd.org/changeset/base/353918

Log:
  axp81x: Use the default regnode_init method
  
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/axp81x.c

Modified: head/sys/arm/allwinner/axp81x.c
==
--- head/sys/arm/allwinner/axp81x.c Wed Oct 23 09:54:12 2019
(r353917)
+++ head/sys/arm/allwinner/axp81x.c Wed Oct 23 09:54:50 2019
(r353918)
@@ -747,12 +747,6 @@ axp8xx_write(device_t dev, uint8_t reg, uint8_t val)
 }
 
 static int
-axp8xx_regnode_init(struct regnode *regnode)
-{
-   return (0);
-}
-
-static int
 axp8xx_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
 {
struct axp8xx_reg_sc *sc;
@@ -869,7 +863,6 @@ axp8xx_regnode_get_voltage(struct regnode *regnode, in
 
 static regnode_method_t axp8xx_regnode_methods[] = {
/* Regulator interface */
-   REGNODEMETHOD(regnode_init, axp8xx_regnode_init),
REGNODEMETHOD(regnode_enable,   axp8xx_regnode_enable),
REGNODEMETHOD(regnode_set_voltage,  axp8xx_regnode_set_voltage),
REGNODEMETHOD(regnode_get_voltage,  axp8xx_regnode_get_voltage),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >