forked from luck/tmp_suning_uos_patched
KVM: IOAPIC/LAPIC: Enable NMI support
[avi: fix ia64 build breakage] Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
parent
50d40d7fb9
commit
3419ffc8e4
|
@ -356,8 +356,9 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
|
||||||
case APIC_DM_SMI:
|
case APIC_DM_SMI:
|
||||||
printk(KERN_DEBUG "Ignoring guest SMI\n");
|
printk(KERN_DEBUG "Ignoring guest SMI\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APIC_DM_NMI:
|
case APIC_DM_NMI:
|
||||||
printk(KERN_DEBUG "Ignoring guest NMI\n");
|
kvm_inject_nmi(vcpu);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APIC_DM_INIT:
|
case APIC_DM_INIT:
|
||||||
|
|
|
@ -173,6 +173,12 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long addr,
|
||||||
kvm_queue_exception_e(vcpu, PF_VECTOR, error_code);
|
kvm_queue_exception_e(vcpu, PF_VECTOR, error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kvm_inject_nmi(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
vcpu->arch.nmi_pending = 1;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(kvm_inject_nmi);
|
||||||
|
|
||||||
void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
|
void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code)
|
||||||
{
|
{
|
||||||
WARN_ON(vcpu->arch.exception.pending);
|
WARN_ON(vcpu->arch.exception.pending);
|
||||||
|
|
|
@ -521,4 +521,6 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu);
|
||||||
int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
|
int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
|
||||||
void kvm_sal_emul(struct kvm_vcpu *vcpu);
|
void kvm_sal_emul(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
|
static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -288,6 +288,8 @@ struct kvm_vcpu_arch {
|
||||||
unsigned int hv_clock_tsc_khz;
|
unsigned int hv_clock_tsc_khz;
|
||||||
unsigned int time_offset;
|
unsigned int time_offset;
|
||||||
struct page *time_page;
|
struct page *time_page;
|
||||||
|
|
||||||
|
bool nmi_pending;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kvm_mem_alias {
|
struct kvm_mem_alias {
|
||||||
|
@ -515,6 +517,8 @@ void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
|
||||||
void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
|
void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
|
||||||
u32 error_code);
|
u32 error_code);
|
||||||
|
|
||||||
|
void kvm_inject_nmi(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
void fx_init(struct kvm_vcpu *vcpu);
|
void fx_init(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
int emulator_read_std(unsigned long addr,
|
int emulator_read_std(unsigned long addr,
|
||||||
|
|
|
@ -146,6 +146,11 @@ static int ioapic_inj_irq(struct kvm_ioapic *ioapic,
|
||||||
return kvm_apic_set_irq(vcpu, vector, trig_mode);
|
return kvm_apic_set_irq(vcpu, vector, trig_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ioapic_inj_nmi(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
kvm_inject_nmi(vcpu);
|
||||||
|
}
|
||||||
|
|
||||||
static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
|
static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
|
||||||
u8 dest_mode)
|
u8 dest_mode)
|
||||||
{
|
{
|
||||||
|
@ -239,8 +244,19 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IOAPIC_NMI:
|
||||||
/* TODO: NMI */
|
for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) {
|
||||||
|
if (!(deliver_bitmask & (1 << vcpu_id)))
|
||||||
|
continue;
|
||||||
|
deliver_bitmask &= ~(1 << vcpu_id);
|
||||||
|
vcpu = ioapic->kvm->vcpus[vcpu_id];
|
||||||
|
if (vcpu)
|
||||||
|
ioapic_inj_nmi(vcpu);
|
||||||
|
else
|
||||||
|
ioapic_debug("NMI to vcpu %d failed\n",
|
||||||
|
vcpu->vcpu_id);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_WARNING "Unsupported delivery mode %d\n",
|
printk(KERN_WARNING "Unsupported delivery mode %d\n",
|
||||||
delivery_mode);
|
delivery_mode);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user