diff options
author | Patrick Mooney <pmooney@pfmooney.com> | 2022-09-24 03:39:47 +0000 |
---|---|---|
committer | Patrick Mooney <pmooney@oxide.computer> | 2022-09-28 21:13:16 +0000 |
commit | 17e9e0ae7132604963fd5a20e8ece5f2630e7fdf (patch) | |
tree | a4808b8bcf23a0ba0093ad0d2c2ac80e80976623 | |
parent | b7335573a496fd332333ccc5718fb23ea11815ba (diff) | |
download | illumos-joyent-17e9e0ae7132604963fd5a20e8ece5f2630e7fdf.tar.gz |
15008 expose bhyve kernel interface version wider
Reviewed by: Marco van Wieringen <mvw@planets.elm.net>
Reviewed by: Andy Fiddaman <illumos@fiddaman.net>
Approved by: Dan McDonald <danmcd@mnx.io>
-rw-r--r-- | usr/src/test/bhyve-tests/tests/vmm/interface_version.c | 22 | ||||
-rw-r--r-- | usr/src/uts/intel/io/vmm/vmm_sol_dev.c | 12 |
2 files changed, 30 insertions, 4 deletions
diff --git a/usr/src/test/bhyve-tests/tests/vmm/interface_version.c b/usr/src/test/bhyve-tests/tests/vmm/interface_version.c index b3de2f4f4f..58ef314e2c 100644 --- a/usr/src/test/bhyve-tests/tests/vmm/interface_version.c +++ b/usr/src/test/bhyve-tests/tests/vmm/interface_version.c @@ -18,9 +18,13 @@ #include <stdlib.h> #include <fcntl.h> #include <libgen.h> +#include <err.h> #include <sys/vmm.h> #include <sys/vmm_dev.h> +#include <vmmapi.h> + +#include "common.h" int main(int argc, char *argv[]) @@ -41,8 +45,24 @@ main(int argc, char *argv[]) version, VMM_CURRENT_INTERFACE_VERSION); return (EXIT_FAILURE); } - (void) close(ctl_fd); + + /* Query the version via an instance fd as well */ + struct vmctx *ctx = create_test_vm(suite_name); + if (ctx == NULL) { + err(EXIT_FAILURE, "could not open test VM"); + } + version = ioctl(vm_get_device_fd(ctx), VMM_INTERFACE_VERSION, 0); + if (version < 0) { + err(EXIT_FAILURE, + "VMM_INTERFACE_VERSION ioctl failed on vmm fd"); + } + if (version != VMM_CURRENT_INTERFACE_VERSION) { + errx(EXIT_FAILURE, "kernel version %d != expected %d", + version, VMM_CURRENT_INTERFACE_VERSION); + } + vm_destroy(ctx); + (void) printf("%s\tPASS\n", suite_name); return (0); } diff --git a/usr/src/uts/intel/io/vmm/vmm_sol_dev.c b/usr/src/uts/intel/io/vmm/vmm_sol_dev.c index 26b58dff79..882d22b435 100644 --- a/usr/src/uts/intel/io/vmm/vmm_sol_dev.c +++ b/usr/src/uts/intel/io/vmm/vmm_sol_dev.c @@ -2935,9 +2935,6 @@ vmm_ctl_ioctl(int cmd, intptr_t arg, int md, cred_t *cr, int *rvalp) } case VMM_VM_SUPPORTED: return (vmm_is_supported(arg)); - case VMM_INTERFACE_VERSION: - *rvalp = VMM_CURRENT_INTERFACE_VERSION; - return (0); case VMM_CHECK_IOMMU: if (!vmm_check_iommu()) { return (ENXIO); @@ -2974,6 +2971,15 @@ vmm_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, return (ENOTSUP); } + /* + * Regardless of minor (vmmctl or instance), we respond to queries of + * the interface version. + */ + if (cmd == VMM_INTERFACE_VERSION) { + *rvalp = VMM_CURRENT_INTERFACE_VERSION; + return (0); + } + minor = getminor(dev); if (minor == VMM_CTL_MINOR) { |