>2 serial ports?
Since 0.12, it appears that kvm does not allow more than 2 serial ports for a guest:
$ kvm \ -serial unix:s1,server,nowait \ -serial unix:s2,server,nowait \ -serial unix:s3,server,nowait isa irq 4 already assigned
Is there a work-around for this?
Thanks!
/mjt
Quoted 10 lines · Michael Tokarev
Since 0.12, it appears that kvm does not allow more than 2 serial ports for a guest:
$ kvm \ -serial unix:s1,server,nowait \ -serial unix:s2,server,nowait \ -serial unix:s3,server,nowait isa irq 4 already assignedIs there a work-around for this?
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.
HTH,
Gerd
Quoted 1 line
From
7d5d53e8a23544ac6413487a8ecdd43537ade9f3Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Fri, 11 Sep 2009 13:43:46 +0200
Subject: [PATCH] isa: refine irq reservations
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.
--- hw/isa-bus.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
hw/isa-bus.c +13 -3
@@ -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++;
Signature · 1 line
1.6.6.1
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Michael Tokarev
Since 0.12, it appears that kvm does not allow more than 2 serial ports for a guest:
$ kvm \ -serial unix:s1,server,nowait \ -serial unix:s2,server,nowait \ -serial unix:s3,server,nowait isa irq 4 already assigned
Quoted 7 lines
Quoted 1 line
Is there a work-around for this?
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.
I tried the patch, and it now appears to work. I did not try to run various stress tests so far, but basic tests are fine.
Thank you Gerd! And I think it's time to push it finally :)
/mjt
Quoted 5 lines
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.
Paul
Paul Brook wrote at Wed, 17 Mar 2010 11:18:09 +0000:
Quoted 9 lines
Quoted 5 lines
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_irqobject. 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?
Thanks!
/mjt
Quoted 25 lines · Michael Tokarev
Paul Brook wrote at Wed, 17 Mar 2010 11:18:09 +0000:
Quoted 10 lines
Quoted 6 lines
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_irqobject. 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]); }
Quoted 6 lines
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)
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
May I ask if it is possible to bind a real physical serial port to a guest?
Thanks,
Neo
Quoted 19 lines · Michael Tokarev
Since 0.12, it appears that kvm does not allow more than 2 serial ports for a guest:
$ kvm \ -serial unix:s1,server,nowait \ -serial unix:s2,server,nowait \ -serial unix:s3,server,nowait isa irq 4 already assignedIs there a work-around for this?
Thanks!
/mjt
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I would remember that if researchers were not ambitious probably today we haven't the technology we are using!
Quoted 1 line · Neo Jia
May I ask if it is possible to bind a real physical serial port to a guest?
It is all described in the documentation, quite a long list of various things you can attach to a virtual serial port, incl. a real one.
/mjt
Quoted 6 lines · Michael Tokarev
Quoted 1 line · Neo Jia
May I ask if it is possible to bind a real physical serial port to a guest?
It is all described in the documentation, quite a long list of various things you can attach to a virtual serial port, incl. a real one.
I have tried -serial /dev/ttyS0 but I can't use it to debug my Windows guest.
Thanks,
Neo
Quoted 3 lines
/mjt
Signature · 2 lines
I would remember that if researchers were not ambitious probably today we haven't the technology we are using!
Quoted 8 lines · Neo Jia
Quoted 5 lines · Michael Tokarev
Quoted 1 line · Neo Jia
May I ask if it is possible to bind a real physical serial port to a guest?
It is all described in the documentation, quite a long list of various things you can attach to a virtual serial port, incl. a real one.
I have tried -serial
/dev/ttyS0but I can't use it to debug my Windows guest.
That's entirely different issue, -- inability to debug windows guests. Please don't hijack other threads for unrelated issues -- it makes finding information and replying more difficult. If it does not work for you, ask in a new thread. But before, try to research the issue a bit, I've seen several discussions about debugging guests over serial port in kvm. Besides, I've no idea what are you really trying to do - debugging a guest is much easier in kvm than to set up another HOST and connect two HOSTS over a null-modem serial cable....
/mjt