Commit 0c7ac28d authored by Zhang Xiantao's avatar Zhang Xiantao Committed by Avi Kivity

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: default avatarZhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 8be5453f
...@@ -36,11 +36,8 @@ ...@@ -36,11 +36,8 @@
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/msr.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/current.h> #include <asm/current.h>
#include <asm/apicdef.h>
#include <asm/io_apic.h>
#include "irq.h" #include "irq.h"
#if 0 #if 0
#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) #define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg)
...@@ -142,8 +139,8 @@ static void ioapic_inj_irq(struct kvm_ioapic *ioapic, ...@@ -142,8 +139,8 @@ static void ioapic_inj_irq(struct kvm_ioapic *ioapic,
ioapic_debug("irq %d trig %d deliv %d\n", vector, trig_mode, ioapic_debug("irq %d trig %d deliv %d\n", vector, trig_mode,
delivery_mode); delivery_mode);
ASSERT((delivery_mode == dest_Fixed) || ASSERT((delivery_mode == IOAPIC_FIXED) ||
(delivery_mode == dest_LowestPrio)); (delivery_mode == IOAPIC_LOWEST_PRIORITY));
kvm_apic_set_irq(vcpu, vector, trig_mode); kvm_apic_set_irq(vcpu, vector, trig_mode);
} }
...@@ -210,7 +207,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq) ...@@ -210,7 +207,7 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
} }
switch (delivery_mode) { switch (delivery_mode) {
case dest_LowestPrio: case IOAPIC_LOWEST_PRIORITY:
vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector, vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector,
deliver_bitmask); deliver_bitmask);
if (vcpu != NULL) if (vcpu != NULL)
...@@ -219,9 +216,9 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq) ...@@ -219,9 +216,9 @@ static void ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
else else
ioapic_debug("null lowest prio vcpu: " ioapic_debug("null lowest prio vcpu: "
"mask=%x vector=%x delivery_mode=%x\n", "mask=%x vector=%x delivery_mode=%x\n",
deliver_bitmask, vector, dest_LowestPrio); deliver_bitmask, vector, IOAPIC_LOWEST_PRIORITY);
break; break;
case dest_Fixed: case IOAPIC_FIXED:
for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) { for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) {
if (!(deliver_bitmask & (1 << vcpu_id))) if (!(deliver_bitmask & (1 << vcpu_id)))
continue; continue;
......
...@@ -79,6 +79,14 @@ void kvm_pic_update_irq(struct kvm_pic *s); ...@@ -79,6 +79,14 @@ void kvm_pic_update_irq(struct kvm_pic *s);
#define IOAPIC_REG_VERSION 0x01 #define IOAPIC_REG_VERSION 0x01
#define IOAPIC_REG_ARB_ID 0x02 /* x86 IOAPIC only */ #define IOAPIC_REG_ARB_ID 0x02 /* x86 IOAPIC only */
/*ioapic delivery mode*/
#define IOAPIC_FIXED 0x0
#define IOAPIC_LOWEST_PRIORITY 0x1
#define IOAPIC_PMI 0x2
#define IOAPIC_NMI 0x4
#define IOAPIC_INIT 0x5
#define IOAPIC_EXTINT 0x7
struct kvm_ioapic { struct kvm_ioapic {
u64 base_address; u64 base_address;
u32 ioregsel; u32 ioregsel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment