Skip to contentSkip to conversation

tools: add support for FreeBSD

PATCH Superseded Roger Pau Monne 2 participants 42 messages Jun 2, 2014 – Jun 18, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover tools: add support for FreeBSD

This patch series adds support for using the tools on FreeBSD. The series can also be found on my git repo:

git://xenbits.xen.org/people/royger/xen.git branch freebsd_tools_v2
http://xenbits.xen.org/gitweb/?p=people/royger/xen.git;a=shortlog;h=refs/heads/freebsd_tools_v2

Some of the patches have already been acked, and they are marked with a * in the following list:

[PATCH v2 01/17] configure: make the libaio test conditional on [PATCH v2 02/17] configure: disable qemu-trad on FreeBSD systems by [PATCH v2 03/17] configure: disable ROMBIOS if qemu-trad is disabled
*[PATCH v2 04/17] include: import FreeBSD headers for evtchn and
[PATCH v2 05/17] libxc: add support for FreeBSD
[PATCH v2 06/17] libxc: remove broken endianess gate on lz4 [PATCH v2 07/17] xenstored: unify xenstored OS-specific bits [PATCH v2 08/17] xenstored: add FreeBSD xenstored device paths [PATCH v2 09/17] console: add FreeBSD includes
[PATCH v2 10/17] init: add FreeBSD xencommons init script [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge
[PATCH v2 12/17] libxl: add FreeBSD OS support
[PATCH v2 13/17] libxl: add support for FreeBSD uuid implementation
*[PATCH v2 14/17] libxl: only include utmp.h if it's present
[PATCH v2 15/17] libxl: allow usage of char devices as block
*[PATCH v2 16/17] hvmloader: remove size_t typedef and include
[PATCH v2 17/17] build: export linker emulation parameter to SeaBIOS

Thanks, Roger.

#1 lore raw

PATCH v2 1/17 configure: make the libaio test conditional on blktap1

libaio is only required for blktap1, so make the check conditional on whether the user has requested blktap1 or not.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Please re-run autoconf after applying this patch.

---
 tools/configure.ac |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/configure.ac +2 -0
index 25d7ca3..3b30560 100644
@@ -224,7 +224,9 @@ AC_CHECK_HEADER([lzo/lzo1x.h], [
 AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"])
 ])
 AC_SUBST(zlib)
+AS_IF([test "x$enable_blktap1" = "xyes"], [
 AC_CHECK_LIB([aio], [io_setup], [], [AC_MSG_ERROR([Could not find libaio])])
+])
 AC_SUBST(system_aio)
 AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
 AX_CHECK_EXTFS
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v2 01/17] configure: make the libaio test conditional on blktap1

Quoted 2 lines · Roger Pau Monne

libaio is only required for blktap1, so make the check conditional on whether the user has requested blktap1 or not.

I think it is used for blktap2 as well.

I thought blktap2 was Linux specific (and hence that the libaio could be too) but, from tools/Makefile:
SUBDIRS-$(CONFIG_Linux) += blktap2
SUBDIRS-$(CONFIG_NetBSD) += blktap2

I'm totally surprised by that! And TBH I find it a little hard to believe...

Ian.

#3 lore raw

Re: [PATCH v2 01/17] configure: make the libaio test conditional on blktap1

Quoted 5 lines · Ian Campbell
Quoted 2 lines · Roger Pau Monne

libaio is only required for blktap1, so make the check conditional on whether the user has requested blktap1 or not.

I think it is used for blktap2 as well.

OK, I have such a mess with blktap versions and which ones are inside of the tree. Right now configure only allows enabling/disabling blktap1, and blktap2 is compiled depending on the host OS version. Should I change blktap2 to be selected on configure and disabled by default? (just like blktap1)

Quoted 7 lines

I thought blktap2 was Linux specific (and hence that the libaio could be too) but, from tools/Makefile:
SUBDIRS-$(CONFIG_Linux) += blktap2
SUBDIRS-$(CONFIG_NetBSD) += blktap2

I'm totally surprised by that! And TBH I find it a little hard to believe...

Yes, this is certainly a mistake, NetBSD never had anything similar to blktap2 AFAIK.

Roger.

#4 lore raw

Re: [PATCH v2 01/17] configure: make the libaio test conditional on blktap1

Quoted 5 lines · Roger Pau Monné
Quoted 4 lines · Ian Campbell
Quoted 2 lines · Roger Pau Monne

libaio is only required for blktap1, so make the check conditional on whether the user has requested blktap1 or not.

Quoted 7 lines
Quoted 1 line

I think it is used for blktap2 as well.

OK, I have such a mess with blktap versions and which ones are inside of the tree. Right now configure only allows enabling/disabling blktap1, and blktap2 is compiled depending on the host OS version. Should I change blktap2 to be selected on configure and disabled by default? (just like blktap1)

That might be an interesting change but I wouldn't want to intertwine it with the FreeBSD support for fear that someone objects.

Less controversial would be to move the host OS version check for blktap2 into configure and use it as the default, and then base the libaio check on that?

Quoted 10 lines
Quoted 7 lines

I thought blktap2 was Linux specific (and hence that the libaio could be too) but, from tools/Makefile:
SUBDIRS-$(CONFIG_Linux) += blktap2
SUBDIRS-$(CONFIG_NetBSD) += blktap2

I'm totally surprised by that! And TBH I find it a little hard to believe...

Yes, this is certainly a mistake, NetBSD never had anything similar to blktap2 AFAIK.

Looking at tools/blktap2/Makefile it looks like the lvm and vhd bits would be build on BSD but not drivers or control. I've no idea how useful the lvm and vhd stuff is on NetBSD...

However: the aio stuff is strictly in the drivers subtree. So I think you can just make the libaio check conditional on Linux only. If you also want to improve the situation around blktap2 configuration then I think that would be wonderful, but not required for this series.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

PATCH v2 2/17 configure: disable qemu-trad on FreeBSD systems by default

In reply to Roger Pau Monne
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Please rerun configure after applying.

---
 tools/configure.ac |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
tools/configure.ac +6 -1
index 3b30560..1684405 100644
@@ -61,12 +61,17 @@ AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for x86, otherwise off)]),,[
+                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
     case "$host_cpu" in
         i[[3456]]86|x86_64)
            enable_qemu_traditional="yes";;
         *) enable_qemu_traditional="no";;
     esac
+    case "$host_os" in
+        freebsd*)
+           enable_qemu_traditional="no";;
+    esac
+
 ])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#7 lore raw

PATCH v2 3/17 configure: disable ROMBIOS if qemu-trad is disabled

In reply to Roger Pau Monne

ROMBIOS only works with qemu-traditional, so if it is disabled, disable ROMBIOS also.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Please rerun configure after applying.

---
 tools/configure.ac |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
tools/configure.ac +16 -1
index 1684405..9dcfe81 100644
@@ -54,7 +54,6 @@ AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
 AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
-AX_ARG_DEFAULT_ENABLE([rombios], [Disable ROM BIOS])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
@@ -80,6 +79,22 @@ AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
 ])
 AC_SUBST(qemu_traditional)
 
+AC_ARG_ENABLE([rombios],
+    AS_HELP_STRING([--enable-rombios],
+                   [Enable ROMBIOS, (DEFAULT is on if qemu-traditional is enabled, otherwise off)]),,[
+    AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+        enable_rombios="yes"
+    ], [
+        enable_rombios="no"
+    ])
+])
+AS_IF([test "x$enable_rombios" = "xyes"], [
+AC_DEFINE([HAVE_ROMBIOS], [1], [ROMBIOS enabled])
+    rombios=y],[
+    rombios=n
+])
+AC_SUBST(rombios)
+
 AC_ARG_WITH([system-qemu],
     AS_HELP_STRING([--with-system-qemu@<:@=PATH@:>@],
        [Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 3/17
#8 lore raw

Re: [PATCH v2 03/17] configure: disable ROMBIOS if qemu-trad is disabled

Quoted 5 lines · Roger Pau Monne

ROMBIOS only works with qemu-traditional, so if it is disabled, disable ROMBIOS also.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw

PATCH v2 4/17 include: import FreeBSD headers for evtchn and privcmd devices

In reply to Roger Pau Monne
---
 tools/include/xen-sys/FreeBSD/evtchn.h  |   87 +++++++++++++++++++++++++++++++
 tools/include/xen-sys/FreeBSD/privcmd.h |   64 ++++++++++++++++++++++
 2 files changed, 151 insertions(+), 0 deletions(-)
 create mode 100644 tools/include/xen-sys/FreeBSD/evtchn.h
 create mode 100644 tools/include/xen-sys/FreeBSD/privcmd.h
tools/include/xen-sys/FreeBSD/evtchn.h new file +87 -0
new file mode 100644
index 0000000..00fa67e
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * evtchn.h
+ * 
+ * Interface to /dev/xen/evtchn.
+ * 
+ * Copyright (c) 2003-2005, K A Fraser
+ * 
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __XEN_EVTCHN_H__
+#define __XEN_EVTCHN_H__
+
+/*
+ * Bind a fresh port to VIRQ @virq.
+ */
+#define IOCTL_EVTCHN_BIND_VIRQ				\
+	_IOWR('E', 4, struct ioctl_evtchn_bind_virq)
+struct ioctl_evtchn_bind_virq {
+	unsigned int virq;
+	unsigned int port;
+};
+
+/*
+ * Bind a fresh port to remote <@remote_domain, @remote_port>.
+ */
+#define IOCTL_EVTCHN_BIND_INTERDOMAIN			\
+	_IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
+struct ioctl_evtchn_bind_interdomain {
+	unsigned int remote_domain, remote_port;
+	unsigned int port;
+};
+
+/*
+ * Allocate a fresh port for binding to @remote_domain.
+ */
+#define IOCTL_EVTCHN_BIND_UNBOUND_PORT			\
+	_IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
+struct ioctl_evtchn_bind_unbound_port {
+	unsigned int remote_domain;
+	unsigned int port;
+};
+
+/*
+ * Unbind previously allocated @port.
+ */
+#define IOCTL_EVTCHN_UNBIND				\
+	_IOW('E', 7, struct ioctl_evtchn_unbind)
+struct ioctl_evtchn_unbind {
+	unsigned int port;
+};
+
+/*
+ * Send event to previously allocated @port.
+ */
+#define IOCTL_EVTCHN_NOTIFY				\
+	_IOW('E', 8, struct ioctl_evtchn_notify)
+struct ioctl_evtchn_notify {
+	unsigned int port;
+};
+
+/* Clear and reinitialise the event buffer. Clear error condition. */
+#define IOCTL_EVTCHN_RESET				\
+	_IO('E', 9)
+
+#endif /* __XEN_EVTCHN_H__ */
tools/include/xen-sys/FreeBSD/privcmd.h new file +64 -0

64 lines not on this page · raw message

Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#10 lore raw

PATCH v2 5/17 libxc: add support for FreeBSD

In reply to Roger Pau Monne

Add the FreeBSD implementation of the privcmd and evtchn devices interface.

The evtchn device interface is the same as the Linux one, while the privcmd map interface is simplified because FreeBSD only supports IOCTL_PRIVCMD_MMAPBATCH.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxc/Makefile           |    1 +
 tools/libxc/xc_freebsd.c       |   72 +++++++
 tools/libxc/xc_freebsd_osdep.c |  405 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 478 insertions(+), 0 deletions(-)
 create mode 100644 tools/libxc/xc_freebsd.c
 create mode 100644 tools/libxc/xc_freebsd_osdep.c
tools/libxc/Makefile +1 -0
index a74b19e..16c61f1 100644
@@ -36,6 +36,7 @@ CTRL_SRCS-y       += xtl_core.c
 CTRL_SRCS-y       += xtl_logger_stdio.c
 CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c xc_linux_osdep.c
+CTRL_SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c xc_freebsd_osdep.c
 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
 CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c
 CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c
tools/libxc/xc_freebsd.c new file +72 -0

72 lines not on this page · raw message

tools/libxc/xc_freebsd_osdep.c new file +405 -0

405 lines not on this page · raw message

Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 5/17
#11 lore raw

Re: [PATCH v2 05/17] libxc: add support for FreeBSD

Quoted 9 lines · Roger Pau Monne

Add the FreeBSD implementation of the privcmd and evtchn devices interface.

The evtchn device interface is the same as the Linux one, while the privcmd map interface is simplified because FreeBSD only supports IOCTL_PRIVCMD_MMAPBATCH.

Given that this is mostly a clone and hack of the existing support for other OSes and that it's unfir to ask you to cleanup that mess:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

PATCH v2 6/17 libxc: remove broken endianess gate on lz4 decompressor

In reply to Roger Pau Monne

The lz4 decompressor had wrongly implemented a gate between little-endian and big-endian versions of get_unaligned_le{16/32}, which turns out to be broken on all architectures supported by Xen, because __LITTLE_ENDIAN is not defined. Instead of trying to fix this, just implement the little-endian version and remove the switch.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxc/xc_dom_decompress_lz4.c |    1 -
 xen/common/lz4/defs.h               |   14 --------------
 2 files changed, 0 insertions(+), 15 deletions(-)
tools/libxc/xc_dom_decompress_lz4.c +0 -1
index 08272fe..490ec56 100644
@@ -1,7 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
-#include <endian.h>
 #include <stdint.h>
 
 #include "xg_private.h"
xen/common/lz4/defs.h +0 -14
index f46df08..d886a4e 100644
@@ -12,7 +12,6 @@
 #include <asm/byteorder.h>
 #endif
 
-#ifdef __LITTLE_ENDIAN
 static inline u16 INIT get_unaligned_le16(const void *p)
 {
 	return le16_to_cpup(p);
@@ -22,19 +21,6 @@ static inline u32 INIT get_unaligned_le32(const void *p)
 {
 	return le32_to_cpup(p);
 }
-#else
-#include <asm/unaligned.h>
-
-static inline u16 INIT get_unaligned_le16(const void *p)
-{
-	return le16_to_cpu(__get_unaligned(p, 2));
-}
-
-static inline u32 INIT get_unaligned_le32(void *p)
-{
-	return le32_to_cpu(__get_unaligned(p, 4));
-}
-#endif
 
 /*
  * Detects 64 bits mode
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 6/17
#13 lore raw

Re: [PATCH v2 06/17] libxc: remove broken endianess gate on lz4 decompressor

Quoted 5 lines · Roger Pau Monne

The lz4 decompressor had wrongly implemented a gate between little-endian and big-endian versions of get_unaligned_le{16/32}, which turns out to be broken on all architectures supported by Xen, because __LITTLE_ENDIAN is not defined. Instead of trying to fix this, just implement the little-endian version and remove the switch.

AFAICT the so called "little endian" versions are perfectly fine for be too -- since they use le32_to_cpup.

Quoted 2 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#14 lore raw

PATCH v2 7/17 xenstored: unify xenstored OS-specific bits

In reply to Roger Pau Monne

The Solaris implementation seems too different, so this patch only folds both the Linux and NetBSD implementations.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/xenstore/Makefile           |    4 +-
 tools/xenstore/xenstored_linux.c  |   73 -------------------------------------
 tools/xenstore/xenstored_netbsd.c |   73 -------------------------------------
 tools/xenstore/xenstored_osdep.h  |   17 +++++++++
 tools/xenstore/xenstored_posix.c  |   54 +++++++++++++++++++++++++++
 5 files changed, 73 insertions(+), 148 deletions(-)
 delete mode 100644 tools/xenstore/xenstored_linux.c
 delete mode 100644 tools/xenstore/xenstored_netbsd.c
 create mode 100644 tools/xenstore/xenstored_osdep.h
tools/xenstore/Makefile +2 -2
index b626104..c0c7bb2 100644
@@ -13,9 +13,9 @@ CLIENTS += xenstore-write xenstore-ls xenstore-watch
 
 XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
-XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
-XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_netbsd.o xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
 
 XENSTORED_OBJS += $(XENSTORED_OBJS_y)
tools/xenstore/xenstored_linux.c deleted +0 -73

73 lines not on this page · raw message

tools/xenstore/xenstored_netbsd.c deleted +0 -73

73 lines not on this page · raw message

tools/xenstore/xenstored_osdep.h new file +17 -0
new file mode 100644
index 0000000..73c6461
@@ -0,0 +1,17 @@
+/*
+ * OS specific bits for xenstored
+ * Copyright (C) 2014 Citrix Systems R&D.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License.
+ */
+
+#if defined(__linux__)
+#define XENSTORED_KVA_DEV  "/proc/xen/xsd_kva"
+#define XENSTORED_PORT_DEV "/proc/xen/xsd_port"
+#elif defined(__NetBSD__)
+#define XENSTORED_KVA_DEV  "/dev/xsd_kva"
+#define XENSTORED_PORT_DEV "/kern/xen/xsd_port"
+#endif
tools/xenstore/xenstored_posix.c +54 -0

63 lines not on this page · raw message

Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 7/17
#15 lore raw

Re: [PATCH v2 07/17] xenstored: unify xenstored OS-specific bits

Quoted 5 lines · Roger Pau Monne

The Solaris implementation seems too different, so this patch only folds both the Linux and NetBSD implementations.

git am whinges about some new trailing whitespace though if you end up needing to resend for some other reason.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#16 lore raw

PATCH v2 8/17 xenstored: add FreeBSD xenstored device paths

In reply to Roger Pau Monne

Add the path to FreeBSD special xenstored device, this is all that's needed to get xenstored working on FreeBSD after the unification of the implementations.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/xenstore/Makefile          |    1 +
 tools/xenstore/xenstored_osdep.h |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
tools/xenstore/Makefile +1 -0
index c0c7bb2..e34bd41 100644
@@ -16,6 +16,7 @@ XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored
 XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
 XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
+XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
 
 XENSTORED_OBJS += $(XENSTORED_OBJS_y)
tools/xenstore/xenstored_osdep.h +3 -0
index 73c6461..b3e630c 100644
@@ -14,4 +14,7 @@
 #elif defined(__NetBSD__)
 #define XENSTORED_KVA_DEV  "/dev/xsd_kva"
 #define XENSTORED_PORT_DEV "/kern/xen/xsd_port"
+#elif defined(__FreeBSD__)
+#define XENSTORED_KVA_DEV  "/dev/xen/xenstored"
+#define XENSTORED_PORT_DEV "/dev/xen/xenstored"
 #endif
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 8/17
#17 lore raw

Re: [PATCH v2 08/17] xenstored: add FreeBSD xenstored device paths

tools/xenstore/xenstored_osdep.h line 19

Quoted 3 lines · Roger Pau Monne
tools/xenstore/xenstored_osdep.h +3 -0
+#elif defined(__FreeBSD__)
+#define XENSTORED_KVA_DEV  "/dev/xen/xenstored"
+#define XENSTORED_PORT_DEV "/dev/xen/xenstored"

Assuming these are really both supposed to be the same:

Ian.

#18 lore raw

Re: [PATCH v2 08/17] xenstored: add FreeBSD xenstored device paths

Quoted 7 lines · Ian Campbell

tools/xenstore/xenstored_osdep.h line 19

Quoted 3 lines · Roger Pau Monne
tools/xenstore/xenstored_osdep.h +3 -0
+#elif defined(__FreeBSD__)
+#define XENSTORED_KVA_DEV  "/dev/xen/xenstored"
+#define XENSTORED_PORT_DEV "/dev/xen/xenstored"

Assuming these are really both supposed to be the same:

Yes, it's the same device:

http://xenbits.xen.org/gitweb/?p=people/royger/freebsd.git;a=patch;h=d4add101f0846c064001037d14c185dfe6d2f50e

In fact I don't really understand why Linux has two different devices, probably a legacy issue?

Roger.

#19 lore raw

Re: [PATCH v2 08/17] xenstored: add FreeBSD xenstored device paths

Quoted 9 lines · Roger Pau Monné
Quoted 7 lines · Ian Campbell

tools/xenstore/xenstored_osdep.h line 19

Quoted 3 lines · Roger Pau Monne
tools/xenstore/xenstored_osdep.h +3 -0
+#elif defined(__FreeBSD__)
+#define XENSTORED_KVA_DEV  "/dev/xen/xenstored"
+#define XENSTORED_PORT_DEV "/dev/xen/xenstored"

Assuming these are really both supposed to be the same:

Quoted 6 lines

Yes, it's the same device:

http://xenbits.xen.org/gitweb/?p=people/royger/freebsd.git;a=patch;h=d4add101f0846c064001037d14c185dfe6d2f50e

In fact I don't really understand why Linux has two different devices, probably a legacy issue?

They used to be /proc/xen/foo which contained the raw numbers rather than having ioctls done etc. Might be somethign to do with that.

Quoted 3 lines

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#20 lore raw

PATCH v2 9/17 console: add FreeBSD includes

In reply to Roger Pau Monne

Add FreeBSD specific includes to the console daemon.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Changes since v1:
- Removed FreeBSD specific include of termios.h.
- Move sys/types.h include outside of the FreeBSD specific section.

---
 tools/console/daemon/io.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tools/console/daemon/io.c +4 -0
index 007ecf4..46719a8 100644
@@ -37,12 +37,16 @@
 #include <sys/mman.h>
 #include <time.h>
 #include <assert.h>
+#include <sys/types.h>
 #if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <util.h>
 #elif defined(__linux__)
 #include <pty.h>
 #elif defined(__sun__)
 #include <stropts.h>
+#elif defined(__FreeBSD__)
+#include <sys/ioctl.h>
+#include <libutil.h>
 #endif
 
 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#22 lore raw

PATCH v2 10/17 init: add FreeBSD xencommons init script

In reply to Roger Pau Monne

This is a clone of the NetBSD xencommons init script with some minor modifications.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/hotplug/FreeBSD/Makefile        |   43 ++++++++++++
 tools/hotplug/FreeBSD/rc.d/xencommons |  121 +++++++++++++++++++++++++++++++++
 tools/hotplug/Makefile                |    1 +
 3 files changed, 165 insertions(+), 0 deletions(-)
 create mode 100644 tools/hotplug/FreeBSD/Makefile
 create mode 100644 tools/hotplug/FreeBSD/rc.d/xencommons
tools/hotplug/FreeBSD/Makefile new file +43 -0
new file mode 100644
index 0000000..c7ffc51
@@ -0,0 +1,43 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+# Xen script dir and scripts to go there.
+XEN_SCRIPTS =
+
+XEN_SCRIPT_DATA =
+
+XEN_RCD_PROG = rc.d/xencommons
+
+.PHONY: all
+all:
+
+.PHONY: build
+build:
+
+.PHONY: install
+install: all install-scripts install-rcd
+
+.PHONY: install-scripts
+install-scripts:
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+	set -e; for i in $(XEN_SCRIPTS); \
+	   do \
+	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
+	done
+	set -e; for i in $(XEN_SCRIPT_DATA); \
+	   do \
+	   $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
+	done
+
+.PHONY: install-rcd
+install-rcd:
+	$(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/rc.d
+	set -e; for i in $(XEN_RCD_PROG); \
+	   do \
+	   $(INSTALL_PROG) $$i $(DESTDIR)$(CONFIG_DIR)/rc.d; \
+	   sed -i '' 's,@xen_script_dir@,$(DESTDIR)$(XEN_SCRIPT_DIR),g' $(DESTDIR)$(CONFIG_DIR)/$$i; \
+	done
+	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_SCRIPT_DIR)
+
+.PHONY: clean
+clean:
tools/hotplug/FreeBSD/rc.d/xencommons new file +121 -0

121 lines not on this page · raw message

tools/hotplug/Makefile +1 -0
index f147b59..14ae9a8 100644
@@ -4,6 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS-y := common
 SUBDIRS-$(CONFIG_NetBSD) += NetBSD
 SUBDIRS-$(CONFIG_Linux) += Linux
+SUBDIRS-$(CONFIG_FreeBSD) += FreeBSD
 
 .PHONY: all clean install
 all clean install: %: subdirs-%
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 10/17
#23 lore raw

Re: [PATCH v2 10/17] init: add FreeBSD xencommons init script

Quoted 2 lines · Roger Pau Monne

This is a clone of the NetBSD xencommons init script with some minor modifications.

On that basis:

#24 lore raw

PATCH v2 11/17 hotplug: add FreeBSD vif-bridge

In reply to Roger Pau Monne

Add a simple vif-bridge script, that takes care of adding network backends (tap or xnb) to a pre-configured bridge.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Changes since v1:
- Remove "x" prefix from variable names.

---
 tools/hotplug/FreeBSD/Makefile   |    2 +-
 tools/hotplug/FreeBSD/vif-bridge |   41 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletions(-)
 create mode 100644 tools/hotplug/FreeBSD/vif-bridge
tools/hotplug/FreeBSD/Makefile +1 -1
index c7ffc51..6480aa5 100644
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS =
+XEN_SCRIPTS = vif-bridge
 
 XEN_SCRIPT_DATA =
 
tools/hotplug/FreeBSD/vif-bridge new file +41 -0

41 lines not on this page · raw message

Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#25 lore raw

Re: [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge

tools/hotplug/FreeBSD/vif-bridge line 7

Quoted 3 lines · Roger Pau Monne
tools/hotplug/FreeBSD/vif-bridge new file +3 -0
+# Parameters:
+#      $1: xenstore backend path of the vif
+#      $2: action, either "add" or "remove"

On Linux path ($1) is in $XENBUS_PATH and action ($2) is the first parameter. Does libxl really call the hotplug scripts in a platform specific manner?

Ian.

#26 lore raw

Re: [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge

Quoted 8 lines · Ian Campbell

tools/hotplug/FreeBSD/vif-bridge line 7

Quoted 3 lines · Roger Pau Monne
tools/hotplug/FreeBSD/vif-bridge new file +3 -0
+# Parameters:
+#      $1: xenstore backend path of the vif
+#      $2: action, either "add" or "remove"

On Linux path ($1) is in $XENBUS_PATH and action ($2) is the first parameter. Does libxl really call the hotplug scripts in a platform specific manner?

Yes, hotplug scripts are platform dependant, the arguments/env variables are set in libxl_{linux/netbsd/freebsd}.c, although I wouldn't mind changing the order, it seems more natural to have the action first and then the backend path IMHO.

Roger.

#27 lore raw

Re: [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge

Quoted 10 lines · Roger Pau Monné
Quoted 8 lines · Ian Campbell

tools/hotplug/FreeBSD/vif-bridge line 7

Quoted 3 lines · Roger Pau Monne
tools/hotplug/FreeBSD/vif-bridge new file +3 -0
+# Parameters:
+#      $1: xenstore backend path of the vif
+#      $2: action, either "add" or "remove"

On Linux path ($1) is in $XENBUS_PATH and action ($2) is the first parameter. Does libxl really call the hotplug scripts in a platform specific manner?

Quoted 2 lines

Yes, hotplug scripts are platform dependant, the arguments/env variables are set in libxl_{linux/netbsd/freebsd}.c,

so I (now) see :-/

Quoted 3 lines

although I wouldn't mind
changing the order, it seems more natural to have the action first and then the backend path IMHO.

I think consistency with *bsd is more important. having three different ways of doing this would be madness ;-)

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#28 lore raw

Re: [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge

Quoted 14 lines · Ian Campbell
Quoted 10 lines · Roger Pau Monné
Quoted 8 lines · Ian Campbell

tools/hotplug/FreeBSD/vif-bridge line 7

Quoted 3 lines · Roger Pau Monne
tools/hotplug/FreeBSD/vif-bridge new file +3 -0
+# Parameters:
+#      $1: xenstore backend path of the vif
+#      $2: action, either "add" or "remove"

On Linux path ($1) is in $XENBUS_PATH and action ($2) is the first parameter. Does libxl really call the hotplug scripts in a platform specific manner?

Quoted 2 lines

Yes, hotplug scripts are platform dependant, the arguments/env variables are set in libxl_{linux/netbsd/freebsd}.c,

Quoted 8 lines

so I (now) see :-/

Quoted 3 lines

although I wouldn't mind
changing the order, it seems more natural to have the action first and then the backend path IMHO.

I think consistency with *bsd is more important. having three different ways of doing this would be madness ;-)

OK, now I see why I've done it this way, because the vif-bridge script is a clone of the NetBSD one and follows the same order, so yes, for consistency this should be kept as-is.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#29 lore raw

PATCH v2 12/17 libxl: add FreeBSD OS support

In reply to Roger Pau Monne

Create a new libxl_freebsd.c file that contains OS-specific bits used by libxl.

This currently defines which backend to use to handle disks, and which hotplug scripts to execute.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxl/Makefile        |    4 +
 tools/libxl/libxl_freebsd.c |  133 +++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_osdeps.h  |    5 ++
 3 files changed, 142 insertions(+), 0 deletions(-)
 create mode 100644 tools/libxl/libxl_freebsd.c
tools/libxl/Makefile +4 -0
index 4cfa275..7fc42c8 100644
@@ -52,10 +52,14 @@ else
 ifeq ($(CONFIG_Linux),y)
 LIBXL_OBJS-y += libxl_linux.o
 else
+ifeq ($(CONFIG_FreeBSD),y)
+LIBXL_OBJS-y += libxl_freebsd.o
+else
 $(error Your Operating System is not supported by libxenlight, \
 please check libxl_linux.c and libxl_netbsd.c to see how to get it ported)
 endif
 endif
+endif
 
 ifeq ($(FLEX),)
 %.c %.h:: %.l
tools/libxl/libxl_freebsd.c new file +133 -0

133 lines not on this page · raw message

tools/libxl/libxl_osdeps.h +5 -0
index aea83ee..08eaf0c 100644
@@ -37,6 +37,11 @@
 #include <pty.h>
 #elif defined(__sun__)
 #include <stropts.h>
+#elif defined(__FreeBSD__)
+#define SYSFS_PCI_DEV          "/dev/null"
+#define SYSFS_PCIBACK_DRIVER   "/dev/null"
+#define NETBACK_NIC_NAME       "xnb%u.%d"
+#include <libutil.h>
 #endif
 
 #ifndef SYSFS_PCIBACK_DRIVER
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#30 lore raw

Re: [PATCH v2 12/17] libxl: add FreeBSD OS support

Quoted 5 lines · Roger Pau Monne

Create a new libxl_freebsd.c file that contains OS-specific bits used by libxl.

This currently defines which backend to use to handle disks, and which hotplug scripts to execute.

This answers my question about the per-platform hotplug script interfaces. Since this is consistent with NetBSD for both this and the vif-bridge patch: Acked-by: Ian Campbell <[email protected]>

#31 lore raw

PATCH v2 13/17 libxl: add support for FreeBSD uuid implementation

In reply to Roger Pau Monne

Add the FreeBSD specific uuid implementation. Since uuid_t is not defined as an array, but as a struct on FreeBSD, use a union with a array in order to be able to return the uuid as a bytearray.

Also, added a libxl internal compile time assert macro, that is used to assert that the size of uuid_t is the same as the union used in libxl.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxl/libxl_internal.h |    4 +++
 tools/libxl/libxl_uuid.c     |   51 ++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_uuid.h     |   12 ++++++++++
 3 files changed, 67 insertions(+), 0 deletions(-)
tools/libxl/libxl_internal.h +4 -0
index c2b73c4..9f8ab49 100644
@@ -3085,6 +3085,10 @@ void libxl__numa_candidate_put_nodemap(libxl__gc *gc,
  */
 #define CTYPE(isfoo,c) (isfoo((unsigned char)(c)))
 
+/*
+ * Compile time assertion
+ */
+#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
 
 #endif
 
tools/libxl/libxl_uuid.c +51 -0

57 lines not on this page · raw message

tools/libxl/libxl_uuid.h +12 -0
index 93c65a7..3604180 100644
@@ -47,6 +47,18 @@ typedef struct {
     uint8_t uuid[16];
 } libxl_uuid;
 
+#elif defined(__FreeBSD__)
+
+#include <uuid.h>
+#include <stdint.h>
+
+typedef union {
+    uuid_t uuid;
+    uint8_t uuid_raw[16];
+} libxl_uuid;
+
+#define LIBXL_UUID_BYTES(arg) LIBXL__UUID_BYTES(arg.uuid_raw)
+
 #else
 
 #error "Please update libxl_uuid.h for your OS"
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#32 lore raw

Re: [PATCH v2 13/17] libxl: add support for FreeBSD uuid implementation

Quoted 7 lines · Roger Pau Monne

Add the FreeBSD specific uuid implementation. Since uuid_t is not defined as an array, but as a struct on FreeBSD, use a union with a array in order to be able to return the uuid as a bytearray.

Also, added a libxl internal compile time assert macro, that is used to assert that the size of uuid_t is the same as the union used in libxl.

This is incredibly similar to the FreeBS version, could this not be done with a few choice || defined(__FreeBSD__) (adding the union you've got here or not as you choose)?

Ian.

#33 lore raw

PATCH v2 14/17 libxl: only include utmp.h if it's present

In reply to Roger Pau Monne

Add a configure check for utmp.h presence, and gate the usage of utmp.h in libxl to the result of the test.

---
 tools/config.h.in              |    3 +++
 tools/configure.ac             |    2 +-
 tools/libxl/libxl_bootloader.c |    2 ++
 3 files changed, 6 insertions(+), 1 deletions(-)
tools/config.h.in +3 -0
index 015f2a1..e29985d 100644
@@ -51,6 +51,9 @@
 /* Define to 1 if you have the <yajl/yajl_version.h> header file. */
 #undef HAVE_YAJL_YAJL_VERSION_H
 
+/* Define to 1 if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
+
 /* Define curses header to use */
 #undef INCLUDE_CURSES_H
 
tools/configure.ac +1 -1
index 9dcfe81..61e19ac 100644
@@ -267,7 +267,7 @@ AC_CHECK_LIB([fdt], [fdt_create], [], [AC_MSG_ERROR([Could not find libfdt])])
 esac
 
 # Checks for header files.
-AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h])
+AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h utmp.h])
 
 AC_OUTPUT()
 
tools/libxl/libxl_bootloader.c +2 -0
index 3287bf7..c3ec782 100644
@@ -15,7 +15,9 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 
 #include <termios.h>
+#ifdef HAVE_UTMP_H
 #include <utmp.h>
+#endif
 
 #ifdef INCLUDE_LIBUTIL_H
 #include INCLUDE_LIBUTIL_H
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#34 lore raw

PATCH v2 15/17 libxl: allow usage of char devices as block backends

In reply to Roger Pau Monne

On FreeBSD ZVOLs/disks/partitions are char devices, so libxl must allow it's usage.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxl/libxl_device.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/libxl/libxl_device.c +2 -1
index fa99f77..7dd359c 100644
@@ -266,7 +266,8 @@ int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
             return ERROR_INVAL;
         }
         if (!S_ISBLK(a.stab.st_mode) &
-            !S_ISREG(a.stab.st_mode)) {
+            !S_ISREG(a.stab.st_mode) &
+            !S_ISCHR(a.stab.st_mode)) {
             LOG(ERROR, "Disk vdev=%s phys path is not a block dev or file: %s",
                        disk->vdev, disk->pdev_path);
             return ERROR_INVAL;
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#35 lore raw

Re: [PATCH v2 15/17] libxl: allow usage of char devices as block backends

Quoted 2 lines · Roger Pau Monne

On FreeBSD ZVOLs/disks/partitions are char devices, so libxl must allow it's usage.

Are they really, how... interesting...

Do we think this should be made platform specific?

Quoted 12 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/libxl/libxl_device.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/libxl/libxl_device.c +0 -0
index fa99f77..7dd359c 100644

tools/libxl/libxl_device.c int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) { · line 273

Quoted 9 lines
tools/libxl/libxl_device.c +2 -1
@@ -266,7 +266,8 @@ int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
             return ERROR_INVAL;
         }
         if (!S_ISBLK(a.stab.st_mode) &
-            !S_ISREG(a.stab.st_mode)) {
+            !S_ISREG(a.stab.st_mode) &
+            !S_ISCHR(a.stab.st_mode)) {
             LOG(ERROR, "Disk vdev=%s phys path is not a block dev or file: %s",
                        disk->vdev, disk->pdev_path);
             return ERROR_INVAL;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#36 lore raw

Re: [PATCH v2 15/17] libxl: allow usage of char devices as block backends

Quoted 7 lines · Ian Campbell
Quoted 2 lines · Roger Pau Monne

On FreeBSD ZVOLs/disks/partitions are char devices, so libxl must allow it's usage.

Are they really, how... interesting...

Do we think this should be made platform specific?

This is already platform specific, see libxl__try_phy_backend in libxl_{linux/netbsd}.c, the problem is that we had this generic gate in libxl_device.c that only allows block or regular files to be tested for 'phy' support. If it's more suitable, I think we can get rid of this gate in libxl_device and rely on the OS specific version of libxl__try_phy_backend to do the checking.

Roger.

#37 lore raw

Re: [PATCH v2 15/17] libxl: allow usage of char devices as block backends

Quoted 7 lines · Roger Pau Monné
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Roger Pau Monne

On FreeBSD ZVOLs/disks/partitions are char devices, so libxl must allow it's usage.

Are they really, how... interesting...

Quoted 9 lines
Quoted 1 line

Do we think this should be made platform specific?

This is already platform specific, see libxl__try_phy_backend in libxl_{linux/netbsd}.c, the problem is that we had this generic gate in libxl_device.c that only allows block or regular files to be tested for 'phy' support. If it's more suitable, I think we can get rid of this gate in libxl_device and rely on the OS specific version of libxl__try_phy_backend to do the checking.

That does sound more sensible -- Ian (J) do you remember how we ended up with it like this?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#38 lore raw

PATCH v2 16/17 hvmloader: remove size_t typedef and include stddef.h

In reply to Roger Pau Monne

The open coded typedef of size_t was clashing with the typedef in FreeBSD headers. Remove the typedef and include the proper header where size_t is defined (stddef.h).

---
 tools/firmware/hvmloader/util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/firmware/hvmloader/util.h +1 -1
index 9ccb905..46d32b9 100644
@@ -3,6 +3,7 @@
 
 #include <stdarg.h>
 #include <stdint.h>
+#include <stddef.h>
 #include <xen/xen.h>
 #include <xen/hvm/hvm_info_table.h>
 
@@ -174,7 +175,6 @@ int printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 int vprintf(const char *fmt, va_list ap);
 
 /* Buffer output */
-typedef unsigned long size_t;
 int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
 
 /* Populate specified memory hole with RAM. */
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#39 lore raw

PATCH v2 17/17 build: export linker emulation parameter to SeaBIOS

In reply to Roger Pau Monne
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>

---
Changes since v1:
- Rework LD32BIT-y to only be defined on FreeBSD.

---
 tools/firmware/Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
tools/firmware/Makefile +3 -1
index dcb56e5..bdd0d55 100644
@@ -17,6 +17,8 @@ SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
 SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
 SUBDIRS-y += hvmloader
 
+LD32BIT-$(CONFIG_FreeBSD) := LD32BIT_FLAG=-melf_i386_fbsd
+
 ovmf-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf-dir
 	cp ovmf-makefile ovmf-dir/Makefile;
@@ -36,7 +38,7 @@ ifeq ($(CONFIG_ROMBIOS),y)
 	false ; \
 	fi
 endif
-	$(MAKE) CC=$(CC) PYTHON=$(PYTHON) subdirs-$@
+	$(MAKE) $(LD32BIT-y) CC=$(CC) PYTHON=$(PYTHON) subdirs-$@
 
 
 .PHONY: install
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#41 lore raw
In reply to Roger Pau Monne
Quoted 8 lines · Roger Pau Monne

This patch series adds support for using the tools on FreeBSD. The series can also be found on my git repo:

git://xenbits.xen.org/people/royger/xen.git branch freebsd_tools_v2
http://xenbits.xen.org/gitweb/?p=people/royger/xen.git;a=shortlog;h=refs/heads/freebsd_tools_v2

Some of the patches have already been acked, and they are marked with a * in the following list:

I just applied:

Quoted 6 lines

[PATCH v2 02/17] configure: disable qemu-trad on FreeBSD systems by [PATCH v2 03/17] configure: disable ROMBIOS if qemu-trad is disabled
*[PATCH v2 04/17] include: import FreeBSD headers for evtchn and
[PATCH v2 05/17] libxc: add support for FreeBSD
[PATCH v2 06/17] libxc: remove broken endianess gate on lz4 [PATCH v2 07/17] xenstored: unify xenstored OS-specific bits

Quoted 8 lines

[PATCH v2 08/17] xenstored: add FreeBSD xenstored device paths [PATCH v2 09/17] console: add FreeBSD includes
[PATCH v2 10/17] init: add FreeBSD xencommons init script [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge
[PATCH v2 12/17] libxl: add FreeBSD OS support
*[PATCH v2 14/17] libxl: only include utmp.h if it's present *[PATCH v2 16/17] hvmloader: remove size_t typedef and include
[PATCH v2 17/17] build: export linker emulation parameter to SeaBIOS

But not yet:

Quoted 3 lines

[PATCH v2 01/17] configure: make the libaio test conditional on
[PATCH v2 13/17] libxl: add support for FreeBSD uuid implementation [PATCH v2 15/17] libxl: allow usage of char devices as block

All had comments I think