diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2014-08-21 12:08:06 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-08-21 12:45:22 -0400 |
commit | ae97a3b818324b92b5b9cc885c63c3f4bd46ee9d (patch) | |
tree | 0e68991ad4458f41fe3fae3ee85aaa6e9be2cdc8 | |
parent | e790d9ef6405633b007339d746b709aed43a928d (diff) |
KVM: x86: introduce sched_in to kvm_x86_ops
sched_in preempt notifier is available for x86, allow its use in
specific virtualization technlogies as well.
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/svm.c | 6 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 1 |
4 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4bda61b582e6..ac0f90e26a0b 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -771,6 +771,8 @@ struct kvm_x86_ops { | |||
771 | bool (*mpx_supported)(void); | 771 | bool (*mpx_supported)(void); |
772 | 772 | ||
773 | int (*check_nested_events)(struct kvm_vcpu *vcpu, bool external_intr); | 773 | int (*check_nested_events)(struct kvm_vcpu *vcpu, bool external_intr); |
774 | |||
775 | void (*sched_in)(struct kvm_vcpu *kvm, int cpu); | ||
774 | }; | 776 | }; |
775 | 777 | ||
776 | struct kvm_arch_async_pf { | 778 | struct kvm_arch_async_pf { |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1f49c867e72e..1703aab84a6d 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -4305,6 +4305,10 @@ static void svm_handle_external_intr(struct kvm_vcpu *vcpu) | |||
4305 | local_irq_enable(); | 4305 | local_irq_enable(); |
4306 | } | 4306 | } |
4307 | 4307 | ||
4308 | static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu) | ||
4309 | { | ||
4310 | } | ||
4311 | |||
4308 | static struct kvm_x86_ops svm_x86_ops = { | 4312 | static struct kvm_x86_ops svm_x86_ops = { |
4309 | .cpu_has_kvm_support = has_svm, | 4313 | .cpu_has_kvm_support = has_svm, |
4310 | .disabled_by_bios = is_disabled, | 4314 | .disabled_by_bios = is_disabled, |
@@ -4405,6 +4409,8 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
4405 | 4409 | ||
4406 | .check_intercept = svm_check_intercept, | 4410 | .check_intercept = svm_check_intercept, |
4407 | .handle_external_intr = svm_handle_external_intr, | 4411 | .handle_external_intr = svm_handle_external_intr, |
4412 | |||
4413 | .sched_in = svm_sched_in, | ||
4408 | }; | 4414 | }; |
4409 | 4415 | ||
4410 | static int __init svm_init(void) | 4416 | static int __init svm_init(void) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 286c2835e25c..7c26533e149c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -8848,6 +8848,10 @@ static int vmx_check_intercept(struct kvm_vcpu *vcpu, | |||
8848 | return X86EMUL_CONTINUE; | 8848 | return X86EMUL_CONTINUE; |
8849 | } | 8849 | } |
8850 | 8850 | ||
8851 | void vmx_sched_in(struct kvm_vcpu *vcpu, int cpu) | ||
8852 | { | ||
8853 | } | ||
8854 | |||
8851 | static struct kvm_x86_ops vmx_x86_ops = { | 8855 | static struct kvm_x86_ops vmx_x86_ops = { |
8852 | .cpu_has_kvm_support = cpu_has_kvm_support, | 8856 | .cpu_has_kvm_support = cpu_has_kvm_support, |
8853 | .disabled_by_bios = vmx_disabled_by_bios, | 8857 | .disabled_by_bios = vmx_disabled_by_bios, |
@@ -8952,6 +8956,8 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
8952 | .mpx_supported = vmx_mpx_supported, | 8956 | .mpx_supported = vmx_mpx_supported, |
8953 | 8957 | ||
8954 | .check_nested_events = vmx_check_nested_events, | 8958 | .check_nested_events = vmx_check_nested_events, |
8959 | |||
8960 | .sched_in = vmx_sched_in, | ||
8955 | }; | 8961 | }; |
8956 | 8962 | ||
8957 | static int __init vmx_init(void) | 8963 | static int __init vmx_init(void) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7d43dc7bb906..575d3fc67e7e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -7173,6 +7173,7 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | |||
7173 | 7173 | ||
7174 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) | 7174 | void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) |
7175 | { | 7175 | { |
7176 | kvm_x86_ops->sched_in(vcpu, cpu); | ||
7176 | } | 7177 | } |
7177 | 7178 | ||
7178 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | 7179 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) |