diff mbox series

[v5,03/44] x86/boot: move cmdline to boot info

Message ID 20241006214956.24339-4-dpsmith@apertussolutions.com (mailing list archive)
State Superseded
Headers show
Series Boot modules for Hyperlaunch | expand

Commit Message

Daniel P. Smith Oct. 6, 2024, 9:49 p.m. UTC
Transition Xen's command line to being held in struct boot_info.

No functional change intended.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  1 +
 xen/arch/x86/setup.c                | 20 ++++++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

Comments

Jason Andryuk Oct. 7, 2024, 6:09 p.m. UTC | #1
On 2024-10-06 17:49, Daniel P. Smith wrote:
> Transition Xen's command line to being held in struct boot_info.
> 
> No functional change intended.
> 
> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---

>   #endif /* __XEN_X86_BOOTINFO_H__ */
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index aafc098ca268..0921f296075f 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -274,6 +274,8 @@ static int __init cf_check parse_acpi_param(const char *s)
>   }
>   custom_param("acpi", parse_acpi_param);
>   
> +static const char *cmdline_cook(const char *p, const char *loader_name);

Is there a reason not to move cmdline_cook() (and loader_is_grub2()) 
earlier to avoid this forward declaration?

Everything else looks okay.

Regards,
Jason
Jan Beulich Oct. 8, 2024, 6:42 a.m. UTC | #2
On 07.10.2024 20:09, Jason Andryuk wrote:
> On 2024-10-06 17:49, Daniel P. Smith wrote:
>> Transition Xen's command line to being held in struct boot_info.
>>
>> No functional change intended.
>>
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
> 
>>   #endif /* __XEN_X86_BOOTINFO_H__ */
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index aafc098ca268..0921f296075f 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -274,6 +274,8 @@ static int __init cf_check parse_acpi_param(const char *s)
>>   }
>>   custom_param("acpi", parse_acpi_param);
>>   
>> +static const char *cmdline_cook(const char *p, const char *loader_name);
> 
> Is there a reason not to move cmdline_cook() (and loader_is_grub2()) 
> earlier to avoid this forward declaration?

At a guess: To limit churn?

Jan
Daniel P. Smith Oct. 9, 2024, 11:28 a.m. UTC | #3
On 10/8/24 02:42, Jan Beulich wrote:
> On 07.10.2024 20:09, Jason Andryuk wrote:
>> On 2024-10-06 17:49, Daniel P. Smith wrote:
>>> Transition Xen's command line to being held in struct boot_info.
>>>
>>> No functional change intended.
>>>
>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>> ---
>>
>>>    #endif /* __XEN_X86_BOOTINFO_H__ */
>>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>>> index aafc098ca268..0921f296075f 100644
>>> --- a/xen/arch/x86/setup.c
>>> +++ b/xen/arch/x86/setup.c
>>> @@ -274,6 +274,8 @@ static int __init cf_check parse_acpi_param(const char *s)
>>>    }
>>>    custom_param("acpi", parse_acpi_param);
>>>    
>>> +static const char *cmdline_cook(const char *p, const char *loader_name);
>>
>> Is there a reason not to move cmdline_cook() (and loader_is_grub2())
>> earlier to avoid this forward declaration?
> 
> At a guess: To limit churn?

Correct.

v/r,
dps
diff mbox series

Patch

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index 98ba773c9bc5..327038465a44 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -16,6 +16,7 @@  struct boot_info {
     unsigned int nr_modules;
 
     const char *loader;
+    const char *cmdline;
 };
 
 #endif /* __XEN_X86_BOOTINFO_H__ */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index aafc098ca268..0921f296075f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -274,6 +274,8 @@  static int __init cf_check parse_acpi_param(const char *s)
 }
 custom_param("acpi", parse_acpi_param);
 
+static const char *cmdline_cook(const char *p, const char *loader_name);
+
 static const module_t *__initdata initial_images;
 
 struct boot_info __initdata xen_boot_info;
@@ -288,6 +290,12 @@  static struct boot_info __init *multiboot_fill_boot_info(unsigned long mbi_p)
     bi->loader = (mbi->flags & MBI_LOADERNAME) ?
                             __va(mbi->boot_loader_name) : "unknown";
 
+    /* Parse the command-line options. */
+    if ( mbi->flags & MBI_CMDLINE )
+        bi->cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
+    else
+        bi->cmdline = "";
+
     return bi;
 }
 
@@ -981,7 +989,7 @@  static struct domain *__init create_dom0(const module_t *image,
 
 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 {
-    const char *memmap_type = NULL, *cmdline = "";
+    const char *memmap_type = NULL;
     char *kextra;
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
@@ -1035,11 +1043,7 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     bi = multiboot_fill_boot_info(mbi_p);
 
-    /* Parse the command-line options. */
-    if ( mbi->flags & MBI_CMDLINE )
-        cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
-
-    if ( (kextra = strstr(cmdline, " -- ")) != NULL )
+    if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
         /*
          * Options after ' -- ' separator belong to dom0.
@@ -1050,7 +1054,7 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         kextra += 3;
         while ( kextra[1] == ' ' ) kextra++;
     }
-    cmdline_parse(cmdline);
+    cmdline_parse(bi->cmdline);
 
     /* Must be after command line argument parsing and before
      * allocing any xenheap structures wanted in lower memory. */
@@ -1080,7 +1084,7 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Bootloader: %s\n", bi->loader);
 
-    printk("Command line: %s\n", cmdline);
+    printk("Command line: %s\n", bi->cmdline);
 
     printk("Xen image load base address: %#lx\n", xen_phys_start);
     if ( hypervisor_name )