diff mbox series

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

Message ID 20241006214956.24339-14-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
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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Jason Andryuk Oct. 7, 2024, 8:31 p.m. UTC | #1
On 2024-10-06 17:49, Daniel P. Smith wrote:
> 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 | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 093a4f5380d1..f968758048ed 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1392,8 +1392,11 @@ 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.
>            */
> -        bi->mods[xen].mod->mod_start = virt_to_mfn(_stext);
> -        bi->mods[xen].mod->mod_end = __2M_rwdata_end - _stext;
> +        bi->mods[xen].start = virt_to_mfn(_stext);
> +        bi->mods[xen].size = __2M_rwdata_end - _stext;

The last patch did:
bi->mods[i].start = (paddr_t)mods[i].mod_start;

and start is a paddr_t.

Is virt_to_mfn() wrong?

> +
> +        bi->mods[xen].mod->mod_start = bi->mods[xen].start;
> +        bi->mods[xen].mod->mod_end = bi->mods[xen].size;
>       }
>   
>       bi->mods[0].headroom =
Daniel P. Smith Oct. 9, 2024, 2:36 p.m. UTC | #2
On 10/7/24 16:31, Jason Andryuk wrote:
> On 2024-10-06 17:49, Daniel P. Smith wrote:
>> 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 | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index 093a4f5380d1..f968758048ed 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -1392,8 +1392,11 @@ 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.
>>            */
>> -        bi->mods[xen].mod->mod_start = virt_to_mfn(_stext);
>> -        bi->mods[xen].mod->mod_end = __2M_rwdata_end - _stext;
>> +        bi->mods[xen].start = virt_to_mfn(_stext);
>> +        bi->mods[xen].size = __2M_rwdata_end - _stext;
> 
> The last patch did:
> bi->mods[i].start = (paddr_t)mods[i].mod_start;
> 
> and start is a paddr_t.
> 
> Is virt_to_mfn() wrong?

Yah, that is seriously wrong. Will fix.

v/r,
dps
diff mbox series

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 093a4f5380d1..f968758048ed 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1392,8 +1392,11 @@  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.
          */
-        bi->mods[xen].mod->mod_start = virt_to_mfn(_stext);
-        bi->mods[xen].mod->mod_end = __2M_rwdata_end - _stext;
+        bi->mods[xen].start = virt_to_mfn(_stext);
+        bi->mods[xen].size = __2M_rwdata_end - _stext;
+
+        bi->mods[xen].mod->mod_start = bi->mods[xen].start;
+        bi->mods[xen].mod->mod_end = bi->mods[xen].size;
     }
 
     bi->mods[0].headroom =