On 6/8/25 22:44, Andrea Righi via Devel wrote:
Add support to the qemu driver to generate the proper command line
for
the acpi-generic-initiator definitions.
Signed-off-by: Andrea Righi <arighi(a)nvidia.com>
---
src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 79cfe60b09..cedcb7e5a5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10387,6 +10387,29 @@ qemuBuildPstoreCommandLine(virCommand *cmd,
return 0;
}
+static int
+qemuBuildAcpiInitiatorCommandLine(virCommand *cmd,
+ const virDomainAcpiInitiatorDef *acpiinitiator,
+ virQEMUCaps *qemuCaps)
+{
+ g_autoptr(virJSONValue) props = NULL;
+
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ACPI_GENERIC_INITIATOR))
+ return -1;
+
No. Firstly, this doesn't belong here but into qemu_validate.c where a
new function must be invented that checks if domain def has an initiator
defined and if so then whether the capability is present.
Secondly, having this without any virReportError() will result in an
unknown error.
+ if (virJSONValueObjectAdd(&props,
+ "s:qom-type",
"acpi-generic-initiator",
+ "s:id", acpiinitiator->info.alias,
+ "s:pci-dev", acpiinitiator->pciDev,
+ "i:node", acpiinitiator->numaNode,
+ NULL) < 0)
+ return -1;
+
+ if (qemuBuildObjectCommandlineFromJSON(cmd, props) < 0)
+ return -1;
+
+ return 0;
+}
static int
qemuBuildAsyncTeardownCommandLine(virCommand *cmd,
@@ -10741,6 +10764,11 @@ qemuBuildCommandLine(virDomainObj *vm,
qemuBuildPstoreCommandLine(cmd, def, def->pstore, qemuCaps) < 0)
return NULL;
+ for (i = 0; i < def->nacpiinitiator; i++) {
+ if (qemuBuildAcpiInitiatorCommandLine(cmd, def->acpiinitiator[i], qemuCaps)
< 0)
+ return NULL;
+ }
+
if (qemuBuildAsyncTeardownCommandLine(cmd, def, qemuCaps) < 0)
return NULL;
Michal