From owner-svn-src-head@freebsd.org Thu Sep 17 17:07:05 2020 Return-Path: Delivered-To: svn-src-head@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 5ADCE3E746C; Thu, 17 Sep 2020 17:07:05 +0000 (UTC) (envelope-from jhb@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bsk0T1MLKz4JFN; Thu, 17 Sep 2020 17:07:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 120C0D6D0; Thu, 17 Sep 2020 17:07:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08HH74e9053825; Thu, 17 Sep 2020 17:07:04 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08HH746v053824; Thu, 17 Sep 2020 17:07:04 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202009171707.08HH746v053824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 17 Sep 2020 17:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365842 - head/usr.sbin/bhyvectl X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.sbin/bhyvectl X-SVN-Commit-Revision: 365842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 17:07:05 -0000 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);