From: "J. Mayer" <l_indien@magic.fr>
To: qemu-devel@nongnu.org
Subject: Re: IRQ handling (was [Qemu-devel] qemu Makefile.target vl.h hw/acpi.c hw/adlib.c ...)
Date: Sun, 08 Apr 2007 10:38:46 +0200 [thread overview]
Message-ID: <1176021526.1516.155.camel@rapid> (raw)
In-Reply-To: <1176018595.1516.115.camel@rapid>
On Sun, 2007-04-08 at 09:49 +0200, J. Mayer wrote:
> I'm sorry, I'm no sure I can (NDA rules....).
> Let's say it's a chips used in some consumer electronics products.
I gave this example to show that we cannot pre-determine any limit to
the number of PINs we have to manage, even if it's a poor design and
that no one need those 500 IRQ sources (50 would be sufficient if it was
well designed but that the way the actual hardware has been
designed...).
Here's an example which is documented:
A CHRP machine is supposed to have an OpenPIC controller (up to 32 IRQ
sources and up to 4 output IRQ pins) and 2 i8259. This simple machine
already has more than 32 IRQs.
Some may also have 2 cascaded OpenPICs.
It will also have one or more PCI controllers (which have it's own IRQ
controller, n inputs, 4 outputs, on actual hardware).
Some complex PCI devices may also have an internal IRQ controller if
they can generate a lot of different hardware events. Those devices can
even be hotplugged.
Then, can you pre-determine the maximum number of IRQ of a hardware
platform ? I can't, because it's conceptually impossible.
[....]
Ooops... Lots of typo in what I wrote....
> static inline void qemu_pin_set_state(struct PINState *st, int level)
> {
> if (st->handler != NULL && level != st->level != level) {
I meant .... && level != st->level) {
[...]
> static inline void qemu_ping_raise(struct PINState *st)
I meant qemu_pin_raise (not ping).
You can even have an allocator to ease sharing the information between
the devices, like:
static inline PINState *qemu_pin_alloc (void *opaque, int n, int
initial_level)
{
PINState *st;
st = qemu_mallocz(sizeof(PINState));
if (st != NULL) {
st->opaque = opaque;
st->n = n;
st->level = initial_level;
}
}
And note that if you really want to emulate GPIOs, you may also need to
add a default_level field to the structure and a bitmask to know which
devices are really driving the PIN (as it reaches its default state only
when no one is driving it). and a new function to signal the case where
the PIN is beeing released (not drived) by a peripheral. And a
peripheral need to identify itself when calling the pin_raise,
pin_lower, pin_release function. The only limitation of this approach
may be the number of peripheral driving one single signal on the board,
which can not be > of the size of the bitfield. But you can have as many
handled signals as you need too.
Once again, one of the two structure is not needed (qemu_irq /
IRQState): there is only one physical state so having 2 different
description of the same thing is conceptually broken. Nothing can be
stored in a generic place as a PIN connection is a completely local
concept between a set of devices. And once again, IRQ are not bound to a
CPU. Storing any informations about IRQs in the CPU structure is
meaningless. Where do you store the IRQ informations when you have 2, 4
CPUs connected to one OpenPIC ? Choose a random CPU ? Only use one ?
Then, we can see the code that has been commited does not solve the
problems of generic signal routing and is conceptually completelly
broken.
One last point:
I thought more about the ppc_openpic_irq function and I have to admit
it's not the good approach.
Yes, this has to be changed to store the IRQ destination inside the
OpenPIC controller and directly call the ppc_set_irq callback. In fact,
there should be a function replacing the ppc_openpic_irq one that
handles the external exception sources and callback ppc_set_irq (this
function also manages internal hardware exception sources). The code in
hw/ppc.c would not be changed a lot but the OpenPIC would be more
generic and may allow some crazy schemes where the outputs would not be
connected to the same destination device (usually the CPU). And it may
make easier to use OpenPIC on hardware that are not PowerPC base (with
no hack), which is imho more important (OpenPIC was designed for and
used on AMD SMP PC platforms, originally). I'll change this, once the
IRQ problems will be solved (which seems urgent, more than anything
else).
--
J. Mayer <l_indien@magic.fr>
Never organized
next prev parent reply other threads:[~2007-04-08 8:42 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-07 18:14 [Qemu-devel] qemu Makefile.target vl.h hw/acpi.c hw/adlib.c Paul Brook
2007-04-07 18:32 ` J. Mayer
2007-04-07 19:10 ` Paul Brook
2007-04-07 19:32 ` Blue Swirl
2007-04-07 19:46 ` Paul Brook
2007-04-07 20:28 ` J. Mayer
2007-04-07 20:45 ` Paul Brook
2007-04-07 22:18 ` J. Mayer
2007-04-07 22:49 ` Thiemo Seufer
2007-04-07 23:13 ` Paul Brook
2007-04-07 23:54 ` J. Mayer
2007-04-08 0:04 ` Thiemo Seufer
2007-04-08 7:49 ` IRQ handling (was [Qemu-devel] qemu Makefile.target vl.h hw/acpi.c hw/adlib.c ...) J. Mayer
2007-04-08 8:38 ` J. Mayer [this message]
2007-04-08 14:41 ` Thiemo Seufer
2007-04-08 16:31 ` J. Mayer
2007-04-08 20:43 ` QEMU Automated Testing " Natalia Portillo
2007-04-08 22:07 ` Eduardo Felipe
2007-04-08 23:53 ` Natalia Portillo
2007-04-09 9:36 ` Eduardo Felipe
2007-04-09 21:19 ` Rob Landley
2007-04-10 11:24 ` Jamie Lokier
2007-04-10 12:00 ` Pierre d'Herbemont
2007-07-27 14:21 ` Dan Shearer
2007-07-27 14:29 ` Anthony Liguori
2007-07-27 14:34 ` Dan Shearer
2007-07-27 14:58 ` Sunil Amitkumar Janki
2007-07-27 15:12 ` Dan Shearer
2007-07-27 15:50 ` Sunil Amitkumar Janki
2007-07-27 16:04 ` Dan Shearer
2007-07-27 16:50 ` Jan Marten Simons
2007-07-27 18:51 ` Thiemo Seufer
2007-07-27 19:55 ` Sunil Amitkumar Janki
2007-07-28 10:17 ` Thiemo Seufer
2007-07-28 11:41 ` Sunil Amitkumar Janki
2007-07-28 12:43 ` [Qemu-devel] Re: QEMU Automated Testing Stefan Weil
2007-07-27 18:54 ` QEMU Automated Testing (was [Qemu-devel] qemu Makefile.target vl.h hw/acpi.c hw/adlib.c ...) Andreas Färber
2007-07-28 10:36 ` Thiemo Seufer
2007-07-29 15:31 ` Andreas Färber
2007-04-10 11:17 ` IRQ handling " Jamie Lokier
2007-04-09 0:41 ` [Qemu-devel] Re: IRQ handling Paul Brook
2007-04-09 11:11 ` J. Mayer
2007-04-09 13:58 ` Paul Brook
2007-04-09 14:56 ` J. Mayer
2007-04-09 16:57 ` Paul Brook
2007-04-07 23:26 ` [Qemu-devel] qemu Makefile.target vl.h hw/acpi.c hw/adlib.c Fabrice Bellard
2007-04-08 13:06 ` Wang Cheng Yeh
2007-04-08 13:56 ` Thiemo Seufer
2007-04-08 22:45 ` Paul Brook
2007-04-07 21:20 ` Thiemo Seufer
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=1176021526.1516.155.camel@rapid \
--to=l_indien@magic.fr \
--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).