From 66d6c08cd543dce5794ba92ff4d115b8d8082004 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 5 Dec 2020 11:20:06 +0000 Subject: [PATCH 1/5] make: Disable -Wpoison-system-directories This compiler warning is used for cross-compilation only, which is not used for hyperkit. Explicitly disable it. Signed-off-by: Rolf Neugebauer --- config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.mk b/config.mk index 8b99ff19..1b12ef65 100644 --- a/config.mk +++ b/config.mk @@ -45,7 +45,8 @@ CFLAGS_WARN := \ -Wno-reserved-id-macro \ -Wno-unknown-warning-option \ -Wno-unused-macros \ - -Wno-switch-enum + -Wno-switch-enum \ + -Wno-poison-system-directories CFLAGS_DIAG := \ -fmessage-length=152 \ From fd0675c1d145842c933fa8fdca4f8ae5d9057543 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 5 Dec 2020 11:35:47 +0000 Subject: [PATCH 2/5] block_if: rename preadv/pwritev macOS Big Sur seems to have introduced their own version of these functions. Use an _ to pick up our version of these functions. This is based on b7e589f91e68 ("Support Big Sur (#200)") from https://github.com/machyve/xhyve Signed-off-by: Rolf Neugebauer --- src/lib/block_if.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/block_if.c b/src/lib/block_if.c index 3b743c36..294e4ae1 100644 --- a/src/lib/block_if.c +++ b/src/lib/block_if.c @@ -138,7 +138,7 @@ static struct blockif_sig_elem *blockif_bse_head; static ssize_t -preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset) +_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset) { off_t res; @@ -149,7 +149,7 @@ preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset) static ssize_t -pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset) +_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset) { off_t res; @@ -181,7 +181,7 @@ block_preadv(struct blockif_ctxt *bc, const struct iovec *iov, int iovcnt, HYPERKIT_BLOCK_PREADV(offset, iovec_len(iov, iovcnt)); if (bc->bc_fd >= 0) - ret = preadv(bc->bc_fd, iov, iovcnt, offset); + ret = _preadv(bc->bc_fd, iov, iovcnt, offset); #ifdef HAVE_OCAML_QCOW else if (bc->bc_mbh >= 0) @@ -205,7 +205,7 @@ block_pwritev(struct blockif_ctxt *bc, const struct iovec *iov, int iovcnt, HYPERKIT_BLOCK_PWRITEV(offset, iovec_len(iov, iovcnt)); if (bc->bc_fd >= 0) - ret = pwritev(bc->bc_fd, iov, iovcnt, offset); + ret = _pwritev(bc->bc_fd, iov, iovcnt, offset); #ifdef HAVE_OCAML_QCOW else if (bc->bc_mbh >= 0) From d201905e54940db2f6afaf7cea4ee2078a917293 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 5 Dec 2020 15:13:17 +0000 Subject: [PATCH 3/5] vmx: Improve hv_vm_create() error handling hv_vm_create() returns a generic HV_ERROR. Add a case for it. While at it, also print the error value in hex as this is how they are defined in hv_error.h. Signed-off-by: Rolf Neugebauer --- src/lib/vmm/intel/vmx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/vmm/intel/vmx.c b/src/lib/vmm/intel/vmx.c index 1aa62d24..bdbad3b5 100644 --- a/src/lib/vmm/intel/vmx.c +++ b/src/lib/vmm/intel/vmx.c @@ -491,9 +491,12 @@ vmx_init(void) case HV_UNSUPPORTED: /* Don't know if this can happen, report to us */ xhyve_abort("hv_vm_create HV_UNSUPPORTED\n"); + case HV_ERROR: + /* An unspecified error happened */ + xhyve_abort("hv_vm_create HV_ERROR (unspecified error)\n"); default: /* Should never happen, report to Apple */ - xhyve_abort("hv_vm_create unknown error %d\n", error); + xhyve_abort("hv_vm_create unknown error %#010x\n", error); } /* From 206b471fe864360a40e976da76df62f30f25d6d0 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 5 Dec 2020 18:22:21 +0000 Subject: [PATCH 4/5] build: Fix OCAML build fixes #305 Signed-off-by: Rolf Neugebauer --- Makefile | 2 ++ config.mk | 1 + 2 files changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 474e48b1..42b25230 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,8 @@ OCAML_PACKS := cstruct cstruct-lwt io-page io-page.unix uri mirage-block \ mirage-unix prometheus-app conduit-lwt cohttp-lwt-unix \ unix-type-representations OCAML_LDLIBS := -L $(OCAML_WHERE) \ + $(shell ocamlfind query bigstringaf)/bigstringaf.a \ + $(shell ocamlfind query bigstringaf)/libbigstringaf_stubs.a \ $(shell ocamlfind query cstruct)/cstruct.a \ $(shell ocamlfind query cstruct)/libcstruct_stubs.a \ $(shell ocamlfind query io-page)/io_page.a \ diff --git a/config.mk b/config.mk index 1b12ef65..f7f19acb 100644 --- a/config.mk +++ b/config.mk @@ -80,4 +80,5 @@ LDFLAGS := \ -arch x86_64 \ -framework Hypervisor \ -framework vmnet \ + -Wl,-no_compact_unwind \ $(LDFLAGS_DBG) From eb4645d0ae82e0579c25b810b7f26d277e68570b Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Sat, 5 Dec 2020 18:23:30 +0000 Subject: [PATCH 5/5] Add disk.dmg to .gitignore This is a temporary file being created by some of the tests. Signed-off-by: Rolf Neugebauer --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c2b54755..b0a36fec 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ _build /test/vmlinuz /test/initrd /test/initrd.gz +/test/disk.dmg /test/disk.qcow2