From b6705cdefb09ddeaefaf6fafd87479c0899ea98f Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 13 May 2022 16:09:30 +0200 Subject: [PATCH] conf: Fix smm=off handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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; - if ((state == VIR_TRISTATE_SWITCH_ABSENT) || - (state == VIR_TRISTATE_SWITCH_ON)) { + if (state == VIR_TRISTATE_SWITCH_ABSENT) + state = VIR_TRISTATE_SWITCH_ON; + + def->features[val] = state; + + if (state == VIR_TRISTATE_SWITCH_ON) { int rv = virParseScaledValue("string(./features/smm/tseg)", "string(./features/smm/tseg/@unit)", ctxt, @@ -17688,7 +17692,6 @@ virDomainFeaturesDefParse(virDomainDef *def, if (rv < 0) return -1; - def->features[val] = VIR_TRISTATE_SWITCH_ON; def->tseg_specified = rv != 0; } break; diff --git a/tests/qemuxml2argvdata/machine-smm-off.x86_64-latest.args b/tests/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=/tmp/lib/domain--1-QEMUGuest1/.config \ -name guest=QEMUGuest1,debug-threads=on \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ --machine q35,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-machine q35,usb=off,smm=off,dump-guest-core=off,memory-backend=pc.ram \ -accel tcg \ -cpu qemu64 \ -m 214 \ diff --git a/tests/qemuxml2xmloutdata/machine-smm-off.x86_64-latest.xml b/tests/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