diff options
author | Eddie Dong <eddie.dong@intel.com> | 2007-08-06 09:29:07 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:26 -0400 |
commit | 2a8067f17b8442ecce0b14e134823020ff33b4fa (patch) | |
tree | e7f65775b3ced0c42de2df8118a84e7ddb9fff7d /drivers/kvm/svm.c | |
parent | 96ad2cc6132479aa0aea485d0838a13fda765bd5 (diff) |
KVM: pending irq save/restore
Add in kernel irqchip save/restore support for pending vectors.
[avi: fix compile warning on i386]
[avi: remove printk]
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r-- | drivers/kvm/svm.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index a347b61644cd..c8cd242f36ff 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -843,6 +843,16 @@ static int svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_debug_guest *dbg) | |||
843 | return -EOPNOTSUPP; | 843 | return -EOPNOTSUPP; |
844 | } | 844 | } |
845 | 845 | ||
846 | static int svm_get_irq(struct kvm_vcpu *vcpu) | ||
847 | { | ||
848 | struct vcpu_svm *svm = to_svm(vcpu); | ||
849 | u32 exit_int_info = svm->vmcb->control.exit_int_info; | ||
850 | |||
851 | if (is_external_interrupt(exit_int_info)) | ||
852 | return exit_int_info & SVM_EVTINJ_VEC_MASK; | ||
853 | return -1; | ||
854 | } | ||
855 | |||
846 | static void load_host_msrs(struct kvm_vcpu *vcpu) | 856 | static void load_host_msrs(struct kvm_vcpu *vcpu) |
847 | { | 857 | { |
848 | #ifdef CONFIG_X86_64 | 858 | #ifdef CONFIG_X86_64 |
@@ -1310,6 +1320,13 @@ static inline void svm_inject_irq(struct vcpu_svm *svm, int irq) | |||
1310 | ((/*control->int_vector >> 4*/ 0xf) << V_INTR_PRIO_SHIFT); | 1320 | ((/*control->int_vector >> 4*/ 0xf) << V_INTR_PRIO_SHIFT); |
1311 | } | 1321 | } |
1312 | 1322 | ||
1323 | static void svm_set_irq(struct kvm_vcpu *vcpu, int irq) | ||
1324 | { | ||
1325 | struct vcpu_svm *svm = to_svm(vcpu); | ||
1326 | |||
1327 | svm_inject_irq(svm, irq); | ||
1328 | } | ||
1329 | |||
1313 | static void svm_intr_assist(struct vcpu_svm *svm) | 1330 | static void svm_intr_assist(struct vcpu_svm *svm) |
1314 | { | 1331 | { |
1315 | struct vmcb *vmcb = svm->vmcb; | 1332 | struct vmcb *vmcb = svm->vmcb; |
@@ -1783,6 +1800,8 @@ static struct kvm_arch_ops svm_arch_ops = { | |||
1783 | .run = svm_vcpu_run, | 1800 | .run = svm_vcpu_run, |
1784 | .skip_emulated_instruction = skip_emulated_instruction, | 1801 | .skip_emulated_instruction = skip_emulated_instruction, |
1785 | .patch_hypercall = svm_patch_hypercall, | 1802 | .patch_hypercall = svm_patch_hypercall, |
1803 | .get_irq = svm_get_irq, | ||
1804 | .set_irq = svm_set_irq, | ||
1786 | }; | 1805 | }; |
1787 | 1806 | ||
1788 | static int __init svm_init(void) | 1807 | static int __init svm_init(void) |