svn commit: r364004 - head/sbin/mount

2020-08-06 Thread Warner Losh
Author: imp
Date: Fri Aug  7 02:48:19 2020
New Revision: 364004
URL: https://svnweb.freebsd.org/changeset/base/364004

Log:
  All the other printf() calls cast to (void) here, do the two newer ones for
  consistency.

Modified:
  head/sbin/mount/mount.c

Modified: head/sbin/mount/mount.c
==
--- head/sbin/mount/mount.c Fri Aug  7 01:05:10 2020(r364003)
+++ head/sbin/mount/mount.c Fri Aug  7 02:48:19 2020(r364004)
@@ -697,9 +697,9 @@ prmount(struct statfs *sfp)
(uintmax_t)sfp->f_syncreads,
(uintmax_t)sfp->f_asyncreads);
if (sfp->f_fsid.val[0] != 0 || sfp->f_fsid.val[1] != 0) {
-   printf(", fsid ");
+   (void)printf(", fsid ");
for (i = 0; i < sizeof(sfp->f_fsid); i++)
-   printf("%02x", ((u_char *)>f_fsid)[i]);
+   (void)printf("%02x", ((u_char 
*)>f_fsid)[i]);
}
}
(void)printf(")\n");
___
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: r363997 - head/sys/net

2020-08-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Thu Aug  6 21:37:38 2020
New Revision: 363997
URL: https://svnweb.freebsd.org/changeset/base/363997

Log:
  iflib: netmap: drop redundant check
  
  The validity of head is already checked by nm_rxsync_prologue().
  
  MFC after:2 weeks

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cThu Aug  6 21:32:25 2020(r363996)
+++ head/sys/net/iflib.cThu Aug  6 21:37:38 2020(r363997)
@@ -1080,16 +1080,12 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl
uint32_t nic_i; /* index into the NIC ring */
u_int n;
u_int const lim = kring->nkr_num_slots - 1;
-   u_int const head = kring->rhead;
int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & 
NKR_PENDINTR;
 
if_ctx_t ctx = ifp->if_softc;
iflib_rxq_t rxq = >ifc_rxqs[kring->ring_id];
iflib_fl_t fl = >ifr_fl[0];
struct if_rxd_info ri;
-
-   if (head > lim)
-   return netmap_ring_reinit(kring);
 
/*
 * netmap only uses free list 0, to avoid out of order consumption
___
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: r363996 - head/sys/net

2020-08-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Thu Aug  6 21:32:25 2020
New Revision: 363996
URL: https://svnweb.freebsd.org/changeset/base/363996

Log:
  iflib: netmap: don't increment ifl_cidx on the wrong free list
  
  Netmap only uses free list 0 to keep it consistent with its
  one-to-one mapping between each netmap ring and a device RX
  (or TX) queue.
  However, the current iflib_netmap_rxsync() routine was
  mistakenly updating the ifl_cidx field of both free lists.
  
  PR:   248494
  MFC after:2 weeks

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cThu Aug  6 21:01:26 2020(r363995)
+++ head/sys/net/iflib.cThu Aug  6 21:32:25 2020(r363996)
@@ -1076,28 +1076,28 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl
struct netmap_adapter *na = kring->na;
struct netmap_ring *ring = kring->ring;
if_t ifp = na->ifp;
-   iflib_fl_t fl;
uint32_t nm_i;  /* index into the netmap ring */
uint32_t nic_i; /* index into the NIC ring */
-   u_int i, n;
+   u_int n;
u_int const lim = kring->nkr_num_slots - 1;
u_int const head = kring->rhead;
int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & 
NKR_PENDINTR;
-   struct if_rxd_info ri;
 
if_ctx_t ctx = ifp->if_softc;
iflib_rxq_t rxq = >ifc_rxqs[kring->ring_id];
+   iflib_fl_t fl = >ifr_fl[0];
+   struct if_rxd_info ri;
+
if (head > lim)
return netmap_ring_reinit(kring);
 
/*
-* XXX netmap_fl_refill() only ever (re)fills free list 0 so far.
+* netmap only uses free list 0, to avoid out of order consumption
+* of receive buffers
 */
 
-   for (i = 0, fl = rxq->ifr_fl; i < rxq->ifr_nfl; i++, fl++) {
-   bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map,
-   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-   }
+   bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map,
+   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
/*
 * First part: import newly received packets.
@@ -1119,38 +1119,35 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl
int crclen = iflib_crcstrip ? 0 : 4;
int error, avail;
 
-   for (i = 0; i < rxq->ifr_nfl; i++) {
-   fl = >ifr_fl[i];
-   nic_i = fl->ifl_cidx;
-   nm_i = netmap_idx_n2k(kring, nic_i);
-   avail = ctx->isc_rxd_available(ctx->ifc_softc,
-   rxq->ifr_id, nic_i, USHRT_MAX);
-   for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, 
avail--) {
-   rxd_info_zero();
-   ri.iri_frags = rxq->ifr_frags;
-   ri.iri_qsidx = kring->ring_id;
-   ri.iri_ifp = ctx->ifc_ifp;
-   ri.iri_cidx = nic_i;
+   nic_i = fl->ifl_cidx;
+   nm_i = netmap_idx_n2k(kring, nic_i);
+   avail = ctx->isc_rxd_available(ctx->ifc_softc,
+   rxq->ifr_id, nic_i, USHRT_MAX);
+   for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) {
+   rxd_info_zero();
+   ri.iri_frags = rxq->ifr_frags;
+   ri.iri_qsidx = kring->ring_id;
+   ri.iri_ifp = ctx->ifc_ifp;
+   ri.iri_cidx = nic_i;
 
-   error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, 
);
-   ring->slot[nm_i].len = error ? 0 : ri.iri_len - 
crclen;
-   ring->slot[nm_i].flags = 0;
-   bus_dmamap_sync(fl->ifl_buf_tag,
-   fl->ifl_sds.ifsd_map[nic_i], 
BUS_DMASYNC_POSTREAD);
-   nm_i = nm_next(nm_i, lim);
-   nic_i = nm_next(nic_i, lim);
+   error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, );
+   ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen;
+   ring->slot[nm_i].flags = 0;
+   bus_dmamap_sync(fl->ifl_buf_tag,
+   fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD);
+   nm_i = nm_next(nm_i, lim);
+   nic_i = nm_next(nic_i, lim);
+   }
+   if (n) { /* update the state variables */
+   if (netmap_no_pendintr && !force_update) {
+   /* diagnostics */
+   iflib_rx_miss ++;
+   iflib_rx_miss_bufs += n;
}
-   if (n) { /* update the state variables */
-

svn commit: r363995 - head/sys/dev/e1000

2020-08-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Thu Aug  6 21:01:26 2020
New Revision: 363995
URL: https://svnweb.freebsd.org/changeset/base/363995

Log:
  em(4): honor vlanhwtag offload
  
  The FreeBSD em driver fails to properly reset the VME flag
  in the e1000 CTRL register oneg the following ifconfig command
  
ifconfig em1 -vlanhwtag
  
  Tested on the e1000 device emulated by QEMU, and on a real
  NIC (chip=0x10d38086).
  
  PR:   236584
  Submitted by:  mu...@sunnyvalley.io
  Reported by:   mu...@sunnyvalley.io
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D25286

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Aug  6 20:55:18 2020(r363994)
+++ head/sys/dev/e1000/if_em.c  Thu Aug  6 21:01:26 2020(r363995)
@@ -1334,6 +1334,11 @@ em_if_init(if_ctx_t ctx)
ctrl |= E1000_CTRL_VME;
E1000_WRITE_REG(>hw, E1000_CTRL, ctrl);
}
+   } else {
+   u32 ctrl;
+   ctrl = E1000_READ_REG(>hw, E1000_CTRL);
+   ctrl &= ~E1000_CTRL_VME;
+   E1000_WRITE_REG(>hw, E1000_CTRL, ctrl);
}
 
/* Don't lose promiscuous settings */
___
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: r363992 - head/usr.sbin/pwd_mkdb

2020-08-06 Thread Alex Richardson
Author: arichardson
Date: Thu Aug  6 20:46:13 2020
New Revision: 363992
URL: https://svnweb.freebsd.org/changeset/base/363992

Log:
  Allow bootstrapping pwd_mkdb on Linux/macOS
  
  We need to provide a struct passwd that is compatible with the target
  system and this is not the case when cross-building from macOS/Linux.
  It should also be a problem when bootstrapping for an i386 target from a
  FreeBSD amd64 host since time_t does not match across those systems.
  However, pwd_mkdb always truncates integer values to 32-bit so this
  difference does not result in different databases.
  
  Reviewed By:  brooks
  Differential Revision: https://reviews.freebsd.org/D25931

Added:
  head/usr.sbin/pwd_mkdb/pwd.h   (contents, props changed)
Modified:
  head/usr.sbin/pwd_mkdb/Makefile

Modified: head/usr.sbin/pwd_mkdb/Makefile
==
--- head/usr.sbin/pwd_mkdb/Makefile Thu Aug  6 20:44:40 2020
(r363991)
+++ head/usr.sbin/pwd_mkdb/Makefile Thu Aug  6 20:46:13 2020
(r363992)
@@ -9,5 +9,8 @@ MAN=pwd_mkdb.8
 SRCS=  pw_scan.c pwd_mkdb.c
 
 CFLAGS+= -I${SRCTOP}/lib/libc/gen  # for pw_scan.h
+.if defined(BOOTSTRAPPING)
+CFLAGS+=-I${.CURDIR}
+.endif
 
 .include 

Added: head/usr.sbin/pwd_mkdb/pwd.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pwd_mkdb/pwd.hThu Aug  6 20:46:13 2020
(r363992)
@@ -0,0 +1,66 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright 2018-2020 Alex Richardson 
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * When building pwd_mkdb we need to use target systems definition of
+ * struct passwd. This protects against future changes to struct passwd and
+ * is essential to allow cross-building from Linux/macOS hosts since the
+ * structure is not compatible there.
+ */
+#include 
+#include 
+/*
+ * Note: pwd_mkdb always stores uint32_t for all integer fields (including
+ * time_t!) so these definitions do not need to match sys/sys/_types.h
+ */
+typedefuint32_t_bootstrap_gid_t;
+typedefuint32_t_bootstrap_uid_t;
+typedefuint64_t_bootstrap_time_t;
+#define_GID_T_DECLARED
+#define_TIME_T_DECLARED
+#define_UID_T_DECLARED
+#define_SIZE_T_DECLARED
+
+#definegid_t   _bootstrap_gid_t
+#defineuid_t   _bootstrap_uid_t
+#definetime_t  _bootstrap_time_t
+#definepasswd  _bootstrap_passwd
+#include "../../include/pwd.h"
+#undef gid_t
+#undef uid_t
+#undef time_t
___
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: r363993 - head/stand

2020-08-06 Thread Alex Richardson
Author: arichardson
Date: Thu Aug  6 20:46:18 2020
New Revision: 363993
URL: https://svnweb.freebsd.org/changeset/base/363993

Log:
  stand: use portable ln -n instead of ln -h
  
  This fixes the build on Linux
  
  Differential Revision: https://reviews.freebsd.org/D24783

Modified:
  head/stand/defs.mk

Modified: head/stand/defs.mk
==
--- head/stand/defs.mk  Thu Aug  6 20:46:13 2020(r363992)
+++ head/stand/defs.mk  Thu Aug  6 20:46:18 2020(r363993)
@@ -237,6 +237,6 @@ ${_ILINKS}: .NOMETA
esac ; \
path=`(cd $$path && /bin/pwd)` ; \
${ECHO} ${.TARGET} "->" $$path ; \
-   ln -fhs $$path ${.TARGET}
+   ln -fns $$path ${.TARGET}
 .endif # !NO_OBJ
 .endif # __BOOT_DEFS_MK__
___
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: r363991 - head/cddl/contrib/opensolaris/tools/ctf/cvt

2020-08-06 Thread Alex Richardson
Author: arichardson
Date: Thu Aug  6 20:44:40 2020
New Revision: 363991
URL: https://svnweb.freebsd.org/changeset/base/363991

Log:
  ctfmerge: Fix missing pthread_cond_init()
  
  This does not appear to matter on FreeBSD or Linux, but when building an
  amd64 kernel on macOS I was seeing infinite loops in ctfmerge.
  It turns out the loop in wip_save_work() was looping forever due to
  pthread_cond_wait() always returning -EINVAL.
  
  Reviewed By:  markj, brooks
  Differential Revision: https://reviews.freebsd.org/D25973

Modified:
  head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c

Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c
==
--- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c  Thu Aug  6 
20:44:18 2020(r363990)
+++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c  Thu Aug  6 
20:44:40 2020(r363991)
@@ -665,6 +665,7 @@ wq_init(workqueue_t *wq, int nfiles)
 
for (i = 0; i < nslots; i++) {
pthread_mutex_init(>wq_wip[i].wip_lock, NULL);
+   pthread_cond_init(>wq_wip[i].wip_cv, NULL);
wq->wq_wip[i].wip_batchid = wq->wq_next_batchid++;
}
 
___
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: r363988 - head/usr.sbin/yp_mkdb

2020-08-06 Thread Dimitry Andric
Author: dim
Date: Thu Aug  6 20:31:50 2020
New Revision: 363988
URL: https://svnweb.freebsd.org/changeset/base/363988

Log:
  Fix clang 11 -Wformat warnings in yp_mkdb:
  
  usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but 
the argument has type 'void *' [-Werror,-Wformat]
  printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
   ^~~~
  usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but 
the argument has type 'void *' [-Werror,-Wformat]
  data.data);
  ^
  
  MFC after:3 days

Modified:
  head/usr.sbin/yp_mkdb/yp_mkdb.c

Modified: head/usr.sbin/yp_mkdb/yp_mkdb.c
==
--- head/usr.sbin/yp_mkdb/yp_mkdb.c Thu Aug  6 19:34:55 2020
(r363987)
+++ head/usr.sbin/yp_mkdb/yp_mkdb.c Thu Aug  6 20:31:50 2020
(r363988)
@@ -88,8 +88,8 @@ unwind(char *map)
 
key.data = NULL;
while (yp_next_record(dbp, , , 1, 1) == YP_TRUE)
-   printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
-   data.data);
+   printf("%.*s %.*s\n", (int)key.size, (char *)key.data,
+   (int)data.size, (char *)data.data);
 
(void)(dbp->close)(dbp);
return;
___
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: r363979 - in head: sys/cam/ctl sys/cam/scsi usr.sbin/ctladm

2020-08-06 Thread Alexander Motin
Author: mav
Date: Thu Aug  6 19:16:11 2020
New Revision: 363979
URL: https://svnweb.freebsd.org/changeset/base/363979

Log:
  Add CTL support for REPORT IDENTIFYING INFORMATION command.
  
  It allows to report to initiator LU identifying information, preset via
  "ident_info" and "text_ident_info" options.
  
  Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
  since we have no persistent storage it requires, so the information is
  read-only for initiator and has to be set out-of-band.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_cmd_table.c
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/scsi/scsi_all.h
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Thu Aug  6 19:15:31 2020(r363978)
+++ head/sys/cam/ctl/ctl.c  Thu Aug  6 19:16:11 2020(r363979)
@@ -7130,6 +7130,88 @@ ctl_read_defect(struct ctl_scsiio *ctsio)
 }
 
 int
+ctl_report_ident_info(struct ctl_scsiio *ctsio)
+{
+   struct ctl_lun *lun = CTL_LUN(ctsio);
+   struct scsi_report_ident_info *cdb;
+   struct scsi_report_ident_info_data *rii_ptr;
+   struct scsi_report_ident_info_descr *riid_ptr;
+   const char *oii, *otii;
+   int retval, alloc_len, total_len = 0, len = 0;
+
+   CTL_DEBUG_PRINT(("ctl_report_ident_info\n"));
+
+   cdb = (struct scsi_report_ident_info *)ctsio->cdb;
+   retval = CTL_RETVAL_COMPLETE;
+
+   total_len = sizeof(struct scsi_report_ident_info_data);
+   switch (cdb->type) {
+   case RII_LUII:
+   oii = dnvlist_get_string(lun->be_lun->options,
+   "ident_info", NULL);
+   if (oii)
+   len = strlen(oii);  /* Approximately */
+   break;
+   case RII_LUTII:
+   otii = dnvlist_get_string(lun->be_lun->options,
+   "text_ident_info", NULL);
+   if (otii)
+   len = strlen(otii) + 1; /* NULL-terminated */
+   break;
+   case RII_IIS:
+   len = 2 * sizeof(struct scsi_report_ident_info_descr);
+   break;
+   default:
+   ctl_set_invalid_field(/*ctsio*/ ctsio,
+ /*sks_valid*/ 1,
+ /*command*/ 1,
+ /*field*/ 11,
+ /*bit_valid*/ 1,
+ /*bit*/ 2);
+   ctl_done((union ctl_io *)ctsio);
+   return(retval);
+   }
+   total_len += len;
+   alloc_len = scsi_4btoul(cdb->length);
+
+   ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO);
+   ctsio->kern_sg_entries = 0;
+   ctsio->kern_rel_offset = 0;
+   ctsio->kern_data_len = min(total_len, alloc_len);
+   ctsio->kern_total_len = ctsio->kern_data_len;
+
+   rii_ptr = (struct scsi_report_ident_info_data *)ctsio->kern_data_ptr;
+   switch (cdb->type) {
+   case RII_LUII:
+   if (oii) {
+   if (oii[0] == '0' && oii[1] == 'x')
+   len = hex2bin(oii, (uint8_t *)(rii_ptr + 1), 
len);
+   else
+   strncpy((uint8_t *)(rii_ptr + 1), oii, len);
+   }
+   break;
+   case RII_LUTII:
+   if (otii)
+   strlcpy((uint8_t *)(rii_ptr + 1), otii, len);
+   break;
+   case RII_IIS:
+   riid_ptr = (struct scsi_report_ident_info_descr *)(rii_ptr + 1);
+   riid_ptr->type = RII_LUII;
+   scsi_ulto2b(0x, riid_ptr->length);
+   riid_ptr++;
+   riid_ptr->type = RII_LUTII;
+   scsi_ulto2b(0x, riid_ptr->length);
+   }
+   scsi_ulto2b(len, rii_ptr->length);
+
+   ctl_set_success(ctsio);
+   ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
+   ctsio->be_move_done = ctl_config_move_done;
+   ctl_datamove((union ctl_io *)ctsio);
+   return(retval);
+}
+
+int
 ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio)
 {
struct ctl_softc *softc = CTL_SOFTC(ctsio);

Modified: head/sys/cam/ctl/ctl_cmd_table.c
==
--- head/sys/cam/ctl/ctl_cmd_table.cThu Aug  6 19:15:31 2020
(r363978)
+++ head/sys/cam/ctl/ctl_cmd_table.cThu Aug  6 19:16:11 2020
(r363979)
@@ -829,8 +829,15 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] =
 /* 04 */
 {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
 
-/* 05 */
-{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE},
+/* 05 REPORT IDENTIFYING INFORMATION */
+{ctl_report_ident_info, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH |
+   

svn commit: r363972 - head/lib/libc/powerpc64/gen

2020-08-06 Thread Brandon Bergren
Author: bdragon
Date: Thu Aug  6 17:49:19 2020
New Revision: 363972
URL: https://svnweb.freebsd.org/changeset/base/363972

Log:
  [POWERPC] Fix ppc64 makecontext() parameter overflow handling.
  
  On ELFv2, the overflow parameters in the stack frame are at a different offset
  from sp than ELFv1. Adjust code to use the correct offset in all cases.
  
  This had resulted in argv[8] and up being copied to the incorrect address
  in the new context's initial stack frame.
  
  This is not necessarily the only bug in this function, I need to do a full
  review still and ensure the rest of the math is sane for ELFv2 stack frames.
  
  Reported by:  pherde (Probably. My notes are a bit unclear.)
  Reviewed by:  jhibbits (in irc)
  Sponsored by: Tag1 Consulting, Inc.

Modified:
  head/lib/libc/powerpc64/gen/makecontext.c

Modified: head/lib/libc/powerpc64/gen/makecontext.c
==
--- head/lib/libc/powerpc64/gen/makecontext.c   Thu Aug  6 16:44:24 2020
(r363971)
+++ head/lib/libc/powerpc64/gen/makecontext.c   Thu Aug  6 17:49:19 2020
(r363972)
@@ -102,7 +102,11 @@ __makecontext(ucontext_t *ucp, void (*start)(void), in
uint64_t *argp;
 
/* Skip past frame pointer and saved LR */
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
argp = (uint64_t *)sp + 6;
+#else
+   argp = (uint64_t *)sp + 4;
+#endif
 
for (i = 0; i < stackargs; i++)
*argp++ = va_arg(ap, uint64_t);
___
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: r363966 - head/sys/vm

2020-08-06 Thread Brooks Davis
On Thu, Aug 06, 2020 at 04:20:21PM +, Brooks Davis wrote:
> Author: brooks
> Date: Thu Aug  6 16:20:20 2020
> New Revision: 363966
> URL: https://svnweb.freebsd.org/changeset/base/363966
> 
> Log:
>   Preserve ASLR vm_map flags across fork
>   
>   In the most common case (fork+execve) this doesn't matter, but further
>   attempts to apply entropy would fail in (e.g.) a pre-fork server.
>   
>   Reported by:Alfredo Mazzinghi
>   Reviewed by:kib, markj
>   Obtained from:  CheriBSD
>   MFC after:  3 days
>   Differential Revision:  https://reviews.freebsd.org/D25966

For the record, ASLR is off by default so there will not be a security
advisory on this issue.  If there are enough users who are concerned
about this we will consider an eratta notice for 12.1.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r363966 - head/sys/vm

2020-08-06 Thread Brooks Davis
Author: brooks
Date: Thu Aug  6 16:20:20 2020
New Revision: 363966
URL: https://svnweb.freebsd.org/changeset/base/363966

Log:
  Preserve ASLR vm_map flags across fork
  
  In the most common case (fork+execve) this doesn't matter, but further
  attempts to apply entropy would fail in (e.g.) a pre-fork server.
  
  Reported by:  Alfredo Mazzinghi
  Reviewed by:  kib, markj
  Obtained from:CheriBSD
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D25966

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cThu Aug  6 16:14:43 2020(r363965)
+++ head/sys/vm/vm_map.cThu Aug  6 16:20:20 2020(r363966)
@@ -4109,6 +4109,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c
}
 
new_map->anon_loc = old_map->anon_loc;
+   new_map->flags |= old_map->flags & (MAP_ASLR | MAP_ASLR_IGNSTART);
 
VM_MAP_ENTRY_FOREACH(old_entry, old_map) {
if ((old_entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 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: r363965 - head

2020-08-06 Thread Emmanuel Vadot
Author: manu
Date: Thu Aug  6 16:14:43 2020
New Revision: 363965
URL: https://svnweb.freebsd.org/changeset/base/363965

Log:
  pkgbase: Add the possibility to choose the output dir
  
  The output dir is set to ${REPODIR}/${PKG_ABI}/${PKG_VERSION} now.
  Add the possibility to specify the last componant and set it by default
  to ${PKG_VERSION} as before.
  This is useful for tests and also for building packages with the same
  PKG_VERSION provided to check differences.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Aug  6 16:13:54 2020(r363964)
+++ head/Makefile.inc1  Thu Aug  6 16:14:43 2020(r363965)
@@ -1789,6 +1789,7 @@ KSTAGEDIR?=   ${OBJTOP}/kernelstage
 REPODIR?=  ${OBJROOT}repo
 PKG_FORMAT?=   txz
 PKGSIGNKEY?=   # empty
+PKG_OUTPUT_DIR?=   ${PKG_VERSION}
 
 .ORDER:stage-packages create-packages
 .ORDER:create-packages create-world-packages
@@ -1883,7 +1884,7 @@ create-world-package-${pkgname}: .PHONY
create -f ${PKG_FORMAT} -M ${WSTAGEDIR}/${pkgname}.ucl \
-p ${WSTAGEDIR}/${pkgname}.plist \
-r ${WSTAGEDIR} \
-   -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION}
+   -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
 .endfor
 
 _default_flavor=   -default
@@ -1916,7 +1917,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul
-M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl 
\
-p 
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
-r ${KSTAGEDIR}/${DISTDIR} \
-   -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION}
+   -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
 . endfor
 .endif
 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
@@ -1949,7 +1950,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_
-M 
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
-p 
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
-r ${KSTAGEDIR}/kernel.${_kernel} \
-   -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION}
+   -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
 .   endfor
 .  endif
 . endfor
@@ -1965,7 +1966,7 @@ sign-packages:_pkgbootstrap .PHONY
${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname 
config ABI)/${PKG_VERSION} \
${PKGSIGNKEY} ; \
cd ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname 
config ABI); \
-   ln -s ${PKG_VERSION} latest
+   ln -s ${PKG_OUTPUT_DIR} latest
 
 #
 #
___
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: r363964 - head

2020-08-06 Thread Emmanuel Vadot
Author: manu
Date: Thu Aug  6 16:13:54 2020
New Revision: 363964
URL: https://svnweb.freebsd.org/changeset/base/363964

Log:
  pkgbase: Add a new variable PKG_TIMESTAMP
  
  libarchive uses the SOURCE_DATE_EPOCH env variable to set the date of file
  in an archive, this is useful for reproducibility.
  Add a variable name PKG_TIMESTAMP that take a epoch time and set 
SOURCE_DATE_EPOCH
  to this. By default it is the current time so no changes here.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Aug  6 16:12:13 2020(r363963)
+++ head/Makefile.inc1  Thu Aug  6 16:13:54 2020(r363964)
@@ -545,6 +545,13 @@ PKG_VERSION=   ${_REVISION}${EXTRA_REVISION}
 .endif
 .endif # !defined(PKG_VERSION)
 
+.if !defined(PKG_TIMESTAMP)
+TIMEEPOCHNOW=  %s
+SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime}
+.else
+SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP}
+.endif
+
 .if !defined(_MKSHOWCONFIG)
 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \
-m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE
@@ -1831,6 +1838,7 @@ create-packages-kernel:   _pkgbootstrap _repodir .PHONY
${MAKE} -f Makefile.inc1 \
DESTDIR=${KSTAGEDIR} \
PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \
+   SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
create-kernel-packages
 
 create-packages: .PHONY create-packages-world create-packages-kernel
@@ -1847,6 +1855,7 @@ create-world-packages:_pkgbootstrap .PHONY
done > ${WSTAGEDIR}/packages.mk
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 create-world-packages-jobs \
+   SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
.MAKE.JOB.PREFIX=
 
 .if make(create-world-packages-jobs)
___
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: r363962 - head/release/packages

2020-08-06 Thread Emmanuel Vadot
Author: manu
Date: Thu Aug  6 16:11:30 2020
New Revision: 363962
URL: https://svnweb.freebsd.org/changeset/base/363962

Log:
  pkgbase: Remove vcs revision from kernel and runtime comment
  
  This is not needed and we don't do that for other packages.

Modified:
  head/release/packages/kernel.ucl
  head/release/packages/runtime.ucl

Modified: head/release/packages/kernel.ucl
==
--- head/release/packages/kernel.uclThu Aug  6 15:46:39 2020
(r363961)
+++ head/release/packages/kernel.uclThu Aug  6 16:11:30 2020
(r363962)
@@ -5,7 +5,7 @@
 name = "FreeBSD-%PKGNAME%"
 origin = "base"
 version = "%VERSION%"
-comment = "%COMMENT% %VCS_REVISION%"
+comment = "%COMMENT%"
 categories = [ base ]
 maintainer = "r...@freebsd.org"
 www = "https://www.FreeBSD.org;

Modified: head/release/packages/runtime.ucl
==
--- head/release/packages/runtime.ucl   Thu Aug  6 15:46:39 2020
(r363961)
+++ head/release/packages/runtime.ucl   Thu Aug  6 16:11:30 2020
(r363962)
@@ -5,7 +5,7 @@
 name = "FreeBSD-%PKGNAME%"
 origin = "base"
 version = "%VERSION%"
-comment = "%COMMENT% %VCS_REVISION%"
+comment = "%COMMENT%"
 categories = [ base ]
 maintainer = "r...@freebsd.org"
 www = "https://www.FreeBSD.org;
___
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: r363960 - head/sys/kern

2020-08-06 Thread Mark Johnston
Author: markj
Date: Thu Aug  6 15:43:15 2020
New Revision: 363960
URL: https://svnweb.freebsd.org/changeset/base/363960

Log:
  Clean up reassignbuf() and buf_vlist_remove() a bit.
  
  - Convert panic() calls to INVARIANTS-only assertions.  The PCTRIE code
provides some of the same protection since it will panic upon an
attempt to remove a non-resident buffer.
  - Update the comment above reassignbuf() to reflect reality.
  
  Reviewed by:  cem, kib, mjg
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25965

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu Aug  6 15:42:59 2020(r363959)
+++ head/sys/kern/vfs_subr.cThu Aug  6 15:43:15 2020(r363960)
@@ -2256,13 +2256,17 @@ static void
 buf_vlist_remove(struct buf *bp)
 {
struct bufv *bv;
+   b_xflags_t flags;
 
+   flags = bp->b_xflags;
+
KASSERT(bp->b_bufobj != NULL, ("No b_bufobj %p", bp));
ASSERT_BO_WLOCKED(bp->b_bufobj);
-   KASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) !=
-   (BX_VNDIRTY|BX_VNCLEAN),
-   ("buf_vlist_remove: Buf %p is on two lists", bp));
-   if (bp->b_xflags & BX_VNDIRTY)
+   KASSERT((flags & (BX_VNDIRTY | BX_VNCLEAN)) != 0 &&
+   (flags & (BX_VNDIRTY | BX_VNCLEAN)) != (BX_VNDIRTY | BX_VNCLEAN),
+   ("%s: buffer %p has invalid queue state", __func__, bp));
+
+   if ((flags & BX_VNDIRTY) != 0)
bv = >b_bufobj->bo_dirty;
else
bv = >b_bufobj->bo_clean;
@@ -2391,10 +2395,7 @@ brelvp(struct buf *bp)
vp = bp->b_vp;  /* XXX */
bo = bp->b_bufobj;
BO_LOCK(bo);
-   if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN))
-   buf_vlist_remove(bp);
-   else
-   panic("brelvp: Buffer %p not on queue.", bp);
+   buf_vlist_remove(bp);
if ((bo->bo_flag & BO_ONWORKLST) && bo->bo_dirty.bv_cnt == 0) {
bo->bo_flag &= ~BO_ONWORKLST;
mtx_lock(_mtx);
@@ -2707,9 +2708,7 @@ syncer_resume(void)
 }
 
 /*
- * Reassign a buffer from one vnode to another.
- * Used to assign file specific control information
- * (indirect blocks) to the vnode to which they belong.
+ * Move the buffer between the clean and dirty lists of its vnode.
  */
 void
 reassignbuf(struct buf *bp)
@@ -2724,23 +2723,15 @@ reassignbuf(struct buf *bp)
vp = bp->b_vp;
bo = bp->b_bufobj;
 
+   KASSERT((bp->b_flags & B_PAGING) == 0,
+   ("%s: cannot reassign paging buffer %p", __func__, bp));
+
CTR3(KTR_BUF, "reassignbuf(%p) vp %p flags %X",
bp, bp->b_vp, bp->b_flags);
-   /*
-* B_PAGING flagged buffers cannot be reassigned because their vp
-* is not fully linked in.
-*/
-   if (bp->b_flags & B_PAGING)
-   panic("cannot reassign paging buffer");
 
-   /*
-* Delete from old vnode list, if on one.
-*/
BO_LOCK(bo);
-   if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN))
-   buf_vlist_remove(bp);
-   else
-   panic("reassignbuf: Buffer %p not on queue.", bp);
+   buf_vlist_remove(bp);
+
/*
 * If dirty, put on list of dirty buffers; otherwise insert onto list
 * of clean buffers.
___
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: r363959 - head/sys/kern

2020-08-06 Thread Mark Johnston
Author: markj
Date: Thu Aug  6 15:42:59 2020
New Revision: 363959
URL: https://svnweb.freebsd.org/changeset/base/363959

Log:
  Remove the vfs.reassignbufcalls counter and sysctl.
  
  As the 20-year old comment above it suggests, the counter is of dubious
  value.  Moreover, the (global) counter was not updated precisely and
  hurts scalability.
  
  Reviewed by:  cem, kib, mjg
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25965

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu Aug  6 15:25:11 2020(r363958)
+++ head/sys/kern/vfs_subr.cThu Aug  6 15:42:59 2020(r363959)
@@ -206,15 +206,6 @@ static counter_u64_t recycles_free_count;
 SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles_free, CTLFLAG_RD, 
_free_count,
 "Number of free vnodes recycled to meet vnode cache targets");
 
-/*
- * Various variables used for debugging the new implementation of
- * reassignbuf().
- * XXX these are probably of (very) limited utility now.
- */
-static int reassignbufcalls;
-SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW | CTLFLAG_STATS,
-, 0, "Number of calls to reassignbuf");
-
 static counter_u64_t deferred_inact;
 SYSCTL_COUNTER_U64(_vfs, OID_AUTO, deferred_inact, CTLFLAG_RD, _inact,
 "Number of times inactive processing was deferred");
@@ -2732,7 +2723,6 @@ reassignbuf(struct buf *bp)
 
vp = bp->b_vp;
bo = bp->b_bufobj;
-   ++reassignbufcalls;
 
CTR3(KTR_BUF, "reassignbuf(%p) vp %p flags %X",
bp, bp->b_vp, bp->b_flags);
___
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: r363955 - head/sys/dev/ahci

2020-08-06 Thread Alexander Motin
Author: mav
Date: Thu Aug  6 15:17:44 2020
New Revision: 363955
URL: https://svnweb.freebsd.org/changeset/base/363955

Log:
  Add Intel Apollo Lake AHCI ID.
  
  Submitted by: Dmitry Luhtionov 
  MFC after:1 week

Modified:
  head/sys/dev/ahci/ahci_pci.c

Modified: head/sys/dev/ahci/ahci_pci.c
==
--- head/sys/dev/ahci/ahci_pci.cThu Aug  6 14:16:07 2020
(r363954)
+++ head/sys/dev/ahci/ahci_pci.cThu Aug  6 15:17:44 2020
(r363955)
@@ -180,6 +180,7 @@ static const struct {
{0x1f3e8086, 0x00, "Intel Avoton (RAID)",   0},
{0x1f3f8086, 0x00, "Intel Avoton (RAID)",   0},
{0x23a38086, 0x00, "Intel Coleto Creek",0},
+   {0x5ae38086, 0x00, "Intel Apollo Lake", 0},
{0x8c028086, 0x00, "Intel Lynx Point",  0},
{0x8c038086, 0x00, "Intel Lynx Point",  0},
{0x8c048086, 0x00, "Intel Lynx Point (RAID)",   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: r363951 - in head/sys: conf dev/usb/misc modules/usb modules/usb/cp2112

2020-08-06 Thread Andriy Gapon
Author: avg
Date: Thu Aug  6 13:41:42 2020
New Revision: 363951
URL: https://svnweb.freebsd.org/changeset/base/363951

Log:
  cp2112: driver for the namesake GPIO and I2C master gadget
  
  Documentation:
  - CP2112 Datasheet
https://www.silabs.com/documents/public/data-sheets/cp2112-datasheet.pdf
  - AN495: CP2112 Interface Specification

https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
  - CP2112 Errata
https://www.silabs.com/documents/public/errata/cp2112-errata.pdf
  
  The logic is implemented as three sub-drivers.
  The parent driver claims the USB device and creates two child devices.
  One acts as a GPIO controller and the other is an I2C controller.
  
  Tested with CP2112 revision F02.
  Both features seem to work.
  HTU21 sensor was used as an I2C slave.
  
  Reviewed by:  adrian, hselasky
  MFC after:2 weeks
  Relnotes: maybe
  Differential Revision: https://reviews.freebsd.org/D25359

Added:
  head/sys/dev/usb/misc/cp2112.c   (contents, props changed)
  head/sys/modules/usb/cp2112/
  head/sys/modules/usb/cp2112/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/modules/usb/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Aug  6 13:25:04 2020(r363950)
+++ head/sys/conf/files Thu Aug  6 13:41:42 2020(r363951)
@@ -3331,6 +3331,7 @@ dev/usb/serial/usb_serial.c   optional ucom | u3g | 
uar
 #
 # USB misc drivers
 #
+dev/usb/misc/cp2112.c  optional cp2112
 dev/usb/misc/ufm.c optional ufm
 dev/usb/misc/udbp.coptional udbp
 dev/usb/misc/ugold.c   optional ugold

Added: head/sys/dev/usb/misc/cp2112.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/misc/cp2112.c  Thu Aug  6 13:41:42 2020
(r363951)
@@ -0,0 +1,1381 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) Andriy Gapon
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Hardware information links:
+ * - CP2112 Datasheet
+ *   https://www.silabs.com/documents/public/data-sheets/cp2112-datasheet.pdf
+ * - AN495: CP2112 Interface Specification
+ *   
https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
+ * - CP2112 Errata
+ *   https://www.silabs.com/documents/public/errata/cp2112-errata.pdf
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include "iicbus_if.h"
+
+#include 
+#include 
+#include 
+#include 
+#include "usbdevs.h"
+
+#defineUSB_DEBUG_VAR usb_debug
+#include 
+
+#defineCP2112GPIO_LOCK(sc) sx_xlock(>gpio_lock)
+#defineCP2112GPIO_UNLOCK(sc)   sx_xunlock(>gpio_lock)
+#defineCP2112GPIO_LOCKED(sc)   sx_assert(>gpio_lock, SX_XLOCKED)
+
+#defineCP2112_PART_NUM 0x0c
+#defineCP2112_GPIO_COUNT   8
+#defineCP2112_REPORT_SIZE  64
+
+#defineCP2112_REQ_RESET0x1
+#defineCP2112_REQ_GPIO_CFG 0x2
+#defineCP2112_REQ_GPIO_GET 0x3
+#defineCP2112_REQ_GPIO_SET 0x4
+#defineCP2112_REQ_VERSION  0x5
+#defineCP2112_REQ_SMB_CFG  0x6
+
+#defineCP2112_REQ_SMB_READ 0x10
+#defineCP2112_REQ_SMB_WRITE_READ   0x11
+#defineCP2112_REQ_SMB_READ_FORCE_SEND  0x12

svn commit: r363950 - in head/sys/dev: rtwn/usb usb

2020-08-06 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Aug  6 13:25:04 2020
New Revision: 363950
URL: https://svnweb.freebsd.org/changeset/base/363950

Log:
  Add new USB ID.
  
  Submitted by: Dmitry Luhtionov 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_attach.h
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h
==
--- head/sys/dev/rtwn/usb/rtwn_usb_attach.h Thu Aug  6 12:49:25 2020
(r363949)
+++ head/sys/dev/rtwn/usb/rtwn_usb_attach.h Thu Aug  6 13:25:04 2020
(r363950)
@@ -123,6 +123,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = {
RTWN_RTL8188EU_DEV(TPLINK,  WN727NV5),
RTWN_RTL8188EU_DEV(REALTEK, RTL8188ETV),
RTWN_RTL8188EU_DEV(REALTEK, RTL8188EU),
+   RTWN_RTL8188EU_DEV(MERCUSYS,MW150US),
 #undef RTWN_RTL8188EU_DEV
 
/* RTL8812AU */

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Aug  6 12:49:25 2020(r363949)
+++ head/sys/dev/usb/usbdevsThu Aug  6 13:25:04 2020(r363950)
@@ -782,6 +782,7 @@ vendor NHJ  0x2770  NHJ
 vendor THINGM  0x27b8  ThingM
 vendor PERASO  0x2932  Peraso Technologies, Inc.
 vendor PLANEX  0x2c02  Planex Communications
+vendor MERCUSYS0x2c4e  Mercusys, Inc.
 vendor QUECTEL 0x2c7c  Quectel Wireless Solutions
 vendor VIDZMEDIA   0x3275  VidzMedia Pte Ltd
 vendor LINKINSTRUMENTS 0x3195  Link Instruments Inc.
@@ -3191,6 +3192,9 @@ product MELCO WLIUCGNM2   0x01ee  WLI-UC-GNM2
 product MELCO WIU2433DM0x0242  WI-U2-433DM
 product MELCO WIU3866D 0x025d  WI-U3-866D
 product MELCO WIU2433DHP   0x029b  WI-U2-433DHP
+
+/* Mercusys, Inc. */
+product MERCUSYS MW150US   0x0102  Mercusys MW150US
 
 /* Merlin products */
 product MERLIN V620 0x1110  Merlin V620
___
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: r363949 - in head/sys: dev/iommu x86/iommu

2020-08-06 Thread Ruslan Bukin
Author: br
Date: Thu Aug  6 12:49:25 2020
New Revision: 363949
URL: https://svnweb.freebsd.org/changeset/base/363949

Log:
  Move dmar_domain_unload_task to busdma_iommu.c.
  
  Reviewed by:  kib
  Sponsored by: DARPA/AFRL
  Differential Revision:https://reviews.freebsd.org/D25972

Modified:
  head/sys/dev/iommu/busdma_iommu.c
  head/sys/x86/iommu/intel_ctx.c

Modified: head/sys/dev/iommu/busdma_iommu.c
==
--- head/sys/dev/iommu/busdma_iommu.c   Thu Aug  6 11:18:06 2020
(r363948)
+++ head/sys/dev/iommu/busdma_iommu.c   Thu Aug  6 12:49:25 2020
(r363949)
@@ -1064,6 +1064,26 @@ bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmama
return (error);
 }
 
+static void
+iommu_domain_unload_task(void *arg, int pending)
+{
+   struct iommu_domain *domain;
+   struct iommu_map_entries_tailq entries;
+
+   domain = arg;
+   TAILQ_INIT();
+
+   for (;;) {
+   IOMMU_DOMAIN_LOCK(domain);
+   TAILQ_SWAP(>unload_entries, ,
+   iommu_map_entry, dmamap_link);
+   IOMMU_DOMAIN_UNLOCK(domain);
+   if (TAILQ_EMPTY())
+   break;
+   iommu_domain_unload(domain, , true);
+   }
+}
+
 void
 iommu_domain_init(struct iommu_unit *unit, struct iommu_domain *domain,
 const struct iommu_domain_map_ops *ops)
@@ -1072,6 +1092,7 @@ iommu_domain_init(struct iommu_unit *unit, struct iomm
domain->ops = ops;
domain->iommu = unit;
 
+   TASK_INIT(>unload_task, 0, iommu_domain_unload_task, domain);
RB_INIT(>rb_root);
TAILQ_INIT(>unload_entries);
mtx_init(>lock, "iodom", NULL, MTX_DEF);

Modified: head/sys/x86/iommu/intel_ctx.c
==
--- head/sys/x86/iommu/intel_ctx.c  Thu Aug  6 11:18:06 2020
(r363948)
+++ head/sys/x86/iommu/intel_ctx.c  Thu Aug  6 12:49:25 2020
(r363949)
@@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_DMAR_CTX, "dmar_ctx", "Intel DMAR Context");
 static MALLOC_DEFINE(M_DMAR_DOMAIN, "dmar_dom", "Intel DMAR Domain");
 
-static void dmar_domain_unload_task(void *arg, int pending);
 static void dmar_unref_domain_locked(struct dmar_unit *dmar,
 struct dmar_domain *domain);
 static void dmar_domain_destroy(struct dmar_domain *domain);
@@ -334,8 +333,6 @@ dmar_domain_alloc(struct dmar_unit *dmar, bool id_mapp
unit = DMAR2IOMMU(dmar);
domain->domain = id;
LIST_INIT(>contexts);
-   TASK_INIT(>iodom.unload_task, 0, dmar_domain_unload_task,
-   domain);
iommu_domain_init(unit, iodom, _domain_map_ops);
 
domain->dmar = dmar;
@@ -875,26 +872,6 @@ dmar_domain_unload(struct dmar_domain *domain,
}
TAILQ_CONCAT(>tlb_flush_entries, entries, dmamap_link);
DMAR_UNLOCK(unit);
-}  
-
-static void
-dmar_domain_unload_task(void *arg, int pending)
-{
-   struct dmar_domain *domain;
-   struct iommu_map_entries_tailq entries;
-
-   domain = arg;
-   TAILQ_INIT();
-
-   for (;;) {
-   DMAR_DOMAIN_LOCK(domain);
-   TAILQ_SWAP(>iodom.unload_entries, ,
-   iommu_map_entry, dmamap_link);
-   DMAR_DOMAIN_UNLOCK(domain);
-   if (TAILQ_EMPTY())
-   break;
-   dmar_domain_unload(domain, , true);
-   }
 }
 
 struct iommu_ctx *
___
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: r363948 - head/sys/arm/allwinner/clkng

2020-08-06 Thread Andriy Gapon
Author: avg
Date: Thu Aug  6 11:18:06 2020
New Revision: 363948
URL: https://svnweb.freebsd.org/changeset/base/363948

Log:
  ccu_sun8i_r: minor comment update
  
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/clkng/ccu_sun8i_r.c

Modified: head/sys/arm/allwinner/clkng/ccu_sun8i_r.c
==
--- head/sys/arm/allwinner/clkng/ccu_sun8i_r.c  Thu Aug  6 10:12:39 2020
(r363947)
+++ head/sys/arm/allwinner/clkng/ccu_sun8i_r.c  Thu Aug  6 11:18:06 2020
(r363948)
@@ -119,7 +119,7 @@ NM_CLK(r_ccu_ir_clk,
 "ir", r_ccu_ir_parents,/* names, parents */
 0x54,  /* offset */
 0, 4, 0, 0,/* N factor */
-16, 2, 0, 0,   /* M flags */
+16, 2, 0, 0,   /* M factor */
 24, 2, /* mux */
 31,/* gate */
 AW_CLK_HAS_MUX | AW_CLK_REPARENT | AW_CLK_HAS_GATE);/* flags */
___
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: r363946 - in head/sys: dev/iommu x86/iommu

2020-08-06 Thread Ruslan Bukin
Author: br
Date: Thu Aug  6 08:48:23 2020
New Revision: 363946
URL: https://svnweb.freebsd.org/changeset/base/363946

Log:
  Add iommu_domain constructor and destructor.
  
  Reviewed by:  kib
  Sponsored by: DARPA/AFRL
  Differential Revision:https://reviews.freebsd.org/D25956

Modified:
  head/sys/dev/iommu/busdma_iommu.c
  head/sys/dev/iommu/iommu.h
  head/sys/x86/iommu/intel_ctx.c
  head/sys/x86/iommu/intel_dmar.h
  head/sys/x86/iommu/intel_idpgtbl.c

Modified: head/sys/dev/iommu/busdma_iommu.c
==
--- head/sys/dev/iommu/busdma_iommu.c   Thu Aug  6 08:21:33 2020
(r363945)
+++ head/sys/dev/iommu/busdma_iommu.c   Thu Aug  6 08:48:23 2020
(r363946)
@@ -1063,3 +1063,23 @@ bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmama
free(ma, M_TEMP);
return (error);
 }
+
+void
+iommu_domain_init(struct iommu_unit *unit, struct iommu_domain *domain,
+const struct iommu_domain_map_ops *ops)
+{
+
+   domain->ops = ops;
+   domain->iommu = unit;
+
+   RB_INIT(>rb_root);
+   TAILQ_INIT(>unload_entries);
+   mtx_init(>lock, "iodom", NULL, MTX_DEF);
+}
+
+void
+iommu_domain_fini(struct iommu_domain *domain)
+{
+
+   mtx_destroy(>lock);
+}

Modified: head/sys/dev/iommu/iommu.h
==
--- head/sys/dev/iommu/iommu.h  Thu Aug  6 08:21:33 2020(r363945)
+++ head/sys/dev/iommu/iommu.h  Thu Aug  6 08:48:23 2020(r363946)
@@ -223,6 +223,9 @@ int iommu_gas_reserve_region(struct iommu_domain *doma
 
 void iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno);
 bool iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno);
+void iommu_domain_init(struct iommu_unit *unit, struct iommu_domain *domain,
+const struct iommu_domain_map_ops *ops);
+void iommu_domain_fini(struct iommu_domain *domain);
 
 bool bus_dma_iommu_set_buswide(device_t dev);
 int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,

Modified: head/sys/x86/iommu/intel_ctx.c
==
--- head/sys/x86/iommu/intel_ctx.c  Thu Aug  6 08:21:33 2020
(r363945)
+++ head/sys/x86/iommu/intel_ctx.c  Thu Aug  6 08:48:23 2020
(r363946)
@@ -322,6 +322,7 @@ static struct dmar_domain *
 dmar_domain_alloc(struct dmar_unit *dmar, bool id_mapped)
 {
struct iommu_domain *iodom;
+   struct iommu_unit *unit;
struct dmar_domain *domain;
int error, id, mgaw;
 
@@ -330,16 +331,14 @@ dmar_domain_alloc(struct dmar_unit *dmar, bool id_mapp
return (NULL);
domain = malloc(sizeof(*domain), M_DMAR_DOMAIN, M_WAITOK | M_ZERO);
iodom = DOM2IODOM(domain);
+   unit = DMAR2IOMMU(dmar);
domain->domain = id;
LIST_INIT(>contexts);
-   RB_INIT(>iodom.rb_root);
-   TAILQ_INIT(>iodom.unload_entries);
TASK_INIT(>iodom.unload_task, 0, dmar_domain_unload_task,
domain);
-   mtx_init(>iodom.lock, "dmardom", NULL, MTX_DEF);
+   iommu_domain_init(unit, iodom, _domain_map_ops);
+
domain->dmar = dmar;
-   domain->iodom.iommu = >iommu;
-   domain_pgtbl_init(domain);
 
/*
 * For now, use the maximal usable physical address of the
@@ -430,8 +429,11 @@ dmar_ctx_unlink(struct dmar_ctx *ctx)
 static void
 dmar_domain_destroy(struct dmar_domain *domain)
 {
+   struct iommu_domain *iodom;
struct dmar_unit *dmar;
 
+   iodom = DOM2IODOM(domain);
+
KASSERT(TAILQ_EMPTY(>iodom.unload_entries),
("unfinished unloads %p", domain));
KASSERT(LIST_EMPTY(>contexts),
@@ -442,7 +444,7 @@ dmar_domain_destroy(struct dmar_domain *domain)
("destroying dom %p with refs %d", domain, domain->refs));
if ((domain->iodom.flags & IOMMU_DOMAIN_GAS_INITED) != 0) {
DMAR_DOMAIN_LOCK(domain);
-   iommu_gas_fini_domain(DOM2IODOM(domain));
+   iommu_gas_fini_domain(iodom);
DMAR_DOMAIN_UNLOCK(domain);
}
if ((domain->iodom.flags & IOMMU_DOMAIN_PGTBL_INITED) != 0) {
@@ -450,7 +452,7 @@ dmar_domain_destroy(struct dmar_domain *domain)
DMAR_DOMAIN_PGLOCK(domain);
domain_free_pgtbl(domain);
}
-   mtx_destroy(>iodom.lock);
+   iommu_domain_fini(iodom);
dmar = DOM2DMAR(domain);
free_unr(dmar->domids, domain->domain);
free(domain, M_DMAR_DOMAIN);

Modified: head/sys/x86/iommu/intel_dmar.h
==
--- head/sys/x86/iommu/intel_dmar.h Thu Aug  6 08:21:33 2020
(r363945)
+++ head/sys/x86/iommu/intel_dmar.h Thu Aug  6 08:48:23 2020
(r363946)
@@ -264,7 +264,7 @@ void domain_flush_iotlb_sync(struct dmar_domain *domai
 iommu_gaddr_t size);
 int domain_alloc_pgtbl(struct dmar_domain 

svn commit: r363945 - head/sys/cam/mmc

2020-08-06 Thread Emmanuel Vadot
Author: manu
Date: Thu Aug  6 08:21:33 2020
New Revision: 363945
URL: https://svnweb.freebsd.org/changeset/base/363945

Log:
  mmccam: Unhold the periph when we add the device
  
  Otherwise the device node aren't created.
  
  Pointy hat to: manu
  Reported by:  bz

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Thu Aug  6 08:06:07 2020(r363944)
+++ head/sys/cam/mmc/mmc_da.c   Thu Aug  6 08:21:33 2020(r363945)
@@ -1505,6 +1505,7 @@ finish_hs_tests:
 
softc->state = SDDA_STATE_NORMAL;
 
+   cam_periph_unhold(periph);
/* MMC partitions support */
if (mmcp->card_features & CARD_FEATURE_MMC && mmc_get_spec_vers(periph) 
>= 4) {
sdda_process_mmc_partitions(periph, start_ccb);
@@ -1516,6 +1517,7 @@ finish_hs_tests:
sdda_get_read_only(periph, start_ccb));
softc->part_curr = 0;
}
+   cam_periph_hold(periph, PRIBIO|PCATCH);
 
xpt_announce_periph(periph, softc->card_id_string);
/*
___
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"