From c8eb99eebf5801a56d381d9e13192f9b77693363 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 15 Nov 2019 13:36:53 +0100 Subject: [PATCH] qemu: command: Build the 'pflash' drives via -machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old way to instantiate a pflash device via -drive was a hack since it's a platform device. The modern approach calls for configuring it via -machine and takes the node name as an argument. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrangé --- src/qemu/qemu_command.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3505a9817d..904ef56a03 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7043,7 +7043,8 @@ static int qemuBuildMachineCommandLine(virCommandPtr cmd, virQEMUDriverConfigPtr cfg, const virDomainDef *def, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps, + qemuDomainObjPrivatePtr priv) { virTristateSwitch vmport = def->features[VIR_DOMAIN_FEATURE_VMPORT]; virTristateSwitch smm = def->features[VIR_DOMAIN_FEATURE_SMM]; @@ -7343,6 +7344,13 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, if (def->sev) virBufferAddLit(&buf, ",memory-encryption=sev0"); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (priv->pflash0) + virBufferAsprintf(&buf, ",pflash0=%s", priv->pflash0->nodeformat); + if (priv->pflash1) + virBufferAsprintf(&buf, ",pflash1=%s", priv->pflash1->nodeformat); + } + virCommandAddArgBuffer(cmd, &buf); return 0; @@ -10247,7 +10255,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (enableFips) virCommandAddArg(cmd, "-enable-fips"); - if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps) < 0) + if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps, priv) < 0) return NULL; qemuBuildTSEGCommandLine(cmd, def); -- GitLab