From owner-dev-commits-src-main@freebsd.org Thu Feb 18 02:54:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36503549C44; Thu, 18 Feb 2021 02:54:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dgznh12VYz4jhQ; Thu, 18 Feb 2021 02:54:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C24F10D6C; Thu, 18 Feb 2021 02:54:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11I2sVEg053687; Thu, 18 Feb 2021 02:54:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I2sV9n053686; Thu, 18 Feb 2021 02:54:31 GMT (envelope-from git) Date: Thu, 18 Feb 2021 02:54:31 GMT Message-Id: <202102180254.11I2sV9n053686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 4f4065e0a220 - main - libvmm: clean up vmmapi.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f4065e0a220a57afa03420d4f8fa97dbcb5644c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 02:54:32 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=4f4065e0a220a57afa03420d4f8fa97dbcb5644c commit 4f4065e0a220a57afa03420d4f8fa97dbcb5644c Author: Robert Wing AuthorDate: 2021-01-29 08:30:31 +0000 Commit: Robert Wing CommitDate: 2021-02-18 02:46:42 +0000 libvmm: clean up vmmapi.h struct checkpoint_op, enum checkpoint_opcodes, and MAX_SNAPSHOT_VMNAME are not vmm specific, move them out of the vmmapi header. They are used for the save/restore functionality that bhyve(8) provides and are better suited in usr.sbin/bhyve/snapshot.h Since bhyvectl(8) requires these, the Makefile for bhyvectl has been modified to include usr.sbin/bhyve/snapshot.h Reviewed by: kevans, grehan Differential Revision: https://reviews.freebsd.org/D28410 --- lib/libvmmapi/vmmapi.h | 13 ------------- usr.sbin/bhyve/snapshot.h | 12 ++++++++++++ usr.sbin/bhyvectl/Makefile | 4 ++++ usr.sbin/bhyvectl/bhyvectl.c | 4 ++++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 2fe2bf7906a4..9dc44f391d2c 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -255,19 +255,6 @@ void vm_setup_freebsd_gdt(uint64_t *gdtr); /* * Save and restore */ - -#define MAX_SNAPSHOT_VMNAME 100 - -enum checkpoint_opcodes { - START_CHECKPOINT = 0, - START_SUSPEND = 1, -}; - -struct checkpoint_op { - unsigned int op; - char snapshot_filename[MAX_SNAPSHOT_VMNAME]; -}; - int vm_snapshot_req(struct vm_snapshot_meta *meta); int vm_restore_time(struct vmctx *ctx); diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index f9ea3d573089..eba46c497ab2 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -42,6 +42,8 @@ #include #include +#define MAX_SNAPSHOT_VMNAME 100 + struct vmctx; struct restore_state { @@ -57,6 +59,16 @@ struct restore_state { ucl_object_t *meta_root_obj; }; +enum checkpoint_opcodes { + START_CHECKPOINT = 0, + START_SUSPEND = 1, +}; + +struct checkpoint_op { + unsigned int op; + char snapshot_filename[MAX_SNAPSHOT_VMNAME]; +}; + struct checkpoint_thread_info { struct vmctx *ctx; int socket_fd; diff --git a/usr.sbin/bhyvectl/Makefile b/usr.sbin/bhyvectl/Makefile index 58eaf49dae3a..12fdb706cadb 100644 --- a/usr.sbin/bhyvectl/Makefile +++ b/usr.sbin/bhyvectl/Makefile @@ -18,6 +18,10 @@ CFLAGS+= -I${SRCTOP}/sys/amd64/vmm .if ${MK_BHYVE_SNAPSHOT} != "no" CFLAGS+= -DBHYVE_SNAPSHOT + +# usr.sbin/bhyve/snapshot.h needs ucl header +CFLAGS+= -I${SRCTOP}/contrib/libucl/include +CFLAGS+= -I${SRCTOP}/usr.sbin/bhyve .endif .include diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index c54aa1f33dc1..b404f9f3c255 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -63,6 +63,10 @@ __FBSDID("$FreeBSD$"); #include "amd/vmcb.h" #include "intel/vmcs.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif + #define MB (1UL << 20) #define GB (1UL << 30)