svn commit: r361571 - head/sys/net

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 07:23:27 2020
New Revision: 361571
URL: https://svnweb.freebsd.org/changeset/base/361571

Log:
  Unlock rtentry before calling for epoch(9) destruction as the destruction
may happen immediately, leading to panic.
  
  Reported by:  bdragon

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cThu May 28 03:08:50 2020(r361570)
+++ head/sys/net/route.cThu May 28 07:23:27 2020(r361571)
@@ -411,9 +411,9 @@ rtfree(struct rtentry *rt)
 
RT_LOCK_ASSERT(rt);
 
+   RT_UNLOCK(rt);
epoch_call(net_epoch_preempt, destroy_rtentry_epoch,
>rt_epoch_ctx);
-   RT_UNLOCK(rt);
 }
 
 static void
___
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: r361577 - head/sys/dev/usb

2020-05-28 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 28 08:05:46 2020
New Revision: 361577
URL: https://svnweb.freebsd.org/changeset/base/361577

Log:
  Don't allow USB device drivers to parent own interface.
  It will prevent proper USB device detach.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Thu May 28 08:00:08 2020
(r361576)
+++ head/sys/dev/usb/usb_device.c   Thu May 28 08:05:46 2020
(r361577)
@@ -1402,7 +1402,7 @@ usbd_set_parent_iface(struct usb_device *udev, uint8_t
 {
struct usb_interface *iface;
 
-   if (udev == NULL) {
+   if (udev == NULL || iface_index == parent_index) {
/* nothing to do */
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: r361582 - head/sys/netgraph/bluetooth/drivers/ubt

2020-05-28 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 28 08:41:18 2020
New Revision: 361582
URL: https://svnweb.freebsd.org/changeset/base/361582

Log:
  Fix check for wMaxPacketSize in USB bluetooth driver,
  in case device is not FULL speed.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c

Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==
--- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cThu May 28 08:38:25 
2020(r361581)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.cThu May 28 08:41:18 
2020(r361582)
@@ -623,7 +623,7 @@ ubt_attach(device_t dev)
struct usb_endpoint_descriptor  *ed;
struct usb_interface_descriptor *id;
struct usb_interface*iface;
-   uint16_twMaxPacketSize;
+   uint32_twMaxPacketSize;
uint8_t alt_index, i, j;
uint8_t iface_index[2] = { 0, 1 };
 
@@ -713,9 +713,10 @@ ubt_attach(device_t dev)
if ((ed->bDescriptorType == UDESC_ENDPOINT) &&
(ed->bLength >= sizeof(*ed)) &&
(i == 1)) {
-   uint16_t temp;
+   uint32_t temp;
 
-   temp = UGETW(ed->wMaxPacketSize);
+   temp = usbd_get_max_frame_length(
+   ed, NULL, usbd_get_speed(uaa->device));
if (temp > wMaxPacketSize) {
wMaxPacketSize = temp;
alt_index = j;
___
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: r361574 - head/sys/netinet

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 07:31:53 2020
New Revision: 361574
URL: https://svnweb.freebsd.org/changeset/base/361574

Log:
  Switch ip_output/icmp_reflect rt lookup calls with fib4_lookup.
  
  fib4_lookup_nh_ represents pre-epoch generation of fib api,
  providing less guarantees over pointer validness and requiring
  on-stack data copying.
  
  Conversion is straight-forwarded, as the only 2 differences are
  requirement of running in network epoch and the need to handle
  RTF_GATEWAY case in the caller code.
  
  Reviewed by:  ae
  Differential Revision:https://reviews.freebsd.org/D24976

Modified:
  head/sys/netinet/ip_icmp.c
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_icmp.c
==
--- head/sys/netinet/ip_icmp.c  Thu May 28 07:29:44 2020(r361573)
+++ head/sys/netinet/ip_icmp.c  Thu May 28 07:31:53 2020(r361574)
@@ -764,7 +764,7 @@ icmp_reflect(struct mbuf *m)
struct ifnet *ifp;
struct in_ifaddr *ia;
struct in_addr t;
-   struct nhop4_extended nh_ext;
+   struct nhop_object *nh;
struct mbuf *opts = NULL;
int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
 
@@ -851,12 +851,13 @@ icmp_reflect(struct mbuf *m)
 * When we don't have a route back to the packet source, stop here
 * and drop the packet.
 */
-   if (fib4_lookup_nh_ext(M_GETFIB(m), ip->ip_dst, 0, 0, _ext) != 0) {
+   nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_NONE, 0);
+   if (nh == NULL) {
m_freem(m);
ICMPSTAT_INC(icps_noroute);
goto done;
}
-   t = nh_ext.nh_src;
+   t = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr;
 match:
 #ifdef MAC
mac_netinet_icmp_replyinplace(m);

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cThu May 28 07:29:44 2020
(r361573)
+++ head/sys/netinet/ip_output.cThu May 28 07:31:53 2020
(r361574)
@@ -512,11 +512,10 @@ again:
mtu = ifp->if_mtu;
src = IA_SIN(ia)->sin_addr;
} else {
-   struct nhop4_extended nh;
+   struct nhop_object *nh;
 
-   bzero(, sizeof(nh));
-   if (fib4_lookup_nh_ext(M_GETFIB(m), ip->ip_dst, 0, 0, ) !=
-   0) {
+   nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_NONE, 0);
+   if (nh == NULL) {
 #if defined(IPSEC) || defined(IPSEC_SUPPORT)
/*
 * There is no route for this packet, but it is
@@ -530,8 +529,8 @@ again:
error = EHOSTUNREACH;
goto bad;
}
-   ifp = nh.nh_ifp;
-   mtu = nh.nh_mtu;
+   ifp = nh->nh_ifp;
+   mtu = nh->nh_mtu;
/*
 * We are rewriting here dst to be gw actually, contradicting
 * comment at the beginning of the function. However, in this
@@ -540,10 +539,11 @@ again:
 * function, the dst would be rewritten by ip_output_pfil().
 */
MPASS(dst == );
-   dst->sin_addr = nh.nh_addr;
-   ia = nh.nh_ia;
-   src = nh.nh_src;
-   isbroadcast = (((nh.nh_flags & (NHF_HOST | NHF_BROADCAST)) ==
+   if (nh->nh_flags & NHF_GATEWAY)
+   dst->sin_addr = nh->gw4_sa.sin_addr;
+   ia = ifatoia(nh->nh_ifa);
+   src = IA_SIN(ia)->sin_addr;
+   isbroadcast = (((nh->nh_flags & (NHF_HOST | NHF_BROADCAST)) ==
(NHF_HOST | NHF_BROADCAST)) ||
((ifp->if_flags & IFF_BROADCAST) &&
in_ifaddr_broadcast(dst->sin_addr, ia)));
___
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: r361576 - in head/sys: netinet netinet6

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 08:00:08 2020
New Revision: 361576
URL: https://svnweb.freebsd.org/changeset/base/361576

Log:
  Use fib[46]_lookup() in mtu calculations.
  
  fib[46]_lookup_nh_ represents pre-epoch generation of fib api,
  providing less guarantees over pointer validness and requiring
  on-stack data copying.
  
  Conversion is straight-forwarded, as the only 2 differences are
  requirement of running in network epoch and the need to handle
  RTF_GATEWAY case in the caller code.
  
  Differential Revision:https://reviews.freebsd.org/D24974

Modified:
  head/sys/netinet/tcp_subr.c
  head/sys/netinet6/icmp6.c

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Thu May 28 07:35:07 2020(r361575)
+++ head/sys/netinet/tcp_subr.c Thu May 28 08:00:08 2020(r361576)
@@ -2920,7 +2920,7 @@ tcp_mtudisc(struct inpcb *inp, int mtuoffer)
 uint32_t
 tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *cap)
 {
-   struct nhop4_extended nh4;
+   struct nhop_object *nh;
struct ifnet *ifp;
uint32_t maxmtu = 0;
 
@@ -2928,12 +2928,12 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *
 
if (inc->inc_faddr.s_addr != INADDR_ANY) {
 
-   if (fib4_lookup_nh_ext(inc->inc_fibnum, inc->inc_faddr,
-   NHR_REF, 0, ) != 0)
+   nh = fib4_lookup(inc->inc_fibnum, inc->inc_faddr, 0, NHR_NONE, 
0);
+   if (nh == NULL)
return (0);
 
-   ifp = nh4.nh_ifp;
-   maxmtu = nh4.nh_mtu;
+   ifp = nh->nh_ifp;
+   maxmtu = nh->nh_mtu;
 
/* Report additional interface capabilities. */
if (cap != NULL) {
@@ -2945,7 +2945,6 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *
cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize;
}
}
-   fib4_free_nh_ext(inc->inc_fibnum, );
}
return (maxmtu);
 }
@@ -2955,7 +2954,7 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *
 uint32_t
 tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap)
 {
-   struct nhop6_extended nh6;
+   struct nhop_object *nh;
struct in6_addr dst6;
uint32_t scopeid;
struct ifnet *ifp;
@@ -2968,12 +2967,12 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap 
 
if (!IN6_IS_ADDR_UNSPECIFIED(>inc6_faddr)) {
in6_splitscope(>inc6_faddr, , );
-   if (fib6_lookup_nh_ext(inc->inc_fibnum, , scopeid, 0,
-   0, ) != 0)
+   nh = fib6_lookup(inc->inc_fibnum, , scopeid, NHR_NONE, 0);
+   if (nh == NULL)
return (0);
 
-   ifp = nh6.nh_ifp;
-   maxmtu = nh6.nh_mtu;
+   ifp = nh->nh_ifp;
+   maxmtu = nh->nh_mtu;
 
/* Report additional interface capabilities. */
if (cap != NULL) {
@@ -2985,7 +2984,6 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap 
cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize;
}
}
-   fib6_free_nh_ext(inc->inc_fibnum, );
}
 
return (maxmtu);

Modified: head/sys/netinet6/icmp6.c
==
--- head/sys/netinet6/icmp6.c   Thu May 28 07:35:07 2020(r361575)
+++ head/sys/netinet6/icmp6.c   Thu May 28 08:00:08 2020(r361576)
@@ -402,6 +402,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
int code, error, icmp6len, ip6len, noff, off, sum;
 
+   NET_EPOCH_ASSERT();
+
m = *mp;
off = *offp;
 
___
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: r361580 - head/sys/dev/xen/control

2020-05-28 Thread Roger Pau Monné
Author: royger
Date: Thu May 28 08:20:16 2020
New Revision: 361580
URL: https://svnweb.freebsd.org/changeset/base/361580

Log:
  xen/control: short circuit xctrl_on_watch_event on spurious event
  
  If there's no data to read from xenstore short-circuit
  xctrl_on_watch_event to return early, there's no reason to continue
  since the lack of data would prevent matching against any known event
  type.
  
  Sponsored by: Citrix Systems R
  MFC with: r352925
  MFC after:1 week

Modified:
  head/sys/dev/xen/control/control.c

Modified: head/sys/dev/xen/control/control.c
==
--- head/sys/dev/xen/control/control.c  Thu May 28 08:19:13 2020
(r361579)
+++ head/sys/dev/xen/control/control.c  Thu May 28 08:20:16 2020
(r361580)
@@ -360,7 +360,7 @@ xctrl_on_watch_event(struct xs_watch *watch, const cha

error = xs_read(XST_NIL, "control", "shutdown",
_len, (void **));
-   if (error != 0)
+   if (error != 0 || result_len == 0)
return;
 
/* Acknowledge the request by writing back an empty 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"


svn commit: r361584 - head/sys/fs/nfsclient

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 09:52:28 2020
New Revision: 361584
URL: https://svnweb.freebsd.org/changeset/base/361584

Log:
  Fix NOINET6 build broken by r361575.
  
  Reported by:  ci, hps

Modified:
  head/sys/fs/nfsclient/nfs_clport.c

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Thu May 28 09:13:20 2020
(r361583)
+++ head/sys/fs/nfsclient/nfs_clport.c  Thu May 28 09:52:28 2020
(r361584)
@@ -971,7 +971,7 @@ u_int8_t *
 nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p)
 {
 #if defined(INET6) || defined(INET)
-   int error, fibnum;
+   int fibnum;
 
fibnum = curthread->td_proc->p_fibnum;
 #endif
@@ -1007,6 +1007,7 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *p
 #ifdef INET6
if (nmp->nm_nam->sa_family == AF_INET6) {
struct sockaddr_in6 *sin6;
+   int error;
 
sin6 = (struct sockaddr_in6 *)nmp->nm_nam;
 
___
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: r361573 - head/sys/netinet6

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 07:29:44 2020
New Revision: 361573
URL: https://svnweb.freebsd.org/changeset/base/361573

Log:
  Replace ip6_ouput fib6_lookup_nh_ calls with fib6_lookup().
  
  fib6_lookup_nh_ represents pre-epoch generation of fib api,
  providing less guarantees over pointer validness and requiring
  on-stack data copying.
  
  Conversion is straight-forwarded, as the only 2 differences are
  requirement of running in network epoch and the need to handle
  RTF_GATEWAY case in the caller code.
  
  Reviewed by:  ae
  Differential Revision:https://reviews.freebsd.org/D24973

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Thu May 28 07:26:18 2020
(r361572)
+++ head/sys/netinet6/ip6_output.c  Thu May 28 07:29:44 2020
(r361573)
@@ -736,7 +736,7 @@ again:
counter_u64_add(nh->nh_pksent, 1);
}
} else {
-   struct nhop6_extended nh6;
+   struct nhop_object *nh;
struct in6_addr kdst;
uint32_t scopeid;
 
@@ -766,20 +766,19 @@ again:
}
}
 
-   error = fib6_lookup_nh_ext(fibnum, , scopeid, NHR_REF, 0,
-   );
-   if (error != 0) {
+   nh = fib6_lookup(fibnum, , scopeid, NHR_NONE, 0);
+   if (nh == NULL) {
IP6STAT_INC(ip6s_noroute);
/* No ifp in6_ifstat_inc(ifp, ifs6_out_discard); */
error = EHOSTUNREACH;;
goto bad;
}
 
-   ifp = nh6.nh_ifp;
-   mtu = nh6.nh_mtu;
-   dst->sin6_addr = nh6.nh_addr;
-   ia = nh6.nh_ia;
-   fib6_free_nh_ext(fibnum, );
+   ifp = nh->nh_ifp;
+   mtu = nh->nh_mtu;
+   ia = ifatoia6(nh->nh_ifa);
+   if (nh->nh_flags & NHF_GATEWAY)
+   dst->sin6_addr = nh->gw6_sa.sin6_addr;
 nonh6lookup:
;
}
@@ -1449,23 +1448,22 @@ ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int
 static int
 ip6_getpmtu_ctl(u_int fibnum, const struct in6_addr *dst, u_long *mtup)
 {
-   struct nhop6_extended nh6;
+   struct epoch_tracker et;
+   struct nhop_object *nh;
struct in6_addr kdst;
uint32_t scopeid;
-   struct ifnet *ifp;
-   u_long mtu;
int error;
 
in6_splitscope(dst, , );
-   if (fib6_lookup_nh_ext(fibnum, , scopeid, NHR_REF, 0, ) != 0)
-   return (EHOSTUNREACH);
 
-   ifp = nh6.nh_ifp;
-   mtu = nh6.nh_mtu;
+   NET_EPOCH_ENTER(et);
+   nh = fib6_lookup(fibnum, , scopeid, NHR_NONE, 0);
+   if (nh != NULL)
+   error = ip6_calcmtu(nh->nh_ifp, dst, nh->nh_mtu, mtup, NULL, 0);
+   else
+   error = EHOSTUNREACH;
+   NET_EPOCH_EXIT(et);
 
-   error = ip6_calcmtu(ifp, dst, mtu, mtup, NULL, 0);
-   fib6_free_nh_ext(fibnum, );
-
return (error);
 }
 
@@ -1484,12 +1482,14 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, int do_lookup,
 struct ifnet *ifp, const struct in6_addr *dst, u_long *mtup,
 int *alwaysfragp, u_int fibnum, u_int proto)
 {
-   struct nhop6_basic nh6;
+   struct nhop_object *nh;
struct in6_addr kdst;
uint32_t scopeid;
struct sockaddr_in6 *sa6_dst, sin6;
u_long mtu;
 
+   NET_EPOCH_ASSERT();
+
mtu = 0;
if (ro_pmtu == NULL || do_lookup) {
 
@@ -1512,9 +1512,9 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, int do_lookup,
sa6_dst->sin6_addr = *dst;
 
in6_splitscope(dst, , );
-   if (fib6_lookup_nh_basic(fibnum, , scopeid, 0, 0,
-   ) == 0) {
-   mtu = nh6.nh_mtu;
+   nh = fib6_lookup(fibnum, , scopeid, NHR_NONE, 0);
+   if (nh != NULL) {
+   mtu = nh->nh_mtu;
if (ro_pmtu != NULL)
ro_pmtu->ro_mtu = mtu;
}
___
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: r361581 - head/sys/dev/usb

2020-05-28 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 28 08:38:25 2020
New Revision: 361581
URL: https://svnweb.freebsd.org/changeset/base/361581

Log:
  Implement helper function, usbd_get_max_frame_length(), which allows kernel
  device drivers to correctly predict the default USB transfer frame length.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usbdi.h

Modified: head/sys/dev/usb/usb_transfer.c
==
--- head/sys/dev/usb/usb_transfer.c Thu May 28 08:20:16 2020
(r361580)
+++ head/sys/dev/usb/usb_transfer.c Thu May 28 08:38:25 2020
(r361581)
@@ -374,6 +374,81 @@ usbd_transfer_setup_sub_malloc(struct usb_setup_params
 #endif
 
 /**
+ * usbd_get_max_frame_length
+ *
+ * This function returns the maximum single frame length as computed by
+ * usbd_transfer_setup(). It is useful when computing buffer sizes for
+ * devices having multiple alternate settings. The SuperSpeed endpoint
+ * companion pointer is allowed to be NULL.
+ **/
+uint32_t
+usbd_get_max_frame_length(const struct usb_endpoint_descriptor *edesc,
+const struct usb_endpoint_ss_comp_descriptor *ecomp,
+enum usb_dev_speed speed)
+{
+   uint32_t max_packet_size;
+   uint32_t max_packet_count;
+   uint8_t type;
+
+   max_packet_size = UGETW(edesc->wMaxPacketSize);
+   max_packet_count = 1;
+   type = (edesc->bmAttributes & UE_XFERTYPE);
+
+   switch (speed) {
+   case USB_SPEED_HIGH:
+   switch (type) {
+   case UE_ISOCHRONOUS:
+   case UE_INTERRUPT:
+   max_packet_count +=
+   (max_packet_size >> 11) & 3;
+
+   /* check for invalid max packet count */
+   if (max_packet_count > 3)
+   max_packet_count = 3;
+   break;
+   default:
+   break;
+   }
+   max_packet_size &= 0x7FF;
+   break;
+   case USB_SPEED_SUPER:
+   max_packet_count += (max_packet_size >> 11) & 3;
+
+   if (ecomp != NULL)
+   max_packet_count += ecomp->bMaxBurst;
+
+   if ((max_packet_count == 0) || 
+   (max_packet_count > 16))
+   max_packet_count = 16;
+
+   switch (type) {
+   case UE_CONTROL:
+   max_packet_count = 1;
+   break;
+   case UE_ISOCHRONOUS:
+   if (ecomp != NULL) {
+   uint8_t mult;
+
+   mult = UE_GET_SS_ISO_MULT(
+   ecomp->bmAttributes) + 1;
+   if (mult > 3)
+   mult = 3;
+
+   max_packet_count *= mult;
+   }
+   break;
+   default:
+   break;
+   }
+   max_packet_size &= 0x7FF;
+   break;
+   default:
+   break;
+   }
+   return (max_packet_size * max_packet_count);
+}
+
+/**
  * usbd_transfer_setup_sub - transfer setup subroutine
  *
  * This function must be called from the "xfer_setup" callback of the

Modified: head/sys/dev/usb/usbdi.h
==
--- head/sys/dev/usb/usbdi.hThu May 28 08:20:16 2020(r361580)
+++ head/sys/dev/usb/usbdi.hThu May 28 08:38:25 2020(r361581)
@@ -605,6 +605,9 @@ uint8_t usbd_get_interface_altindex(struct usb_interfa
 usb_error_t usbd_set_alt_interface_index(struct usb_device *udev,
uint8_t iface_index, uint8_t alt_index);
 uint32_t usbd_get_isoc_fps(struct usb_device *udev);
+uint32_t usbd_get_max_frame_length(const struct usb_endpoint_descriptor *,
+const struct usb_endpoint_ss_comp_descriptor *,
+enum usb_dev_speed);
 usb_error_t usbd_transfer_setup(struct usb_device *udev,
const uint8_t *ifaces, struct usb_xfer **pxfer,
const struct usb_config *setup_start, uint16_t n_setup,
___
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: r361583 - head/sys/crypto/aesni

2020-05-28 Thread Marcin Wojtas
Author: mw
Date: Thu May 28 09:13:20 2020
New Revision: 361583
URL: https://svnweb.freebsd.org/changeset/base/361583

Log:
  Change return types of hash update functions in SHA-NI
  
  r359374 introduced crypto_apply function which takes as argument a function 
pointer
  that is expected to return an int, however aesni hash update functions
  return void.
  Because of that the function pointer passed was simply cast with
  its return value changed.
  This resulted in undefined behavior, in particular when mbuf is used, (ipsec)
  m_apply checks return value of function pointer passed to it
  and in our case bogusly fails after calculating hash of the first mbuf
  in chain.
  Fix it by changing signatures of sha update routines in aesni and
  dropping the casts.
  
  Submitted by: Kornel Duleba
  Reviewed by: jhb, cem
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Differential Revision: https://reviews.freebsd.org/D25030

Modified:
  head/sys/crypto/aesni/aesni.c
  head/sys/crypto/aesni/aesni.h

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Thu May 28 08:41:18 2020
(r361582)
+++ head/sys/crypto/aesni/aesni.c   Thu May 28 09:13:20 2020
(r361583)
@@ -386,8 +386,8 @@ DRIVER_MODULE(aesni, nexus, aesni_driver, aesni_devcla
 MODULE_VERSION(aesni, 1);
 MODULE_DEPEND(aesni, crypto, 1, 1, 1);
 
-static void
-intel_sha1_update(void *vctx, const void *vdata, u_int datalen)
+static int
+intel_sha1_update(void *vctx, void *vdata, u_int datalen)
 {
struct sha1_ctxt *ctx = vctx;
const char *data = vdata;
@@ -419,6 +419,8 @@ intel_sha1_update(void *vctx, const void *vdata, u_int
intel_sha1_step(ctx->h.b32, (void *)ctx->m.b8, 1);
off += copysiz;
}
+
+   return (0);
 }
 
 static void
@@ -433,8 +435,8 @@ SHA1_Finalize_fn(void *digest, void *ctx)
sha1_result(ctx, digest);
 }
 
-static void
-intel_sha256_update(void *vctx, const void *vdata, u_int len)
+static int
+intel_sha256_update(void *vctx, void *vdata, u_int len)
 {
SHA256_CTX *ctx = vctx;
uint64_t bitlen;
@@ -454,7 +456,7 @@ intel_sha256_update(void *vctx, const void *vdata, u_i
/* Handle the case where we don't need to perform any transforms */
if (len < 64 - r) {
memcpy(>buf[r], src, len);
-   return;
+   return (0);
}
 
/* Finish the current block */
@@ -473,6 +475,8 @@ intel_sha256_update(void *vctx, const void *vdata, u_i
 
/* Copy left over data into buffer */
memcpy(ctx->buf, src, len);
+
+   return (0);
 }
 
 static void
@@ -844,20 +848,16 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
ses->hash_update(, hmac_key, sizeof(hmac_key));
 
crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length,
-   __DECONST(int (*)(void *, void *, u_int), ses->hash_update),
-   );
+   ses->hash_update, );
if (CRYPTO_HAS_OUTPUT_BUFFER(crp) &&
CRYPTO_OP_IS_ENCRYPT(crp->crp_op))
crypto_apply_buf(>crp_obuf,
crp->crp_payload_output_start,
crp->crp_payload_length,
-   __DECONST(int (*)(void *, void *, u_int),
-   ses->hash_update), );
+   ses->hash_update, );
else
crypto_apply(crp, crp->crp_payload_start,
-   crp->crp_payload_length,
-   __DECONST(int (*)(void *, void *, u_int),
-   ses->hash_update), );
+   crp->crp_payload_length, ses->hash_update, );
ses->hash_finalize(res, );
 
/* Outer hash: (K ^ OPAD) || inner hash */
@@ -873,20 +873,17 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
ses->hash_init();
 
crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length,
-   __DECONST(int (*)(void *, void *, u_int), ses->hash_update),
-   );
+   ses->hash_update, );
if (CRYPTO_HAS_OUTPUT_BUFFER(crp) &&
CRYPTO_OP_IS_ENCRYPT(crp->crp_op))
crypto_apply_buf(>crp_obuf,
crp->crp_payload_output_start,
crp->crp_payload_length,
-   __DECONST(int (*)(void *, void *, u_int),
-   ses->hash_update), );
+   ses->hash_update, );
else
crypto_apply(crp, crp->crp_payload_start,
crp->crp_payload_length,
-   __DECONST(int (*)(void *, void *, u_int),
-   

Re: svn commit: r361575 - head/sys/fs/nfsclient

2020-05-28 Thread Hans Petter Selasky

On 2020-05-28 09:35, Alexander V. Chernikov wrote:

Author: melifaro
Date: Thu May 28 07:35:07 2020
New Revision: 361575
URL: https://svnweb.freebsd.org/changeset/base/361575

Log:
   Make NFS address selection use fib4_lookup().
   
   fib4_lookup_nh_ represents pre-epoch generation of fib api,

   providing less guarantees over pointer validness and requiring
   on-stack data copying.
   Switch call to use new fib4_lookup(), allowing to eventually
   deprecate old api.
   
   Differential Revision:	https://reviews.freebsd.org/D24977


Modified:
   head/sys/fs/nfsclient/nfs_clport.c



FYI:

--- nfs_clport.o ---
/usr/src/sys/fs/nfsclient/nfs_clport.c:974:6: error: unused variable 
'error' [-Werror,-Wunused-variable]

int error, fibnum;
^
1 error generated.
*** [nfs_clport.o] Error code 1

--HPS

___
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: r361572 - in head/sys: netinet netinet6

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 07:26:18 2020
New Revision: 361572
URL: https://svnweb.freebsd.org/changeset/base/361572

Log:
  Switch gif(4) path verification to fib[46]_check_urfp().
  
  fibX_lookup_nh_ represents pre-epoch generation of fib api,
  providing less guarantees over pointer validness and requiring
  on-stack data copying.
  Use specialized fib[46]_check_urpf() from newer KPI instead,
  to allow removal of older KPI.
  
  Reviewed by:  ae
  Differential Revision:https://reviews.freebsd.org/D24978

Modified:
  head/sys/netinet/in_gif.c
  head/sys/netinet6/in6_gif.c

Modified: head/sys/netinet/in_gif.c
==
--- head/sys/netinet/in_gif.c   Thu May 28 07:23:27 2020(r361571)
+++ head/sys/netinet/in_gif.c   Thu May 28 07:26:18 2020(r361572)
@@ -379,13 +379,8 @@ done:
return (0);
/* ingress filters on outer source */
if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0) {
-   struct nhop4_basic nh4;
-   struct in_addr dst;
-
-   dst = ip->ip_src;
-   if (fib4_lookup_nh_basic(sc->gif_fibnum, dst, 0, 0, ) != 0)
-   return (0);
-   if (nh4.nh_ifp != m->m_pkthdr.rcvif)
+   if (fib4_check_urpf(sc->gif_fibnum, ip->ip_src, 0, NHR_NONE,
+   m->m_pkthdr.rcvif) == 0)
return (0);
}
*arg = sc;

Modified: head/sys/netinet6/in6_gif.c
==
--- head/sys/netinet6/in6_gif.c Thu May 28 07:23:27 2020(r361571)
+++ head/sys/netinet6/in6_gif.c Thu May 28 07:26:18 2020(r361572)
@@ -402,13 +402,9 @@ done:
return (0);
/* ingress filters on outer source */
if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0) {
-   struct nhop6_basic nh6;
-
-   if (fib6_lookup_nh_basic(sc->gif_fibnum, >ip6_src,
-   ntohs(in6_getscope(>ip6_src)), 0, 0, ) != 0)
-   return (0);
-
-   if (nh6.nh_ifp != m->m_pkthdr.rcvif)
+   if (fib6_check_urpf(sc->gif_fibnum, >ip6_src,
+   ntohs(in6_getscope(>ip6_src)), NHR_NONE,
+   m->m_pkthdr.rcvif) == 0)
return (0);
}
*arg = sc;
___
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: r361575 - head/sys/fs/nfsclient

2020-05-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May 28 07:35:07 2020
New Revision: 361575
URL: https://svnweb.freebsd.org/changeset/base/361575

Log:
  Make NFS address selection use fib4_lookup().
  
  fib4_lookup_nh_ represents pre-epoch generation of fib api,
  providing less guarantees over pointer validness and requiring
  on-stack data copying.
  Switch call to use new fib4_lookup(), allowing to eventually
  deprecate old api.
  
  Differential Revision:https://reviews.freebsd.org/D24977

Modified:
  head/sys/fs/nfsclient/nfs_clport.c

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Thu May 28 07:31:53 2020
(r361574)
+++ head/sys/fs/nfsclient/nfs_clport.c  Thu May 28 07:35:07 2020
(r361575)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -976,24 +977,29 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *p
 #endif
 #ifdef INET
if (nmp->nm_nam->sa_family == AF_INET) {
+   struct epoch_tracker et;
+   struct nhop_object *nh;
struct sockaddr_in *sin;
-   struct nhop4_extended nh_ext;
+   struct in_addr addr = {};
 
sin = (struct sockaddr_in *)nmp->nm_nam;
+   NET_EPOCH_ENTER(et);
CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred));
-   error = fib4_lookup_nh_ext(fibnum, sin->sin_addr, 0, 0,
-   _ext);
+   nh = fib4_lookup(fibnum, sin->sin_addr, 0, NHR_NONE, 0);
CURVNET_RESTORE();
-   if (error != 0)
+   if (nh != NULL)
+   addr = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr;
+   NET_EPOCH_EXIT(et);
+   if (nh == NULL)
return (NULL);
 
-   if (IN_LOOPBACK(ntohl(nh_ext.nh_src.s_addr))) {
+   if (IN_LOOPBACK(ntohl(addr.s_addr))) {
/* Ignore loopback addresses */
return (NULL);
}
 
*isinet6p = 0;
-   *((struct in_addr *)paddr) = nh_ext.nh_src;
+   *((struct in_addr *)paddr) = addr;
 
return (u_int8_t *)paddr;
}
___
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: r361579 - head/sys/dev/xen/blkfront

2020-05-28 Thread Roger Pau Monné
Author: royger
Date: Thu May 28 08:19:13 2020
New Revision: 361579
URL: https://svnweb.freebsd.org/changeset/base/361579

Log:
  xen/blkfront: use the correct type for disk sectors
  
  The correct type to use to represent disk sectors is blkif_sector_t
  (which is an uint64_t underneath). This avoid truncation of the disk
  size calculation when resizing on i386, as otherwise the calculation
  of d_mediasize in xbd_connect is truncated to the size of unsigned
  long, which is 32bits on i386.
  
  Note this issue didn't affect amd64, because the size of unsigned long
  is 64bits there.
  
  Sponsored by: Citrix Systems R
  MFC after:1 week

Modified:
  head/sys/dev/xen/blkfront/blkfront.c

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cThu May 28 08:18:34 2020
(r361578)
+++ head/sys/dev/xen/blkfront/blkfront.cThu May 28 08:19:13 2020
(r361579)
@@ -1225,7 +1225,8 @@ static void 
 xbd_connect(struct xbd_softc *sc)
 {
device_t dev = sc->xbd_dev;
-   unsigned long sectors, sector_size, phys_sector_size;
+   blkif_sector_t sectors;
+   unsigned long sector_size, phys_sector_size;
unsigned int binfo;
int err, feature_barrier, feature_flush;
int i, j;
@@ -1244,7 +1245,7 @@ xbd_connect(struct xbd_softc *sc)
return;
}
err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
-   "sectors", "%lu", , NULL);
+   "sectors", "%"PRIu64, , NULL);
if (err != 0) {
xenbus_dev_error(dev, err,
"reading sectors at %s",
@@ -1266,7 +1267,7 @@ xbd_connect(struct xbd_softc *sc)
}
 
err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev),
-   "sectors", "%lu", ,
+   "sectors", "%"PRIu64, ,
"info", "%u", ,
"sector-size", "%lu", _size,
NULL);
@@ -1279,7 +1280,7 @@ xbd_connect(struct xbd_softc *sc)
if ((sectors == 0) || (sector_size == 0)) {
xenbus_dev_fatal(dev, 0,
"invalid parameters from %s:"
-   " sectors = %lu, sector_size = %lu",
+   " sectors = %"PRIu64", sector_size = %lu",
xenbus_get_otherend_path(dev),
sectors, sector_size);
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: r361578 - head/sys/x86/xen

2020-05-28 Thread Roger Pau Monné
Author: royger
Date: Thu May 28 08:18:34 2020
New Revision: 361578
URL: https://svnweb.freebsd.org/changeset/base/361578

Log:
  xenpv: do not use low 1MB for Xen mappings on i386
  
  On amd64 we already avoid using memory below 4GB in order to prevent
  clashes with MMIO regions, but i386 was allowed to use any hole in
  the physical memory map in order to map Xen pages.
  
  Limit this to memory above the 1MB boundary on i386 in order to avoid
  clashes with the MMIO holes in that area.
  
  Sponsored by: Citrix Systems R
  MFC after:1 week

Modified:
  head/sys/x86/xen/xenpv.c

Modified: head/sys/x86/xen/xenpv.c
==
--- head/sys/x86/xen/xenpv.cThu May 28 08:05:46 2020(r361577)
+++ head/sys/x86/xen/xenpv.cThu May 28 08:18:34 2020(r361578)
@@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$");
  * prevent clashes with MMIO/ACPI regions.
  *
  * Since this is not possible on i386 just use any available memory
- * chunk and hope we don't clash with anything else.
+ * chunk above 1MB and hope we don't clash with anything else.
  */
 #ifdef __amd64__
 #define LOW_MEM_LIMIT  0x1ul
+#elif defined(__i386__)
+#define LOW_MEM_LIMIT  0x10ul
 #else
-#define LOW_MEM_LIMIT  0
+#error "Unsupported architecture"
 #endif
 
 static devclass_t xenpv_devclass;
___
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: r361568 - head/sys/powerpc/aim

2020-05-28 Thread Konstantin Belousov
On Wed, May 27, 2020 at 09:41:01PM -0500, Justin Hibbits wrote:
> On Thu, 28 May 2020 00:49:03 + (UTC)
> Brandon Bergren  wrote:
> 
> > Author: bdragon
> > Date: Thu May 28 00:49:02 2020
> > New Revision: 361568
> > URL: https://svnweb.freebsd.org/changeset/base/361568
> > 
> > Log:
> >   [PowerPC] Fix radix crash when passing -1 from userspace
> >   
> >   Found by running libc tests with radix enabled.
> >   
> >   Detect unsigned integer wrapping with a postcondition.
> >   
> >   Note: Radix MMU is not enabled by default yet.
> >   
> >   Sponsored by: Tag1 Consulting, Inc.
> > 
> > Modified:
> >   head/sys/powerpc/aim/mmu_radix.c
> > 
> > Modified: head/sys/powerpc/aim/mmu_radix.c
> > ==
> > --- head/sys/powerpc/aim/mmu_radix.cWed May 27 23:20:35
> > 2020(r361567) +++ head/sys/powerpc/aim/mmu_radix.c  Thu
> > May 28 00:49:02 2020(r361568) @@ -6000,7 +6000,8 @@
> > mmu_radix_kremove(vm_offset_t va) int mmu_radix_map_user_ptr(pmap_t
> > pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t
> > *klen) {
> > -   if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS)
> > +   if ((uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS ||
> > +   (uintptr_t)uaddr + ulen < (uintptr_t)uaddr)
> > return (EFAULT);
> >  
> > *kaddr = (void *)(uintptr_t)uaddr;
> 
> Wouldn't
> 
> if ((uintptr_t)uaddr >= VM_MAXUSER_ADDRESS ||
> (uintptr_t)uaddr + ulen >= VM_MAXUSER_ADDRESS)
> 
> be more appropriate?

The committed change is the canonical way to detect unsigned overflow,
so I think it is fine and does not depend on specific values of
VM_MAXUSER_ADDRESS.
___
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: r361491 - in head/sys: geom kern sys ufs/ffs ufs/ufs

2020-05-28 Thread Peter Jeremy
On 2020-May-25 23:47:32 +, Chuck Silvers  wrote:
>Author: chs
>Date: Mon May 25 23:47:31 2020
>New Revision: 361491
>URL: https://svnweb.freebsd.org/changeset/base/361491
>
>Log:
>  This commit enables a UFS filesystem to do a forcible unmount when
>  the underlying media fails or becomes inaccessible. For example
>  when a USB flash memory card hosting a UFS filesystem is unplugged.

This breaks the build when FFS is not built into the kernel but GEOM
is (eg for a ZFS-only system).  Specifically, ffs_subr.c is marked
"optional ffs | geom_label" and this commit added a dependency on
M_UFSMNT (defined in sys/ufs/ufs/ufs_vfsops.c) to ffs_subr.c.

The geom_label dependency exists because sys/geom/label/g_label_ufs.c
relies on ffs_sbget() (defined in ffs_subr.c) to taste UFS partitions.

I'm not sure of the best fix here - ideally, the new functions this
commit adds to ffs_subr.c would be moved to a different file (though
it's not immediately clear which file that would be.

-- 
Peter Jeremy


signature.asc
Description: PGP signature


svn commit: r361586 - head/usr.sbin/bluetooth/hccontrol

2020-05-28 Thread Takanori Watanabe
Author: takawata
Date: Thu May 28 13:48:33 2020
New Revision: 361586
URL: https://svnweb.freebsd.org/changeset/base/361586

Log:
  Fix connection event message string (n->\n)
  
  PR: 246664
  Submitted by: Marc Veldman (m...@bumblngdork.com)
  Reported by:  Jose Luis Duran (jldu...@gmail.com)

Modified:
  head/usr.sbin/bluetooth/hccontrol/le.c

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Thu May 28 13:19:41 2020
(r361585)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Thu May 28 13:48:33 2020
(r361586)
@@ -1078,7 +1078,7 @@ static void handle_le_connection_event(ng_hci_event_pk
"Supervision timeout: %dms\n",
 10 * le16toh(conn_event->supervision_timeout));
fprintf(stdout,
-   "Master clock accuracy: %sn",
+   "Master clock accuracy: %s\n",
hci_mc_accuracy2str(
conn_event->master_clock_accuracy));
}
___
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: r361587 - in head/sys/riscv: include riscv

2020-05-28 Thread Mitchell Horne
Author: mhorne
Date: Thu May 28 14:56:11 2020
New Revision: 361587
URL: https://svnweb.freebsd.org/changeset/base/361587

Log:
  Add macros simplifying the fake preload setup
  
  This is in preparation for booting via loader(8). Lift these macros from arm64
  so we don't need to worry about the size when inserting new elements. This
  could have been done in r359673, but I didn't think I would be returning to
  this function so soon.
  
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D24910

Modified:
  head/sys/riscv/include/vmparam.h
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/riscv/include/vmparam.h
==
--- head/sys/riscv/include/vmparam.hThu May 28 13:48:33 2020
(r361586)
+++ head/sys/riscv/include/vmparam.hThu May 28 14:56:11 2020
(r361587)
@@ -190,8 +190,6 @@
 #defineSHAREDPAGE  (VM_MAXUSER_ADDRESS - PAGE_SIZE)
 #defineUSRSTACKSHAREDPAGE
 
-#defineKERNENTRY   (0)
-
 #defineVM_EARLY_DTB_ADDRESS(VM_MAX_KERNEL_ADDRESS - (2 * L2_SIZE))
 
 /*

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu May 28 13:48:33 2020
(r361586)
+++ head/sys/riscv/riscv/machdep.c  Thu May 28 14:56:11 2020
(r361587)
@@ -733,29 +733,36 @@ fake_preload_metadata(struct riscv_bootparams *rvbp)
vm_offset_t zstart = 0, zend = 0;
 #endif
vm_offset_t lastaddr;
-   size_t dtb_size;
-   int i;
+   size_t fake_size, dtb_size;
 
-   i = 0;
+#define PRELOAD_PUSH_VALUE(type, value) do {   \
+   *(type *)((char *)fake_preload + fake_size) = (value);  \
+   fake_size += sizeof(type);  \
+} while (0)
 
-   fake_preload[i++] = MODINFO_NAME;
-   fake_preload[i++] = strlen("kernel") + 1;
-   strcpy((char*)_preload[i++], "kernel");
-   i += 1;
-   fake_preload[i++] = MODINFO_TYPE;
-   fake_preload[i++] = strlen("elf64 kernel") + 1;
-   strcpy((char*)_preload[i++], "elf64 kernel");
-   i += 3;
-   fake_preload[i++] = MODINFO_ADDR;
-   fake_preload[i++] = sizeof(vm_offset_t);
-   *(vm_offset_t *)_preload[i++] =
-   (vm_offset_t)(KERNBASE + KERNENTRY);
-   i += 1;
-   fake_preload[i++] = MODINFO_SIZE;
-   fake_preload[i++] = sizeof(vm_offset_t);
-   fake_preload[i++] = (vm_offset_t) -
-   (vm_offset_t)(KERNBASE + KERNENTRY);
-   i += 1;
+#define PRELOAD_PUSH_STRING(str) do {  \
+   uint32_t ssize; \
+   ssize = strlen(str) + 1;\
+   PRELOAD_PUSH_VALUE(uint32_t, ssize);\
+   strcpy(((char *)fake_preload + fake_size), str);\
+   fake_size += ssize; \
+   fake_size = roundup(fake_size, sizeof(u_long)); \
+} while (0)
+
+   fake_size = 0;
+
+   PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME);
+   PRELOAD_PUSH_STRING("kernel");
+   PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE);
+   PRELOAD_PUSH_STRING("elf kernel");
+
+   PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR);
+   PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t));
+   PRELOAD_PUSH_VALUE(uint64_t, KERNBASE);
+
+   PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE);
+   PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t));
+   PRELOAD_PUSH_VALUE(uint64_t, (size_t)((vm_offset_t) - KERNBASE));
 #ifdef DDB
 #if 0
/* RISCVTODO */
@@ -777,19 +784,20 @@ fake_preload_metadata(struct riscv_bootparams *rvbp)
 
/* Copy the DTB to KVA space. */
lastaddr = roundup(lastaddr, sizeof(int));
-   fake_preload[i++] = MODINFO_METADATA | MODINFOMD_DTBP;
-   fake_preload[i++] = sizeof(vm_offset_t);
-   *(vm_offset_t *)_preload[i] = (vm_offset_t)lastaddr;
-   i += sizeof(vm_offset_t) / sizeof(uint32_t);
+   PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA | MODINFOMD_DTBP);
+   PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t));
+   PRELOAD_PUSH_VALUE(vm_offset_t, lastaddr);
dtb_size = fdt_totalsize(rvbp->dtbp_virt);
memmove((void *)lastaddr, (const void *)rvbp->dtbp_virt, dtb_size);
lastaddr = roundup(lastaddr + dtb_size, sizeof(int));
 
-   fake_preload[i++] = 0;
-   fake_preload[i] = 0;
-   preload_metadata = (void *)fake_preload;
+   /* End marker */
+   PRELOAD_PUSH_VALUE(uint32_t, 0);
+   PRELOAD_PUSH_VALUE(uint32_t, 0);
+   preload_metadata = (caddr_t)fake_preload;
 
-   KASSERT(i < nitems(fake_preload), ("Too many fake_preload items"));
+   KASSERT(fake_size < sizeof(fake_preload),
+   ("Too many fake_preload items"));
 
return (lastaddr);
 }

svn commit: r361590 - head/sys/cam/ctl

2020-05-28 Thread Alexander Motin
Author: mav
Date: Thu May 28 18:12:05 2020
New Revision: 361590
URL: https://svnweb.freebsd.org/changeset/base/361590

Log:
  Remove ctl_free_beio() LUN and ctl_io dependencies.
  
  This slightly simplifies the code, plus may be a ground for asynchronous
  buffer free.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cThu May 28 17:08:39 2020
(r361589)
+++ head/sys/cam/ctl/ctl_backend_block.cThu May 28 18:12:05 2020
(r361590)
@@ -162,7 +162,6 @@ struct ctl_be_block_lun {
cbb_dispatch_t unmap;
cbb_dispatch_t get_lba_status;
cbb_getattr_t getattr;
-   uma_zone_t lun_zone;
uint64_t size_blocks;
uint64_t size_bytes;
struct ctl_be_block_softc *softc;
@@ -187,9 +186,10 @@ struct ctl_be_block_lun {
 struct ctl_be_block_softc {
struct sxmodify_lock;
struct mtx   lock;
-   uma_zone_t   beio_zone;
int  num_luns;
SLIST_HEAD(, ctl_be_block_lun)   lun_list;
+   uma_zone_t   beio_zone;
+   uma_zone_t   buf_zone;
 };
 
 static struct ctl_be_block_softc backend_block_softc;
@@ -202,6 +202,7 @@ struct ctl_be_block_io {
struct ctl_sg_entry sg_segs[CTLBLK_MAX_SEGS];
struct iovecxiovecs[CTLBLK_MAX_SEGS];
int bio_cmd;
+   int two_sglists;
int num_segs;
int num_bios_sent;
int num_bios_done;
@@ -310,32 +311,20 @@ ctl_alloc_beio(struct ctl_be_block_softc *softc)
 static void
 ctl_free_beio(struct ctl_be_block_io *beio)
 {
-   int duplicate_free;
+   struct ctl_be_block_softc *softc = beio->softc;
int i;
 
-   duplicate_free = 0;
-
for (i = 0; i < beio->num_segs; i++) {
-   if (beio->sg_segs[i].addr == NULL)
-   duplicate_free++;
+   uma_zfree(softc->buf_zone, beio->sg_segs[i].addr);
 
-   uma_zfree(beio->lun->lun_zone, beio->sg_segs[i].addr);
-   beio->sg_segs[i].addr = NULL;
-
/* For compare we had two equal S/G lists. */
-   if (ARGS(beio->io)->flags & CTL_LLF_COMPARE) {
-   uma_zfree(beio->lun->lun_zone,
+   if (beio->two_sglists) {
+   uma_zfree(softc->buf_zone,
beio->sg_segs[i + CTLBLK_HALF_SEGS].addr);
-   beio->sg_segs[i + CTLBLK_HALF_SEGS].addr = NULL;
}
}
 
-   if (duplicate_free > 0) {
-   printf("%s: %d duplicate frees out of %d segments\n", __func__,
-  duplicate_free, beio->num_segs);
-   }
-
-   uma_zfree(beio->softc->beio_zone, beio);
+   uma_zfree(softc->beio_zone, beio);
 }
 
 static void
@@ -1260,6 +1249,7 @@ static void
 ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun,
union ctl_io *io)
 {
+   struct ctl_be_block_softc *softc = be_lun->softc;
struct ctl_be_lun *cbe_lun = _lun->cbe_lun;
struct ctl_be_block_io *beio;
struct ctl_lba_len_flags *lbalen;
@@ -1324,7 +1314,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *b
} else
seglen -= seglen % cbe_lun->blocksize;
beio->sg_segs[i].len = seglen;
-   beio->sg_segs[i].addr = uma_zalloc(be_lun->lun_zone, M_WAITOK);
+   beio->sg_segs[i].addr = uma_zalloc(softc->buf_zone, M_WAITOK);
 
DPRINTF("segment %d addr %p len %zd\n", i,
beio->sg_segs[i].addr, beio->sg_segs[i].len);
@@ -1578,10 +1568,12 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun,
DPRINTF("%s at LBA %jx len %u @%ju\n",
   (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE",
   (uintmax_t)lbalen->lba, lbalen->len, bptrlen->len);
-   if (lbalen->flags & CTL_LLF_COMPARE)
+   if (lbalen->flags & CTL_LLF_COMPARE) {
+   beio->two_sglists = 1;
lbas = CTLBLK_HALF_IO_SIZE;
-   else
+   } else {
lbas = CTLBLK_MAX_IO_SIZE;
+   }
lbas = MIN(lbalen->len - bptrlen->len, lbas / cbe_lun->blocksize);
beio->io_offset = (lbalen->lba + bptrlen->len) * cbe_lun->blocksize;
beio->io_len = lbas * cbe_lun->blocksize;
@@ -1595,17 +1587,17 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun,
 * Setup the S/G entry for this chunk.
 */
beio->sg_segs[i].len = min(CTLBLK_MAX_SEG, 

Re: svn commit: r361583 - head/sys/crypto/aesni

2020-05-28 Thread John Baldwin
On 5/28/20 2:13 AM, Marcin Wojtas wrote:
> Author: mw
> Date: Thu May 28 09:13:20 2020
> New Revision: 361583
> URL: https://svnweb.freebsd.org/changeset/base/361583
> 
> Log:
>   Change return types of hash update functions in SHA-NI
>   
>   r359374 introduced crypto_apply function which takes as argument a function 
> pointer
>   that is expected to return an int, however aesni hash update functions
>   return void.
>   Because of that the function pointer passed was simply cast with
>   its return value changed.
>   This resulted in undefined behavior, in particular when mbuf is used, 
> (ipsec)
>   m_apply checks return value of function pointer passed to it
>   and in our case bogusly fails after calculating hash of the first mbuf
>   in chain.
>   Fix it by changing signatures of sha update routines in aesni and
>   dropping the casts.

Hmm, I missed one nit in the review.  r359374 didn't introduce
crypto_apply, it just changed some of the arguments arguments (crp
instead of crp_buf and crp_flags).  This fix needs to be MFC'd to 12
as well since the issue with the return type is also present there.

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


svn commit: r361603 - head/lib/libc/sys

2020-05-28 Thread Rick Macklem
Author: rmacklem
Date: Thu May 28 21:26:26 2020
New Revision: 361603
URL: https://svnweb.freebsd.org/changeset/base/361603

Log:
  Add an entry to Symbol.map for the rpctls_syscall added by r361599.
  
  Reviewed by:  brooks
  Differential Revision:https://reviews.freebsd.org/D24949

Modified:
  head/lib/libc/sys/Symbol.map

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapThu May 28 21:23:02 2020
(r361602)
+++ head/lib/libc/sys/Symbol.mapThu May 28 21:26:26 2020
(r361603)
@@ -1033,4 +1033,5 @@ FBSDprivate_1.0 {
__sys_cpuset_getdomain;
_cpuset_setdomain;
__sys_cpuset_setdomain;
+   rpctls_syscall;
 };
___
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: r361596 - head/usr.bin/fortune

2020-05-28 Thread Ed Maste
Author: emaste
Date: Thu May 28 20:39:27 2020
New Revision: 361596
URL: https://svnweb.freebsd.org/changeset/base/361596

Log:
  fortune: remove warning about potentially offensive fortunes
  
  They were removed long ago.
  
  PR:   246736
  Submitted by: Ruby Lazuli Lord
  MFC after:3 days

Modified:
  head/usr.bin/fortune/README

Modified: head/usr.bin/fortune/README
==
--- head/usr.bin/fortune/README Thu May 28 19:41:00 2020(r361595)
+++ head/usr.bin/fortune/README Thu May 28 20:39:27 2020(r361596)
@@ -1,13 +1,6 @@
 #  @(#)README  8.1 (Berkeley) 5/31/93
 # $FreeBSD$
 
-The potentially offensive fortunes are installed by default on FreeBSD
-systems.  If you're absolutely, *positively*, without-a-shadow-of-a-doubt
-sure that your user community goes berzerk/sues your pants off/drops dead
-upon reading one of them, edit the Makefile in the subdirectory datfiles,
-and do "make all install".
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Some years ago, my neighbor Avery said to me: "There has not been an
 adequate jokebook published since "Joe_Miller", which came out in 1739 and
 which, incidentally, was the most miserable no-good ... jokebook in the
___
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: r360964 - in head: lib/libclang_rt lib/libthr lib/msun libexec/rtld-elf libexec/tftpd/tests share/mk stand stand/arm/uboot stand/efi stand/efi/boot1 stand/efi/loader stand/i386/boot2 s

2020-05-28 Thread Eric van Gyzen

On 5/25/20 3:37 AM, Tijl Coosemans wrote:

On Tue, 12 May 2020 15:22:41 + (UTC) Eric van Gyzen
 wrote:

Author: vangyzen
Date: Tue May 12 15:22:40 2020
New Revision: 360964
URL: https://svnweb.freebsd.org/changeset/base/360964

Log:
   Remove tests for obsolete compilers in the build system
   
   Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.

   Assume clang is at least 6, which was in 11.2-RELEASE.  Drop conditions
   for older compilers.
   
   Reviewed by:	imp (earlier version), emaste, jhb

   MFC after:   2 weeks
   Sponsored by:Dell EMC Isilon
   Differential Revision:   https://reviews.freebsd.org/D24802


This broke devel/linux_libusb.  It is FreeBSD libusb built with Linux
gcc 4.8.5 (devel/linux-c7-devtools).  It's probably caused by the
changes to share/mk/*.

http://beefy18.nyi.freebsd.org/data/head-amd64-default/p536258_s361404/logs/linux_libusb-13.0r358841.log


This should be fixed in r361605.  Thanks for bringing it to my attention.

Eric
___
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: r361595 - in head/sys: amd64/amd64 i386/i386 vm

2020-05-28 Thread Mark Johnston
Author: markj
Date: Thu May 28 19:41:00 2020
New Revision: 361595
URL: https://svnweb.freebsd.org/changeset/base/361595

Log:
  Fix boot on systems where NUMA domain 0 is unpopulated.
  
  - Add vm_phys_early_add_seg(), complementing vm_phys_early_alloc(), to
ensure that segments registered during hammer_time() are placed in the
right domain.  Otherwise, since the SRAT is not parsed at that point,
we just add them to domain 0, which may be incorrect and results in a
domain with only several MB worth of memory.
  - Fix uma_startup1() to try allocating memory for zones from any domain.
If domain 0 is unpopulated, the allocation will simply fail, resulting
in a page fault slightly later during boot.
  - Change _vm_phys_domain() to return -1 for addresses not covered by the
affinity table, and change vm_phys_early_alloc() to handle wildcard
domains.  This is necessary on amd64, where the page array is dense
and pmap_page_array_startup() may allocate page table pages for
non-existent page frames.
  
  Reported and tested by:   Rafael Kitover 
  Reviewed by:  cem (earlier version), kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25001

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/pmap.c
  head/sys/vm/uma_core.c
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Thu May 28 19:14:44 2020
(r361594)
+++ head/sys/amd64/amd64/machdep.c  Thu May 28 19:41:00 2020
(r361595)
@@ -1223,7 +1223,7 @@ getmemsize(caddr_t kmdp, u_int64_t first)
 * Tell the physical memory allocator about pages used to store
 * the kernel and preloaded data.  See kmem_bootstrap_free().
 */
-   vm_phys_add_seg((vm_paddr_t)kernphys, trunc_page(first));
+   vm_phys_early_add_seg((vm_paddr_t)kernphys, trunc_page(first));
 
bzero(physmap, sizeof(physmap));
physmap_idx = 0;

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu May 28 19:14:44 2020(r361594)
+++ head/sys/amd64/amd64/pmap.c Thu May 28 19:41:00 2020(r361595)
@@ -1700,7 +1700,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 * are required for promotion of the corresponding kernel virtual
 * addresses to superpage mappings.
 */
-   vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt));
+   vm_phys_early_add_seg(KPTphys, KPTphys + ptoa(nkpt));
 
/*
 * Account for the virtual addresses mapped by create_pagetables().

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cThu May 28 19:14:44 2020
(r361594)
+++ head/sys/i386/i386/machdep.cThu May 28 19:41:00 2020
(r361595)
@@ -1828,7 +1828,7 @@ getmemsize(int first)
 * Tell the physical memory allocator about pages used to store
 * the kernel and preloaded data.  See kmem_bootstrap_free().
 */
-   vm_phys_add_seg((vm_paddr_t)KERNLOAD, trunc_page(first));
+   vm_phys_early_add_seg((vm_paddr_t)KERNLOAD, trunc_page(first));
 
TUNABLE_INT_FETCH("hw.above4g_allow", _allow);
TUNABLE_INT_FETCH("hw.above24g_allow", _allow);

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu May 28 19:14:44 2020(r361594)
+++ head/sys/i386/i386/pmap.c   Thu May 28 19:41:00 2020(r361595)
@@ -633,7 +633,7 @@ __CONCAT(PMTYPE, bootstrap)(vm_paddr_t firstaddr)
 * are required for promotion of the corresponding kernel virtual
 * addresses to superpage mappings.
 */
-   vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt));
+   vm_phys_early_add_seg(KPTphys, KPTphys + ptoa(nkpt));
 
/*
 * Initialize the first available kernel virtual address.

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Thu May 28 19:14:44 2020(r361594)
+++ head/sys/vm/uma_core.c  Thu May 28 19:41:00 2020(r361595)
@@ -2810,6 +2810,7 @@ uma_startup1(vm_offset_t virtual_avail)
size_t ksize, zsize, size;
uma_keg_t masterkeg;
uintptr_t m;
+   int domain;
uint8_t pflag;
 
bootstart = bootmem = virtual_avail;
@@ -2827,7 +2828,12 @@ uma_startup1(vm_offset_t virtual_avail)
 
/* Allocate the zone of zones, zone of kegs, and zone of zones keg. */
size = (zsize * 2) + ksize;
-   m = (uintptr_t)startup_alloc(NULL, size, 0, , M_NOWAIT | M_ZERO);
+   for (domain = 0; 

svn commit: r361601 - head/sys/dev/vt

2020-05-28 Thread Jason A. Harmening
Author: jah
Date: Thu May 28 21:22:30 2020
New Revision: 361601
URL: https://svnweb.freebsd.org/changeset/base/361601

Log:
  vt(4): Add support for `vidcontrol -C'
  
  Extract scrollback buffer initialization into a common routine, used both
  during vt(4) init and in handling the CONS_CLRHIST ioctl.
  
  PR:   224436
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D24815

Modified:
  head/sys/dev/vt/vt.h
  head/sys/dev/vt/vt_buf.c
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hThu May 28 21:19:44 2020(r361600)
+++ head/sys/dev/vt/vt.hThu May 28 21:22:30 2020(r361601)
@@ -231,6 +231,7 @@ void vtbuf_scroll_mode(struct vt_buf *vb, int yes);
 void vtbuf_dirty(struct vt_buf *vb, const term_rect_t *area);
 void vtbuf_undirty(struct vt_buf *, term_rect_t *);
 void vtbuf_sethistory_size(struct vt_buf *, unsigned int);
+void vtbuf_clearhistory(struct vt_buf *);
 int vtbuf_iscursor(const struct vt_buf *vb, int row, int col);
 void vtbuf_cursor_visibility(struct vt_buf *, int);
 #ifndef SC_NO_CUTPASTE

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cThu May 28 21:19:44 2020(r361600)
+++ head/sys/dev/vt/vt_buf.cThu May 28 21:22:30 2020(r361601)
@@ -416,13 +416,26 @@ vtbuf_init_rows(struct vt_buf *vb)
vb->vb_rows[r] = >vb_buffer[r * vb->vb_scr_size.tp_col];
 }
 
-void
-vtbuf_init_early(struct vt_buf *vb)
+static void
+vtbuf_do_clearhistory(struct vt_buf *vb)
 {
term_rect_t rect;
const teken_attr_t *a;
-   term_char_t c;
+   term_char_t ch;
 
+   a = teken_get_curattr(>vb_terminal->tm_emulator);
+   ch = TCOLOR_FG(a->ta_fgcolor) | TCOLOR_BG(a->ta_bgcolor);
+
+   rect.tr_begin.tp_row = rect.tr_begin.tp_col = 0;
+   rect.tr_end.tp_col = vb->vb_scr_size.tp_col;
+   rect.tr_end.tp_row = vb->vb_history_size;
+
+   vtbuf_do_fill(vb, , VTBUF_SPACE_CHAR(ch));
+}
+
+void
+vtbuf_init_early(struct vt_buf *vb)
+{
vb->vb_flags |= VBF_CURSOR;
vb->vb_roffset = 0;
vb->vb_curroffset = 0;
@@ -432,14 +445,7 @@ vtbuf_init_early(struct vt_buf *vb)
vb->vb_mark_end.tp_col = 0;
 
vtbuf_init_rows(vb);
-   rect.tr_begin.tp_row = rect.tr_begin.tp_col = 0;
-   rect.tr_end.tp_col = vb->vb_scr_size.tp_col;
-   rect.tr_end.tp_row = vb->vb_history_size;
-
-   a = teken_get_curattr(>vb_terminal->tm_emulator);
-   c = TCOLOR_FG((term_char_t)a->ta_fgcolor) | 
-   TCOLOR_BG((term_char_t)a->ta_bgcolor);
-   vtbuf_do_fill(vb, , VTBUF_SPACE_CHAR(c));
+   vtbuf_do_clearhistory(vb);
vtbuf_make_undirty(vb);
if ((vb->vb_flags & VBF_MTX_INIT) == 0) {
mtx_init(>vb_lock, "vtbuf", NULL, MTX_SPIN);
@@ -464,6 +470,14 @@ vtbuf_init(struct vt_buf *vb, const term_pos_t *p)
}
 
vtbuf_init_early(vb);
+}
+
+void
+vtbuf_clearhistory(struct vt_buf *vb)
+{
+   VTBUF_LOCK(vb);
+   vtbuf_do_clearhistory(vb);
+   VTBUF_UNLOCK(vb);
 }
 
 void

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Thu May 28 21:19:44 2020(r361600)
+++ head/sys/dev/vt/vt_core.c   Thu May 28 21:22:30 2020(r361601)
@@ -2329,7 +2329,10 @@ skip_thunk:
if (*(int *)data != vd->vd_curwindow->vw_buf.vb_history_size)
vtbuf_sethistory_size(>vd_curwindow->vw_buf,
*(int *)data);
-   return 0;
+   return (0);
+   case CONS_CLRHIST:
+   vtbuf_clearhistory(>vd_curwindow->vw_buf);
+   return (0);
case CONS_GET:
/* XXX */
*(int *)data = M_CG640x480;
___
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: r361602 - in head/sys: compat/freebsd32 kern

2020-05-28 Thread Rick Macklem
Author: rmacklem
Date: Thu May 28 21:23:02 2020
New Revision: 361602
URL: https://svnweb.freebsd.org/changeset/base/361602

Log:
  Update the files created from the new syscalls.master from r361599.
  
  Reviewed by:  brooks
  Differential Revision:https://reviews.freebsd.org/D24949

Modified:
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Thu May 28 21:22:30 
2020(r361601)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Thu May 28 21:23:02 
2020(r361602)
@@ -502,4 +502,5 @@
 #defineFREEBSD32_SYS_sigfastblock  573
 #defineFREEBSD32_SYS___realpathat  574
 #defineFREEBSD32_SYS_close_range   575
-#defineFREEBSD32_SYS_MAXSYSCALL576
+#defineFREEBSD32_SYS_rpctls_syscall576
+#defineFREEBSD32_SYS_MAXSYSCALL577

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Thu May 28 21:22:30 
2020(r361601)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Thu May 28 21:23:02 
2020(r361602)
@@ -612,4 +612,5 @@ const char *freebsd32_syscallnames[] = {
"sigfastblock", /* 573 = sigfastblock */
"__realpathat", /* 574 = __realpathat */
"close_range",  /* 575 = close_range */
+   "rpctls_syscall",   /* 576 = rpctls_syscall */
 };

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cThu May 28 21:22:30 
2020(r361601)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cThu May 28 21:23:02 
2020(r361602)
@@ -665,4 +665,5 @@ struct sysent freebsd32_sysent[] = {
{ AS(sigfastblock_args), (sy_call_t *)sys_sigfastblock, AUE_NULL, NULL, 
0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 573 = sigfastblock */
{ AS(__realpathat_args), (sy_call_t *)sys___realpathat, AUE_REALPATHAT, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 574 = __realpathat */
{ AS(close_range_args), (sy_call_t *)sys_close_range, AUE_CLOSERANGE, 
NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 575 = close_range */
+   { AS(rpctls_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 
0, 0, SY_THR_ABSENT },/* 576 = rpctls_syscall */
 };

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu May 28 21:22:30 
2020(r361601)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu May 28 21:23:02 
2020(r361602)
@@ -3376,6 +3376,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
*n_args = 3;
break;
}
+   /* rpctls_syscall */
+   case 576: {
+   struct rpctls_syscall_args *p = params;
+   iarg[0] = p->op; /* int */
+   uarg[1] = (intptr_t) p->path; /* const char * */
+   *n_args = 2;
+   break;
+   }
default:
*n_args = 0;
break;
@@ -9103,6 +9111,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d
break;
};
break;
+   /* rpctls_syscall */
+   case 576:
+   switch(ndx) {
+   case 0:
+   p = "int";
+   break;
+   case 1:
+   p = "userland const char *";
+   break;
+   default:
+   break;
+   };
+   break;
default:
break;
};
@@ -10999,6 +11020,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *
break;
/* close_range */
case 575:
+   if (ndx == 0 || ndx == 1)
+   p = "int";
+   break;
+   /* rpctls_syscall */
+   case 576:
if (ndx == 0 || ndx == 1)
p = "int";
break;

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Thu May 28 21:22:30 2020(r361601)
+++ head/sys/kern/init_sysent.c Thu May 28 21:23:02 2020(r361602)
@@ -631,4 +631,5 @@ struct sysent sysent[] = {
 

svn commit: r361605 - head/share/mk

2020-05-28 Thread Eric van Gyzen
Author: vangyzen
Date: Thu May 28 21:56:31 2020
New Revision: 361605
URL: https://svnweb.freebsd.org/changeset/base/361605

Log:
  Revert part of r360964
  
  ports/devel/linux_libusb builds FreeBSD libusb with GCC 4.8.5
  from devel/linux-c7-devtools.  Restore the tests for older GCC
  in bsd.sys.mk to accomodate such ports.
  
  Reported by:  tijl
  Sponsored by: Dell EMC Isilon

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

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkThu May 28 21:30:29 2020(r361604)
+++ head/share/mk/bsd.sys.mkThu May 28 21:56:31 2020(r361605)
@@ -124,7 +124,12 @@ CWARNFLAGS+=   -Wno-format
 # GCC
 # We should clean up warnings produced with these flags.
 # They were originally added as a quick hack to enable gcc5/6.
+# The base system requires at least GCC 6.4, but some ports
+# use this file with older compilers.  Request an exprun
+# before changing these.
 .if ${COMPILER_TYPE} == "gcc"
+# GCC 5.2.0
+.if ${COMPILER_VERSION} >= 50200
 CWARNFLAGS+=   -Wno-error=address  \
-Wno-error=array-bounds \
-Wno-error=attributes   \
@@ -136,15 +141,20 @@ CWARNFLAGS+=  -Wno-error=address  
\
-Wno-error=extra\
-Wno-error=inline   \
-Wno-error=logical-not-parentheses  \
-   -Wno-error=nonnull-compare  \
-   -Wno-error=shift-negative-value \
-Wno-error=strict-aliasing  \
-   -Wno-error=tautological-compare \
-Wno-error=uninitialized\
-Wno-error=unused-but-set-variable  \
-   -Wno-error=unused-const-variable\
-Wno-error=unused-function  \
-Wno-error=unused-value
+.endif
+
+# GCC 6.1.0
+.if ${COMPILER_VERSION} >= 60100
+CWARNFLAGS+=   -Wno-error=nonnull-compare  \
+   -Wno-error=shift-negative-value \
+   -Wno-error=tautological-compare \
+   -Wno-error=unused-const-variable
+.endif
 
 # GCC 7.1.0
 .if ${COMPILER_VERSION} >= 70100
___
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: r361606 - head

2020-05-28 Thread Eric van Gyzen
Author: vangyzen
Date: Thu May 28 22:05:33 2020
New Revision: 361606
URL: https://svnweb.freebsd.org/changeset/base/361606

Log:
  Add an UPDATING entry for r360964
  
  Reported by:  rpokala
  Sponsored by: Dell EMC Isilon

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Thu May 28 21:56:31 2020(r361605)
+++ head/UPDATING   Thu May 28 22:05:33 2020(r361606)
@@ -32,6 +32,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
information about prerequisites and upgrading, if you are not already
using clang 3.5.0 or higher.
 
+20200512:
+   Support for obsolete compilers has been removed from the build system.
+   Clang 6 and GCC 6.4 are the minimum supported versions.
+
 20200424:
closefrom(2) has been moved under COMPAT12, and replaced in libc with a
stub that calls close_range(2).  If using a custom kernel configuration,
___
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: r361599 - in head/sys: compat/freebsd32 kern

2020-05-28 Thread Rick Macklem
Author: rmacklem
Date: Thu May 28 21:06:10 2020
New Revision: 361599
URL: https://svnweb.freebsd.org/changeset/base/361599

Log:
  Add a syscall for the nfs-over-tls daemons to use.
  
  The nfs-over-tls daemons need a system call to perform operations such as
  associate a file descriptor with a krpc socket.
  The daemons will not be in head for some time, but it will make it
  easier for testers of nfs-over-tls to do testing if the system call
  is in head (basically the stub for libc which will be commited soon).
  
  Reviewed by:  brooks
  Differential Revision:https://reviews.freebsd.org/D24949

Modified:
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Thu May 28 21:02:12 2020
(r361598)
+++ head/sys/compat/freebsd32/syscalls.master   Thu May 28 21:06:10 2020
(r361599)
@@ -1164,5 +1164,8 @@
char *buf, size_t size, int flags); }
 575AUE_CLOSERANGE  NOPROTO { int close_range(u_int lowfd, u_int highfd, \
int flags); }
+; 576 is initialised by the krpc code, if present.
+576AUE_NULLNOSTD|NOPROTO   { int rpctls_syscall(int op, \
+   const char *path); }
 
 ; vim: syntax=off

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Thu May 28 21:02:12 2020
(r361598)
+++ head/sys/kern/syscalls.master   Thu May 28 21:06:10 2020
(r361599)
@@ -3234,6 +3234,13 @@
int flags
);
}
+; 576 is initialised by the krpc code, if present.
+576AUE_NULLNOSTD {
+   int rpctls_syscall(
+   int op,
+   _In_z_ const char *path
+   );
+   }
 
 ; Please copy any additions and changes to the following compatability tables:
 ; sys/compat/freebsd32/syscalls.master
___
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: r361604 - head/sys/cam/ctl

2020-05-28 Thread Alexander Motin
Author: mav
Date: Thu May 28 21:30:29 2020
New Revision: 361604
URL: https://svnweb.freebsd.org/changeset/base/361604

Log:
  Make struct ctl_be_lun first element of struct ctl_be_*_lun.
  
  It allows to remove some extra pointer dereferences and slightly tightens
  up the code by unification.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend.h
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Thu May 28 21:26:26 2020(r361603)
+++ head/sys/cam/ctl/ctl.c  Thu May 28 21:30:29 2020(r361604)
@@ -3083,7 +3083,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, 
break;
 
if (lun->backend->lun_info != NULL) {
-   retval = 
lun->backend->lun_info(lun->be_lun->be_lun, sb);
+   retval = lun->backend->lun_info(lun->be_lun, 
sb);
if (retval != 0)
break;
}
@@ -4751,7 +4751,7 @@ ctl_free_lun(struct ctl_lun *lun)
/*
 * Tell the backend to free resources, if this LUN has a backend.
 */
-   lun->be_lun->lun_shutdown(lun->be_lun->be_lun);
+   lun->be_lun->lun_shutdown(lun->be_lun);
 
lun->ie_reportcnt = UINT32_MAX;
callout_drain(>ie_callout);
@@ -6708,7 +6708,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
data = page_index->page_data;
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, "blocksavail"))
+   (val = lun->backend->lun_attr(lun->be_lun, "blocksavail"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x0001, phdr->param_code);
@@ -6721,7 +6721,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
}
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, "blocksused"))
+   (val = lun->backend->lun_attr(lun->be_lun, "blocksused"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x0002, phdr->param_code);
@@ -6734,7 +6734,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
}
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, 
"poolblocksavail"))
+   (val = lun->backend->lun_attr(lun->be_lun, "poolblocksavail"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x00f1, phdr->param_code);
@@ -6747,7 +6747,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
}
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, 
"poolblocksused"))
+   (val = lun->backend->lun_attr(lun->be_lun, "poolblocksused"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x00f2, phdr->param_code);
@@ -13386,8 +13386,7 @@ ctl_thresh_thread(void *arg)
continue;
}
mtx_unlock(>ctl_lock); // XXX
-   val = lun->backend->lun_attr(
-   lun->be_lun->be_lun, attr);
+   val = lun->backend->lun_attr(lun->be_lun, attr);
mtx_lock(>ctl_lock);
if (val == UINT64_MAX)
continue;

Modified: head/sys/cam/ctl/ctl_backend.h
==
--- head/sys/cam/ctl/ctl_backend.h  Thu May 28 21:26:26 2020
(r361603)
+++ head/sys/cam/ctl/ctl_backend.h  Thu May 28 21:30:29 2020
(r361604)
@@ -80,7 +80,8 @@ typedef enum {
MODULE_DEPEND(name, cam, 1, 1, 1)
 
 
-typedef void (*be_callback_t)(void *be_lun);
+struct ctl_be_lun;
+typedef void (*be_callback_t)(struct ctl_be_lun *be_lun);
 
 /*
  * The lun_type field is the SCSI device type of this particular LUN.  In
@@ -147,7 +148,6 @@ struct ctl_be_lun {
uint8_t lun_type;   /* passed to CTL */
ctl_backend_lun_flags   flags;  /* passed to CTL */
ctl_lun_serseq  serseq; /* passed to CTL */
-   void*be_lun;/* passed to CTL */
uint64_tmaxlba; /* passed to CTL */
uint32_tblocksize;  /* passed to CTL */
uint16_tpblockexp;  /* passed to CTL */
@@ -178,8 +178,8 

svn commit: r361591 - head/release/tools

2020-05-28 Thread Glen Barber
Author: gjb
Date: Thu May 28 18:48:30 2020
New Revision: 361591
URL: https://svnweb.freebsd.org/changeset/base/361591

Log:
  Include the shells/bash port on Vagrant images, which prevents
  a shell issue during startup.
  
  PR:   245051
  MFC after:1 minute (if approved by re@)
  X-MFC-for:11.4-RC2
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/tools/vagrant.conf

Modified: head/release/tools/vagrant.conf
==
--- head/release/tools/vagrant.conf Thu May 28 18:12:05 2020
(r361590)
+++ head/release/tools/vagrant.conf Thu May 28 18:48:30 2020
(r361591)
@@ -8,7 +8,7 @@ export VMSIZE=8G
 
 # Packages to install into the image we're creating.  This is a deliberately
 # minimalist set, providing only the packages necessary to bootstrap.
-export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs"
+export VM_EXTRA_PACKAGES="shells/bash firstboot-freebsd-update firstboot-pkgs"
 
 # Set to a list of third-party software to enable in rc.conf(5).
 export VM_RC_LIST="firstboot_freebsd_update firstboot_pkgs growfs"
___
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: r361600 - in head/sys/contrib/dev/acpica: . compiler components/debugger components/utilities include

2020-05-28 Thread Jung-uk Kim
Author: jkim
Date: Thu May 28 21:19:44 2020
New Revision: 361600
URL: https://svnweb.freebsd.org/changeset/base/361600

Log:
  MFV:  r361597
  
  Import ACPICA 20200528.

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/compiler/aslcompiler.l
  head/sys/contrib/dev/acpica/compiler/aslkeywords.y
  head/sys/contrib/dev/acpica/compiler/aslmap.c
  head/sys/contrib/dev/acpica/compiler/aslmethod.c
  head/sys/contrib/dev/acpica/compiler/asltokens.y
  head/sys/contrib/dev/acpica/compiler/aslxref.c
  head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  head/sys/contrib/dev/acpica/components/utilities/utdecode.c
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/actypes.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Thu May 28 21:06:10 2020
(r361599)
+++ head/sys/contrib/dev/acpica/changes.txt Thu May 28 21:19:44 2020
(r361600)
@@ -1,8 +1,61 @@
 
 
 
-30 April 2020. Summary of changes for version 20200430:
+28 May 2020. Summary of changes for version 20200528:
 
+
+1) ACPICA kernel-resident subsystem:
+
+Removed old/obsolete Visual Studio files which were used to build the 
+Windows versions of the ACPICA tools. Since we have moved to Visual 
+Studio 2017, we are no longer supporting Visual Studio 2006 and 2009 
+project files. The new subdirectory and solution file are located at:
+
+acpica/generate/msvc2017/AcpiComponents.sln
+
+
+2) iASL Compiler/Disassembler and ACPICA tools: 
+
+iASL: added support for a new OperationRegion Address Space (subtype): 
+PlatformRtMechanism. Support for this new keyword is being released for 
+early prototyping. It will appear in the next release of the ACPI 
+specification.
+
+iASL: do not optimize the NameString parameter of the CondRefOf operator. 
+In the previous iASL compiler release, the NameString parameter of the 
+CondRefOf was optimized. There is evidence that some implementations of 
+the AML interpreter do not perform the recursive search-to-parent search 
+during the execution of the CondRefOf operator. Therefore, the CondRefOf 
+operator behaves differently when the NameString parameter is a single 
+name segment (a NameSeg) as opposed to a full NamePath (starting at the 
+root scope) or a NameString containing parent prefixes.
+
+iASL: Prevent an inadvertent remark message. This change prevents a 
+remark if within a control method the following exist:
+1) An Operation Region is defined, and
+2) A Field operator is defined that refers to the region.
+This happens because at the top level, the Field operator does not 
+actually create a new named object, it simply references the operation 
+region.
+
+Removed support for the acpinames utility. The acpinames was a simple 
+utility used to populate and display the ACPI namespace without executing 
+any AML code. However, ACPICA now supports executable opcodes outside of 
+control methods. This means that executable AML opcodes such as If and 
+Store opcodes need to be executed during table load. Therefore, acpinames 
+would need to be updated to match the same behavior as the acpiexec 
+utility and since acpiexec can already dump the entire namespace (via the 
+'namespace' command), we no longer have the need to maintain acpinames.
+
+In order to dump the contents of the ACPI namepsace using acpiexec, 
+execute the following command from the command line:
+
+acpiexec -b "n" [aml files]
+
+
+
+
+30 April 2020. Summary of changes for version 20200430:
 
 1) ACPICA kernel-resident subsystem:
 

Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.l
==
--- head/sys/contrib/dev/acpica/compiler/aslcompiler.l  Thu May 28 21:06:10 
2020(r361599)
+++ head/sys/contrib/dev/acpica/compiler/aslcompiler.l  Thu May 28 21:19:44 
2020(r361600)
@@ -693,6 +693,7 @@ NamePathTail[.]{NameSeg}
 "GeneralPurposeIo"  { count (0); return (PARSEOP_REGIONSPACE_GPIO); }  
 /* ACPI 5.0 */
 "GenericSerialBus"  { count (0); return (PARSEOP_REGIONSPACE_GSBUS); } 
 /* ACPI 5.0 */
 "PCC"   { count (0); return (PARSEOP_REGIONSPACE_PCC); }   
 /* ACPI 5.0 */
+"PlatformRtMechanism"   { count (0); return (PARSEOP_REGIONSPACE_PRM); }
 "FFixedHW"  { count (0); return 
(PARSEOP_REGIONSPACE_FFIXEDHW); }
 
 /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */

Modified: head/sys/contrib/dev/acpica/compiler/aslkeywords.y
==
--- head/sys/contrib/

svn commit: r361607 - in head: . etc/mtree lib lib/libevent lib/libevent1 share/mk usr.sbin/ftp-proxy usr.sbin/ypldap

2020-05-28 Thread Ed Maste
Author: emaste
Date: Thu May 28 22:05:50 2020
New Revision: 361607
URL: https://svnweb.freebsd.org/changeset/base/361607

Log:
  rename in-tree libevent v1 to libevent1
  
  r316063 installed pf's embedded libevent as a private lib, with headers
  in /usr/include/private/event.  Unfortunately we also have a copy of
  libevent v2 included in ntp, which needed to be updated for compatibility
  with OpenSSL 1.1.
  
  As unadorned 'libevent' generally refers to libevent v2, be explicit that
  this one is libevent v1.
  
  Reviewed by:  vangyzen (earlier)
  Differential Revision:https://reviews.freebsd.org/D17275

Added:
  head/lib/libevent1/
 - copied from r361606, head/lib/libevent/
Deleted:
  head/lib/libevent/
Modified:
  head/ObsoleteFiles.inc
  head/etc/mtree/BSD.usr.dist
  head/lib/Makefile
  head/lib/libevent1/Makefile
  head/share/mk/src.libnames.mk
  head/usr.sbin/ftp-proxy/Makefile
  head/usr.sbin/ypldap/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu May 28 22:05:33 2020(r361606)
+++ head/ObsoleteFiles.inc  Thu May 28 22:05:50 2020(r361607)
@@ -36,6 +36,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200528: libevent renamed libevent1
+OLD_FILES+=usr/include/private/event/event.h
+OLD_DIRS+=usr/include/private/event
+
 # 20200523: new clang import which bumps version from 10.0.0 to 10.0.1.s
 OLD_FILES+=usr/lib/clang/10.0.0/include/cuda_wrappers/algorithm
 OLD_FILES+=usr/lib/clang/10.0.0/include/cuda_wrappers/complex

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Thu May 28 22:05:33 2020(r361606)
+++ head/etc/mtree/BSD.usr.dist Thu May 28 22:05:50 2020(r361607)
@@ -11,7 +11,7 @@
 private
 bsdstat
 ..
-event
+event1
 ..
 gmock
 internal

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Thu May 28 22:05:33 2020(r361606)
+++ head/lib/Makefile   Thu May 28 22:05:50 2020(r361607)
@@ -48,7 +48,7 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
libdwarf \
libedit \
libelftc \
-   libevent \
+   libevent1 \
libexecinfo \
libexpat \
libfetch \

Modified: head/lib/libevent1/Makefile
==
--- head/lib/libevent/Makefile  Thu May 28 22:05:33 2020(r361606)
+++ head/lib/libevent1/Makefile Thu May 28 22:05:50 2020(r361607)
@@ -5,7 +5,7 @@ PACKAGE=lib${LIB}
 
 .include 
 
-LIB=   event
+LIB=   event1
 SHLIB_MAJOR=   1
 PRIVATELIB=
 

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Thu May 28 22:05:33 2020
(r361606)
+++ head/share/mk/src.libnames.mk   Thu May 28 22:05:50 2020
(r361607)
@@ -18,7 +18,7 @@ _PRIVATELIBS= \
auditd \
bsdstat \
devdctl \
-   event \
+   event1 \
gmock \
gtest \
gmock_main \

Modified: head/usr.sbin/ftp-proxy/Makefile
==
--- head/usr.sbin/ftp-proxy/MakefileThu May 28 22:05:33 2020
(r361606)
+++ head/usr.sbin/ftp-proxy/MakefileThu May 28 22:05:50 2020
(r361607)
@@ -9,7 +9,7 @@ SRCS=   ftp-proxy.c filter.c
 
 CFLAGS+=-I${SRCTOP}/contrib/pf/libevent
 
-LIBADD=event
+LIBADD=event1
 
 WARNS?=3
 

Modified: head/usr.sbin/ypldap/Makefile
==
--- head/usr.sbin/ypldap/Makefile   Thu May 28 22:05:33 2020
(r361606)
+++ head/usr.sbin/ypldap/Makefile   Thu May 28 22:05:50 2020
(r361607)
@@ -9,7 +9,7 @@ SRCS=   parse.y ypldap.c log.c  \
 
 MAN=   ypldap.8 ypldap.conf.5
 
-LIBADD=openbsd event util rpcsvc
+LIBADD=openbsd event1 util rpcsvc
 
 CFLAGS+=-I${.CURDIR}
 CFLAGS+=-I${SRCTOP}/contrib/pf/libevent
___
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: r361613 - head/sys/kern

2020-05-28 Thread John Baldwin
Author: jhb
Date: Fri May 29 00:09:12 2020
New Revision: 361613
URL: https://svnweb.freebsd.org/changeset/base/361613

Log:
  Permit SO_NO_DDP and SO_NO_OFFLOAD to be read via getsockopt(2).
  
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24627

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Fri May 29 00:05:43 2020(r361612)
+++ head/sys/kern/uipc_socket.c Fri May 29 00:09:12 2020(r361613)
@@ -3231,6 +3231,8 @@ sogetopt(struct socket *so, struct sockopt *sopt)
case SO_TIMESTAMP:
case SO_BINTIME:
case SO_NOSIGPIPE:
+   case SO_NO_DDP:
+   case SO_NO_OFFLOAD:
optval = so->so_options & sopt->sopt_name;
 integer:
error = sooptcopyout(sopt, , sizeof optval);
___
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: r361610 - head/sys/sys

2020-05-28 Thread John Baldwin
On 5/28/20 4:57 PM, Rick Macklem wrote:
> Author: rmacklem
> Date: Thu May 28 23:57:50 2020
> New Revision: 361610
> URL: https://svnweb.freebsd.org/changeset/base/361610
> 
> Log:
>   Oops, missed syscall.h and sysproto.h for r361602.
>   
>   Pointy hat goes on me.

I still have a diff in sys/syscall.mk after rerunning make sysent FWIW.

Index: sys/sys/syscall.mk
===
--- sys/sys/syscall.mk  (revision 361612)
+++ sys/sys/syscall.mk  (working copy)
@@ -416,4 +416,5 @@
shm_rename.o \
sigfastblock.o \
__realpathat.o \
-   close_range.o
+   close_range.o \
+   rpctls_syscall.o


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


svn commit: r361616 - head/sys/cam/ctl

2020-05-28 Thread Alexander Motin
Author: mav
Date: Fri May 29 02:32:48 2020
New Revision: 361616
URL: https://svnweb.freebsd.org/changeset/base/361616

Log:
  Move EXPDATASN/R2TSN from PDU to CTL_PRIV_FRONTEND.
  
  We any way have per-I/O space in CTL_PRIV_FRONTEND, while for PDU private
  fields I have better use ideas.  Plus to me such use of PDU fields looked
  a layering violation.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Fri May 29 00:46:31 2020
(r361615)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Fri May 29 02:32:48 2020
(r361616)
@@ -143,9 +143,18 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxtags, CTL
 
 #defineCONN_SESSION(X) ((struct cfiscsi_session 
*)(X)->ic_prv0)
 #definePDU_SESSION(X)  CONN_SESSION((X)->ip_conn)
-#definePDU_EXPDATASN(X)(X)->ip_prv0
-#definePDU_R2TSN(X)(X)->ip_prv2
 
+struct cfiscsi_priv {
+   void*request;
+   uint32_t expdatasn;
+   uint32_t r2tsn;
+};
+#definePRIV(io)\
+((struct cfiscsi_priv *)&(io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND])
+#definePRIV_REQUEST(io)PRIV(io)->request
+#definePRIV_EXPDATASN(io)  PRIV(io)->expdatasn
+#definePRIV_R2TSN(io)  PRIV(io)->r2tsn
+
 static int cfiscsi_init(void);
 static int cfiscsi_shutdown(void);
 static voidcfiscsi_online(void *arg);
@@ -512,7 +521,7 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *reques
}
io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref);
ctl_zero_io(io);
-   io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = request;
+   PRIV_REQUEST(io) = request;
io->io_hdr.io_type = CTL_IO_SCSI;
io->io_hdr.nexus.initid = cs->cs_ctl_initid;
io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port;
@@ -568,7 +577,7 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *reques
bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs;
io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref);
ctl_zero_io(io);
-   io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = request;
+   PRIV_REQUEST(io) = request;
io->io_hdr.io_type = CTL_IO_TASK;
io->io_hdr.nexus.initid = cs->cs_ctl_initid;
io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port;
@@ -1105,7 +1114,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session
return; /* No target yet, so nothing to do. */
io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref);
ctl_zero_io(io);
-   io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = cs;
+   PRIV_REQUEST(io) = cs;
io->io_hdr.io_type = CTL_IO_TASK;
io->io_hdr.nexus.initid = cs->cs_ctl_initid;
io->io_hdr.nexus.targ_port = cs->cs_target->ct_port.targ_port;
@@ -2426,7 +2435,7 @@ cfiscsi_datamove_in(union ctl_io *io)
const char *sg_addr;
int ctl_sg_count, error, i;
 
-   request = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
+   request = PRIV_REQUEST(io);
cs = PDU_SESSION(request);
 
bhssc = (const struct iscsi_bhs_scsi_command *)request->ip_bhs;
@@ -2495,8 +2504,7 @@ cfiscsi_datamove_in(union ctl_io *io)
bhsdi->bhsdi_initiator_task_tag =
bhssc->bhssc_initiator_task_tag;
bhsdi->bhsdi_target_transfer_tag = 0x;
-   bhsdi->bhsdi_datasn = htonl(PDU_EXPDATASN(request));
-   PDU_EXPDATASN(request)++;
+   bhsdi->bhsdi_datasn = htonl(PRIV_EXPDATASN(io)++);
bhsdi->bhsdi_buffer_offset = htonl(buffer_offset);
}
 
@@ -2640,7 +2648,7 @@ cfiscsi_datamove_out(union ctl_io *io)
uint32_t target_transfer_tag;
bool done;
 
-   request = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
+   request = PRIV_REQUEST(io);
cs = PDU_SESSION(request);
 
bhssc = (const struct iscsi_bhs_scsi_command *)request->ip_bhs;
@@ -2753,8 +2761,7 @@ cfiscsi_datamove_out(union ctl_io *io)
 *  be running concurrently on several CPUs for a given
 *  command.
 */
-   bhsr2t->bhsr2t_r2tsn = htonl(PDU_R2TSN(request));
-   PDU_R2TSN(request)++;
+   bhsr2t->bhsr2t_r2tsn = htonl(PRIV_R2TSN(io)++);
/*
 * This is the offset within the current SCSI command;
 * i.e. for the first call of datamove(), it will be 0,
@@ -2799,7 +2806,7 @@ cfiscsi_scsi_command_done(union ctl_io *io)
struct cfiscsi_session *cs;
uint16_t sense_length;
 
-   request = 

svn commit: r361617 - head/sys/opencrypto

2020-05-28 Thread John Baldwin
Author: jhb
Date: Fri May 29 05:41:21 2020
New Revision: 361617
URL: https://svnweb.freebsd.org/changeset/base/361617

Log:
  Increment the correct pointer when a crypto buffer spans an mbuf or iovec.
  
  When a crypto_cursor_copyback() request spanned multiple mbufs or
  iovecs, the pointer into the mbuf/iovec was incremented instead of the
  pointer into the source buffer being copied from.
  
  PR:   246737
  Reported by:  Jenkins, ZFS test suite
  Sponsored by: Netflix

Modified:
  head/sys/opencrypto/criov.c

Modified: head/sys/opencrypto/criov.c
==
--- head/sys/opencrypto/criov.c Fri May 29 02:32:48 2020(r361616)
+++ head/sys/opencrypto/criov.c Fri May 29 05:41:21 2020(r361617)
@@ -266,7 +266,7 @@ crypto_cursor_copyback(struct crypto_buffer_cursor *cc
remain = cc->cc_mbuf->m_len - cc->cc_offset;
todo = MIN(remain, size);
memcpy(dst, src, todo);
-   dst += todo;
+   src += todo;
if (todo < remain) {
cc->cc_offset += todo;
break;
@@ -284,7 +284,7 @@ crypto_cursor_copyback(struct crypto_buffer_cursor *cc
remain = cc->cc_iov->iov_len - cc->cc_offset;
todo = MIN(remain, size);
memcpy(dst, src, todo);
-   dst += todo;
+   src += todo;
if (todo < remain) {
cc->cc_offset += todo;
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361610 - head/sys/sys

2020-05-28 Thread Rick Macklem
Author: rmacklem
Date: Thu May 28 23:57:50 2020
New Revision: 361610
URL: https://svnweb.freebsd.org/changeset/base/361610

Log:
  Oops, missed syscall.h and sysproto.h for r361602.
  
  Pointy hat goes on me.

Modified:
  head/sys/sys/syscall.h
  head/sys/sys/sysproto.h

Modified: head/sys/sys/syscall.h
==
--- head/sys/sys/syscall.h  Thu May 28 23:55:46 2020(r361609)
+++ head/sys/sys/syscall.h  Thu May 28 23:57:50 2020(r361610)
@@ -511,4 +511,5 @@
 #defineSYS_sigfastblock573
 #defineSYS___realpathat574
 #defineSYS_close_range 575
-#defineSYS_MAXSYSCALL  576
+#defineSYS_rpctls_syscall  576
+#defineSYS_MAXSYSCALL  577

Modified: head/sys/sys/sysproto.h
==
--- head/sys/sys/sysproto.h Thu May 28 23:55:46 2020(r361609)
+++ head/sys/sys/sysproto.h Thu May 28 23:57:50 2020(r361610)
@@ -1832,6 +1832,10 @@ struct close_range_args {
char highfd_l_[PADL_(u_int)]; u_int highfd; char 
highfd_r_[PADR_(u_int)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 };
+struct rpctls_syscall_args {
+   char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
+   char path_l_[PADL_(const char *)]; const char * path; char 
path_r_[PADR_(const char *)];
+};
 intnosys(struct thread *, struct nosys_args *);
 void   sys_sys_exit(struct thread *, struct sys_exit_args *);
 intsys_fork(struct thread *, struct fork_args *);
@@ -,6 +2226,7 @@ int   sys_shm_rename(struct thread *, struct 
shm_rename_
 intsys_sigfastblock(struct thread *, struct sigfastblock_args *);
 intsys___realpathat(struct thread *, struct __realpathat_args *);
 intsys_close_range(struct thread *, struct close_range_args *);
+intsys_rpctls_syscall(struct thread *, struct rpctls_syscall_args *);
 
 #ifdef COMPAT_43
 
@@ -3152,6 +3157,7 @@ int   freebsd12_closefrom(struct thread *, struct 
freebs
 #defineSYS_AUE_sigfastblockAUE_NULL
 #defineSYS_AUE___realpathatAUE_REALPATHAT
 #defineSYS_AUE_close_range AUE_CLOSERANGE
+#defineSYS_AUE_rpctls_syscall  AUE_NULL
 
 #undef PAD_
 #undef PADL_
___
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: r361609 - head/sys/cam/ctl

2020-05-28 Thread Alexander Motin
Author: mav
Date: Thu May 28 23:55:46 2020
New Revision: 361609
URL: https://svnweb.freebsd.org/changeset/base/361609

Log:
  Remove PDU_TOTAL_TRANSFER_LEN() macro.
  
  I don't see a point to copy io->scsiio.kern_total_len into the request
  PDU private field.  The io is going to stay with us till the end, and
  kern_total_len field is not changed after being first initialized.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Thu May 28 23:23:49 2020
(r361608)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Thu May 28 23:55:46 2020
(r361609)
@@ -144,7 +144,6 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxtags, CTL
 #defineCONN_SESSION(X) ((struct cfiscsi_session 
*)(X)->ic_prv0)
 #definePDU_SESSION(X)  CONN_SESSION((X)->ip_conn)
 #definePDU_EXPDATASN(X)(X)->ip_prv0
-#definePDU_TOTAL_TRANSFER_LEN(X)   (X)->ip_prv1
 #definePDU_R2TSN(X)(X)->ip_prv2
 
 static int cfiscsi_init(void);
@@ -2446,13 +2445,6 @@ cfiscsi_datamove_in(union ctl_io *io)
}
 
/*
-* This is the total amount of data to be transferred within the current
-* SCSI command.  We need to record it so that we can properly report
-* underflow/underflow.
-*/
-   PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len;
-
-   /*
 * This is the offset within the current SCSI command; for the first
 * call to cfiscsi_datamove() it will be 0, and for subsequent ones
 * it will be the sum of lengths of previous ones.
@@ -2611,17 +2603,17 @@ cfiscsi_datamove_in(union ctl_io *io)
bhsdi->bhsdi_flags |= BHSDI_FLAGS_F;
if (io->io_hdr.status == CTL_SUCCESS) {
bhsdi->bhsdi_flags |= BHSDI_FLAGS_S;
-   if (PDU_TOTAL_TRANSFER_LEN(request) <
+   if (io->scsiio.kern_total_len <

ntohl(bhssc->bhssc_expected_data_transfer_length)) {
bhsdi->bhsdi_flags |= 
BHSSR_FLAGS_RESIDUAL_UNDERFLOW;
bhsdi->bhsdi_residual_count =

htonl(ntohl(bhssc->bhssc_expected_data_transfer_length) -
-   PDU_TOTAL_TRANSFER_LEN(request));
-   } else if (PDU_TOTAL_TRANSFER_LEN(request) >
+   io->scsiio.kern_total_len);
+   } else if (io->scsiio.kern_total_len >

ntohl(bhssc->bhssc_expected_data_transfer_length)) {
bhsdi->bhsdi_flags |= 
BHSSR_FLAGS_RESIDUAL_OVERFLOW;
bhsdi->bhsdi_residual_count =
-   
htonl(PDU_TOTAL_TRANSFER_LEN(request) -
+   htonl(io->scsiio.kern_total_len -

ntohl(bhssc->bhssc_expected_data_transfer_length));
}
bhsdi->bhsdi_status = io->scsiio.scsi_status;
@@ -2657,12 +2649,6 @@ cfiscsi_datamove_out(union ctl_io *io)
("bhssc->bhssc_opcode != ISCSI_BHS_OPCODE_SCSI_COMMAND"));
 
/*
-* We need to record it so that we can properly report
-* underflow/underflow.
-*/
-   PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len;
-
-   /*
 * Complete write underflow.  Not a single byte to read.  Return.
 */
expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length);
@@ -2851,19 +2837,18 @@ cfiscsi_scsi_command_done(union ctl_io *io)
 * XXX: We don't deal with bidirectional under/overflows;
 *  does anything actually support those?
 */
-   if (PDU_TOTAL_TRANSFER_LEN(request) <
+   if (io->scsiio.kern_total_len <
ntohl(bhssc->bhssc_expected_data_transfer_length)) {
bhssr->bhssr_flags |= BHSSR_FLAGS_RESIDUAL_UNDERFLOW;
bhssr->bhssr_residual_count =
htonl(ntohl(bhssc->bhssc_expected_data_transfer_length) -
-   PDU_TOTAL_TRANSFER_LEN(request));
+   io->scsiio.kern_total_len);
//CFISCSI_SESSION_DEBUG(cs, "underflow; residual count %d",
//ntohl(bhssr->bhssr_residual_count));
-   } else if (PDU_TOTAL_TRANSFER_LEN(request) > 
+   } else if (io->scsiio.kern_total_len >
ntohl(bhssc->bhssc_expected_data_transfer_length)) {
bhssr->bhssr_flags |= 

svn commit: r361614 - head/sys/sys

2020-05-28 Thread Rick Macklem
Author: rmacklem
Date: Fri May 29 00:10:19 2020
New Revision: 361614
URL: https://svnweb.freebsd.org/changeset/base/361614

Log:
  Oops two, missed syscall.mk as well.

Modified:
  head/sys/sys/syscall.mk

Modified: head/sys/sys/syscall.mk
==
--- head/sys/sys/syscall.mk Fri May 29 00:09:12 2020(r361613)
+++ head/sys/sys/syscall.mk Fri May 29 00:10:19 2020(r361614)
@@ -416,4 +416,5 @@ MIASM =  \
shm_rename.o \
sigfastblock.o \
__realpathat.o \
-   close_range.o
+   close_range.o \
+   rpctls_syscall.o
___
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: r361615 - head/sys/powerpc/powerpc

2020-05-28 Thread Justin Hibbits
Author: jhibbits
Date: Fri May 29 00:46:31 2020
New Revision: 361615
URL: https://svnweb.freebsd.org/changeset/base/361615

Log:
  powerpc: Stop advertising that POWER8 and POWER9 support HTM
  
  HTM is on the chopping block, doesn't work on FreeBSD, and has only token
  support in PowerISA 3.1 and POWER10.  Don't advertise something we'll never
  support.

Modified:
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Fri May 29 00:10:19 2020
(r361614)
+++ head/sys/powerpc/powerpc/cpu.c  Fri May 29 00:46:31 2020
(r361615)
@@ -170,30 +170,26 @@ static const struct cputab models[] = {
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
   PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
-  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
-  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
-  PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_DSCR | PPC_FEATURE2_ISEL |
+  PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO, cpu_powerx_setup },
 { "IBM POWER8NVL", IBMPOWER8NVL,   REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
   PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
-  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
-  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
-  PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_DSCR | PPC_FEATURE2_ISEL |
+  PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO, cpu_powerx_setup },
 { "IBM POWER8",IBMPOWER8,  REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
   PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
-  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
-  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
-  PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_DSCR | PPC_FEATURE2_ISEL |
+  PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO, cpu_powerx_setup },
 { "IBM POWER9",IBMPOWER9,  REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
   PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
-  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR |
-  PPC_FEATURE2_EBB | PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR |
-  PPC_FEATURE2_HAS_VEC_CRYPTO | PPC_FEATURE2_HTM_NOSC |
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_DSCR | PPC_FEATURE2_EBB |
+  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO | 
   PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 |
   PPC_FEATURE2_DARN, cpu_powerx_setup },
 { "Motorola PowerPC 7400", MPC7400,REVFMT_MAJMIN,
___
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: r361612 - head/sys/mips/mips

2020-05-28 Thread Adrian Chadd
Author: adrian
Date: Fri May 29 00:05:43 2020
New Revision: 361612
URL: https://svnweb.freebsd.org/changeset/base/361612

Log:
  [mips] fix up the assembly generation of unaligned exception loads
  
  I noticed that unaligned accesses were returning garbage values.
  
  Give test data like this:
  
  char testdata[] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf1, 0x23, 
0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x5a };
  
  Iterating through uint32_t space 1 byte at a time should
  look like this:
  
  freebsd-carambola2:/mnt# ./test
  Hello, world!
  offset 0 pointer 0x410b00 value 0x12345678 0x12345678
  offset 1 pointer 0x410b01 value 0x3456789a 0x3456789a
  offset 2 pointer 0x410b02 value 0x56789abc 0x56789abc
  offset 3 pointer 0x410b03 value 0x789abcde 0x789abcde
  offset 4 pointer 0x410b04 value 0x9abcdef1 0x9abcdef1
  offset 5 pointer 0x410b05 value 0xbcdef123 0xbcdef123
  offset 6 pointer 0x410b06 value 0xdef12345 0xdef12345
  offset 7 pointer 0x410b07 value 0xf1234567 0xf1234567
  
  .. but to begin with it looked like this:
  
  offset 0 value 0x12345678
  offset 1 value 0x00410a9a
  offset 2 value 0x00419abc
  offset 3 value 0x009abcde
  offset 4 value 0x9abcdef1
  offset 5 value 0x00410a23
  offset 6 value 0x00412345
  offset 7 value 0x00234567
  
  The amusing reason? The compiler is generating the lwr/lwl incorrectly.
  Here's an example after I tried to replace the two macros with a single
  invocation and offset, rather than having the compiler compile in addiu
  to s3 - but the bug is the same:
  
  1044: 8a620003 lwl v0,0(s3)
  1048: 9a73 lwr s3,3(s3)
  
  .. which is just totally trashy and wrong.
  
  This explicitly tells the compiler to treat the output as being read
  and written to, which is what lwl/lwr does with the destination
  register.
  
  I think a subsequent commit should unify these macros to skip an addiu,
  but that can be a later commit.
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D25040

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

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Fri May 29 00:01:47 2020(r361611)
+++ head/sys/mips/mips/trap.c   Fri May 29 00:05:43 2020(r361612)
@@ -114,22 +114,22 @@ SYSCTL_INT(_machdep, OID_AUTO, trap_debug, CTLFLAG_RW,
 
 #definelwl_macro(data, addr)   
\
__asm __volatile ("lwl %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #definelwr_macro(data, addr)   
\
__asm __volatile ("lwr %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #defineldl_macro(data, addr)   
\
__asm __volatile ("ldl %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #defineldr_macro(data, addr)   
\
__asm __volatile ("ldr %0, 0x0(%1)" \
-   : "=r" (data)   /* outputs */   \
+   : "+r" (data)   /* outputs */   \
: "r" (addr));  /* inputs */
 
 #definesb_macro(data, addr)
\
@@ -1528,7 +1528,7 @@ mips_unaligned_load_store(struct trapframe *frame, int
 {
register_t *reg = (register_t *) frame;
u_int32_t inst = *((u_int32_t *)(intptr_t)pc);
-   register_t value_msb, value;
+   register_t value_msb = 0, value = 0;
unsigned size;
 
/*
___
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"