qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: >2 serial ports?


From: Avi Kivity
Subject: Re: [Qemu-devel] Re: >2 serial ports?
Date: Mon, 22 Mar 2010 11:02:30 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3

On 03/22/2010 10:35 AM, Michael Tokarev wrote:
Paul Brook wrote at Wed, 17 Mar 2010 11:18:09 +0000:
Oh, well, yes, I remember.  qemu is more strict on ISA irq sharing now.
   A bit too strict.

/me goes dig out a old patch which never made it upstream for some
reason I forgot.  Attached.
This is wrong. Two devices should never be manipulating the same qemu_irq
object.  If you want multiple devices connected to the same IRQ then you need
an explicit multiplexer. e.g. arm_timer.c:sp804_set_irq.
So... what we have to do here?

I've looked at the mentioned routine, here it is:

/* Merge the IRQs from the two component devices.  */
static void sp804_set_irq(void *opaque, int irq, int level)
{
     sp804_state *s = (sp804_state *)opaque;

     s->level[irq] = level;
     qemu_set_irq(s->irq, s->level[0] || s->level[1]);
}

But I know nothing about qemu internals, so don't quite
understand how to do this in case of serial ports.  I
see it is tracking two timers and raises the irq level
if at least one half is raised...  That to say - I've
got the idea, but how to apply it to serial ports?

Two devices have the same s->irq. Give each on its own qemu_irq, and feed it into a multiplexer that ORs them together and sends the result to the interrupt controller's qemu_irq:


S1 ----qemu_irq---->+------+

                    |  mux  +---qemu_irq----->  irq controller

S2 ----qemu_irq---->+------+


(the ascii art will come out all wrong, I know it)

--

Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]