Alexander Graf wrote:
This patch implements the GIF flag and the clgi and stgi instructions that set this flag. Only if the flag is set (default), interrupts can be received by the CPU.To keep the information about that somewhere, this patch adds a new hidden flags vector. that is used to store information that does not go into the vmcb, but is SVM specific. v2 moves the hflags to x86 generic code v3 makes use of the new permission helper Signed-off-by: Alexander Graf <[EMAIL PROTECTED]> --- arch/x86/kvm/svm.c | 42 +++++++++++++++++++++++++++++++++++++++--- include/asm-x86/kvm_host.h | 3 +++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index a00421b..62bfa2b 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -614,6 +614,8 @@ static void init_vmcb(struct vcpu_svm *svm) save->cr4 = 0; } force_new_asid(&svm->vcpu); + + svm->vcpu.arch.hflags = HF_GIF_MASK; }static int svm_vcpu_reset(struct kvm_vcpu *vcpu)@@ -1233,6 +1235,36 @@ static int nested_svm_do(struct vcpu_svm *svm, return retval; }+static int stgi_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)+{ + if (nested_svm_check_permissions(svm)) + return 1; + + svm->next_rip = kvm_rip_read(&svm->vcpu) + 3; + skip_emulated_instruction(&svm->vcpu); + + svm->vcpu.arch.hflags |= HF_GIF_MASK; + + return 1; +}
It feels a little strange to see this here instead of an implementation of stgi/clgi in x86_emulate. Any reason for not going that route?
GIF somehow needs exposure to userspace too, right? Otherwise, when using -no-kernel-apic, userspace may try to inject an interrupt when the guest cannot handle it, right?
Regards, Anthony Liguori -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
