svn commit: r239307 - head/sys/arm/lpc

2012-08-15 Thread Jakub Wojciech Klama
Author: jceel
Date: Wed Aug 15 18:18:29 2012
New Revision: 239307
URL: http://svn.freebsd.org/changeset/base/239307

Log:
  Switch lpc initarm() to use struct arm_boot_params and therefore fix
  EA3250 kernel build.
  
  Approved by:  gonzo

Modified:
  head/sys/arm/lpc/lpc_machdep.c

Modified: head/sys/arm/lpc/lpc_machdep.c
==
--- head/sys/arm/lpc/lpc_machdep.c  Wed Aug 15 18:00:52 2012
(r239306)
+++ head/sys/arm/lpc/lpc_machdep.c  Wed Aug 15 18:18:29 2012
(r239307)
@@ -296,7 +296,7 @@ physmap_init(void)
 }
 
 void *
-initarm(void *mdp, void *unused __unused)
+initarm(struct arm_boot_params *abp)
 {
struct pv_addr kernel_l1pt;
struct pv_addr dpcpu;
@@ -306,41 +306,15 @@ initarm(void *mdp, void *unused __unused
u_int l1pagetable;
int i = 0, j = 0;
 
-   kmdp = NULL;
-   lastaddr = 0;
+   lastaddr = parse_boot_param(abp);
memsize = 0;
-   dtbp = (vm_offset_t)NULL;
-
set_cpufuncs();
 
-   /*
-* Mask metadata pointer: it is supposed to be on page boundary. If
-* the first argument (mdp) doesn't point to a valid address the
-* bootloader must have passed us something else than the metadata
-* ptr... In this case we want to fall back to some built-in settings.
-*/
-   mdp = (void *)((uint32_t)mdp  ~PAGE_MASK);
-
-   /* Parse metadata and fetch parameters */
-   if (mdp != NULL) {
-   preload_metadata = mdp;
-   kmdp = preload_search_by_type(elf kernel);
-   if (kmdp != NULL) {
-   boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
-   kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
-   dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t);
-   lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND,
-   vm_offset_t);
-#ifdef DDB
-   ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
-   ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);
-#endif
-   }
-
-   } else {
-   /* Fall back to hardcoded metadata. */
-   lastaddr = fake_preload_metadata();
-   }
+   kmdp = preload_search_by_type(elf kernel);
+   if (kmdp != NULL) 
+   dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t);
+   else
+   dtbp = (vm_offset_t)NULL;
 
 #if defined(FDT_DTB_STATIC)
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r226121 - in head: share/misc usr.bin/calendar/calendars

2011-10-07 Thread Jakub Wojciech Klama
Author: jceel
Date: Fri Oct  7 23:12:33 2011
New Revision: 226121
URL: http://svn.freebsd.org/changeset/base/226121

Log:
  Add myself.
  
  Approved by:  wkoszek (mentor)

Modified:
  head/share/misc/committers-src.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Oct  7 22:22:19 2011
(r226120)
+++ head/share/misc/committers-src.dot  Fri Oct  7 23:12:33 2011
(r226121)
@@ -153,6 +153,7 @@ iedowse [label=Ian Dowse\niedowse@FreeB
 imp [label=Warner Losh\n...@freebsd.org\n1996/09/20]
 ivoras [label=Ivan Voras\nivo...@freebsd.org\n2008/06/10]
 jamie [label=Jamie Gritton\nja...@freebsd.org\n2009/01/28]
+jceel [label=Jakub Klama\njc...@freebsd.org\n2011/09/25]
 jchandra [label=Jayachandran C.\njchan...@freebsd.org\n2010/05/19]
 jeff [label=Jeff Roberson\nj...@freebsd.org\n2002/02/21]
 jh [label=Jaakko Heinonen\n...@freebsd.org\n2009/10/02]
@@ -306,6 +307,7 @@ bz - anchie
 bz - jamie
 bz - syrinx
 
+cognet - jceel
 cognet - kevlo
 
 cperciva - flz
@@ -573,6 +575,8 @@ ume - tshiozak
 
 wes - scf
 
+wkoszek - jceel
+
 wollman - gad
 
 zml - mdf

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdFri Oct  7 22:22:19 
2011(r226120)
+++ head/usr.bin/calendar/calendars/calendar.freebsdFri Oct  7 23:12:33 
2011(r226121)
@@ -127,6 +127,7 @@
 04/17  Dryice Liu dry...@freebsd.org born in Jinan, Shandong, China, 1975
 04/22  Joerg Wunsch jo...@freebsd.org born in Dresden, Sachsen, Germany, 1962
 04/22  Jun Kuriyama kuriy...@freebsd.org born in Matsue, Shimane, Japan, 1973
+04/22  Jakub Klama jc...@freebsd.org born in Blachownia, Silesia, Poland, 
1989
 04/26  Rene Ladan r...@freebsd.org born in Geldrop, the Netherlands, 1980
 04/29  Adam Weinberger ad...@freebsd.org born in Berkeley, California, 
United States, 1980
 04/29  Eric Anholt anh...@freebsd.org born in Portland, Oregon, United 
States, 1983
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r295212 - head/usr.sbin/ctld

2016-02-03 Thread Jakub Wojciech Klama
Author: jceel
Date: Wed Feb  3 15:45:13 2016
New Revision: 295212
URL: https://svnweb.freebsd.org/changeset/base/295212

Log:
  Add an additional, libucl-based configuration file parser to ctld.
  
  Default ctld behavior remains unchanged - libucl parser can be selected
  explicitly by adding -u switch to ctld command line.
  
  Reviewed by:  trasz
  Approved by:  trasz (mentor)
  MFC after:1 month
  Relnotes: yes
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D4534

Added:
  head/usr.sbin/ctld/uclparse.c   (contents, props changed)
Modified:
  head/usr.sbin/ctld/Makefile
  head/usr.sbin/ctld/ctld.c
  head/usr.sbin/ctld/ctld.h
  head/usr.sbin/ctld/parse.y

Modified: head/usr.sbin/ctld/Makefile
==
--- head/usr.sbin/ctld/Makefile Wed Feb  3 15:16:20 2016(r295211)
+++ head/usr.sbin/ctld/Makefile Wed Feb  3 15:45:13 2016(r295212)
@@ -1,8 +1,11 @@
 # $FreeBSD$
 
+CFLAGS+=-I${.CURDIR}/../../contrib/libucl/include
+.PATH:  ${.CURDIR}/../../contrib/libucl/include
+
 PROG=  ctld
 SRCS=  chap.c ctld.c discovery.c isns.c kernel.c keys.c log.c
-SRCS+= login.c parse.y pdu.c token.l y.tab.h
+SRCS+= login.c parse.y pdu.c token.l y.tab.h uclparse.c
 CFLAGS+=   -I${.CURDIR}
 CFLAGS+=   -I${.CURDIR}/../../sys
 CFLAGS+=   -I${.CURDIR}/../../sys/cam/ctl
@@ -10,7 +13,7 @@ CFLAGS+=  -I${.CURDIR}/../../sys/dev/iscs
 #CFLAGS+=  -DICL_KERNEL_PROXY
 MAN=   ctld.8 ctl.conf.5
 
-LIBADD=bsdxml l md sbuf util
+LIBADD=bsdxml l md sbuf util ucl m
 
 YFLAGS+=   -v
 CLEANFILES=y.tab.c y.tab.h y.output

Modified: head/usr.sbin/ctld/ctld.c
==
--- head/usr.sbin/ctld/ctld.c   Wed Feb  3 15:16:20 2016(r295211)
+++ head/usr.sbin/ctld/ctld.c   Wed Feb  3 15:45:13 2016(r295212)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2491,6 +2492,104 @@ register_signals(void)
log_err(1, "sigaction");
 }
 
+static void
+check_perms(const char *path)
+{
+   struct stat sb;
+   int error;
+
+   error = stat(path, );
+   if (error != 0) {
+   log_warn("stat");
+   return;
+   }
+   if (sb.st_mode & S_IWOTH) {
+   log_warnx("%s is world-writable", path);
+   } else if (sb.st_mode & S_IROTH) {
+   log_warnx("%s is world-readable", path);
+   } else if (sb.st_mode & S_IXOTH) {
+   /*
+* Ok, this one doesn't matter, but still do it,
+* just for consistency.
+*/
+   log_warnx("%s is world-executable", path);
+   }
+
+   /*
+* XXX: Should we also check for owner != 0?
+*/
+}
+
+static struct conf *
+conf_new_from_file(const char *path, struct conf *oldconf, bool ucl)
+{
+   struct conf *conf;
+   struct auth_group *ag;
+   struct portal_group *pg;
+   struct pport *pp;
+   int error;
+
+   log_debugx("obtaining configuration from %s", path);
+
+   conf = conf_new();
+
+   TAILQ_FOREACH(pp, >conf_pports, pp_next)
+   pport_copy(pp, conf);
+
+   ag = auth_group_new(conf, "default");
+   assert(ag != NULL);
+
+   ag = auth_group_new(conf, "no-authentication");
+   assert(ag != NULL);
+   ag->ag_type = AG_TYPE_NO_AUTHENTICATION;
+
+   ag = auth_group_new(conf, "no-access");
+   assert(ag != NULL);
+   ag->ag_type = AG_TYPE_DENY;
+
+   pg = portal_group_new(conf, "default");
+   assert(pg != NULL);
+
+   if (ucl)
+   error = uclparse_conf(conf, path);
+   else
+   error = parse_conf(conf, path);
+
+   if (error != 0) {
+   conf_delete(conf);
+   return (NULL);
+   }
+
+   check_perms(path);
+
+   if (conf->conf_default_ag_defined == false) {
+   log_debugx("auth-group \"default\" not defined; "
+   "going with defaults");
+   ag = auth_group_find(conf, "default");
+   assert(ag != NULL);
+   ag->ag_type = AG_TYPE_DENY;
+   }
+
+   if (conf->conf_default_pg_defined == false) {
+   log_debugx("portal-group \"default\" not defined; "
+   "going with defaults");
+   pg = portal_group_find(conf, "default");
+   assert(pg != NULL);
+   portal_group_add_listen(pg, "0.0.0.0:3260", false);
+   portal_group_add_listen(pg, "[::]:3260", false);
+   }
+
+   conf->conf_kernel_port_on = true;
+
+   error = conf_verify(conf);
+   if (error != 0) {
+   conf_delete(conf);
+   return (NULL);
+   }
+
+   return (conf);
+}
+
 int
 main(int argc, char 

svn commit: r296808 - head/usr.sbin/ctld

2016-03-13 Thread Jakub Wojciech Klama
Author: jceel
Date: Sun Mar 13 19:50:17 2016
New Revision: 296808
URL: https://svnweb.freebsd.org/changeset/base/296808

Log:
  Check value returned from ucl_parser_add_file().
  
  Reviewed by:  trasz
  Approved by:  trasz (mentor)
  MFC after:1 month
  Sponsored by: iXsystems, Inc.

Modified:
  head/usr.sbin/ctld/uclparse.c

Modified: head/usr.sbin/ctld/uclparse.c
==
--- head/usr.sbin/ctld/uclparse.c   Sun Mar 13 19:42:59 2016
(r296807)
+++ head/usr.sbin/ctld/uclparse.c   Sun Mar 13 19:50:17 2016
(r296808)
@@ -886,9 +886,8 @@ uclparse_conf(struct conf *newconf, cons
 
conf = newconf;
parser = ucl_parser_new(0);
-   ucl_parser_add_file(parser, path);
 
-   if (ucl_parser_get_error(parser)) {
+   if (!ucl_parser_add_file(parser, path)) {
log_warn("unable to parse configuration file %s: %s", path,
ucl_parser_get_error(parser));
return (1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305898 - head/usr.sbin/bhyve

2016-09-17 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Sep 17 13:48:01 2016
New Revision: 305898
URL: https://svnweb.freebsd.org/changeset/base/305898

Log:
  Add virtio-console support to bhyve.
  
  Adds virtio-console device support to bhyve, allowing to create
  bidirectional character streams between host and guest.
  
  Syntax:
  -s ,virtio-console,port1=/path/to/port1.sock,anotherport=...
  
  Maximum of 16 ports per device can be created. Every port is named
  and corresponds to an Unix domain socket created by bhyve. bhyve
  accepts at most one connection per port at a time.
  
  Limitations:
  - due to lack of destructors of in bhyve, sockets on the filesystem
must be cleaned up manually after bhyve exits
  - there's no way to use "console port" feature, nor the console port
resize as of now
  - emergency write is advertised, but no-op as of now
  
  Approved by:  trasz
  MFC after:1 month
  Relnotes: yes
  Sponsored by: iXsystems, Inc.
  Differential Revision:D7185

Added:
  head/usr.sbin/bhyve/pci_virtio_console.c   (contents, props changed)
Modified:
  head/usr.sbin/bhyve/Makefile
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileSat Sep 17 11:43:51 2016
(r305897)
+++ head/usr.sbin/bhyve/MakefileSat Sep 17 13:48:01 2016
(r305898)
@@ -36,6 +36,7 @@ SRCS= \
pci_lpc.c   \
pci_passthru.c  \
pci_virtio_block.c  \
+   pci_virtio_console.c\
pci_virtio_net.c\
pci_virtio_rnd.c\
pci_uart.c  \

Added: head/usr.sbin/bhyve/pci_virtio_console.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/bhyve/pci_virtio_console.cSat Sep 17 13:48:01 2016
(r305898)
@@ -0,0 +1,631 @@
+/*-
+ * Copyright (c) 2016 iXsystems Inc.
+ * All rights reserved.
+ *
+ * This software was developed by Jakub Klama 
+ * under sponsorship from iXsystems Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer
+ *in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "bhyverun.h"
+#include "pci_emul.h"
+#include "virtio.h"
+#include "mevent.h"
+
+#defineVTCON_RINGSZ64
+#defineVTCON_MAXPORTS  16
+#defineVTCON_MAXQ  (VTCON_MAXPORTS * 2 + 2)
+
+#defineVTCON_DEVICE_READY  0
+#defineVTCON_DEVICE_ADD1
+#defineVTCON_DEVICE_REMOVE 2
+#defineVTCON_PORT_READY3
+#defineVTCON_CONSOLE_PORT  4
+#defineVTCON_CONSOLE_RESIZE5
+#defineVTCON_PORT_OPEN 6
+#defineVTCON_PORT_NAME 7
+
+#defineVTCON_F_SIZE0
+#defineVTCON_F_MULTIPORT   1
+#defineVTCON_F_EMERG_WRITE 2
+#defineVTCON_S_HOSTCAPS\
+(VTCON_F_SIZE | VTCON_F_MULTIPORT | VTCON_F_EMERG_WRITE)
+
+static int pci_vtcon_debug;
+#define DPRINTF(params) if (pci_vtcon_debug) printf params
+#define WPRINTF(params) printf params
+
+struct pci_vtcon_softc;
+struct pci_vtcon_port;
+struct pci_vtcon_config;
+typedef void (pci_vtcon_cb_t)(struct pci_vtcon_port *, void *, struct iovec *,
+int);
+
+struct pci_vtcon_port {
+   struct pci_vtcon_softc * vsp_sc;
+   int  vsp_id;
+   const char * vsp_name;
+   bool 

svn commit: r305900 - head/sys/dev/virtio/console

2016-09-17 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Sep 17 16:03:33 2016
New Revision: 305900
URL: https://svnweb.freebsd.org/changeset/base/305900

Log:
  Create aliases for named virtio-console ports.
  
  Make virtio_console(4) create `/dev/vtcon/` alias pointing
  to /dev/ttyVx.y upon receiving PORT_NAME (id = 7) event over the control
  queue.
  
  Approved by:  trasz
  MFC after:1 month
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D7182

Modified:
  head/sys/dev/virtio/console/virtio_console.c

Modified: head/sys/dev/virtio/console/virtio_console.c
==
--- head/sys/dev/virtio/console/virtio_console.cSat Sep 17 14:00:52 
2016(r305899)
+++ head/sys/dev/virtio/console/virtio_console.cSat Sep 17 16:03:33 
2016(r305900)
@@ -176,8 +176,10 @@ static void vtcon_ctrl_port_add_event(s
 static void vtcon_ctrl_port_remove_event(struct vtcon_softc *, int);
 static void vtcon_ctrl_port_console_event(struct vtcon_softc *, int);
 static void vtcon_ctrl_port_open_event(struct vtcon_softc *, int);
+static void vtcon_ctrl_port_name_event(struct vtcon_softc *, int,
+const char *, size_t);
 static void vtcon_ctrl_process_event(struct vtcon_softc *,
-struct virtio_console_control *);
+struct virtio_console_control *, void *, size_t);
 static void vtcon_ctrl_task_cb(void *, int);
 static void vtcon_ctrl_event_intr(void *);
 static void vtcon_ctrl_poll(struct vtcon_softc *,
@@ -611,8 +613,10 @@ vtcon_ctrl_event_create(struct vtcon_sof
struct virtio_console_control *control;
int error;
 
-   control = malloc(sizeof(struct virtio_console_control), M_DEVBUF,
-   M_ZERO | M_NOWAIT);
+   control = malloc(
+   sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ,
+   M_DEVBUF, M_ZERO | M_NOWAIT);
+
if (control == NULL)
return (ENOMEM);
 
@@ -796,8 +800,29 @@ vtcon_ctrl_port_open_event(struct vtcon_
 }
 
 static void
+vtcon_ctrl_port_name_event(struct vtcon_softc *sc, int id, const char *name,
+size_t len)
+{
+   device_t dev;
+   struct vtcon_softc_port *scport;
+   struct vtcon_port *port;
+
+   dev = sc->vtcon_dev;
+   scport = >vtcon_ports[id];
+
+   port = scport->vcsp_port;
+   if (port == NULL) {
+   device_printf(dev, "%s: name port %d, but does not exist\n",
+   __func__, id);
+   return;
+   }
+
+   tty_makealias(port->vtcport_tty, "vtcon/%*s", (int)len, name);
+}
+
+static void
 vtcon_ctrl_process_event(struct vtcon_softc *sc,
-struct virtio_console_control *control)
+struct virtio_console_control *control, void *payload, size_t plen)
 {
device_t dev;
int id;
@@ -831,6 +856,9 @@ vtcon_ctrl_process_event(struct vtcon_so
break;
 
case VIRTIO_CONSOLE_PORT_NAME:
+   if (payload != NULL && plen > 0)
+   vtcon_ctrl_port_name_event(sc, id,
+   (const char *)payload, plen);
break;
}
 }
@@ -842,6 +870,9 @@ vtcon_ctrl_task_cb(void *xsc, int pendin
struct virtqueue *vq;
struct virtio_console_control *control;
int detached;
+   uint32_t len;
+   size_t plen;
+   void *payload;
 
sc = xsc;
vq = sc->vtcon_ctrl_rxvq;
@@ -849,12 +880,20 @@ vtcon_ctrl_task_cb(void *xsc, int pendin
VTCON_LOCK(sc);
 
while ((detached = (sc->vtcon_flags & VTCON_FLAG_DETACHED)) == 0) {
-   control = virtqueue_dequeue(vq, NULL);
+   control = virtqueue_dequeue(vq, );
+   payload = NULL;
+   plen = 0;
+
if (control == NULL)
break;
 
+   if (len > sizeof(control)) {
+   payload = (void *)(control + 1);
+   plen = len - sizeof(control);
+   }
+
VTCON_UNLOCK(sc);
-   vtcon_ctrl_process_event(sc, control);
+   vtcon_ctrl_process_event(sc, control, payload, plen);
VTCON_LOCK(sc);
vtcon_ctrl_event_requeue(sc, control);
}
___
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: r309121 - head/usr.sbin/bhyve

2016-11-24 Thread Jakub Wojciech Klama
Author: jceel
Date: Thu Nov 24 22:16:18 2016
New Revision: 309121
URL: https://svnweb.freebsd.org/changeset/base/309121

Log:
  virtio_console: handle short writes to an Unix domain socket gracefully.
  
  writev() can do a short write.  Retrying it results in a very convoluted
  and complex code, so we iterate over iovec and do regular stream_write()
  instead.
  
  Approved by:  trasz
  Sponsored by: iXsystems, Inc.

Modified:
  head/usr.sbin/bhyve/pci_virtio_console.c

Modified: head/usr.sbin/bhyve/pci_virtio_console.c
==
--- head/usr.sbin/bhyve/pci_virtio_console.cThu Nov 24 21:53:42 2016
(r309120)
+++ head/usr.sbin/bhyve/pci_virtio_console.cThu Nov 24 22:16:18 2016
(r309121)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include "pci_emul.h"
 #include "virtio.h"
 #include "mevent.h"
+#include "sockstream.h"
 
 #defineVTCON_RINGSZ64
 #defineVTCON_MAXPORTS  16
@@ -425,16 +426,21 @@ pci_vtcon_sock_tx(struct pci_vtcon_port 
 int niov)
 {
struct pci_vtcon_sock *sock;
-   int ret;
+   int i, ret;
 
sock = (struct pci_vtcon_sock *)arg;
 
if (sock->vss_conn_fd == -1)
return;
 
-   ret = writev(sock->vss_conn_fd, iov, niov);
+   for (i = 0; i < niov; i++) {
+   ret = stream_write(sock->vss_conn_fd, iov[i].iov_base,
+   iov[i].iov_len);
+   if (ret <= 0)
+   break;
+   }
 
-   if (ret < 0 && errno != EWOULDBLOCK) {
+   if (ret <= 0) {
mevent_delete_close(sock->vss_conn_evp);
sock->vss_conn_fd = -1;
sock->vss_open = false;
___
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: r309120 - head/usr.sbin/bhyve

2016-11-24 Thread Jakub Wojciech Klama
Author: jceel
Date: Thu Nov 24 21:53:42 2016
New Revision: 309120
URL: https://svnweb.freebsd.org/changeset/base/309120

Log:
  Allow opening virtio-console ports from the host side before guest
  enumerates them.
  
  Approved by:  trasz
  Sponsored by: iXsystems, Inc.

Modified:
  head/usr.sbin/bhyve/pci_virtio_console.c

Modified: head/usr.sbin/bhyve/pci_virtio_console.c
==
--- head/usr.sbin/bhyve/pci_virtio_console.cThu Nov 24 21:32:04 2016
(r309119)
+++ head/usr.sbin/bhyve/pci_virtio_console.cThu Nov 24 21:53:42 2016
(r309120)
@@ -90,6 +90,7 @@ struct pci_vtcon_port {
bool vsp_enabled;
bool vsp_console;
bool vsp_rx_ready;
+   bool vsp_open;
int  vsp_rxq;
int  vsp_txq;
void *   vsp_arg;
@@ -116,6 +117,7 @@ struct pci_vtcon_softc {
char *   vsc_rootdir;
int  vsc_kq;
int  vsc_nports;
+   bool vsc_ready;
struct pci_vtcon_portvsc_control_port;
struct pci_vtcon_portvsc_ports[VTCON_MAXPORTS];
struct pci_vtcon_config *vsc_config;
@@ -359,6 +361,7 @@ pci_vtcon_sock_accept(int fd __unused, e
sock->vss_open = true;
sock->vss_conn_fd = s;
sock->vss_conn_evp = mevent_add(s, EVF_READ, pci_vtcon_sock_rx, sock);
+
pci_vtcon_open_port(sock->vss_port, true);
 }
 
@@ -454,11 +457,15 @@ pci_vtcon_control_tx(struct pci_vtcon_po
 
switch (ctrl->event) {
case VTCON_DEVICE_READY:
+   sc->vsc_ready = true;
/* set port ready events for registered ports */
for (i = 0; i < VTCON_MAXPORTS; i++) {
tmp = >vsc_ports[i];
if (tmp->vsp_enabled)
pci_vtcon_announce_port(tmp);
+
+   if (tmp->vsp_open)
+   pci_vtcon_open_port(tmp, true);
}
break;
 
@@ -500,6 +507,11 @@ pci_vtcon_open_port(struct pci_vtcon_por
 {
struct pci_vtcon_control event;
 
+   if (!port->vsp_sc->vsc_ready) {
+   port->vsp_open = true;
+   return;
+   }
+
event.id = port->vsp_id;
event.event = VTCON_PORT_OPEN;
event.value = (int)open;
___
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: r308566 - head/sys/dev/virtio/console

2016-11-11 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Nov 12 01:41:43 2016
New Revision: 308566
URL: https://svnweb.freebsd.org/changeset/base/308566

Log:
  Reserve space for control message payload (currently a port name).
  
  Approved by:  trasz (mentor)
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/dev/virtio/console/virtio_console.c

Modified: head/sys/dev/virtio/console/virtio_console.c
==
--- head/sys/dev/virtio/console/virtio_console.cSat Nov 12 00:23:09 
2016(r308565)
+++ head/sys/dev/virtio/console/virtio_console.cSat Nov 12 01:41:43 
2016(r308566)
@@ -600,7 +600,7 @@ vtcon_ctrl_event_enqueue(struct vtcon_so
 
sglist_init(, 2, segs);
error = sglist_append(, control,
-   sizeof(struct virtio_console_control));
+   sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ);
KASSERT(error == 0, ("%s: error %d adding control to sglist",
__func__, error));
 
@@ -633,7 +633,8 @@ vtcon_ctrl_event_requeue(struct vtcon_so
 {
int error;
 
-   bzero(control, sizeof(struct virtio_console_control));
+   bzero(control, sizeof(struct virtio_console_control) +
+   VTCON_BULK_BUFSZ);
 
error = vtcon_ctrl_event_enqueue(sc, control);
KASSERT(error == 0,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361054 - head/contrib/lib9p

2020-05-14 Thread Jakub Wojciech Klama
Author: jceel
Date: Thu May 14 19:57:52 2020
New Revision: 361054
URL: https://svnweb.freebsd.org/changeset/base/361054

Log:
  Import lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.
  
  Approved by:  trasz
  MFC after:1 month
  Sponsored by: Conclusive Engineering (development), vStack.com (funding)

Added:
  head/contrib/lib9p/
 - copied from r361050, vendor/lib9p/dist/
___
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: r366412 - head/contrib/lib9p/transport

2020-10-03 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Oct  3 18:52:54 2020
New Revision: 366412
URL: https://svnweb.freebsd.org/changeset/base/366412

Log:
  Import lib9p 9d5aee77bcc1bf0e79b0a3bfefff5fdf2146283c.
  
  Approved by:  trasz (mentor)
  Sponsored by: Conclusive Engineering Sp. z o. o.

Modified:
  head/contrib/lib9p/transport/socket.c
Directory Properties:
  head/contrib/lib9p/   (props changed)

Modified: head/contrib/lib9p/transport/socket.c
==
--- head/contrib/lib9p/transport/socket.c   Sat Oct  3 18:49:00 2020
(r366411)
+++ head/contrib/lib9p/transport/socket.c   Sat Oct  3 18:52:54 2020
(r366412)
@@ -307,7 +307,7 @@ l9p_socket_send_response(struct l9p_request *req __unu
 
 static void
 l9p_socket_drop_response(struct l9p_request *req __unused,
-const struct iovec *iov, size_t niov __unused, void *arg)
+const struct iovec *iov, size_t niov __unused, void *arg __unused)
 {
 
L9P_LOG(L9P_DEBUG, "%p: drop buf=%p", arg, iov[0].iov_base);
___
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: r366413 - in head: etc/mtree lib lib/lib9p share/mk usr.sbin/bhyve

2020-10-03 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Oct  3 19:05:13 2020
New Revision: 366413
URL: https://svnweb.freebsd.org/changeset/base/366413

Log:
  Add virtio-9p (aka VirtFS) filesystem sharing to bhyve.
  
  VirtFS allows sharing an arbitrary directory tree between bhyve virtual
  machine and the host. Current implementation has a fairly complete support
  for 9P2000.L protocol, except for the extended attribute support. It has
  been verified to work with the qemu-kvm hypervisor.
  
  Reviewed by:  rgrimes, emaste, jhb, trasz
  Approved by:  trasz (mentor)
  MFC after:1 month
  Relnotes: yes
  Sponsored by: Conclusive Engineering (development), vStack.com (funding)
  Differential Revision:https://reviews.freebsd.org/D10335

Added:
  head/lib/lib9p/
  head/lib/lib9p/Makefile   (contents, props changed)
  head/usr.sbin/bhyve/pci_virtio_9p.c   (contents, props changed)
Modified:
  head/etc/mtree/BSD.include.dist
  head/lib/Makefile
  head/share/mk/bsd.libnames.mk
  head/share/mk/src.libnames.mk
  head/usr.sbin/bhyve/Makefile
  head/usr.sbin/bhyve/bhyve.8
  head/usr.sbin/bhyve/virtio.h

Modified: head/etc/mtree/BSD.include.dist
==
--- head/etc/mtree/BSD.include.dist Sat Oct  3 18:52:54 2020
(r366412)
+++ head/etc/mtree/BSD.include.dist Sat Oct  3 19:05:13 2020
(r366413)
@@ -193,6 +193,8 @@
 ..
 lib80211
 ..
+lib9p
+..
 libipt
 ..
 libmilter

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Sat Oct  3 18:52:54 2020(r366412)
+++ head/lib/Makefile   Sat Oct  3 19:05:13 2020(r366413)
@@ -30,6 +30,7 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
.WAIT \
libsqlite3 \
geom \
+   lib9p \
libalias \
libarchive \
libauditd \

Added: head/lib/lib9p/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/lib9p/Makefile Sat Oct  3 19:05:13 2020(r366413)
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../contrib/lib9p
+CFLAGS+=   -DWITH_CASPER
+CFLAGS+=   -I${.CURDIR}
+CFLAGS+=   -I${.CURDIR}/../../contrib/lib9p
+
+LIB=   9p
+PACKAGE=   lib${LIB}
+SHLIB_MAJOR=   1
+SRCS=  connection.c \
+   genacl.c \
+   hashtable.c \
+   log.c \
+   pack.c \
+   request.c \
+   rfuncs.c \
+   threadpool.c \
+   utils.c \
+   backend/fs.c \
+   transport/socket.c
+
+INCSDIR=   ${INCLUDEDIR}/lib9p
+INCS=  fid.h lib9p.h backend/fs.h
+
+LIBADD=sbuf
+
+.include 

Modified: head/share/mk/bsd.libnames.mk
==
--- head/share/mk/bsd.libnames.mk   Sat Oct  3 18:52:54 2020
(r366412)
+++ head/share/mk/bsd.libnames.mk   Sat Oct  3 19:05:13 2020
(r366413)
@@ -17,6 +17,7 @@ LIBDESTDIR=   ${SYSROOT:U${DESTDIR}}
 LIBCRT0?=  ${LIBDESTDIR}${LIBDIR_BASE}/crt0.o
 
 LIB80211?= ${LIBDESTDIR}${LIBDIR_BASE}/lib80211.a
+LIB9P?=${LIBDESTDIR}${LIBDIR_BASE}/lib9p.a
 LIBALIAS?= ${LIBDESTDIR}${LIBDIR_BASE}/libalias.a
 LIBARCHIVE?=   ${LIBDESTDIR}${LIBDIR_BASE}/libarchive.a
 LIBASN1?=  ${LIBDESTDIR}${LIBDIR_BASE}/libasn1.a

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Sat Oct  3 18:52:54 2020
(r366412)
+++ head/share/mk/src.libnames.mk   Sat Oct  3 19:05:13 2020
(r366413)
@@ -70,6 +70,7 @@ _LIBRARIES=   \
${_INTERNALLIBS} \
${LOCAL_LIBRARIES} \
80211 \
+   9p \
alias \
archive \
asn1 \
@@ -246,6 +247,7 @@ LIBVERIEXEC?=   ${LIBVERIEXECDIR}/libveriexec.a
 # Each library's LIBADD needs to be duplicated here for static linkage of
 # 2nd+ order consumers.  Auto-generating this would be better.
 _DP_80211= sbuf bsdxml
+_DP_9p=sbuf
 _DP_archive=   z bz2 lzma bsdxml zstd
 _DP_zstd=  pthread
 .if ${MK_BLACKLIST} != "no"

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileSat Oct  3 18:52:54 2020
(r366412)
+++ head/usr.sbin/bhyve/MakefileSat Oct  3 19:05:13 2020
(r366413)
@@ -3,6 +3,7 @@
 #
 
 .include 
+CFLAGS+=-I${.CURDIR}/../../contrib/lib9p
 CFLAGS+=-I${SRCTOP}/sys
 .PATH:  ${SRCTOP}/sys/cam/ctl
 
@@ -47,6 +48,7 @@ SRCS= \
pci_lpc.c   \
pci_nvme.c  \
pci_passthru.c  \
+   pci_virtio_9p.c \