svn commit: r307338 - head/sys/boot/i386/libi386

2016-10-14 Thread Warner Losh
Author: imp
Date: Sat Oct 15 05:53:09 2016
New Revision: 307338
URL: https://svnweb.freebsd.org/changeset/base/307338

Log:
  Create a pcibios-version environment FORTH word. This allows one to
  conditionally compile forth code before using the pcibios- words.

Modified:
  head/sys/boot/i386/libi386/biospci.c

Modified: head/sys/boot/i386/libi386/biospci.c
==
--- head/sys/boot/i386/libi386/biospci.cSat Oct 15 01:41:28 2016
(r307337)
+++ head/sys/boot/i386/libi386/biospci.cSat Oct 15 05:53:09 2016
(r307338)
@@ -190,7 +190,6 @@ static struct pci_class
 {-1,   NULL,   NULL}
 };
 
-
 static voidbiospci_enumerate(void);
 static voidbiospci_addinfo(int devid, struct pci_class *pc, struct 
pci_subclass *psc, struct pci_progif *ppi);
 
@@ -199,6 +198,7 @@ struct pnphandler biospcihandler =
 "PCI BIOS",
 biospci_enumerate
 };
+static int biospci_version;
 
 #define PCI_BIOS_PRESENT   0xb101
 #define FIND_PCI_DEVICE0xb102
@@ -254,7 +254,7 @@ biospci_detect(void)
 setenv("pcibios.config2", buf, 1);
 sprintf(buf, "%d", maxbus);
 setenv("pcibios.maxbus", buf, 1);
-
+biospci_version = bcd2bin((version >> 8) & 0xf) * 10 + bcd2bin(version & 
0xf);
 }
 
 static void
@@ -577,6 +577,8 @@ static void ficlCompilePciBios(FICL_SYST
 dictAppendWord(dp, "pcibios-find-devclass", ficlPciBiosFindDevclass, 
FW_DEFAULT);
 dictAppendWord(dp, "pcibios-find-device", ficlPciBiosFindDevice, 
FW_DEFAULT);
 dictAppendWord(dp, "pcibios-locator", ficlPciBiosLocator, FW_DEFAULT);
+
+ficlSetEnv(pSys, "pcibios-version", biospci_version);
 }
 
 FICL_COMPILE_SET(ficlCompilePciBios);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307337 - head/sys/netinet

2016-10-14 Thread Patrick Kelsey
Author: pkelsey
Date: Sat Oct 15 01:41:28 2016
New Revision: 307337
URL: https://svnweb.freebsd.org/changeset/base/307337

Log:
  Fix cases where the TFO pending counter would leak references, and 
eventually, memory.
  
  Also renamed some tfo labels and added/reworked comments for clarity.
  
  Based on an initial patch from jtl.
  
  PR: 213424
  Reviewed by:  jtl
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D8235

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSat Oct 15 00:29:15 2016
(r307336)
+++ head/sys/netinet/tcp_input.cSat Oct 15 01:41:28 2016
(r307337)
@@ -1121,7 +1121,7 @@ relocked:
goto dropwithreset;
}
 #ifdef TCP_RFC7413
-new_tfo_socket:
+tfo_socket_result:
 #endif
if (so == NULL) {
/*
@@ -1387,7 +1387,7 @@ new_tfo_socket:
tcp_dooptions(, optp, optlen, TO_SYN);
 #ifdef TCP_RFC7413
if (syncache_add(, , th, inp, , m, NULL, NULL))
-   goto new_tfo_socket;
+   goto tfo_socket_result;
 #else
syncache_add(, , th, inp, , m, NULL, NULL);
 #endif

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Sat Oct 15 00:29:15 2016
(r307336)
+++ head/sys/netinet/tcp_syncache.c Sat Oct 15 01:41:28 2016
(r307337)
@@ -1151,11 +1151,10 @@ syncache_tfo_expand(struct syncache *sc,
  * the data, we avoid this DoS scenario.
  *
  * The exception to the above is when a SYN with a valid TCP Fast Open (TFO)
- * cookie is processed, V_tcp_fastopen_enabled set to true, and the
- * TCP_FASTOPEN socket option is set.  In this case, a new socket is created
- * and returned via lsop, the mbuf is not freed so that tcp_input() can
- * queue its data to the socket, and 1 is returned to indicate the
- * TFO-socket-creation path was taken.
+ * cookie is processed and a new socket is created.  In this case, any data
+ * accompanying the SYN will be queued to the socket by tcp_input() and will
+ * be ACKed either when the application sends response data or the delayed
+ * ACK timer expires, whichever comes first.
  */
 int
 syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
@@ -1181,6 +1180,7 @@ syncache_add(struct in_conninfo *inc, st
struct ucred *cred;
 #ifdef TCP_RFC7413
uint64_t tfo_response_cookie;
+   unsigned int *tfo_pending = NULL;
int tfo_cookie_valid = 0;
int tfo_response_cookie_valid = 0;
 #endif
@@ -1226,8 +1226,13 @@ syncache_add(struct in_conninfo *inc, st
_response_cookie);
tfo_cookie_valid = (result > 0);
tfo_response_cookie_valid = (result >= 0);
-   } else
-   atomic_subtract_int(tp->t_tfo_pending, 1);
+   }
+
+   /*
+* Remember the TFO pending counter as it will have to be
+* decremented below if we don't make it to 
syncache_tfo_expand().
+*/
+   tfo_pending = tp->t_tfo_pending;
}
 #endif
 
@@ -1468,9 +1473,9 @@ skip_alloc:
 #ifdef TCP_RFC7413
if (tfo_cookie_valid) {
syncache_tfo_expand(sc, lsop, m, tfo_response_cookie);
-   /* INP_WUNLOCK(inp) will be performed by the called */
+   /* INP_WUNLOCK(inp) will be performed by the caller */
rv = 1;
-   goto tfo_done;
+   goto tfo_expanded;
}
 #endif
 
@@ -1496,7 +1501,16 @@ done:
m_freem(m);
}
 #ifdef TCP_RFC7413
-tfo_done:
+   /*
+* If tfo_pending is not NULL here, then a TFO SYN that did not
+* result in a new socket was processed and the associated pending
+* counter has not yet been decremented.  All such TFO processing paths
+* transit this point.
+*/
+   if (tfo_pending != NULL)
+   tcp_fastopen_decrement_counter(tfo_pending);
+
+tfo_expanded:
 #endif
if (cred != NULL)
crfree(cred);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307082 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules/cc sys/modules/khelp sys/netinet sys/netinet/tcp_stacks sys/pc98/conf s

2016-10-14 Thread Jonathan Looney
Thanks!

Yes, that was clearly an error on my part, and your patch is an obvious
solution. I committed it at r307336.

Thanks again!

Jonathan

On Fri, Oct 14, 2016 at 8:01 PM, Shawn Webb 
wrote:

> On Wed, Oct 12, 2016 at 02:16:42AM +, Jonathan T. Looney wrote:
> > Author: jtl
> > Date: Wed Oct 12 02:16:42 2016
> > New Revision: 307082
> > URL: https://svnweb.freebsd.org/changeset/base/307082
> >
> > Log:
> >   In the TCP stack, the hhook(9) framework provides hooks for kernel
> modules
> >   to add actions that run when a TCP frame is sent or received on a TCP
> >   session in the ESTABLISHED state. In the base tree, this functionality
> is
> >   only used for the h_ertt module, which is used by the cc_cdg, cc_chd,
> cc_hd,
> >   and cc_vegas congestion control modules.
> >
> >   Presently, we incur overhead to check for hooks each time a TCP frame
> is
> >   sent or received on an ESTABLISHED TCP session.
> >
> >   This change adds a new compile-time option (TCP_HHOOK) to determine
> whether
> >   to include the hhook(9) framework for TCP. To retain backwards
> >   compatibility, I added the TCP_HHOOK option to every configuration
> file that
> >   already defined "options INET". (Therefore, this patch introduces no
> >   functional change. In order to see a functional difference, you need to
> >   compile a custom kernel without the TCP_HHOOK option.) This change will
> >   allow users to easily exclude this functionality from their kernel,
> should
> >   they wish to do so.
> >
> >   Note that any users who use a custom kernel configuration and use one
> of the
> >   congestion control modules listed above will need to add the TCP_HHOOK
> >   option to their kernel configuration.
> >
> >   Reviewed by:rrs, lstewart, hiren (previous version), sjg
> (makefiles only)
> >   Sponsored by:   Netflix
> >   Differential Revision:  https://reviews.freebsd.org/D8185
>
> This commit breaks the build when VNET is enabled. Attached is a
> candidate patch to fix.
>
> If the patch doesn't make it to the list, I've pasted it here:
> http://ix.io/1wbE
>
> Thanks,
>
> --
> Shawn Webb
> Cofounder and Security Engineer
> HardenedBSD
>
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307336 - head/sys/netinet

2016-10-14 Thread Jonathan T. Looney
Author: jtl
Date: Sat Oct 15 00:29:15 2016
New Revision: 307336
URL: https://svnweb.freebsd.org/changeset/base/307336

Log:
  r307082 added the TCP_HHOOK kernel option and made some existing code only
  compile when that option is configured. In tcp_destroy(), the error
  variable is now only used in code enclosed in an '#ifdef TCP_HHOOK' block.
  This broke the build for VNET images.
  
  Enclose the error variable itself in an #ifdef block.
  
  Submitted by: Shawn Webb 
  Reported by:  Shawn Webb 
  PointyHat to: jtl

Modified:
  head/sys/netinet/tcp_subr.c

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Fri Oct 14 22:23:03 2016(r307335)
+++ head/sys/netinet/tcp_subr.c Sat Oct 15 00:29:15 2016(r307336)
@@ -742,7 +742,10 @@ tcp_init(void)
 static void
 tcp_destroy(void *unused __unused)
 {
-   int error, n;
+   int n;
+#ifdef TCP_HHOOK
+   int error;
+#endif
 
/*
 * All our processes are gone, all our sockets should be cleaned
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307082 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules/cc sys/modules/khelp sys/netinet sys/netinet/tcp_stacks sys/pc98/conf s

2016-10-14 Thread Shawn Webb
On Wed, Oct 12, 2016 at 02:16:42AM +, Jonathan T. Looney wrote:
> Author: jtl
> Date: Wed Oct 12 02:16:42 2016
> New Revision: 307082
> URL: https://svnweb.freebsd.org/changeset/base/307082
> 
> Log:
>   In the TCP stack, the hhook(9) framework provides hooks for kernel modules
>   to add actions that run when a TCP frame is sent or received on a TCP
>   session in the ESTABLISHED state. In the base tree, this functionality is
>   only used for the h_ertt module, which is used by the cc_cdg, cc_chd, cc_hd,
>   and cc_vegas congestion control modules.
>   
>   Presently, we incur overhead to check for hooks each time a TCP frame is
>   sent or received on an ESTABLISHED TCP session.
>   
>   This change adds a new compile-time option (TCP_HHOOK) to determine whether
>   to include the hhook(9) framework for TCP. To retain backwards
>   compatibility, I added the TCP_HHOOK option to every configuration file that
>   already defined "options INET". (Therefore, this patch introduces no
>   functional change. In order to see a functional difference, you need to
>   compile a custom kernel without the TCP_HHOOK option.) This change will
>   allow users to easily exclude this functionality from their kernel, should
>   they wish to do so.
>   
>   Note that any users who use a custom kernel configuration and use one of the
>   congestion control modules listed above will need to add the TCP_HHOOK
>   option to their kernel configuration.
>   
>   Reviewed by:rrs, lstewart, hiren (previous version), sjg (makefiles 
> only)
>   Sponsored by:   Netflix
>   Differential Revision:  https://reviews.freebsd.org/D8185

This commit breaks the build when VNET is enabled. Attached is a
candidate patch to fix.

If the patch doesn't make it to the list, I've pasted it here:
http://ix.io/1wbE

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index b8c9ff0..e69c3d4 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -742,7 +742,10 @@ tcp_init(void)
 static void
 tcp_destroy(void *unused __unused)
 {
-   int error, n;
+   int n;
+#ifdef TCP_HHOOK
+   int error;
+#endif
 
/*
 * All our processes are gone, all our sockets should be cleaned


signature.asc
Description: PGP signature


svn commit: r307335 - in head/sys: arm/broadcom/bcm2835 arm64/broadcom arm64/conf conf

2016-10-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Oct 14 22:23:03 2016
New Revision: 307335
URL: https://svnweb.freebsd.org/changeset/base/307335

Log:
  Make BRCM2837 port conform FreeBSD/ARM64 guidelines
  
  - Rename SOC_BCM2837 to SOC_BRCM_BCM2837, put it to opt_soc.h
  - do not use files.XXX files, just move required sources to
  conf/files.arm64 and make them depend on soc_brcm_bcm2837
  
  Suggested by: andrew

Deleted:
  head/sys/arm64/broadcom/
Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
  head/sys/arm64/conf/RPI3
  head/sys/conf/files.arm64
  head/sys/conf/options.arm64

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h   Fri Oct 14 22:20:14 
2016(r307334)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h   Fri Oct 14 22:23:03 
2016(r307335)
@@ -33,16 +33,23 @@
 #ifndef _BCM2835_VCBUS_H_
 #define _BCM2835_VCBUS_H_
 
+/*
+ * ARM64 define its SOC options in opt_soc.h
+ */
+#if defined(__aarch64__)
+#include "opt_soc.h"
+#endif
+
 #defineBCM2835_VCBUS_SDRAM_CACHED  0x4000
 #defineBCM2835_VCBUS_IO_BASE   0x7E00
 #defineBCM2835_VCBUS_SDRAM_UNCACHED0xC000
 
-#if defined(SOC_BCM2836) || defined(SOC_BCM2837)
-#defineBCM2835_ARM_IO_BASE 0x3f00
-#defineBCM2835_VCBUS_SDRAM_BASEBCM2835_VCBUS_SDRAM_UNCACHED
-#else
+#if defined(SOC_BCM2835)
 #defineBCM2835_ARM_IO_BASE 0x2000
 #defineBCM2835_VCBUS_SDRAM_BASEBCM2835_VCBUS_SDRAM_CACHED
+#else
+#defineBCM2835_ARM_IO_BASE 0x3f00
+#defineBCM2835_VCBUS_SDRAM_BASEBCM2835_VCBUS_SDRAM_UNCACHED
 #endif
 #defineBCM2835_ARM_IO_SIZE 0x0100
 

Modified: head/sys/arm64/conf/RPI3
==
--- head/sys/arm64/conf/RPI3Fri Oct 14 22:20:14 2016(r307334)
+++ head/sys/arm64/conf/RPI3Fri Oct 14 22:23:03 2016(r307335)
@@ -22,9 +22,6 @@
 cpuARM64
 ident  RPI3
 
-files  "../../arm/broadcom/bcm2835/files.bcm283x"
-files  "../broadcom/bcm2837/files.bcm2837"
-
 makeoptionsDEBUG=-g# Build kernel with gdb(1) debug symbols
 #makeoptions   WITH_CTF=1  # Run ctfconvert(1) for DTrace support
 
@@ -91,7 +88,7 @@ options   WITNESS # Enable checks to de
 optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for 
speed
 optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
 
-optionsSOC_BCM2837
+optionsSOC_BRCM_BCM2837
 
 optionsROOTDEVNAME=\"ufs:mmcsd0s2\"
 

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Fri Oct 14 22:20:14 2016(r307334)
+++ head/sys/conf/files.arm64   Fri Oct 14 22:23:03 2016(r307335)
@@ -45,6 +45,24 @@ arm/arm/generic_timer.c  standard
 arm/arm/gic.c  standard
 arm/arm/gic_fdt.c  optionalfdt
 arm/arm/pmu.c  standard
+arm/broadcom/bcm2835/bcm2835_audio.c   optional sound vchiq \
+   compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq"
+arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc
+arm/broadcom/bcm2835/bcm2835_common.c  optional fdt soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_ft5406.c  optional evdev bcm2835_ft5406 
soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_gpio.coptional gpio soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_intr.coptional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_mbox.coptional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_rng.c optional random soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_sdhci.c   optional sdhci soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi 
soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_vcio.coptional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2835_wdog.coptional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837
+arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt 
soc_brcm_bcm2837
 arm64/acpica/acpi_machdep.coptionalacpi
 arm64/acpica/OsdEnvironment.c  optionalacpi
 arm64/acpica/acpi_wakeup.c optionalacpi
@@ -96,6 +114,24 @@ arm64/cavium/thunder_pcie_pem.c optiona
 arm64/cavium/thunder_pcie_pem_fdt.coptionalsoc_cavm_thunderx pci 
fdt
 

svn commit: r307334 - in head/sys/arm64: arm64 include

2016-10-14 Thread Andrew Turner
Author: andrew
Date: Fri Oct 14 22:20:14 2016
New Revision: 307334
URL: https://svnweb.freebsd.org/changeset/base/307334

Log:
  Create macros for the MAIR memory attributes. While here add an uncached
  memory type, however the VM code still needs to be taught about this.
  
  MFC after:1 week
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Fri Oct 14 21:51:50 2016
(r307333)
+++ head/sys/arm64/arm64/locore.S   Fri Oct 14 22:20:14 2016
(r307334)
@@ -617,8 +617,10 @@ start_mmu:
 
.align 3
 mair:
-   /* DeviceNormal, no cache Normal, write-back */
-   .quad   MAIR_ATTR(0x00, 0) | MAIR_ATTR(0x44, 1) | MAIR_ATTR(0xff, 2)
+   .quad   MAIR_ATTR(MAIR_DEVICE_nGnRnE, 0) |  \
+   MAIR_ATTR(MAIR_NORMAL_NC, 1) |  \
+   MAIR_ATTR(MAIR_NORMAL_WB, 2) |  \
+   MAIR_ATTR(MAIR_NORMAL_WT, 3)
 tcr:
.quad (TCR_TxSZ(64 - VIRT_BITS) | TCR_ASID_16 | TCR_TG1_4K | \
TCR_CACHE_ATTRS | TCR_SMP_ATTRS)

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Fri Oct 14 21:51:50 2016
(r307333)
+++ head/sys/arm64/include/armreg.h Fri Oct 14 22:20:14 2016
(r307334)
@@ -357,6 +357,10 @@
 /* MAIR_EL1 - Memory Attribute Indirection Register */
 #defineMAIR_ATTR_MASK(idx) (0xff << ((n)* 8))
 #defineMAIR_ATTR(attr, idx) ((attr) << ((idx) * 8))
+#define MAIR_DEVICE_nGnRnE 0x00
+#define MAIR_NORMAL_NC 0x44
+#define MAIR_NORMAL_WT 0x88
+#define MAIR_NORMAL_WB 0xff
 
 /* PAR_EL1 - Physical Address Register */
 #definePAR_F_SHIFT 0
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307333 - head/sys/x86/x86

2016-10-14 Thread John Baldwin
Author: jhb
Date: Fri Oct 14 21:51:50 2016
New Revision: 307333
URL: https://svnweb.freebsd.org/changeset/base/307333

Log:
  Reprogram I/O APIC interrupt pins when registering an I/O APIC.
  
  All I/O APIC pins are masked when an I/O APIC is first probed.  The
  APIC enumerator (MP Table or MADT) then parses its associated tables to
  configure individual pins to set custom delivery modes or alternate
  routing (e.g. routing IRQ 0 to intpin 2).  Pins for regular interrupt
  pins are left masked until the first interrupt is assigned.  However,
  pins with unusual settings (e.g. NMI or SMI) are never assigned an
  interrupt and thus never re-programmed.  The I/O APIC code used to
  reprogram all interrupt pins during registration but this was lost in
  r151979.
  
  In theory, this is mostly a no-op as the ACPI APIC table does not
  include a way to enumerate NMI or SMI pins for the I/O APIC, so only
  systems using an MP Table would be affected.
  
  Reported by:  avg
  MFC after:1 month

Modified:
  head/sys/x86/x86/io_apic.c

Modified: head/sys/x86/x86/io_apic.c
==
--- head/sys/x86/x86/io_apic.c  Fri Oct 14 20:01:07 2016(r307332)
+++ head/sys/x86/x86/io_apic.c  Fri Oct 14 21:51:50 2016(r307333)
@@ -916,11 +916,16 @@ ioapic_register(void *cookie)
io->io_id, flags >> 4, flags & 0xf, io->io_intbase,
io->io_intbase + io->io_numintr - 1);
 
-   /* Register valid pins as interrupt sources. */
+   /*
+* Reprogram pins to handle special case pins (such as NMI and
+* SMI) and register valid pins as interrupt sources.
+*/
intr_register_pic(>io_pic);
-   for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++)
+   for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) {
+   ioapic_reprogram_intpin(>io_intsrc);
if (pin->io_irq < NUM_IO_INTS)
intr_register_source(>io_intsrc);
+   }
 }
 
 /* A simple new-bus driver to consume PCI I/O APIC devices. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307332 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 powerpc/powerpc

2016-10-14 Thread John Baldwin
Author: jhb
Date: Fri Oct 14 20:01:07 2016
New Revision: 307332
URL: https://svnweb.freebsd.org/changeset/base/307332

Log:
  Drop support for using mmap() with /dev/kmem.
  
  Using the device pager with /dev/kmem is not stable since KVA mappings
  are transient, but the device pager caches the PA associated with a
  given offset forever.  Interestingly, mips' implementation of
  memmap() already refused requests for /dev/kmem.
  
  Note that kvm_read/kvm_write do not use mmap, but use read and write on
  /dev/kmem, so this should not affect libkvm users.
  
  Reviewed by:  kib
  MFC after:2 months

Modified:
  head/sys/amd64/amd64/mem.c
  head/sys/arm/arm/mem.c
  head/sys/arm64/arm64/mem.c
  head/sys/i386/i386/mem.c
  head/sys/powerpc/powerpc/mem.c

Modified: head/sys/amd64/amd64/mem.c
==
--- head/sys/amd64/amd64/mem.c  Fri Oct 14 18:43:17 2016(r307331)
+++ head/sys/amd64/amd64/mem.c  Fri Oct 14 20:01:07 2016(r307332)
@@ -172,10 +172,9 @@ memmmap(struct cdev *dev, vm_ooffset_t o
if (offset >= (1ULL << cpu_maxphyaddr))
return (-1);
*paddr = offset;
-   } else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }
 
 /*

Modified: head/sys/arm/arm/mem.c
==
--- head/sys/arm/arm/mem.c  Fri Oct 14 18:43:17 2016(r307331)
+++ head/sys/arm/arm/mem.c  Fri Oct 14 20:01:07 2016(r307332)
@@ -161,10 +161,9 @@ int
 memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot __unused, vm_memattr_t *memattr __unused)
 {
-   if (dev2unit(dev) == CDEV_MINOR_MEM)
+   if (dev2unit(dev) == CDEV_MINOR_MEM) {
*paddr = offset;
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }

Modified: head/sys/arm64/arm64/mem.c
==
--- head/sys/arm64/arm64/mem.c  Fri Oct 14 18:43:17 2016(r307331)
+++ head/sys/arm64/arm64/mem.c  Fri Oct 14 20:01:07 2016(r307332)
@@ -123,10 +123,9 @@ int
 memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot __unused, vm_memattr_t *memattr __unused)
 {
-   if (dev2unit(dev) == CDEV_MINOR_MEM)
+   if (dev2unit(dev) == CDEV_MINOR_MEM) {
*paddr = offset;
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }

Modified: head/sys/i386/i386/mem.c
==
--- head/sys/i386/i386/mem.cFri Oct 14 18:43:17 2016(r307331)
+++ head/sys/i386/i386/mem.cFri Oct 14 20:01:07 2016(r307332)
@@ -161,12 +161,11 @@ int
 memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot __unused, vm_memattr_t *memattr __unused)
 {
-   if (dev2unit(dev) == CDEV_MINOR_MEM)
+   if (dev2unit(dev) == CDEV_MINOR_MEM) {
*paddr = offset;
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }
 
 /*

Modified: head/sys/powerpc/powerpc/mem.c
==
--- head/sys/powerpc/powerpc/mem.c  Fri Oct 14 18:43:17 2016
(r307331)
+++ head/sys/powerpc/powerpc/mem.c  Fri Oct 14 20:01:07 2016
(r307332)
@@ -179,8 +179,6 @@ memmmap(struct cdev *dev, vm_ooffset_t o
 
if (dev2unit(dev) == CDEV_MINOR_MEM)
*paddr = offset;
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
else
return (EFAULT);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307231 - head/lib/libgcc_s

2016-10-14 Thread Tijl Coosemans
On Fri, 14 Oct 2016 20:55:30 +0200 Dimitry Andric  wrote:
> On 14 Oct 2016, at 04:06, Ed Maste  wrote:
>> On 14 October 2016 at 01:53, Bruce Evans  wrote:  
 compiler-rt's complex division support routines contain calls to
 compiler builtins such as `__builtin_scalbnl`.  Unfortunately Clang
 turns these back into a call to `scalbnl`.  
>>> 
>>> gcc-4.2 has the same bug.  
>> 
>> Oh, interesting. Do you know off hand if it's resolved in later GCC?  
> 
> Not for x86, in any case (I think I talked about this with you on IRC
> before).  For example, using the latest gcc 7.0.0 20160911 on this
> program:
> 
> float f1(float x, int n)
> {
>   return __builtin_scalbnf(x, n);
> }
> 
> double f2(double x, int n)
> {
>   return __builtin_scalbn(x, n);
> }
> 
> long double f3(long double x, long n)
> {
>   return __builtin_scalbnl(x, n);
> }
> 
> gives this assembly:
> 
>   .p2align 4,,15
>   .globl  f1
>   .type   f1, @function
> f1:
> .LFB0:
>   .cfi_startproc
>   jmp scalbnf
>   .cfi_endproc
> .LFE0:
>   .size   f1, .-f1
>   .p2align 4,,15
>   .globl  f2
>   .type   f2, @function
> f2:
> .LFB1:
>   .cfi_startproc
>   jmp scalbn
>   .cfi_endproc
> .LFE1:
>   .size   f2, .-f2
>   .p2align 4,,15
>   .globl  f3
>   .type   f3, @function
> f3:
> .LFB2:
>   .cfi_startproc
>   jmp scalbnl
>   .cfi_endproc
> .LFE2:
>   .size   f3, .-f3
> 
> E.g., it looks like the __builtin_scalbn functions were always a red
> herring. :-)

>From https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html:

GCC includes built-in versions of many of the functions in the standard C
library. These functions come in two forms: one whose names start with
the __builtin_ prefix, and the other without. Both forms have the same
type (including prototype), the same address (when their address is
taken), and the same meaning as the C library functions even if you
specify the -fno-builtin option see C Dialect Options). Many of these
functions are only optimized in certain cases; if they are not optimized
in a particular case, a call to the library function is emitted.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307231 - head/lib/libgcc_s

2016-10-14 Thread Dimitry Andric
On 14 Oct 2016, at 04:06, Ed Maste  wrote:
> 
> Hi Bruce, thank you for the detailed response.
> 
> On 14 October 2016 at 01:53, Bruce Evans  wrote:
>>> compiler-rt's complex division support routines contain calls to
>>> compiler builtins such as `__builtin_scalbnl`.  Unfortunately Clang
>>> turns these back into a call to `scalbnl`.
>> 
>> gcc-4.2 has the same bug.
> 
> Oh, interesting. Do you know off hand if it's resolved in later GCC?

Not for x86, in any case (I think I talked about this with you on IRC
before).  For example, using the latest gcc 7.0.0 20160911 on this
program:

float f1(float x, int n)
{
return __builtin_scalbnf(x, n);
}

double f2(double x, int n)
{
return __builtin_scalbn(x, n);
}

long double f3(long double x, long n)
{
return __builtin_scalbnl(x, n);
}

gives this assembly:

.p2align 4,,15
.globl  f1
.type   f1, @function
f1:
.LFB0:
.cfi_startproc
jmp scalbnf
.cfi_endproc
.LFE0:
.size   f1, .-f1
.p2align 4,,15
.globl  f2
.type   f2, @function
f2:
.LFB1:
.cfi_startproc
jmp scalbn
.cfi_endproc
.LFE1:
.size   f2, .-f2
.p2align 4,,15
.globl  f3
.type   f3, @function
f3:
.LFB2:
.cfi_startproc
jmp scalbnl
.cfi_endproc
.LFE2:
.size   f3, .-f3

E.g., it looks like the __builtin_scalbn functions were always a red
herring. :-)


> It seems particularly unfortunate for the compiler to report (by
> whatever mechanism) that a builtin exists, and then just turn that
> builtin into a library call.

Yes, at best this is misleading.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Doug Ambrisko
On Fri, Oct 14, 2016 at 12:25:54PM -0600, Warner Losh wrote:
|On Oct 14, 2016 11:55 AM, "Doug Ambrisko" <[1]ambri...@ambrisko.com>
|wrote:
|>
|> On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote:
|> | -Original Message-
|> | > From: <[2]owner-src-committ...@freebsd.org> on behalf of Doug
|Ambrisko <[3]ambri...@ambrisko.com>
|> | > Date: 2016-10-14, Friday at 10:27
|> | > To: Warner Losh <[4]i...@bsdimp.com>
|> | > Cc: Doug Ambrisko <[5]ambri...@freebsd.org>, src-committers
|<[6]src-committ...@freebsd.org>, "[7]svn-src-...@freebsd.org"
|<[8]svn-src-...@freebsd.org>, "[9]svn-src-head@freebsd.org"
|<[10]svn-src-head@freebsd.org>
|> | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader
|> | >
|> | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote:
|> | > | Love the functionality, but don't like using the 'hint'
|namespace for
|> | > | this. Can we change it now before too many things depend on it?
|We had
|> | > | similar issues in ACPI and moved it to the 'acpi' space. Can we
|move
|> | > | this to the 'smbios' space please?
|> | > |
|> | > | The reason is that 'hint' is special and sometimes filtered
|out, so it
|> | > | is a poor choice to export data from the boot loader to the
|kernel.
|> | >
|> | > The reason I picked hint was it could be put /boot/device.hints
|> | > to make it work as well and that it was a hint.  Other standards
|in the
|> | > future might use other methods.  Looking back over the email I
|had
|> | > with John he had suggested hint.smbios.0.anchor to make this look
|> | > different.  This code had been hanging around for so long I
|forgot
|> | > about that and we were using hint.smbios.0.mem in our shipping
|code base.
|> | >
|> | > However, I hope that nothing would use this except for smbios(4)
|and
|> | > for people to make smbios(4) useful for this info.
|> |
|> | Doug's looking at me when he says that. :-)
|> |
|> | We talked about this last night at BAFUG; right now, even if
|smbios(4)
|> | is able to find the SMBIOS info -- it currently only looks at the
|> | aforementioned 0xf - 0xf range, so it can't find it on UEFI
|--
|> | smbios(4) doesn't actually provide any interface for that
|information.
|> | Doug and I have talked about making smbios(4) useful, by parsing
|the
|> | data and providing KPIs and APIs, for years now; I think I'll
|*finally*
|> | have the time and motivation to do so "soon".
|>
|> I've actually talked to a few people.  However, your the first to
|> step up.  This needs to be designed and will take some time and
|> review.  I would hope that except for smbios(4), nothing else would
|> use this kenv but there is nothing to prevent that :-(  I could name
|> it super_secret_dont_use.
|>
|> BTW, to get you started this patch prevents smbios(4) from blowing
|chunks
|> when it gets a anchor in high memory and works on legacy machines.
|>
|> --- /sys/x86/bios/smbios.c  2013-10-01 14:28:25.0 -0700
|> +++ ./smbios.c  2016-04-11 11:58:03.234969000 -0700
|> @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8
|>  #include 
|>  #include 
|>  #include 
|> +#include 
|>
|>  #include 
|>  #include 
|> @@ -59,7 +60,7 @@ struct smbios_softc {
|>  };
|>
|>  #defineRES2EPS(res)((struct smbios_eps
|*)rman_get_virtual(res))
|> -#defineADDR2EPS(addr)  ((struct smbios_eps
|*)BIOS_PADDRTOVADDR(addr))
|> +#defineADDR2EPS(addr)  ((struct smbios_eps
|*)PHYS_TO_DMAP(addr))
|>
|>  static devclass_t  smbios_devclass;
|>
|> @@ -71,19 +72,26 @@ static int  smbios_modevent (module_t, in
|>
|>  static int smbios_cksum(struct smbios_eps *);
|>
|> +static unsigned long addr;
|> +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0,
|> +"SMBIOS driver parameters");
|> +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW,
|> +, 0, "");
|> +
|>  static void
|>  smbios_identify (driver_t *driver, device_t parent)
|>  {
|> device_t child;
|> -   u_int32_t addr;
|> int length;
|> int rid;
|>
|> if (!device_is_alive(parent))
|> return;
|>
|> -   addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
|> - SMBIOS_STEP, SMBIOS_OFF);
|> +   if (resource_long_value("smbios", 0, "mem", ) != 0 ||
|> +   addr == 0)
|> +   addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG,
|SMBIOS_LEN,
|> + SMBIOS_STEP, SMBIOS_OFF);
|> if (addr != 0) {
|> rid = 0;

Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Warner Losh
On Oct 14, 2016 11:55 AM, "Doug Ambrisko"  wrote:
>
> On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote:
> | -Original Message-
> | > From:  on behalf of Doug Ambrisko <
ambri...@ambrisko.com>
> | > Date: 2016-10-14, Friday at 10:27
> | > To: Warner Losh 
> | > Cc: Doug Ambrisko , src-committers <
src-committ...@freebsd.org>, "svn-src-...@freebsd.org" <
svn-src-...@freebsd.org>, "svn-src-head@freebsd.org" <
svn-src-head@freebsd.org>
> | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader
> | >
> | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote:
> | > | Love the functionality, but don't like using the 'hint' namespace
for
> | > | this. Can we change it now before too many things depend on it? We
had
> | > | similar issues in ACPI and moved it to the 'acpi' space. Can we move
> | > | this to the 'smbios' space please?
> | > |
> | > | The reason is that 'hint' is special and sometimes filtered out, so
it
> | > | is a poor choice to export data from the boot loader to the kernel.
> | >
> | > The reason I picked hint was it could be put /boot/device.hints
> | > to make it work as well and that it was a hint.  Other standards in
the
> | > future might use other methods.  Looking back over the email I had
> | > with John he had suggested hint.smbios.0.anchor to make this look
> | > different.  This code had been hanging around for so long I forgot
> | > about that and we were using hint.smbios.0.mem in our shipping code
base.
> | >
> | > However, I hope that nothing would use this except for smbios(4) and
> | > for people to make smbios(4) useful for this info.
> |
> | Doug's looking at me when he says that. :-)
> |
> | We talked about this last night at BAFUG; right now, even if smbios(4)
> | is able to find the SMBIOS info -- it currently only looks at the
> | aforementioned 0xf - 0xf range, so it can't find it on UEFI --
> | smbios(4) doesn't actually provide any interface for that information.
> | Doug and I have talked about making smbios(4) useful, by parsing the
> | data and providing KPIs and APIs, for years now; I think I'll *finally*
> | have the time and motivation to do so "soon".
>
> I've actually talked to a few people.  However, your the first to
> step up.  This needs to be designed and will take some time and
> review.  I would hope that except for smbios(4), nothing else would
> use this kenv but there is nothing to prevent that :-(  I could name
> it super_secret_dont_use.
>
> BTW, to get you started this patch prevents smbios(4) from blowing chunks
> when it gets a anchor in high memory and works on legacy machines.
>
> --- /sys/x86/bios/smbios.c  2013-10-01 14:28:25.0 -0700
> +++ ./smbios.c  2016-04-11 11:58:03.234969000 -0700
> @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -59,7 +60,7 @@ struct smbios_softc {
>  };
>
>  #defineRES2EPS(res)((struct smbios_eps
*)rman_get_virtual(res))
> -#defineADDR2EPS(addr)  ((struct smbios_eps
*)BIOS_PADDRTOVADDR(addr))
> +#defineADDR2EPS(addr)  ((struct smbios_eps *)PHYS_TO_DMAP(addr))
>
>  static devclass_t  smbios_devclass;
>
> @@ -71,19 +72,26 @@ static int  smbios_modevent (module_t, in
>
>  static int smbios_cksum(struct smbios_eps *);
>
> +static unsigned long addr;
> +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0,
> +"SMBIOS driver parameters");
> +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW,
> +, 0, "");
> +
>  static void
>  smbios_identify (driver_t *driver, device_t parent)
>  {
> device_t child;
> -   u_int32_t addr;
> int length;
> int rid;
>
> if (!device_is_alive(parent))
> return;
>
> -   addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
> - SMBIOS_STEP, SMBIOS_OFF);
> +   if (resource_long_value("smbios", 0, "mem", ) != 0 ||
> +   addr == 0)
> +   addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG,
SMBIOS_LEN,
> + SMBIOS_STEP, SMBIOS_OFF);
> if (addr != 0) {
> rid = 0;
> length = ADDR2EPS(addr)->length;
>
> Note I don't plan to commit this since it doesn't really do much and we
> need a lot more.

I was planning on exporting all smbios stuff via sysctl.

You can still put non hints.* in device.hints too.

I can rework things a bit to be more complete is you like...

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


Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Doug Ambrisko
On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote:
| -Original Message-
| > From:  on behalf of Doug Ambrisko 

| > Date: 2016-10-14, Friday at 10:27
| > To: Warner Losh 
| > Cc: Doug Ambrisko , src-committers 
, "svn-src-...@freebsd.org" 
, "svn-src-head@freebsd.org" 
| > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader
| > 
| > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote:
| > | Love the functionality, but don't like using the 'hint' namespace for
| > | this. Can we change it now before too many things depend on it? We had
| > | similar issues in ACPI and moved it to the 'acpi' space. Can we move
| > | this to the 'smbios' space please?
| > | 
| > | The reason is that 'hint' is special and sometimes filtered out, so it
| > | is a poor choice to export data from the boot loader to the kernel.
| > 
| > The reason I picked hint was it could be put /boot/device.hints
| > to make it work as well and that it was a hint.  Other standards in the
| > future might use other methods.  Looking back over the email I had
| > with John he had suggested hint.smbios.0.anchor to make this look
| > different.  This code had been hanging around for so long I forgot
| > about that and we were using hint.smbios.0.mem in our shipping code base.
| > 
| > However, I hope that nothing would use this except for smbios(4) and
| > for people to make smbios(4) useful for this info.
| 
| Doug's looking at me when he says that. :-)
| 
| We talked about this last night at BAFUG; right now, even if smbios(4) 
| is able to find the SMBIOS info -- it currently only looks at the 
| aforementioned 0xf - 0xf range, so it can't find it on UEFI -- 
| smbios(4) doesn't actually provide any interface for that information. 
| Doug and I have talked about making smbios(4) useful, by parsing the 
| data and providing KPIs and APIs, for years now; I think I'll *finally* 
| have the time and motivation to do so "soon".

I've actually talked to a few people.  However, your the first to
step up.  This needs to be designed and will take some time and
review.  I would hope that except for smbios(4), nothing else would
use this kenv but there is nothing to prevent that :-(  I could name
it super_secret_dont_use.

BTW, to get you started this patch prevents smbios(4) from blowing chunks
when it gets a anchor in high memory and works on legacy machines.

--- /sys/x86/bios/smbios.c  2013-10-01 14:28:25.0 -0700
+++ ./smbios.c  2016-04-11 11:58:03.234969000 -0700
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -59,7 +60,7 @@ struct smbios_softc {
 };
 
 #defineRES2EPS(res)((struct smbios_eps *)rman_get_virtual(res))
-#defineADDR2EPS(addr)  ((struct smbios_eps *)BIOS_PADDRTOVADDR(addr))
+#defineADDR2EPS(addr)  ((struct smbios_eps *)PHYS_TO_DMAP(addr))
 
 static devclass_t  smbios_devclass;
 
@@ -71,19 +72,26 @@ static int  smbios_modevent (module_t, in
 
 static int smbios_cksum(struct smbios_eps *);
 
+static unsigned long addr;
+static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0,
+"SMBIOS driver parameters");
+SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW,
+, 0, "");
+
 static void
 smbios_identify (driver_t *driver, device_t parent)
 {
device_t child;
-   u_int32_t addr;
int length;
int rid;
 
if (!device_is_alive(parent))
return;
 
-   addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
- SMBIOS_STEP, SMBIOS_OFF);
+   if (resource_long_value("smbios", 0, "mem", ) != 0 ||
+   addr == 0)
+   addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
+ SMBIOS_STEP, SMBIOS_OFF);
if (addr != 0) {
rid = 0;
length = ADDR2EPS(addr)->length;

Note I don't plan to commit this since it doesn't really do much and we
need a lot more.

Thanks,

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


svn commit: r307328 - head/sys/arm64/broadcom/bcm2837

2016-10-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Oct 14 17:40:48 2016
New Revision: 307328
URL: https://svnweb.freebsd.org/changeset/base/307328

Log:
  Remove redundant kern_clocksource.c. It is already in conf/files.arm64
  
  Reported by:  andrew

Modified:
  head/sys/arm64/broadcom/bcm2837/files.bcm2837

Modified: head/sys/arm64/broadcom/bcm2837/files.bcm2837
==
--- head/sys/arm64/broadcom/bcm2837/files.bcm2837   Fri Oct 14 17:25:29 
2016(r307327)
+++ head/sys/arm64/broadcom/bcm2837/files.bcm2837   Fri Oct 14 17:40:48 
2016(r307328)
@@ -1,4 +1,3 @@
 # $FreeBSD$
 
 arm/broadcom/bcm2835/bcm2836.c standard
-kern/kern_clocksource.cstandard
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Doug Ambrisko 
> 
> Date: 2016-10-14, Friday at 10:27
> To: Warner Losh 
> Cc: Doug Ambrisko , src-committers 
> , "svn-src-...@freebsd.org" 
> , "svn-src-head@freebsd.org" 
> 
> Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader
> 
> On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote:
> | Love the functionality, but don't like using the 'hint' namespace for
> | this. Can we change it now before too many things depend on it? We had
> | similar issues in ACPI and moved it to the 'acpi' space. Can we move
> | this to the 'smbios' space please?
> | 
> | The reason is that 'hint' is special and sometimes filtered out, so it
> | is a poor choice to export data from the boot loader to the kernel.
> 
> The reason I picked hint was it could be put /boot/device.hints
> to make it work as well and that it was a hint.  Other standards in the
> future might use other methods.  Looking back over the email I had
> with John he had suggested hint.smbios.0.anchor to make this look
> different.  This code had been hanging around for so long I forgot
> about that and we were using hint.smbios.0.mem in our shipping code base.
> 
> However, I hope that nothing would use this except for smbios(4) and
> for people to make smbios(4) useful for this info.

Doug's looking at me when he says that. :-)

We talked about this last night at BAFUG; right now, even if smbios(4) is able 
to find the SMBIOS info -- it currently only looks at the aforementioned 
0xf - 0xf range, so it can't find it on UEFI -- smbios(4) doesn't 
actually provide any interface for that information. Doug and I have talked 
about making smbios(4) useful, by parsing the data and providing KPIs and APIs, 
for years now; I think I'll *finally* have the time and motivation to do so 
"soon".

-Ravi (rpokala@)

> Thanks,
> 
> Doug A.



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


Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Doug Ambrisko
On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote:
| Love the functionality, but don't like using the 'hint' namespace for
| this. Can we change it now before too many things depend on it? We had
| similar issues in ACPI and moved it to the 'acpi' space. Can we move
| this to the 'smbios' space please?
| 
| The reason is that 'hint' is special and sometimes filtered out, so it
| is a poor choice to export data from the boot loader to the kernel.

The reason I picked hint was it could be put /boot/device.hints
to make it work as well and that it was a hint.  Other standards in the
future might use other methods.  Looking back over the email I had
with John he had suggested hint.smbios.0.anchor to make this look
different.  This code had been hanging around for so long I forgot
about that and we were using hint.smbios.0.mem in our shipping code base.

However, I hope that nothing would use this except for smbios(4) and
for people to make smbios(4) useful for this info.

Thanks,

Doug A.
 
| On Fri, Oct 14, 2016 at 11:10 AM, Doug Ambrisko  wrote:
| > Author: ambrisko
| > Date: Fri Oct 14 17:10:53 2016
| > New Revision: 307326
| > URL: https://svnweb.freebsd.org/changeset/base/307326
| >
| > Log:
| >   In UEFI mode expose the SMBIOS anchor base address via kenv so the kernel
| >   etc. can find out where the SMBIOS entry point is located.  In pure
| >   UEFI mode the BIOS is not mapped into the standard address space so the
| >   SMBIOS table might not appear between 0xf and 0xf.  The
| >   UEFI environment can report this the location of the anchor.  If it is
| >   reported then expose it as hint.smbios.0.mem.  This can then be used
| >   by other tools.  However, we should make smbios(4) useful and have it
| >   take this value and provide accesor function so ipmi(4) etc. don't
| >   have to parse and figure things about the SMBIOS table.  I have some
| >   simple patches to smbios(4) to expose this address as sysctl and
| >   for ipmi(4) to get the base address.  However, the real fix is to
| >   have ipmi(4) ask smbios(4) for what it wants and have smbios(4)
| >   parse it out and return it.  This would make smbios(4) useful and reduce
| >   duplicated code.  If this address doesn't point to the anchor then
| >   finding SMBIOS info. will fail as if this didn't exist.  So there should
| >   be no harm.
| >
| >   With this change and the following hack, dmidecode works on a bunch of
| >   UEFI machines that I tested:
| >
| > if kenv hint.smbios.0.mem > /dev/null
| > then
| >   mkdir -p /sys/firmware/efi
| >   mount -t tmpfs -o size=8k tmpfs /sys/firmware/efi
| >   echo "SMBIOS=`kenv hint.smbios.0.mem`" > /sys/firmware/efi/systab
| > fi
| >
| >   Linux exposes this information via the /sys/firmware/efi/systab file which
| >   dmidecode looks at.  We should update dmidecode to do this the FreeBSD
| >   way when we determine what that is!
| >
| >   Reviewed by:  jhb
| >
| > Modified:
| >   head/sys/boot/efi/loader/main.c
| >
| > Modified: head/sys/boot/efi/loader/main.c
| > 
==
| > --- head/sys/boot/efi/loader/main.c Fri Oct 14 17:04:07 2016
(r307325)
| > +++ head/sys/boot/efi/loader/main.c Fri Oct 14 17:10:53 2016
(r307326)
| > @@ -235,6 +235,7 @@ main(int argc, CHAR16 *argv[])
| > uint64_t pool_guid;
| > UINTN k;
| > int has_kbd;
| > +   char buf[40];
| >
| > archsw.arch_autoload = efi_autoload;
| > archsw.arch_getdev = efi_getdev;
| > @@ -447,6 +448,9 @@ main(int argc, CHAR16 *argv[])
| > for (k = 0; k < ST->NumberOfTableEntries; k++) {
| > guid = >ConfigurationTable[k].VendorGuid;
| > if (!memcmp(guid, , sizeof(EFI_GUID))) {
| > +   snprintf(buf, sizeof(buf), "%p",
| > +   ST->ConfigurationTable[k].VendorTable);
| > +   setenv("hint.smbios.0.mem", buf, 1);
| > 
smbios_detect(ST->ConfigurationTable[k].VendorTable);
| > break;
| > }
| > @@ -603,7 +607,8 @@ command_configuration(int argc, char *ar
| > else if (!memcmp(guid, , sizeof(EFI_GUID)))
| > printf("ACPI 2.0 Table");
| > else if (!memcmp(guid, , sizeof(EFI_GUID)))
| > -   printf("SMBIOS Table");
| > +   printf("SMBIOS Table %p",
| > +   ST->ConfigurationTable[i].VendorTable);
| > else if (!memcmp(guid, , sizeof(EFI_GUID)))
| > printf("DXE Table");
| > else if (!memcmp(guid, , sizeof(EFI_GUID)))
| >
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

Re: svn commit: r307252 - head/sys/arm/broadcom/bcm2835

2016-10-14 Thread Oleksandr Tymoshenko

> On Oct 14, 2016, at 1:37 AM, Andrew Turner  wrote:
> 
> On Fri, 14 Oct 2016 03:00:53 + (UTC)
> Oleksandr Tymoshenko  wrote:
> 
>> Author: gonzo
>> Date: Fri Oct 14 03:00:53 2016
>> New Revision: 307252
>> URL: https://svnweb.freebsd.org/changeset/base/307252
>> 
>> Log:
>>  Make bcm2835_machdep.c optional
>> 
>>  bcm2835_machdep.c contains only bits enabled by "options PLATFORM",
>> this option available only on ARM, not ARM64
>> 
>> Modified:
>>  head/sys/arm/broadcom/bcm2835/files.bcm283x
>> 
>> Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x
>> ==
>> --- head/sys/arm/broadcom/bcm2835/files.bcm283x  Fri Oct 14 02:58:31 
>> 2016(r307251)
>> +++ head/sys/arm/broadcom/bcm2835/files.bcm283x  Fri Oct 14 03:00:53 
>> 2016(r307252)
>> @@ -9,7 +9,7 @@ arm/broadcom/bcm2835/bcm2835_fbd.c   opti
>> arm/broadcom/bcm2835/bcm2835_ft5406.coptional evdev 
>> bcm2835_ft5406
>> arm/broadcom/bcm2835/bcm2835_gpio.c  optional gpio
>> arm/broadcom/bcm2835/bcm2835_intr.c  standard
>> -arm/broadcom/bcm2835/bcm2835_machdep.c  standard
>> +arm/broadcom/bcm2835/bcm2835_machdep.c  optional platform
>> arm/broadcom/bcm2835/bcm2835_mbox.c  standard
>> arm/broadcom/bcm2835/bcm2835_rng.c   optional random
>> arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci
>> 
> 
> Any of these files you need should be added to files.arm64 being
> optional on the appropriate soc_ value.

I don’t quite follow. These files are shared between ARM and ARM64 port,
does that mean they should be in both files.arm64 and files.arm? Or
in files.arm64 and files.bcm283x?


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

svn commit: r307327 - in head: sys/boot/efi/loader/arch/i386 targets/pseudo/userland/misc

2016-10-14 Thread Sean Bruno
Author: sbruno
Date: Fri Oct 14 17:25:29 2016
New Revision: 307327
URL: https://svnweb.freebsd.org/changeset/base/307327

Log:
  Update i386 build of loader.efi (but leave it disabled) so that we at
  least build it now.
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D7801

Modified:
  head/sys/boot/efi/loader/arch/i386/efimd.c
  head/sys/boot/efi/loader/arch/i386/elf32_freebsd.c
  head/sys/boot/efi/loader/arch/i386/exec.c
  head/targets/pseudo/userland/misc/Makefile.depend

Modified: head/sys/boot/efi/loader/arch/i386/efimd.c
==
--- head/sys/boot/efi/loader/arch/i386/efimd.c  Fri Oct 14 17:10:53 2016
(r307326)
+++ head/sys/boot/efi/loader/arch/i386/efimd.c  Fri Oct 14 17:25:29 2016
(r307327)
@@ -48,7 +48,10 @@ static EFI_GUID hcdp_guid = HCDP_TABLE_G
 
 static UINTN mapkey;
 
-uint64_t
+int ldr_bootinfo(struct bootinfo *, uint64_t *);
+int ldr_enter(const char *);
+
+static uint64_t
 ldr_alloc(vm_offset_t va)
 {
 

Modified: head/sys/boot/efi/loader/arch/i386/elf32_freebsd.c
==
--- head/sys/boot/efi/loader/arch/i386/elf32_freebsd.c  Fri Oct 14 17:10:53 
2016(r307326)
+++ head/sys/boot/efi/loader/arch/i386/elf32_freebsd.c  Fri Oct 14 17:25:29 
2016(r307327)
@@ -35,12 +35,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+
 #include "bootstrap.h"
 #include "../libi386/libi386.h"
 #include "../btx/lib/btxv86.h"
 
 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);
@@ -72,14 +76,14 @@ elf32_exec(struct preloaded_file *fp)
 ehdr = (Elf_Ehdr *)&(md->md_data);
 
 efi_time_fini();
-err = bi_load(fp->f_args, , , , , 
);
+err = bi_load(fp->f_args, , );
 if (err != 0) {
efi_time_init();
return(err);
 }
 entry = ehdr->e_entry & 0xff;
 
-printf("Start @ 0x%lx ...\n", entry);
+printf("Start @ 0x%x ...\n", entry);
 
 ldr_enter(fp->f_name);
 

Modified: head/sys/boot/efi/loader/arch/i386/exec.c
==
--- head/sys/boot/efi/loader/arch/i386/exec.c   Fri Oct 14 17:10:53 2016
(r307326)
+++ head/sys/boot/efi/loader/arch/i386/exec.c   Fri Oct 14 17:25:29 2016
(r307327)
@@ -36,6 +36,12 @@ __FBSDID("$FreeBSD$");
 uint32_t __base;
 struct __v86 __v86;
 
+/* XXX - Needed a definition here to implicitly define exit(); do not remove. 
*/
+static void
+exit(int x)
+{
+}
+
 void
 __v86int()
 {

Modified: head/targets/pseudo/userland/misc/Makefile.depend
==
--- head/targets/pseudo/userland/misc/Makefile.depend   Fri Oct 14 17:10:53 
2016(r307326)
+++ head/targets/pseudo/userland/misc/Makefile.depend   Fri Oct 14 17:25:29 
2016(r307327)
@@ -77,7 +77,7 @@ DIRDEPS.amd64+= \
 
 DIRDEPS.arm= ${_sys_boot_fdt} ${_sys_boot_efi}
 DIRDEPS.arm64= ${_sys_boot_fdt} ${_sys_boot_efi}
-DIRDEPS.i386= ${DIRDEPS.x86sys} sys/boot/efi/libefi
+DIRDEPS.i386= ${DIRDEPS.x86sys} ${_sys_boot_efi}
 DIRDEPS.powerpc= ${_sys_boot_fdt} sys/boot/libstand32 sys/boot/ofw 
sys/boot/uboot
 DIRDEPS.pc98= sys/boot/libstand32
 DIRDEPS.sparc64= sys/boot/ofw ${_sys_boot_zfs}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Warner Losh 
> 
> Date: 2016-10-14, Friday at 10:16
> To: Doug Ambrisko 
> Cc: src-committers , "svn-src-...@freebsd.org" 
> , "svn-src-head@freebsd.org" 
> 
> Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader
> 
> Love the functionality,

Ditto! Thank you Doug! :-)

> but don't like using the 'hint' namespace for
> this. Can we change it now before too many things depend on it? We had
> similar issues in ACPI and moved it to the 'acpi' space. Can we move
> this to the 'smbios' space please?
> 
> The reason is that 'hint' is special and sometimes filtered out, so it
> is a poor choice to export data from the boot loader to the kernel.

Loader already exports a bunch of stuff as "smbios.*" kenv variables. So 
perhaps "smbios.addr" or somesuch?

Thanks,

Ravi (rpokala@)

> Warner
> 
> On Fri, Oct 14, 2016 at 11:10 AM, Doug Ambrisko  wrote:
>> Author: ambrisko
>> Date: Fri Oct 14 17:10:53 2016
>> New Revision: 307326
>> URL: https://svnweb.freebsd.org/changeset/base/307326
>>
>> Log:
>>   In UEFI mode expose the SMBIOS anchor base address via kenv so the kernel
>>   etc. can find out where the SMBIOS entry point is located.  In pure
>>   UEFI mode the BIOS is not mapped into the standard address space so the
>>   SMBIOS table might not appear between 0xf and 0xf.  The
>>   UEFI environment can report this the location of the anchor.  If it is
>>   reported then expose it as hint.smbios.0.mem.  This can then be used
>>   by other tools.  However, we should make smbios(4) useful and have it
>>   take this value and provide accesor function so ipmi(4) etc. don't
>>   have to parse and figure things about the SMBIOS table.  I have some
>>   simple patches to smbios(4) to expose this address as sysctl and
>>   for ipmi(4) to get the base address.  However, the real fix is to
>>   have ipmi(4) ask smbios(4) for what it wants and have smbios(4)
>>   parse it out and return it.  This would make smbios(4) useful and reduce
>>   duplicated code.  If this address doesn't point to the anchor then
>>   finding SMBIOS info. will fail as if this didn't exist.  So there should
>>   be no harm.
>>
>>   With this change and the following hack, dmidecode works on a bunch of
>>   UEFI machines that I tested:
>>
>> if kenv hint.smbios.0.mem > /dev/null
>> then
>>   mkdir -p /sys/firmware/efi
>>   mount -t tmpfs -o size=8k tmpfs /sys/firmware/efi
>>   echo "SMBIOS=`kenv hint.smbios.0.mem`" > /sys/firmware/efi/systab
>> fi
>>
>>   Linux exposes this information via the /sys/firmware/efi/systab file which
>>   dmidecode looks at.  We should update dmidecode to do this the FreeBSD
>>   way when we determine what that is!
>>
>>   Reviewed by:  jhb
>>
>> Modified:
>>   head/sys/boot/efi/loader/main.c
>>
>> Modified: head/sys/boot/efi/loader/main.c
>> ==
>> --- head/sys/boot/efi/loader/main.c Fri Oct 14 17:04:07 2016
>> (r307325)
>> +++ head/sys/boot/efi/loader/main.c Fri Oct 14 17:10:53 2016
>> (r307326)
>> @@ -235,6 +235,7 @@ main(int argc, CHAR16 *argv[])
>> uint64_t pool_guid;
>> UINTN k;
>> int has_kbd;
>> +   char buf[40];
>>
>> archsw.arch_autoload = efi_autoload;
>> archsw.arch_getdev = efi_getdev;
>> @@ -447,6 +448,9 @@ main(int argc, CHAR16 *argv[])
>> for (k = 0; k < ST->NumberOfTableEntries; k++) {
>> guid = >ConfigurationTable[k].VendorGuid;
>> if (!memcmp(guid, , sizeof(EFI_GUID))) {
>> +   snprintf(buf, sizeof(buf), "%p",
>> +   ST->ConfigurationTable[k].VendorTable);
>> +   setenv("hint.smbios.0.mem", buf, 1);
>> smbios_detect(ST->ConfigurationTable[k].VendorTable);
>> break;
>> }
>> @@ -603,7 +607,8 @@ command_configuration(int argc, char *ar
>> else if (!memcmp(guid, , sizeof(EFI_GUID)))
>> printf("ACPI 2.0 Table");
>> else if (!memcmp(guid, , sizeof(EFI_GUID)))
>> -   printf("SMBIOS Table");
>> +   printf("SMBIOS Table %p",
>> +   ST->ConfigurationTable[i].VendorTable);
>> else if (!memcmp(guid, , sizeof(EFI_GUID)))
>> printf("DXE Table");
>> else if (!memcmp(guid, , sizeof(EFI_GUID)))
>>



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


Re: svn commit: r307257 - in head/sys: arm/broadcom/bcm2835 arm64/broadcom arm64/broadcom/bcm2837 arm64/conf conf

2016-10-14 Thread Oleksandr Tymoshenko

> On Oct 14, 2016, at 1:31 AM, Andrew Turner  wrote:
> 
> On Fri, 14 Oct 2016 03:37:36 + (UTC)
> Oleksandr Tymoshenko > wrote:
> 
>> Author: gonzo
>> Date: Fri Oct 14 03:37:35 2016
>> New Revision: 307257
>> URL: https://svnweb.freebsd.org/changeset/base/307257
>> 
>> Log:
>>  Add initial Raspberry Pi 3 support
>> 
>>  RPI3 kernel config builds kernel compatible with latest upstream
>> device tree and firmware:
>> https://github.com/raspberrypi/firmware/tree/master/boot As of today
>> it's 597c662a613df1144a6bc43e5f4505d83bd748ca 
>>  Default console is PL01x, so pi3-disable-bt dt overlay should be
>> configured in config.txt and stock U-Boot should be patched to use
>> proper serial port. 
>>  Yet unsupported: SMP, VCHIQ, RNG driver. RNG requires some work due
>> to upstream device tree incompatibility.
>> 
>>  Multiple people contributed to this work over time: db@, loos@,
>> manu@
>> 
>> Added:
>>  head/sys/arm64/broadcom/
>>  head/sys/arm64/broadcom/bcm2837/
>>  head/sys/arm64/broadcom/bcm2837/files.bcm2837   (contents, props
>> changed) head/sys/arm64/conf/RPI3   (contents, props changed)
>> Modified:
>>  head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
>>  head/sys/conf/options.arm64
>> 
>> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
>> ==
>> --- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.hFri Oct 14
>> 03:32:20 2016(r307256) +++
>> head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.hFri Oct 14
>> 03:37:35 2016(r307257) @@ -37,7 +37,7 @@ #define
>> BCM2835_VCBUS_IO_BASE0x7E00 #define
>> BCM2835_VCBUS_SDRAM_UNCACHED 0xC000 
>> -#ifdef SOC_BCM2836
>> +#if defined(SOC_BCM2836) || defined(SOC_BCM2837)
> 
> You could reverse the logic here to:
> #ifdef SOC_BCM2835
> <2835 macros>
> #else
> 
> #endif
> 
>> #define  BCM2835_ARM_IO_BASE 0x3f00
>> #define  BCM2835_VCBUS_SDRAM_BASE
>> BCM2835_VCBUS_SDRAM_UNCACHED #else
>> 
>> Added: head/sys/arm64/broadcom/bcm2837/files.bcm2837
>> ==
>> --- /dev/null00:00:00 1970   (empty, because file is
>> newly added) +++ head/sys/arm64/broadcom/bcm2837/files.bcm2837
>> Fri Oct 14 03:37:35 2016 (r307257) @@ -0,0 +1,4 @@
>> +# $FreeBSD$
>> +
>> +arm/broadcom/bcm2835/bcm2836.c  standard
> This should be in files.arm64 and enabled when the SOC_ option is set.
> 
>> +kern/kern_clocksource.c standard
> This is already in files.arm64.

Thanks, I will fix these. 

>> 
>> Added: head/sys/arm64/conf/RPI3
> 
> Why a new kernel config and not GENERIC?
I thought about it. But no SMP support yet. When we have SMP support we can get 
rid of RPI3 config. 


> ...
>> Modified: head/sys/conf/options.arm64
>> ==
>> --- head/sys/conf/options.arm64  Fri Oct 14 03:32:20
>> 2016 (r307256) +++ head/sys/conf/options.arm64   Fri Oct
>> 14 03:37:35 2016 (r307257) @@ -9,5 +9,6 @@
>> VFP  opt_global.h 
>> # SoC Support
>> SOC_ALLWINNER_A64opt_soc.h
>> +SOC_BCM2837 opt_global.h
> This should be SOC_BRCM_BCM2837 (or maybe SOC_BRCM_BCM283X) and live in
> opt_soc.h


This one to match ARM SOC_XXX pattern. All SOC_ for arm reside in opt_global,
since BCM SoC files are used in ARM and ARM64 files they will need to include
two files to get options from the same category. Probably we should convert all 
SOC_XXX
opts to opt_soc.h for consistency, but I didn’t want to do this in this change. 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Warner Losh
Love the functionality, but don't like using the 'hint' namespace for
this. Can we change it now before too many things depend on it? We had
similar issues in ACPI and moved it to the 'acpi' space. Can we move
this to the 'smbios' space please?

The reason is that 'hint' is special and sometimes filtered out, so it
is a poor choice to export data from the boot loader to the kernel.

Warner

On Fri, Oct 14, 2016 at 11:10 AM, Doug Ambrisko  wrote:
> Author: ambrisko
> Date: Fri Oct 14 17:10:53 2016
> New Revision: 307326
> URL: https://svnweb.freebsd.org/changeset/base/307326
>
> Log:
>   In UEFI mode expose the SMBIOS anchor base address via kenv so the kernel
>   etc. can find out where the SMBIOS entry point is located.  In pure
>   UEFI mode the BIOS is not mapped into the standard address space so the
>   SMBIOS table might not appear between 0xf and 0xf.  The
>   UEFI environment can report this the location of the anchor.  If it is
>   reported then expose it as hint.smbios.0.mem.  This can then be used
>   by other tools.  However, we should make smbios(4) useful and have it
>   take this value and provide accesor function so ipmi(4) etc. don't
>   have to parse and figure things about the SMBIOS table.  I have some
>   simple patches to smbios(4) to expose this address as sysctl and
>   for ipmi(4) to get the base address.  However, the real fix is to
>   have ipmi(4) ask smbios(4) for what it wants and have smbios(4)
>   parse it out and return it.  This would make smbios(4) useful and reduce
>   duplicated code.  If this address doesn't point to the anchor then
>   finding SMBIOS info. will fail as if this didn't exist.  So there should
>   be no harm.
>
>   With this change and the following hack, dmidecode works on a bunch of
>   UEFI machines that I tested:
>
> if kenv hint.smbios.0.mem > /dev/null
> then
>   mkdir -p /sys/firmware/efi
>   mount -t tmpfs -o size=8k tmpfs /sys/firmware/efi
>   echo "SMBIOS=`kenv hint.smbios.0.mem`" > /sys/firmware/efi/systab
> fi
>
>   Linux exposes this information via the /sys/firmware/efi/systab file which
>   dmidecode looks at.  We should update dmidecode to do this the FreeBSD
>   way when we determine what that is!
>
>   Reviewed by:  jhb
>
> Modified:
>   head/sys/boot/efi/loader/main.c
>
> Modified: head/sys/boot/efi/loader/main.c
> ==
> --- head/sys/boot/efi/loader/main.c Fri Oct 14 17:04:07 2016
> (r307325)
> +++ head/sys/boot/efi/loader/main.c Fri Oct 14 17:10:53 2016
> (r307326)
> @@ -235,6 +235,7 @@ main(int argc, CHAR16 *argv[])
> uint64_t pool_guid;
> UINTN k;
> int has_kbd;
> +   char buf[40];
>
> archsw.arch_autoload = efi_autoload;
> archsw.arch_getdev = efi_getdev;
> @@ -447,6 +448,9 @@ main(int argc, CHAR16 *argv[])
> for (k = 0; k < ST->NumberOfTableEntries; k++) {
> guid = >ConfigurationTable[k].VendorGuid;
> if (!memcmp(guid, , sizeof(EFI_GUID))) {
> +   snprintf(buf, sizeof(buf), "%p",
> +   ST->ConfigurationTable[k].VendorTable);
> +   setenv("hint.smbios.0.mem", buf, 1);
> smbios_detect(ST->ConfigurationTable[k].VendorTable);
> break;
> }
> @@ -603,7 +607,8 @@ command_configuration(int argc, char *ar
> else if (!memcmp(guid, , sizeof(EFI_GUID)))
> printf("ACPI 2.0 Table");
> else if (!memcmp(guid, , sizeof(EFI_GUID)))
> -   printf("SMBIOS Table");
> +   printf("SMBIOS Table %p",
> +   ST->ConfigurationTable[i].VendorTable);
> else if (!memcmp(guid, , sizeof(EFI_GUID)))
> printf("DXE Table");
> else if (!memcmp(guid, , sizeof(EFI_GUID)))
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307326 - head/sys/boot/efi/loader

2016-10-14 Thread Doug Ambrisko
Author: ambrisko
Date: Fri Oct 14 17:10:53 2016
New Revision: 307326
URL: https://svnweb.freebsd.org/changeset/base/307326

Log:
  In UEFI mode expose the SMBIOS anchor base address via kenv so the kernel
  etc. can find out where the SMBIOS entry point is located.  In pure
  UEFI mode the BIOS is not mapped into the standard address space so the
  SMBIOS table might not appear between 0xf and 0xf.  The
  UEFI environment can report this the location of the anchor.  If it is
  reported then expose it as hint.smbios.0.mem.  This can then be used
  by other tools.  However, we should make smbios(4) useful and have it
  take this value and provide accesor function so ipmi(4) etc. don't
  have to parse and figure things about the SMBIOS table.  I have some
  simple patches to smbios(4) to expose this address as sysctl and
  for ipmi(4) to get the base address.  However, the real fix is to
  have ipmi(4) ask smbios(4) for what it wants and have smbios(4)
  parse it out and return it.  This would make smbios(4) useful and reduce
  duplicated code.  If this address doesn't point to the anchor then
  finding SMBIOS info. will fail as if this didn't exist.  So there should
  be no harm.
  
  With this change and the following hack, dmidecode works on a bunch of
  UEFI machines that I tested:
  
if kenv hint.smbios.0.mem > /dev/null
then
  mkdir -p /sys/firmware/efi
  mount -t tmpfs -o size=8k tmpfs /sys/firmware/efi
  echo "SMBIOS=`kenv hint.smbios.0.mem`" > /sys/firmware/efi/systab
fi
  
  Linux exposes this information via the /sys/firmware/efi/systab file which
  dmidecode looks at.  We should update dmidecode to do this the FreeBSD
  way when we determine what that is!
  
  Reviewed by:  jhb

Modified:
  head/sys/boot/efi/loader/main.c

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Fri Oct 14 17:04:07 2016
(r307325)
+++ head/sys/boot/efi/loader/main.c Fri Oct 14 17:10:53 2016
(r307326)
@@ -235,6 +235,7 @@ main(int argc, CHAR16 *argv[])
uint64_t pool_guid;
UINTN k;
int has_kbd;
+   char buf[40];
 
archsw.arch_autoload = efi_autoload;
archsw.arch_getdev = efi_getdev;
@@ -447,6 +448,9 @@ main(int argc, CHAR16 *argv[])
for (k = 0; k < ST->NumberOfTableEntries; k++) {
guid = >ConfigurationTable[k].VendorGuid;
if (!memcmp(guid, , sizeof(EFI_GUID))) {
+   snprintf(buf, sizeof(buf), "%p",
+   ST->ConfigurationTable[k].VendorTable);
+   setenv("hint.smbios.0.mem", buf, 1);
smbios_detect(ST->ConfigurationTable[k].VendorTable);
break;
}
@@ -603,7 +607,8 @@ command_configuration(int argc, char *ar
else if (!memcmp(guid, , sizeof(EFI_GUID)))
printf("ACPI 2.0 Table");
else if (!memcmp(guid, , sizeof(EFI_GUID)))
-   printf("SMBIOS Table");
+   printf("SMBIOS Table %p",
+   ST->ConfigurationTable[i].VendorTable);
else if (!memcmp(guid, , sizeof(EFI_GUID)))
printf("DXE Table");
else if (!memcmp(guid, , sizeof(EFI_GUID)))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307325 - head/lib

2016-10-14 Thread Ed Maste
Author: emaste
Date: Fri Oct 14 17:04:07 2016
New Revision: 307325
URL: https://svnweb.freebsd.org/changeset/base/307325

Log:
  Simplify logic for libproc and librtld_db in lib/Makefile

Modified:
  head/lib/Makefile

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Fri Oct 14 16:23:12 2016(r307324)
+++ head/lib/Makefile   Fri Oct 14 17:04:07 2016(r307325)
@@ -166,26 +166,13 @@ SUBDIR.${MK_NIS}+=libypclnt
 
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
 _libvgl=   libvgl
-_libproc=  libproc
-_librtld_db=   librtld_db
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
 SUBDIR.${MK_BHYVE}+=   libvmmapi
 .endif
 
-.if ${MACHINE_CPUARCH} == "mips"
-_libproc=  libproc
-_librtld_db=   librtld_db
-.endif
-
-.if ${MACHINE_CPUARCH} == "powerpc"
-_libproc=  libproc
-_librtld_db=   librtld_db
-.endif
-
-.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \
-${MACHINE_CPUARCH} == "riscv"
+.if ${MACHINE_CPUARCH} != "sparc64"
 _libproc=  libproc
 _librtld_db=   librtld_db
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307323 - head/sys/boot/common

2016-10-14 Thread Warner Losh
Author: imp
Date: Fri Oct 14 16:23:05 2016
New Revision: 307323
URL: https://svnweb.freebsd.org/changeset/base/307323

Log:
  Remove fetching of pInterp. Currently, there's no actual effect other
  than to store the location of a forth word that is subsequently never
  used. It was last used before the 2.03 ficl upgrade in r51786. It was
  only used from r43614 (so Feb-Sept 1999) on head and in the 3.x branch
  (merged r43715 3.1 -> EOL). Remove it since nobody cared enough to
  report the bug in the last 18 years rather than fix it. It's need
  seems to have passed in the 2.03 ficl update.
  
  Differential Revision: https://reviews.freebsd.org/D8150

Modified:
  head/sys/boot/common/interp_forth.c

Modified: head/sys/boot/common/interp_forth.c
==
--- head/sys/boot/common/interp_forth.c Fri Oct 14 16:05:44 2016
(r307322)
+++ head/sys/boot/common/interp_forth.c Fri Oct 14 16:23:05 2016
(r307323)
@@ -63,7 +63,6 @@ extern char bootprog_rev[];
 
 FICL_SYSTEM *bf_sys;
 FICL_VM*bf_vm;
-FICL_WORD *pInterp;
 
 /*
  * Shim for taking commands from BF and passing them out to 'standard'
@@ -281,8 +280,6 @@ bf_init(const char *rc)
 ficlSetEnv(bf_sys, "loader_version", 
   (bootprog_rev[0] - '0') * 10 + (bootprog_rev[2] - '0'));
 
-pInterp = ficlLookup(bf_sys, "interpret");
-
 /* try to load and run init file if present */
 if (rc == NULL)
rc = "/boot/boot.4th";
@@ -293,9 +290,6 @@ bf_init(const char *rc)
close(fd);
}
 }
-
-/* Do this again, so that interpret can be redefined. */
-pInterp = ficlLookup(bf_sys, "interpret");
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307324 - in head/sys/boot: common efi/loader efi/loader/arch/amd64 efi/loader/arch/arm efi/loader/arch/arm64 efi/loader/arch/i386 ficl ficl/i386 i386/libi386 mips/beri/loader pc98/libpc98

2016-10-14 Thread Warner Losh
Author: imp
Date: Fri Oct 14 16:23:12 2016
New Revision: 307324
URL: https://svnweb.freebsd.org/changeset/base/307324

Log:
  Create a new linker set, Xficl_compile_set which contains a list of
  functions to call at the appropriate time to register new forth
  words. In the past we've done this with ifdef soup, but now if the
  file is included in the build, we'll get the new forth words.
  
  Use this new functionality to move the pci bios stuff out of loader.c
  by moving it to biospci.c.
  
  Move the pnp functionality to common/pnp.c.
  
  Move the inb/outb forth words to the i386 sysdep.c file where their
  implementation is defined.
  
  Adjust the efi linker scripts and build machinery to cope.
  
  his should be an invisible change to forth scripts and user
  experience.
  
  Differential Revision: https://reviews.freebsd.org/D8145

Modified:
  head/sys/boot/common/bootstrap.h
  head/sys/boot/common/pnp.c
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/efi/loader/arch/amd64/ldscript.amd64
  head/sys/boot/efi/loader/arch/arm/ldscript.arm
  head/sys/boot/efi/loader/arch/arm64/ldscript.arm64
  head/sys/boot/efi/loader/arch/i386/ldscript.i386
  head/sys/boot/ficl/ficl.h
  head/sys/boot/ficl/i386/sysdep.c
  head/sys/boot/ficl/loader.c
  head/sys/boot/i386/libi386/Makefile
  head/sys/boot/i386/libi386/biospci.c
  head/sys/boot/i386/libi386/libi386.h
  head/sys/boot/mips/beri/loader/loader.ldscript
  head/sys/boot/pc98/libpc98/Makefile

Modified: head/sys/boot/common/bootstrap.h
==
--- head/sys/boot/common/bootstrap.hFri Oct 14 16:23:05 2016
(r307323)
+++ head/sys/boot/common/bootstrap.hFri Oct 14 16:23:12 2016
(r307324)
@@ -142,8 +142,6 @@ struct pnpinfo
 
 STAILQ_HEAD(pnpinfo_stql, pnpinfo);
 
-extern struct pnpinfo_stql pnp_devices;
-
 extern struct pnphandler   *pnphandlers[]; /* provided by MD code 
*/
 
 void   pnp_addident(struct pnpinfo *pi, char *ident);

Modified: head/sys/boot/common/pnp.c
==
--- head/sys/boot/common/pnp.c  Fri Oct 14 16:23:05 2016(r307323)
+++ head/sys/boot/common/pnp.c  Fri Oct 14 16:23:12 2016(r307324)
@@ -17,8 +17,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include "ficl.h"
 
-struct pnpinfo_stqlpnp_devices;
+static struct pnpinfo_stql pnp_devices;
 static int pnp_devices_initted = 0;
 
 static voidpnp_discard(void);
@@ -185,3 +186,47 @@ pnp_eisaformat(u_int8_t *data)
 return(idbuf);
 }
 
+void
+ficlPnpdevices(FICL_VM *pVM)
+{
+   static int pnp_devices_initted = 0;
+#if FICL_ROBUST > 1
+   vmCheckStack(pVM, 0, 1);
+#endif
+
+   if(!pnp_devices_initted) {
+   STAILQ_INIT(_devices);
+   pnp_devices_initted = 1;
+   }
+
+   stackPushPtr(pVM->pStack, _devices);
+
+   return;
+}
+
+void
+ficlPnphandlers(FICL_VM *pVM)
+{
+#if FICL_ROBUST > 1
+   vmCheckStack(pVM, 0, 1);
+#endif
+
+   stackPushPtr(pVM->pStack, pnphandlers);
+
+   return;
+}
+
+/*
+ * Glue function to add the appropriate forth words to access pnp BIOS
+ * functionality.
+ */
+static void ficlCompilePnp(FICL_SYSTEM *pSys)
+{
+FICL_DICT *dp = pSys->dp;
+assert (dp);
+
+dictAppendWord(dp, "pnpdevices",ficlPnpdevices, FW_DEFAULT);
+dictAppendWord(dp, "pnphandlers",ficlPnphandlers, FW_DEFAULT);
+}
+
+FICL_COMPILE_SET(ficlCompilePnp);

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Fri Oct 14 16:23:05 2016
(r307323)
+++ head/sys/boot/efi/loader/Makefile   Fri Oct 14 16:23:12 2016
(r307324)
@@ -145,6 +145,7 @@ loader.efi: ${PROG}
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
+   -j set_Xficl_compile_set \
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
 
 LIBEFI=${.OBJDIR}/../libefi/libefi.a

Modified: head/sys/boot/efi/loader/arch/amd64/ldscript.amd64
==
--- head/sys/boot/efi/loader/arch/amd64/ldscript.amd64  Fri Oct 14 16:23:05 
2016(r307323)
+++ head/sys/boot/efi/loader/arch/amd64/ldscript.amd64  Fri Oct 14 16:23:12 
2016(r307324)
@@ -40,6 +40,11 @@ SECTIONS
 *(set_Xcommand_set)
 __stop_set_Xcommand_set = .;
   }
+  set_Xficl_compile_set: {
+__start_set_Xficl_compile_set = .;
+*(set_Xficl_compile_set)
+__stop_set_Xficl_compile_set = .;
+  }
   . = ALIGN(4096);
   __gp = .;
   .sdata   : {

Modified: head/sys/boot/efi/loader/arch/arm/ldscript.arm
==
--- 

svn commit: r307322 - head/sys/boot/common

2016-10-14 Thread Warner Losh
Author: imp
Date: Fri Oct 14 16:05:44 2016
New Revision: 307322
URL: https://svnweb.freebsd.org/changeset/base/307322

Log:
  The file /boot/boot.conf existed for the 3.0 release (r38764). It was
  replaced by /boot/loader.rc for 3.1 (r42682). In May 2000, this was
  documented as deprecated (r61942) (between FreeBSD 4.0 and
  4.1). Remove it since it's not been the preferred method in 17 years
  and has been deprecated for 16.
  
  Differential Revision: https://reviews.freebsd.org/D8142

Modified:
  head/sys/boot/common/interp.c
  head/sys/boot/common/loader.8

Modified: head/sys/boot/common/interp.c
==
--- head/sys/boot/common/interp.c   Fri Oct 14 15:53:48 2016
(r307321)
+++ head/sys/boot/common/interp.c   Fri Oct 14 16:05:44 2016
(r307322)
@@ -104,8 +104,7 @@ interact(const char *rc)
 
 if (rc == NULL) {
/* Read our default configuration. */
-   if (include("/boot/loader.rc") != CMD_OK)
-   include("/boot/boot.conf");
+   include("/boot/loader.rc");
 } else if (*rc != '\0')
include(rc);
 

Modified: head/sys/boot/common/loader.8
==
--- head/sys/boot/common/loader.8   Fri Oct 14 15:53:48 2016
(r307321)
+++ head/sys/boot/common/loader.8   Fri Oct 14 16:05:44 2016
(r307322)
@@ -90,9 +90,7 @@ which is
 default.
 After that,
 .Pa /boot/loader.rc
-is processed if available, and, failing that,
-.Pa /boot/boot.conf
-is read for historical reasons.
+is processed if available.
 These files are processed through the
 .Ic include
 command, which reads all of them into memory before processing them,
@@ -957,10 +955,6 @@ itself.
 Additional
 .Tn FICL
 initialization.
-.It Pa /boot/boot.conf
-.Nm
-bootstrapping script.
-Deprecated.
 .It Pa /boot/defaults/loader.conf
 .It Pa /boot/loader.conf
 .It Pa /boot/loader.conf.local
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307321 - in head/sys/arm64: arm64 include

2016-10-14 Thread Andrew Turner
Author: andrew
Date: Fri Oct 14 15:53:48 2016
New Revision: 307321
URL: https://svnweb.freebsd.org/changeset/base/307321

Log:
  Rework how we store the VFP registers in the pcb. This will be used when
  creating a floating-point context within the kernel without having to move
  the stored values in memory.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/vfp.c
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/arm64/include/pcb.h
  head/sys/arm64/include/vfp.h

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Fri Oct 14 15:16:44 2016
(r307320)
+++ head/sys/arm64/arm64/machdep.c  Fri Oct 14 15:53:48 2016
(r307321)
@@ -192,9 +192,12 @@ fill_fpregs(struct thread *td, struct fp
 */
vfp_save_state(td, pcb);
 
-   memcpy(regs->fp_q, pcb->pcb_vfp, sizeof(regs->fp_q));
-   regs->fp_cr = pcb->pcb_fpcr;
-   regs->fp_sr = pcb->pcb_fpsr;
+   KASSERT(pcb->pcb_fpusaved == >pcb_fpustate,
+   ("Called fill_fpregs while the kernel is using the VFP"));
+   memcpy(regs->fp_q, pcb->pcb_fpustate.vfp_regs,
+   sizeof(regs->fp_q));
+   regs->fp_cr = pcb->pcb_fpustate.vfp_fpcr;
+   regs->fp_sr = pcb->pcb_fpustate.vfp_fpsr;
} else
 #endif
memset(regs->fp_q, 0, sizeof(regs->fp_q));
@@ -208,9 +211,11 @@ set_fpregs(struct thread *td, struct fpr
struct pcb *pcb;
 
pcb = td->td_pcb;
-   memcpy(pcb->pcb_vfp, regs->fp_q, sizeof(regs->fp_q));
-   pcb->pcb_fpcr = regs->fp_cr;
-   pcb->pcb_fpsr = regs->fp_sr;
+   KASSERT(pcb->pcb_fpusaved == >pcb_fpustate,
+   ("Called set_fpregs while the kernel is using the VFP"));
+   memcpy(pcb->pcb_fpustate.vfp_regs, regs->fp_q, sizeof(regs->fp_q));
+   pcb->pcb_fpustate.vfp_fpcr = regs->fp_cr;
+   pcb->pcb_fpustate.vfp_fpsr = regs->fp_sr;
 #endif
return (0);
 }
@@ -334,10 +339,12 @@ get_fpcontext(struct thread *td, mcontex
 */
vfp_save_state(td, curpcb);
 
-   memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_vfp,
+   KASSERT(curpcb->pcb_fpusaved == >pcb_fpustate,
+   ("Called get_fpcontext while the kernel is using the VFP"));
+   memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs,
sizeof(mcp->mc_fpregs));
-   mcp->mc_fpregs.fp_cr = curpcb->pcb_fpcr;
-   mcp->mc_fpregs.fp_sr = curpcb->pcb_fpsr;
+   mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr;
+   mcp->mc_fpregs.fp_sr = curpcb->pcb_fpustate.vfp_fpsr;
mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags;
mcp->mc_flags |= _MC_FP_VALID;
}
@@ -363,10 +370,12 @@ set_fpcontext(struct thread *td, mcontex
 */
vfp_discard(td);
 
-   memcpy(curpcb->pcb_vfp, mcp->mc_fpregs.fp_q,
+   KASSERT(curpcb->pcb_fpusaved == >pcb_fpustate,
+   ("Called set_fpcontext while the kernel is using the VFP"));
+   memcpy(curpcb->pcb_fpustate.vfp_regs, mcp->mc_fpregs.fp_q,
sizeof(mcp->mc_fpregs));
-   curpcb->pcb_fpcr = mcp->mc_fpregs.fp_cr;
-   curpcb->pcb_fpsr = mcp->mc_fpregs.fp_sr;
+   curpcb->pcb_fpustate.vfp_fpcr = mcp->mc_fpregs.fp_cr;
+   curpcb->pcb_fpustate.vfp_fpsr = mcp->mc_fpregs.fp_sr;
curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags;
}
 
@@ -607,6 +616,7 @@ init_proc0(vm_offset_t kstack)
thread0.td_kstack = kstack;
thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1;
thread0.td_pcb->pcb_fpflags = 0;
+   thread0.td_pcb->pcb_fpusaved = _pcb->pcb_fpustate;
thread0.td_pcb->pcb_vfpcpu = UINT_MAX;
thread0.td_frame = _tf;
pcpup->pc_curpcb = thread0.td_pcb;

Modified: head/sys/arm64/arm64/vfp.c
==
--- head/sys/arm64/arm64/vfp.c  Fri Oct 14 15:16:44 2016(r307320)
+++ head/sys/arm64/arm64/vfp.c  Fri Oct 14 15:53:48 2016(r307321)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -42,7 +43,10 @@ __FBSDID("$FreeBSD$");
 #include 
 
 /* Sanity check we can store all the VFP registers */
-CTASSERT(sizeof(((struct pcb *)0)->pcb_vfp) == 16 * 32);
+CTASSERT(sizeof(((struct pcb *)0)->pcb_fpustate.vfp_regs) == 16 * 32);
+
+static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx",
+"Kernel contexts for VFP state");
 
 static void
 vfp_enable(void)
@@ -81,11 +85,73 @@ vfp_discard(struct thread *td)
vfp_disable();
 }
 
-void
-vfp_save_state(struct thread *td, struct pcb *pcb)
+static void
+vfp_store(struct 

svn commit: r307320 - head/release/picobsd/build

2016-10-14 Thread Luigi Rizzo
Author: luigi
Date: Fri Oct 14 15:16:44 2016
New Revision: 307320
URL: https://svnweb.freebsd.org/changeset/base/307320

Log:
  adjust picobsd script to work with HEAD

Modified:
  head/release/picobsd/build/picobsd

Modified: head/release/picobsd/build/picobsd
==
--- head/release/picobsd/build/picobsd  Fri Oct 14 14:57:43 2016
(r307319)
+++ head/release/picobsd/build/picobsd  Fri Oct 14 15:16:44 2016
(r307320)
@@ -8,6 +8,10 @@
 #  picobsd [options] image_type [site_name]
 #
 # CWARNFLAGS can be used to pass -Wall or similar options
+#export CWARNFLAGS=-D__sxasxa__
+#export WARNS=2
+# EFIABI... unused attributes ?
+export NO_WERROR=1
 #
 # Where image_type is a directory with the picobsd config info,
 # and ${image_type}/floppy.tree.${site_name} contains
@@ -165,7 +169,7 @@ create_includes_and_libraries2() { # opt
 local no
 log "create_includes_and_libraries2() for ${SRC} $1"
 
-no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
+no="-DNO_CLEAN -DMK_PROFILE=no -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
 no="$no -DWITHOUT_CASPER"
 no="$no -DMALLOC_PRODUCTION"
 
@@ -674,7 +678,7 @@ populate_mfs_tree() {
 ) || fail $? crunch
 
 log "Setting up host key for sshd:"
-for K in rsa1 rsa dsa ; do
+for K in rsa dsa ; do
if [ $K = rsa1 ] ; then
i=ssh_host_key
else
@@ -844,6 +848,7 @@ fill_floppy_image() {
 mkdir -p ${dst}
 (
 cd ${BUILDDIR}
+# old style mfs lookup, find markers in kernel
 set 0 0 # reset variables
 # $1 takes the offset of the MFS filesystem
 set `strings -at d kernel | grep "MFS Filesystem goes here"`
@@ -852,6 +857,16 @@ fill_floppy_image() {
 set `strings -at d kernel | grep "MFS Filesystem had better"`
 mfs_end=$1
 mfs_size="$((${mfs_end} - ${mfs_start}))"
+if [ ${mfs_start} = 0 -o ${mfs_end} = 0 ] ; then
+   # similar to sys/tools/embed_mfs.sh
+   local x="`objdump -h kernel | grep oldmfs`"
+   mfs_size=`echo ${x} | awk '{printf("%d", "0x" $3)}' 2> /dev/null`
+   mfs_start=`echo ${x} | awk '{printf("%d", "0x" $6)}' 2> /dev/null`
+   if [ ${mfs_start} = 0 -o ${mfs_size} = 0 ] ; then
+   log "-- old style mfs location not found, have"
+   logverbose "$x"
+   fi
+fi
 set -- `ls -l ${c_fs}`; imgsize="$5"
 if [ ${mfs_start} -gt 0 -a ${mfs_size} -ge ${imgsize} ] ; then
mfs_ofs=$((${mfs_start} + 8192))
@@ -953,9 +968,15 @@ set_build_parameters() {
 OSVERSION=$3
 log "OSVERSION is ${OSVERSION}"
 
-   export MAKEOBJDIRPREFIX=${l_objtree}
-   export TARGET_ARCH=${o_arch} TARGET=${o_arch}
-   # XXX 20131001 see if CLANG fixes the build
+export MAKEOBJDIRPREFIX=${l_objtree}
+export TARGET_ARCH=${o_arch} TARGET=${o_arch}
+# XXX 20131001 see if CLANG fixes the build
+if true; then
+   echo "--- build with clang"
+   export WITHOUT_CLANG=yes
+   export WITHOUT_CLANG_BOOTSTRAP=yes
+   # export WITH_CLANG_BOOTSTRAP=yes
+else
export WITHOUT_CLANG_IS_CC=yes
export WITHOUT_CLANG_BOOTSTRAP=yes
export WITH_GCC=yes
@@ -964,14 +985,15 @@ set_build_parameters() {
export WITHOUT_CLANG=yes
export WITHOUT_ICONV=yes
export WITHOUT_TESTS=yes
+fi
 
-   # XXX why change machine_arch ?
-   #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
-   # export CWARNFLAGS="-Wextra -Wno-sign-compare 
-Wno-missing-field-initializers"
-   # XXX BINMAKE does not really exist anymore
-   eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
-   [ "$BINMAKE" = "" ] && \
-  eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\""
+# XXX why change machine_arch ?
+#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
+# export CWARNFLAGS="-Wextra -Wno-sign-compare 
-Wno-missing-field-initializers"
+# XXX BINMAKE does not really exist anymore
+eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
+[ "$BINMAKE" = "" ] && \
+   eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\""
 
 if [ "${o_init_src}" != "" ] ; then
create_includes_and_libraries2
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307319 - in head/sys/netinet: . tcp_stacks

2016-10-14 Thread Jonathan T. Looney
Author: jtl
Date: Fri Oct 14 14:57:43 2016
New Revision: 307319
URL: https://svnweb.freebsd.org/changeset/base/307319

Log:
  The code currently resets the keepalive timer each time a packet is
  received on a TCP session that has entered the ESTABLISHED state. This
  results in a lot of calls to reset the keepalive timer.
  
  This patch changes the behavior so we set the keepalive timer for the
  keepalive idle time (TP_KEEPIDLE). When the keepalive timer fires, it will
  first check to see if the session has been idle for TP_KEEPIDLE ticks. If
  not, it will reschedule the keepalive timer for the time the session will
  have been idle for TP_KEEPIDLE ticks.
  
  For a session with regular communication, the keepalive timer should fire
  approximately once every TP_KEEPIDLE ticks. For sessions with irregular
  communication, the keepalive timer might fire more often. But, the
  disruption from a periodic keepalive timer should be less than the regular
  cost of resetting the keepalive timer on every packet.
  
  (FWIW, this change saved approximately 1.73% of the busy CPU cycles on a
  particular test system with a heavy TCP output load. Of course, the
  actual impact is very specific to the particular hardware and workload.)
  
  Reviewed by:  gallatin, rrs
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D8243

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/fastpath.c
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cFri Oct 14 12:03:04 2016
(r307318)
+++ head/sys/netinet/tcp_input.cFri Oct 14 14:57:43 2016
(r307319)
@@ -1565,8 +1565,6 @@ tcp_do_segment(struct mbuf *m, struct tc
 * validation to ignore broken/spoofed segs.
 */
tp->t_rcvtime = ticks;
-   if (TCPS_HAVEESTABLISHED(tp->t_state))
-   tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
 
/*
 * Scale up the window into a 32-bit value.

Modified: head/sys/netinet/tcp_stacks/fastpath.c
==
--- head/sys/netinet/tcp_stacks/fastpath.c  Fri Oct 14 12:03:04 2016
(r307318)
+++ head/sys/netinet/tcp_stacks/fastpath.c  Fri Oct 14 14:57:43 2016
(r307319)
@@ -1819,8 +1819,6 @@ tcp_do_segment_fastslow(struct mbuf *m, 
 * validation to ignore broken/spoofed segs.
 */
tp->t_rcvtime = ticks;
-   if (TCPS_HAVEESTABLISHED(tp->t_state))
-   tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
 
/*
 * Unscale the window into a 32-bit value.
@@ -2266,8 +2264,6 @@ tcp_do_segment_fastack(struct mbuf *m, s
 * validation to ignore broken/spoofed segs.
 */
tp->t_rcvtime = ticks;
-   if (TCPS_HAVEESTABLISHED(tp->t_state))
-   tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp));
 
/*
 * Unscale the window into a 32-bit value.

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cFri Oct 14 12:03:04 2016
(r307318)
+++ head/sys/netinet/tcp_timer.cFri Oct 14 14:57:43 2016
(r307319)
@@ -468,6 +468,26 @@ tcp_timer_keep(void *xtp)
}
KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+
+   /*
+* Because we don't regularly reset the keepalive callout in
+* the ESTABLISHED state, it may be that we don't actually need
+* to send a keepalive yet. If that occurs, schedule another
+* call for the next time the keepalive timer might expire.
+*/
+   if (TCPS_HAVEESTABLISHED(tp->t_state)) {
+   u_int idletime;
+
+   idletime = ticks - tp->t_rcvtime;
+   if (idletime < TP_KEEPIDLE(tp)) {
+   callout_reset(>t_timers->tt_keep,
+   TP_KEEPIDLE(tp) - idletime, tcp_timer_keep, tp);
+   INP_WUNLOCK(inp);
+   CURVNET_RESTORE();
+   return;
+   }
+   }
+
/*
 * Keep-alive timer went off; send something
 * or drop connection if idle for too long.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307317 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-10-14 Thread Andriy Gapon
On 14/10/2016 15:22, Alexander Motin wrote:
> On 14.10.2016 15:11, Andriy Gapon wrote:
>> On 14/10/2016 15:01, Alexander Motin wrote:
>>> Author: mav
>>> Date: Fri Oct 14 12:01:33 2016
>>> New Revision: 307317
>>> URL: https://svnweb.freebsd.org/changeset/base/307317
>>>
>>> Log:
>>>   MFV r307313:
>>>   5120 zfs should allow large block/gzip/raidz boot pool (loader project)
>>>   
>>>   Reviewed by: George Wilson 
>>>   Reviewed by: Yuri Pankov 
>>>   Reviewed by: Andrew Stormont 
>>>   Reviewed by: Matthew Ahrens 
>>>   Approved by: Robert Mustacchi 
>>>   Author: Toomas Soome 
>>>   
>>>   openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370
>>>   
>>>   FreeBSD still does not support booting from gzip-compressed datasets,
>>>   so keep one chunk of this commit out.
>>
>> Does FreeBSD boot code support large blocks? Just to be sure.
> 
> According to r304321 commit message -- it does now.

Okay.

>> And maybe this is worth some additional notice because users sometimes 
>> forget to
>> upgrade gptzfsboot / zfsboot.
> 
> Where would you like to see it to be noticeable?

That's a good question for which I do not have a good answer.
Ideally 'zfs set recordsize=' would warn when setting a large block size on a
boot filesystem and 'zpool set bootfs=' would warn when switching the boot
filesystem to a filesystem that already has a large block size.
But not sure if that's doable without kludges.

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


Re: svn commit: r307317 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-10-14 Thread Julian Elischer

On 14/10/2016 5:01 AM, Alexander Motin wrote:

Author: mav
Date: Fri Oct 14 12:01:33 2016
New Revision: 307317
URL: https://svnweb.freebsd.org/changeset/base/307317

Log:
   MFV r307313:
   5120 zfs should allow large block/gzip/raidz boot pool (loader project)
   
   Reviewed by: George Wilson 

   Reviewed by: Yuri Pankov 
   Reviewed by: Andrew Stormont 
   Reviewed by: Matthew Ahrens 
   Approved by: Robert Mustacchi 
   Author: Toomas Soome 
   
   openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370
   
   FreeBSD still does not support booting from gzip-compressed datasets,

   so keep one chunk of this commit out.
might it not have been a bit better to have just put #if 0 around the 
bits so that we could still see them?


also may help with future merges



Modified:
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
   head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Fri Oct 14 
11:57:08 2016(r307316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Fri Oct 14 
12:01:33 2016(r307317)
@@ -27,6 +27,7 @@
   * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
   * Copyright 2013 Saso Kiselkov. All rights reserved.
   * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Toomas Soome 
   */
  
  /*

@@ -539,12 +540,6 @@ spa_prop_validate(spa_t *spa, nvlist_t *
)) == 0 &&
!BOOTFS_COMPRESS_VALID(propval)) {
error = SET_ERROR(ENOTSUP);
-   } else if ((error =
-   dsl_prop_get_int_ds(dmu_objset_ds(os),
-   zfs_prop_to_name(ZFS_PROP_RECORDSIZE),
-   )) == 0 &&
-   propval > SPA_OLD_MAXBLOCKSIZE) {
-   error = SET_ERROR(ENOTSUP);
} else {
objnum = dmu_objset_id(os);
}

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Fri Oct 
14 11:57:08 2016(r307316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Fri Oct 
14 12:01:33 2016(r307317)
@@ -24,6 +24,7 @@
   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
   * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
   * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright 2016 Toomas Soome 
   */
  
  #ifndef _ZIO_H


Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Fri Oct 14 
11:57:08 2016(r307316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Fri Oct 14 
12:01:33 2016(r307317)
@@ -25,6 +25,7 @@
   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
   * Copyright 2013 Martin Matuska . All rights reserved.
   * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Toomas Soome 
   */
  
  #include 

@@ -3474,16 +3475,10 @@ vdev_set_state(vdev_t *vd, boolean_t iso
  
  /*

   * Check the vdev configuration to ensure that it's capable of supporting
- * a root pool.
+ * a root pool. We do not support partial configuration.
+ * In addition, only a single top-level vdev is allowed.
   *
- * On Solaris, we do not support RAID-Z or partial configuration.  In
- * addition, only a single top-level vdev is allowed and none of the
- * leaves can be wholedisks.
- *
- * For FreeBSD, we can boot from any configuration. There is a
- * limitation that the boot filesystem must be either uncompressed or
- * compresses with lzjb compression but I'm not sure how to enforce
- * that here.
+ * FreeBSD does not have above limitations.
   */
  boolean_t
  vdev_is_bootable(vdev_t *vd)
@@ -3495,8 +3490,7 @@ vdev_is_bootable(vdev_t *vd)
if (strcmp(vdev_type, VDEV_TYPE_ROOT) == 0 &&
vd->vdev_children > 1) {
return (B_FALSE);
-   } else if (strcmp(vdev_type, VDEV_TYPE_RAIDZ) == 0 

Re: svn commit: r307317 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-10-14 Thread Alexander Motin
On 14.10.2016 15:11, Andriy Gapon wrote:
> On 14/10/2016 15:01, Alexander Motin wrote:
>> Author: mav
>> Date: Fri Oct 14 12:01:33 2016
>> New Revision: 307317
>> URL: https://svnweb.freebsd.org/changeset/base/307317
>>
>> Log:
>>   MFV r307313:
>>   5120 zfs should allow large block/gzip/raidz boot pool (loader project)
>>   
>>   Reviewed by: George Wilson 
>>   Reviewed by: Yuri Pankov 
>>   Reviewed by: Andrew Stormont 
>>   Reviewed by: Matthew Ahrens 
>>   Approved by: Robert Mustacchi 
>>   Author: Toomas Soome 
>>   
>>   openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370
>>   
>>   FreeBSD still does not support booting from gzip-compressed datasets,
>>   so keep one chunk of this commit out.
> 
> Does FreeBSD boot code support large blocks? Just to be sure.

According to r304321 commit message -- it does now.

> And maybe this is worth some additional notice because users sometimes forget 
> to
> upgrade gptzfsboot / zfsboot.

Where would you like to see it to be noticeable?

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


Re: svn commit: r307317 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-10-14 Thread Andriy Gapon
On 14/10/2016 15:01, Alexander Motin wrote:
> Author: mav
> Date: Fri Oct 14 12:01:33 2016
> New Revision: 307317
> URL: https://svnweb.freebsd.org/changeset/base/307317
> 
> Log:
>   MFV r307313:
>   5120 zfs should allow large block/gzip/raidz boot pool (loader project)
>   
>   Reviewed by: George Wilson 
>   Reviewed by: Yuri Pankov 
>   Reviewed by: Andrew Stormont 
>   Reviewed by: Matthew Ahrens 
>   Approved by: Robert Mustacchi 
>   Author: Toomas Soome 
>   
>   openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370
>   
>   FreeBSD still does not support booting from gzip-compressed datasets,
>   so keep one chunk of this commit out.

Does FreeBSD boot code support large blocks?
Just to be sure.
And maybe this is worth some additional notice because users sometimes forget to
upgrade gptzfsboot / zfsboot.

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


svn commit: r307318 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-10-14 Thread Alexander Motin
Author: mav
Date: Fri Oct 14 12:03:04 2016
New Revision: 307318
URL: https://svnweb.freebsd.org/changeset/base/307318

Log:
  MFV r307314:
  6988 spa_sync() spends half its time in dmu_objset_do_userquota_updates
  
  Using a benchmark which creates 2 million files in one TXG, I observe
  that the thread running spa_sync() is on CPU almost the entire time we
  are syncing, and therefore can be a performance bottleneck. About 50% of
  the time in spa_sync() is in dmu_objset_do_userquota_updates().
  
  The problem is that dmu_objset_do_userquota_updates() calls
  zap_increment_int(DMU_USERUSED_OBJECT) once for every file that was
  modified (or created). In this benchmark, all the files are owned by the
  same user/group, so all 2 million calls to zap_increment_int() are
  modifying the same entry in the zap. The same issue exists for the
  DMU_GROUPUSED_OBJECT.
  
  We should keep an in-memory map from user to space delta while we are
  syncing, and when we finish, iterate over the in-memory map and modify
  the ZAP once per entry. This reduces the number of calls to
  zap_increment_int() from "number of objects modified" to "number of
  owners/groups of modified files".
  
  This reduced the time spent in spa_sync() in the file create benchmark
  by ~33%, from 11 seconds to 7 seconds.
  
  Closes #107
  
  Reviewed by: George Wilson 
  Reviewed by: Steve Gonczi 
  Reviewed by: Ned Bass 
  Reviewed by: Jinshan Xiong 
  Author: Matthew Ahrens 
  
  openzfs/openzfs@5fc46359c569369d87728ca09f8705cdff6cc8e2

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.cFri Oct 
14 12:01:33 2016(r307317)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.cFri Oct 
14 12:03:04 2016(r307318)
@@ -1207,18 +1207,83 @@ dmu_objset_userused_enabled(objset_t *os
DMU_USERUSED_DNODE(os) != NULL);
 }
 
+typedef struct userquota_node {
+   uint64_t uqn_id;
+   int64_t uqn_delta;
+   avl_node_t uqn_node;
+} userquota_node_t;
+
+typedef struct userquota_cache {
+   avl_tree_t uqc_user_deltas;
+   avl_tree_t uqc_group_deltas;
+} userquota_cache_t;
+
+static int
+userquota_compare(const void *l, const void *r)
+{
+   const userquota_node_t *luqn = l;
+   const userquota_node_t *ruqn = r;
+
+   if (luqn->uqn_id < ruqn->uqn_id)
+   return (-1);
+   if (luqn->uqn_id > ruqn->uqn_id)
+   return (1);
+   return (0);
+}
+
 static void
-do_userquota_update(objset_t *os, uint64_t used, uint64_t flags,
-uint64_t user, uint64_t group, boolean_t subtract, dmu_tx_t *tx)
+do_userquota_cacheflush(objset_t *os, userquota_cache_t *cache, dmu_tx_t *tx)
+{
+   void *cookie;
+   userquota_node_t *uqn;
+
+   ASSERT(dmu_tx_is_syncing(tx));
+
+   cookie = NULL;
+   while ((uqn = avl_destroy_nodes(>uqc_user_deltas,
+   )) != NULL) {
+   VERIFY0(zap_increment_int(os, DMU_USERUSED_OBJECT,
+   uqn->uqn_id, uqn->uqn_delta, tx));
+   kmem_free(uqn, sizeof (*uqn));
+   }
+   avl_destroy(>uqc_user_deltas);
+
+   cookie = NULL;
+   while ((uqn = avl_destroy_nodes(>uqc_group_deltas,
+   )) != NULL) {
+   VERIFY0(zap_increment_int(os, DMU_GROUPUSED_OBJECT,
+   uqn->uqn_id, uqn->uqn_delta, tx));
+   kmem_free(uqn, sizeof (*uqn));
+   }
+   avl_destroy(>uqc_group_deltas);
+}
+
+static void
+userquota_update_cache(avl_tree_t *avl, uint64_t id, int64_t delta)
+{
+   userquota_node_t search = { .uqn_id = id };
+   avl_index_t idx;
+
+   userquota_node_t *uqn = avl_find(avl, , );
+   if (uqn == NULL) {
+   uqn = kmem_zalloc(sizeof (*uqn), KM_SLEEP);
+   uqn->uqn_id = id;
+   avl_insert(avl, uqn, idx);
+   }
+   uqn->uqn_delta += delta;
+}
+
+static void
+do_userquota_update(userquota_cache_t *cache, uint64_t used, uint64_t flags,
+uint64_t user, uint64_t group, boolean_t subtract)
 {
if ((flags & DNODE_FLAG_USERUSED_ACCOUNTED)) {
int64_t delta = DNODE_SIZE + used;
if (subtract)
delta = -delta;
-   VERIFY3U(0, ==, zap_increment_int(os, DMU_USERUSED_OBJECT,
-   user, delta, tx));
-   VERIFY3U(0, ==, zap_increment_int(os, DMU_GROUPUSED_OBJECT,
-   group, delta, tx));
+
+   userquota_update_cache(>uqc_user_deltas, user, delta);
+   userquota_update_cache(>uqc_group_deltas, group, delta);
  

svn commit: r307317 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-10-14 Thread Alexander Motin
Author: mav
Date: Fri Oct 14 12:01:33 2016
New Revision: 307317
URL: https://svnweb.freebsd.org/changeset/base/307317

Log:
  MFV r307313:
  5120 zfs should allow large block/gzip/raidz boot pool (loader project)
  
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Reviewed by: Andrew Stormont 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Toomas Soome 
  
  openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370
  
  FreeBSD still does not support booting from gzip-compressed datasets,
  so keep one chunk of this commit out.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Fri Oct 14 
11:57:08 2016(r307316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Fri Oct 14 
12:01:33 2016(r307317)
@@ -27,6 +27,7 @@
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright 2013 Saso Kiselkov. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Toomas Soome 
  */
 
 /*
@@ -539,12 +540,6 @@ spa_prop_validate(spa_t *spa, nvlist_t *
)) == 0 &&
!BOOTFS_COMPRESS_VALID(propval)) {
error = SET_ERROR(ENOTSUP);
-   } else if ((error =
-   dsl_prop_get_int_ds(dmu_objset_ds(os),
-   zfs_prop_to_name(ZFS_PROP_RECORDSIZE),
-   )) == 0 &&
-   propval > SPA_OLD_MAXBLOCKSIZE) {
-   error = SET_ERROR(ENOTSUP);
} else {
objnum = dmu_objset_id(os);
}

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Fri Oct 
14 11:57:08 2016(r307316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Fri Oct 
14 12:01:33 2016(r307317)
@@ -24,6 +24,7 @@
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright 2016 Toomas Soome 
  */
 
 #ifndef _ZIO_H

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Fri Oct 14 
11:57:08 2016(r307316)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Fri Oct 14 
12:01:33 2016(r307317)
@@ -25,6 +25,7 @@
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2013 Martin Matuska . All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Toomas Soome 
  */
 
 #include 
@@ -3474,16 +3475,10 @@ vdev_set_state(vdev_t *vd, boolean_t iso
 
 /*
  * Check the vdev configuration to ensure that it's capable of supporting
- * a root pool.
+ * a root pool. We do not support partial configuration.
+ * In addition, only a single top-level vdev is allowed.
  *
- * On Solaris, we do not support RAID-Z or partial configuration.  In
- * addition, only a single top-level vdev is allowed and none of the
- * leaves can be wholedisks.
- *
- * For FreeBSD, we can boot from any configuration. There is a
- * limitation that the boot filesystem must be either uncompressed or
- * compresses with lzjb compression but I'm not sure how to enforce
- * that here.
+ * FreeBSD does not have above limitations.
  */
 boolean_t
 vdev_is_bootable(vdev_t *vd)
@@ -3495,8 +3490,7 @@ vdev_is_bootable(vdev_t *vd)
if (strcmp(vdev_type, VDEV_TYPE_ROOT) == 0 &&
vd->vdev_children > 1) {
return (B_FALSE);
-   } else if (strcmp(vdev_type, VDEV_TYPE_RAIDZ) == 0 ||
-   strcmp(vdev_type, VDEV_TYPE_MISSING) == 0) {
+   } else if (strcmp(vdev_type, VDEV_TYPE_MISSING) == 0) {
return (B_FALSE);
}
}

Modified: 

svn commit: r307316 - head/sys/boot/userboot/userboot

2016-10-14 Thread Baptiste Daroussin
Author: bapt
Date: Fri Oct 14 11:57:08 2016
New Revision: 307316
URL: https://svnweb.freebsd.org/changeset/base/307316

Log:
  Fix build WITHOUT_FORTH
  
  MFC after:1 week
  Sponsored by: Gandi.net

Modified:
  head/sys/boot/userboot/userboot/Makefile

Modified: head/sys/boot/userboot/userboot/Makefile
==
--- head/sys/boot/userboot/userboot/MakefileFri Oct 14 11:49:36 2016
(r307315)
+++ head/sys/boot/userboot/userboot/MakefileFri Oct 14 11:57:08 2016
(r307316)
@@ -51,9 +51,10 @@ BOOT_FORTH=  yes
 CFLAGS+=-DBOOT_FORTH -I${.CURDIR}/../../ficl 
-I${.CURDIR}/../../ficl/i386
 CFLAGS+=   -DBF_DICTSIZE=15000
 LIBFICL=   ${.OBJDIR}/../ficl/libficl.a
-LIBSTAND=  ${.OBJDIR}/../libstand/libstand.a
 .endif
 
+LIBSTAND=  ${.OBJDIR}/../libstand/libstand.a
+
 .if ${MK_ZFS} != "no"
 CFLAGS+=   -DUSERBOOT_ZFS_SUPPORT
 LIBZFSBOOT=${.OBJDIR}/../zfs/libzfsboot.a
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307252 - head/sys/arm/broadcom/bcm2835

2016-10-14 Thread Andrew Turner
On Fri, 14 Oct 2016 03:00:53 + (UTC)
Oleksandr Tymoshenko  wrote:

> Author: gonzo
> Date: Fri Oct 14 03:00:53 2016
> New Revision: 307252
> URL: https://svnweb.freebsd.org/changeset/base/307252
> 
> Log:
>   Make bcm2835_machdep.c optional
>   
>   bcm2835_machdep.c contains only bits enabled by "options PLATFORM",
> this option available only on ARM, not ARM64
> 
> Modified:
>   head/sys/arm/broadcom/bcm2835/files.bcm283x
> 
> Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x
> ==
> --- head/sys/arm/broadcom/bcm2835/files.bcm283x   Fri Oct 14 02:58:31 
> 2016(r307251)
> +++ head/sys/arm/broadcom/bcm2835/files.bcm283x   Fri Oct 14 03:00:53 
> 2016(r307252)
> @@ -9,7 +9,7 @@ arm/broadcom/bcm2835/bcm2835_fbd.copti
>  arm/broadcom/bcm2835/bcm2835_ft5406.coptional evdev 
> bcm2835_ft5406
>  arm/broadcom/bcm2835/bcm2835_gpio.c  optional gpio
>  arm/broadcom/bcm2835/bcm2835_intr.c  standard
> -arm/broadcom/bcm2835/bcm2835_machdep.c   standard
> +arm/broadcom/bcm2835/bcm2835_machdep.c   optional platform
>  arm/broadcom/bcm2835/bcm2835_mbox.c  standard
>  arm/broadcom/bcm2835/bcm2835_rng.c   optional random
>  arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci
>

Any of these files you need should be added to files.arm64 being
optional on the appropriate soc_ value.

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


Re: svn commit: r307257 - in head/sys: arm/broadcom/bcm2835 arm64/broadcom arm64/broadcom/bcm2837 arm64/conf conf

2016-10-14 Thread Andrew Turner
On Fri, 14 Oct 2016 03:37:36 + (UTC)
Oleksandr Tymoshenko  wrote:

> Author: gonzo
> Date: Fri Oct 14 03:37:35 2016
> New Revision: 307257
> URL: https://svnweb.freebsd.org/changeset/base/307257
> 
> Log:
>   Add initial Raspberry Pi 3 support
>   
>   RPI3 kernel config builds kernel compatible with latest upstream
> device tree and firmware:
> https://github.com/raspberrypi/firmware/tree/master/boot As of today
> it's 597c662a613df1144a6bc43e5f4505d83bd748ca 
>   Default console is PL01x, so pi3-disable-bt dt overlay should be
> configured in config.txt and stock U-Boot should be patched to use
> proper serial port. 
>   Yet unsupported: SMP, VCHIQ, RNG driver. RNG requires some work due
> to upstream device tree incompatibility.
>   
>   Multiple people contributed to this work over time: db@, loos@,
> manu@
> 
> Added:
>   head/sys/arm64/broadcom/
>   head/sys/arm64/broadcom/bcm2837/
>   head/sys/arm64/broadcom/bcm2837/files.bcm2837   (contents, props
> changed) head/sys/arm64/conf/RPI3   (contents, props changed)
> Modified:
>   head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
>   head/sys/conf/options.arm64
> 
> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
> ==
> --- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Fri Oct 14
> 03:32:20 2016 (r307256) +++
> head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Fri Oct 14
> 03:37:35 2016 (r307257) @@ -37,7 +37,7 @@ #define
> BCM2835_VCBUS_IO_BASE 0x7E00 #define
> BCM2835_VCBUS_SDRAM_UNCACHED  0xC000 
> -#ifdef SOC_BCM2836
> +#if defined(SOC_BCM2836) || defined(SOC_BCM2837)

You could reverse the logic here to:
#ifdef SOC_BCM2835
<2835 macros>
#else

#endif

>  #define  BCM2835_ARM_IO_BASE 0x3f00
>  #define  BCM2835_VCBUS_SDRAM_BASE
> BCM2835_VCBUS_SDRAM_UNCACHED #else
> 
> Added: head/sys/arm64/broadcom/bcm2837/files.bcm2837
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is
> newly added) +++ head/sys/arm64/broadcom/bcm2837/files.bcm2837
> Fri Oct 14 03:37:35 2016  (r307257) @@ -0,0 +1,4 @@
> +# $FreeBSD$
> +
> +arm/broadcom/bcm2835/bcm2836.c   standard
This should be in files.arm64 and enabled when the SOC_ option is set.

> +kern/kern_clocksource.c  standard
This is already in files.arm64.
> 
> Added: head/sys/arm64/conf/RPI3

Why a new kernel config and not GENERIC?

...
> Modified: head/sys/conf/options.arm64
> ==
> --- head/sys/conf/options.arm64   Fri Oct 14 03:32:20
> 2016  (r307256) +++ head/sys/conf/options.arm64   Fri Oct
> 14 03:37:35 2016  (r307257) @@ -9,5 +9,6 @@
> VFP   opt_global.h 
>  # SoC Support
>  SOC_ALLWINNER_A64opt_soc.h
> +SOC_BCM2837  opt_global.h
This should be SOC_BRCM_BCM2837 (or maybe SOC_BRCM_BCM283X) and live in
opt_soc.h

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


Re: svn commit: r307235 - in head: sbin/pfctl share/man/man5 sys/netpfil/pf

2016-10-14 Thread Kristof Provost

This work was done by franco_opnsense.org
I forgot to credit him in the commit message. Sorry Franco.

Regards,
Kristof

On 13 Oct 2016, at 22:34, Kristof Provost wrote:


Author: kp
Date: Thu Oct 13 20:34:44 2016
New Revision: 307235
URL: https://svnweb.freebsd.org/changeset/base/307235

Log:
  pf: port extended DSCP support from OpenBSD

  Ignore the ECN bits on 'tos' and 'set-tos' and allow to use
  DCSP names instead of having to embed their TOS equivalents
  as plain numbers.

  Obtained from:OpenBSD
  Sponsored by: OPNsense
  Differential Revision:https://reviews.freebsd.org/D8165

Modified:
  head/sbin/pfctl/parse.y
  head/share/man/man5/pf.conf.5
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sbin/pfctl/parse.y
==
--- head/sbin/pfctl/parse.y Thu Oct 13 20:15:47 2016(r307234)
+++ head/sbin/pfctl/parse.y Thu Oct 13 20:34:44 2016(r307235)
@@ -351,6 +351,8 @@ void decide_address_family(struct node_
 voidremove_invalid_hosts(struct node_host **, sa_family_t *);
 int invalid_redirect(struct node_host *, sa_family_t);
 u_int16_t parseicmpspec(char *, sa_family_t);
+int kw_casecmp(const void *, const void *);
+int map_tos(char *string, int *);

 static TAILQ_HEAD(loadanchorshead, loadanchors)
 loadanchorshead = TAILQ_HEAD_INITIALIZER(loadanchorshead);
@@ -3584,15 +3586,17 @@ icmp6type   : STRING{
;

 tos: STRING{
-   if (!strcmp($1, "lowdelay"))
-   $$ = IPTOS_LOWDELAY;
-   else if (!strcmp($1, "throughput"))
-   $$ = IPTOS_THROUGHPUT;
-   else if (!strcmp($1, "reliability"))
-   $$ = IPTOS_RELIABILITY;
-   else if ($1[0] == '0' && $1[1] == 'x')
-   $$ = strtoul($1, NULL, 16);
-   else
+   int val;
+   char *end;
+
+   if (map_tos($1, ))
+   $$ = val;
+   else if ($1[0] == '0' && $1[1] == 'x') {
+   errno = 0;
+   $$ = strtoul($1, , 16);
+   if (errno || *end != '\0')
+   $$ = 256;
+   } else
$$ = 256;   /* flag bad argument */
if ($$ < 0 || $$ > 255) {
yyerror("illegal tos value %s", $1);
@@ -6250,6 +6254,57 @@ pfctl_load_anchors(int dev, struct pfctl
 }

 int
+kw_casecmp(const void *k, const void *e)
+{
+   return (strcasecmp(k, ((const struct keywords *)e)->k_name));
+}
+
+int
+map_tos(char *s, int *val)
+{
+   /* DiffServ Codepoints and other TOS mappings */
+   const struct keywordstoswords[] = {
+   { "af11", IPTOS_DSCP_AF11 },
+   { "af12", IPTOS_DSCP_AF12 },
+   { "af13", IPTOS_DSCP_AF13 },
+   { "af21", IPTOS_DSCP_AF21 },
+   { "af22", IPTOS_DSCP_AF22 },
+   { "af23", IPTOS_DSCP_AF23 },
+   { "af31", IPTOS_DSCP_AF31 },
+   { "af32", IPTOS_DSCP_AF32 },
+   { "af33", IPTOS_DSCP_AF33 },
+   { "af41", IPTOS_DSCP_AF41 },
+   { "af42", IPTOS_DSCP_AF42 },
+   { "af43", IPTOS_DSCP_AF43 },
+   { "critical", IPTOS_PREC_CRITIC_ECP },
+   { "cs0",  IPTOS_DSCP_CS0 },
+   { "cs1",  IPTOS_DSCP_CS1 },
+   { "cs2",  IPTOS_DSCP_CS2 },
+   { "cs3",  IPTOS_DSCP_CS3 },
+   { "cs4",  IPTOS_DSCP_CS4 },
+   { "cs5",  IPTOS_DSCP_CS5 },
+   { "cs6",  IPTOS_DSCP_CS6 },
+   { "cs7",  IPTOS_DSCP_CS7 },
+   { "ef",   IPTOS_DSCP_EF },
+   { "inetcontrol",  IPTOS_PREC_INTERNETCONTROL },
+   { "lowdelay", IPTOS_LOWDELAY },
+   { "netcontrol",   IPTOS_PREC_NETCONTROL },
+   { "reliability",  IPTOS_RELIABILITY },
+   { "throughput",   IPTOS_THROUGHPUT }
+   };
+   const struct keywords   *p;
+
+   p = bsearch(s, toswords, sizeof(toswords)/sizeof(toswords[0]),
+   sizeof(toswords[0]), kw_casecmp);
+
+   if (p) {
+   *val = p->k_val;
+   return (1);
+   }
+   return (0);
+}
+
+int
 rt_tableid_max(void)
 {
 #ifdef __FreeBSD__

Modified: