On Thu, Oct 15, 2026 at 12:41:57PM +0200, Luigi Leonardi wrote:
Add a "cmdline" property to the igvm-cfg object and a handler for the
IGVM_VHT_COMMAND_LINE directive, which copies the string into the
parameter area the directive points at.
Should we update docs/system/igvm.rst ?
Maybe in another commit, since I guess we forgot to update it also for
other directives like IGVM_VHT_MADT or IGVM_VHT_DEVICE_TREE.
The command line is passed to whatever software the IGVM file loads,
such as an SVSM. For example, SVSM can use it to select the serial port
it logs to.
Signed-off-by: Luigi Leonardi <[email protected]>
---
Changes in v2:
- Updated commit message and doc to make it clear that QEMU does not
need to parse this string [Markus]
- Link to v1:
https://lore.kernel.org/qemu-devel/[email protected]
---
backends/igvm-cfg.c | 21 +++++++++++++++++++++
backends/igvm.c | 31 +++++++++++++++++++++++++++++++
include/system/igvm-internal.h | 5 +++++
qapi/qom.json | 6 +++++-
4 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c
index 935ba54f54..ec796ea8a6 100644
--- a/backends/igvm-cfg.c
+++ b/backends/igvm-cfg.c
@@ -34,6 +34,19 @@ static void set_igvm(Object *obj, const char *value, Error
**errp)
igvm->filename = g_strdup(value);
}
+static char *get_cmdline(Object *obj, Error **errp)
+{
+ IgvmCfg *igvm = IGVM_CFG(obj);
+ return g_strdup(igvm->cmdline);
+}
+
+static void set_cmdline(Object *obj, const char *value, Error **errp)
+{
+ IgvmCfg *igvm = IGVM_CFG(obj);
+ g_free(igvm->cmdline);
+ igvm->cmdline = g_strdup(value);
+}
+
static ResettableState *igvm_reset_state(Object *obj)
{
IgvmCfg *igvm = IGVM_CFG(obj);
@@ -85,6 +98,13 @@ static void igvm_cfg_class_init(ObjectClass *oc, const void
*data)
object_class_property_set_description(oc, "file",
"Set the IGVM filename to use");
+ object_class_property_add_str(oc, "cmdline", get_cmdline, set_cmdline);
Should we add this to qemu-options.hx as well?
+ object_class_property_set_description(oc, "cmdline",
+ "Set the kernel-style command line "
nit: I'd remove "kernel-style", since it's an implementation detail but
the format is really up to the guest code IIUC.
Maybe we can reuse something similar to what we have in libigvm:
/**
* A parameter which describes a null terminated ASCII command line to
* be used with the guest as specified by [`IGVM_VHS_PARAMETER`]. The
* format of the command line is specific to the guest being loaded.
*
* For example, this parameter could be used to describe the Linux
* kernel command line.
*
* In the [`IgvmVariableHeaderType::IGVM_VHT_DEVICE_TREE`] parameter,
* this corresponds to the `/chosen/bootargs` field.
*/
IGVM_VHT_COMMAND_LINE = 782,
The rest LTGM,
Stefano