aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-08-24 18:19:15 +0300
committerAvi Kivity <avi@redhat.com>2009-08-24 18:19:15 +0300
commit40880583a1e9b6f9161b292cbe8c8a2aa4cbea0d (patch)
treed1234af64e3d5c3ea81c5e5c29d136b3e6d1530d
parentMerge commit '1452411b25fb207e7f442e5a5128f34b4939d31c' into upstream-merge (diff)
parentRoute IOAPIC interrupts via ISA bus (diff)
downloadqemu-kvm-40880583a1e9b6f9161b292cbe8c8a2aa4cbea0d.tar.gz
qemu-kvm-40880583a1e9b6f9161b292cbe8c8a2aa4cbea0d.tar.bz2
qemu-kvm-40880583a1e9b6f9161b292cbe8c8a2aa4cbea0d.zip
Merge commit '1632dc6a8f6e8662f4a203b6fb8c0371ca216946' into upstream-merge
* commit '1632dc6a8f6e8662f4a203b6fb8c0371ca216946': Route IOAPIC interrupts via ISA bus Conflicts: hw/i8259.c hw/pc.h Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--hw/i8259.c15
-rw-r--r--hw/ioapic.c6
-rw-r--r--hw/pc.c25
-rw-r--r--hw/pc.h4
4 files changed, 20 insertions, 30 deletions
diff --git a/hw/i8259.c b/hw/i8259.c
index 19c9d170a..fe12a667c 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -62,9 +62,6 @@ struct PicState2 {
PicState pics[2];
qemu_irq parent_irq;
void *irq_request_opaque;
- /* IOAPIC callback support */
- SetIRQFunc *alt_irq_func;
- void *alt_irq_opaque;
};
#if defined(DEBUG_PIC) || defined (DEBUG_IRQ_COUNT)
@@ -204,9 +201,6 @@ static void i8259_set_irq(void *opaque, int irq, int level)
}
#endif
pic_set_irq1(&s->pics[irq >> 3], irq & 7, level);
- /* used for IOAPIC irqs */
- if (s->alt_irq_func)
- s->alt_irq_func(s->alt_irq_opaque, irq, level);
pic_update_irq(s);
}
@@ -592,13 +586,6 @@ qemu_irq *i8259_init(qemu_irq parent_irq)
return qemu_allocate_irqs(i8259_set_irq, s, 16);
}
-void pic_set_alt_irq_func(PicState2 *s, SetIRQFunc *alt_irq_func,
- void *alt_irq_opaque)
-{
- s->alt_irq_func = alt_irq_func;
- s->alt_irq_opaque = alt_irq_opaque;
-}
-
#ifdef KVM_CAP_IRQCHIP
static void kvm_kernel_pic_save_to_user(PicState *s)
{
@@ -708,7 +695,7 @@ qemu_irq *kvm_i8259_init(qemu_irq parent_irq)
s->pics[0].pics_state = s;
s->pics[1].pics_state = s;
isa_pic = s;
- return qemu_allocate_irqs(kvm_i8259_set_irq, s, 16);
+ return qemu_allocate_irqs(kvm_i8259_set_irq, s, 24);
}
#endif
diff --git a/hw/ioapic.c b/hw/ioapic.c
index 32019de66..41ab5e7a2 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -317,9 +317,10 @@ static CPUWriteMemoryFunc *ioapic_mem_write[3] = {
ioapic_mem_writel,
};
-IOAPICState *ioapic_init(void)
+qemu_irq *ioapic_init(void)
{
IOAPICState *s;
+ qemu_irq *irq;
int io_memory;
s = qemu_mallocz(sizeof(IOAPICState));
@@ -331,6 +332,7 @@ IOAPICState *ioapic_init(void)
register_savevm("ioapic", 0, 2, ioapic_save, ioapic_load, s);
qemu_register_reset(ioapic_reset, s);
+ irq = qemu_allocate_irqs(ioapic_set_irq, s, IOAPIC_NUM_PINS);
- return s;
+ return irq;
}
diff --git a/hw/pc.c b/hw/pc.c
index 2e9290247..530c7f19e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -65,7 +65,6 @@
static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
-static IOAPICState *ioapic;
static PCIDevice *i440fx_state;
typedef struct rom_reset_data {
@@ -94,14 +93,18 @@ static void option_rom_setup_reset(target_phys_addr_t addr, unsigned size)
typedef struct isa_irq_state {
qemu_irq *i8259;
+ qemu_irq *ioapic;
} IsaIrqState;
static void isa_irq_handler(void *opaque, int n, int level)
{
IsaIrqState *isa = (IsaIrqState *)opaque;
- qemu_set_irq(isa->i8259[n], level);
-}
+ if (n < 16) {
+ qemu_set_irq(isa->i8259[n], level);
+ }
+ qemu_set_irq(isa->ioapic[n], level);
+};
static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
{
@@ -1291,13 +1294,16 @@ static void pc_init1(ram_addr_t ram_size,
cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1);
#ifdef KVM_CAP_IRQCHIP
if (kvm_enabled() && qemu_kvm_irqchip_in_kernel()) {
- i8259 = kvm_i8259_init(cpu_irq[0]);
+ isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
+ isa_irq = i8259 = kvm_i8259_init(cpu_irq[0]);
} else
#endif
+ {
i8259 = i8259_init(cpu_irq[0]);
- isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
- isa_irq_state->i8259 = i8259;
- isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 16);
+ isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
+ isa_irq_state->i8259 = i8259;
+ isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
+ }
ferr_irq = isa_irq[13];
if (pci_enabled) {
@@ -1339,7 +1345,7 @@ static void pc_init1(ram_addr_t ram_size,
register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
if (pci_enabled) {
- ioapic = ioapic_init();
+ isa_irq_state->ioapic = ioapic_init();
}
#ifdef USE_KVM_PIT
if (kvm_enabled() && qemu_kvm_pit_in_kernel())
@@ -1351,9 +1357,6 @@ static void pc_init1(ram_addr_t ram_size,
if (!no_hpet) {
hpet_init(isa_irq);
}
- if (pci_enabled) {
- pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
- }
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
if (serial_hds[i]) {
diff --git a/hw/pc.h b/hw/pc.h
index db8fac784..6de00bb7c 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -27,8 +27,6 @@ void pic_set_irq(int irq, int level);
void pic_set_irq_new(void *opaque, int irq, int level);
qemu_irq *i8259_init(qemu_irq parent_irq);
qemu_irq *kvm_i8259_init(qemu_irq parent_irq);
-void pic_set_alt_irq_func(PicState2 *s, SetIRQFunc *alt_irq_func,
- void *alt_irq_opaque);
int pic_read_irq(PicState2 *s);
void pic_update_irq(PicState2 *s);
uint32_t pic_intack_read(PicState2 *s);
@@ -45,7 +43,7 @@ int apic_init(CPUState *env);
int apic_accept_pic_intr(CPUState *env);
void apic_deliver_pic_intr(CPUState *env, int level);
int apic_get_interrupt(CPUState *env);
-IOAPICState *ioapic_init(void);
+qemu_irq *ioapic_init(void);
void ioapic_set_irq(void *opaque, int vector, int level);
void apic_reset_irq_delivered(void);
int apic_get_irq_delivered(void);