From nobody Wed Feb 11 03:02:01 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=1652453059; cv=none; d=zohomail.com; s=zohoarc; b=mSFc3/NJalzxi60MIu1MfmZpK4uPZrtDjXS6lvJv/XBOQ5myYrGSTbpbdizpsmk3CBc1/EecniAmjW88mzGktHyjJHqhbrdA3jsliR1HCUranh6OnHYTehm+DlSoNZEP0QRWJx3jVWTzAPcNqw7Y9F6SGk1lbJvK4GLA3fI3r84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652453059; 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=sZxJMMlVUzg9WOQ7UcKzMckM5aoFswO9I0/WqenceXY=; b=aSUjNkKyxs1kvGcWYHihADg9bMOtY4GwScaAgkSfAyeFwzNLgSFZS0AIfGJ0iq+2dV/ZPVUZdXjqZ0VhUQNP/I2F6IFtiFq3+G6uQp5O5yH18c/2KnwWrOg1sdT+N7vN4naon90DxHctM6FzPFVSTQzOsp8+CfwKPDL5QBLEPzw= 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 1652453059484736.8304949442614; Fri, 13 May 2022 07:44:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-ICuPrREJNhCb7Uz49PlVIQ-1; Fri, 13 May 2022 10:44:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D53885A5BE; Fri, 13 May 2022 14:44:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED1242026987; Fri, 13 May 2022 14:44:13 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF9AB1956B85; Fri, 13 May 2022 14:44:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F39CB193220C for ; Fri, 13 May 2022 14:44:10 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E1589C27E94; Fri, 13 May 2022 14:44:10 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.192.172]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 731C5C27E84 for ; Fri, 13 May 2022 14:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652453058; 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=sZxJMMlVUzg9WOQ7UcKzMckM5aoFswO9I0/WqenceXY=; b=MM0PR31lyaF7gRs++lq74e+5+QYNusyQSjJ+UNXjhsSUHz3EYfVzjPqQ3CURODSX5Bnut+ MM9hSgI8L0LsGtMasjDO5aqqsXCvwDZOEtr618u315C1tIe0pnem4K+2KrL/fTkzjKwBOM bmyxtlR9McKAtU5By2yRxyhp3jGT+No= X-MC-Unique: ICuPrREJNhCb7Uz49PlVIQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] conf: Fix smm=off handling Date: Fri, 13 May 2022 16:44:05 +0200 Message-Id: <20220513144405.864210-4-abologna@redhat.com> In-Reply-To: <20220513144405.864210-1-abologna@redhat.com> References: <20220513144405.864210-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652453060253100004 Content-Type: text/plain; charset="utf-8" We have to always store the state of the feature in the virDomainDef struct, otherwise will incorrectly be interpreted as if the element was not present. Fixes: eeb94215b074a71b3c8932d5fcaf657f269b2c82 Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 9 ++++++--- .../qemuxml2argvdata/machine-smm-off.x86_64-latest.args | 2 +- .../qemuxml2xmloutdata/machine-smm-off.x86_64-latest.xml | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d9b55c80aa..70562cc993 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17676,8 +17676,12 @@ virDomainFeaturesDefParse(virDomainDef *def, VIR_XML_PROP_NONE, &state) < 0) return -1; =20 - if ((state =3D=3D VIR_TRISTATE_SWITCH_ABSENT) || - (state =3D=3D VIR_TRISTATE_SWITCH_ON)) { + if (state =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + state =3D VIR_TRISTATE_SWITCH_ON; + + def->features[val] =3D state; + + if (state =3D=3D VIR_TRISTATE_SWITCH_ON) { int rv =3D virParseScaledValue("string(./features/smm/tseg= )", "string(./features/smm/tseg/@= unit)", ctxt, @@ -17688,7 +17692,6 @@ virDomainFeaturesDefParse(virDomainDef *def, if (rv < 0) return -1; =20 - def->features[val] =3D VIR_TRISTATE_SWITCH_ON; def->tseg_specified =3D rv !=3D 0; } break; diff --git a/tests/qemuxml2argvdata/machine-smm-off.x86_64-latest.args b/te= sts/qemuxml2argvdata/machine-smm-off.x86_64-latest.args index b5a685524e..46f6a4a70c 100644 --- a/tests/qemuxml2argvdata/machine-smm-off.x86_64-latest.args +++ b/tests/qemuxml2argvdata/machine-smm-off.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ --machine q35,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-machine q35,usb=3Doff,smm=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc= .ram \ -accel tcg \ -cpu qemu64 \ -m 214 \ diff --git a/tests/qemuxml2xmloutdata/machine-smm-off.x86_64-latest.xml b/t= ests/qemuxml2xmloutdata/machine-smm-off.x86_64-latest.xml index 1d58c22892..77b0b39750 100644 --- a/tests/qemuxml2xmloutdata/machine-smm-off.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/machine-smm-off.x86_64-latest.xml @@ -8,6 +8,9 @@ hvm + + + qemu64 --=20 2.35.3