diff options
Diffstat (limited to 'drivers/kvm/irq.h')
-rw-r--r-- | drivers/kvm/irq.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h index 57e23bdac530..6ed856a41e23 100644 --- a/drivers/kvm/irq.h +++ b/drivers/kvm/irq.h | |||
@@ -60,6 +60,50 @@ int kvm_pic_read_irq(struct kvm_pic *s); | |||
60 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 60 | 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 | 62 | ||
63 | #define IOAPIC_NUM_PINS 24 | ||
64 | #define IOAPIC_VERSION_ID 0x11 /* IOAPIC version */ | ||
65 | #define IOAPIC_EDGE_TRIG 0 | ||
66 | #define IOAPIC_LEVEL_TRIG 1 | ||
67 | |||
68 | #define IOAPIC_DEFAULT_BASE_ADDRESS 0xfec00000 | ||
69 | #define IOAPIC_MEM_LENGTH 0x100 | ||
70 | |||
71 | /* Direct registers. */ | ||
72 | #define IOAPIC_REG_SELECT 0x00 | ||
73 | #define IOAPIC_REG_WINDOW 0x10 | ||
74 | #define IOAPIC_REG_EOI 0x40 /* IA64 IOSAPIC only */ | ||
75 | |||
76 | /* Indirect registers. */ | ||
77 | #define IOAPIC_REG_APIC_ID 0x00 /* x86 IOAPIC only */ | ||
78 | #define IOAPIC_REG_VERSION 0x01 | ||
79 | #define IOAPIC_REG_ARB_ID 0x02 /* x86 IOAPIC only */ | ||
80 | |||
81 | struct kvm_ioapic { | ||
82 | u64 base_address; | ||
83 | u32 ioregsel; | ||
84 | u32 id; | ||
85 | u32 irr; | ||
86 | u32 pad; | ||
87 | union ioapic_redir_entry { | ||
88 | u64 bits; | ||
89 | struct { | ||
90 | u8 vector; | ||
91 | u8 delivery_mode:3; | ||
92 | u8 dest_mode:1; | ||
93 | u8 delivery_status:1; | ||
94 | u8 polarity:1; | ||
95 | u8 remote_irr:1; | ||
96 | u8 trig_mode:1; | ||
97 | u8 mask:1; | ||
98 | u8 reserve:7; | ||
99 | u8 reserved[4]; | ||
100 | u8 dest_id; | ||
101 | } fields; | ||
102 | } redirtbl[IOAPIC_NUM_PINS]; | ||
103 | struct kvm_io_device dev; | ||
104 | struct kvm *kvm; | ||
105 | }; | ||
106 | |||
63 | struct kvm_lapic { | 107 | struct kvm_lapic { |
64 | unsigned long base_address; | 108 | unsigned long base_address; |
65 | struct kvm_io_device dev; | 109 | struct kvm_io_device dev; |
@@ -96,8 +140,15 @@ void kvm_free_apic(struct kvm_lapic *apic); | |||
96 | u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu); | 140 | u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu); |
97 | void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8); | 141 | void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8); |
98 | void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value); | 142 | void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value); |
143 | struct kvm_lapic *kvm_apic_round_robin(struct kvm *kvm, u8 vector, | ||
144 | unsigned long bitmap); | ||
99 | u64 kvm_get_apic_base(struct kvm_vcpu *vcpu); | 145 | u64 kvm_get_apic_base(struct kvm_vcpu *vcpu); |
100 | void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); | 146 | void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); |
147 | int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest); | ||
101 | void kvm_ioapic_update_eoi(struct kvm *kvm, int vector); | 148 | void kvm_ioapic_update_eoi(struct kvm *kvm, int vector); |
149 | int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda); | ||
150 | int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec, u8 trig); | ||
151 | int kvm_ioapic_init(struct kvm *kvm); | ||
152 | void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level); | ||
102 | 153 | ||
103 | #endif | 154 | #endif |