From nobody Sun Feb 8 16:30:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1631186736; cv=none; d=zohomail.com; s=zohoarc; b=gCWEO3/OLmQP1+bDsmwzVUm7W4RjjWct4R2H4oXJDv+ngSrcKDNOAa2KAdGJvLvu+lOcJQPYC95w+PRNPqe5Febj3sgJlf/XXEWBGz84ejYN3Nmni5NbJ4rOEqx7LxL3bGxFJ38A6LTcJ5+WAVu5WQGILePkeZ6FeOMs8AOjX/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631186736; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=izxXtCZGxuSo3i1Hn+EBPC8zGUKbuuPs43ItmHVq1RE=; b=IYsS95cEWyJYcnA4SluvwKj+Z55NkiQTdGYROLfs7KVDXytORn2InFtTOvTiCTUenGIjQFWyVNLgOGuMpl1QjgrbTXr3yH4/1YWvWH/bV8+JXyFjqT5A2C4/jhFdH86t7HSTbpxd9uvhUs8jKnDrk+307ItGmQi9O9inIwtw2a4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1631186736569465.51943508236343; Thu, 9 Sep 2021 04:25:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-khdSzH_fNliQErOtKCaS9Q-1; Thu, 09 Sep 2021 07:25:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6BF62100C662; Thu, 9 Sep 2021 11:25:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51BEC19C87; Thu, 9 Sep 2021 11:25:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 239694EA2A; Thu, 9 Sep 2021 11:25:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 189BPOMk013960 for ; Thu, 9 Sep 2021 07:25:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB3965D6CF; Thu, 9 Sep 2021 11:25:24 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.195.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3538C5D6AD; Thu, 9 Sep 2021 11:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631186735; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=izxXtCZGxuSo3i1Hn+EBPC8zGUKbuuPs43ItmHVq1RE=; b=XVk2LnZQouY75w8geDikGPTLevYQ/YVvCxesL6mZOm1gvuKlu65JLAwb0zQHjfyeirNPW4 YKXM/mQcKZzCip/2IwsJIIJppwwNmo9ld5Cq35HB30wYWBltmkYJcZHrXs8DfcLk6rJaUW 0xUbCf6LIFO84JMxAPyCif4e/5XJgNI= X-MC-Unique: khdSzH_fNliQErOtKCaS9Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] qemu: switch to use -M graphics=off instead of -device sga Date: Thu, 9 Sep 2021 12:25:15 +0100 Message-Id: <20210909112516.854126-4-berrange@redhat.com> In-Reply-To: <20210909112516.854126-1-berrange@redhat.com> References: <20210909112516.854126-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1631186737638100005 SeaBIOS >=3D 1.11 has built-in support for outputting to the serial console when QEMU sets -M graphics=3Doff. 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. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 25 ++++++++++--------------- src/qemu/qemu_validate.c | 13 ++++++------- tests/qemuxml2argvdata/bios.args | 3 +-- tests/qemuxml2argvtest.c | 3 +-- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b230314f7f..4d29313f45 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5956,18 +5956,6 @@ qemuBuildVMGenIDCommandLine(virCommand *cmd, } =20 =20 -static int -qemuBuildSgaCommandLine(virCommand *cmd, - const virDomainDef *def) -{ - /* Serial graphics adapter */ - if (def->os.bios.useserial =3D=3D 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=3D%s", defaultRAMid); } =20 + /* On x86 targets, graphics=3Doff 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=3Dyes on non-x86 + */ + if (def->os.bios.useserial =3D=3D VIR_TRISTATE_BOOL_YES) { + virBufferAddLit(&buf, ",graphics=3Doff"); + } + virCommandAddArgBuffer(cmd, &buf); =20 return 0; @@ -10553,9 +10551,6 @@ qemuBuildCommandLine(virQEMUDriver *driver, virCommandAddArg(cmd, "-no-user-config"); virCommandAddArg(cmd, "-nodefaults"); =20 - if (qemuBuildSgaCommandLine(cmd, def) < 0) - return NULL; - if (qemuBuildMonitorCommandLine(logManager, secManager, cmd, cfg, def,= priv) < 0) return NULL; =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 47012748e8..9d93f373ab 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1194,19 +1194,18 @@ qemuValidateDomainDef(const virDomainDef *def, =20 /* Serial graphics adapter */ if (def->os.bios.useserial =3D=3D 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=3Doff 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 ar= chitectures")); 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 se= rial output")); diff --git a/tests/qemuxml2argvdata/bios.args b/tests/qemuxml2argvdata/bios= .args index 7356d1626d..7d831a716d 100644 --- a/tests/qemuxml2argvdata/bios.args +++ b/tests/qemuxml2argvdata/bios.args @@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-i386 \ -name guest=3Dtest-bios,debug-threads=3Don \ -S \ --machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,graphics=3Doff \ -bios /usr/share/seabios/bios.bin \ -m 1024 \ -realtime mlock=3Doff \ @@ -19,7 +19,6 @@ QEMU_AUDIO_DRV=3Dnone \ -display none \ -no-user-config \ -nodefaults \ --device sga \ -chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-test-bios/monit= or.sock,server=3Don,wait=3Doff \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c67214d01e..4d82267598 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1192,8 +1192,7 @@ mymain(void) DO_TEST_PARSE_ERROR_NOCAPS("reboot-timeout-enabled"); =20 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, --=20 2.31.1