aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhang Xiantao <xiantao.zhang@intel.com>2007-12-02 09:49:09 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:17 -0500
commit0c7ac28d3dd27d718493aae4bbc7de89a2d9d386 (patch)
tree976c243aa5f4325c9087f3e2f88d81d8b0e48983 /drivers
parent8be5453f95933340a42c6e7fc7b66f3bb786fddd (diff)
KVM: Replace dest_Lowest_Prio and dest_Fixed with self-defined macros
Change dest_Loest_Prio -> IOAPIC_LOWEST_PRIORITY dest_Fixed -> IOAPIC_FIXED the original names are x86 specific, while the ioapic code will be reused for ia64. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/ioapic.c13
-rw-r--r--drivers/kvm/irq.h8
2 files changed, 13 insertions, 8 deletions
diff --git a/drivers/kvm/ioapic.c b/drivers/kvm/ioapic.c
index 3629867a76bc..0feae6f7fb2d 100644
--- a/drivers/kvm/ioapic.c
+++ b/drivers/kvm/ioapic.c
@@ -36,11 +36,8 @@
36#include <linux/hrtimer.h> 36#include <linux/hrtimer.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <asm/processor.h> 38#include <asm/processor.h>
39#include <asm/msr.h>
40#include <asm/page.h> 39#include <asm/page.h>
41#include <asm/current.h> 40#include <asm/current.h>
42#include <asm/apicdef.h>
43#include <asm/io_apic.h>
44#include "irq.h" 41#include "irq.h"
45#if 0 42#if 0
46#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) 43#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg)
@@ -142,8 +139,8 @@ static void ioapic_inj_irq(struct kvm_ioapic *ioapic,
142 ioapic_debug("irq %d trig %d deliv %d\n", vector, trig_mode, 139 ioapic_debug("irq %d trig %d deliv %d\n", vector, trig_mode,
143 delivery_mode); 140 delivery_mode);
144 141
145 ASSERT((delivery_mode == dest_Fixed) || 142 ASSERT((delivery_mode == IOAPIC_FIXED) ||
146 (delivery_mode == dest_LowestPrio)); 143 (delivery_mode == IOAPIC_LOWEST_PRIORITY));
147 144
148 kvm_apic_set_irq(vcpu, vector, trig_mode); 145 kvm_apic_set_irq(vcpu, vector, trig_mode);
149} 146}
@@ -210,7 +207,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
210 } 207 }
211 208
212 switch (delivery_mode) { 209 switch (delivery_mode) {
213 case dest_LowestPrio: 210 case IOAPIC_LOWEST_PRIORITY:
214 vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector, 211 vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector,
215 deliver_bitmask); 212 deliver_bitmask);
216 if (vcpu != NULL) 213 if (vcpu != NULL)
@@ -219,9 +216,9 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
219 else 216 else
220 ioapic_debug("null lowest prio vcpu: " 217 ioapic_debug("null lowest prio vcpu: "
221 "mask=%x vector=%x delivery_mode=%x\n", 218 "mask=%x vector=%x delivery_mode=%x\n",
222 deliver_bitmask, vector, dest_LowestPrio); 219 deliver_bitmask, vector, IOAPIC_LOWEST_PRIORITY);
223 break; 220 break;
224 case dest_Fixed: 221 case IOAPIC_FIXED:
225 for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) { 222 for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) {
226 if (!(deliver_bitmask & (1 << vcpu_id))) 223 if (!(deliver_bitmask & (1 << vcpu_id)))
227 continue; 224 continue;
diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
index 78a34dde1cb9..75f5f18d801c 100644
--- a/drivers/kvm/irq.h
+++ b/drivers/kvm/irq.h
@@ -79,6 +79,14 @@ void kvm_pic_update_irq(struct kvm_pic *s);
79#define IOAPIC_REG_VERSION 0x01 79#define IOAPIC_REG_VERSION 0x01
80#define IOAPIC_REG_ARB_ID 0x02 /* x86 IOAPIC only */ 80#define IOAPIC_REG_ARB_ID 0x02 /* x86 IOAPIC only */
81 81
82/*ioapic delivery mode*/
83#define IOAPIC_FIXED 0x0
84#define IOAPIC_LOWEST_PRIORITY 0x1
85#define IOAPIC_PMI 0x2
86#define IOAPIC_NMI 0x4
87#define IOAPIC_INIT 0x5
88#define IOAPIC_EXTINT 0x7
89
82struct kvm_ioapic { 90struct kvm_ioapic {
83 u64 base_address; 91 u64 base_address;
84 u32 ioregsel; 92 u32 ioregsel;