aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2009-02-11 03:03:36 -0500
committerAvi Kivity <avi@redhat.com>2009-06-10 04:48:21 -0400
commitcf9e4e15e8f6306b2559979269ead7c02e6b2b95 (patch)
tree08913212c62e64e3f3a6622e9cc302e7b1f386b5
parent5897297bc228fc3c85fdc421fd5c487f9a99821a (diff)
KVM: Split IOAPIC structure
Prepared for reuse ioapic_redir_entry for MSI. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--include/linux/kvm_types.h17
-rw-r--r--virt/kvm/ioapic.c6
-rw-r--r--virt/kvm/ioapic.h17
3 files changed, 21 insertions, 19 deletions
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 2b8318c83e53..b84aca3c4ad1 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -40,4 +40,21 @@ typedef unsigned long hfn_t;
40 40
41typedef hfn_t pfn_t; 41typedef hfn_t pfn_t;
42 42
43union kvm_ioapic_redirect_entry {
44 u64 bits;
45 struct {
46 u8 vector;
47 u8 delivery_mode:3;
48 u8 dest_mode:1;
49 u8 delivery_status:1;
50 u8 polarity:1;
51 u8 remote_irr:1;
52 u8 trig_mode:1;
53 u8 mask:1;
54 u8 reserve:7;
55 u8 reserved[4];
56 u8 dest_id;
57 } fields;
58};
59
43#endif /* __KVM_TYPES_H__ */ 60#endif /* __KVM_TYPES_H__ */
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index c3b99def9cbc..812801317e36 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -85,7 +85,7 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
85 85
86static int ioapic_service(struct kvm_ioapic *ioapic, unsigned int idx) 86static int ioapic_service(struct kvm_ioapic *ioapic, unsigned int idx)
87{ 87{
88 union ioapic_redir_entry *pent; 88 union kvm_ioapic_redirect_entry *pent;
89 int injected = -1; 89 int injected = -1;
90 90
91 pent = &ioapic->redirtbl[idx]; 91 pent = &ioapic->redirtbl[idx];
@@ -284,7 +284,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
284{ 284{
285 u32 old_irr = ioapic->irr; 285 u32 old_irr = ioapic->irr;
286 u32 mask = 1 << irq; 286 u32 mask = 1 << irq;
287 union ioapic_redir_entry entry; 287 union kvm_ioapic_redirect_entry entry;
288 int ret = 1; 288 int ret = 1;
289 289
290 if (irq >= 0 && irq < IOAPIC_NUM_PINS) { 290 if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
@@ -305,7 +305,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
305static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int pin, 305static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int pin,
306 int trigger_mode) 306 int trigger_mode)
307{ 307{
308 union ioapic_redir_entry *ent; 308 union kvm_ioapic_redirect_entry *ent;
309 309
310 ent = &ioapic->redirtbl[pin]; 310 ent = &ioapic->redirtbl[pin];
311 311
diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h
index a34bd5e6436b..008ec873d018 100644
--- a/virt/kvm/ioapic.h
+++ b/virt/kvm/ioapic.h
@@ -40,22 +40,7 @@ struct kvm_ioapic {
40 u32 id; 40 u32 id;
41 u32 irr; 41 u32 irr;
42 u32 pad; 42 u32 pad;
43 union ioapic_redir_entry { 43 union kvm_ioapic_redirect_entry redirtbl[IOAPIC_NUM_PINS];
44 u64 bits;
45 struct {
46 u8 vector;
47 u8 delivery_mode:3;
48 u8 dest_mode:1;
49 u8 delivery_status:1;
50 u8 polarity:1;
51 u8 remote_irr:1;
52 u8 trig_mode:1;
53 u8 mask:1;
54 u8 reserve:7;
55 u8 reserved[4];
56 u8 dest_id;
57 } fields;
58 } redirtbl[IOAPIC_NUM_PINS];
59 struct kvm_io_device dev; 44 struct kvm_io_device dev;
60 struct kvm *kvm; 45 struct kvm *kvm;
61 void (*ack_notifier)(void *opaque, int irq); 46 void (*ack_notifier)(void *opaque, int irq);