diff options
-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) { |