On 2025-04-29 08:36, Alejandro Vallejo wrote:
From: "Daniel P. Smith" <dpsm...@apertussolutions.com>

Add support to read the command line from the hyperlaunch device tree.
The device tree command line is located in the "bootargs" property of the
"multiboot,kernel" node.

A boot loader command line, e.g. a grub module string field, takes
precendence over the device tree one since it is easier to modify.

Signed-off-by: Daniel P. Smith <dpsm...@apertussolutions.com>
Signed-off-by: Jason Andryuk <jason.andr...@amd.com>
Signed-off-by: Alejandro Vallejo <agarc...@amd.com>
Reviewed-by: Denis Mukhin <dmuk...@ford.com>
---

diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fdt.c
index cbb0ed30a2..dabe201b04 100644
--- a/xen/common/domain-builder/fdt.c
+++ b/xen/common/domain-builder/fdt.c
@@ -219,6 +219,12 @@ static int __init fdt_process_domain_node(
              printk(XENLOG_INFO "  kernel: multiboot-index=%d\n", idx);
              bi->mods[idx].type = BOOTMOD_KERNEL;
              bd->kernel = &bi->mods[idx];
+
+            /* If bootloader didn't set cmdline, see if FDT provides one. */
+            if ( bd->kernel->cmdline_pa &&
+                 !((char *)__va(bd->kernel->cmdline_pa))[0] )

The logic is incorrect - it should be:

            if ( !bd->kernel->cmdline_pa ||
                 !((char *)__va(bd->kernel->cmdline_pa))[0] )

If there is no cmdline_pa (which happens with the "reg" property) or the if there is a 0-length string, then check the DT for bootargs.

This fixes the "reg" case to read from bootargs.

+                bd->kernel->fdt_cmdline = fdt_get_prop_offset(
+                    fdt, node, "bootargs", &bd->kernel->cmdline_pa);
          }
      }

Just giving a heads up in case anyone is using it.

Regards,
Jason

Reply via email to