mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: Introduce 16550A serial console model
None of the existing models is suitable for use with RISC-V virt guests, and we don't want information about the serial console to be missing from the XML. The name is based on comments in qemu/hw/riscv/virt.c: RISC-V machine with 16550a UART and VirtIO MMIO and in qemu/hw/char/serial.c: QEMU 16550A UART emulation along with the output of dmesg in the guest: Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 13, base_baud= 230400) is a 16550A Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3a5e6cf688
commit
9610eaa48d
@ -7011,7 +7011,8 @@ qemu-kvm -net nic,model=? /dev/null
|
|||||||
is available) and <code>pci-serial</code> (usable whenever PCI support
|
is available) and <code>pci-serial</code> (usable whenever PCI support
|
||||||
is available); <span class="since">since 3.10.0</span>,
|
is available); <span class="since">since 3.10.0</span>,
|
||||||
<code>spapr-vio-serial</code> (usable with ppc64/pseries guests),
|
<code>spapr-vio-serial</code> (usable with ppc64/pseries guests),
|
||||||
<code>system-serial</code> (usable with aarch64/virt guests) and
|
<code>system-serial</code> (usable with aarch64/virt and,
|
||||||
|
<span class="since">since 4.7.0</span>, riscv/virt guests) and
|
||||||
<code>sclp-serial</code> (usable with s390 and s390x guests) are
|
<code>sclp-serial</code> (usable with s390 and s390x guests) are
|
||||||
available as well.
|
available as well.
|
||||||
</p>
|
</p>
|
||||||
@ -7025,10 +7026,11 @@ qemu-kvm -net nic,model=? /dev/null
|
|||||||
target type); <code>pci-serial</code>
|
target type); <code>pci-serial</code>
|
||||||
(usable with the <code>pci-serial</code> target type);
|
(usable with the <code>pci-serial</code> target type);
|
||||||
<code>spapr-vty</code> (usable with the <code>spapr-vio-serial</code>
|
<code>spapr-vty</code> (usable with the <code>spapr-vio-serial</code>
|
||||||
target type); <code>pl011</code> (usable with the
|
target type); <code>pl011</code> and,
|
||||||
<code>system-serial</code> target type); <code>sclpconsole</code> and
|
<span class="since">since 4.7.0</span>, <code>16550a</code> (usable
|
||||||
<code>sclplmconsole</code> (usable with the <code>sclp-serial</code>
|
with the <code>system-serial</code> target type);
|
||||||
target type).
|
<code>sclpconsole</code> and <code>sclplmconsole</code> (usable with
|
||||||
|
the <code>sclp-serial</code> target type).
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -3733,6 +3733,7 @@
|
|||||||
<value>pci-serial</value>
|
<value>pci-serial</value>
|
||||||
<value>spapr-vty</value>
|
<value>spapr-vty</value>
|
||||||
<value>pl011</value>
|
<value>pl011</value>
|
||||||
|
<value>16550a</value>
|
||||||
<value>sclpconsole</value>
|
<value>sclpconsole</value>
|
||||||
<value>sclplmconsole</value>
|
<value>sclplmconsole</value>
|
||||||
</choice>
|
</choice>
|
||||||
|
@ -493,6 +493,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel,
|
|||||||
"pl011",
|
"pl011",
|
||||||
"sclpconsole",
|
"sclpconsole",
|
||||||
"sclplmconsole",
|
"sclplmconsole",
|
||||||
|
"16550a",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
|
||||||
|
@ -1133,6 +1133,7 @@ typedef enum {
|
|||||||
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011,
|
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011,
|
||||||
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE,
|
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE,
|
||||||
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE,
|
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE,
|
||||||
|
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A,
|
||||||
|
|
||||||
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST
|
VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST
|
||||||
} virDomainChrSerialTargetModel;
|
} virDomainChrSerialTargetModel;
|
||||||
|
@ -9151,6 +9151,7 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel)
|
|||||||
return QEMU_CAPS_DEVICE_SCLPLMCONSOLE;
|
return QEMU_CAPS_DEVICE_SCLPLMCONSOLE;
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
||||||
return QEMU_CAPS_DEVICE_PL011;
|
return QEMU_CAPS_DEVICE_PL011;
|
||||||
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
|
||||||
break;
|
break;
|
||||||
@ -9191,6 +9192,16 @@ qemuChrIsPlatformDevice(const virDomainDef *def,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ARCH_IS_RISCV(def->os.arch)) {
|
||||||
|
|
||||||
|
/* 16550a (used by riscv/virt guests) is a platform device */
|
||||||
|
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||||
|
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM &&
|
||||||
|
chr->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If we got all the way here and we're still stuck with the default
|
/* If we got all the way here and we're still stuck with the default
|
||||||
* target type for a serial device, it means we have no clue what kind of
|
* target type for a serial device, it means we have no clue what kind of
|
||||||
* device we're talking about and we must treat it as a platform device. */
|
* device we're talking about and we must treat it as a platform device. */
|
||||||
@ -10581,6 +10592,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
||||||
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
|
||||||
/* Except from _LAST, which is just a guard value and will never
|
/* Except from _LAST, which is just a guard value and will never
|
||||||
|
@ -4186,6 +4186,7 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel)
|
|||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
|
||||||
return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO;
|
return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO;
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
||||||
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A:
|
||||||
return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM;
|
return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM;
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
|
||||||
@ -4251,6 +4252,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr)
|
|||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
|
||||||
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A:
|
||||||
|
|
||||||
expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel);
|
expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel);
|
||||||
|
|
||||||
@ -4301,18 +4303,23 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev,
|
|||||||
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
|
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
|
||||||
bool isCompatible = true;
|
bool isCompatible = true;
|
||||||
|
|
||||||
|
if (dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM) {
|
||||||
|
if (dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011 &&
|
||||||
|
!qemuDomainIsARMVirt(def)) {
|
||||||
|
isCompatible = false;
|
||||||
|
}
|
||||||
|
if (dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A &&
|
||||||
|
!qemuDomainIsRISCVVirt(def)) {
|
||||||
|
isCompatible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!qemuDomainIsPSeries(def) &&
|
if (!qemuDomainIsPSeries(def) &&
|
||||||
(dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO ||
|
(dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO ||
|
||||||
dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY)) {
|
dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY)) {
|
||||||
isCompatible = false;
|
isCompatible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qemuDomainIsARMVirt(def) &&
|
|
||||||
(dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM ||
|
|
||||||
dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011)) {
|
|
||||||
isCompatible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ARCH_IS_S390(def->os.arch) &&
|
if (!ARCH_IS_S390(def->os.arch) &&
|
||||||
(dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP ||
|
(dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP ||
|
||||||
dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE ||
|
dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE ||
|
||||||
@ -6132,7 +6139,7 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
|
|||||||
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA;
|
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA;
|
||||||
} else if (qemuDomainIsPSeries(def)) {
|
} else if (qemuDomainIsPSeries(def)) {
|
||||||
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO;
|
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO;
|
||||||
} else if (qemuDomainIsARMVirt(def)) {
|
} else if (qemuDomainIsARMVirt(def) || qemuDomainIsRISCVVirt(def)) {
|
||||||
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM;
|
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM;
|
||||||
} else if (ARCH_IS_S390(def->os.arch)) {
|
} else if (ARCH_IS_S390(def->os.arch)) {
|
||||||
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP;
|
chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP;
|
||||||
@ -6156,7 +6163,11 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
|
|||||||
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY;
|
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
|
||||||
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011;
|
if (qemuDomainIsARMVirt(def)) {
|
||||||
|
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011;
|
||||||
|
} else if (qemuDomainIsRISCVVirt(def)) {
|
||||||
|
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
|
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
|
||||||
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE;
|
chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE;
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
<address type='virtio-mmio'/>
|
<address type='virtio-mmio'/>
|
||||||
</disk>
|
</disk>
|
||||||
<serial type='pty'>
|
<serial type='pty'>
|
||||||
<target port='0'/>
|
<target type='system-serial' port='0'>
|
||||||
|
<model name='16550a'/>
|
||||||
|
</target>
|
||||||
</serial>
|
</serial>
|
||||||
<console type='pty'>
|
<console type='pty'>
|
||||||
<target type='serial' port='0'/>
|
<target type='serial' port='0'/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user