qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] Route IOAPIC interrupts via ISA bus
Date: Sun,  9 Aug 2009 19:44:56 +0300	[thread overview]
Message-ID: <1249836296-13288-3-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1249836296-13288-1-git-send-email-avi@redhat.com>

Instead of calling the IOAPIC from the PIC, raise IOAPIC irqs via the ISA bus.
As a side effect, IOAPIC lines 16-23 are enabled.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/i8259.c  |   13 -------------
 hw/ioapic.c |    6 ++++--
 hw/pc.c     |   16 ++++++++--------
 hw/pc.h     |    4 +---
 4 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/hw/i8259.c b/hw/i8259.c
index 0b9fab5..74acc39 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -60,9 +60,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)
@@ -203,9 +200,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);
 }
 
@@ -562,10 +556,3 @@ qemu_irq *i8259_init(qemu_irq parent_irq)
     isa_pic = s;
     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;
-}
diff --git a/hw/ioapic.c b/hw/ioapic.c
index a5cdd5d..998894d 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -241,9 +241,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));
@@ -255,6 +256,7 @@ IOAPICState *ioapic_init(void)
 
     register_savevm("ioapic", 0, 1, 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 a6be4a8..5182a57 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -60,7 +60,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 {
@@ -89,14 +88,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)
 {
@@ -1279,7 +1282,7 @@ static void pc_init1(ram_addr_t ram_size,
     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 = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
     ferr_irq = isa_irq[13];
 
     if (pci_enabled) {
@@ -1321,16 +1324,13 @@ 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();
     }
     pit = pit_init(0x40, isa_irq[0]);
     pcspk_init(pit);
     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 9fbae20..043c216 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -32,8 +32,6 @@ extern PicState2 *isa_pic;
 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);
-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);
@@ -50,7 +48,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);
-- 
1.6.2.5

  parent reply	other threads:[~2009-08-09 16:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-09 16:44 [Qemu-devel] [PATCH 0/2] Disentagle ISA IRQs Avi Kivity
2009-08-09 16:44 ` [Qemu-devel] [PATCH 1/2] Route PC irqs to ISA bus instead of i8259 directly Avi Kivity
2009-08-10  8:34   ` Gerd Hoffmann
2009-08-10  8:46     ` Avi Kivity
2009-08-10  9:04   ` Alexander Graf
2009-08-10  9:43     ` Avi Kivity
2009-08-10  9:45     ` Stefan Assmann
2009-08-10  9:52       ` Avi Kivity
2009-08-10 13:20         ` Olaf Dabrunz
2009-08-10 13:14       ` Olaf Dabrunz
2009-08-09 16:44 ` Avi Kivity [this message]
2009-08-10  8:38   ` [Qemu-devel] [PATCH 2/2] Route IOAPIC interrupts via ISA bus Gerd Hoffmann
2009-08-26 16:03   ` Gerd Hoffmann
2009-08-26 16:06     ` Avi Kivity
2009-08-26 16:30       ` Gerd Hoffmann
2009-08-26 19:09         ` Gleb Natapov
2009-08-27  7:40           ` Gerd Hoffmann
2009-08-27  7:57             ` Gleb Natapov
2009-08-27  8:18               ` Jamie Lokier
2009-08-27  8:24                 ` Gleb Natapov
2009-08-27  8:55                 ` Gerd Hoffmann
2009-08-27 10:35                   ` Isaku Yamahata
2009-08-27 21:07                   ` [Qemu-devel] " Bjørn Mork
2009-08-27  4:53         ` [Qemu-devel] " Avi Kivity
2009-08-27  7:35           ` Gerd Hoffmann
2009-08-27  7:57             ` Avi Kivity
2009-08-27  8:13               ` Gerd Hoffmann
2009-08-27  8:26                 ` Avi Kivity
2009-08-28  2:20       ` Beth Kon
2009-08-29 17:47         ` Avi Kivity
2009-08-30  2:09           ` Beth Kon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1249836296-13288-3-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).