[LTP] [PATCH 3/5] KVM: Simplify reading VMX control field masks

Martin Doucha mdoucha@suse.cz
Mon Apr 28 12:38:25 CEST 2025


Hi!

On 16. 04. 25 9:16, Petr Vorel wrote:
> Hi Martin,
> 
>> Hi Martin,
> 
>> ...
>>>   	/* Configure VM execution control fields */
>>> -	if (kvm_rdmsr(MSR_IA32_VMX_BASIC) & IA32_VMXBASIC_USELESS_CTL_MASKS) {
>>> -		pinxctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_PINX_MASK2);
>>> -		execctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_EXECCTL_MASK2);
>>> -		exitctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_EXITCTL_MASK2);
>>> -		entryctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_ENTRYCTL_MASK2);
>>> -	} else {
>>> -		pinxctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_PINX_MASK);
>>> -		execctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_EXECCTL_MASK);
>>> -		exitctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_EXITCTL_MASK);
>>> -		entryctl = (uint32_t)kvm_rdmsr(MSR_IA32_VMX_ENTRYCTL_MASK);
> 
> The rest of the patchset merged, thank you!
> 
>> I guess you're going to use in the future MSR_IA32_VMX_PINX_MASK2 and other
>> deleted masks (because now they are IMHO only in the structs).
> 
> If you don't need the constants in the future, please remove it in a subsequent
> patch.

Those constants are still used in kvm_vmx_read_vmctl_mask() via the 
static lookup table in lib_x86.c. We can't remove them because the tests 
would break on old CPUs.

-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list