Implement early printk in virtio-console
On our S390x Virtio machine we don't have anywhere to display early printks on, because we don't know about VGA or serial ports. So instead we just forward everything to the virtio console that we created anyways. Signed-off-by: Alexander Graf <agraf@suse.de> Conflicts: hw/s390-virtio.c
This commit is contained in:
committed by
Andreas Färber
parent
63d9acbe99
commit
bf5b9c24c5
@@ -76,6 +76,9 @@ static int s390_virtio_hcall_notify(const uint64_t *args)
|
||||
}
|
||||
} else {
|
||||
/* Early printk */
|
||||
uint8_t *p = (uint8_t *)qemu_get_ram_ptr(mem);
|
||||
VirtIOS390Device *dev = s390_virtio_bus_console(s390_bus);
|
||||
virtio_console_print_early(dev->vdev, p);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,14 @@ typedef struct VirtConsole {
|
||||
CharDriverState *chr;
|
||||
} VirtConsole;
|
||||
|
||||
void virtio_console_print_early(VirtIODevice *vdev, uint8_t *buf)
|
||||
{
|
||||
VirtIOSerial *vser = (void*)vdev;
|
||||
VirtIOSerialPort *port = find_port_by_id(vser, 0);
|
||||
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
||||
|
||||
qemu_chr_fe_write(vcon->chr, buf, strlen((char*)buf));
|
||||
}
|
||||
|
||||
/* Callback function that's called when the guest sends us data */
|
||||
static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
|
||||
|
||||
@@ -66,7 +66,7 @@ struct VirtIOSerial {
|
||||
struct VirtIOSerialPostLoad *post_load;
|
||||
};
|
||||
|
||||
static VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id)
|
||||
VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id)
|
||||
{
|
||||
VirtIOSerialPort *port;
|
||||
|
||||
|
||||
@@ -205,4 +205,7 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port);
|
||||
*/
|
||||
void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle);
|
||||
|
||||
void virtio_console_print_early(VirtIODevice *vdev, uint8_t *buf);
|
||||
VirtIOSerialPort *find_port_by_id(VirtIOSerial *vser, uint32_t id);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user