diff mbox series

[v4,13/44] x86/boot: update struct boot_module on module relocation

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

Commit Message

Daniel P. Smith Aug. 30, 2024, 9:46 p.m. UTC
When a boot module is relocated, ensure struct boot_module start and size
fields are updated along with early_mod.

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

Comments

Andrew Cooper Sept. 3, 2024, 11:48 p.m. UTC | #1
On 30/08/2024 10:46 pm, Daniel P. Smith wrote:
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 021c5699f86c..27517d24b2ea 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1408,8 +1408,10 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>           * respective reserve_e820_ram() invocation below. No need to
>           * query efi_boot_mem_unused() here, though.
>           */
> -        boot_info->mods[idx].early_mod->mod_start = virt_to_mfn(_stext);
> -        boot_info->mods[idx].early_mod->mod_end = __2M_rwdata_end - _stext;
> +        boot_info->mods[idx].start = boot_info->mods[idx].early_mod->mod_start
> +                                   = virt_to_mfn(_stext);
> +        boot_info->mods[idx].size = boot_info->mods[idx].early_mod->mod_end
> +                                  = __2M_rwdata_end - _stext;

MISRA objects to using a = b = c; syntax, and we're being asked to take
it out elsewhere.

It would be best to make local start/size variables, and the resulting
code will have less churn through the rest of the series.

~Andrew
Daniel P. Smith Sept. 26, 2024, 5:08 p.m. UTC | #2
On 9/3/24 19:48, Andrew Cooper wrote:
> On 30/08/2024 10:46 pm, Daniel P. Smith wrote:
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index 021c5699f86c..27517d24b2ea 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -1408,8 +1408,10 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>>            * respective reserve_e820_ram() invocation below. No need to
>>            * query efi_boot_mem_unused() here, though.
>>            */
>> -        boot_info->mods[idx].early_mod->mod_start = virt_to_mfn(_stext);
>> -        boot_info->mods[idx].early_mod->mod_end = __2M_rwdata_end - _stext;
>> +        boot_info->mods[idx].start = boot_info->mods[idx].early_mod->mod_start
>> +                                   = virt_to_mfn(_stext);
>> +        boot_info->mods[idx].size = boot_info->mods[idx].early_mod->mod_end
>> +                                  = __2M_rwdata_end - _stext;
> 
> MISRA objects to using a = b = c; syntax, and we're being asked to take
> it out elsewhere.
> 
> It would be best to make local start/size variables, and the resulting
> code will have less churn through the rest of the series.

I will drop the "a = b =c;" syntax and update appropriately.

v/r,
dps
diff mbox series

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 021c5699f86c..27517d24b2ea 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1408,8 +1408,10 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          * respective reserve_e820_ram() invocation below. No need to
          * query efi_boot_mem_unused() here, though.
          */
-        boot_info->mods[idx].early_mod->mod_start = virt_to_mfn(_stext);
-        boot_info->mods[idx].early_mod->mod_end = __2M_rwdata_end - _stext;
+        boot_info->mods[idx].start = boot_info->mods[idx].early_mod->mod_start
+                                   = virt_to_mfn(_stext);
+        boot_info->mods[idx].size = boot_info->mods[idx].early_mod->mod_end
+                                  = __2M_rwdata_end - _stext;
     }
 
     boot_info->mods[0].headroom = bzimage_headroom(