svn commit: r365842 - head/usr.sbin/bhyvectl

John Baldwin jhb at FreeBSD.org
Thu Sep 17 17:07:05 UTC 2020


Author: jhb
Date: Thu Sep 17 17:07:04 2020
New Revision: 365842
URL: https://svnweb.freebsd.org/changeset/base/365842

Log:
  Remove support for setting some obscure fields.
  
  Don't permit setting the exception bitmap or VMCS entry interrupt
  information.  These are not generally useful to set.  If it is needed
  in the future, dedicated pseudo registers can be added for these that
  would be used with vm_set_register().
  
  Discussed with:	grehan
  MFC after:	1 week

Modified:
  head/usr.sbin/bhyvectl/bhyvectl.c

Modified: head/usr.sbin/bhyvectl/bhyvectl.c
==============================================================================
--- head/usr.sbin/bhyvectl/bhyvectl.c	Thu Sep 17 16:49:28 2020	(r365841)
+++ head/usr.sbin/bhyvectl/bhyvectl.c	Thu Sep 17 17:07:04 2020	(r365842)
@@ -313,11 +313,11 @@ static int get_vmcb_virq, get_avic_table;
  */
 static int get_pinbased_ctls, get_procbased_ctls, get_procbased_ctls2;
 static int get_eptp, get_io_bitmap, get_tsc_offset;
-static int get_vmcs_entry_interruption_info, set_vmcs_entry_interruption_info;
+static int get_vmcs_entry_interruption_info;
 static int get_vmcs_interruptibility;
 uint32_t vmcs_entry_interruption_info;
 static int get_vmcs_gpa, get_vmcs_gla;
-static int get_exception_bitmap, set_exception_bitmap, exception_bitmap;
+static int get_exception_bitmap, exception_bitmap;
 static int get_cr0_mask, get_cr0_shadow;
 static int get_cr4_mask, get_cr4_shadow;
 static int get_cr3_targets;
@@ -542,13 +542,6 @@ vm_get_vmcs_field(struct vmctx *ctx, int vcpu, int fie
 }
 
 static int
-vm_set_vmcs_field(struct vmctx *ctx, int vcpu, int field, uint64_t val)
-{
-
-	return (vm_set_register(ctx, vcpu, VMCS_IDENT(field), val));
-}
-
-static int
 vm_get_vmcb_field(struct vmctx *ctx, int vcpu, int off, int bytes,
 	uint64_t *ret_val)
 {
@@ -556,14 +549,6 @@ vm_get_vmcb_field(struct vmctx *ctx, int vcpu, int off
 	return (vm_get_register(ctx, vcpu, VMCB_ACCESS(off, bytes), ret_val));
 }
 
-static int
-vm_set_vmcb_field(struct vmctx *ctx, int vcpu, int off, int bytes,
-	uint64_t val)
-{
-	
-	return (vm_set_register(ctx, vcpu, VMCB_ACCESS(off, bytes), val));
-}
-
 enum {
 	VMNAME = 1000,	/* avoid collision with return values from getopt */
 	VCPU,
@@ -595,8 +580,6 @@ enum {
 	SET_TR,
 	SET_LDTR,
 	SET_X2APIC_STATE,
-	SET_EXCEPTION_BITMAP,
-	SET_VMCS_ENTRY_INTERRUPTION_INFO,
 	SET_CAP,
 	CAPNAME,
 	UNASSIGN_PPTDEV,
@@ -1379,8 +1362,6 @@ setup_options(bool cpu_intel)
 		{ "set-tr",	REQ_ARG,	0,	SET_TR },
 		{ "set-ldtr",	REQ_ARG,	0,	SET_LDTR },
 		{ "set-x2apic-state",REQ_ARG,	0,	SET_X2APIC_STATE },
-		{ "set-exception-bitmap",
-				REQ_ARG,	0, SET_EXCEPTION_BITMAP },
 		{ "capname",	REQ_ARG,	0,	CAPNAME },
 		{ "unassign-pptdev", REQ_ARG,	0,	UNASSIGN_PPTDEV },
 		{ "setcap",	REQ_ARG,	0,	SET_CAP },
@@ -1514,8 +1495,6 @@ setup_options(bool cpu_intel)
 		{ "get-vmcs-host-pat",	NO_ARG,	&get_host_pat,	1 },
 		{ "get-vmcs-host-cr0",
 					NO_ARG,	&get_host_cr0,	1 },
-		{ "set-vmcs-entry-interruption-info",
-				REQ_ARG, 0, SET_VMCS_ENTRY_INTERRUPTION_INFO },
 		{ "get-vmcs-exit-qualification",
 				NO_ARG,	&get_vmcs_exit_qualification, 1 },
 		{ "get-vmcs-exit-inst-length",
@@ -1923,14 +1902,6 @@ main(int argc, char *argv[])
 			x2apic_state = strtol(optarg, NULL, 0);
 			set_x2apic_state = 1;
 			break;
-		case SET_EXCEPTION_BITMAP:
-			exception_bitmap = strtoul(optarg, NULL, 0);
-			set_exception_bitmap = 1;
-			break;
-		case SET_VMCS_ENTRY_INTERRUPTION_INFO:
-			vmcs_entry_interruption_info = strtoul(optarg, NULL, 0);
-			set_vmcs_entry_interruption_info = 1;
-			break;
 		case SET_CAP:
 			capval = strtoul(optarg, NULL, 0);
 			setcap = 1;
@@ -2123,22 +2094,6 @@ main(int argc, char *argv[])
 
 	if (!error && unassign_pptdev)
 		error = vm_unassign_pptdev(ctx, bus, slot, func);
-
-	if (!error && set_exception_bitmap) {
-		if (cpu_intel)
-			error = vm_set_vmcs_field(ctx, vcpu,
-						  VMCS_EXCEPTION_BITMAP,
-						  exception_bitmap);
-		else
-			error = vm_set_vmcb_field(ctx, vcpu,
-						  VMCB_OFF_EXC_INTERCEPT,
-						  4, exception_bitmap);
-	}
-
-	if (!error && cpu_intel && set_vmcs_entry_interruption_info) {
-		error = vm_set_vmcs_field(ctx, vcpu, VMCS_ENTRY_INTR_INFO,
-					  vmcs_entry_interruption_info);
-	}
 
 	if (!error && inject_nmi) {
 		error = vm_inject_nmi(ctx, vcpu);


More information about the svn-src-head mailing list