Re: [PATCH] KVM: VMX: Use wrapper macro ~RMODE_GUEST_OWNED_EFLAGS_BITS directly

From: linmiaohe
Date: Thu Mar 05 2020 - 21:11:16 EST


Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> writes:
>linmiaohe <linmiaohe@xxxxxxxxxx> writes:
>
>> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>>
>>
>> vmcs_writel(GUEST_RFLAGS, flags);
>> vmcs_writel(GUEST_CR4, vmcs_readl(GUEST_CR4) | X86_CR4_VME);
>
>Double negations are evil, let's define a macro for 'X86_EFLAGS_IOPL | X86_EFLAGS_VM' instead (completely untested):

You catch the evil guys again. :) But ~RMODE_GUEST_OWNED_EFLAGS_BITS is used by many other func, we should fix them
together. Would try your version, many thanks!

>
>
>- flags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM;
>+ flags |= RMODE_HOST_OWNED_EFLAGS_BITS;
>
> vmcs_writel(GUEST_RFLAGS, flags);
> vmcs_writel(GUEST_CR4, vmcs_readl(GUEST_CR4) | X86_CR4_VME);
>