Re: [PATCH 51/80] qemu: Remove pre-blockdev PFLASH setup

2022-08-05 Thread Pavel Hrdina
On Tue, Jul 26, 2022 at 04:37:29PM +0200, Peter Krempa wrote:
> Signed-off-by: Peter Krempa 
> ---
>  src/qemu/qemu_command.c | 60 +++--
>  src/qemu/qemu_domain.c  |  5 +---
>  2 files changed, 10 insertions(+), 55 deletions(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature


[PATCH 51/80] qemu: Remove pre-blockdev PFLASH setup

2022-07-26 Thread Peter Krempa
Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_command.c | 60 +++--
 src/qemu/qemu_domain.c  |  5 +---
 2 files changed, 10 insertions(+), 55 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5c90138c73..ed718eb81b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7045,8 +7045,7 @@ qemuBuildMachineCommandLine(virCommand *cmd,
 }
 }

-if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) &&
-virDomainDefHasOldStyleUEFI(def)) {
+if (virDomainDefHasOldStyleUEFI(def)) {
 if (priv->pflash0)
 virBufferAsprintf(, ",pflash0=%s", priv->pflash0->nodeformat);
 if (def->os.loader->nvram)
@@ -9364,53 +9363,10 @@ qemuBuildRedirdevCommandLine(virCommand *cmd,
 }


-static void
-qemuBuildDomainLoaderPflashCommandLine(virCommand *cmd,
-  virDomainLoaderDef *loader,
-  virQEMUCaps *qemuCaps)
-{
-g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-int unit = 0;
-
-if (loader->secure == VIR_TRISTATE_BOOL_YES) {
-virCommandAddArgList(cmd,
- "-global",
- "driver=cfi.pflash01,property=secure,value=on",
- NULL);
-}
-
-/* with blockdev we instantiate the pflash when formatting -machine */
-if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV))
-return;
-
-virBufferAddLit(, "file=");
-virQEMUBuildBufferEscapeComma(, loader->path);
-virBufferAsprintf(, ",if=pflash,format=raw,unit=%d", unit);
-unit++;
-
-if (loader->readonly) {
-virBufferAsprintf(, ",readonly=%s",
-  virTristateSwitchTypeToString(loader->readonly));
-}
-
-virCommandAddArg(cmd, "-drive");
-virCommandAddArgBuffer(cmd, );
-
-if (loader->nvram) {
-virBufferAddLit(, "file=");
-virQEMUBuildBufferEscapeComma(, loader->nvram->path);
-virBufferAsprintf(, ",if=pflash,format=raw,unit=%d", unit);
-
-virCommandAddArg(cmd, "-drive");
-virCommandAddArgBuffer(cmd, );
-}
-}
-

 static void
 qemuBuildDomainLoaderCommandLine(virCommand *cmd,
- virDomainDef *def,
- virQEMUCaps *qemuCaps)
+ virDomainDef *def)
 {
 virDomainLoaderDef *loader = def->os.loader;

@@ -9424,7 +9380,12 @@ qemuBuildDomainLoaderCommandLine(virCommand *cmd,
 break;

 case VIR_DOMAIN_LOADER_TYPE_PFLASH:
-qemuBuildDomainLoaderPflashCommandLine(cmd, loader, qemuCaps);
+if (loader->secure == VIR_TRISTATE_BOOL_YES) {
+virCommandAddArgList(cmd,
+ "-global",
+ 
"driver=cfi.pflash01,property=secure,value=on",
+ NULL);
+}
 break;

 case VIR_DOMAIN_LOADER_TYPE_NONE:
@@ -9859,9 +9820,6 @@ qemuBuildPflashBlockdevCommandLine(virCommand *cmd,
 if (!virDomainDefHasOldStyleUEFI(vm->def))
 return 0;

-if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
-return 0;
-
 if (priv->pflash0 &&
 qemuBuildPflashBlockdevOne(cmd, priv->pflash0, priv->qemuCaps) < 0)
 return -1;
@@ -10267,7 +10225,7 @@ qemuBuildCommandLine(virDomainObj *vm,
 if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0)
 return NULL;

-qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps);
+qemuBuildDomainLoaderCommandLine(cmd, def);

 if (qemuBuildMemCommandLine(cmd, def, qemuCaps, priv) < 0)
 return NULL;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7403b2584b..8b55dd0361 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11305,7 +11305,7 @@ qemuDomainSupportsCheckpointsBlockjobs(virDomainObj *vm)
  * qemuDomainInitializePflashStorageSource:
  *
  * This helper converts the specification of the source of the 'loader' in case
- * PFLASH is required to virStorageSources in case QEMU_CAPS_BLOCKDEV is 
present.
+ * PFLASH is required to virStorageSources.
  *
  * This helper is used in the intermediate state when we don't support full
  * backing chains for pflash drives in the XML.
@@ -11323,9 +11323,6 @@ qemuDomainInitializePflashStorageSource(virDomainObj 
*vm,
 virDomainDef *def = vm->def;
 g_autoptr(virStorageSource) pflash0 = NULL;

-if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
-return 0;
-
 if (!virDomainDefHasOldStyleUEFI(def))
 return 0;

-- 
2.36.1