mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-27 18:03:50 +03:00
qemu: switch to use -M graphics=off instead of -device sga
SeaBIOS >= 1.11 has built-in support for outputting to the serial console when QEMU sets -M graphics=off. Our minimum QEMU version is 2.11.0, which bundled SeaBIOS 1.11. Thus we have no need to use '-device sga' anymore. This change results in a slight layout difference for option ROMs in memory, however, it does not affect the migration data stream format on the wire and once migration is complete the target QEMU memory layout for ROMs matches the source QEMU once again. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
58dfbca51d
commit
40dfef297a
@ -5956,18 +5956,6 @@ qemuBuildVMGenIDCommandLine(virCommand *cmd,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildSgaCommandLine(virCommand *cmd,
|
||||
const virDomainDef *def)
|
||||
{
|
||||
/* Serial graphics adapter */
|
||||
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES)
|
||||
virCommandAddArgList(cmd, "-device", "sga", NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
qemuBuildClockArgStr(virDomainClockDef *def)
|
||||
{
|
||||
@ -7054,6 +7042,16 @@ qemuBuildMachineCommandLine(virCommand *cmd,
|
||||
virBufferAsprintf(&buf, ",memory-backend=%s", defaultRAMid);
|
||||
}
|
||||
|
||||
/* On x86 targets, graphics=off activates the serial console
|
||||
* output mode in the firmware. On non-x86 targets it has
|
||||
* various other undesirable effects that we certainly do
|
||||
* not want to have. We rely on the validation code to have
|
||||
* blocked useserial=yes on non-x86
|
||||
*/
|
||||
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) {
|
||||
virBufferAddLit(&buf, ",graphics=off");
|
||||
}
|
||||
|
||||
virCommandAddArgBuffer(cmd, &buf);
|
||||
|
||||
return 0;
|
||||
@ -10553,9 +10551,6 @@ qemuBuildCommandLine(virQEMUDriver *driver,
|
||||
virCommandAddArg(cmd, "-no-user-config");
|
||||
virCommandAddArg(cmd, "-nodefaults");
|
||||
|
||||
if (qemuBuildSgaCommandLine(cmd, def) < 0)
|
||||
return NULL;
|
||||
|
||||
if (qemuBuildMonitorCommandLine(logManager, secManager, cmd, cfg, def, priv) < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -1194,19 +1194,18 @@ qemuValidateDomainDef(const virDomainDef *def,
|
||||
|
||||
/* Serial graphics adapter */
|
||||
if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) {
|
||||
/* -device sga is only sane on x86, since the option ROM it
|
||||
* loads contains x86 machine code.
|
||||
/* On x86 -machine graphics=off toggles the use of the
|
||||
* serial console in SeaBIOS (and theoretically other
|
||||
* firmwares).
|
||||
* On non-x86, it has also sorts of other effects
|
||||
* on QEMU device models created and so we don't
|
||||
* want to allow its use.
|
||||
*/
|
||||
if (!ARCH_IS_X86(def->os.arch)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("BIOS serial console only supported on x86 architectures"));
|
||||
return -1;
|
||||
}
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("qemu does not support SGA"));
|
||||
return -1;
|
||||
}
|
||||
if (!def->nserials) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("need at least one serial port to use BIOS serial output"));
|
||||
|
@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu-system-i386 \
|
||||
-name guest=test-bios,debug-threads=on \
|
||||
-S \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off,graphics=off \
|
||||
-bios /usr/share/seabios/bios.bin \
|
||||
-m 1024 \
|
||||
-realtime mlock=off \
|
||||
@ -19,7 +19,6 @@ QEMU_AUDIO_DRV=none \
|
||||
-display none \
|
||||
-no-user-config \
|
||||
-nodefaults \
|
||||
-device sga \
|
||||
-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-test-bios/monitor.sock,server=on,wait=off \
|
||||
-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
-rtc base=utc \
|
||||
|
@ -1192,8 +1192,7 @@ mymain(void)
|
||||
DO_TEST_PARSE_ERROR_NOCAPS("reboot-timeout-enabled");
|
||||
|
||||
DO_TEST("bios",
|
||||
QEMU_CAPS_DEVICE_ISA_SERIAL,
|
||||
QEMU_CAPS_SGA);
|
||||
QEMU_CAPS_DEVICE_ISA_SERIAL);
|
||||
DO_TEST_NOCAPS("bios-nvram");
|
||||
DO_TEST("bios-nvram-secure",
|
||||
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user