Re: [RFC PATCH v2 06/26] x86/cpu/intel: Allow SGX virtualization without Launch Control support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/17/21 7:27 PM, Kai Huang wrote:
> -	enable_sgx = cpu_has(c, X86_FEATURE_SGX) &&
> -		     cpu_has(c, X86_FEATURE_SGX_LC) &&
> -		     IS_ENABLED(CONFIG_X86_SGX);
> +	enable_sgx_driver = cpu_has(c, X86_FEATURE_SGX) &&
> +			    cpu_has(c, X86_FEATURE_SGX1) &&
> +			    IS_ENABLED(CONFIG_X86_SGX) &&
> +			    cpu_has(c, X86_FEATURE_SGX_LC);
> +	enable_sgx_virt = cpu_has(c, X86_FEATURE_SGX) &&
> +			  cpu_has(c, X86_FEATURE_SGX1) &&
> +			  IS_ENABLED(CONFIG_X86_SGX) &&
> +			  IS_ENABLED(CONFIG_X86_SGX_VIRTUALIZATION) &&
> +			  enable_vmx;

Would it be too much to ask that the SGX/SGX1 checks not be duplicated?
 Perhaps:

	enable_sgx_any = cpu_feature_enabled(CONFIG_X86_SGX) &&
			 cpu_feature_enabled(CONFIG_X86_SGX1);

	enable_sgx_driver = enable_sgx_any &&
			    cpu_has(c, X86_FEATURE_SGX_LC);

	enable_sgx_virt = enable_sgx_any &&
			  enable_vmx &&
		     IS_ENABLED(CONFIG_X86_SGX_VIRTUALIZATION)

BTW, CONFIG_X86_SGX_VIRTUALIZATION is a pretty porky name.  Maybe just
CONFIG_X86_SGX_VIRT?




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux