Index | Thread | Search

From:
Mike Larkin <mlarkin@nested.page>
Subject:
Re: remove VMFUNC feature detection
To:
Dave Voutila <dv@sisu.io>
Cc:
Openbsd Tech <tech@openbsd.org>, Mike Larkin <mlarkin@openbsd.org>
Date:
Mon, 7 Oct 2024 12:42:56 -0700

Download raw body.

Thread
On Mon, Oct 07, 2024 at 11:09:43AM -0400, Dave Voutila wrote:
> As part of my cleanup of VMM feature identification, I'll be cutting a
> few diffs to incrementally change the logic to keep things
> reviewable. This is the first.
>
> vmm(4) doesn't implement any support for the VMFUNC instruction, so
> let's remove this detection and feature tracking.
>
> ok?
>

sure.

> diffstat refs/heads/master refs/heads/vmm-ident
>  M  sys/arch/amd64/amd64/identcpu.c     |  0+   5-
>  M  sys/arch/amd64/amd64/vmm_machdep.c  |  0+  10-
>  M  sys/arch/amd64/include/cpu.h        |  0+   1-
>
> 3 files changed, 0 insertions(+), 16 deletions(-)
>
> diff refs/heads/master refs/heads/vmm-ident
> commit - 4f09e5189a0c43e3ec42299f2148c5a55c78be46
> commit + 51b89aecc42f46c171160c8517a18189418a2223
> blob - 755e0eeaafb78d4d23605576bbdb5e08a3c69e3a
> blob + ea746d1a1b075ee9a7ecdb56737862e2e25d051f
> --- sys/arch/amd64/amd64/identcpu.c
> +++ sys/arch/amd64/amd64/identcpu.c
> @@ -952,11 +952,6 @@ cpu_check_vmm_cap(struct cpu_info *ci)
>  			/* EPT available? */
>  			if (msr & (IA32_VMX_ENABLE_EPT) << 32)
>  				ci->ci_vmm_flags |= CI_VMM_EPT;
> -			/* VM Functions available? */
> -			if (msr & (IA32_VMX_ENABLE_VM_FUNCTIONS) << 32) {
> -				ci->ci_vmm_cap.vcc_vmx.vmx_vm_func =
> -				    rdmsr(IA32_VMX_VMFUNC);
> -			}
>  		}
>  	}
>
> blob - 7c898fb559ff864b2542b36510a250cc1100c11c
> blob + 225b9e39077678ca6ef77bbfd9a0760f733da714
> --- sys/arch/amd64/amd64/vmm_machdep.c
> +++ sys/arch/amd64/amd64/vmm_machdep.c
> @@ -7157,16 +7157,6 @@ vmx_dump_vmcs(struct vcpu *vcpu)
>  		}
>
>  		if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED2_CTLS,
> -		    IA32_VMX_ENABLE_VM_FUNCTIONS, 1)) {
> -			/* We assume all CPUs have the same VMFUNC caps */
> -			if (curcpu()->ci_vmm_cap.vcc_vmx.vmx_vm_func & 0x1) {
> -				vmx_dump_vmcs_field(VMCS_EPTP_LIST_ADDRESS,
> -				    "EPTP List Addr");
> -				DPRINTF("\n");
> -			}
> -		}
> -
> -		if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED2_CTLS,
>  		    IA32_VMX_VMCS_SHADOWING, 1)) {
>  			vmx_dump_vmcs_field(VMCS_VMREAD_BITMAP_ADDRESS,
>  			    "VMREAD Bitmap Addr");
> blob - 34ba78776fc56d39e1b6622cf267da2d9e328f20
> blob + f8c415390f9e101da4abb9f7dd8b87d3fac19e88
> --- sys/arch/amd64/include/cpu.h
> +++ sys/arch/amd64/include/cpu.h
> @@ -73,7 +73,6 @@ struct vmx {
>  	uint32_t	vmx_vmxon_revision;
>  	uint32_t	vmx_msr_table_size;
>  	uint32_t	vmx_cr3_tgt_count;
> -	uint64_t	vmx_vm_func;
>  	uint8_t		vmx_has_l1_flush_msr;
>  	uint64_t	vmx_invept_mode;
>  };