diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2011-04-01 15:15:27 +1100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2011-04-01 18:34:56 +0200 |
commit | 0201e2da65b1828937c478fa1ac52e58522a32c1 (patch) | |
tree | cd4510282d6f3e008c65f24613ced28c2e55d9ae /hw/spapr_vty.c | |
parent | 00dc738d8a08fce0f0d327e081bb2bd7b6fba888 (diff) |
Add (virtual) interrupt to PAPR virtual tty device
Now that we have implemented the PAPR "xics" virtualized interrupt
controller, we can add interrupts in PAPR VIO devices. This patch adds
interrupt support to the PAPR virtual tty/console device.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/spapr_vty.c')
-rw-r--r-- | hw/spapr_vty.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index b4da6a83fb..6fc0105eac 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -24,6 +24,10 @@ static void vty_receive(void *opaque, const uint8_t *buf, int size) VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)opaque; int i; + if ((dev->in == dev->out) && size) { + /* toggle line to simulate edge interrupt */ + qemu_irq_pulse(dev->sdev.qirq); + } for (i = 0; i < size; i++) { assert((dev->in - dev->out) < VTERM_BUFSIZE); dev->buf[dev->in++ % VTERM_BUFSIZE] = buf[i]; @@ -112,14 +116,19 @@ static target_ulong h_get_term_char(CPUState *env, sPAPREnvironment *spapr, } void spapr_vty_create(VIOsPAPRBus *bus, - uint32_t reg, CharDriverState *chardev) + uint32_t reg, CharDriverState *chardev, + qemu_irq qirq, uint32_t vio_irq_num) { DeviceState *dev; + VIOsPAPRDevice *sdev; dev = qdev_create(&bus->bus, "spapr-vty"); qdev_prop_set_uint32(dev, "reg", reg); qdev_prop_set_chr(dev, "chardev", chardev); qdev_init_nofail(dev); + sdev = (VIOsPAPRDevice *)dev; + sdev->qirq = qirq; + sdev->vio_irq_num = vio_irq_num; } static void vty_hcalls(VIOsPAPRBus *bus) |