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

Re: [PATCH v5 28/44] x86/boot: add cmdline to struct boot_module


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 8 Oct 2024 13:08:20 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=apertussolutions.com 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=P4PqYY8vaPyU4fep7AqwrEpfeeWyJp6J+pS3JulfCAI=; b=zUNVzOcuZewFiP3RbXBc0sTKdwCVFnwVKacMvxeO9iuzvb5TwPV1Vp9JAhfaCxsc2e1OWSbtk/Um4qYo+LuJ+inmlCjlb7D5t98AXTYASB0D4oyxaeB00BvcJSgi3QJB4Er1GNHjAXZFfRmThAfK3Vy08wQEh+6/vgvQbda8cB4FVu0wYuMLA78Uw6JG6CsR2JIKi82f+LSInjD52OufJbRjtPlZR6aY/x+W+EWvl+k5ZHeMnGxJbwbGCnKu17Zo8T4obhfZBbuVxPrx2fkOiGVmPzRfs49YbVJyhmrezzWUNxnqH0ChC3zICodcVC/SRxWJVlv4Ijgcix4WchMORQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SH69uf5U1caztKu8tqtk5FddWN88pO2caXDkPvlU+vWHyAtDLnsHhx+o8TzO+N7uhtopamW1lQfS52vCofcvGOXQLgFJMXYa47dpZyBUhDQGrSpBSASb/Bae5w2yFDx4dYhEnienpCf08by2QG4VavmQnR7sGgJuWWoofEqvQarE+4hF6G+voIW3IkKC87ZG0cQn1rMox1id6Y88WRySSksK1u/7a8t9JZoSP+GT9vCVPoIZY28lof3imzRTrSHwz36o+mIabnDlX5kRxSjVwX0RKON/EZUuU2OwwrEb3pOR7T9rytteOC3L5k8q5mraI3bfklnIrhKLWZiJsCMOLg==
  • Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 08 Oct 2024 17:08:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-10-06 17:49, Daniel P. Smith wrote:
Add a char pointer field, cmdline, to struct boot_module to hold the address
pointed to by the string field of struct mod. This removes the need to use the
early_mod field to get to the dom0 kernel command line.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
  xen/arch/x86/include/asm/bootinfo.h | 2 ++
  xen/arch/x86/setup.c                | 9 ++++++---
  2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h 
b/xen/arch/x86/include/asm/bootinfo.h
index 9ed260629012..3b6bfbe88770 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -38,6 +38,8 @@ struct boot_module {
  #define BOOTMOD_FLAG_X86_RELOCATED     (1U << 0)
  #define BOOTMOD_FLAG_X86_CONSUMED      (1U << 1)
+ const char *cmdline;
+
      paddr_t start;
      size_t size;
  };
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index aed0837902c4..d5916e85f68e 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -312,6 +312,8 @@ static struct boot_info __init 
*multiboot_fill_boot_info(unsigned long mbi_p)
      {
          bi->mods[i].mod = &mods[i];
+ bi->mods[i].cmdline = (char *)(paddr_t)mods[i].string;
+
          bi->mods[i].start = (paddr_t)mods[i].mod_start;
          bi->mods[i].size = mods[i].mod_end - mods[i].mod_start;
      }
@@ -1000,10 +1002,11 @@ static struct domain *__init create_dom0(struct 
boot_info *bi)
          panic("Error creating d%uv0\n", domid);
/* Grab the DOM0 command line. */
-    if ( image->mod->string || bi->kextra )
+    if ( image->cmdline || bi->kextra )
      {
-        if ( image->mod->string )
-            safe_strcpy(cmdline, cmdline_cook(__va(image->mod->string),
+        if ( image->cmdline )
+            safe_strcpy(cmdline,
+                        cmdline_cook(__va((unsigned long)image->cmdline),

char * seems inappropriate if cmdline isn't usable as a string. Maybe have cmdline as a paddr_t, or can __va() be used at assignment time?

Regards,
Jason

                          bi->loader));
if ( bi->kextra )



 


Rackspace

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