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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJTJ2pUAAoJEBF7vIC1phx8u/MP/RNd875pyFYamYF1aLKka7Ov
 hGtTaVtvqtJjsvy57Av9LX3sT1bbafqNTYea8ZXJgMCggHHk+QM/zUSjkY3qZqxL
 V15wCg1wlMXagjkZRwfCD+dGGJK3CQBQSsJ4q9szPeyAf/P1VPOblkR5k0YtqzU7
 ZdjzxuizqnHekaHAfmCvURdngJIRa6C6abYS9oosfyZ4eWlivLrL02i82fYGHUVh
 Nd2GylqHLZNy2laHzwKKeItw+Lu3O3bl6OY4kXqColyaNEMcuM3Helz0Z64QqLM+
 SAataHtT2AJ4e+W+rXBT8StQ2/XB0n0q1StuKz4lceG/6VgZ52kH47Bv0yAr++Gl
 GNyqfx3xMMCF61oqAO3OmAfmr1C8hW01ZM/CVS0yfQTXKtI1OsWTxbZxNygrRaL1
 6Nkr35+8Tt6snKbFxTu7IAh5qVsXYb0cW3Dp5XqtFOPT0vedZkCycVZSFeM1JybT
 NcZPZxT+3CoYFS7y6p/wq6gMcgUA4AT+ibOx7G/mQPyt+FBdGkU6jSV38H8NxpKM
 XaeGvp0iuOrX8DBqMEPKPAW0z1uKwkyjHm/WSS1mwjcDAk7AOHRzCVRFG2MuTDQB
 qIoN/Q9nR65mTTBbDypQqS7EmkVmLScLJRORrTi77d7OwB1zsf7KeauR6pB3gSyb
 eT/YVXiwccxfz6bf/kOK
 =u8Wg
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2014-03-17 22:31:32 +00:00
commit 315b593441
4 changed files with 14 additions and 51 deletions

View file

@ -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;
}

View file

@ -36,7 +36,6 @@ typedef struct SCLPConsole {
uint32_t iov_bs; /* offset in buf for char layer read operation */
uint32_t iov_data_len; /* length of byte stream in buffer */
uint32_t iov_sclp_rest; /* length of byte stream not read via SCLP */
qemu_irq irq_read_vt220;
} SCLPConsole;
/* character layer call-back functions */
@ -49,11 +48,12 @@ static int chr_can_read(void *opaque)
return SIZE_BUFFER_VT220 - scon->iov_data_len;
}
/* Receive n bytes from character layer, save in iov buffer,
* and set event pending */
static void receive_from_chr_layer(SCLPConsole *scon, const uint8_t *buf,
int size)
/* Send data from a char device over to the guest */
static void chr_read(void *opaque, const uint8_t *buf, int size)
{
SCLPConsole *scon = opaque;
assert(scon);
/* read data must fit into current buffer */
assert(size <= SIZE_BUFFER_VT220 - scon->iov_data_len);
@ -63,18 +63,7 @@ static void receive_from_chr_layer(SCLPConsole *scon, const uint8_t *buf,
scon->iov_sclp_rest += size;
scon->iov_bs += size;
scon->event.event_pending = true;
}
/* Send data from a char device over to the guest */
static void chr_read(void *opaque, const uint8_t *buf, int size)
{
SCLPConsole *scon = opaque;
assert(scon);
receive_from_chr_layer(scon, buf, size);
/* trigger SCLP read operation */
qemu_irq_raise(scon->irq_read_vt220);
sclp_service_interrupt(0);
}
/* functions to be called by event facility */
@ -192,11 +181,6 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr)
return rc;
}
static void trigger_ascii_console_data(void *opaque, int n, int level)
{
sclp_service_interrupt(0);
}
static const VMStateDescription vmstate_sclpconsole = {
.name = "sclpconsole",
.version_id = 0,
@ -232,8 +216,6 @@ static int console_init(SCLPEvent *event)
qemu_chr_add_handlers(scon->chr, chr_can_read,
chr_read, NULL, scon);
}
scon->irq_read_vt220 = *qemu_allocate_irqs(trigger_ascii_console_data,
NULL, 1);
return 0;
}

View file

@ -80,7 +80,7 @@ static int s390_ipl_init(SysBusDevice *dev)
bios_size = load_elf(bios_filename, NULL, NULL, &ipl->start_addr, NULL,
NULL, 1, ELF_MACHINE, 0);
if (bios_size == -1) {
if (bios_size < 0) {
bios_size = load_image_targphys(bios_filename, ZIPL_IMAGE_START,
4096);
ipl->start_addr = ZIPL_IMAGE_START;

View file

@ -25,13 +25,13 @@ typedef struct ConfigMgtData {
uint8_t event_qualifier;
} QEMU_PACKED ConfigMgtData;
static qemu_irq irq_cpu_hotplug; /* Only used in this file */
static qemu_irq *irq_cpu_hotplug; /* Only used in this file */
#define EVENT_QUAL_CPU_CHANGE 1
void raise_irq_cpu_hotplug(void)
{
qemu_irq_raise(irq_cpu_hotplug);
qemu_irq_raise(*irq_cpu_hotplug);
}
static unsigned int send_mask(void)
@ -81,7 +81,7 @@ static void trigger_signal(void *opaque, int n, int level)
static int irq_cpu_hotplug_init(SCLPEvent *event)
{
irq_cpu_hotplug = *qemu_allocate_irqs(trigger_signal, event, 1);
irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1);
return 0;
}