[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 06/12] x86/hyperlaunch: obtain cmdline from device tree


  • To: Alejandro Vallejo <agarciav@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 9 Jun 2025 13:07:35 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u5BSugR0vnffgsQIou3yc8PFf2hPaHLWN4mLggwndVw=; b=qtpHlN80zsjpVIgFyZrSqKQl7lVAlReWVUzCwAc/dmWgygF//QqIVim0k3/DCdRE119xlMKp0aMvKLNqtkBf8oHyQvaaI5OQWHVHXDRtCeF+5BA8VEAyYc3z8YALIAYAgLebzudVCHjf6DxfBueWx699Rt2qlkRqEt99EaVcMO2w9Ya4iwKzxPpgj1YJaQ/lCZJzn9HdlH8b7zveE8XCd53fjIRW7HBA5X9xjjMEesTm26m6M71WJa49gz8y6NqPnFuMMjnolL8HXNnR4Ito+tqnmvFOPpEAN2DqwHvCT3IphSutVyJxS8i3F5lubw0klCbgvgBQKgmkw5k8iXpAAg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OOEjeE4wyC5Q9+OVem0Gcu4VVCNa8VQP2EjdghM+yGZ2jUFSN/EdexcUKubVFBzKcvkm8PgAJ/kk6/mFJCw5Nipb6KV4cGNY5XehBRYDvJDzBecy+mm5Qs8Hn2FXlZkUzG8WzP/cANY07xnoRemVUPiHPuoqlJf8LJoFr7b0fqUG2QbxX0XsMfg+2IUIRv88hDigzAnb6TVedPNPBBZVZLpNnFFnDelwT1hQwEYpCQ2WoUCSB04+BL5jVHVMc5hVgjVNrIy3RMrfW5LZF84f7WFF9qr6igz+Dl3M5FJqqbAK/K9xsHtZ6m7SJO85LMvfZ6Ej9Eyrx/nWC0Ya2tfa/w==
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Mon, 09 Jun 2025 17:07:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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

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 <dpsmith@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Signed-off-by: Alejandro Vallejo <agarciav@xxxxxxx>
Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx>
---

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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.