From a71dc724e4e5be75f8d56f225a6f3c2062fa2307 Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Tue, 17 Dec 2019 01:33:26 +0000 Subject: [PATCH] Attempt to load vmm(4) module before creating a guest using vm_create() wrapper in libvmmapi. Submitted by: Rob Fairbanks Reviewed by: jhb MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D19400 --- lib/libvmmapi/vmmapi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 6cfba69e23c..6f5062545e4 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -103,7 +105,11 @@ vm_device_open(const char *name) int vm_create(const char *name) { - + /* Try to load vmm(4) module before creating a guest. */ + if (modfind("vmm") < 0) { + if (modfind("vmm") < 0) + kldload("vmm"); + } return (CREATE((char *)name)); }