Skip to contentSkip to conversation

KVM: VMX: Use wrapper macro ~RMODE_GUEST_OWNED_EFLAGS_BITS directly

PATCH linmiaohe 1 participant 1 message Mar 6, 2020 KVM

lore
Share & tools
lore

linmiaohe

author
#0 lore raw
Quoted 9 lines · Vitaly Kuznetsov

Review

Quoted 5 lines · linmiaohe

From: Miaohe Lin <[email protected]>

(quoted diff) +0 -0
 	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!

Quoted 8 lines
(quoted diff) +1 -1
-       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);