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

Daniel P. Smith posted 44 patches 3 months ago
There is a newer version of this series
[PATCH v4 13/44] x86/boot: update struct boot_module on module relocation
Posted by Daniel P. Smith 3 months ago
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(-)

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(
-- 
2.30.2
Re: [PATCH v4 13/44] x86/boot: update struct boot_module on module relocation
Posted by Andrew Cooper 3 months ago
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
Re: [PATCH v4 13/44] x86/boot: update struct boot_module on module relocation
Posted by Daniel P. Smith 2 months, 1 week ago
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