summaryrefslogtreecommitdiff
path: root/hw/char/sclpconsole-lm.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-03-17 22:31:32 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-03-17 22:31:33 +0000
commit315b59344126beab85a62b53582794b14436a5a4 (patch)
treeed80bcbad0373aa418173edc7d6179ad93f817d8 /hw/char/sclpconsole-lm.c
parentcdf0592cb888d071e4b4f37048ad8646ac9fbc8c (diff)
parent4f3ed190a673c0020c3ccebb4882ae4675cb5f4d (diff)
downloadqemu-315b59344126beab85a62b53582794b14436a5a4.tar.gz
qemu-315b59344126beab85a62b53582794b14436a5a4.tar.bz2
qemu-315b59344126beab85a62b53582794b14436a5a4.zip
Merge remote-tracking branch 'remotes/borntraeger/tags/kvm-s390-20140317' into staging
4 small patches: - Fixing findings of valgrind regarding minor memory leaks: Currently we forget the pointer of qemu_allocate_irqs. Since we never free the irqs, this is not critical, but obviously not good programming style. While we are at it, we dont need the irq infrastructure for the sclp consoles. - Handle new ELF error codes for BIOS loading # gpg: Signature made Mon 17 Mar 2014 21:34:12 GMT using RSA key ID B5A61C7C # gpg: Can't check signature: public key not found * remotes/borntraeger/tags/kvm-s390-20140317: s390x/sclpconsole-lm: Fix and simplify irq setup s390x/sclpconsole: Fix and simplify interrupt injection s390x/cpu hotplug: Fix memory leak s390/ipl: Fix error path on BIOS loading Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char/sclpconsole-lm.c')
-rw-r--r--hw/char/sclpconsole-lm.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 93390675d6..a2dc1c63b0 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -41,7 +41,6 @@ typedef struct SCLPConsoleLM {
uint32_t write_errors; /* errors writing to char layer */
uint32_t length; /* length of byte stream in buffer */
uint8_t buf[SIZE_CONSOLE_BUFFER];
- qemu_irq irq_console_read;
} SCLPConsoleLM;
/*
@@ -68,13 +67,15 @@ static int chr_can_read(void *opaque)
return 0;
}
-static void receive_from_chr_layer(SCLPConsoleLM *scon, const uint8_t *buf,
- int size)
+static void chr_read(void *opaque, const uint8_t *buf, int size)
{
+ SCLPConsoleLM *scon = opaque;
+
assert(size == 1);
if (*buf == '\r' || *buf == '\n') {
scon->event.event_pending = true;
+ sclp_service_interrupt(0);
return;
}
scon->buf[scon->length] = *buf;
@@ -84,20 +85,6 @@ static void receive_from_chr_layer(SCLPConsoleLM *scon, const uint8_t *buf,
}
}
-/*
- * Send data from a char device over to the guest
- */
-static void chr_read(void *opaque, const uint8_t *buf, int size)
-{
- SCLPConsoleLM *scon = opaque;
-
- receive_from_chr_layer(scon, buf, size);
- if (scon->event.event_pending) {
- /* trigger SCLP read operation */
- qemu_irq_raise(scon->irq_console_read);
- }
-}
-
/* functions to be called by event facility */
static bool can_handle_event(uint8_t type)
@@ -298,11 +285,6 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *ebh)
return SCLP_RC_NORMAL_COMPLETION;
}
-static void trigger_console_data(void *opaque, int n, int level)
-{
- sclp_service_interrupt(0);
-}
-
/* functions for live migration */
static const VMStateDescription vmstate_sclplmconsole = {
@@ -338,7 +320,6 @@ static int console_init(SCLPEvent *event)
if (scon->chr) {
qemu_chr_add_handlers(scon->chr, chr_can_read, chr_read, NULL, scon);
}
- scon->irq_console_read = *qemu_allocate_irqs(trigger_console_data, NULL, 1);
return 0;
}