All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: "J. Mayer" <l_indien@magic.fr>
Subject: Re: [Qemu-devel] Re: IRQ handling
Date: Mon, 9 Apr 2007 14:58:49 +0100	[thread overview]
Message-ID: <200704091458.50964.paul@codesourcery.com> (raw)
In-Reply-To: <1176117115.1516.277.camel@rapid>

> > In summary the IRQ source (ie. device raising the IRQ) needs to keep
> > track of 4 values:
> > 1) Callback
> > 2) Opaque callback argument
> > 3) PIN number
> > 4) IRQ state.
>...
> > I believe (1) and (2) are inherently linked, and it makes no sense to
> > set/change them individually.
>
> OK.
>
> > Having each device keep track of 3 values (callback, opaque and nIRQ; see
> > earlier) is a real mess, evidenced by the fact that devices don't do this
> > consistently, the PCI code has grown its own slightly different
> > mechanisms for signalling IRQs, and the ARM boards had their own
> > partially generic implementation. Adding simple and consistent
> > infrastructure for signalling interrupts is IMHO a worthwhile change in
> > its own right.
>
> So, you wanted just to hide all the mess in an opaque ?

Yes. As you agreed above, there's no need for the device to know the details.

> But I still cannot see what functionality this could add, how this could
> make SMP feasible, for example (I do think there was no problem for this
> before), ...

In its current implementation it doesn't provide any functional enhancements 
over a {callpack, opaque, nIRQ} triplet. What it does do is isolate the 
device (IRQ source) emulation from the implementation details.  As you agreed 
above, there's no need for the device to know these details.

It could be extended to do clever things like multiple sources, shared IRQ 
lines and tristate pins, but I have not done this. For the current code it is 
sufficient to model these cases as a virtual fixed-function IRQ controller.

> > I have implemented sufficient infrastructure for a single-master
> > single-slave bus. The most common example of which is a IRQ line. I
> > believe it also covers a usefully large subset GPIO pin uses.
>
> I don't think so. For most hardware, you need to emulate the actual
> hardware behavior if you want to emulate what happens on the GPIO pins.
> And I maintain you need to read back the hardware state if you want to
> know the logical level of an IO. Think about implementing IIC,
> SPI,  .... using GPIO, which is not efficient but quite a usual

We obviously have a different idea of what a "usefully large subset of GPIO 
pin uses" entails. Most of the hardware I'm familiar with has dedicated I2C 
hardware, and uses GPIO pins for interrupts and simple signals (eg. card 
present).

I agree that in some cases you may want to model eg. an I2C bus connected to a 
tristate GPIO pin. I don't have a good solution worked out for that. However 
I am fairly confident that the current infrastructure could be used as a base 
for whatever we do come up with.

>  I have added a fake internal IRQ controller in
> the PowerPC core just to use the same API (the SetIRQ callback / nIRQ /
> level) as the rest of the code to easily plug other IRQ controllers to a
> PowerPC core.
>...
> As suggested by Fabrice,
> instead of adding mess in the Qemu core code, as I needed to add more
> asynchronous exception sources, I decided to hide this using a bitmask
> in the CPU structure, which seemed to be cleaner to me.

Right, This is that same as what MIPS does, and probably ARM will soon.

All I did was to change the "same API" to be abstract object instead of 
messing about with pointless triplets of information. For PPC this conversion 
is incomplete because I don't understand the details well enough to tell how 
bogus the current code is. eg. the openpic emulation looks like it is capable 
of raising several outputs, but only one is ever used.

Paul

  reply	other threads:[~2007-04-09 14:02 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
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 [this message]
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=200704091458.50964.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.