[PATCH v6 12/44] x86/boot: update struct boot_module on module relocation

Daniel P. Smith posted 44 patches 1 month ago
There is a newer version of this series
[PATCH v6 12/44] x86/boot: update struct boot_module on module relocation
Posted by Daniel P. Smith 1 month 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>
---
Changes since v5:
- corrected conversion function for a missed switch from mfn to maddr/paddr
---
 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 6ee352fc0cde..d51b0b03bc97 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1380,8 +1380,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_maddr(_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 =
-- 
2.30.2
Re: [PATCH v6 12/44] x86/boot: update struct boot_module on module relocation
Posted by Jason Andryuk 1 month ago
On 2024-10-17 13:02, 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>
> ---
> Changes since v5:
> - corrected conversion function for a missed switch from mfn to maddr/paddr
> ---
>   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 6ee352fc0cde..d51b0b03bc97 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1380,8 +1380,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_maddr(_stext);
> +        bi->mods[xen].size = __2M_rwdata_end - _stext;
> +
> +        bi->mods[xen].mod->mod_start = bi->mods[xen].start;

But now this line needs to be converted to an mfn?

Regards,
Jason

> +        bi->mods[xen].mod->mod_end = bi->mods[xen].size;
>       }
>   
>       bi->mods[0].headroom =
Re: [PATCH v6 12/44] x86/boot: update struct boot_module on module relocation
Posted by Daniel P. Smith 1 month ago
On 10/17/24 19:15, Jason Andryuk wrote:
> On 2024-10-17 13:02, 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>
>> ---
>> Changes since v5:
>> - corrected conversion function for a missed switch from mfn to 
>> maddr/paddr
>> ---
>>   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 6ee352fc0cde..d51b0b03bc97 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -1380,8 +1380,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_maddr(_stext);
>> +        bi->mods[xen].size = __2M_rwdata_end - _stext;
>> +
>> +        bi->mods[xen].mod->mod_start = bi->mods[xen].start;
> 
> But now this line needs to be converted to an mfn?

Correct.

v/r,
dps