aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/ioapic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/ioapic.c')
-rw-r--r--drivers/kvm/ioapic.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/kvm/ioapic.c b/drivers/kvm/ioapic.c
index c7992e667fdb..8503d99b8339 100644
--- a/drivers/kvm/ioapic.c
+++ b/drivers/kvm/ioapic.c
@@ -40,8 +40,11 @@
40#include <asm/apicdef.h> 40#include <asm/apicdef.h>
41#include <asm/io_apic.h> 41#include <asm/io_apic.h>
42#include "irq.h" 42#include "irq.h"
43/* #define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) */ 43#if 0
44#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg)
45#else
44#define ioapic_debug(fmt, arg...) 46#define ioapic_debug(fmt, arg...)
47#endif
45static void ioapic_deliver(struct kvm_ioapic *vioapic, int irq); 48static void ioapic_deliver(struct kvm_ioapic *vioapic, int irq);
46 49
47static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, 50static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,
@@ -113,7 +116,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
113 default: 116 default:
114 index = (ioapic->ioregsel - 0x10) >> 1; 117 index = (ioapic->ioregsel - 0x10) >> 1;
115 118
116 ioapic_debug("change redir index %x val %x", index, val); 119 ioapic_debug("change redir index %x val %x\n", index, val);
117 if (index >= IOAPIC_NUM_PINS) 120 if (index >= IOAPIC_NUM_PINS)
118 return; 121 return;
119 if (ioapic->ioregsel & 1) { 122 if (ioapic->ioregsel & 1) {
@@ -134,7 +137,7 @@ static void ioapic_inj_irq(struct kvm_ioapic *ioapic,
134 struct kvm_lapic *target, 137 struct kvm_lapic *target,
135 u8 vector, u8 trig_mode, u8 delivery_mode) 138 u8 vector, u8 trig_mode, u8 delivery_mode)
136{ 139{
137 ioapic_debug("irq %d trig %d deliv %d", vector, trig_mode, 140 ioapic_debug("irq %d trig %d deliv %d\n", vector, trig_mode,
138 delivery_mode); 141 delivery_mode);
139 142
140 ASSERT((delivery_mode == dest_Fixed) || 143 ASSERT((delivery_mode == dest_Fixed) ||
@@ -151,7 +154,7 @@ static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
151 struct kvm *kvm = ioapic->kvm; 154 struct kvm *kvm = ioapic->kvm;
152 struct kvm_vcpu *vcpu; 155 struct kvm_vcpu *vcpu;
153 156
154 ioapic_debug("dest %d dest_mode %d", dest, dest_mode); 157 ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode);
155 158
156 if (dest_mode == 0) { /* Physical mode. */ 159 if (dest_mode == 0) { /* Physical mode. */
157 if (dest == 0xFF) { /* Broadcast. */ 160 if (dest == 0xFF) { /* Broadcast. */
@@ -179,7 +182,7 @@ static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
179 kvm_apic_match_logical_addr(vcpu->apic, dest)) 182 kvm_apic_match_logical_addr(vcpu->apic, dest))
180 mask |= 1 << vcpu->vcpu_id; 183 mask |= 1 << vcpu->vcpu_id;
181 } 184 }
182 ioapic_debug("mask %x", mask); 185 ioapic_debug("mask %x\n", mask);
183 return mask; 186 return mask;
184} 187}
185 188
@@ -196,12 +199,12 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
196 int vcpu_id; 199 int vcpu_id;
197 200
198 ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x " 201 ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x "
199 "vector=%x trig_mode=%x", 202 "vector=%x trig_mode=%x\n",
200 dest, dest_mode, delivery_mode, vector, trig_mode); 203 dest, dest_mode, delivery_mode, vector, trig_mode);
201 204
202 deliver_bitmask = ioapic_get_delivery_bitmask(ioapic, dest, dest_mode); 205 deliver_bitmask = ioapic_get_delivery_bitmask(ioapic, dest, dest_mode);
203 if (!deliver_bitmask) { 206 if (!deliver_bitmask) {
204 ioapic_debug("no target on destination"); 207 ioapic_debug("no target on destination\n");
205 return; 208 return;
206 } 209 }
207 210
@@ -214,7 +217,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
214 trig_mode, delivery_mode); 217 trig_mode, delivery_mode);
215 else 218 else
216 ioapic_debug("null round robin: " 219 ioapic_debug("null round robin: "
217 "mask=%x vector=%x delivery_mode=%x", 220 "mask=%x vector=%x delivery_mode=%x\n",
218 deliver_bitmask, vector, dest_LowestPrio); 221 deliver_bitmask, vector, dest_LowestPrio);
219 break; 222 break;
220 case dest_Fixed: 223 case dest_Fixed:
@@ -304,7 +307,7 @@ static void ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len,
304 struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private; 307 struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private;
305 u32 result; 308 u32 result;
306 309
307 ioapic_debug("addr %lx", (unsigned long)addr); 310 ioapic_debug("addr %lx\n", (unsigned long)addr);
308 ASSERT(!(addr & 0xf)); /* check alignment */ 311 ASSERT(!(addr & 0xf)); /* check alignment */
309 312
310 addr &= 0xff; 313 addr &= 0xff;
@@ -341,8 +344,8 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
341 struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private; 344 struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private;
342 u32 data; 345 u32 data;
343 346
344 ioapic_debug("ioapic_mmio_write addr=%lx len=%d val=%p\n", 347 ioapic_debug("ioapic_mmio_write addr=%p len=%d val=%p\n",
345 addr, len, val); 348 (void*)addr, len, val);
346 ASSERT(!(addr & 0xf)); /* check alignment */ 349 ASSERT(!(addr & 0xf)); /* check alignment */
347 if (len == 4 || len == 8) 350 if (len == 4 || len == 8)
348 data = *(u32 *) val; 351 data = *(u32 *) val;