Re: [PATCH v2 3/6] KVM: nVMX: fix SMI injection in guest mode

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

 



On 20/09/2017 09:53, Paolo Bonzini wrote:
> On 19/09/2017 17:37, Ladi Prosek wrote:
>> +		if (nested_cpu_has_ept(vmcs12)) {
>> +			/*
>> +			 * 34.14.1 Default Treatment of SMI Delivery
>> +			 * Bit 0 of the 32-bit field at offset SMBASE + 8000H + 7EE0H
>> +			 * indicates whether the cpu was in VMX non-root operation with
>> +			 * EPT enabled.
>> +			 * The 64-bit field at offset SMBASE + 8000H + 7ED8H holds the
>> +			 * value of the EPT pointer.
>> +			 */
>> +			put_smstate(u32, smstate, 0x7ee0,
>> +				    get_smstate(u32, smstate, 0x7ee0) | 1);
> 
> This is zero, so it should be enough to just write 1 here.
> 
> But, it is not clear to me why this is needed.  Since we use the AMD
> format for the SMM state save area anyway, I'm inclined to omit it...

To clarify more what I mean, my guess is that the EPT state is meant for
SMI state save handlers that want to emulate e.g. REP INS or REP OUTS,
and therefore need to walk the caller's page tables.  We do not have
such magic SMI state save handlers because we don't use SMM for crazy
things such as emulating the 8042 on top of a USB keyboard.  Therefore,
since we document our SMM state save map version as the AMD format, we
can omit this information.

I probably should also clarify my different opinion on vmx->nested.smm
versus svm->nested.smm.  AMD lets you use SVM in system management mode,
without all the complication of dual-monitor treatment and the like.
They do it simply by storing the SVM state (which is not much) in the
state save map.

On the other hand, Intel's VMX state (VMXON, VMXON area, current VMCS
pointer) is inaccessible to SMM under the default treatment of SMIs.
That's because CR4.VMXE is reserved for SMM under default treatment (KVM
currenty does not implement this and it should be changed---not
necessarily by you, though I won't complain if it is part of v3 :)).

Therefore, storing such hidden state or a subset of it in
vmx->nested.smm is merely a convenience that lets you keep
vmx->nested.vmxon == false while in SMM.  This is different from nSVM,
and I think it's an acceptable difference for the sake of convenience.

Paolo



[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