On Thu, Mar 28, 2019 at 4:20 AM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > On 26/03/19 21:50, Jim Mattson wrote: > > enter SMM; > > save the following internal to the processor: > > CR4.VMXE > > an indication of whether the logical processor was in VMX operation > > (root or non-root) > > ... > > CR4.VMXE ← 0; > > perform ordinary SMI delivery: > > save processor state in SMRAM; > > > > It looks like vmx->nested.smm.guest_mode is the "indication of whether > > the logical processor was in VMX operation (root or non-root)," but I > > don't see where the VMXE bit is saved. > > We store it in SMRAM and not do this part: > > IF VMXE = 1 in CR4 image in SMRAM > THEN fail and enter shutdown state; > > This is only for historical reasons; we got it wrong when first adding > support for nested+SMM, it remained like that ever since, and it would > be hard to change it without potentially breaking KVM_GET/SET_NESTED_STATE. It seems like there are inherent flaws in a system design that discourages bug fixes.