Re: [PATCH] KVM: SVM: Add a dedicated INVD intercept routine

From: Paolo Bonzini
Date: Thu Sep 24 2020 - 02:52:22 EST


On 23/09/20 22:40, Tom Lendacky wrote:
>>> +static int invd_interception(struct vcpu_svm *svm)
>>> +{
>>> + /*
>>> + * Can't do emulation on an SEV guest and INVD is emulated
>>> + * as a NOP, so just skip the instruction.
>>> + */
>>> + return (sev_guest(svm->vcpu.kvm))
>>> + ? kvm_skip_emulated_instruction(&svm->vcpu)
>>> + : kvm_emulate_instruction(&svm->vcpu, 0);
>>
>> Is there any reason not to do kvm_skip_emulated_instruction() for both SEV
>> and legacy? VMX has the same odd kvm_emulate_instruction() call, but AFAICT
>> that's completely unecessary, i.e. VMX can also convert to a straight skip.
>
> You could, I just figured I'd leave the legacy behavior just in case. Not
> that I can think of a reason that behavior would ever change.

Yeah, let's do skip for both SVM and VMX.

Paolo