diff options
author | He, Qing <qing.he@intel.com> | 2007-08-05 03:49:16 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:25 -0400 |
commit | 6bf9e962d14deb9e460afbbfd83ea2f450325c2d (patch) | |
tree | 050b2be2fcded255afbb2512ed9c07adbd3f5b0f /drivers | |
parent | c52fb35a8b5dada749d35fbe15ac1f9857b22896 (diff) |
KVM: in-kernel IOAPIC save and restore support
This patch adds support for in-kernel ioapic save and restore (to
and from userspace). It uses the same get/set_irqchip ioctl as
in-kernel PIC.
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/irq.h | 2 | ||||
-rw-r--r-- | drivers/kvm/kvm_main.c | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h index 4034f6576cd9..30adddcb182d 100644 --- a/drivers/kvm/irq.h +++ b/drivers/kvm/irq.h | |||
@@ -61,7 +61,7 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | |||
61 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 61 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
62 | void kvm_pic_update_irq(struct kvm_pic *s); | 62 | void kvm_pic_update_irq(struct kvm_pic *s); |
63 | 63 | ||
64 | #define IOAPIC_NUM_PINS 24 | 64 | #define IOAPIC_NUM_PINS KVM_IOAPIC_NUM_PINS |
65 | #define IOAPIC_VERSION_ID 0x11 /* IOAPIC version */ | 65 | #define IOAPIC_VERSION_ID 0x11 /* IOAPIC version */ |
66 | #define IOAPIC_EDGE_TRIG 0 | 66 | #define IOAPIC_EDGE_TRIG 0 |
67 | #define IOAPIC_LEVEL_TRIG 1 | 67 | #define IOAPIC_LEVEL_TRIG 1 |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index c270e4afd3fd..61dff55f137e 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -913,6 +913,11 @@ static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip) | |||
913 | &pic_irqchip(kvm)->pics[1], | 913 | &pic_irqchip(kvm)->pics[1], |
914 | sizeof(struct kvm_pic_state)); | 914 | sizeof(struct kvm_pic_state)); |
915 | break; | 915 | break; |
916 | case KVM_IRQCHIP_IOAPIC: | ||
917 | memcpy (&chip->chip.ioapic, | ||
918 | ioapic_irqchip(kvm), | ||
919 | sizeof(struct kvm_ioapic_state)); | ||
920 | break; | ||
916 | default: | 921 | default: |
917 | r = -EINVAL; | 922 | r = -EINVAL; |
918 | break; | 923 | break; |
@@ -936,6 +941,11 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip) | |||
936 | &chip->chip.pic, | 941 | &chip->chip.pic, |
937 | sizeof(struct kvm_pic_state)); | 942 | sizeof(struct kvm_pic_state)); |
938 | break; | 943 | break; |
944 | case KVM_IRQCHIP_IOAPIC: | ||
945 | memcpy (ioapic_irqchip(kvm), | ||
946 | &chip->chip.ioapic, | ||
947 | sizeof(struct kvm_ioapic_state)); | ||
948 | break; | ||
939 | default: | 949 | default: |
940 | r = -EINVAL; | 950 | r = -EINVAL; |
941 | break; | 951 | break; |