diff mbox series

[v5,36/44] x86/boot: remove remaining early_mod references

Message ID 20241006214956.24339-37-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
Any direct usages of struct mod have been transitioned, remove the remaining
references to early_mod fields.

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

Comments

Jason Andryuk Oct. 8, 2024, 7:15 p.m. UTC | #1
On 2024-10-06 17:49, Daniel P. Smith wrote:
> Any direct usages of struct mod have been transitioned, remove the remaining
> references to early_mod fields.

This is unclear, please try to re-word.  "struct mod" and "early_mod" 
don't exist.

> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> ---
>   xen/arch/x86/setup.c | 31 +++++++++++--------------------
>   1 file changed, 11 insertions(+), 20 deletions(-)
> 
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index e9e3da3204f1..0ffe8d3ff8dd 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c

> @@ -1404,16 +1401,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>            */
>           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 =
> -        bzimage_headroom(bootstrap_map(bi->mods[0].mod),
> -                         bi->mods[0].mod->mod_end);
> -
> -    bootstrap_map(NULL);
> +    bi->mods[0].headroom = bzimage_headroom(
> +                        bootstrap_map_bm(&bi->mods[0]),
> +                        bi->mods[0].size);

Thunderbird might corrupt this, bit the above can fit on two lines:
     bi->mods[0].headroom = bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
                                             bi->mods[0].size);

> +    bootstrap_map_bm(NULL);
>   
>   #ifndef highmem_start
>       /* Don't allow split below 4Gb. */

> @@ -1708,8 +1699,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>   
>       for ( i = 0; i < bi->nr_modules; ++i )
>       {
> -        set_pdx_range(paddr_to_pfn(bi->mods[i].mod->mod_start),
> -                      paddr_to_pfn(bi->mods[i].mod->mod_start) +
> +        set_pdx_range(paddr_to_pfn(bi->mods[i].start),
> +                      paddr_to_pfn(bi->mods[i].start) +

This belongs in patch 14 as mentioned there.

>                         PFN_UP(bi->mods[i].size));
>           map_pages_to_xen(
>               (unsigned long)maddr_to_virt(bi->mods[i].start),
Jan Beulich Oct. 9, 2024, 6:53 a.m. UTC | #2
On 08.10.2024 21:15, Jason Andryuk wrote:
> On 2024-10-06 17:49, Daniel P. Smith wrote:
>> Any direct usages of struct mod have been transitioned, remove the remaining
>> references to early_mod fields.
> 
> This is unclear, please try to re-word.  "struct mod" and "early_mod" 
> don't exist.
> 
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>> ---
>>   xen/arch/x86/setup.c | 31 +++++++++++--------------------
>>   1 file changed, 11 insertions(+), 20 deletions(-)
>>
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index e9e3da3204f1..0ffe8d3ff8dd 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
> 
>> @@ -1404,16 +1401,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>>            */
>>           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 =
>> -        bzimage_headroom(bootstrap_map(bi->mods[0].mod),
>> -                         bi->mods[0].mod->mod_end);
>> -
>> -    bootstrap_map(NULL);
>> +    bi->mods[0].headroom = bzimage_headroom(
>> +                        bootstrap_map_bm(&bi->mods[0]),
>> +                        bi->mods[0].size);
> 
> Thunderbird might corrupt this, bit the above can fit on two lines:
>      bi->mods[0].headroom = bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
>                                              bi->mods[0].size);

Or else at least indentation wants to change, to one of the two possible
forms:

    bi->mods[0].headroom = bzimage_headroom(
        bootstrap_map_bm(&bi->mods[0]),
        bi->mods[0].size);

(indentation increased by a level from the start of the statement) or

    bi->mods[0].headroom = bzimage_headroom(
                               bootstrap_map_bm(&bi->mods[0]),
                               bi->mods[0].size);

(indentation by one level biased from the start of the function call).
Personally, if already wrapping like this, I'd prefer the former.

Jan
Daniel P. Smith Oct. 9, 2024, 11:40 p.m. UTC | #3
On 10/8/24 15:15, Jason Andryuk wrote:
> On 2024-10-06 17:49, Daniel P. Smith wrote:
>> Any direct usages of struct mod have been transitioned, remove the 
>> remaining
>> references to early_mod fields.
> 
> This is unclear, please try to re-word.  "struct mod" and "early_mod" 
> don't exist.

Ack.

>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>> ---
>>   xen/arch/x86/setup.c | 31 +++++++++++--------------------
>>   1 file changed, 11 insertions(+), 20 deletions(-)
>>
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index e9e3da3204f1..0ffe8d3ff8dd 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
> 
>> @@ -1404,16 +1401,12 @@ void asmlinkage __init noreturn 
>> __start_xen(unsigned long mbi_p)
>>            */
>>           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 =
>> -        bzimage_headroom(bootstrap_map(bi->mods[0].mod),
>> -                         bi->mods[0].mod->mod_end);
>> -
>> -    bootstrap_map(NULL);
>> +    bi->mods[0].headroom = bzimage_headroom(
>> +                        bootstrap_map_bm(&bi->mods[0]),
>> +                        bi->mods[0].size);
> 
> Thunderbird might corrupt this, bit the above can fit on two lines:
>      bi->mods[0].headroom = 
> bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
>                                              bi->mods[0].size);

I actually prefer the same formatting as Jan has suggested, will apply 
that one.

>> +    bootstrap_map_bm(NULL);
>>   #ifndef highmem_start
>>       /* Don't allow split below 4Gb. */
> 
>> @@ -1708,8 +1699,8 @@ void asmlinkage __init noreturn 
>> __start_xen(unsigned long mbi_p)
>>       for ( i = 0; i < bi->nr_modules; ++i )
>>       {
>> -        set_pdx_range(paddr_to_pfn(bi->mods[i].mod->mod_start),
>> -                      paddr_to_pfn(bi->mods[i].mod->mod_start) +
>> +        set_pdx_range(paddr_to_pfn(bi->mods[i].start),
>> +                      paddr_to_pfn(bi->mods[i].start) +
> 
> This belongs in patch 14 as mentioned there.

Ack.

v/r,
dps
Daniel P. Smith Oct. 9, 2024, 11:42 p.m. UTC | #4
On 10/9/24 02:53, Jan Beulich wrote:
> On 08.10.2024 21:15, Jason Andryuk wrote:
>> On 2024-10-06 17:49, Daniel P. Smith wrote:
>>> Any direct usages of struct mod have been transitioned, remove the remaining
>>> references to early_mod fields.
>>
>> This is unclear, please try to re-word.  "struct mod" and "early_mod"
>> don't exist.
>>
>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>> ---
>>>    xen/arch/x86/setup.c | 31 +++++++++++--------------------
>>>    1 file changed, 11 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>>> index e9e3da3204f1..0ffe8d3ff8dd 100644
>>> --- a/xen/arch/x86/setup.c
>>> +++ b/xen/arch/x86/setup.c
>>
>>> @@ -1404,16 +1401,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>>>             */
>>>            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 =
>>> -        bzimage_headroom(bootstrap_map(bi->mods[0].mod),
>>> -                         bi->mods[0].mod->mod_end);
>>> -
>>> -    bootstrap_map(NULL);
>>> +    bi->mods[0].headroom = bzimage_headroom(
>>> +                        bootstrap_map_bm(&bi->mods[0]),
>>> +                        bi->mods[0].size);
>>
>> Thunderbird might corrupt this, bit the above can fit on two lines:
>>       bi->mods[0].headroom = bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
>>                                               bi->mods[0].size);
> 
> Or else at least indentation wants to change, to one of the two possible
> forms:
> 
>      bi->mods[0].headroom = bzimage_headroom(
>          bootstrap_map_bm(&bi->mods[0]),
>          bi->mods[0].size);
> 
> (indentation increased by a level from the start of the statement) or
> 
>      bi->mods[0].headroom = bzimage_headroom(
>                                 bootstrap_map_bm(&bi->mods[0]),
>                                 bi->mods[0].size);
> 
> (indentation by one level biased from the start of the function call).
> Personally, if already wrapping like this, I'd prefer the former.

I agree with you, the former is more pleasing, though wouldn't line 3 
fit on line 2?

v/r,
dps
Jan Beulich Oct. 10, 2024, 8:05 a.m. UTC | #5
On 10.10.2024 01:42, Daniel P. Smith wrote:
> On 10/9/24 02:53, Jan Beulich wrote:
>> On 08.10.2024 21:15, Jason Andryuk wrote:
>>> On 2024-10-06 17:49, Daniel P. Smith wrote:
>>>> Any direct usages of struct mod have been transitioned, remove the remaining
>>>> references to early_mod fields.
>>>
>>> This is unclear, please try to re-word.  "struct mod" and "early_mod"
>>> don't exist.
>>>
>>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>>> ---
>>>>    xen/arch/x86/setup.c | 31 +++++++++++--------------------
>>>>    1 file changed, 11 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>>>> index e9e3da3204f1..0ffe8d3ff8dd 100644
>>>> --- a/xen/arch/x86/setup.c
>>>> +++ b/xen/arch/x86/setup.c
>>>
>>>> @@ -1404,16 +1401,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
>>>>             */
>>>>            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 =
>>>> -        bzimage_headroom(bootstrap_map(bi->mods[0].mod),
>>>> -                         bi->mods[0].mod->mod_end);
>>>> -
>>>> -    bootstrap_map(NULL);
>>>> +    bi->mods[0].headroom = bzimage_headroom(
>>>> +                        bootstrap_map_bm(&bi->mods[0]),
>>>> +                        bi->mods[0].size);
>>>
>>> Thunderbird might corrupt this, bit the above can fit on two lines:
>>>       bi->mods[0].headroom = bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
>>>                                               bi->mods[0].size);
>>
>> Or else at least indentation wants to change, to one of the two possible
>> forms:
>>
>>      bi->mods[0].headroom = bzimage_headroom(
>>          bootstrap_map_bm(&bi->mods[0]),
>>          bi->mods[0].size);
>>
>> (indentation increased by a level from the start of the statement) or
>>
>>      bi->mods[0].headroom = bzimage_headroom(
>>                                 bootstrap_map_bm(&bi->mods[0]),
>>                                 bi->mods[0].size);
>>
>> (indentation by one level biased from the start of the function call).
>> Personally, if already wrapping like this, I'd prefer the former.
> 
> I agree with you, the former is more pleasing, though wouldn't line 3 
> fit on line 2?

Yes, looks like it would.

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index e9e3da3204f1..0ffe8d3ff8dd 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -334,9 +334,8 @@  unsigned long __init initial_images_nrpages(nodeid_t node)
 
     for ( nr = i = 0; i < bi->nr_modules; ++i )
     {
-        unsigned long start = bi->mods[i].mod->mod_start;
-        unsigned long end = start +
-                            PFN_UP(bi->mods[i].mod->mod_end);
+        unsigned long start = bi->mods[i].start;
+        unsigned long end = start + PFN_UP(bi->mods[i].size);
 
         if ( end > node_start && node_end > start )
             nr += min(node_end, end) - max(node_start, start);
@@ -664,8 +663,8 @@  static uint64_t __init consider_modules(
 
     for ( i = 0; i < nr_mods ; ++i )
     {
-        uint64_t start = (uint64_t)pfn_to_paddr(mods[i].mod->mod_start);
-        uint64_t end = start + PAGE_ALIGN(mods[i].mod->mod_end);
+        uint64_t start = (uint64_t)mods[i].start;
+        uint64_t end = start + PAGE_ALIGN(mods[i].size);
 
         if ( i == this_mod )
             continue;
@@ -1380,10 +1379,8 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
-        if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) )
+        if ( bi->mods[i].start & (PAGE_SIZE - 1) )
             panic("Bootloader didn't honor module alignment request\n");
-        bi->mods[i].mod->mod_end -= bi->mods[i].mod->mod_start;
-        bi->mods[i].mod->mod_start >>= PAGE_SHIFT;
     }
 
     /*
@@ -1404,16 +1401,12 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          */
         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 =
-        bzimage_headroom(bootstrap_map(bi->mods[0].mod),
-                         bi->mods[0].mod->mod_end);
-
-    bootstrap_map(NULL);
+    bi->mods[0].headroom = bzimage_headroom(
+                        bootstrap_map_bm(&bi->mods[0]),
+                        bi->mods[0].size);
+    bootstrap_map_bm(NULL);
 
 #ifndef highmem_start
     /* Don't allow split below 4Gb. */
@@ -1518,9 +1511,7 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
             {
                 move_memory(end - size + bm->headroom, bm->start, bm->size);
                 bm->start = (end - size);
-                bm->mod->mod_start = paddr_to_pfn(bm->start);
                 bm->size += bm->headroom;
-                bm->mod->mod_end = bm->size;
                 bm->flags |= BOOTMOD_FLAG_X86_RELOCATED;
             }
         }
@@ -1708,8 +1699,8 @@  void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        set_pdx_range(paddr_to_pfn(bi->mods[i].mod->mod_start),
-                      paddr_to_pfn(bi->mods[i].mod->mod_start) +
+        set_pdx_range(paddr_to_pfn(bi->mods[i].start),
+                      paddr_to_pfn(bi->mods[i].start) +
                       PFN_UP(bi->mods[i].size));
         map_pages_to_xen(
             (unsigned long)maddr_to_virt(bi->mods[i].start),