From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 7/8] isa: refine irq reservations
Date: Fri, 11 Sep 2009 14:32:30 +0200 [thread overview]
Message-ID: <1252672351-12937-8-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1252672351-12937-1-git-send-email-kraxel@redhat.com>
There are a few cases where IRQ sharing on the ISA bus is used and
possible. In general only devices of the same kind can do that.
A few use cases:
* serial lines 1+3 share irq 4
* serial lines 2+4 share irq 3
* parallel ports share irq 7
* ppc/prep: ide ports share irq 13
This patch refines the irq reservation mechanism for the isa bus to
handle those cases. It keeps track of the driver which owns the IRQ in
question and allows irq sharing for devices handled by the same driver.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/isa-bus.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 4ecc0f8..1d2ca90 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -26,6 +26,7 @@ struct ISABus {
BusState qbus;
qemu_irq *irqs;
uint32_t assigned;
+ DeviceInfo *irq_owner[16];
};
static ISABus *isabus;
@@ -71,7 +72,9 @@ qemu_irq isa_reserve_irq(int isairq)
exit(1);
}
if (isabus->assigned & (1 << isairq)) {
- fprintf(stderr, "isa irq %d already assigned\n", isairq);
+ DeviceInfo *owner = isabus->irq_owner[isairq];
+ fprintf(stderr, "isa irq %d already assigned (%s)\n",
+ isairq, owner ? owner->name : "unknown");
exit(1);
}
isabus->assigned |= (1 << isairq);
@@ -82,10 +85,17 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
{
assert(dev->nirqs < ARRAY_SIZE(dev->isairq));
if (isabus->assigned & (1 << isairq)) {
- fprintf(stderr, "isa irq %d already assigned\n", isairq);
- exit(1);
+ DeviceInfo *owner = isabus->irq_owner[isairq];
+ if (owner == dev->qdev.info) {
+ /* irq sharing is ok in case the same driver handles both */;
+ } else {
+ fprintf(stderr, "isa irq %d already assigned (%s)\n",
+ isairq, owner ? owner->name : "unknown");
+ exit(1);
+ }
}
isabus->assigned |= (1 << isairq);
+ isabus->irq_owner[isairq] = dev->qdev.info;
dev->isairq[dev->nirqs] = isairq;
*p = isabus->irqs[isairq];
dev->nirqs++;
--
1.6.2.5
next prev parent reply other threads:[~2009-09-11 12:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 12:32 [Qemu-devel] [PATCH 0/8] ide: convert to qdev Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 1/8] qdev/pci: add pci_create_noinit() Gerd Hoffmann
2009-09-11 14:14 ` Markus Armbruster
2009-09-11 14:28 ` Gerd Hoffmann
2009-09-11 14:57 ` Markus Armbruster
2009-09-11 12:32 ` [Qemu-devel] [PATCH 2/8] support media=cdrom for if=none Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 3/8] split away drive init from ide_init2() Gerd Hoffmann
2009-09-11 14:27 ` Markus Armbruster
2009-09-11 14:36 ` Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 4/8] ide/qdev: add ide bus Gerd Hoffmann
[not found] ` <m3fxat8u80.fsf@neno.mitica>
2009-09-11 14:10 ` [Qemu-devel] " Gerd Hoffmann
2009-09-11 14:54 ` [Qemu-devel] " Markus Armbruster
2009-09-11 15:01 ` Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 5/8] ide/pci: convert to qdev Gerd Hoffmann
[not found] ` <m3bplh8u13.fsf@neno.mitica>
2009-09-11 14:13 ` [Qemu-devel] " Gerd Hoffmann
[not found] ` <m3my517dni.fsf@neno.mitica>
2009-09-11 14:58 ` Gerd Hoffmann
[not found] ` <m3y6ol5x64.fsf@neno.mitica>
2009-09-11 19:16 ` Gerd Hoffmann
[not found] ` <m3bplh2js1.fsf@neno.mitica>
2009-09-14 7:09 ` Gerd Hoffmann
2009-09-11 15:21 ` [Qemu-devel] " Markus Armbruster
2009-09-14 6:44 ` Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 6/8] ide/isa: " Gerd Hoffmann
2009-09-11 12:32 ` Gerd Hoffmann [this message]
2009-09-11 12:32 ` [Qemu-devel] [PATCH 8/8] unbreak ppc/prep Gerd Hoffmann
2009-09-11 14:31 ` [Qemu-devel] Re: [PATCH 0/8] ide: convert to qdev Juan Quintela
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=1252672351-12937-8-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--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).