diff mbox series

[v5,33/44] x86/boot: convert initial_images to struct boot_module

Message ID 20241006214956.24339-34-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
The variable initial_images is used for tracking the boot modules passed in by
the boot loader. Convert to a struct boot_module and adjust the code that uses
it accordingly.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Jason Andryuk Oct. 8, 2024, 6:52 p.m. UTC | #1
On 2024-10-06 17:49, Daniel P. Smith wrote:
> The variable initial_images is used for tracking the boot modules passed in by
> the boot loader. Convert to a struct boot_module and adjust the code that uses
> it accordingly.
> 
> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> ---
>   xen/arch/x86/setup.c | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index d5916e85f68e..30a139074833 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c

> @@ -336,8 +336,9 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
>   
>       for ( nr = i = 0; i < bi->nr_modules; ++i )
>       {
> -        unsigned long start = initial_images[i].mod_start;
> -        unsigned long end = start + PFN_UP(initial_images[i].mod_end);
> +        unsigned long start = initial_images[i].mod->mod_start;
> +        unsigned long end = start +
> +                            PFN_UP(initial_images[i].mod->mod_end);

This can fit on a single line.

>   
>           if ( end > node_start && node_end > start )
>               nr += min(node_end, end) - max(node_start, start);
> @@ -353,10 +354,12 @@ void __init discard_initial_images(void)
>   
>       for ( i = 0; i < bi->nr_modules; ++i )
>       {
> -        uint64_t start = (uint64_t)initial_images[i].mod_start << PAGE_SHIFT;
> +        uint64_t start =
> +            (uint64_t)initial_images[i].mod->mod_start << PAGE_SHIFT;
>   
>           init_domheap_pages(start,
> -                           start + PAGE_ALIGN(initial_images[i].mod_end));
> +                           start +
> +                           PAGE_ALIGN(initial_images[i].mod->mod_end));

This can fit on a single line.

>       }
>   
>       bi->nr_modules = 0;

With those fixed:
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Daniel P. Smith Oct. 9, 2024, 11:15 p.m. UTC | #2
On 10/8/24 14:52, Jason Andryuk wrote:
> On 2024-10-06 17:49, Daniel P. Smith wrote:
>> The variable initial_images is used for tracking the boot modules 
>> passed in by
>> the boot loader. Convert to a struct boot_module and adjust the code 
>> that uses
>> it accordingly.
>>
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>> ---
>>   xen/arch/x86/setup.c | 15 +++++++++------
>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index d5916e85f68e..30a139074833 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
> 
>> @@ -336,8 +336,9 @@ unsigned long __init 
>> initial_images_nrpages(nodeid_t node)
>>       for ( nr = i = 0; i < bi->nr_modules; ++i )
>>       {
>> -        unsigned long start = initial_images[i].mod_start;
>> -        unsigned long end = start + PFN_UP(initial_images[i].mod_end);
>> +        unsigned long start = initial_images[i].mod->mod_start;
>> +        unsigned long end = start +
>> +                            PFN_UP(initial_images[i].mod->mod_end);
> 
> This can fit on a single line.

Ack.

>>           if ( end > node_start && node_end > start )
>>               nr += min(node_end, end) - max(node_start, start);
>> @@ -353,10 +354,12 @@ void __init discard_initial_images(void)
>>       for ( i = 0; i < bi->nr_modules; ++i )
>>       {
>> -        uint64_t start = (uint64_t)initial_images[i].mod_start << 
>> PAGE_SHIFT;
>> +        uint64_t start =
>> +            (uint64_t)initial_images[i].mod->mod_start << PAGE_SHIFT;
>>           init_domheap_pages(start,
>> -                           start + 
>> PAGE_ALIGN(initial_images[i].mod_end));
>> +                           start +
>> +                           PAGE_ALIGN(initial_images[i].mod->mod_end));
> 
> This can fit on a single line.

Ack.

>>       }
>>       bi->nr_modules = 0;
> 
> With those fixed:
> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>

Thanks!

v/r,
dps
diff mbox series

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d5916e85f68e..30a139074833 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -276,7 +276,7 @@  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;
+static const struct boot_module *__initdata initial_images;
 
 struct boot_info __initdata xen_boot_info;
 
@@ -336,8 +336,9 @@  unsigned long __init initial_images_nrpages(nodeid_t node)
 
     for ( nr = i = 0; i < bi->nr_modules; ++i )
     {
-        unsigned long start = initial_images[i].mod_start;
-        unsigned long end = start + PFN_UP(initial_images[i].mod_end);
+        unsigned long start = initial_images[i].mod->mod_start;
+        unsigned long end = start +
+                            PFN_UP(initial_images[i].mod->mod_end);
 
         if ( end > node_start && node_end > start )
             nr += min(node_end, end) - max(node_start, start);
@@ -353,10 +354,12 @@  void __init discard_initial_images(void)
 
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        uint64_t start = (uint64_t)initial_images[i].mod_start << PAGE_SHIFT;
+        uint64_t start =
+            (uint64_t)initial_images[i].mod->mod_start << PAGE_SHIFT;
 
         init_domheap_pages(start,
-                           start + PAGE_ALIGN(initial_images[i].mod_end));
+                           start +
+                           PAGE_ALIGN(initial_images[i].mod->mod_end));
     }
 
     bi->nr_modules = 0;
@@ -1380,7 +1383,7 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT);
     kexec_reserve_area();
 
-    initial_images = bi->mods[0].mod;
+    initial_images = bi->mods;
 
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {