svn commit: r300280 - head/sys/dev/mlx5/mlx5_en

2016-05-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 20 06:59:38 2016
New Revision: 300280
URL: https://svnweb.freebsd.org/changeset/base/300280

Log:
  Optimise use of doorbell and remove redundant NOPs
  
  Store the last doorbell write in the mlx5e_sq structure and write the
  doorbell to the hardware when the transmit routine finishes
  transmitting all queued mbufs.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Fri May 20 06:56:43 2016
(r300279)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Fri May 20 06:59:38 2016
(r300280)
@@ -505,6 +505,10 @@ struct mlx5e_sq {
 #defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */
 #defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */
struct callout cev_callout;
+   union {
+   u32 d32[2];
+   u64 d64;
+   } doorbell;
struct  mlx5e_sq_stats stats;
 
struct  mlx5e_cq cq;
@@ -752,8 +756,7 @@ int mlx5e_add_all_vlan_rules(struct mlx5
 void   mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv);
 
 static inline void
-mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
-struct mlx5e_tx_wqe *wqe, int bf_sz)
+mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe, int bf_sz)
 {
u16 ofst = MLX5_BF_OFFSET + sq->bf_offset;
 
@@ -769,13 +772,13 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
wmb();
 
if (bf_sz) {
-   __iowrite64_copy(sq->uar_bf_map + ofst, &wqe->ctrl, bf_sz);
+   __iowrite64_copy(sq->uar_bf_map + ofst, wqe, bf_sz);
 
/* flush the write-combining mapped buffer */
wmb();
 
} else {
-   mlx5_write64((__be32 *)&wqe->ctrl, sq->uar_map + ofst, NULL);
+   mlx5_write64(wqe, sq->uar_map + ofst, NULL);
}
 
sq->bf_offset ^= sq->bf_buf_size;
@@ -795,7 +798,7 @@ voidmlx5e_create_ethtool(struct mlx5e_p
 void   mlx5e_create_stats(struct sysctl_ctx_list *,
 struct sysctl_oid_list *, const char *,
 const char **, unsigned, u64 *);
-void   mlx5e_send_nop(struct mlx5e_sq *, u32, bool);
+void   mlx5e_send_nop(struct mlx5e_sq *, u32);
 void   mlx5e_sq_cev_timeout(void *);
 intmlx5e_refresh_channel_params(struct mlx5e_priv *);
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri May 20 06:56:43 2016
(r300279)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri May 20 06:59:38 2016
(r300280)
@@ -850,7 +850,6 @@ mlx5e_open_rq(struct mlx5e_channel *c,
 struct mlx5e_rq *rq)
 {
int err;
-   int i;
 
err = mlx5e_create_rq(c, param, rq);
if (err)
@@ -866,12 +865,6 @@ mlx5e_open_rq(struct mlx5e_channel *c,
 
c->rq.enabled = 1;
 
-   /*
-* Test send queues, which will trigger
-* "mlx5e_post_rx_wqes()":
-*/
-   for (i = 0; i != c->num_tc; i++)
-   mlx5e_send_nop(&c->sq[i], 1, true);
return (0);
 
 err_disable_rq:
@@ -1198,9 +1191,16 @@ mlx5e_sq_send_nops_locked(struct mlx5e_s
goto done;
}
}
-   mlx5e_send_nop(sq, 1, true);
+   /* send a single NOP */
+   mlx5e_send_nop(sq, 1);
+   wmb();
}
 done:
+   /* Check if we need to write the doorbell */
+   if (likely(sq->doorbell.d64 != 0)) {
+   mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0);
+   sq->doorbell.d64 = 0;
+   }
return;
 }
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Fri May 20 06:56:43 2016
(r300279)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Fri May 20 06:59:38 2016
(r300280)
@@ -41,7 +41,7 @@ mlx5e_do_send_cqe(struct mlx5e_sq *sq)
 }
 
 void
-mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt, bool notify_hw)
+mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt)
 {
u16 pi = sq->pc & sq->wq.sz_m1;
struct mlx5e_tx_wqe *wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi);
@@ -55,12 +55,13 @@ mlx5e_send_nop(struct mlx5e_sq *sq, u32 
else
wqe->ctrl.fm_ce_se = 0;
 
+   /* Copy data for doorbell */
+   memcpy(sq->doorbell.d32, &wqe->ctrl, sizeof(sq->doorbell.d32));
+
sq->mbuf[pi].mbuf = NULL;
sq->mbuf[pi].num_bytes = 0;
sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
sq->pc += sq->mbuf[pi].num_wqebbs;
-   if (notify_hw)
-   mlx5e_tx_notify_hw(sq, wqe, 0);
 }
 
 #i

svn commit: r300282 - head/sys/dev/mlx5/mlx5_en

2016-05-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 20 07:07:27 2016
New Revision: 300282
URL: https://svnweb.freebsd.org/changeset/base/300282

Log:
  Verify one sysctl parameter at a time. When a mlx5en sysctl parameter
  is updated only verify the changed one instead of all.
  
  No functional change.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri May 20 07:00:11 2016
(r300281)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri May 20 07:07:27 2016
(r300282)
@@ -84,6 +84,9 @@ mlx5e_ethtool_sync_tx_completion_fact(st
priv->params_ethtool.tx_completion_fact = max;
 }
 
+#defineMLX5_PARAM_OFFSET(n)\
+__offsetof(struct mlx5e_priv, params_ethtool.n)
+
 static int
 mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 {
@@ -110,129 +113,222 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
error = ENXIO;
goto done;
}
-   /* import RX coal time */
-   if (priv->params_ethtool.rx_coalesce_usecs < 1)
-   priv->params_ethtool.rx_coalesce_usecs = 0;
-   else if (priv->params_ethtool.rx_coalesce_usecs >
-   MLX5E_FLD_MAX(cqc, cq_period)) {
-   priv->params_ethtool.rx_coalesce_usecs =
-   MLX5E_FLD_MAX(cqc, cq_period);
-   }
-   priv->params.rx_cq_moderation_usec = 
priv->params_ethtool.rx_coalesce_usecs;
-
-   /* import RX coal pkts */
-   if (priv->params_ethtool.rx_coalesce_pkts < 1)
-   priv->params_ethtool.rx_coalesce_pkts = 0;
-   else if (priv->params_ethtool.rx_coalesce_pkts >
-   MLX5E_FLD_MAX(cqc, cq_max_count)) {
-   priv->params_ethtool.rx_coalesce_pkts =
-   MLX5E_FLD_MAX(cqc, cq_max_count);
-   }
-   priv->params.rx_cq_moderation_pkts = 
priv->params_ethtool.rx_coalesce_pkts;
-
-   /* import TX coal time */
-   if (priv->params_ethtool.tx_coalesce_usecs < 1)
-   priv->params_ethtool.tx_coalesce_usecs = 0;
-   else if (priv->params_ethtool.tx_coalesce_usecs >
-   MLX5E_FLD_MAX(cqc, cq_period)) {
-   priv->params_ethtool.tx_coalesce_usecs =
-   MLX5E_FLD_MAX(cqc, cq_period);
-   }
-   priv->params.tx_cq_moderation_usec = 
priv->params_ethtool.tx_coalesce_usecs;
-
-   /* import TX coal pkts */
-   if (priv->params_ethtool.tx_coalesce_pkts < 1)
-   priv->params_ethtool.tx_coalesce_pkts = 0;
-   else if (priv->params_ethtool.tx_coalesce_pkts >
-   MLX5E_FLD_MAX(cqc, cq_max_count)) {
-   priv->params_ethtool.tx_coalesce_pkts = MLX5E_FLD_MAX(cqc, 
cq_max_count);
-   }
-   priv->params.tx_cq_moderation_pkts = 
priv->params_ethtool.tx_coalesce_pkts;
-
was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
-   if (was_opened) {
-   u64 *xarg = priv->params_ethtool.arg + arg2;
 
-   if (xarg == &priv->params_ethtool.tx_coalesce_pkts ||
-   xarg == &priv->params_ethtool.rx_coalesce_pkts ||
-   xarg == &priv->params_ethtool.tx_coalesce_usecs ||
-   xarg == &priv->params_ethtool.rx_coalesce_usecs) {
-   /* avoid downing and upping the network interface */
+   switch (MLX5_PARAM_OFFSET(arg[arg2])) {
+   case MLX5_PARAM_OFFSET(rx_coalesce_usecs):
+   /* import RX coal time */
+   if (priv->params_ethtool.rx_coalesce_usecs < 1)
+   priv->params_ethtool.rx_coalesce_usecs = 0;
+   else if (priv->params_ethtool.rx_coalesce_usecs >
+   MLX5E_FLD_MAX(cqc, cq_period)) {
+   priv->params_ethtool.rx_coalesce_usecs =
+   MLX5E_FLD_MAX(cqc, cq_period);
+   }
+   priv->params.rx_cq_moderation_usec =
+   priv->params_ethtool.rx_coalesce_usecs;
+
+   /* check to avoid down and up the network interface */
+   if (was_opened)
error = mlx5e_refresh_channel_params(priv);
-   goto done;
+   break;
+
+   case MLX5_PARAM_OFFSET(rx_coalesce_pkts):
+   /* import RX coal pkts */
+   if (priv->params_ethtool.rx_coalesce_pkts < 1)
+   priv->params_ethtool.rx_coalesce_pkts = 0;
+   else if (priv->params_ethtool.rx_coalesce_pkts >
+   MLX5E_FLD_MAX(cqc, cq_max_count)) {
+   priv->params_ethtool.rx_coalesce_pkts =
+   MLX5E_FLD_MAX(cqc, cq_max_count);
}
-   mlx5e_close_locked(priv->ifp);
-   }
-   /* import TX queue size */
-   if (priv->para

svn commit: r300287 - head/sys/geom

2016-05-20 Thread Konstantin Belousov
Author: kib
Date: Fri May 20 08:22:20 2016
New Revision: 300287
URL: https://svnweb.freebsd.org/changeset/base/300287

Log:
  Remove asserts that Giant is not held on entrance into geom KPI, which
  outlived their usefulness.  This allows to remove drop/pickup Giant
  wrappers around GEOM calls.
  
  Discussed with:   alfred, imp, phk
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/geom/geom.h
  head/sys/geom/geom_event.c
  head/sys/geom/geom_kern.c

Modified: head/sys/geom/geom.h
==
--- head/sys/geom/geom.hFri May 20 07:18:33 2016(r300286)
+++ head/sys/geom/geom.hFri May 20 08:22:20 2016(r300287)
@@ -371,7 +371,6 @@ g_free(void *ptr)
 
 #define g_topology_lock()  \
do {\
-   mtx_assert(&Giant, MA_NOTOWNED);\
sx_xlock(&topology_lock);   \
} while (0)
 

Modified: head/sys/geom/geom_event.c
==
--- head/sys/geom/geom_event.c  Fri May 20 07:18:33 2016(r300286)
+++ head/sys/geom/geom_event.c  Fri May 20 08:22:20 2016(r300287)
@@ -83,7 +83,6 @@ g_waitidle(void)
 {
 
g_topology_assert_not();
-   mtx_assert(&Giant, MA_NOTOWNED);
 
mtx_lock(&g_eventlock);
while (!TAILQ_EMPTY(&g_events))

Modified: head/sys/geom/geom_kern.c
==
--- head/sys/geom/geom_kern.c   Fri May 20 07:18:33 2016(r300286)
+++ head/sys/geom/geom_kern.c   Fri May 20 08:22:20 2016(r300287)
@@ -90,7 +90,6 @@ static void
 g_up_procbody(void *arg)
 {
 
-   mtx_assert(&Giant, MA_NOTOWNED);
thread_lock(g_up_td);
sched_prio(g_up_td, PRIBIO);
thread_unlock(g_up_td);
@@ -103,7 +102,6 @@ static void
 g_down_procbody(void *arg)
 {
 
-   mtx_assert(&Giant, MA_NOTOWNED);
thread_lock(g_down_td);
sched_prio(g_down_td, PRIBIO);
thread_unlock(g_down_td);
@@ -116,7 +114,6 @@ static void
 g_event_procbody(void *arg)
 {
 
-   mtx_assert(&Giant, MA_NOTOWNED);
thread_lock(g_event_td);
sched_prio(g_event_td, PRIBIO);
thread_unlock(g_event_td);
___
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: r300288 - in head/sys/geom: . eli journal mirror mountver raid raid3

2016-05-20 Thread Konstantin Belousov
Author: kib
Date: Fri May 20 08:25:37 2016
New Revision: 300288
URL: https://svnweb.freebsd.org/changeset/base/300288

Log:
  Removal of Giant droping wrappers for GEOM classes.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/geom/eli/g_eli.c
  head/sys/geom/geom_mbr.c
  head/sys/geom/geom_pc98.c
  head/sys/geom/geom_subr.c
  head/sys/geom/journal/g_journal.c
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/mountver/g_mountver.c
  head/sys/geom/raid/g_raid.c
  head/sys/geom/raid3/g_raid3.c

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Fri May 20 08:22:20 2016(r300287)
+++ head/sys/geom/eli/g_eli.c   Fri May 20 08:25:37 2016(r300288)
@@ -1231,7 +1231,6 @@ g_eli_shutdown_pre_sync(void *arg, int h
int error;
 
mp = arg;
-   DROP_GIANT();
g_topology_lock();
LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
sc = gp->softc;
@@ -1247,7 +1246,6 @@ g_eli_shutdown_pre_sync(void *arg, int h
}
}
g_topology_unlock();
-   PICKUP_GIANT();
 }
 
 static void

Modified: head/sys/geom/geom_mbr.c
==
--- head/sys/geom/geom_mbr.cFri May 20 08:22:20 2016(r300287)
+++ head/sys/geom/geom_mbr.cFri May 20 08:25:37 2016(r300288)
@@ -190,7 +190,6 @@ g_mbr_ioctl(struct g_provider *pp, u_lon
case DIOCSMBR: {
if (!(fflag & FWRITE))
return (EPERM);
-   DROP_GIANT();
g_topology_lock();
cp = LIST_FIRST(&gp->consumer);
if (cp->acw == 0) {
@@ -205,7 +204,6 @@ g_mbr_ioctl(struct g_provider *pp, u_lon
if (opened)
g_access(cp, 0, -1 , 0);
g_topology_unlock();
-   PICKUP_GIANT();
return(error);
}
default:

Modified: head/sys/geom/geom_pc98.c
==
--- head/sys/geom/geom_pc98.c   Fri May 20 08:22:20 2016(r300287)
+++ head/sys/geom/geom_pc98.c   Fri May 20 08:25:37 2016(r300288)
@@ -176,7 +176,6 @@ g_pc98_ioctl(struct g_provider *pp, u_lo
case DIOCSPC98: {
if (!(fflag & FWRITE))
return (EPERM);
-   DROP_GIANT();
g_topology_lock();
cp = LIST_FIRST(&gp->consumer);
if (cp->acw == 0) {
@@ -191,7 +190,6 @@ g_pc98_ioctl(struct g_provider *pp, u_lo
if (opened)
g_access(cp, 0, -1 , 0);
g_topology_unlock();
-   PICKUP_GIANT();
return(error);
}
default:

Modified: head/sys/geom/geom_subr.c
==
--- head/sys/geom/geom_subr.c   Fri May 20 08:22:20 2016(r300287)
+++ head/sys/geom/geom_subr.c   Fri May 20 08:25:37 2016(r300288)
@@ -247,9 +247,7 @@ g_modevent(module_t mod, int type, void 
break;
case MOD_UNLOAD:
g_trace(G_T_TOPOLOGY, "g_modevent(%s, UNLOAD)", mp->name);
-   DROP_GIANT();
error = g_unload_class(mp);
-   PICKUP_GIANT();
if (error == 0) {
KASSERT(LIST_EMPTY(&mp->geom),
("Unloaded class (%s) still has geom", mp->name));

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Fri May 20 08:22:20 2016
(r300287)
+++ head/sys/geom/journal/g_journal.c   Fri May 20 08:25:37 2016
(r300288)
@@ -2697,7 +2697,6 @@ g_journal_shutdown(void *arg, int howto 
if (panicstr != NULL)
return;
mp = arg;
-   DROP_GIANT();
g_topology_lock();
LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
if (gp->softc == NULL)
@@ -2706,7 +2705,6 @@ g_journal_shutdown(void *arg, int howto 
g_journal_destroy(gp->softc);
}
g_topology_unlock();
-   PICKUP_GIANT();
 }
 
 /*
@@ -2725,7 +2723,6 @@ g_journal_lowmem(void *arg, int howto __
 
g_journal_stats_low_mem++;
mp = arg;
-   DROP_GIANT();
g_topology_lock();
LIST_FOREACH(gp, &mp->geom, geom) {
sc = gp->softc;
@@ -2756,7 +2753,6 @@ g_journal_lowmem(void *arg, int howto __
break;
}
g_topology_unlock();
-   PICKUP_GIANT();
 }
 
 static void g_journal_switcher(void *arg);
@@ -2871,7 +2867,6 @@ g_journal_do_switch(struct g_class *clas
char *mountpoint;
int error, save;
 
-   DROP_GIANT();
g_topology_lock();
LIST_FOREACH(gp, &classp->geom, geom) {
  

svn commit: r300289 - head/sys/geom

2016-05-20 Thread Konstantin Belousov
Author: kib
Date: Fri May 20 08:28:11 2016
New Revision: 300289
URL: https://svnweb.freebsd.org/changeset/base/300289

Log:
  Remove unneeded Giant locking around kthreads creation.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/geom/geom_kern.c

Modified: head/sys/geom/geom_kern.c
==
--- head/sys/geom/geom_kern.c   Fri May 20 08:25:37 2016(r300288)
+++ head/sys/geom/geom_kern.c   Fri May 20 08:28:11 2016(r300289)
@@ -144,14 +144,12 @@ g_init(void)
g_io_init();
g_event_init();
g_ctl_init();
-   mtx_lock(&Giant);
kproc_kthread_add(g_event_procbody, NULL, &g_proc, &g_event_td,
RFHIGHPID, 0, "geom", "g_event");
kproc_kthread_add(g_up_procbody, NULL, &g_proc, &g_up_td,
RFHIGHPID, 0, "geom", "g_up");
kproc_kthread_add(g_down_procbody, NULL, &g_proc, &g_down_td,
RFHIGHPID, 0, "geom", "g_down");
-   mtx_unlock(&Giant);
EVENTHANDLER_REGISTER(shutdown_pre_sync, geom_shutdown, NULL,
SHUTDOWN_PRI_FIRST);
 }
___
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: r300290 - in head/sys: arm64/cavium dev/pci

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 08:29:00 2016
New Revision: 300290
URL: https://svnweb.freebsd.org/changeset/base/300290

Log:
  Handle PCI_RES_BUS on the generic and ThunderX PCIe drivers. This has been
  tested on the Pass 1.1 and 2.0 ThunderX machines in the Netperf cluster.
  
  Reviewed by:  jhb
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6453

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c
  head/sys/dev/pci/pci_host_generic.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem.cFri May 20 08:28:11 2016
(r300289)
+++ head/sys/arm64/cavium/thunder_pcie_pem.cFri May 20 08:29:00 2016
(r300290)
@@ -313,6 +313,10 @@ thunder_pem_adjust_resource(device_t dev
struct rman *rm;
 
sc = device_get_softc(dev);
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS)
+   return (pci_domain_adjust_bus(sc->id, child, res, start, end));
+#endif
 
rm = thunder_pem_rman(sc, type);
if (rm == NULL)
@@ -619,6 +623,11 @@ thunder_pem_alloc_resource(device_t dev,
struct resource *res;
device_t parent_dev;
 
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS)
+   return (pci_domain_alloc_bus(sc->id, child, rid, start,  end,
+   count, flags));
+#endif
rm = thunder_pem_rman(sc, type);
if (rm == NULL) {
/* Find parent device. On ThunderX we know an exact path. */
@@ -675,7 +684,12 @@ thunder_pem_release_resource(device_t de
 struct resource *res)
 {
device_t parent_dev;
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   struct thunder_pem_softc *sc = device_get_softc(dev);
 
+   if (type == PCI_RES_BUS)
+   return (pci_domain_release_bus(sc->id, child, rid, res));
+#endif
/* Find parent device. On ThunderX we know an exact path. */
parent_dev = device_get_parent(device_get_parent(dev));
 

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Fri May 20 08:28:11 2016
(r300289)
+++ head/sys/dev/pci/pci_host_generic.c Fri May 20 08:29:00 2016
(r300290)
@@ -501,7 +501,14 @@ static int
 generic_pcie_release_resource(device_t dev, device_t child, int type,
 int rid, struct resource *res)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   struct generic_pcie_softc *sc;
 
+   if (type == PCI_RES_BUS) {
+   sc = device_get_softc(dev);
+   return (pci_domain_release_bus(sc->ecam, child, rid, res));
+   }
+#endif
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0) {
return (generic_pcie_release_resource_pcie(dev,
@@ -517,7 +524,15 @@ struct resource *
 pci_host_generic_alloc_resource(device_t dev, device_t child, int type, int 
*rid,
 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   struct generic_pcie_softc *sc;
 
+   if (type == PCI_RES_BUS) {
+   sc = device_get_softc(dev);
+   return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
+   count, flags));
+   }
+#endif
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0)
return (generic_pcie_alloc_resource_pcie(dev, child, type, rid,
@@ -579,6 +594,11 @@ generic_pcie_adjust_resource(device_t de
struct rman *rm;
 
sc = device_get_softc(dev);
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+   if (type == PCI_RES_BUS)
+   return (pci_domain_adjust_bus(sc->ecam, child, res, start,
+   end));
+#endif
 
rm = generic_pcie_rman(sc, type);
if (rm != NULL)
___
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: r300291 - head/sys/arm64/conf

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 08:43:18 2016
New Revision: 300291
URL: https://svnweb.freebsd.org/changeset/base/300291

Log:
  Enable NEW_PCIB on arm64.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/conf/DEFAULTS

Modified: head/sys/arm64/conf/DEFAULTS
==
--- head/sys/arm64/conf/DEFAULTSFri May 20 08:29:00 2016
(r300290)
+++ head/sys/arm64/conf/DEFAULTSFri May 20 08:43:18 2016
(r300291)
@@ -12,3 +12,4 @@ devicemem # Memory and kernel 
memory 
 optionsGEOM_PART_BSD
 optionsGEOM_PART_MBR
 
+optionsNEW_PCIB
___
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: r300292 - in head/sys/dev: bwn wi

2016-05-20 Thread Andriy Voskoboinyk
Author: avos
Date: Fri May 20 08:58:06 2016
New Revision: 300292
URL: https://svnweb.freebsd.org/changeset/base/300292

Log:
  wi: fix a typo.
  
  The max size of bitmask is IEEE80211_MODE_BYTES, not IEEE80211_MODE_MAX.
  
  Reuse it in bwn(4) while I'm here.
  
  Noticed by:   kevlo

Modified:
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/wi/if_wi.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Fri May 20 08:43:18 2016(r300291)
+++ head/sys/dev/bwn/if_bwn.c   Fri May 20 08:58:06 2016(r300292)
@@ -1498,7 +1498,7 @@ bwn_setup_channels(struct bwn_mac *mac, 
 {
struct bwn_softc *sc = mac->mac_sc;
struct ieee80211com *ic = &sc->sc_ic;
-   uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+   uint8_t bands[IEEE80211_MODE_BYTES];
 
memset(ic->ic_channels, 0, sizeof(ic->ic_channels));
ic->ic_nchans = 0;

Modified: head/sys/dev/wi/if_wi.c
==
--- head/sys/dev/wi/if_wi.c Fri May 20 08:43:18 2016(r300291)
+++ head/sys/dev/wi/if_wi.c Fri May 20 08:58:06 2016(r300292)
@@ -691,7 +691,7 @@ wi_getradiocaps(struct ieee80211com *ic,
 int maxchans, int *nchans, struct ieee80211_channel chans[])
 {
struct wi_softc *sc = ic->ic_softc;
-   u_int8_t bands[IEEE80211_MODE_MAX];
+   u_int8_t bands[IEEE80211_MODE_BYTES];
int i;
 
memset(bands, 0, sizeof(bands));
___
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: r299683 - in head/sys/arm64: arm64 include

2016-05-20 Thread Wojciech Macek
Where can I find any details about how was this change tested or reviewed?
Apparently it breaks AHCI on armv8. Log below.

Wojtek


mountroot> ufs:/dev/ada0s2
> Trying to mount root from ufs:/dev/ada0s2 []...
> warning: no time-of-day clock registered, system time will not be set
> accurately
> Setting hostuuid: 701a2acc-d0a0-11e5-8550-001517169365.
> Setting hostid: 0x2abffeca.
> No suitable dump device was found.
> Starting file system checks:
> /dev/ada0s2: FILE SYSTEM CLEAN; SKIPPING CHECKS
> /dev/ada0s2: clean, 16575173 free (25325 frags, 2068731 blocks, 0.1%
> fragmentation)
> panic: unsupported combination of sync operations: 0x0008



cpuid = 0
> KDB: stack backtrace:
> db_trace_self() at db_trace_self_wrapper+0x28
>  pc = 0x0050e4a0  lr = 0x0005a378
>  sp = 0x000b4236e380  fp = 0x000b4236e590
>
> db_trace_self_wrapper() at vpanic+0x170
>  pc = 0x0005a378  lr = 0x00276664
>  sp = 0x000b4236e5a0  fp = 0x000b4236e620
>
> vpanic() at panic+0x4c
>  pc = 0x00276664  lr = 0x002766f4
>  sp = 0x000b4236e630  fp = 0x000b4236e6b0
>
> panic() at bounce_bus_dmamap_sync+0x2d4
>  pc = 0x002766f4  lr = 0x0050d208
>  sp = 0x000b4236e6c0  fp = 0x000b4236e720
>
> bounce_bus_dmamap_sync() at ahci_end_transaction+0x214
>  pc = 0x0050d208  lr = 0x00061d14
>  sp = 0x000b4236e730  fp = 0x000b4236e780
>
> ahci_end_transaction() at ahci_ch_intr_main+0x3d4
>  pc = 0x00061d14  lr = 0x000616fc
>  sp = 0x000b4236e790  fp = 0x000b4236e800
>
> ahci_ch_intr_main() at ahci_ch_intr_direct+0x70
>  pc = 0x000616fc  lr = 0x00060a24
>  sp = 0x000b4236e810  fp = 0x000b4236e840
>
> ahci_ch_intr_direct() at ahci_intr_one+0x30
>  pc = 0x00060a24  lr = 0x0005f8f0
>  sp = 0x000b4236e850  fp = 0x000b4236e860
>
> ahci_intr_one() at intr_event_execute_handlers+0xac
>  pc = 0x0005f8f0  lr = 0x0023ee1c
>  sp = 0x000b4236e870  fp = 0x000b4236e8c0
>
> intr_event_execute_handlers() at ithread_loop+0xb0
>  pc = 0x0023ee1c  lr = 0x0023f4b4
>  sp = 0x000b4236e8d0  fp = 0x000b4236e930
>
> ithread_loop() at fork_exit+0x7c
>  pc = 0x0023f4b4  lr = 0x0023c374
>  sp = 0x000b4236e940  fp = 0x000b4236e970
>
> fork_exit() at fork_trampoline+0x10
>  pc = 0x0023c374  lr = 0x00523a84
>  sp = 0x000b4236e980  fp = 0x
>
> KDB: enter: panic
> [ thread pid 12 tid 100135 ]
> Stopped at  kdb_enter+0x40: undefined   d420
> db>


2016-05-13 18:03 GMT+02:00 Andrew Turner :

> Author: andrew
> Date: Fri May 13 16:03:50 2016
> New Revision: 299683
> URL: https://svnweb.freebsd.org/changeset/base/299683
>
> Log:
>   Add support to the arm64 busdma to handle the cache. For now this is
>   disabled, however when we enable it it will default to assume memory is
>   not cache-coherent, unless either the tag was created or the parent was
>   marked as cache-coherent.
>
>   Obtained from:ABT Systems Ltd
>   Relnotes: yes
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm64/arm64/busdma_bounce.c
>   head/sys/arm64/include/cpufunc.h
>
> Modified: head/sys/arm64/arm64/busdma_bounce.c
>
> ==
> --- head/sys/arm64/arm64/busdma_bounce.cFri May 13 15:57:55 2016
>   (r299682)
> +++ head/sys/arm64/arm64/busdma_bounce.cFri May 13 16:03:50 2016
>   (r299683)
> @@ -1,8 +1,11 @@
>  /*-
>   * Copyright (c) 1997, 1998 Justin T. Gibbs.
> - * Copyright (c) 2015 The FreeBSD Foundation
> + * Copyright (c) 2015-2016 The FreeBSD Foundation
>   * All rights reserved.
>   *
> + * Portions of this software were developed by Andrew Turner
> + * under sponsorship of the FreeBSD Foundation.
> + *
>   * Portions of this software were developed by Semihalf
>   * under sponsorship of the FreeBSD Foundation.
>   *
> @@ -62,6 +65,7 @@ enum {
> BF_COULD_BOUNCE = 0x01,
> BF_MIN_ALLOC_COMP   = 0x02,
> BF_KMEM_ALLOC   = 0x04,
> +   BF_COHERENT = 0x10,
>  };
>
>  struct bounce_zone;
> @@ -113,6 +117,13 @@ static SYSCTL_NODE(_hw, OID_AUTO, busdma
>  SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages,
> 0,
>"Total bounce pages");
>
> +struct sync_list {
> +   vm_offset_t vaddr;  /* kva of client data */
> +   bus_addr_t  paddr;  /* physical address */
> +   vm_page_t   pages;  /* starting page of client data */
> +   bus_size_t  datacount;  /* client data count */
> +};
> +
>  struct bus_dmamap {
> struct bp_list bpages;
>   

svn commit: r300293 - in head/sys: cam cam/ctl dev/isp

2016-05-20 Thread Alexander Motin
Author: mav
Date: Fri May 20 10:26:12 2016
New Revision: 300293
URL: https://svnweb.freebsd.org/changeset/base/300293

Log:
  Pass task management response information from CTL through CAM to isp(4),
  utilizing previously unused arg field of struct ccb_notify_acknowledge.
  
  This makes new QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT requests
  really functional for CAM target mode drivers.

Modified:
  head/sys/cam/cam_ccb.h
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Fri May 20 08:58:06 2016(r300292)
+++ head/sys/cam/cam_ccb.h  Fri May 20 10:26:12 2016(r300293)
@@ -1087,7 +1087,17 @@ struct ccb_notify_acknowledge {
u_int tag_id;   /* Tag for immediate notify */
u_int seq_id;   /* Tar for target of notify */
u_int initiator_id; /* Initiator Identifier */
-   u_int arg;  /* Function specific */
+   u_int arg;  /* Response information */
+   /*
+* Lower byte of arg is one of RESPONSE CODE values defined below
+* (subset of response codes from SPL-4 and FCP-4 specifications),
+* upper 3 bytes is code-specific ADDITIONAL RESPONSE INFORMATION.
+*/
+#defineCAM_RSP_TMF_COMPLETE0x00
+#defineCAM_RSP_TMF_REJECTED0x04
+#defineCAM_RSP_TMF_FAILED  0x05
+#defineCAM_RSP_TMF_SUCCEEDED   0x08
+#defineCAM_RSP_TMF_INCORRECT_LUN   0x09
 };
 
 /* HBA engine structures. */

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Fri May 20 08:58:06 2016(r300292)
+++ head/sys/cam/ctl/scsi_ctl.c Fri May 20 10:26:12 2016(r300293)
@@ -1552,6 +1552,7 @@ ctlfedone(struct cam_periph *periph, uni
/*
 * Queue this back down to the SIM as an immediate notify.
 */
+   done_ccb->ccb_h.status = CAM_REQ_INPROG;
done_ccb->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
xpt_action(done_ccb);
break;
@@ -2041,6 +2042,28 @@ ctlfe_done(union ctl_io *io)
 */
ccb->ccb_h.status = CAM_REQ_INPROG;
ccb->ccb_h.func_code = XPT_NOTIFY_ACKNOWLEDGE;
+   switch (io->taskio.task_status) {
+   case CTL_TASK_FUNCTION_COMPLETE:
+   ccb->cna2.arg = CAM_RSP_TMF_COMPLETE;
+   break;
+   case CTL_TASK_FUNCTION_SUCCEEDED:
+   ccb->cna2.arg = CAM_RSP_TMF_SUCCEEDED;
+   ccb->ccb_h.flags |= CAM_SEND_STATUS;
+   break;
+   case CTL_TASK_FUNCTION_REJECTED:
+   ccb->cna2.arg = CAM_RSP_TMF_REJECTED;
+   ccb->ccb_h.flags |= CAM_SEND_STATUS;
+   break;
+   case CTL_TASK_LUN_DOES_NOT_EXIST:
+   ccb->cna2.arg = CAM_RSP_TMF_INCORRECT_LUN;
+   ccb->ccb_h.flags |= CAM_SEND_STATUS;
+   break;
+   case CTL_TASK_FUNCTION_NOT_SUPPORTED:
+   ccb->cna2.arg = CAM_RSP_TMF_FAILED;
+   ccb->ccb_h.flags |= CAM_SEND_STATUS;
+   break;
+   }
+   ccb->cna2.arg |= scsi_3btoul(io->taskio.task_resp) << 8;
xpt_action(ccb);
} else if (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) {
if (softc->flags & CTLFE_LUN_WILDCARD) {

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Fri May 20 08:58:06 2016
(r300292)
+++ head/sys/dev/isp/isp_freebsd.c  Fri May 20 10:26:12 2016
(r300293)
@@ -856,7 +856,7 @@ static void isp_handle_platform_atio7(is
 static void isp_handle_platform_ctio(ispsoftc_t *, void *);
 static void isp_handle_platform_notify_fc(ispsoftc_t *, in_fcentry_t *);
 static void isp_handle_platform_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *);
-static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *);
+static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *, 
uint32_t rsp);
 static void isp_handle_platform_target_tmf(ispsoftc_t *, isp_notify_t *);
 static void isp_target_mark_aborted(ispsoftc_t *, union ccb *);
 static void isp_target_mark_aborted_early(ispsoftc_t *, tstate_t *, uint32_t);
@@ -2761,7 +2761,7 @@ isp_handle_platform_notify_24xx(ispsoftc
 }
 
 static int
-isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp)
+isp_handle_platform_target_notify_ack(ispsoftc_t *isp, isp_notify_t *mp, 
uint32_t rsp)
 {
 
if (is

svn commit: r300294 - in head/sys: conf dev/vnic modules/vnic modules/vnic/mrmlbus modules/vnic/thunder_bgx modules/vnic/thunder_mdio modules/vnic/vnicpf modules/vnic/vnicvf

2016-05-20 Thread Wojciech Macek
Author: wma
Date: Fri May 20 11:00:06 2016
New Revision: 300294
URL: https://svnweb.freebsd.org/changeset/base/300294

Log:
  Allow building VNIC as a module
  
  Add directory structure and fix dependencies to be able to
  build and use Cavium VNIC driver as a module.
  
  Reviewed by:  zbb
  Obtained from:Semihalf
  Sponsored by: Cavium
  Differential Revision:https://reviews.freebsd.org/D6345

Added:
  head/sys/modules/vnic/
  head/sys/modules/vnic/Makefile   (contents, props changed)
  head/sys/modules/vnic/mrmlbus/
  head/sys/modules/vnic/mrmlbus/Makefile   (contents, props changed)
  head/sys/modules/vnic/thunder_bgx/
  head/sys/modules/vnic/thunder_bgx/Makefile   (contents, props changed)
  head/sys/modules/vnic/thunder_mdio/
  head/sys/modules/vnic/thunder_mdio/Makefile   (contents, props changed)
  head/sys/modules/vnic/vnicpf/
  head/sys/modules/vnic/vnicpf/Makefile   (contents, props changed)
  head/sys/modules/vnic/vnicvf/
  head/sys/modules/vnic/vnicvf/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files.arm64
  head/sys/dev/vnic/mrml_bridge.c
  head/sys/dev/vnic/nic_main.c
  head/sys/dev/vnic/nicvf_main.c
  head/sys/dev/vnic/thunder_bgx.c
  head/sys/dev/vnic/thunder_mdio.c

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Fri May 20 10:26:12 2016(r300293)
+++ head/sys/conf/files.arm64   Fri May 20 11:00:06 2016(r300294)
@@ -82,7 +82,7 @@ dev/vnic/thunder_bgx_fdt.coptionalvnic
 dev/vnic/thunder_bgx.c optionalvnic pci
 dev/vnic/thunder_mdio_fdt.coptionalvnic fdt
 dev/vnic/thunder_mdio.coptionalvnic
-dev/vnic/lmac_if.m optionalvnic
+dev/vnic/lmac_if.m optionalinet | inet6 | vnic
 kern/kern_clocksource.cstandard
 kern/msi_if.m  optionalintrng
 kern/pic_if.m  optionalintrng

Modified: head/sys/dev/vnic/mrml_bridge.c
==
--- head/sys/dev/vnic/mrml_bridge.c Fri May 20 10:26:12 2016
(r300293)
+++ head/sys/dev/vnic/mrml_bridge.c Fri May 20 11:00:06 2016
(r300294)
@@ -85,6 +85,7 @@ static devclass_t mrmlbus_fdt_devclass;
 
 EARLY_DRIVER_MODULE(mrmlbus, pcib, mrmlbus_fdt_driver, mrmlbus_fdt_devclass, 
0, 0,
 BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
+MODULE_VERSION(mrmlbus, 1);
 
 static int mrmlb_ofw_fill_ranges(phandle_t, struct simplebus_softc *);
 static int mrmlb_ofw_bus_attach(device_t);

Modified: head/sys/dev/vnic/nic_main.c
==
--- head/sys/dev/vnic/nic_main.cFri May 20 10:26:12 2016
(r300293)
+++ head/sys/dev/vnic/nic_main.cFri May 20 11:00:06 2016
(r300294)
@@ -137,18 +137,19 @@ static device_method_t nicpf_methods[] =
DEVMETHOD_END,
 };
 
-static driver_t nicpf_driver = {
+static driver_t vnicpf_driver = {
"vnicpf",
nicpf_methods,
sizeof(struct nicpf),
 };
 
-static devclass_t nicpf_devclass;
+static devclass_t vnicpf_devclass;
 
-DRIVER_MODULE(nicpf, pci, nicpf_driver, nicpf_devclass, 0, 0);
-MODULE_DEPEND(nicpf, pci, 1, 1, 1);
-MODULE_DEPEND(nicpf, ether, 1, 1, 1);
-MODULE_DEPEND(nicpf, thunder_bgx, 1, 1, 1);
+DRIVER_MODULE(vnicpf, pci, vnicpf_driver, vnicpf_devclass, 0, 0);
+MODULE_VERSION(vnicpf, 1);
+MODULE_DEPEND(vnicpf, pci, 1, 1, 1);
+MODULE_DEPEND(vnicpf, ether, 1, 1, 1);
+MODULE_DEPEND(vnicpf, thunder_bgx, 1, 1, 1);
 
 static int nicpf_alloc_res(struct nicpf *);
 static void nicpf_free_res(struct nicpf *);

Modified: head/sys/dev/vnic/nicvf_main.c
==
--- head/sys/dev/vnic/nicvf_main.c  Fri May 20 10:26:12 2016
(r300293)
+++ head/sys/dev/vnic/nicvf_main.c  Fri May 20 11:00:06 2016
(r300294)
@@ -129,10 +129,11 @@ static driver_t nicvf_driver = {
 
 static devclass_t nicvf_devclass;
 
-DRIVER_MODULE(nicvf, pci, nicvf_driver, nicvf_devclass, 0, 0);
-MODULE_DEPEND(nicvf, pci, 1, 1, 1);
-MODULE_DEPEND(nicvf, ether, 1, 1, 1);
-MODULE_DEPEND(nicvf, vnic_pf, 1, 1, 1);
+DRIVER_MODULE(vnicvf, pci, nicvf_driver, nicvf_devclass, 0, 0);
+MODULE_VERSION(vnicvf, 1);
+MODULE_DEPEND(vnicvf, pci, 1, 1, 1);
+MODULE_DEPEND(vnicvf, ether, 1, 1, 1);
+MODULE_DEPEND(vnicvf, vnicpf, 1, 1, 1);
 
 static int nicvf_allocate_misc_interrupt(struct nicvf *);
 static int nicvf_enable_misc_interrupt(struct nicvf *);

Modified: head/sys/dev/vnic/thunder_bgx.c
==
--- head/sys/dev/vnic/thunder_bgx.c Fri May 20 10:26:12 2016
(r300293)
+++ head/sys/dev/vnic/thunder_bgx.c Fri May 20 11:00:06 2016
(r300294)
@@ -109,9 +109,10 @@ static driver_t thunder_bgx_driver = {
 static devclass_

svn commit: r300295 - head/sys/dev/vnic

2016-05-20 Thread Wojciech Macek
Author: wma
Date: Fri May 20 11:02:04 2016
New Revision: 300295
URL: https://svnweb.freebsd.org/changeset/base/300295

Log:
  Fix VNIC module unloading
  
  Fix panics which were present when BGX and PF module were unloaded.
  
  Reviewed by:  zbb
  Obtained from:Semihalf
  Sponsored by: Cavium
  Differential Revision:https://reviews.freebsd.org/D6346

Modified:
  head/sys/dev/vnic/nic_main.c
  head/sys/dev/vnic/thunder_bgx.c

Modified: head/sys/dev/vnic/nic_main.c
==
--- head/sys/dev/vnic/nic_main.cFri May 20 11:00:06 2016
(r300294)
+++ head/sys/dev/vnic/nic_main.cFri May 20 11:02:04 2016
(r300295)
@@ -247,7 +247,9 @@ static int
 nicpf_detach(device_t dev)
 {
struct nicpf *nic;
+   int err;
 
+   err = 0;
nic = device_get_softc(dev);
 
callout_drain(&nic->check_link);
@@ -257,7 +259,12 @@ nicpf_detach(device_t dev)
nicpf_free_res(nic);
pci_disable_busmaster(dev);
 
-   return (0);
+#ifdef PCI_IOV
+   err = pci_iov_detach(dev);
+   if (err != 0)
+   device_printf(dev, "SR-IOV in use. Detach first.\n");
+#endif
+   return (err);
 }
 
 /*
@@ -1055,6 +1062,9 @@ nic_disable_msix(struct nicpf *nic)
nic->msix_enabled = 0;
nic->num_vec = 0;
}
+
+   bus_release_resource(nic->dev, SYS_RES_MEMORY,
+   rman_get_rid(nic->msix_table_res), nic->msix_table_res);
 }
 
 static void
@@ -1071,7 +1081,7 @@ nic_free_all_interrupts(struct nicpf *ni
nic->msix_entries[irq].handle);
}
 
-   bus_release_resource(nic->dev, SYS_RES_IRQ, irq,
+   bus_release_resource(nic->dev, SYS_RES_IRQ, irq + 1,
nic->msix_entries[irq].irq_res);
}
 }

Modified: head/sys/dev/vnic/thunder_bgx.c
==
--- head/sys/dev/vnic/thunder_bgx.c Fri May 20 11:00:06 2016
(r300294)
+++ head/sys/dev/vnic/thunder_bgx.c Fri May 20 11:02:04 2016
(r300295)
@@ -136,12 +136,16 @@ static int
 thunder_bgx_attach(device_t dev)
 {
struct bgx *bgx;
-   uint8_t lmac;
+   uint8_t lmacid;
int err;
int rid;
+   struct lmac *lmac;
 
bgx = malloc(sizeof(*bgx), M_BGX, (M_WAITOK | M_ZERO));
bgx->dev = dev;
+
+   lmac = device_get_softc(dev);
+   lmac->bgx = bgx;
/* Enable bus mastering */
pci_enable_busmaster(dev);
/* Allocate resources - configuration registers */
@@ -168,11 +172,11 @@ thunder_bgx_attach(device_t dev)
bgx_init_hw(bgx);
 
/* Enable all LMACs */
-   for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
-   err = bgx_lmac_enable(bgx, lmac);
+   for (lmacid = 0; lmacid < bgx->lmac_count; lmacid++) {
+   err = bgx_lmac_enable(bgx, lmacid);
if (err) {
device_printf(dev, "BGX%d failed to enable lmac%d\n",
-   bgx->bgx_id, lmac);
+   bgx->bgx_id, lmacid);
goto err_free_res;
}
}
@@ -203,6 +207,12 @@ thunder_bgx_detach(device_t dev)
for (lmacid = 0; lmacid < bgx->lmac_count; lmacid++)
bgx_lmac_disable(bgx, lmacid);
 
+   bgx_vnic[bgx->bgx_id] = NULL;
+   bus_release_resource(dev, SYS_RES_MEMORY,
+   rman_get_rid(bgx->reg_base), bgx->reg_base);
+   free(bgx, M_BGX);
+   pci_disable_busmaster(dev);
+
return (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: r300296 - head/sys/dev/isp

2016-05-20 Thread Alexander Motin
Author: mav
Date: Fri May 20 11:56:16 2016
New Revision: 300296
URL: https://svnweb.freebsd.org/changeset/base/300296

Log:
  Pass proper for 23xx arguments to isp_endcmd().

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

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Fri May 20 11:02:04 2016
(r300295)
+++ head/sys/dev/isp/isp_freebsd.c  Fri May 20 11:56:16 2016
(r300296)
@@ -2003,7 +2003,7 @@ noresrc:
ntp = isp_get_ntpd(isp, tptr);
if (ntp == NULL) {
rls_lun_statep(isp, tptr);
-   isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_BUSY, 0);
+   isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
return;
}
memcpy(ntp->rd.data, aep, QENTRY_LEN);
___
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: r300297 - head/sys/netinet6

2016-05-20 Thread Andrey V. Elsukov
Author: ae
Date: Fri May 20 12:09:10 2016
New Revision: 300297
URL: https://svnweb.freebsd.org/changeset/base/300297

Log:
  Remove ip6 pointer initialization and strange check from the beginning
  of ip6_output(). It isn't used until the first time adjusted.
  Remove the comment about adjusting where it is actually initialized.

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Fri May 20 11:56:16 2016
(r300296)
+++ head/sys/netinet6/ip6_output.c  Fri May 20 12:09:10 2016
(r300297)
@@ -325,12 +325,6 @@ ip6_output(struct mbuf *m0, struct ip6_p
struct m_tag *fwd_tag = NULL;
uint32_t id;
 
-   ip6 = mtod(m, struct ip6_hdr *);
-   if (ip6 == NULL) {
-   printf ("ip6 is NULL");
-   goto bad;
-   }
-
if (inp != NULL) {
M_SETFIB(m, inp->inp_inc.inc_fibnum);
if ((flags & IP_NODEFAULTFLOWID) == 0) {
@@ -412,7 +406,6 @@ ip6_output(struct mbuf *m0, struct ip6_p
hdrsplit++;
}
 
-   /* adjust pointer */
ip6 = mtod(m, struct ip6_hdr *);
 
/* adjust mbuf packet header length */
___
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: r300298 - head/sys/netinet6

2016-05-20 Thread Andrey V. Elsukov
Author: ae
Date: Fri May 20 12:17:40 2016
New Revision: 300298
URL: https://svnweb.freebsd.org/changeset/base/300298

Log:
  Remove ip6 adjusting from the place where pointer couldn't be changed.
  And add comment after calling PFIL hooks, where it could be changed.

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Fri May 20 12:09:10 2016
(r300297)
+++ head/sys/netinet6/ip6_output.c  Fri May 20 12:17:40 2016
(r300298)
@@ -536,10 +536,6 @@ again:
else
ip6->ip6_hlim = V_ip6_defmcasthlim;
}
-
-   /* adjust pointer */
-   ip6 = mtod(m, struct ip6_hdr *);
-
/*
 * Validate route against routing table additions;
 * a better/more specific route might have been added.
@@ -798,6 +794,7 @@ again:
error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, inp);
if (error != 0 || m == NULL)
goto done;
+   /* adjust pointer */
ip6 = mtod(m, struct ip6_hdr *);
 
needfiblookup = 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"


Re: svn commit: r299683 - in head/sys/arm64: arm64 include

2016-05-20 Thread Andrew Turner
On Fri, 20 May 2016 11:44:44 +0200
Wojciech Macek  wrote:

> Where can I find any details about how was this change tested or
> reviewed? Apparently it breaks AHCI on armv8. Log below.
> 
> Wojtek
> 
> 
> mountroot> ufs:/dev/ada0s2
> > Trying to mount root from ufs:/dev/ada0s2 []...
> > warning: no time-of-day clock registered, system time will not be
> > set accurately
> > Setting hostuuid: 701a2acc-d0a0-11e5-8550-001517169365.
> > Setting hostid: 0x2abffeca.
> > No suitable dump device was found.
> > Starting file system checks:
> > /dev/ada0s2: FILE SYSTEM CLEAN; SKIPPING CHECKS
> > /dev/ada0s2: clean, 16575173 free (25325 frags, 2068731 blocks, 0.1%
> > fragmentation)
> > panic: unsupported combination of sync operations: 0x0008  

How were you getting into dma_dcache_sync? That should only happen when
map->sync_count != 0, this should only be possible when the BF_COHERENT
flag is set. This flag should never get set.

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"


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

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 12:38:48 2016
New Revision: 300299
URL: https://svnweb.freebsd.org/changeset/base/300299

Log:
  Filter out BUS_DMASYNC_POSTWRITE sync operations, there is nothing for us
  to do on these.
  
  Reported by:  wma
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cFri May 20 12:17:40 2016
(r300298)
+++ head/sys/arm64/arm64/busdma_bounce.cFri May 20 12:38:48 2016
(r300299)
@@ -955,6 +955,9 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
struct sync_list *sl, *end;
vm_offset_t datavaddr, tempvaddr;
 
+   if (op == BUS_DMASYNC_POSTWRITE)
+   return;
+
if ((op & BUS_DMASYNC_POSTREAD) != 0) {
/*
 * Wait for any DMA operations to complete before the bcopy.
___
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: r300300 - head/sys/arm64/arm64

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 13:11:07 2016
New Revision: 300300
URL: https://svnweb.freebsd.org/changeset/base/300300

Log:
  Add more useful GICv3 register definitions. While here fix
  GITS_CBASER_CACHE_MASK to use the correct shift macro.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3_reg.h

Modified: head/sys/arm64/arm64/gic_v3_reg.h
==
--- head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 12:38:48 2016
(r300299)
+++ head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 13:11:07 2016
(r300300)
@@ -142,6 +142,8 @@
 #defineGICR_PROPBASER_CACHE_NIWAWB 0x5UL
 #defineGICR_PROPBASER_CACHE_NIRAWAWT   0x6UL
 #defineGICR_PROPBASER_CACHE_NIRAWAWB   0x7UL
+#defineGICR_PROPBASER_CACHE_MASK   \
+   (0x7UL << GICR_PROPBASER_CACHE_SHIFT)
 
 /*
  * Shareability
@@ -179,6 +181,8 @@
 #defineGICR_PENDBASER_CACHE_NIWAWB 0x5UL
 #defineGICR_PENDBASER_CACHE_NIRAWAWT   0x6UL
 #defineGICR_PENDBASER_CACHE_NIRAWAWB   0x7UL
+#defineGICR_PENDBASER_CACHE_MASK   \
+   (0x7UL << GICR_PENDBASER_CACHE_SHIFT)
 
 /*
  * Shareability
@@ -217,6 +221,26 @@
 #defineGITS_CTLR   (0x)
 #defineGITS_CTLR_EN(1 << 0)
 
+#defineGITS_IIDR   (0x0004)
+#define GITS_IIDR_PRODUCT_SHIFT24
+#define GITS_IIDR_PRODUCT_MASK (0xff << 
GITS_IIDR_PRODUCT_SHIFT)
+#define GITS_IIDR_VARIANT_SHIFT16
+#define GITS_IIDR_VARIANT_MASK (0xf << GITS_IIDR_VARIANT_SHIFT)
+#define GITS_IIDR_REVISION_SHIFT   12
+#define GITS_IIDR_REVISION_MASK(0xf << 
GITS_IIDR_REVISION_SHIFT)
+#define GITS_IIDR_IMPLEMENTOR_SHIFT0
+#define GITS_IIDR_IMPLEMENTOR_MASK (0xfff << 
GITS_IIDR_IMPLEMENTOR_SHIFT)
+
+#define GITS_IIDR_RAW(impl, prod, var, rev)\
+((prod) << GITS_IIDR_PRODUCT_SHIFT |   \
+ (var) << GITS_IIDR_VARIANT_SHIFT |\
+ (rev) << GITS_IIDR_REVISION_SHIFT |   \
+ (impl) << GITS_IIDR_IMPLEMENTOR_SHIFT)
+
+#define GITS_IIDR_IMPL_CAVIUM  (0x34c)
+#define GITS_IIDR_PROD_THUNDER (0xa1)
+#define GITS_IIDR_VAR_THUNDER_1(0x0)
+
 #defineGITS_CBASER (0x0080)
 #defineGITS_CBASER_VALID   (1UL << 63)
 /*
@@ -239,7 +263,7 @@
 #defineGITS_CBASER_CACHE_NIWAWB0x5UL
 #defineGITS_CBASER_CACHE_NIRAWAWT  0x6UL
 #defineGITS_CBASER_CACHE_NIRAWAWB  0x7UL
-#defineGITS_CBASER_CACHE_MASK  (0x7UL << 
GITS_CBASER_TYPE_SHIFT)
+#defineGITS_CBASER_CACHE_MASK  (0x7UL << 
GITS_CBASER_CACHE_SHIFT)
 /*
  * Shareability
  * 0x0 - Non-shareable
___
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: r300301 - head/contrib/gcc

2016-05-20 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 20 14:36:49 2016
New Revision: 300301
URL: https://svnweb.freebsd.org/changeset/base/300301

Log:
  GCC: Add support for named initializers for anonymous structs/unions.
  
  This is a C11 feature that is starting to get used in places such as Mesa.
  This implementation takes a different approach to upstream and is
  therefore not covered by GPLv3.
  
  Obtained from:OpenBSD (CVS rev. 1.2)
  MFC after:3 weeks

Modified:
  head/contrib/gcc/c-typeck.c

Modified: head/contrib/gcc/c-typeck.c
==
--- head/contrib/gcc/c-typeck.c Fri May 20 13:11:07 2016(r300300)
+++ head/contrib/gcc/c-typeck.c Fri May 20 14:36:49 2016(r300301)
@@ -6041,6 +6041,7 @@ set_init_index (tree first, tree last)
 void
 set_init_label (tree fieldname)
 {
+  tree anon = NULL_TREE;
   tree tail;
 
   if (set_designator (0))
@@ -6058,6 +6059,15 @@ set_init_label (tree fieldname)
   for (tail = TYPE_FIELDS (constructor_type); tail;
tail = TREE_CHAIN (tail))
 {
+  if (DECL_NAME (tail) == NULL_TREE
+ && (TREE_CODE (TREE_TYPE (tail)) == RECORD_TYPE
+ || TREE_CODE (TREE_TYPE (tail)) == UNION_TYPE))
+   {
+ anon = lookup_field (tail, fieldname);
+ if (anon)
+   break;
+   }
+
   if (DECL_NAME (tail) == fieldname)
break;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r300257 - in head/sys/boot/i386: libi386 zfsboot

2016-05-20 Thread John Baldwin
On Friday, May 20, 2016 01:41:47 AM Allan Jude wrote:
> Author: allanjude
> Date: Fri May 20 01:41:47 2016
> New Revision: 300257
> URL: https://svnweb.freebsd.org/changeset/base/300257
> 
> Log:
>   Fixup the geliboot sector rounding code
>   
>   Replace all rounding with the round{up,down}2 macros
>   a missing set of braces caused the previous code to be incorrect
>   
>   replace alloca() with malloc() because alloca() can return an allocation
>   that is actually invalid, causing boot to fail

No, you have to revert the malloc!  malloc() can be anywhere.  The alloca
is _on purpose_ to get a bufer below 1MB so that it will work with all
devices.  Some BIOSes can only store data in the first 1MB.

-- 
John Baldwin
___
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: r300257 - in head/sys/boot/i386: libi386 zfsboot

2016-05-20 Thread Allan Jude
On 2016-05-20 10:48, John Baldwin wrote:
> On Friday, May 20, 2016 01:41:47 AM Allan Jude wrote:
>> Author: allanjude
>> Date: Fri May 20 01:41:47 2016
>> New Revision: 300257
>> URL: https://svnweb.freebsd.org/changeset/base/300257
>>
>> Log:
>>   Fixup the geliboot sector rounding code
>>   
>>   Replace all rounding with the round{up,down}2 macros
>>   a missing set of braces caused the previous code to be incorrect
>>   
>>   replace alloca() with malloc() because alloca() can return an allocation
>>   that is actually invalid, causing boot to fail
> 
> No, you have to revert the malloc!  malloc() can be anywhere.  The alloca
> is _on purpose_ to get a bufer below 1MB so that it will work with all
> devices.  Some BIOSes can only store data in the first 1MB.
> 

to be clear, the alloca() was something I added, not something that was
there before. And it was breaking, because ZFS was trying to allocate
too large a block of memory, that wouldn't fit below 1MB.

-- 
Allan Jude
___
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: r300302 - head/sys/netpfil/ipfw

2016-05-20 Thread Andrey V. Elsukov
Author: ae
Date: Fri May 20 15:00:12 2016
New Revision: 300302
URL: https://svnweb.freebsd.org/changeset/base/300302

Log:
  Fix the regression introduced in r300143.
  When we are creating new dynamic state use MATCH_FORWARD direction to
  correctly initialize protocol's state.

Modified:
  head/sys/netpfil/ipfw/ip_fw_dynamic.c

Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c
==
--- head/sys/netpfil/ipfw/ip_fw_dynamic.c   Fri May 20 14:36:49 2016
(r300301)
+++ head/sys/netpfil/ipfw/ip_fw_dynamic.c   Fri May 20 15:00:12 2016
(r300302)
@@ -687,7 +687,7 @@ ipfw_install_state(struct ip_fw_chain *c
 ipfw_insn_limit *cmd, struct ip_fw_args *args, uint32_t tablearg)
 {
ipfw_dyn_rule *q;
-   int i, dir;
+   int i;
 
DEB(print_dyn_rule(&args->f_id, cmd->o.opcode, "install_state", "");)

@@ -695,7 +695,7 @@ ipfw_install_state(struct ip_fw_chain *c
 
IPFW_BUCK_LOCK(i);
 
-   q = lookup_dyn_rule_locked(&args->f_id, i, &dir, NULL);
+   q = lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL);
if (q != NULL) {/* should never occur */
DEB(
if (last_log != time_uptime) {
@@ -816,7 +816,7 @@ ipfw_install_state(struct ip_fw_chain *c
return (1); /* Notify caller about failure */
}
 
-   dyn_update_proto_state(q, &args->f_id, NULL, dir);
+   dyn_update_proto_state(q, &args->f_id, NULL, MATCH_FORWARD);
IPFW_BUCK_UNLOCK(i);
return (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: r300303 - in head: . contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/sys lib/libc/aarch64 lib/libc/aarch64/sys sys/sys

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 15:04:48 2016
New Revision: 300303
URL: https://svnweb.freebsd.org/changeset/base/300303

Log:
  Remove brk and sbrk from arm64. They were defined in The Single UNIX
  Specification, Version 2, but marked as legacy, and have been removed from
  later specifications. After 12 years it is time to remove them from new
  architectures when the main use for sbrk is an invalid method to attempt
  to find how much memory has been allocated from malloc.
  
  There are a few places in the tree that still call sbrk, however they are
  not used on arm64. They will need to be fixed to cross build from arm64,
  but these will be fixed in a follow up commit.
  
  Old copies of binutils from ports called into sbrk, however this has been
  fixed around 6 weeks ago. It is advised to update binutils on arm64 before
  installing a world that includes this change.
  
  Reviewed by:  brooks, emaste
  Obtained from:brooks
  Relnotes: yes
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D6464

Deleted:
  head/lib/libc/aarch64/sys/brk.S
  head/lib/libc/aarch64/sys/sbrk.S
Modified:
  head/UPDATING
  head/contrib/netbsd-tests/lib/libc/gen/t_dir.c
  head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
  head/lib/libc/aarch64/Symbol.map
  head/lib/libc/aarch64/sys/Makefile.inc
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Fri May 20 15:00:12 2016(r300302)
+++ head/UPDATING   Fri May 20 15:04:48 2016(r300303)
@@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20160520:
+   The brk and sbrk functions have been removed from libc on arm64.
+   Binutils from ports has been updated to not link to these
+   functions and should be updated to the latest version before
+   installing a new libc.
+
 20160517:
The armv6 port now defaults to hard float ABI. Limited support
for running both hardfloat and soft float on the same system

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c
==
--- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c  Fri May 20 15:00:12 
2016(r300302)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c  Fri May 20 15:04:48 
2016(r300303)
@@ -111,6 +111,7 @@ ATF_TC_BODY(seekdir_basic, tc)
closedir(dp);
 }
 
+#ifndef __aarch64__ /* There is no sbrk on AArch64 */
 ATF_TC(telldir_leak);
 ATF_TC_HEAD(telldir_leak, tc)
 {
@@ -154,12 +155,15 @@ ATF_TC_BODY(telldir_leak, tc)
(void)printf("OK: used %td bytes\n", (char *)(sbrk(0))-memused);
}
 }
+#endif
 
 ATF_TP_ADD_TCS(tp)
 {
 
ATF_TP_ADD_TC(tp, seekdir_basic);
+#ifndef __aarch64__
ATF_TP_ADD_TC(tp, telldir_leak);
+#endif
 
return atf_no_error();
 }

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cFri May 20 15:00:12 
2016(r300302)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cFri May 20 15:04:48 
2016(r300303)
@@ -176,7 +176,9 @@ ATF_TC_BODY(mlock_err, tc)
unsigned long vmin = 0;
size_t len = sizeof(vmin);
 #endif
+#ifndef __aarch64__
void *invalid_ptr;
+#endif
int null_errno = ENOMEM;/* error expected for NULL */
 
 #ifdef __FreeBSD__
@@ -212,6 +214,7 @@ ATF_TC_BODY(mlock_err, tc)
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1);
 
+#ifndef __aarch64__ /* There is no sbrk on AArch64 */
/*
 * Try to create a pointer to an unmapped page - first after current
 * brk will likely do.
@@ -224,6 +227,7 @@ ATF_TC_BODY(mlock_err, tc)
 
errno = 0;
ATF_REQUIRE_ERRNO(ENOMEM, munlock(invalid_ptr, page) == -1);
+#endif
 }
 
 #ifdef __FreeBSD__

Modified: head/lib/libc/aarch64/Symbol.map
==
--- head/lib/libc/aarch64/Symbol.mapFri May 20 15:00:12 2016
(r300302)
+++ head/lib/libc/aarch64/Symbol.mapFri May 20 15:04:48 2016
(r300303)
@@ -28,8 +28,6 @@ FBSD_1.0 {
ntohl;
ntohs;
vfork;
-   brk;
-   sbrk;
makecontext;
 };
 

Modified: head/lib/libc/aarch64/sys/Makefile.inc
==
--- head/lib/libc/aarch64/sys/Makefile.inc  Fri May 20 15:00:12 2016
(r300302)
+++ head/lib/libc/aarch64/sys/Makefile.inc  Fri May 20 15:04:48 2016
(r300303)
@@ -5,10 +5,8 @@ MIASM:=${MIASM:Nfreebsd[467]_*}
 SRCS+= __vdso_gettc.c
 
 

svn commit: r300304 - head/contrib/binutils/gas/config

2016-05-20 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 20 15:14:38 2016
New Revision: 300304
URL: https://svnweb.freebsd.org/changeset/base/300304

Log:
  gas/config/tc-arm.c: Minor re-sorting to match upstream history.
  
  No functional change.
  
  MFC after:2 weeks

Modified:
  head/contrib/binutils/gas/config/tc-arm.c

Modified: head/contrib/binutils/gas/config/tc-arm.c
==
--- head/contrib/binutils/gas/config/tc-arm.c   Fri May 20 15:04:48 2016
(r300303)
+++ head/contrib/binutils/gas/config/tc-arm.c   Fri May 20 15:14:38 2016
(r300304)
@@ -3837,10 +3837,10 @@ s_arm_eabi_attribute (int ignored ATTRIB
 #endif /* OBJ_ELF */
 
 static void s_arm_arch (int);
-static void s_arm_arch_extension (int);
 static void s_arm_object_arch (int);
 static void s_arm_cpu (int);
 static void s_arm_fpu (int);
+static void s_arm_arch_extension (int);
 
 #ifdef TE_PE
 
@@ -3892,9 +3892,9 @@ const pseudo_typeS md_pseudo_table[] =
   { "syntax", s_syntax,  0 },
   { "cpu",s_arm_cpu, 0 },
   { "arch",   s_arm_arch,0 },
-  { "arch_extension", s_arm_arch_extension,  0 },
   { "object_arch", s_arm_object_arch,  0 },
   { "fpu",s_arm_fpu, 0 },
+  { "arch_extension", s_arm_arch_extension,  0 },
 #ifdef OBJ_ELF
   { "word",   s_arm_elf_cons, 4 },
   { "long",   s_arm_elf_cons, 4 },
___
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: r300305 - head/sys/amd64/amd64

2016-05-20 Thread Konstantin Belousov
Author: kib
Date: Fri May 20 15:32:48 2016
New Revision: 300305
URL: https://svnweb.freebsd.org/changeset/base/300305

Log:
  Use unsigned type for the loop index to make overflow checks effective.
  
  PR:   209661
  Reported by:  cturt
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

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

Modified: head/sys/amd64/amd64/sys_machdep.c
==
--- head/sys/amd64/amd64/sys_machdep.c  Fri May 20 15:14:38 2016
(r300304)
+++ head/sys/amd64/amd64/sys_machdep.c  Fri May 20 15:32:48 2016
(r300305)
@@ -333,11 +333,12 @@ amd64_set_ioperm(td, uap)
struct thread *td;
struct i386_ioperm_args *uap;
 {
-   int i, error;
char *iomap;
struct amd64tss *tssp;
struct system_segment_descriptor *tss_sd;
struct pcb *pcb;
+   u_int i;
+   int error;
 
if ((error = priv_check(td, PRIV_IO)) != 0)
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300306 - head/sys/mips/include

2016-05-20 Thread Robert Watson
Author: rwatson
Date: Fri May 20 15:34:03 2016
New Revision: 300306
URL: https://svnweb.freebsd.org/changeset/base/300306

Log:
  Garbage collect unused prototype for clockintr().
  
  MFC after:3 days

Modified:
  head/sys/mips/include/clock.h

Modified: head/sys/mips/include/clock.h
==
--- head/sys/mips/include/clock.h   Fri May 20 15:32:48 2016
(r300305)
+++ head/sys/mips/include/clock.h   Fri May 20 15:34:03 2016
(r300306)
@@ -17,8 +17,6 @@
 
 extern int cpu_clock;
 
-extern uint32_t clockintr(uint32_t, struct trapframe *);
-
 #define wall_cmos_clock 0
 #define adjkerntz 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: r300307 - head/sys/netpfil/pf

2016-05-20 Thread Kristof Provost
Author: kp
Date: Fri May 20 15:41:05 2016
New Revision: 300307
URL: https://svnweb.freebsd.org/changeset/base/300307

Log:
  pf: Fix fragment timeout
  
  We were inconsistent about the use of time_second vs. time_uptime.
  Always use time_uptime so the value can be meaningfully compared.
  
  Submitted by: "Max" 
  MFC after:4 days

Modified:
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Fri May 20 15:34:03 2016
(r300306)
+++ head/sys/netpfil/pf/pf_norm.c   Fri May 20 15:41:05 2016
(r300307)
@@ -374,7 +374,7 @@ pf_fillup_fragment(struct pf_fragment_cm
}
 
*(struct pf_fragment_cmp *)frag = *key;
-   frag->fr_timeout = time_second;
+   frag->fr_timeout = time_uptime;
frag->fr_maxlen = frent->fe_len;
TAILQ_INIT(&frag->fr_queue);
 
___
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: r300308 - head/sys/arm64/arm64

2016-05-20 Thread Andrew Turner
Author: andrew
Date: Fri May 20 15:43:51 2016
New Revision: 300308
URL: https://svnweb.freebsd.org/changeset/base/300308

Log:
  Extract the correct bits from the GICD_TYPER register. The interrupt count
  is encoded in the bottom 5 bits.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3_reg.h

Modified: head/sys/arm64/arm64/gic_v3_reg.h
==
--- head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 15:41:05 2016
(r300307)
+++ head/sys/arm64/arm64/gic_v3_reg.h   Fri May 20 15:43:51 2016
(r300308)
@@ -67,7 +67,7 @@
 
 #defineGICD_TYPER  (0x0004)
 #defineGICD_TYPER_IDBITS(n)n) >> 19) & 0x1F) + 1)
-#defineGICD_TYPER_I_NUM(n) n) & 0xF1) + 1) * 32)
+#defineGICD_TYPER_I_NUM(n) n) & 0x1F) + 1) * 32)
 
 #defineGICD_ISENABLER(n)   (0x0100 + (((n) >> 5) * 4))
 #defineGICD_I_PER_ISENABLERn   (32)
___
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: r300257 - in head/sys/boot/i386: libi386 zfsboot

2016-05-20 Thread Adrian Chadd
Right, but if you hand that malloc() pointer to any BIOS int calls,
it's highly likely it won't work right. :)


-a


On 20 May 2016 at 08:00, Allan Jude  wrote:
> On 2016-05-20 10:48, John Baldwin wrote:
>> On Friday, May 20, 2016 01:41:47 AM Allan Jude wrote:
>>> Author: allanjude
>>> Date: Fri May 20 01:41:47 2016
>>> New Revision: 300257
>>> URL: https://svnweb.freebsd.org/changeset/base/300257
>>>
>>> Log:
>>>   Fixup the geliboot sector rounding code
>>>
>>>   Replace all rounding with the round{up,down}2 macros
>>>   a missing set of braces caused the previous code to be incorrect
>>>
>>>   replace alloca() with malloc() because alloca() can return an allocation
>>>   that is actually invalid, causing boot to fail
>>
>> No, you have to revert the malloc!  malloc() can be anywhere.  The alloca
>> is _on purpose_ to get a bufer below 1MB so that it will work with all
>> devices.  Some BIOSes can only store data in the first 1MB.
>>
>
> to be clear, the alloca() was something I added, not something that was
> there before. And it was breaking, because ZFS was trying to allocate
> too large a block of memory, that wouldn't fit below 1MB.
>
> --
> Allan Jude
>
___
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: r300257 - in head/sys/boot/i386: libi386 zfsboot

2016-05-20 Thread John Baldwin
On Friday, May 20, 2016 11:00:22 AM Allan Jude wrote:
> On 2016-05-20 10:48, John Baldwin wrote:
> > On Friday, May 20, 2016 01:41:47 AM Allan Jude wrote:
> >> Author: allanjude
> >> Date: Fri May 20 01:41:47 2016
> >> New Revision: 300257
> >> URL: https://svnweb.freebsd.org/changeset/base/300257
> >>
> >> Log:
> >>   Fixup the geliboot sector rounding code
> >>   
> >>   Replace all rounding with the round{up,down}2 macros
> >>   a missing set of braces caused the previous code to be incorrect
> >>   
> >>   replace alloca() with malloc() because alloca() can return an allocation
> >>   that is actually invalid, causing boot to fail
> > 
> > No, you have to revert the malloc!  malloc() can be anywhere.  The alloca
> > is _on purpose_ to get a bufer below 1MB so that it will work with all
> > devices.  Some BIOSes can only store data in the first 1MB.
> > 
> 
> to be clear, the alloca() was something I added, not something that was
> there before. And it was breaking, because ZFS was trying to allocate
> too large a block of memory, that wouldn't fit below 1MB.

Sorry, I had that thought you were changing the "real" alloca() in
bd_io() when reading the diff.

-- 
John Baldwin
___
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: r300301 - head/contrib/gcc

2016-05-20 Thread Ed Schouten
Hi Pedro,

2016-05-20 16:36 GMT+02:00 Pedro F. Giffuni :
> +  tree anon = NULL_TREE;

This initialization shouldn't be needed, right? The value is always
assigned before used.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r300311 - in head: contrib/elftoolchain/addr2line contrib/elftoolchain/brandelf contrib/elftoolchain/common contrib/elftoolchain/cxxfilt contrib/elftoolchain/elfcopy contrib/elftoolchai...

2016-05-20 Thread Ed Maste
Author: emaste
Date: Fri May 20 17:24:34 2016
New Revision: 300311
URL: https://svnweb.freebsd.org/changeset/base/300311

Log:
  Update to ELF Tool Chain r3475
  
  Improvements include:
  
   * Add support for reporting and handling a number of new constants in
 various tools, including:
  * CloudABI OSABI
  * DT_TLSDESC_*
  * i386, MIPS, SPARC and amd64 relocations
  
   * C++ demangler bug fixes
  
   * Man page updates
  
   * Improved input validation in several tools
  
  This update also reduces diffs against upstream as a number of fixes
  included in upstream were previously cherry-picked into FreeBSD.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.3
 - copied unchanged from r300228, 
vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.3
  head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
 - copied unchanged from r300228, 
vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c
Modified:
  head/contrib/elftoolchain/addr2line/addr2line.c
  head/contrib/elftoolchain/brandelf/brandelf.c
  head/contrib/elftoolchain/common/_elftc.h
  head/contrib/elftoolchain/common/elfdefinitions.h
  head/contrib/elftoolchain/cxxfilt/cxxfilt.c
  head/contrib/elftoolchain/elfcopy/ascii.c
  head/contrib/elftoolchain/elfcopy/binary.c
  head/contrib/elftoolchain/elfcopy/elfcopy.1
  head/contrib/elftoolchain/elfcopy/elfcopy.h
  head/contrib/elftoolchain/elfcopy/main.c
  head/contrib/elftoolchain/elfcopy/sections.c
  head/contrib/elftoolchain/elfcopy/segments.c
  head/contrib/elftoolchain/elfcopy/symbols.c
  head/contrib/elftoolchain/elfdump/elfdump.c
  head/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
  head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
  head/contrib/elftoolchain/libelf/_libelf_config.h
  head/contrib/elftoolchain/libelf/elf_data.c
  head/contrib/elftoolchain/libelf/libelf_ar.c
  head/contrib/elftoolchain/libelf/libelf_convert.m4
  head/contrib/elftoolchain/libelftc/Makefile
  head/contrib/elftoolchain/libelftc/libelftc.h
  head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
  head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
  head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
  head/contrib/elftoolchain/libelftc/make-toolchain-version
  head/contrib/elftoolchain/libpe/libpe_section.c
  head/contrib/elftoolchain/libpe/pe.h
  head/contrib/elftoolchain/nm/nm.c
  head/contrib/elftoolchain/readelf/readelf.c
  head/contrib/elftoolchain/size/size.c
  head/contrib/elftoolchain/strings/strings.c
  head/lib/libelftc/Makefile
  head/lib/libelftc/elftc_version.c
Directory Properties:
  head/contrib/elftoolchain/   (props changed)
  head/contrib/elftoolchain/brandelf/   (props changed)
  head/contrib/elftoolchain/elfdump/   (props changed)

Modified: head/contrib/elftoolchain/addr2line/addr2line.c
==
--- head/contrib/elftoolchain/addr2line/addr2line.c Fri May 20 16:20:08 
2016(r300310)
+++ head/contrib/elftoolchain/addr2line/addr2line.c Fri May 20 17:24:34 
2016(r300311)
@@ -40,7 +40,7 @@
 #include "uthash.h"
 #include "_elftc.h"
 
-ELFTC_VCSID("$Id: addr2line.c 3273 2015-12-11 21:38:57Z kaiwang27 $");
+ELFTC_VCSID("$Id: addr2line.c 3446 2016-05-03 01:31:17Z emaste $");
 
 struct Func {
char *name;
@@ -284,7 +284,7 @@ collect_func(Dwarf_Debug dbg, Dwarf_Die 
&de) == DW_DLV_OK)
goto add_func;
 
-   /* Skip if no name assoicated with this DIE. */
+   /* Skip if no name associated with this DIE. */
goto cont_search;
 
add_func:

Modified: head/contrib/elftoolchain/brandelf/brandelf.c
==
--- head/contrib/elftoolchain/brandelf/brandelf.c   Fri May 20 16:20:08 
2016(r300310)
+++ head/contrib/elftoolchain/brandelf/brandelf.c   Fri May 20 17:24:34 
2016(r300311)
@@ -44,7 +44,7 @@
 
 #include "_elftc.h"
 
-ELFTC_VCSID("$Id: brandelf.c 3354 2016-01-18 21:50:15Z jkoshy $");
+ELFTC_VCSID("$Id: brandelf.c 3440 2016-04-07 14:51:47Z emaste $");
 
 static int elftype(const char *);
 static const char *iselftype(int);
@@ -62,6 +62,7 @@ static struct ELFtypes elftypes[] = {
{ "AIX",ELFOSABI_AIX },
{ "ARM",ELFOSABI_ARM },
{ "AROS",   ELFOSABI_AROS },
+   { "CloudABI",   ELFOSABI_CLOUDABI },
{ "FreeBSD",ELFOSABI_FREEBSD },
{ "GNU",ELFOSABI_GNU },
{ "HP/UX",  ELFOSABI_HPUX},

Modified: head/contrib/elftoolchain/common/_elftc.h
==
--- head/contrib/elftoolchain/common/_elftc.h   Fri May 20 16:20:08 2016
(r300310)
+++ head/contrib/elftoolchain/common/_elftc.h   Fri May 20 17:24:34 2016
(r300311)
@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN

Re: svn commit: r300301 - head/contrib/gcc

2016-05-20 Thread Pedro Giffuni



On 20/05/2016 12:23, Ed Schouten wrote:

Hi Pedro,

2016-05-20 16:36 GMT+02:00 Pedro F. Giffuni :

+  tree anon = NULL_TREE;

This initialization shouldn't be needed, right? The value is always
assigned before used.


Oh wait .. the patch is incomplete .. the code is a no-op.

Pedro.
___
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: r300313 - in head: contrib/bmake contrib/bmake/mk contrib/bmake/mk/sys usr.bin/bmake

2016-05-20 Thread Simon J. Gerraty
Author: sjg
Date: Fri May 20 17:35:39 2016
New Revision: 300313
URL: https://svnweb.freebsd.org/changeset/base/300313

Log:
  Merge bmake-20160512

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/arch.c
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/compat.c
  head/contrib/bmake/job.c
  head/contrib/bmake/main.c
  head/contrib/bmake/make.1
  head/contrib/bmake/meta.c
  head/contrib/bmake/meta.h
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/auto.dep.mk
  head/contrib/bmake/mk/autodep.mk
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/dpadd.mk
  head/contrib/bmake/mk/final.mk
  head/contrib/bmake/mk/gendirdeps.mk
  head/contrib/bmake/mk/init.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/lib.mk
  head/contrib/bmake/mk/libnames.mk
  head/contrib/bmake/mk/meta.autodep.mk
  head/contrib/bmake/mk/meta.sys.mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/mk/nls.mk
  head/contrib/bmake/mk/own.mk
  head/contrib/bmake/mk/prog.mk
  head/contrib/bmake/mk/subdir.mk
  head/contrib/bmake/mk/sys.mk
  head/contrib/bmake/mk/sys/AIX.mk
  head/contrib/bmake/mk/sys/Darwin.mk
  head/contrib/bmake/mk/sys/Generic.mk
  head/contrib/bmake/mk/sys/HP-UX.mk
  head/contrib/bmake/mk/sys/IRIX.mk
  head/contrib/bmake/mk/sys/Linux.mk
  head/contrib/bmake/mk/sys/NetBSD.mk
  head/contrib/bmake/mk/sys/OSF1.mk
  head/contrib/bmake/mk/sys/OpenBSD.mk
  head/contrib/bmake/mk/sys/SunOS.mk
  head/contrib/bmake/mk/sys/UnixWare.mk
  head/contrib/bmake/mk/warnings.mk
  head/contrib/bmake/parse.c
  head/contrib/bmake/str.c
  head/usr.bin/bmake/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==
--- head/contrib/bmake/ChangeLogFri May 20 17:25:36 2016
(r300312)
+++ head/contrib/bmake/ChangeLogFri May 20 17:35:39 2016
(r300313)
@@ -1,3 +1,26 @@
+2016-05-12  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20160512
+ Merge with NetBSD make, pick up
+ o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS
+   this is useful for gcov builds.
+ o propagate errors from filemon(4).
+   
+2016-05-09  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20160509
+ Merge with NetBSD make, pick up
+ o remove use of non-standard types u_int etc.
+ o meta.c: apply realpath() before matching against metaIgnorePaths
+
+2016-04-04  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20160404
+ Merge with NetBSD make, pick up
+ o allow makefile to set .MAKE.JOBS
+
+   * Makefile (PROG_NAME): use ${_MAKE_VERSION}
+
 2016-03-15  Simon J. Gerraty  
 
* Makefile (_MAKE_VERSION): 20160315

Modified: head/contrib/bmake/Makefile
==
--- head/contrib/bmake/Makefile Fri May 20 17:25:36 2016(r300312)
+++ head/contrib/bmake/Makefile Fri May 20 17:35:39 2016(r300313)
@@ -1,7 +1,7 @@
-#  $Id: Makefile,v 1.58 2016/03/15 23:39:12 sjg Exp $
+#  $Id: Makefile,v 1.63 2016/05/12 20:34:46 sjg Exp $
 
 # Base version on src date
-_MAKE_VERSION= 20160315
+_MAKE_VERSION= 20160512
 
 PROG=  bmake
 
@@ -131,9 +131,9 @@ OPTIONS_DEFAULT_NO+= \
 .include 
 
 .if ${MK_PROG_VERSION} == "yes"
-PROG_NAME= ${PROG}-${MAKE_VERSION}
+PROG_NAME= ${PROG}-${_MAKE_VERSION}
 .if ${MK_PROG_LINK} == "yes"
-SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG}
+SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG}
 .endif
 .endif
 

Modified: head/contrib/bmake/arch.c
==
--- head/contrib/bmake/arch.c   Fri May 20 17:25:36 2016(r300312)
+++ head/contrib/bmake/arch.c   Fri May 20 17:35:39 2016(r300313)
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $   */
+/* $NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp 
$";
+static char rcsid[] = "$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.68 2016/02/18 18:29:14 christos Exp $");
+__RCSID("$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -832,7 +832,7 @@ ArchSVR4Entry(Arch *ar, char *name, size
}
if (DEBUG(ARCH)) {
fprintf(debug_file, "Found svr4 archive name table with %lu 
entries\n",
-   (u_long)entry);
+   (unsigned long)entry);
}
return 0;
 }
@@ -850,7 +850,7 @@ ArchSVR4Entry(Arch *ar, char *

svn commit: r300314 - head/contrib/llvm/tools/clang/lib/Basic

2016-05-20 Thread Dimitry Andric
Author: dim
Date: Fri May 20 17:38:45 2016
New Revision: 300314
URL: https://svnweb.freebsd.org/changeset/base/300314

Log:
  Pull in r270240 from upstream clang trunk (by me):
  
Make __FreeBSD_cc_version predefined macro configurable at build time
  
The `FreeBSDTargetInfo` class has always set the `__FreeBSD_cc_version`
predefined macro to a rather static value, calculated from the major OS
version.
  
In the FreeBSD base system, we will start incrementing the value of this
macro whenever we make any signifant change to clang, so we need a way
to configure the macro's value at build time.
  
Use `FREEBSD_CC_VERSION` for this, which we can define in the FreeBSD
build system using either the `-D` command line option, or an include
file.  Stock builds will keep the earlier value.
  
Differential Revision: http://reviews.llvm.org/D20037
  
  Follow-up commits will start using the __FreeBSD_cc_version to determine
  whether a bootstrap compiler has to be built during buildworld.

Modified:
  head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp

Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
==
--- head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Fri May 20 17:35:39 
2016(r300313)
+++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Fri May 20 17:38:45 
2016(r300314)
@@ -296,6 +296,10 @@ public:
   }
 };
 
+#ifndef FREEBSD_CC_VERSION
+#define FREEBSD_CC_VERSION 0U
+#endif
+
 // FreeBSD Target
 template
 class FreeBSDTargetInfo : public OSTargetInfo {
@@ -306,10 +310,13 @@ protected:
 
 unsigned Release = Triple.getOSMajorVersion();
 if (Release == 0U)
-  Release = 8;
+  Release = 8U;
+unsigned CCVersion = FREEBSD_CC_VERSION;
+if (CCVersion == 0U)
+  CCVersion = Release * 10U + 1U;
 
 Builder.defineMacro("__FreeBSD__", Twine(Release));
-Builder.defineMacro("__FreeBSD_cc_version", Twine(Release * 10U + 1U));
+Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion));
 Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
 DefineStd(Builder, "unix", Opts);
 Builder.defineMacro("__ELF__");
___
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: r300315 - head/sys/dev/iscsi

2016-05-20 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri May 20 17:38:51 2016
New Revision: 300315
URL: https://svnweb.freebsd.org/changeset/base/300315

Log:
  Call the ICL module's handoff method even when using ICL proxy.
  The upcoming iSER code uses this.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/icl_soft.c
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/dev/iscsi/icl_soft.c
==
--- head/sys/dev/iscsi/icl_soft.c   Fri May 20 17:38:45 2016
(r300314)
+++ head/sys/dev/iscsi/icl_soft.c   Fri May 20 17:38:51 2016
(r300315)
@@ -1327,6 +1327,23 @@ icl_soft_conn_handoff(struct icl_conn *i
 
ICL_CONN_LOCK_ASSERT_NOT(ic);
 
+#ifdef ICL_KERNEL_PROXY
+   /*
+* We're transitioning to Full Feature phase, and we don't
+* really care.
+*/
+   if (fd == 0) {
+   ICL_CONN_LOCK(ic);
+   if (ic->ic_socket == NULL) {
+   ICL_CONN_UNLOCK(ic);
+   ICL_WARN("proxy handoff without connect"); 
+   return (EINVAL);
+   }
+   ICL_CONN_UNLOCK(ic);
+   return (0);
+   }
+#endif
+
/*
 * Steal the socket from userland.
 */

Modified: head/sys/dev/iscsi/iscsi.c
==
--- head/sys/dev/iscsi/iscsi.c  Fri May 20 17:38:45 2016(r300314)
+++ head/sys/dev/iscsi/iscsi.c  Fri May 20 17:38:51 2016(r300315)
@@ -1415,21 +1415,17 @@ iscsi_ioctl_daemon_handoff(struct iscsi_
 
ISCSI_SESSION_UNLOCK(is);
 
-#ifdef ICL_KERNEL_PROXY
-   if (handoff->idh_socket != 0) {
-#endif
-   /*
-* Handoff without using ICL proxy.
-*/
-   error = icl_conn_handoff(ic, handoff->idh_socket);
-   if (error != 0) {
-   sx_sunlock(&sc->sc_lock);
-   iscsi_session_terminate(is);
-   return (error);
-   }
-#ifdef ICL_KERNEL_PROXY
+   /*
+* If we're going through the proxy, the idh_socket will be 0,
+* and the ICL module can simply ignore this call.  It can also
+* use it to determine it's no longer in the Login phase.
+*/
+   error = icl_conn_handoff(ic, handoff->idh_socket);
+   if (error != 0) {
+   sx_sunlock(&sc->sc_lock);
+   iscsi_session_terminate(is);
+   return (error);
}
-#endif
 
sx_sunlock(&sc->sc_lock);
 
___
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: r300316 - head

2016-05-20 Thread John Baldwin
Author: jhb
Date: Fri May 20 17:41:12 2016
New Revision: 300316
URL: https://svnweb.freebsd.org/changeset/base/300316

Log:
  Drop trailing asterisks.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri May 20 17:38:51 2016(r300315)
+++ head/ObsoleteFiles.inc  Fri May 20 17:41:12 2016(r300316)
@@ -39,11 +39,11 @@
 # done
 
 # 20160519: remove DTrace Toolkit from base
-OLD_FILES+=usr/share/dtrace/toolkit/execsnoop*
-OLD_FILES+=usr/share/dtrace/toolkit/hotkernel*
-OLD_FILES+=usr/share/dtrace/toolkit/hotuser*
-OLD_FILES+=usr/share/dtrace/toolkit/opensnoop*
-OLD_FILES+=usr/share/dtrace/toolkit/procsystime*
+OLD_FILES+=usr/share/dtrace/toolkit/execsnoop
+OLD_FILES+=usr/share/dtrace/toolkit/hotkernel
+OLD_FILES+=usr/share/dtrace/toolkit/hotuser
+OLD_FILES+=usr/share/dtrace/toolkit/opensnoop
+OLD_FILES+=usr/share/dtrace/toolkit/procsystime
 OLD_DIRS+=usr/share/dtrace/toolkit
 # 20160519: stale MLINK removed
 OLD_FILES+=usr/share/man/man9/rman_await_resource.9.gz
___
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: r300219 - in head/sys: kern sys

2016-05-20 Thread Scott Long via svn-src-head
Yeah, I was following existing style.  Feel free to fix up if you like.

Scott

> On May 19, 2016, at 12:51 PM, Steven Hartland  wrote:
> 
> I thought it was considered better to use if (var == NULL) instead of
> if (!var) for pointers as they aren't bools?
> 
>> On 19 May 2016, at 18:14, Scott Long  wrote:
>> 
>> Author: scottl
>> Date: Thu May 19 17:14:24 2016
>> New Revision: 300219
>> URL: https://svnweb.freebsd.org/changeset/base/300219
>> 
>> Log:
>> Adjust the creation of tq_name so it can be freed correctly
>> 
>> Reviewed by:jhb, allanjude
>> Differential Revision:D6454
>> 
>> Modified:
>> head/sys/kern/subr_taskqueue.c
>> head/sys/sys/taskqueue.h
>> 
>> Modified: head/sys/kern/subr_taskqueue.c
>> ==
>> --- head/sys/kern/subr_taskqueue.cThu May 19 17:02:33 2016(r300218)
>> +++ head/sys/kern/subr_taskqueue.cThu May 19 17:14:24 2016(r300219)
>> @@ -128,16 +128,17 @@ _taskqueue_create(const char *name, int
>>int mtxflags, const char *mtxname __unused)
>> {
>>   struct taskqueue *queue;
>> -char *tq_name = NULL;
>> +char *tq_name;
>> 
>> -if (name != NULL)
>> -tq_name = strndup(name, 32, M_TASKQUEUE);
>> -if (tq_name == NULL)
>> -tq_name = "taskqueue";
>> +tq_name = malloc(TASKQUEUE_NAMELEN, M_TASKQUEUE, mflags | M_ZERO);
>> +if (!tq_name)
>> +return (NULL);
>> +
>> +snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue");
>> 
>>   queue = malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags | M_ZERO);
>>   if (!queue)
>> -return NULL;
>> +return (NULL);
>> 
>>   STAILQ_INIT(&queue->tq_queue);
>>   TAILQ_INIT(&queue->tq_active);
>> @@ -153,7 +154,7 @@ _taskqueue_create(const char *name, int
>>   queue->tq_flags |= TQ_FLAGS_UNLOCKED_ENQUEUE;
>>   mtx_init(&queue->tq_mutex, tq_name, NULL, mtxflags);
>> 
>> -return queue;
>> +return (queue);
>> }
>> 
>> struct taskqueue *
>> 
>> Modified: head/sys/sys/taskqueue.h
>> ==
>> --- head/sys/sys/taskqueue.hThu May 19 17:02:33 2016(r300218)
>> +++ head/sys/sys/taskqueue.hThu May 19 17:14:24 2016(r300219)
>> @@ -56,6 +56,7 @@ enum taskqueue_callback_type {
>> #defineTASKQUEUE_CALLBACK_TYPE_MINTASKQUEUE_CALLBACK_TYPE_INIT
>> #defineTASKQUEUE_CALLBACK_TYPE_MAXTASKQUEUE_CALLBACK_TYPE_SHUTDOWN
>> #defineTASKQUEUE_NUM_CALLBACKSTASKQUEUE_CALLBACK_TYPE_MAX + 1
>> +#defineTASKQUEUE_NAMELEN32
>> 
>> typedef void (*taskqueue_callback_fn)(void *context);
>> 
>> 
> 

___
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: r300317 - in head: share/man/man9 sys/kern sys/sparc64/include sys/sys sys/vm

2016-05-20 Thread John Baldwin
Author: jhb
Date: Fri May 20 17:57:47 2016
New Revision: 300317
URL: https://svnweb.freebsd.org/changeset/base/300317

Log:
  Add new bus methods for mapping resources.
  
  Add a pair of bus methods that can be used to "map" resources for direct
  CPU access using bus_space(9).  bus_map_resource() creates a mapping and
  bus_unmap_resource() releases a previously created mapping.  Mappings are
  described by 'struct resource_map' object.  Pointers to these objects can
  be passed as the first argument to the bus_space wrapper API used for bus
  resources.
  
  Drivers that wish to map all of a resource using default settings
  (for example, using uncacheable memory attributes) do not need to change.
  However, drivers that wish to use non-default settings can now do so
  without jumping through hoops.
  
  First, an RF_UNMAPPED flag is added to request that a resource is not
  implicitly mapped with the default settings when it is activated.  This
  permits other activation steps (such as enabling I/O or memory decoding
  in a device's PCI command register) to be taken without creating a
  mapping.  Right now the AGP drivers don't set RF_ACTIVE to avoid using
  up a large amount of KVA to map the AGP aperture on 32-bit platforms.
  Once RF_UNMAPPED is supported on all platforms that support AGP this
  can be changed to using RF_UNMAPPED with RF_ACTIVE instead.
  
  Second, bus_map_resource accepts an optional structure that defines
  additional settings for a given mapping.
  
  For example, a driver can now request to map only a subset of a resource
  instead of the entire range.  The AGP driver could also use this to only
  map the first page of the aperture (IIRC, it calls pmap_mapdev() directly
  to map the first page currently).  I will also eventually change the
  PCI-PCI bridge driver to request mappings of the subset of the I/O window
  resource on its parent side to create mappings for child devices rather
  than passing child resources directly up to nexus to be mapped.  This
  also permits bridges that do address translation to request suitable
  mappings from a resource on the "upper" side of the bus when mapping
  resources on the "lower" side of the bus.
  
  Another attribute that can be specified is an alternate memory attribute
  for memory-mapped resources.  This can be used to request a
  Write-Combining mapping of a PCI BAR in an MI fashion.  (Currently the
  drivers that do this call pmap_change_attr() directly for x86 only.)
  
  Note that this commit only adds the MI framework.  Each platform needs
  to add support for handling RF_UNMAPPED and thew new
  bus_map/unmap_resource methods.  Generally speaking, any drivers that
  are calling rman_set_bustag() and rman_set_bushandle() need to be
  updated.
  
  Discussed on: arch
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D5237

Added:
  head/share/man/man9/bus_map_resource.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/bus_activate_resource.9
  head/share/man/man9/bus_alloc_resource.9
  head/share/man/man9/rman.9
  head/sys/kern/bus_if.m
  head/sys/kern/subr_bus.c
  head/sys/kern/subr_rman.c
  head/sys/sparc64/include/vm.h
  head/sys/sys/bus.h
  head/sys/sys/rman.h
  head/sys/vm/vm.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri May 20 17:41:12 2016
(r300316)
+++ head/share/man/man9/MakefileFri May 20 17:57:47 2016
(r300317)
@@ -44,6 +44,7 @@ MAN=  accept_filter.9 \
bus_generic_shutdown.9 \
BUS_GET_CPUS.9 \
bus_get_resource.9 \
+   bus_map_resource.9 \
BUS_NEW_PASS.9 \
BUS_PRINT_CHILD.9 \
BUS_READ_IVAR.9 \
@@ -504,6 +505,8 @@ MLINKS+=bus_dma.9 busdma.9 \
bus_dma.9 bus_dma_tag_destroy.9
 MLINKS+=bus_generic_read_ivar.9 bus_generic_write_ivar.9
 MLINKS+=BUS_GET_CPUS.9 bus_get_cpus.9
+MLINKS+=bus_map_resource.9 bus_unmap_resource.9 \
+   bus_map_resource.9 resource_init_map_request.9
 MLINKS+=BUS_READ_IVAR.9 BUS_WRITE_IVAR.9
 MLINKS+=BUS_SETUP_INTR.9 bus_setup_intr.9 \
BUS_SETUP_INTR.9 BUS_TEARDOWN_INTR.9 \
@@ -1381,6 +1384,7 @@ MLINKS+=rman.9 rman_activate_resource.9 
rman.9 rman_get_device.9 \
rman.9 rman_get_end.9 \
rman.9 rman_get_flags.9 \
+   rman.9 rman_get_mapping.9 \
rman.9 rman_get_rid.9 \
rman.9 rman_get_size.9 \
rman.9 rman_get_start.9 \
@@ -1396,6 +1400,7 @@ MLINKS+=rman.9 rman_activate_resource.9 
rman.9 rman_reserve_resource_bound.9 \
rman.9 rman_set_bushandle.9 \
rman.9 rman_set_bustag.9 \
+   rman.9 rman_set_mapping.9 \
rman.9 rman_set_rid.9 \
rman.9 rman_set_virtual.9
 MLINKS+=rmlock.9 rm_assert.9 \

Modified: head/share/man/man9/bus_activate_resource.9
==
--- hea

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

2016-05-20 Thread John Baldwin
Author: jhb
Date: Fri May 20 18:00:10 2016
New Revision: 300318
URL: https://svnweb.freebsd.org/changeset/base/300318

Log:
  Implement support for RF_UNMAPPED and bus_map/unmap_resource on x86.
  
  Add implementations of bus_map/unmap_resource to the x86 nexus driver.
  Change bus_activate/deactivate_resource to honor RF_UNMAPPED and to
  use bus_map/unmap_resource to create/destroy the implicit mapping when
  RF_UNMAPPED is not set.
  
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D5237

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

Modified: head/sys/x86/x86/nexus.c
==
--- head/sys/x86/x86/nexus.cFri May 20 17:57:47 2016(r300317)
+++ head/sys/x86/x86/nexus.cFri May 20 18:00:10 2016(r300318)
@@ -114,6 +114,12 @@ static int nexus_activate_resource(devic
struct resource *);
 static int nexus_deactivate_resource(device_t, device_t, int, int,
  struct resource *);
+static int nexus_map_resource(device_t bus, device_t child, int type,
+  struct resource *r,
+  struct resource_map_request *argsp,
+  struct resource_map *map);
+static int nexus_unmap_resource(device_t bus, device_t child, int type,
+struct resource *r, struct resource_map *map);
 static int nexus_release_resource(device_t, device_t, int, int,
   struct resource *);
 static int nexus_setup_intr(device_t, device_t, struct resource *, int flags,
@@ -154,6 +160,8 @@ static device_method_t nexus_methods[] =
DEVMETHOD(bus_release_resource, nexus_release_resource),
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
+   DEVMETHOD(bus_map_resource, nexus_map_resource),
+   DEVMETHOD(bus_unmap_resource,   nexus_unmap_resource),
DEVMETHOD(bus_setup_intr,   nexus_setup_intr),
DEVMETHOD(bus_teardown_intr,nexus_teardown_intr),
 #ifdef SMP
@@ -432,11 +440,81 @@ static int
 nexus_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
 {
+   struct resource_map map;
+   int error;
+
+   error = rman_activate_resource(r);
+   if (error != 0)
+   return (error);
+
+   if (!(rman_get_flags(r) & RF_UNMAPPED) &&
+   (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
+   error = nexus_map_resource(bus, child, type, r, NULL, &map);
+   if (error) {
+   rman_deactivate_resource(r);
+   return (error);
+   }
+
+   rman_set_mapping(r,&map);
+   }
+   return (0);
+}
+
+static int
+nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
+ struct resource *r)
+{
+   struct resource_map map;
+   int error;
+
+   error = rman_deactivate_resource(r);
+   if (error)
+   return (error);
+
+   if (!(rman_get_flags(r) & RF_UNMAPPED) &&
+   (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
+   rman_get_mapping(r, &map);
+   nexus_unmap_resource(bus, child, type, r, &map);
+   }
+   return (0);
+}
+
+static int
+nexus_map_resource(device_t bus, device_t child, int type, struct resource *r,
+struct resource_map_request *argsp, struct resource_map *map)
+{
+   struct resource_map_request args;
+   rman_res_t end, length, start;
 #ifdef PC98
-   bus_space_handle_t bh;
int error;
 #endif
-   void *vaddr;
+
+   /* Resources must be active to be mapped. */
+   if (!(rman_get_flags(r) & RF_ACTIVE))
+   return (ENXIO);
+
+   /* Mappings are only supported on I/O and memory resources. */
+   switch (type) {
+   case SYS_RES_IOPORT:
+   case SYS_RES_MEMORY:
+   break;
+   default:
+   return (EINVAL);
+   }
+
+   resource_init_map_request(&args);
+   if (argsp != NULL)
+   bcopy(argsp, &args, imin(argsp->size, args.size));
+   start = rman_get_start(r) + args.offset;
+   if (args.length == 0)
+   length = rman_get_size(r);
+   else
+   length = args.length;
+   end = start + length - 1;
+   if (start > rman_get_end(r) || start < rman_get_start(r))
+   return (EINVAL);
+   if (end > rman_get_end(r) || end < start)
+   return (EINVAL);
 
/*
 * If this is a memory resource, map it into the kernel.
@@ -445,58 +523,64 @@ nexus_activate_resource(device_t bus, de
case SYS_RES_IOPORT:
 #ifdef PC98
error = i386_bus_space_handle_alloc(X86_BUS_SPACE_IO,
-   rman_get_start(r), rman_ge

Re: svn commit: r300301 - head/contrib/gcc

2016-05-20 Thread Pedro Giffuni



On 20/05/2016 12:23, Ed Schouten wrote:

Hi Pedro,

2016-05-20 16:36 GMT+02:00 Pedro F. Giffuni :

+  tree anon = NULL_TREE;

This initialization shouldn't be needed, right? The value is always
assigned before used.



Yes, you are right. However do note that anon is used only within an if() so
it is rather sane to have it initialized JIC we hit a bogus compiler.

The code came directly from OpenBSD, which still uses that crappy compiler
for everything, so I don't want to play experiments :).

Pedro.
___
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: r300319 - head/contrib/gcc

2016-05-20 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 20 18:01:53 2016
New Revision: 300319
URL: https://svnweb.freebsd.org/changeset/base/300319

Log:
  GCC: Add support for named initializers for anonymous structs/unions.
  
  Missing hunk from r300301.
  
  Reported by:  Ed Schouten
  Obtained from:OpenBSD (CVS rev. 1.2)

Modified:
  head/contrib/gcc/c-typeck.c

Modified: head/contrib/gcc/c-typeck.c
==
--- head/contrib/gcc/c-typeck.c Fri May 20 18:00:10 2016(r300318)
+++ head/contrib/gcc/c-typeck.c Fri May 20 18:01:53 2016(r300319)
@@ -6074,13 +6074,24 @@ set_init_label (tree fieldname)
 
   if (tail == 0)
 error ("unknown field %qE specified in initializer", fieldname);
-  else
+
+  while (tail)
 {
   constructor_fields = tail;
   designator_depth++;
   designator_erroneous = 0;
   if (constructor_range_stack)
push_range_stack (NULL_TREE);
+
+  if (anon)
+   {
+ if (set_designator (0))
+   return;
+ tail = TREE_VALUE(anon);
+ anon = TREE_CHAIN(anon);
+   }
+  else
+   tail = NULL_TREE;
 }
 }
 
___
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: r300320 - in head/contrib/elftoolchain: elfdump libdwarf libelftc readelf

2016-05-20 Thread Ed Maste
Author: emaste
Date: Fri May 20 18:54:42 2016
New Revision: 300320
URL: https://svnweb.freebsd.org/changeset/base/300320

Log:
  elftoolchain: backwards compatability for EM_IAMCU definition
  
  It is not provided by sys/elf_common.h on older stable/10.

Modified:
  head/contrib/elftoolchain/elfdump/elfdump.c
  head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
  head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/elfdump/elfdump.c
==
--- head/contrib/elftoolchain/elfdump/elfdump.c Fri May 20 18:01:53 2016
(r300319)
+++ head/contrib/elftoolchain/elfdump/elfdump.c Fri May 20 18:54:42 2016
(r300320)
@@ -52,6 +52,11 @@
 
 ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $");
 
+/* Backwards compatability for older FreeBSD releases. */
+#ifndef EM_IAMCU
+#define EM_IAMCU 6
+#endif
+
 #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
 #include "native-elf-format.h"
 #if ELFTC_CLASS == ELFCLASS32

Modified: head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
==
--- head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Fri May 20 18:01:53 
2016(r300319)
+++ head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Fri May 20 18:54:42 
2016(r300320)
@@ -28,6 +28,11 @@
 
 ELFTC_VCSID("$Id: libdwarf_reloc.c 3198 2015-05-14 18:36:19Z emaste $");
 
+/* Backwards compatability for older FreeBSD releases. */
+#ifndef EM_IAMCU
+#define EM_IAMCU 6
+#endif
+
 Dwarf_Unsigned
 _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)
 {

Modified: head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
==
--- head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c   Fri May 20 
18:01:53 2016(r300319)
+++ head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c   Fri May 20 
18:54:42 2016(r300320)
@@ -31,6 +31,11 @@
 #include 
 #include 
 
+/* Backwards compatability for older FreeBSD releases. */
+#ifndef EM_IAMCU
+#define EM_IAMCU 6
+#endif
+
 const char *
 elftc_reloc_type_str(unsigned int mach, unsigned int type)
 {

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Fri May 20 18:01:53 2016
(r300319)
+++ head/contrib/elftoolchain/readelf/readelf.c Fri May 20 18:54:42 2016
(r300320)
@@ -50,6 +50,9 @@
 ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $");
 
 /* Backwards compatability for older FreeBSD releases. */
+#ifndef EM_IAMCU
+#define EM_IAMCU 6
+#endif
 #ifndefSTB_GNU_UNIQUE
 #defineSTB_GNU_UNIQUE 10
 #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: r300322 - head/bin/ed

2016-05-20 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 20 19:10:29 2016
New Revision: 300322
URL: https://svnweb.freebsd.org/changeset/base/300322

Log:
  ed(1): Cleanups for the DES mode.
  
  - Use arc4random_uniform(3).
  - Prevent a segmentation fault when ed receives a signal
while being in getpass(). [1]
  
  Obtained from:OpenBSD [1] (CVS Rev. 1.15)
  MFC after:2 weeks

Modified:
  head/bin/ed/cbc.c

Modified: head/bin/ed/cbc.c
==
--- head/bin/ed/cbc.c   Fri May 20 19:05:33 2016(r300321)
+++ head/bin/ed/cbc.c   Fri May 20 19:10:29 2016(r300322)
@@ -99,7 +99,7 @@ init_des_cipher(void)
 
/* initialize the padding vector */
for (i = 0; i < 8; i++)
-   pvec[i] = (char) (arc4random() % 256);
+   pvec[i] = (char)arc4random_uniform(256);
 #endif
 }
 
@@ -164,7 +164,7 @@ get_keyword(void)
/*
 * get the key
 */
-   if (*(p = getpass("Enter key: "))) {
+   if ((p = getpass("Enter key: ")) != NULL && *p != '\0') {
 
/*
 * copy it, nul-padded, into the key area
___
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: r300324 - head/sys/arm/include

2016-05-20 Thread Warner Losh
Author: imp
Date: Fri May 20 19:18:32 2016
New Revision: 300324
URL: https://svnweb.freebsd.org/changeset/base/300324

Log:
  Remove hf appending code from param.h for machine arch name.
  
  Submitted by: ian@ andyt@

Modified:
  head/sys/arm/include/param.h

Modified: head/sys/arm/include/param.h
==
--- head/sys/arm/include/param.hFri May 20 19:14:15 2016
(r300323)
+++ head/sys/arm/include/param.hFri May 20 19:18:32 2016
(r300324)
@@ -59,12 +59,6 @@
 #define_V6_SUFFIX ""
 #endif
 
-#ifdef __ARM_PCS_VFP
-#define_HF_SUFFIX "hf"
-#else
-#define_HF_SUFFIX ""
-#endif
-
 #ifdef __ARM_BIG_ENDIAN
 #define_EB_SUFFIX "eb"
 #else
@@ -75,7 +69,7 @@
 #defineMACHINE "arm"
 #endif
 #ifndef MACHINE_ARCH
-#defineMACHINE_ARCH"arm" _V6_SUFFIX _HF_SUFFIX _EB_SUFFIX
+#defineMACHINE_ARCH"arm" _V6_SUFFIX _EB_SUFFIX
 #endif
 
 #if defined(SMP) || defined(KLD_MODULE)
___
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: r300325 - head/tools/build/options

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Fri May 20 19:23:07 2016
New Revision: 300325
URL: https://svnweb.freebsd.org/changeset/base/300325

Log:
  Add a WITH_LIBSOFT

Added:
  head/tools/build/options/WITH_LIBSOFT   (contents, props changed)

Added: head/tools/build/options/WITH_LIBSOFT
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITH_LIBSOFT   Fri May 20 19:23:07 2016
(r300325)
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+On armv6 only, set to enable soft float ABI compatibility libraries.
+This option is for transitioning to the new hard float ABI.
___
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: r300326 - head/share/man/man5

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Fri May 20 19:25:57 2016
New Revision: 300326
URL: https://svnweb.freebsd.org/changeset/base/300326

Log:
  Regenerate

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Fri May 20 19:23:07 2016
(r300325)
+++ head/share/man/man5/src.conf.5  Fri May 20 19:25:57 2016
(r300326)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 292283 2015-12-15 18:42:30Z 
bdrewery
 .\" $FreeBSD$
-.Dd April 14, 2016
+.Dd May 20, 2016
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -171,7 +171,7 @@ Set to build and install binutils (as, l
 of the normal system build.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, 
powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, 
powerpc/powerpc64 and sparc64/sparc64.
 .It Va WITHOUT_BINUTILS_BOOTSTRAP
 .\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 295490 
2016-02-10 23:57:09Z emaste
 Set to not build binutils (as, ld, objcopy and objdump)
@@ -189,7 +189,7 @@ Set build binutils (as, ld, objcopy and 
 as part of the bootstrap process.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, 
powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, 
powerpc/powerpc64 and sparc64/sparc64.
 .It Va WITHOUT_BLUETOOTH
 .\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 
07:50:50Z ru
 Set to not build Bluetooth related kernel modules, programs and libraries.
@@ -322,7 +322,7 @@ When set, it also enforces the following
 Set to build the Clang C/C++ compiler during the normal phase of the build.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, 
pc98/i386, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_CLANG_BOOTSTRAP
 .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 
2014-10-16 18:28:11Z skreuzer
 Set to not build the Clang C/C++ compiler during the bootstrap phase of the 
build.
@@ -337,7 +337,7 @@ mips/mipsel, mips/mips, mips/mips64el, m
 Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386 and pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and 
pc98/i386.
 .It Va WITH_CLANG_EXTRAS
 .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 
23:56:22Z dim
 Set to build additional clang and llvm tools, such as bugpoint.
@@ -354,7 +354,7 @@ Set to build the ARCMigrate, Rewriter an
 Clang C/C++ compiler.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, 
pc98/i386, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_CLANG_IS_CC
 .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_IS_CC 242629 
2012-11-05 21:53:23Z brooks
 Set to install the GCC compiler as
@@ -374,7 +374,7 @@ and
 .Pa /usr/bin/cpp .
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386 and pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and 
pc98/i386.
 .It Va WITHOUT_CPP
 .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 
07:50:50Z ru
 Set to not build
@@ -666,7 +666,7 @@ Set to not build games.
 Set to not build and install gcc and g++ as part of the normal build process.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386 and pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and 
pc98/i386.
 .It Va WITH_GCC
 .\" from FreeBSD: head/tools/build/options/WITH_GCC 255326 2013-09-06 
20:49:48Z zeising
 Set to build and install gcc and g++.
@@ -681,7 +681,7 @@ unless an alternative compiler is provid
 XCC.
 .Pp
 It is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, 
i386/i386 and pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, 

svn commit: r300327 - in head: lib/libmt usr.bin/mt

2016-05-20 Thread Kenneth D. Merry
Author: ken
Date: Fri May 20 19:30:52 2016
New Revision: 300327
URL: https://svnweb.freebsd.org/changeset/base/300327

Log:
  Add the density code for LTO-7 to libmt and the mt(1) man page.
  
  The density code and bits per mm values were obtained from an
  actual drive density report.
  
  The number of tracks were obtained from an LTO-7 hardware
  announcement on IBM's web site.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/lib/libmt/mtlib.c
  head/usr.bin/mt/mt.1

Modified: head/lib/libmt/mtlib.c
==
--- head/lib/libmt/mtlib.c  Fri May 20 19:25:57 2016(r300326)
+++ head/lib/libmt/mtlib.c  Fri May 20 19:30:52 2016(r300327)
@@ -643,6 +643,7 @@ static struct densities {
{ 0x55, 20670,  525018, "3592A5 (unencrypted)" },
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
+   { 0x5C, 19107,  485318, "LTO-7" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: head/usr.bin/mt/mt.1
==
--- head/usr.bin/mt/mt.1Fri May 20 19:25:57 2016(r300326)
+++ head/usr.bin/mt/mt.1Fri May 20 19:30:52 2016(r300327)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2014
+.Dd May 20, 2016
 .Dt MT 1
 .Os
 .Sh NAME
@@ -517,6 +517,7 @@ Value  WidthTracksDensity   
 0x55   12.7  (0.5) 5120  20,670 (525,018)   C   3592A5 (unencrypted)
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
+0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
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: r300322 - head/bin/ed

2016-05-20 Thread Ed Schouten
2016-05-20 21:10 GMT+02:00 Pedro F. Giffuni :
> /* initialize the padding vector */
> for (i = 0; i < 8; i++)
> -   pvec[i] = (char) (arc4random() % 256);
> +   pvec[i] = (char)arc4random_uniform(256);

This could be simplified to just calling arc4random_buf() on pvec, right?

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r300330 - head/sys/boot/efi/loader

2016-05-20 Thread Warner Losh
Author: imp
Date: Fri May 20 19:38:01 2016
New Revision: 300330
URL: https://svnweb.freebsd.org/changeset/base/300330

Log:
  Large improvements to efi-show (though some weird problems
  linger). We now print only printable characters for the
  values and we print ascii strings as strings.

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

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Fri May 20 19:37:54 2016
(r300329)
+++ head/sys/boot/efi/loader/main.c Fri May 20 19:38:01 2016
(r300330)
@@ -632,57 +632,6 @@ command_mode(int argc, char *argv[])
return (CMD_OK);
 }
 
-
-/* deprecated */
-COMMAND_SET(nvram, "nvram", "get or set NVRAM variables", command_nvram);
-
-static int
-command_nvram(int argc, char *argv[])
-{
-   CHAR16 var[128];
-   CHAR16 *data;
-   EFI_STATUS status;
-   EFI_GUID varguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
-   UINTN varsz, datasz, i;
-   SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
-
-   conout = ST->ConOut;
-
-   /* Initiate the search */
-   status = RS->GetNextVariableName(&varsz, NULL, NULL);
-
-   pager_open();
-   for (; status != EFI_NOT_FOUND; ) {
-   status = RS->GetNextVariableName(&varsz, var, &varguid);
-   //if (EFI_ERROR(status))
-   //break;
-
-   conout->OutputString(conout, var);
-   printf("=");
-   datasz = 0;
-   status = RS->GetVariable(var, &varguid, NULL, &datasz, NULL);
-   /* XXX: check status */
-   data = malloc(datasz);
-   status = RS->GetVariable(var, &varguid, NULL, &datasz, data);
-   if (EFI_ERROR(status))
-   printf("");
-   else {
-   for (i = 0; i < datasz; i++) {
-   if (isalnum(data[i]) || isspace(data[i]))
-   printf("%c", data[i]);
-   else
-   printf("\\x%02x", data[i]);
-   }
-   }
-   free(data);
-   if (pager_output("\n"))
-   break;
-   }
-   pager_close();
-
-   return (CMD_OK);
-}
-
 #ifdef EFI_ZFS_BOOT
 COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset",
 command_lszfs);
@@ -738,17 +687,18 @@ command_reloadbe(int argc, char *argv[])
 }
 #endif
 
-COMMAND_SET(efishow, "efi-show", "print some or all EFI variables", 
command_efi_printenv);
+COMMAND_SET(efishow, "efi-show", "print some or all EFI variables", 
command_efi_show);
 
 static int
 efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag)
 {
-   UINTN   datasz;
+   UINTN   datasz, i;
EFI_STATUS  status;
UINT32  attr;
CHAR16  *data;
char*str;
uint32_tuuid_status;
+   int is_ascii;
 
datasz = 0;
status = RS->GetVariable(varnamearg, matchguid, &attr,
@@ -765,8 +715,33 @@ efi_print_var(CHAR16 *varnamearg, EFI_GU
return (CMD_ERROR);
}
uuid_to_string((uuid_t *)matchguid, &str, &uuid_status);
-   printf("%s %S=%S", str, varnamearg, data);
-   free(str);
+   if (lflag) {
+   printf("%s 0x%x %S", str, attr, varnamearg);
+   } else {
+   printf("%s 0x%x %S=", str, attr, varnamearg);
+   is_ascii = 1;
+   free(str);
+   str = (char *)data;
+   for (i = 0; i < datasz - 1; i++) {
+   /* Quick hack to see if this ascii-ish string printable 
range plus tab, cr and lf */
+   if ((str[i] < 32 || str[i] > 126) && str[i] != 9 && 
str[i] != 10 && str[i] != 13) {
+   is_ascii = 0;
+   break;
+   }
+   }
+   if (str[datasz - 1] != '\0')
+   is_ascii = 0;
+   if (is_ascii)
+   printf("%s", str);
+   else {
+   for (i = 0; i < datasz / 2; i++) {
+   if (isalnum(data[i]) || isspace(data[i]))
+   printf("%c", data[i]);
+   else
+   printf("\\x%02x", data[i]);
+   }
+   }
+   }
free(data);
if (pager_output("\n"))
return (CMD_WARN);
@@ -774,20 +749,20 @@ efi_print_var(CHAR16 *varnamearg, EFI_GU
 }
 
 static int
-command_efi_printenv(int argc, char *argv[])
+command_efi_show(int argc, char *argv[])
 {
/*
-* efi-printenv [-a]
+* efi-show [-a]
 *  print all the env
-* efi-printenv -u UUID
+* efi-sho

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

2016-05-20 Thread Warner Losh
Author: imp
Date: Fri May 20 19:37:54 2016
New Revision: 300329
URL: https://svnweb.freebsd.org/changeset/base/300329

Log:
  Implement efi-set and efi-unset

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

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Fri May 20 19:37:46 2016
(r300328)
+++ head/sys/boot/efi/loader/main.c Fri May 20 19:37:54 2016
(r300329)
@@ -75,8 +75,23 @@ EFI_GUID inputid = SIMPLE_TEXT_INPUT_PRO
 static void efi_zfs_probe(void);
 #endif
 
+/*
+ * cpy8to16 copies a traditional C string into a CHAR16 string and
+ * 0 terminates it. len is the size of *dst in bytes.
+ */
 static void
-cp16to8(const CHAR16 *src, char *dst, size_t len)
+cpy8to16(const char *src, CHAR16 *dst, size_t len)
+{
+   len <<= 1;  /* Assume CHAR16 is 2 bytes */
+   while (len > 0 && *src) {
+   *dst++ = *src++;
+   len--;
+   }
+   *dst++ = (CHAR16)0;
+}
+
+static void
+cpy16to8(const CHAR16 *src, char *dst, size_t len)
 {
size_t i;
 
@@ -256,14 +271,14 @@ main(int argc, CHAR16 *argv[])
if (i + 1 == argc) {

setenv("comconsole_speed", "115200", 1);
} else {
-   cp16to8(&argv[i + 
1][0], var,
+   cpy16to8(&argv[i + 
1][0], var,
sizeof(var));

setenv("comconsole_speedspeed", var, 1);
}
i++;
break;
} else {
-   cp16to8(&argv[i][j + 1], var,
+   cpy16to8(&argv[i][j + 1], var,
sizeof(var));
setenv("comconsole_speed", var, 
1);
break;
@@ -909,6 +924,32 @@ COMMAND_SET(efiset, "efi-set", "set EFI 
 static int
 command_efi_set(int argc, char *argv[])
 {
+   char *uuid, *var, *val;
+   CHAR16 wvar[128];
+   EFI_GUID guid;
+   uint32_t status;
+   EFI_STATUS err;
+
+   if (argc != 4) {
+   printf("efi-set uuid var new-value\n");
+   return (CMD_ERROR);
+   }
+   uuid = argv[1];
+   var = argv[2];
+   val = argv[3];
+   uuid_from_string(uuid, (uuid_t *)&guid, &status);
+   if (status != uuid_s_ok) {
+   printf("Invalid uuid %s\n", uuid);
+   return (CMD_ERROR);
+   }
+   cpy8to16(var, wvar, sizeof(wvar));
+   err = RS->SetVariable(wvar, &guid,
+   EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS,
+   strlen(val) + 1, val);
+   if (EFI_ERROR(err)) {
+   printf("Failed to set variable: error %d\n", 
EFI_ERROR_CODE(err));
+   return (CMD_ERROR);
+   }
return (CMD_OK);
 }
 
@@ -917,6 +958,29 @@ COMMAND_SET(efiunset, "efi-unset", "dele
 static int
 command_efi_unset(int argc, char *argv[])
 {
+   char *uuid, *var;
+   CHAR16 wvar[128];
+   EFI_GUID guid;
+   uint32_t status;
+   EFI_STATUS err;
+
+   if (argc != 3) {
+   printf("efi-unset uuid var\n");
+   return (CMD_ERROR);
+   }
+   uuid = argv[1];
+   var = argv[2];
+   uuid_from_string(uuid, (uuid_t *)&guid, &status);
+   if (status != uuid_s_ok) {
+   printf("Invalid uuid %s\n", uuid);
+   return (CMD_ERROR);
+   }
+   cpy8to16(var, wvar, sizeof(wvar));
+   err = RS->SetVariable(wvar, &guid, 0, 0, NULL);
+   if (EFI_ERROR(err)) {
+   printf("Failed to unset variable: error %d\n", 
EFI_ERROR_CODE(err));
+   return (CMD_ERROR);
+   }
return (CMD_OK);
 }
 
___
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: r300328 - head/sys/boot/efi/loader

2016-05-20 Thread Warner Losh
Author: imp
Date: Fri May 20 19:37:46 2016
New Revision: 300328
URL: https://svnweb.freebsd.org/changeset/base/300328

Log:
  Cleanup to use %S.

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

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Fri May 20 19:30:52 2016
(r300327)
+++ head/sys/boot/efi/loader/main.c Fri May 20 19:37:46 2016
(r300328)
@@ -75,20 +75,6 @@ EFI_GUID inputid = SIMPLE_TEXT_INPUT_PRO
 static void efi_zfs_probe(void);
 #endif
 
-/*
- * Need this because EFI uses UTF-16 unicode string constants, but we
- * use UTF-8. We can't use printf due to the possibility of \0 and we
- * don't support support wide characters either.
- */
-static void
-print_str16(const CHAR16 *str)
-{
-   int i;
-
-   for (i = 0; str[i]; i++)
-   printf("%c", (char)str[i]);
-}
-
 static void
 cp16to8(const CHAR16 *src, char *dst, size_t len)
 {
@@ -96,6 +82,8 @@ cp16to8(const CHAR16 *src, char *dst, si
 
for (i = 0; i < len && src[i]; i++)
dst[i] = (char)src[i];
+   if (i < len)
+   dst[i] = '\0';
 }
 
 static int
@@ -330,10 +318,8 @@ main(int argc, CHAR16 *argv[])
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
 
printf("Command line arguments:");
-   for (i = 0; i < argc; i++) {
-   printf(" ");
-   print_str16(argv[i]);
-   }
+   for (i = 0; i < argc; i++)
+   printf(" %S", argv[i]);
printf("\n");
 
printf("Image base: 0x%lx\n", (u_long)img->ImageBase);
___
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: r300331 - head/sys/kern

2016-05-20 Thread John Baldwin
Author: jhb
Date: Fri May 20 19:46:25 2016
New Revision: 300331
URL: https://svnweb.freebsd.org/changeset/base/300331

Log:
  Consistently set status to -1 when completing an AIO request with an error.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/kern/sys_socket.c
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/sys_socket.c
==
--- head/sys/kern/sys_socket.c  Fri May 20 19:38:01 2016(r300330)
+++ head/sys/kern/sys_socket.c  Fri May 20 19:46:25 2016(r300331)
@@ -605,7 +605,6 @@ retry:
cnt -= uio.uio_resid;
td->td_ucred = td_savedcred;
 
-   /* XXX: Not sure if this is needed? */
if (cnt != 0 && (error == ERESTART || error == EINTR ||
error == EWOULDBLOCK))
error = 0;
@@ -633,7 +632,10 @@ retry:
TAILQ_INSERT_HEAD(&sb->sb_aiojobq, job, list);
}
} else {
-   aio_complete(job, cnt, error);
+   if (error)
+   aio_complete(job, -1, error);
+   else
+   aio_complete(job, cnt, 0);
SOCKBUF_LOCK(sb);
}
 }

Modified: head/sys/kern/vfs_aio.c
==
--- head/sys/kern/vfs_aio.c Fri May 20 19:38:01 2016(r300330)
+++ head/sys/kern/vfs_aio.c Fri May 20 19:46:25 2016(r300331)
@@ -806,7 +806,10 @@ aio_process_rw(struct kaiocb *job)
 
cnt -= auio.uio_resid;
td->td_ucred = td_savedcred;
-   aio_complete(job, cnt, error);
+   if (error)
+   aio_complete(job, -1, error);
+   else
+   aio_complete(job, cnt, 0);
 }
 
 static void
@@ -824,7 +827,10 @@ aio_process_sync(struct kaiocb *job)
if (fp->f_vnode != NULL)
error = aio_fsync_vnode(td, fp->f_vnode);
td->td_ucred = td_savedcred;
-   aio_complete(job, 0, error);
+   if (error)
+   aio_complete(job, -1, error);
+   else
+   aio_complete(job, 0, 0);
 }
 
 static void
@@ -839,7 +845,10 @@ aio_process_mlock(struct kaiocb *job)
aio_switch_vmspace(job);
error = vm_mlock(job->userproc, job->cred,
__DEVOLATILE(void *, cb->aio_buf), cb->aio_nbytes);
-   aio_complete(job, 0, error);
+   if (error)
+   aio_complete(job, -1, error);
+   else
+   aio_complete(job, 0, 0);
 }
 
 static void
@@ -2323,7 +2332,10 @@ aio_physwakeup(struct bio *bp)
else
job->inputcharge += nblks;
 
-   aio_complete(job, nbytes, error);
+   if (error)
+   aio_complete(job, -1, error);
+   else
+   aio_complete(job, nbytes, 0);
 
g_destroy_bio(bp);
 }
___
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: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-20 Thread Konstantin Belousov
Author: kib
Date: Fri May 20 19:50:32 2016
New Revision: 300332
URL: https://svnweb.freebsd.org/changeset/base/300332

Log:
  Check for overflow and return EINVAL if detected.  Backport this and
  r300305 to i386.
  
  PR:   209661
  Reported and reviewed by: cturt
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==
--- head/sys/amd64/amd64/sys_machdep.c  Fri May 20 19:46:25 2016
(r300331)
+++ head/sys/amd64/amd64/sys_machdep.c  Fri May 20 19:50:32 2016
(r300332)
@@ -344,7 +344,8 @@ amd64_set_ioperm(td, uap)
return (error);
if ((error = securelevel_gt(td->td_ucred, 0)) != 0)
return (error);
-   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
+   if (uap->start > uap->start + uap->length ||
+   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);
 
/*

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri May 20 19:46:25 2016
(r300331)
+++ head/sys/i386/i386/sys_machdep.cFri May 20 19:50:32 2016
(r300332)
@@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
struct thread *td;
struct i386_ioperm_args *uap;
 {
-   int i, error;
char *iomap;
+   u_int i;
+   int error;
 
if ((error = priv_check(td, PRIV_IO)) != 0)
return (error);
@@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
return (error);
iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;
 
-   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
+   if (uap->start > uap->start + uap->length ||
+   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);
 
for (i = uap->start; i < uap->start + uap->length; i++) {
___
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: r300322 - head/bin/ed

2016-05-20 Thread Pedro Giffuni



On 05/20/16 14:31, Ed Schouten wrote:

2016-05-20 21:10 GMT+02:00 Pedro F. Giffuni :

/* initialize the padding vector */
for (i = 0; i < 8; i++)
-   pvec[i] = (char) (arc4random() % 256);
+   pvec[i] = (char)arc4random_uniform(256);


This could be simplified to just calling arc4random_buf() on pvec, right?



Hmm ... Yes.

FWIW, ed(1) needs a bunch of cleanups. OpenBSD removed the DES code 
altogether.


Pedro.
___
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: r300333 - head/contrib/binutils/gas/config

2016-05-20 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 20 20:01:10 2016
New Revision: 300333
URL: https://svnweb.freebsd.org/changeset/base/300333

Log:
  gas: Implement the .inst assembler directive for arm.
  
  We normally use the binutils from ports but on other systems this
  is required for building gcc 4.9.
  
  Obtained from:OpenBSD (CVS rev. 1.5)
  MFC after:3 weeks

Modified:
  head/contrib/binutils/gas/config/tc-arm.c

Modified: head/contrib/binutils/gas/config/tc-arm.c
==
--- head/contrib/binutils/gas/config/tc-arm.c   Fri May 20 19:50:32 2016
(r300332)
+++ head/contrib/binutils/gas/config/tc-arm.c   Fri May 20 20:01:10 2016
(r300333)
@@ -2284,6 +2284,37 @@ s_unreq (int a ATTRIBUTE_UNUSED)
   demand_empty_rest_of_line ();
 }
 
+static void
+s_inst(int unused ATTRIBUTE_UNUSED)
+{
+   expressionS exp;
+
+   if (thumb_mode) {
+   as_bad(".inst not implemented for Thumb mode");
+   ignore_rest_of_line();
+   return;
+   }
+
+   if (is_it_end_of_statement()) {
+   demand_empty_rest_of_line();
+   return;
+   }
+
+   do {
+   expression(&exp);
+
+   if (exp.X_op != O_constant)
+   as_bad("constant expression required");
+   else
+   emit_expr(&exp, 4);
+
+   } while (*input_line_pointer++ == ',');
+
+   /* Put terminator back into stream. */
+   input_line_pointer--;
+   demand_empty_rest_of_line();
+}
+
 /* Directives: Instruction set selection.  */
 
 #ifdef OBJ_ELF
@@ -3895,6 +3926,7 @@ const pseudo_typeS md_pseudo_table[] =
   { "object_arch", s_arm_object_arch,  0 },
   { "fpu",s_arm_fpu, 0 },
   { "arch_extension", s_arm_arch_extension,  0 },
+  { "inst",   s_inst,0 },
 #ifdef OBJ_ELF
   { "word",   s_arm_elf_cons, 4 },
   { "long",   s_arm_elf_cons, 4 },
___
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: r300334 - in head/contrib/elftoolchain: elfdump libelftc readelf

2016-05-20 Thread Ed Maste
Author: emaste
Date: Fri May 20 20:27:30 2016
New Revision: 300334
URL: https://svnweb.freebsd.org/changeset/base/300334

Log:
  elftoolchain: backwards compatability for EM_RISCV definition
  
  It is not provided by sys/elf_common.h on older releases
  
  Reported by:  Jenkins

Modified:
  head/contrib/elftoolchain/elfdump/elfdump.c
  head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/elfdump/elfdump.c
==
--- head/contrib/elftoolchain/elfdump/elfdump.c Fri May 20 20:01:10 2016
(r300333)
+++ head/contrib/elftoolchain/elfdump/elfdump.c Fri May 20 20:27:30 2016
(r300334)
@@ -56,6 +56,9 @@ ELFTC_VCSID("$Id: elfdump.c 3474 2016-05
 #ifndef EM_IAMCU
 #define EM_IAMCU 6
 #endif
+#ifndef EM_RISCV
+#define EM_RISCV 243
+#endif
 
 #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
 #include "native-elf-format.h"

Modified: head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c
==
--- head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c   Fri May 20 
20:01:10 2016(r300333)
+++ head/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c   Fri May 20 
20:27:30 2016(r300334)
@@ -35,6 +35,9 @@
 #ifndef EM_IAMCU
 #define EM_IAMCU 6
 #endif
+#ifndef EM_RISCV
+#define EM_RISCV 243
+#endif
 
 const char *
 elftc_reloc_type_str(unsigned int mach, unsigned int type)

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Fri May 20 20:01:10 2016
(r300333)
+++ head/contrib/elftoolchain/readelf/readelf.c Fri May 20 20:27:30 2016
(r300334)
@@ -53,6 +53,9 @@ ELFTC_VCSID("$Id: readelf.c 3469 2016-05
 #ifndef EM_IAMCU
 #define EM_IAMCU 6
 #endif
+#ifndef EM_RISCV
+#define EM_RISCV 243
+#endif
 #ifndefSTB_GNU_UNIQUE
 #defineSTB_GNU_UNIQUE 10
 #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"


Re: svn commit: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-20 Thread Bruce Evans

On Fri, 20 May 2016, Konstantin Belousov wrote:


Log:
 Check for overflow and return EINVAL if detected.  Backport this and
 r300305 to i386.

 PR:209661
 Reported and reviewed by:  cturt
 Sponsored by:  The FreeBSD Foundation
 MFC after: 3 days

Modified:
 head/sys/amd64/amd64/sys_machdep.c
 head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri May 20 19:46:25 2016
(r300331)
+++ head/sys/i386/i386/sys_machdep.cFri May 20 19:50:32 2016
(r300332)
@@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
struct thread *td;
struct i386_ioperm_args *uap;
{
-   int i, error;
char *iomap;
+   u_int i;
+   int error;

if ((error = priv_check(td, PRIV_IO)) != 0)
return (error);
@@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
return (error);
iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;

-   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
+   if (uap->start > uap->start + uap->length ||
+   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);

for (i = uap->start; i < uap->start + uap->length; i++) {


I don't like using u_int for a small index.  After the bounds checking
fix, the range fits in a small signed integer.  However, uap->start
and uap->length already use bad type u_int, so it is natural to keep
using that type.  Except, i386_get/set_ioperm() is undocumented on
amd64, so no one knows what its types are.  amd64 documents sysarch(2)
and that refers to i386_get_ioperm(2), i386_get_ldt(2) and i386_vm86(2),
but these man pages are not installed.  They are installed on i386.
I think syscalls for them exist ecept for vm86.  Man pages are also
missing for newer sysarch() calls, and amd64 has more of these:
{AMD64,I386}_{GET,SET}_XFPUSTATE, {AMD64,I386}_{GET,SET}_{FS,GS}BASE.
apropos can't find anything related.

It would be even more natural to do separate range checks for the
start and length: start >= 0 && start <= IOPAGES * PAGE_SIZE * NBBY &&
length >= 0 && length <= IOPAGES * PAGE_SIZE * NBBY - start.  It
isn't clear whether to allow the silly null range of start =
= IOPAGES * PAGE_SIZE * NBBY && length == 0.  Initialization doesn't
allow this.  Other null ranges should be allowed.

Didn't the old versions already have adequate bounds checking even without
the fixes?  The fixes just avoid depending on undefined^Wimplementation-
defined behaviour, and return EINVAL instead of doing nothing for bad ranges:

X   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
X   return (EINVAL);
X 
X 	for (i = uap->start; i < uap->start + uap->length; i++) {


Suppose (uap->start > uap->start + uap->length).  Then if i is unsigned,
the intial i is after the end so nothing is done, and if i is signed
then the same is true if uap->start < INT_MAX; otherwise assignment
overflows to an implementation-defined value which is usually negative
and comparision turns this into a value which is much larger than the
end, so again nothing is done.

Changing a type from signed to unsigned is neither necessary nor
sufficient for getting this right.  You have to know that the entire
range fits in the type.  The analysis for it fitting in the range
[0, INT_MAX] is not much different for the analysis for it fitting
in the range [0, UINT_MAX], but is often slightly simpler because it
cannot depend on special properties of unsigned types.

Bruce
___
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: r300336 - head/sys/dev/cxgbe/tom

2016-05-20 Thread John Baldwin
Author: jhb
Date: Fri May 20 23:08:22 2016
New Revision: 300336
URL: https://svnweb.freebsd.org/changeset/base/300336

Log:
  Move the KTR for the update of ddp_active_id on each completion under
  VERBOSE_TRACES.
  
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/tom/t4_ddp.c
==
--- head/sys/dev/cxgbe/tom/t4_ddp.c Fri May 20 22:03:51 2016
(r300335)
+++ head/sys/dev/cxgbe/tom/t4_ddp.c Fri May 20 23:08:22 2016
(r300336)
@@ -296,8 +296,10 @@ complete_ddp_buffer(struct toepcb *toep,
toep->ddp_active_id = -1;
} else
toep->ddp_active_id ^= 1;
+#ifdef VERBOSE_TRACES
CTR2(KTR_CXGBE, "%s: ddp_active_id = %d", __func__,
toep->ddp_active_id);
+#endif
} else {
KASSERT(toep->ddp_active_count != 0 &&
toep->ddp_active_id != -1,
___
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: r300337 - in head: share/man/man9 sys/kern sys/sys

2016-05-20 Thread John Baldwin
Author: jhb
Date: Fri May 20 23:28:43 2016
New Revision: 300337
URL: https://svnweb.freebsd.org/changeset/base/300337

Log:
  Add sglist functions for working with arrays of VM pages.
  
  sglist_count_vmpages() determines the number of segments required for
  a buffer described by an array of VM pages. sglist_append_vmpages()
  adds the segments described by such a buffer to an sglist.  The latter
  function is largely pulled from sglist_append_bio(), and
  sglist_append_bio() now uses sglist_append_vmpages().
  
  Reviewed by:  kib
  Sponsored by: Chelsio Communications

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/sglist.9
  head/sys/kern/subr_sglist.c
  head/sys/sys/sglist.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri May 20 23:08:22 2016
(r300336)
+++ head/share/man/man9/MakefileFri May 20 23:28:43 2016
(r300337)
@@ -1510,10 +1510,12 @@ MLINKS+=sglist.9 sglist_alloc.9 \
sglist.9 sglist_append_phys.9 \
sglist.9 sglist_append_uio.9 \
sglist.9 sglist_append_user.9 \
+   sglist.9 sglist_append_vmpages.9 \
sglist.9 sglist_build.9 \
sglist.9 sglist_clone.9 \
sglist.9 sglist_consume_uio.9 \
sglist.9 sglist_count.9 \
+   sglist.9 sglist_count_vmpages.9 \
sglist.9 sglist_free.9 \
sglist.9 sglist_hold.9 \
sglist.9 sglist_init.9 \

Modified: head/share/man/man9/sglist.9
==
--- head/share/man/man9/sglist.9Fri May 20 23:08:22 2016
(r300336)
+++ head/share/man/man9/sglist.9Fri May 20 23:28:43 2016
(r300337)
@@ -38,10 +38,12 @@
 .Nm sglist_append_phys ,
 .Nm sglist_append_uio ,
 .Nm sglist_append_user ,
+.Nm sglist_append_vmpages ,
 .Nm sglist_build ,
 .Nm sglist_clone ,
 .Nm sglist_consume_uio ,
 .Nm sglist_count ,
+.Nm sglist_count_vmpages ,
 .Nm sglist_free ,
 .Nm sglist_hold ,
 .Nm sglist_init ,
@@ -68,6 +70,8 @@
 .Fn sglist_append_uio "struct sglist *sg" "struct uio *uio"
 .Ft int
 .Fn sglist_append_user "struct sglist *sg" "void *buf" "size_t len" "struct 
thread *td"
+.Ft int
+.Fn sglist_append_vmpages "struct sglist *sg" "vm_page_t *m" "size_t pgoff" 
"size_t len"
 .Ft struct sglist *
 .Fn sglist_build "void *buf" "size_t len" "int mflags"
 .Ft struct sglist *
@@ -76,6 +80,8 @@
 .Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "size_t resid"
 .Ft int
 .Fn sglist_count "void *buf" "size_t len"
+.Ft int
+.Fn sglist_count_vmpages "vm_page_t *m" "size_t pgoff" "size_t len"
 .Ft void
 .Fn sglist_free "struct sglist *sg"
 .Ft struct sglist *
@@ -137,6 +143,18 @@ and is
 bytes long.
 .Pp
 The
+.Nm sglist_count_vmpages
+function returns the number of scatter/gather list elements needed to describe
+the physical address ranges of a buffer backed by an array of virtual memory
+pages
+.Fa m .
+The buffer starts at an offset of
+.Fa pgoff
+bytes relative to the first page and is
+.Fa len
+bytes long.
+.Pp
+The
 .Nm sglist_build
 function allocates a new scatter/gather list object that describes the physical
 address ranges mapped by a single kernel virtual address range.
@@ -262,6 +280,17 @@ the user buffer are wired for the lifeti
 .Fa sg .
 .Pp
 The
+.Nm sglist_append_vmpages
+function appends the physical address ranges of a buffer backed by an array
+of virtual memory pages
+.Fa m .
+The buffer starts at an offset of
+.Fa pgoff
+bytes relative to the first page and is
+.Fa len
+bytes long.
+.Pp
+The
 .Nm sglist_consume_uio
 function is a variation of
 .Nm sglist_append_uio .
@@ -421,7 +450,9 @@ functions return zero on success or an e
 .Pp
 The
 .Nm sglist_count
-function returns a count of scatter/gather list elements.
+and
+.Nm sglist_count_vmpages
+functions return a count of scatter/gather list elements.
 .Pp
 The
 .Nm sglist_length

Modified: head/sys/kern/subr_sglist.c
==
--- head/sys/kern/subr_sglist.c Fri May 20 23:08:22 2016(r300336)
+++ head/sys/kern/subr_sglist.c Fri May 20 23:28:43 2016(r300337)
@@ -192,6 +192,31 @@ sglist_count(void *buf, size_t len)
 }
 
 /*
+ * Determine the number of scatter/gather list elements needed to
+ * describe a buffer backed by an array of VM pages.
+ */
+int
+sglist_count_vmpages(vm_page_t *m, size_t pgoff, size_t len)
+{
+   vm_paddr_t lastaddr, paddr;
+   int i, nsegs;
+
+   if (len == 0)
+   return (0);
+
+   len += pgoff;
+   nsegs = 1;
+   lastaddr = VM_PAGE_TO_PHYS(m[0]);
+   for (i = 1; len > PAGE_SIZE; len -= PAGE_SIZE, i++) {
+   paddr = VM_PAGE_TO_PHYS(m[i]);
+   if (lastaddr + PAGE_SIZE != paddr)
+   nsegs++;
+   lastaddr = paddr;
+   }
+   return (nsegs);
+}
+
+/*
  * Allocate a scatter/gather list along wit

svn commit: r300340 - head/bin/ed

2016-05-20 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 21 00:45:42 2016
New Revision: 300340
URL: https://svnweb.freebsd.org/changeset/base/300340

Log:
  ed(1): simplify by using arc4random_buf().
  
  Suggested by: ed

Modified:
  head/bin/ed/cbc.c

Modified: head/bin/ed/cbc.c
==
--- head/bin/ed/cbc.c   Sat May 21 00:43:10 2016(r300339)
+++ head/bin/ed/cbc.c   Sat May 21 00:45:42 2016(r300340)
@@ -90,16 +90,13 @@ void
 init_des_cipher(void)
 {
 #ifdef DES
-   int i;
-
des_ct = des_n = 0;
 
/* initialize the initialization vector */
MEMZERO(ivec, 8);
 
/* initialize the padding vector */
-   for (i = 0; i < 8; i++)
-   pvec[i] = (char)arc4random_uniform(256);
+   arc4random_buf(pvec, sizeof(pvec));
 #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"


Re: svn commit: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-20 Thread Conrad Meyer
On Fri, May 20, 2016 at 4:02 PM, Bruce Evans  wrote:
> On Fri, 20 May 2016, Konstantin Belousov wrote:
>
>> --- head/sys/i386/i386/sys_machdep.cFri May 20 19:46:25 2016
>> (r300331)
>> +++ head/sys/i386/i386/sys_machdep.cFri May 20 19:50:32 2016
>> (r300332)
>> @@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
>> struct thread *td;
>> struct i386_ioperm_args *uap;
>> {
>> -   int i, error;
>> char *iomap;
>> +   u_int i;
>> +   int error;
>>
>> if ((error = priv_check(td, PRIV_IO)) != 0)
>> return (error);
>> @@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
>> return (error);
>> iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;
>>
>> -   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
>> +   if (uap->start > uap->start + uap->length ||
>> +   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
>> return (EINVAL);
>>
>> for (i = uap->start; i < uap->start + uap->length; i++) {
>
>
> I don't like using u_int for a small index.

Why not?  Indices are by definition non-negative so the fit seems natural.

>  After the bounds checking
> fix, the range fits in a small signed integer.  However, uap->start
> and uap->length already use bad type u_int, so it is natural to keep
> using that type.

What's bad about it?

Thanks,
Conrad
___
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: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-20 Thread Bruce Evans

On Fri, 20 May 2016, Conrad Meyer wrote:


On Fri, May 20, 2016 at 4:02 PM, Bruce Evans  wrote:

On Fri, 20 May 2016, Konstantin Belousov wrote:


--- head/sys/i386/i386/sys_machdep.cFri May 20 19:46:25 2016
(r300331)
+++ head/sys/i386/i386/sys_machdep.cFri May 20 19:50:32 2016
(r300332)
@@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
struct thread *td;
struct i386_ioperm_args *uap;
{
-   int i, error;
char *iomap;
+   u_int i;
+   int error;

if ((error = priv_check(td, PRIV_IO)) != 0)
return (error);
@@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
return (error);
iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;

-   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
+   if (uap->start > uap->start + uap->length ||
+   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);

for (i = uap->start; i < uap->start + uap->length; i++) {


I don't like using u_int for a small index.


Why not?  Indices are by definition non-negative so the fit seems natural.


Signed integers are easier to understand provided calculations with them
don't overflow.  Unsigned integers are not easier to understand if
calculations with them do overflow.  That was the case here.

Only indices relative to the base of an array are by definition
non-negative.  For an array a[], it is valid to do p = &a[i] and then
use p[j] with negative j to get back before the i'th index.  This is
sometimes useful.  i + j must be >= 0, but is hard write correctly and
understand if either i or j is unsigned.  (It can be arranged that the
addition wraps correctly, but this is basically re-implementing signed
arithmetic.)


After the bounds checking
fix, the range fits in a small signed integer.  However, uap->start
and uap->length already use bad type u_int, so it is natural to keep
using that type.


What's bad about it?


Unsigned in the API gives unsigned poisoning when the API is used.

The API would have needed unsigneds to cover the i386 i/o range of
64K using 16-bit ints, but since we never supported 16-bit ints and
POSI now requires 32-bit ints, we shouldn't have the complications
from that.

Bruce
___
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: r300342 - head/share/mk

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:31:44 2016
New Revision: 300342
URL: https://svnweb.freebsd.org/changeset/base/300342

Log:
  WITH_DIRDEPS_BUILD: Fix forcing user to run bootstrap-tools.
  
  This is a follow-up to r299289.  If the user did not run bootstrap-tools
  for this directory then just build the tool as normal.  It assumes that
  TARGET == MACHINE, but that was already the case before r299289.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/local.meta.sys.mk

Modified: head/share/mk/local.meta.sys.mk
==
--- head/share/mk/local.meta.sys.mk Sat May 21 01:31:41 2016
(r300341)
+++ head/share/mk/local.meta.sys.mk Sat May 21 01:31:44 2016
(r300342)
@@ -232,7 +232,12 @@ TOOLSDIR?= ${HOST_OBJTOP}/tools
 .elif defined(STAGE_HOST_OBJTOP)
 TOOLSDIR?= ${STAGE_HOST_OBJTOP}
 .endif
+# Only define if it exists in case user didn't run bootstrap-tools.  Otherwise
+# the tool will be built during the build.  Building it assumes it is
+# TARGET==MACHINE.
+.if exists(${HOST_OBJTOP}/tools${.CURDIR})
 BTOOLSPATH= ${HOST_OBJTOP}/tools${.CURDIR}
+.endif
 
 # Don't use the bootstrap tools logic on itself.
 .if ${.TARGETS:Mbootstrap-tools} == "" && \
___
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: r300341 - head/lib/libc/gen

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:31:41 2016
New Revision: 300341
URL: https://svnweb.freebsd.org/changeset/base/300341

Log:
  FTS: Remove stale reference to nfs4 fs which was removed in r192578.
  
  MFC after:2 weeks

Modified:
  head/lib/libc/gen/fts-compat.c
  head/lib/libc/gen/fts.c

Modified: head/lib/libc/gen/fts-compat.c
==
--- head/lib/libc/gen/fts-compat.c  Sat May 21 00:45:42 2016
(r300340)
+++ head/lib/libc/gen/fts-compat.c  Sat May 21 01:31:41 2016
(r300341)
@@ -114,7 +114,6 @@ static const char *ufslike_filesystems[]
"ufs",
"zfs",
"nfs",
-   "nfs4",
"ext2fs",
0
 };

Modified: head/lib/libc/gen/fts.c
==
--- head/lib/libc/gen/fts.c Sat May 21 00:45:42 2016(r300340)
+++ head/lib/libc/gen/fts.c Sat May 21 01:31:41 2016(r300341)
@@ -104,7 +104,6 @@ static const char *ufslike_filesystems[]
"ufs",
"zfs",
"nfs",
-   "nfs4",
"ext2fs",
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: r300343 - in head: share/mk sys/conf

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:31:48 2016
New Revision: 300343
URL: https://svnweb.freebsd.org/changeset/base/300343

Log:
  WITH_META_MODE: Fix suffix transformation rules with guessed dependencies.
  
  This is the same problem as r290629.  With META_MODE we do not generate
  .depend files, so there is no proper dependency to lookup.  Guessed
  dependencies must be used.  If this proves to be a problem then we will
  have to generate and use .depend files even with META_MODE.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/bsd.dep.mk
  head/sys/conf/kern.post.mk

Modified: head/share/mk/bsd.dep.mk
==
--- head/share/mk/bsd.dep.mkSat May 21 01:31:44 2016(r300342)
+++ head/share/mk/bsd.dep.mkSat May 21 01:31:48 2016(r300343)
@@ -216,6 +216,12 @@ afterdepend: beforedepend
 (!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}))
 ${__obj}: ${OBJS_DEPEND_GUESS}
 ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
+.elif defined(_meta_filemon)
+# For meta mode we still need to know which file to depend on to avoid
+# ambiguous suffix transformation rules from .PATH.  Meta mode does not
+# use .depend files.  We really only need source files, not headers.
+${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
+${__obj}: ${OBJS_DEPEND_GUESS.${__obj}:N*.h}
 .endif
 .endfor
 

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Sat May 21 01:31:44 2016(r300342)
+++ head/sys/conf/kern.post.mk  Sat May 21 01:31:48 2016(r300343)
@@ -247,6 +247,14 @@ beforebuild: kernel-depend
 ${__obj}: ${OBJS_DEPEND_GUESS}
 .endif
 ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
+.elif defined(_meta_filemon)
+# For meta mode we still need to know which file to depend on to avoid
+# ambiguous suffix transformation rules from .PATH.  Meta mode does not
+# use .depend files.  We really only need source files, not headers.
+.if ${SYSTEM_OBJS:M${__obj}}
+${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
+.endif
+${__obj}: ${OBJS_DEPEND_GUESS.${__obj}:N*.h}
 .endif
 .endfor
 
___
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: r300345 - head/share/mk

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:31:54 2016
New Revision: 300345
URL: https://svnweb.freebsd.org/changeset/base/300345

Log:
  WITH_META_MODE: Disable for 'make install' from top-level.
  
  See r298220 for more explanation.  We don't want to prevent installing
  if a cookie exists for the install target.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/src.sys.env.mk

Modified: head/share/mk/src.sys.env.mk
==
--- head/share/mk/src.sys.env.mkSat May 21 01:31:51 2016
(r300344)
+++ head/share/mk/src.sys.env.mkSat May 21 01:31:54 2016
(r300345)
@@ -18,6 +18,13 @@ SRC_ENV_CONF?= /etc/src-env.conf
 _src_env_conf_included_:   .NOTMAIN
 .endif
 
+# Top-level installs should not use meta mode as it may prevent installing
+# based on cookies.
+.if make(*install*) && ${.MAKE.LEVEL} == 0
+META_MODE= normal
+MK_META_MODE=  no
+.endif
+
 # If we were found via .../share/mk we need to replace that
 # with ${.PARSEDIR:tA} so that we can be found by
 # sub-makes launched from objdir.
___
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: r300344 - head

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:31:51 2016
New Revision: 300344
URL: https://svnweb.freebsd.org/changeset/base/300344

Log:
  WITH_META_MODE: Use META_MODE rather than .MAKE.MODE for buildkernel.
  
  This is mostly a style change so that other code does not duplicate
  it.  The problem is when META_MODE needs to be disabled but it has
  been overridden by .MAKE.MODE.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May 21 01:31:48 2016(r300343)
+++ head/Makefile.inc1  Sat May 21 01:31:51 2016(r300344)
@@ -533,7 +533,7 @@ KMAKE=  ${KMAKEENV} ${MAKE} ${.MAKEFLAGS
 .if ${MK_META_MODE} == "yes"
 # meta mode normally is disallowed when building from curdir==objdir, but we
 # want to allow it for the kernel build.
-KMAKE+=.MAKE.MODE="${.MAKE.MODE} curdirOk=yes"
+KMAKEENV+= META_MODE="${.MAKE.MODE} curdirOk=yes"
 .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: r300347 - head/gnu/usr.bin/cc/cc_tools

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:01 2016
New Revision: 300347
URL: https://svnweb.freebsd.org/changeset/base/300347

Log:
  WITH_META_MODE: Avoid rebuilds of cc_tools during target build.
  
  This is the same as r299289 and r297997.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/gnu/usr.bin/cc/cc_tools/Makefile

Modified: head/gnu/usr.bin/cc/cc_tools/Makefile
==
--- head/gnu/usr.bin/cc/cc_tools/Makefile   Sat May 21 01:31:57 2016
(r300346)
+++ head/gnu/usr.bin/cc/cc_tools/Makefile   Sat May 21 01:32:01 2016
(r300347)
@@ -279,7 +279,7 @@ gengtype: gengtype.o gengtype-yacc+%DIKE
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
 
 gtype-desc.h:  gengtype
-   ./gengtype
+   ${BTOOLSPATH:U.}/gengtype
touch ${.TARGET}
 
 gtype-desc.c:  gtype-desc.h
@@ -309,7 +309,7 @@ gencondmd:  gencondmd.o
 # Generated .md files.
 #
 insn-conditions.md:gencondmd
-   ./gencondmd > ${.TARGET}
+   ${BTOOLSPATH:U.}/gencondmd > ${.TARGET}
 GENSRCS+=  insn-conditions.md
 
 #
@@ -318,35 +318,35 @@ GENSRCS+= insn-conditions.md
 
 .for F in constants
 insn-$F.h: gen$F ${MD_FILE}
-   ./gen$F ${MD_FILE} > ${.TARGET}
+   ${BTOOLSPATH:U.}/gen$F ${MD_FILE} > ${.TARGET}
 GENSRCS+=  insn-$F.h
 .endfor
 
 .for F in attr codes config flags
 insn-$F.h: gen$F ${MD_FILE} insn-conditions.md
-   ./gen$F ${MD_FILE} insn-conditions.md > ${.TARGET}
+   ${BTOOLSPATH:U.}/gen$F ${MD_FILE} insn-conditions.md > ${.TARGET}
 GENSRCS+=  insn-$F.h
 .endfor
 
 # Header files with irregular names.
 genrtl.h:  gengenrtl
-   ./gengenrtl -h > ${.TARGET}
+   ${BTOOLSPATH:U.}/gengenrtl -h > ${.TARGET}
 GENSRCS+=  genrtl.h
 
 tm-preds.h:genpreds
-   ./genpreds -h ${MD_FILE} > ${.TARGET}
+   ${BTOOLSPATH:U.}/genpreds -h ${MD_FILE} > ${.TARGET}
 GENSRCS+=  tm-preds.h
 
 tm-constrs.h:  genpreds
-   ./genpreds -c ${MD_FILE} > ${.TARGET}
+   ${BTOOLSPATH:U.}/genpreds -c ${MD_FILE} > ${.TARGET}
 GENSRCS+=  tm-constrs.h
 
 tree-check.h:  gencheck
-   ./gencheck > ${.TARGET}
+   ${BTOOLSPATH:U.}/gencheck > ${.TARGET}
 GENSRCS+=  tree-check.h
 
 insn-modes.h:  genmodes
-   ./genmodes -h > ${.TARGET}
+   ${BTOOLSPATH:U.}/genmodes -h > ${.TARGET}
 GENSRCS+=  insn-modes.h
 
 #
@@ -354,31 +354,31 @@ GENSRCS+= insn-modes.h
 #
 .for F in attrtab automata emit extract opinit output peep preds recog
 insn-$F.c: gen$F ${MD_FILE} insn-conditions.md
-   ./gen$F ${MD_FILE} insn-conditions.md > ${.TARGET}
+   ${BTOOLSPATH:U.}/gen$F ${MD_FILE} insn-conditions.md > ${.TARGET}
 GENONLY+=  insn-$F.c
 .endfor
 
 .for F in conditions
 insn-$F.c: gen$F ${MD_FILE}
-   ./gen$F ${MD_FILE} > ${.TARGET}
+   ${BTOOLSPATH:U.}/gen$F ${MD_FILE} > ${.TARGET}
 GENSRCS+=  insn-$F.c
 .endfor
 
 # Source files with irregular names.
 insn-modes.c:  genmodes
-   ./genmodes > ${.TARGET}
+   ${BTOOLSPATH:U.}/genmodes > ${.TARGET}
 GENONLY+=  insn-modes.c
 
 min-insn-modes.c:  genmodes
-   ./genmodes -m > ${.TARGET}
+   ${BTOOLSPATH:U.}/genmodes -m > ${.TARGET}
 GENSRCS+=  min-insn-modes.c
 
 genrtl.c:  gengenrtl
-   ./gengenrtl > ${.TARGET}
+   ${BTOOLSPATH:U.}/gengenrtl > ${.TARGET}
 GENONLY+=  genrtl.c
 
 gencondmd.c:   genconditions ${MD_FILE}
-   ./genconditions ${MD_FILE} > ${.TARGET}
+   ${BTOOLSPATH:U.}/genconditions ${MD_FILE} > ${.TARGET}
 GENSRCS+=  gencondmd.c
 
 #---
@@ -389,6 +389,7 @@ GNTOOLS+=   genattr genattrtab genautomata
genextract genflags gengenrtl gengtype genmodes genopinit \
genoutput genpeep genpreds genrecog
 
+${GNTOOLS:C,$,.o,} ${GNTOOLS}: ${BUILD_TOOLS_META}
 all: ${GNTOOLS} ${GENSRCS} ${GENONLY}
 beforedepend: ${GENONLY}
 
@@ -404,11 +405,11 @@ LIBIBERTY_SRCS=   choose-temp.c concat.c c
 LIBIBERTY_OBJS=${LIBIBERTY_SRCS:R:S/$/.o/g}
 
 .for _src in ${LIBIBERTY_SRCS}
-${_src:R:S/$/.o/}: ${_src}
+${_src:R:S/$/.o/}: ${_src} ${BUILD_TOOLS_META}
${CC} -c -I ${.CURDIR}/../libiberty ${CFLAGS} -o ${.TARGET} ${.IMPSRC}
 .endfor
 
-${LIBIBERTY}: ${LIBIBERTY_OBJS}
+${LIBIBERTY}: ${LIBIBERTY_OBJS} ${BUILD_TOOLS_META}
@rm -f ${.TARGET}
@${AR} ${ARFLAGS} ${.TARGET} `lorder ${LIBIBERTY_OBJS} | tsort -q`
${RANLIB} ${.TARGET}
@@ -432,6 +433,7 @@ SRCS=   errors.c genattr.c genattrtab.c \
 SRCS+= ${GENSRCS}
 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
 GENOBJS+=  ${GENSRCS:N*.h:R:S/$/.o/g}
+${OBJS} ${GENOBJS}: ${BUILD_TOOLS_META}
 CLEANFILES+=   ${GENSRCS} ${GENONLY} ${GENOBJS} ${GNTOOLS}
 
 #---
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src

svn commit: r300350 - head/share/mk

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:10 2016
New Revision: 300350
URL: https://svnweb.freebsd.org/changeset/base/300350

Log:
  Auto determine X_COMPILER_TYPE/X_COMPILER_VERSION if XCC is set.
  
  Reviewed by:  brooks, bapt
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6355

Modified:
  head/share/mk/bsd.compiler.mk

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Sat May 21 01:32:07 2016
(r300349)
+++ head/share/mk/bsd.compiler.mk   Sat May 21 01:32:10 2016
(r300350)
@@ -19,6 +19,8 @@
 #
 # - c++11 : supports full (or nearly full) C++11 programming environment.
 #
+# These variables with an X_ prefix will also be provided if XCC is set.
+#
 # This file may be included multiple times, but only has effect the first time.
 #
 
@@ -97,12 +99,14 @@ ccache-print-options: .PHONY
 .endif # exists(${CCACHE_BIN})
 .endif # ${MK_CCACHE_BUILD} == "yes"
 
+.for cc X_ in CC $${_empty_var_} XCC X_
+.if ${cc} == "CC" || !empty(XCC)
 # Try to import COMPILER_TYPE and COMPILER_VERSION from parent make.
 # The value is only used/exported for the same environment that impacts
 # CC and COMPILER_* settings here.
-_exported_vars=COMPILER_TYPE COMPILER_VERSION
-_cc_hash=  ${CC}${MACHINE}${PATH}
-_cc_hash:= ${_cc_hash:hash}
+_exported_vars=${X_}COMPILER_TYPE ${X_}COMPILER_VERSION
+${X_}_cc_hash= ${${cc}}${MACHINE}${PATH}
+${X_}_cc_hash:=${${X_}_cc_hash:hash}
 # Only import if none of the vars are set somehow else.
 _can_export=   yes
 .for var in ${_exported_vars}
@@ -112,54 +116,65 @@ _can_export=  no
 .endfor
 .if ${_can_export} == yes
 .for var in ${_exported_vars}
-.if defined(${var}.${_cc_hash})
-${var}=${${var}.${_cc_hash}}
+.if defined(${var}.${${X_}_cc_hash})
+${var}=${${var}.${${X_}_cc_hash}}
 .endif
 .endfor
 .endif
 
+.if ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
 .if ${MACHINE} == "common"
 # common is a pseudo machine for architecture independent
 # generated files - thus there is no compiler.
-COMPILER_TYPE= none
-COMPILER_VERSION= 0
-.elif !defined(COMPILER_TYPE) || !defined(COMPILER_VERSION)
-_v!=   ${CC} --version || echo 0.0.0
-
-.if !defined(COMPILER_TYPE)
-. if ${CC:T:M*gcc*}
-COMPILER_TYPE:=gcc  
-. elif ${CC:T:M*clang*}
-COMPILER_TYPE:=clang
+${X_}COMPILER_TYPE= none
+${X_}COMPILER_VERSION= 0
+.elif !defined(${X_}COMPILER_TYPE) || !defined(${X_}COMPILER_VERSION)
+_v!=   ${${cc}} --version || echo 0.0.0
+
+.if !defined(${X_}COMPILER_TYPE)
+. if ${${cc}:T:M*gcc*}
+${X_}COMPILER_TYPE:=   gcc
+. elif ${${cc}:T:M*clang*}
+${X_}COMPILER_TYPE:=   clang
 . elif ${_v:Mgcc}
-COMPILER_TYPE:=gcc
+${X_}COMPILER_TYPE:=   gcc
 . elif ${_v:M\(GCC\)}
-COMPILER_TYPE:=gcc
+${X_}COMPILER_TYPE:=   gcc
 . elif ${_v:Mclang}
-COMPILER_TYPE:=clang
+${X_}COMPILER_TYPE:=   clang
 . else
-.error Unable to determine compiler type for ${CC}.  Consider setting 
COMPILER_TYPE.
+.error Unable to determine compiler type for ${cc}=${${cc}}.  Consider setting 
${X_}COMPILER_TYPE.
 . endif
 .endif
-.if !defined(COMPILER_VERSION)
-COMPILER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 1 + 
$$2 * 100 + $$3;}'
+.if !defined(${X_}COMPILER_VERSION)
+${X_}COMPILER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 
1 + $$2 * 100 + $$3;}'
 .endif
 .undef _v
 .endif
 
+.if ${${X_}COMPILER_TYPE} == "clang" || \
+   (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
+${X_}COMPILER_FEATURES=c++11
+.else
+${X_}COMPILER_FEATURES=
+.endif
+
+.else
+# Use CC's values
+X_COMPILER_TYPE=   ${COMPILER_TYPE}
+X_COMPILER_VERSION=${COMPILER_VERSION}
+X_COMPILER_FEATURES=   ${COMPILER_FEATURES}
+.endif # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
+
 # Export the values so sub-makes don't have to look them up again, using the
 # hash key computed above.
 .for var in ${_exported_vars}
-${var}.${_cc_hash}:=   ${${var}}
-.export-env ${var}.${_cc_hash}
-.undef ${var}.${_cc_hash}
+${var}.${${X_}_cc_hash}:=  ${${var}}
+.export-env ${var}.${${X_}_cc_hash}
+.undef ${var}.${${X_}_cc_hash}
 .endfor
 
-.if ${COMPILER_TYPE} == "clang" || \
-   (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800)
-COMPILER_FEATURES= c++11
-.else
-COMPILER_FEATURES=
-.endif
+.endif # ${cc} == "CC" || !empty(XCC)
+.endfor# .for cc in CC XCC
 
 .endif # !target()
___
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: r300346 - head/include

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:31:57 2016
New Revision: 300346
URL: https://svnweb.freebsd.org/changeset/base/300346

Log:
  WITH_META_MODE: Disable cookie handling for include installation.
  
  Using a cookie with meta mode causes it to *not rerun* (as normal make
  does) unless the command changes or filemon-detected files change.
  
  After all of the work done here it turns out that skipping installation
  is dangerous since the install commands use /*.h.  The actual build
  command is not changing but the files installed are changing by the mere
  act of adding a new header into the source tree.  Thus we cannot safely
  use meta mode logic here.  It must always rerun and install the headers.
  The install -C flag at least prevents churning timestamps when
  installing a header that was already present.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/include/Makefile

Modified: head/include/Makefile
==
--- head/include/Makefile   Sat May 21 01:31:54 2016(r300345)
+++ head/include/Makefile   Sat May 21 01:31:57 2016(r300346)
@@ -130,7 +130,7 @@ _MARCHS=${MACHINE_CPUARCH}
 _MARCHS+=  x86
 .endif
 
-META_TARGETS+= compat copies symlinks
+META_TARGETS+= compat
 stage_includes: ${SHARED}
 
 # Take care of stale directory-level symlinks.
@@ -144,7 +144,7 @@ compat:
-f ${.CURDIR}/../etc/mtree/BSD.include.dist \
-p ${DESTDIR}${INCLUDEDIR} > /dev/null
 
-copies:
+copies: .PHONY .META
 .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
${_MARCHS}
if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \
@@ -230,7 +230,7 @@ copies:
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
${DESTDIR}${INCLUDEDIR}/teken
 
-symlinks:
+symlinks: .PHONY .META
@${ECHO} "Setting up symlinks to kernel source tree..."
 .for i in ${LDIRS}
cd ${.CURDIR}/../sys/$i; \
___
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: r300348 - head

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:04 2016
New Revision: 300348
URL: https://svnweb.freebsd.org/changeset/base/300348

Log:
  Move external toolchain support earlier.
  
  This is to consolidate external toolchain and WITHOUT_CROSS_COMPILER support.
  
  Reviewed by:  brooks, bapt
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6353

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May 21 01:32:01 2016(r300347)
+++ head/Makefile.inc1  Sat May 21 01:32:04 2016(r300348)
@@ -56,6 +56,41 @@ LOCALBASE?=  /usr/local
 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
 CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}"
 .endif
+.if defined(CROSS_TOOLCHAIN_PREFIX)
+CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
+CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
+.endif
+# If we do not have a bootstrap binutils (because the in-tree one does not
+# support the target architecture), provide a default cross-binutils prefix.
+# This allows aarch64 builds, for example, to automatically use the
+# aarch64-binutils port or package.
+.if !make(showconfig)
+.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
+!defined(CROSS_BINUTILS_PREFIX)
+CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
+.if !exists(${CROSS_BINUTILS_PREFIX})
+.error In-tree binutils does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-binutils port or package or set 
CROSS_BINUTILS_PREFIX.
+.endif
+.endif
+.endif
+
+XCOMPILERS=CC CXX CPP
+.for COMPILER in ${XCOMPILERS}
+.if defined(CROSS_COMPILER_PREFIX)
+X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
+.else
+X${COMPILER}?= ${${COMPILER}}
+.endif
+.endfor
+XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
+.for BINUTIL in ${XBINUTILS}
+.if defined(CROSS_BINUTILS_PREFIX) && \
+exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
+X${BINUTIL}?=  ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
+.else
+X${BINUTIL}?=  ${${BINUTIL}}
+.endif
+.endfor
 .include  # don't depend on src.opts.mk doing it
 .include "share/mk/src.opts.mk"
 
@@ -404,42 +439,6 @@ HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MT
 HMAKE+=PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
 .endif
 
-.if defined(CROSS_TOOLCHAIN_PREFIX)
-CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
-CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
-.endif
-
-# If we do not have a bootstrap binutils (because the in-tree one does not
-# support the target architecture), provide a default cross-binutils prefix.
-# This allows aarch64 builds, for example, to automatically use the
-# aarch64-binutils port or package.
-.if !make(showconfig)
-.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
-!defined(CROSS_BINUTILS_PREFIX)
-CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
-.if !exists(${CROSS_BINUTILS_PREFIX})
-.error In-tree binutils does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-binutils port or package or set 
CROSS_BINUTILS_PREFIX.
-.endif
-.endif
-.endif
-
-XCOMPILERS=CC CXX CPP
-.for COMPILER in ${XCOMPILERS}
-.if defined(CROSS_COMPILER_PREFIX)
-X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
-.else
-X${COMPILER}?= ${${COMPILER}}
-.endif
-.endfor
-XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
-.for BINUTIL in ${XBINUTILS}
-.if defined(CROSS_BINUTILS_PREFIX) && \
-exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
-X${BINUTIL}?=  ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
-.else
-X${BINUTIL}?=  ${${BINUTIL}}
-.endif
-.endfor
 CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
CPP="${XCPP} ${XCFLAGS}" \
AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
___
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: r300349 - head

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:07 2016
New Revision: 300349
URL: https://svnweb.freebsd.org/changeset/base/300349

Log:
  Enable and utilize WITHOUT_CROSS_COMPILER logic for external CC.
  
  This is a NOP.
  
  Reviewed by:  brooks, bapt
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6354

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May 21 01:32:04 2016(r300348)
+++ head/Makefile.inc1  Sat May 21 01:32:07 2016(r300349)
@@ -91,6 +91,12 @@ X${BINUTIL}?=${CROSS_BINUTILS_PREFIX}${
 X${BINUTIL}?=  ${${BINUTIL}}
 .endif
 .endfor
+# If a full path to an external cross compiler is given, don't build
+# a cross compiler.
+.if ${XCC:N${CCACHE_BIN}:M/*}
+MK_CROSS_COMPILER= no
+.endif
+
 .include  # don't depend on src.opts.mk doing it
 .include "share/mk/src.opts.mk"
 
@@ -454,7 +460,7 @@ BFLAGS+=-B${CROSS_BINUTILS_PREFIX}
 .endif
 
 # External compiler needs sysroot and target flags.
-.if ${XCC:N${CCACHE_BIN}:M/*} || ${MK_CROSS_COMPILER} == "no"
+.if ${MK_CROSS_COMPILER} == "no"
 .if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX})
 BFLAGS+=   -B${WORLDTMP}/usr/bin
 .endif
@@ -478,7 +484,7 @@ XCFLAGS+=   -target ${TARGET_TRIPLE}
 .endif
 XCFLAGS+=  --sysroot=${WORLDTMP}
 .else
-.endif # ${XCC:M/*} || ${MK_CROSS_COMPILER} == "no"
+.endif # ${MK_CROSS_COMPILER} == "no"
 
 .if !empty(BFLAGS)
 XCFLAGS+=  ${BFLAGS}
@@ -1714,9 +1720,7 @@ _elftctools=  lib/libelftc \
usr.bin/elfcopy
 .endif
 
-# If an full path to an external cross compiler is given, don't build
-# a cross compiler.
-.if ${XCC:N${CCACHE_BIN}:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
+.if ${MK_CROSS_COMPILER} != "no"
 .if ${MK_CLANG_BOOTSTRAP} != "no"
 _clang=usr.bin/clang
 _clang_libs=   lib/clang
___
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: r300351 - head/share/mk

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:13 2016
New Revision: 300351
URL: https://svnweb.freebsd.org/changeset/base/300351

Log:
  Fetch the __FreeBSD_cc_version as COMPILER_FREEBSD_VERSION.
  
  Reviewed by:  brooks, bapt, dim
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6356

Modified:
  head/share/mk/bsd.compiler.mk

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Sat May 21 01:32:10 2016
(r300350)
+++ head/share/mk/bsd.compiler.mk   Sat May 21 01:32:13 2016
(r300351)
@@ -14,6 +14,8 @@
 # against 30300 for gcc likely isn't  what you wanted (since versions of gcc
 # prior to 4.2 likely have no prayer of working).
 #
+# COMPILER_FREEBSD_VERSION is the compiler's __FreeBSD_cc_version value.
+#
 # COMPILER_FEATURES will contain one or more of the following, based on
 # compiler support for that feature:
 #
@@ -104,7 +106,8 @@ ccache-print-options: .PHONY
 # Try to import COMPILER_TYPE and COMPILER_VERSION from parent make.
 # The value is only used/exported for the same environment that impacts
 # CC and COMPILER_* settings here.
-_exported_vars=${X_}COMPILER_TYPE ${X_}COMPILER_VERSION
+_exported_vars=${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
+   ${X_}COMPILER_FREEBSD_VERSION
 ${X_}_cc_hash= ${${cc}}${MACHINE}${PATH}
 ${X_}_cc_hash:=${${X_}_cc_hash:hash}
 # Only import if none of the vars are set somehow else.
@@ -128,6 +131,7 @@ ${var}= ${${var}.${${X_}_cc_hash}}
 # generated files - thus there is no compiler.
 ${X_}COMPILER_TYPE= none
 ${X_}COMPILER_VERSION= 0
+${X_}COMPILER_FREEBSD_VERSION= 0
 .elif !defined(${X_}COMPILER_TYPE) || !defined(${X_}COMPILER_VERSION)
 _v!=   ${${cc}} --version || echo 0.0.0
 
@@ -151,6 +155,15 @@ ${X_}COMPILER_VERSION!=echo "${_v:M[1-9]
 .endif
 .undef _v
 .endif
+.if !defined(${X_}COMPILER_FREEBSD_VERSION)
+${X_}COMPILER_FREEBSD_VERSION!={ echo "__FreeBSD_cc_version" | 
${${cc}} -E - 2>/dev/null || echo __FreeBSD_cc_version; } | tail -n 1
+# If we get a literal "__FreeBSD_cc_version" back then the compiler
+# is a non-FreeBSD build that doesn't support it or some other error
+# occurred.
+.if ${${X_}COMPILER_FREEBSD_VERSION} == "__FreeBSD_cc_version"
+${X_}COMPILER_FREEBSD_VERSION= unknown
+.endif
+.endif
 
 .if ${${X_}COMPILER_TYPE} == "clang" || \
(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
@@ -163,6 +176,7 @@ ${X_}COMPILER_FEATURES=
 # Use CC's values
 X_COMPILER_TYPE=   ${COMPILER_TYPE}
 X_COMPILER_VERSION=${COMPILER_VERSION}
+X_COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION}
 X_COMPILER_FEATURES=   ${COMPILER_FEATURES}
 .endif # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
 
___
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: r300354 - in head: . share/mk tools/build/options

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:23 2016
New Revision: 300354
URL: https://svnweb.freebsd.org/changeset/base/300354

Log:
  Opportunistically skip building a cross-compiler with SYSTEM_COMPILER set.
  
  This will still build the compiler for the target but will not build the
  bootstrap cross-compiler in the cross-tools phase.  Other toolchain
  bootstrapping, such as elftoolchan and binutils, currently still occurs.
  
  This will utilize the default CC (cc, /usr/bin/cc) as an external compiler.
  
  This is planned to be on-by-default eventually.
  
  This will utilize the __FreeBSD_cc_version compiler macro defined in the
  source tree and compare it to CC's version.  If they match then the
  cross-compiler is skipped.  If [X]CC is an external compiler (absolute
  path) or WITHOUT_CROSS_COMPILER is already set, then this logic is skipped.
  If the expected bootstrap compiler type no longer matches the found CC
  compiler type (clang vs gcc), then the logic is skipped.  As an extra
  safety check the version number is also compared from the compiler to
  the tree version.
  
  Clang:
The macro FREEBSD_CC_VERSION is defined in:
  lib/clang/include/clang/Basic/Version.inc
For clang -target will be used if TARGET_ARCH != MACHINE_ARCH.  This
is from the current external toolchain logic.  There is currently an
assumption that the host compiler can build the TARGET_ARCH.  This
will usually be the case since we don't conditionalize target arch
support in clang, but it will break when introducing new
architectures.  This problem is mitigated by incrementing the version
when adding new architectures.
  
  GCC:
The macro FBSD_CC_VER is defined in:
  gnu/usr.bin/cc/cc_tools/freebsd-native.h
For GCC there is no simple -target support when TARGET_ARCH !=
MACHINE_ARCH.  In this case the opportunistic skip is not done.  If we
add proper support for this case in external toolchain logic then it
will be fine to enable.
  
  This relies on the macros being incremented whenever any change occurs
  to these compilers that warrant rebuilding files.  It also should never
  repeat earlier values.
  
  Reviewed by:  brooks, bapt, imp
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6357

Added:
  head/tools/build/options/WITHOUT_SYSTEM_COMPILER   (contents, props changed)
  head/tools/build/options/WITH_SYSTEM_COMPILER   (contents, props changed)
Modified:
  head/Makefile.inc1
  head/share/mk/src.opts.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May 21 01:32:20 2016(r300353)
+++ head/Makefile.inc1  Sat May 21 01:32:23 2016(r300354)
@@ -48,6 +48,7 @@
 .error "Both TARGET and TARGET_ARCH must be defined."
 .endif
 
+SRCDIR?=   ${.CURDIR}
 LOCALBASE?=/usr/local
 
 # Cross toolchain changes must be in effect before bsd.compiler.mk
@@ -97,8 +98,59 @@ X${BINUTIL}?=${${BINUTIL}}
 MK_CROSS_COMPILER= no
 .endif
 
-.include  # don't depend on src.opts.mk doing it
-.include "share/mk/src.opts.mk"
+# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early.
+.include 
+.include "share/mk/src.opts.mk"
+
+# Check if there is a local compiler that can satisfy as an external compiler.
+.if ${MK_SYSTEM_COMPILER} == "yes" && ${MK_CROSS_COMPILER} == "yes" && \
+(${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \
+!make(showconfig)
+# Which compiler is expected to be used?
+.if ${MK_CLANG_BOOTSTRAP} == "yes"
+_expected_compiler_type=   clang
+.elif ${MK_GCC_BOOTSTRAP} == "yes"
+_expected_compiler_type=   gcc
+.endif
+# If the expected vs CC is different then we can't skip.
+# GCC cannot be used for cross-arch yet.  For clang we pass -target later if
+# TARGET_ARCH!=MACHINE_ARCH.
+.if ${_expected_compiler_type} == ${COMPILER_TYPE} && \
+(${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH})
+# It needs to be the same revision as we would build for the bootstrap.
+.if !defined(CROSS_COMPILER_FREEBSD_VERSION)
+.if ${_expected_compiler_type} == "clang"
+CROSS_COMPILER_FREEBSD_VERSION!= \
+   awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \
+   ${SRCDIR}/lib/clang/include/clang/Basic/Version.inc || echo unknown
+CROSS_COMPILER_VERSION!= \
+   awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 1 + 
a[2] * 100 + a[3]}' \
+   ${SRCDIR}/lib/clang/include/clang/Basic/Version.inc || echo unknown
+.elif ${_expected_compiler_type} == "gcc"
+CROSS_COMPILER_FREEBSD_VERSION!= \
+   awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \
+   ${SRCDIR}/gnu/usr.bin/cc/cc_tools/freebsd-native.h || echo unknown
+CROSS_COMPILER_VERSION!= \
+   awk -F. '{print $$1 * 1 + $$2 * 100 + $$3}' \
+   ${SRCDIR}/contrib/gcc/BASE-VER || echo unknown
+.endif
+.export CROSS_COMPILER_FREEBSD_VERSION CROSS_CO

svn commit: r300353 - head/lib/clang/include/clang/Basic

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:20 2016
New Revision: 300353
URL: https://svnweb.freebsd.org/changeset/base/300353

Log:
  Add FREEBSD_CC_VERSION which will be used to define __FreeBSD_cc_version.
  
  The WITH_SYSTEM_COMPILER build option will rely on this value to determine 
what
  __FreeBSD_cc_version the source tree will produce.  This value will be 
compared
  against the /usr/bin/cc value to determine if a new compiler is needed.
  
  Start with 112 which is 1 more than than the value we've had since
  3.8.0 to ensure that all changes since then are present.
  
  Reviewed by:  dim
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/clang/include/clang/Basic/Version.inc

Modified: head/lib/clang/include/clang/Basic/Version.inc
==
--- head/lib/clang/include/clang/Basic/Version.inc  Sat May 21 01:32:16 
2016(r300352)
+++ head/lib/clang/include/clang/Basic/Version.inc  Sat May 21 01:32:20 
2016(r300353)
@@ -8,3 +8,5 @@
 #defineCLANG_VENDOR"FreeBSD "
 
 #defineSVN_REVISION"262564"
+
+#defineFREEBSD_CC_VERSION  112U
___
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: r300352 - head

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:32:16 2016
New Revision: 300352
URL: https://svnweb.freebsd.org/changeset/base/300352

Log:
  Enable external compiler logic if both bootstrap compilers are disabled.
  
  Reviewed by:  brooks
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D6358

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat May 21 01:32:13 2016(r300351)
+++ head/Makefile.inc1  Sat May 21 01:32:16 2016(r300352)
@@ -460,7 +460,8 @@ BFLAGS+=-B${CROSS_BINUTILS_PREFIX}
 .endif
 
 # External compiler needs sysroot and target flags.
-.if ${MK_CROSS_COMPILER} == "no"
+.if ${MK_CROSS_COMPILER} == "no" || \
+(${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no")
 .if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX})
 BFLAGS+=   -B${WORLDTMP}/usr/bin
 .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: r300355 - head/share/man/man5

2016-05-20 Thread Bryan Drewery
Author: bdrewery
Date: Sat May 21 01:35:48 2016
New Revision: 300355
URL: https://svnweb.freebsd.org/changeset/base/300355

Log:
  Regenerate

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Sat May 21 01:32:23 2016
(r300354)
+++ head/share/man/man5/src.conf.5  Sat May 21 01:35:48 2016
(r300355)
@@ -1403,6 +1403,19 @@ This must be set in the environment, mak
 .Pa /etc/src-env.conf ,
 not
 .Pa /etc/src.conf .
+.It Va WITH_SYSTEM_COMPILER
+.\" from FreeBSD: head/tools/build/options/WITH_SYSTEM_COMPILER 300354 
2016-05-21 01:32:23Z bdrewery
+Set to opportunistically skip building a cross-compiler during the
+bootstrap phase of the build.
+If the currently installed compiler matches the planned bootstrap compiler
+type and revision, then it will not be built.
+This does not prevent a compiler from being built for installation though,
+only for building one for the build itself.
+The
+.Va WITHOUT_CLANG
+and
+.Va WITHOUT_GCC
+options control those.
 .It Va WITHOUT_TALK
 .\" from FreeBSD: head/tools/build/options/WITHOUT_TALK 277676 2015-01-25 
04:37:44Z ngie
 Set to not build or install
___
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: r300356 - in head: etc/defaults usr.sbin/periodic

2016-05-20 Thread Alan Somers
Author: asomers
Date: Sat May 21 02:14:11 2016
New Revision: 300356
URL: https://svnweb.freebsd.org/changeset/base/300356

Log:
  Better document security_show_{success,info,badconfig} in /etc/periodic.conf
  
  periodic(8) already handles the security_show_{success,info,badconfig}
  variables correctly. However, those variables aren't explicitly set in
  /etc/defaults/periodic.conf or anywhere else, which suggests to the user
  that they shouldn't be used.
  
  etc/defaults/periodic.conf
Explicitly set defaults for security_show_{success,info,badconfig}
  
  usr.sbin/periodic/periodic.sh
Update usage string
  
  usr.sbin/periodic/periodic.8
Minor man page updates
  
  One thing I'm _not_ doing is recommending setting security_output to
  /var/log/security.log or adding that file to /etc/newsyslog.conf, because
  periodic(8) would create it with default permissions, usually 644, and
  that's probably a bad idea.
  
  Reviewed by:  brd
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D6477

Modified:
  head/etc/defaults/periodic.conf
  head/usr.sbin/periodic/periodic.8
  head/usr.sbin/periodic/periodic.sh

Modified: head/etc/defaults/periodic.conf
==
--- head/etc/defaults/periodic.conf Sat May 21 01:35:48 2016
(r300355)
+++ head/etc/defaults/periodic.conf Sat May 21 02:14:11 2016
(r300356)
@@ -222,6 +222,10 @@ monthly_local="/etc/monthly.local" # L
 
 # Security options
 
+security_show_success="YES"# scripts returning 0
+security_show_info="YES"   # scripts returning 1
+security_show_badconfig="NO"   # scripts returning 2
+
 # These options are used by the security periodic(8) scripts spawned in
 # daily and weekly 450.status-security.
 security_status_logdir="/var/log"  # Directory for logs

Modified: head/usr.sbin/periodic/periodic.8
==
--- head/usr.sbin/periodic/periodic.8   Sat May 21 01:35:48 2016
(r300355)
+++ head/usr.sbin/periodic/periodic.8   Sat May 21 02:14:11 2016
(r300356)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 30, 2007
+.Dd May 20, 2016
 .Dt PERIODIC 8
 .Os
 .Sh NAME
@@ -166,8 +166,9 @@ table
 the top level directory containing
 .Pa daily ,
 .Pa weekly ,
+.Pa monthly ,
 and
-.Pa monthly
+.Pa security
 subdirectories which contain standard system periodic executables
 .It Pa /etc/defaults/periodic.conf
 the
@@ -175,9 +176,9 @@ the
 system registry contains variables that control the behaviour of
 .Nm
 and the standard
-.Pa daily , weekly ,
+.Pa daily , weekly , monthly ,
 and
-.Pa monthly
+.Pa security
 scripts
 .It Pa /etc/periodic.conf
 this file contains local overrides for the default

Modified: head/usr.sbin/periodic/periodic.sh
==
--- head/usr.sbin/periodic/periodic.sh  Sat May 21 01:35:48 2016
(r300355)
+++ head/usr.sbin/periodic/periodic.sh  Sat May 21 02:14:11 2016
(r300356)
@@ -4,13 +4,13 @@
 #
 # Run nightly periodic scripts
 #
-# usage: periodic { daily | weekly | monthly } - run standard periodic scripts
+# usage: periodic { daily | weekly | monthly | security } - run standard 
scripts
 #periodic /absolute/path/to/directory  - run periodic scripts in dir
 #
 
 usage () {
 echo "usage: $0 " 1>&2
-echo "or $0 { daily | weekly | monthly }"1>&2
+echo "or $0 { daily | weekly | monthly | security }"1>&2
 exit 1
 }
 
___
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: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-20 Thread Conrad Meyer
On Fri, May 20, 2016 at 6:10 PM, Bruce Evans  wrote:
> On Fri, 20 May 2016, Conrad Meyer wrote:
>
>> On Fri, May 20, 2016 at 4:02 PM, Bruce Evans  wrote:
>>>
>>> On Fri, 20 May 2016, Konstantin Belousov wrote:
>>>
 --- head/sys/i386/i386/sys_machdep.cFri May 20 19:46:25 2016
 (r300331)
 +++ head/sys/i386/i386/sys_machdep.cFri May 20 19:50:32 2016
 (r300332)
 @@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
 struct thread *td;
 struct i386_ioperm_args *uap;
 {
 -   int i, error;
 char *iomap;
 +   u_int i;
 +   int error;

 if ((error = priv_check(td, PRIV_IO)) != 0)
 return (error);
 @@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
 return (error);
 iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;

 -   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
 +   if (uap->start > uap->start + uap->length ||
 +   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
 return (EINVAL);

 for (i = uap->start; i < uap->start + uap->length; i++) {
>>>
>>>
>>> I don't like using u_int for a small index.
>>
>>
>> Why not?  Indices are by definition non-negative so the fit seems natural.
>
>
> Signed integers are easier to understand provided calculations with them
> don't overflow.

How?

The rest of the argument seems to be, using u_int is bad because more
unsigned is always bad.  But I haven't seen a good reason to believe
that is so.

> Unsigned integers are not easier to understand if
> calculations with them do overflow.  That was the case here.
>
> Only indices relative to the base of an array are by definition
> non-negative.  For an array a[], it is valid to do p = &a[i] and then
> use p[j] with negative j to get back before the i'th index.  This is
> sometimes useful.  i + j must be >= 0, but is hard write correctly and
> understand if either i or j is unsigned.  (It can be arranged that the
> addition wraps correctly, but this is basically re-implementing signed
> arithmetic.)

This has devolved from an array and index, to pointer arithmetic.  The
fact that C lets you do pointer arithmetic with array syntax doesn't
help.  The "real" indices are always non-negative.

Best,
Conrad
___
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: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-20 Thread Bruce Evans

On Fri, 20 May 2016, Conrad Meyer wrote:


On Fri, May 20, 2016 at 6:10 PM, Bruce Evans  wrote:

On Fri, 20 May 2016, Conrad Meyer wrote:


On Fri, May 20, 2016 at 4:02 PM, Bruce Evans  wrote:


On Fri, 20 May 2016, Konstantin Belousov wrote:


--- head/sys/i386/i386/sys_machdep.cFri May 20 19:46:25 2016
(r300331)
+++ head/sys/i386/i386/sys_machdep.cFri May 20 19:50:32 2016
(r300332)
@@ -315,8 +315,9 @@ i386_set_ioperm(td, uap)
struct thread *td;
struct i386_ioperm_args *uap;
{
-   int i, error;
char *iomap;
+   u_int i;
+   int error;

if ((error = priv_check(td, PRIV_IO)) != 0)
return (error);
@@ -334,7 +335,8 @@ i386_set_ioperm(td, uap)
return (error);
iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;

-   if (uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
+   if (uap->start > uap->start + uap->length ||
+   uap->start + uap->length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);

for (i = uap->start; i < uap->start + uap->length; i++) {



I don't like using u_int for a small index.



Why not?  Indices are by definition non-negative so the fit seems natural.


Signed integers are easier to understand provided calculations with them
don't overflow.


How?


For the same reasons as in applying mathematics.  Applying mathematics
was harder before negative numbers were invented.  Negative numbers
are actually not easy to understand at the technical level (the usual
representation of them is equivalence classes of pairs of non-negative
numbers), but their properties are easy to understand and work with
once you are familiar with them and don't think about their
implementation details too much.

Ordinary (real) numbers (including negative ones) also have good ordering
properties for all operations.

Computer arithmetic can't represent all ordinary numbers, but gets closest
by representing ordinary integers as C signed integers perfectly when no
overflow occurs.

By using C unsigned integers unnecessarily, you throw out invention of
negative numbers and might have to work with the unfamiliar and badly 
behaved ordering on them.  C programmers have some experience with this

ordering, but apparently not enough to usually avoid bugs.


The rest of the argument seems to be, using u_int is bad because more
unsigned is always bad.  But I haven't seen a good reason to believe
that is so.


Not always bad.  Sometimes you must use C unsigned integers to get a full
representation without wasting many bits, or actually want the ordering
of unsigned integers.  The main case is representing other C things like
pointers.  Differences of pointers are still hard to handle.

Bruce
___
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"