diff options
author | Robert Mustacchi <rm@joyent.com> | 2011-06-06 10:09:46 -0700 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2011-06-06 10:09:46 -0700 |
commit | 801bbc8943e1dc9498ea033e11416b9f8e4f862f (patch) | |
tree | f602c201c40283852b09fa5a880f8c96dbe59935 /kvm_irq.h | |
parent | 1662d9d57f26a6bb37f716089871f6809ed78eeb (diff) | |
download | illumos-kvm-801bbc8943e1dc9498ea033e11416b9f8e4f862f.tar.gz |
HVM-291 irq.h should be kvm_irq.h
HVM-292 kvm_irq.c shouldn't have extern declarations
Diffstat (limited to 'kvm_irq.h')
-rw-r--r-- | kvm_irq.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/kvm_irq.h b/kvm_irq.h new file mode 100644 index 0000000..88dc129 --- /dev/null +++ b/kvm_irq.h @@ -0,0 +1,97 @@ +/* + * kvm_irq.h: in kernel interrupt controller related definitions + * Copyright (c) 2007, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * Authors: + * Yaozu (Eddie) Dong <Eddie.dong@intel.com> + * + */ + +#ifndef __IRQ_H +#define __IRQ_H + +#include <sys/mutex.h> +#include "kvm_host.h" + +#include "kvm_iodev.h" +#include "kvm_ioapic.h" +#include "kvm_lapic.h" + +#define PIC_NUM_PINS 16 +#define SELECT_PIC(irq) \ + ((irq) < 8 ? KVM_IRQCHIP_PIC_MASTER : KVM_IRQCHIP_PIC_SLAVE) + +struct kvm; +struct kvm_vcpu; + +typedef void irq_request_func(void *opaque, int level); + +typedef struct kvm_kpic_state { + uint8_t last_irr; /* edge detection */ + uint8_t irr; /* interrupt request register */ + uint8_t imr; /* interrupt mask register */ + uint8_t isr; /* interrupt service register */ + uint8_t isr_ack; /* interrupt ack detection */ + uint8_t priority_add; /* highest irq priority */ + uint8_t irq_base; + uint8_t read_reg_select; + uint8_t poll; + uint8_t special_mask; + uint8_t init_state; + uint8_t auto_eoi; + uint8_t rotate_on_auto_eoi; + uint8_t special_fully_nested_mode; + uint8_t init4; /* true if 4 byte init */ + uint8_t elcr; /* PIIX edge/trigger selection */ + uint8_t elcr_mask; + struct kvm_pic *pics_state; +} kvm_kpic_state_t; + +typedef struct kvm_pic { + kmutex_t lock; + unsigned pending_acks; + struct kvm *kvm; + struct kvm_kpic_state pics[2]; /* 0 is master pic, 1 is slave pic */ + irq_request_func *irq_request; + void *irq_request_opaque; + int output; /* intr from master PIC */ + struct kvm_io_device dev; + void (*ack_notifier)(void *opaque, int irq); + unsigned long irq_states[16]; +} kvm_pic_t; + +struct kvm_pic *kvm_create_pic(struct kvm *kvm); +void kvm_destroy_pic(struct kvm *kvm); +int kvm_pic_read_irq(struct kvm *kvm); +void kvm_pic_update_irq(struct kvm_pic *s); +void kvm_pic_clear_isr_ack(struct kvm *kvm); + +struct kvm_pic *pic_irqchip(struct kvm *kvm); +int irqchip_in_kernel(struct kvm *kvm); + +void kvm_pic_reset(struct kvm_kpic_state *s); +void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu); + +void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); +void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); +void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); +void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu); +void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu); +void __kvm_migrate_timers(struct kvm_vcpu *vcpu); + +int pit_has_pending_timer(struct kvm_vcpu *vcpu); +int apic_has_pending_timer(struct kvm_vcpu *vcpu); + +#endif |