QEMU 不会创建第二个串行端口(Ubuntu x86-64 来宾和主机)

QEMU doesn't create a second serial port (Ubuntu x86-64 guest and host)

我 运行 我的 QEMU 版本 3.0.0 来自:
x86_64-softmmu/qemu-system-x86_64 -m 2560 -hda img.qcow2 -serial pty -serial pty

我的主机是 Ubuntu 桌面 16.04,我的来宾是新的(即默认配置)Ubuntu 服务器 18.04。两者都是 x86-64。

启动后,QEMU 立即打印:

qemu-system-x86_64: -serial pty: char device redirected to /dev/pts/18 (label serial0)
qemu-system-x86_64: -serial pty: char device redirected to /dev/pts/19 (label serial1)

此外,info qtree(在 QEMU 的监视器中)的输出是:

[...]
          dev: isa-serial, id ""
            index = 1 (0x1)
            iobase = 760 (0x2f8)
            irq = 3 (0x3)
            chardev = "serial1"
            wakeup = 0 (0x0)
            isa irq 3
          dev: isa-serial, id ""
            index = 0 (0x0)
            iobase = 1016 (0x3f8)
            irq = 4 (0x4)
            chardev = "serial0"
            wakeup = 0 (0x0)
            isa irq 4
[...]

看来serial0serial1应该是差不多的吧
根据this site,iobase为0x2f8的串口应该使用/dev/ttyS1,所以从上面的输出我推导出serial1应该通过[=17=使用].

我可以毫无问题地在来宾中使用 /dev/ttyS0 并在主机中使用 /dev/pts/18。 但是,我没有设法在来宾中使用 /dev/ttyS1,在我看来 serial1 在来宾中根本不存在。

在guest内部,dmesg | grep ttyS的输出(根据this answer应该显示现有的串口):
[ 7.147289] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

我错过了什么?为什么客人里面好像 serial1 不存在?

我发现了我的错误。

因为来宾启动需要很多时间(至少在我的机器上),所以我总是立即使用 loadvm after_startup_snapshot

我现在尝试让访客通过启动,/dev/ttyS1 的重定向工作得很好。