[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/18] xen: init memory regions for PVH
From: |
Juergen Gross |
Subject: |
Re: [PATCH v2 13/18] xen: init memory regions for PVH |
Date: |
Mon, 22 Oct 2018 13:43:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
On 22/10/2018 13:31, Daniel Kiper wrote:
> On Tue, Oct 09, 2018 at 01:03:12PM +0200, Juergen Gross wrote:
>> Add all usable memory regions to grub memory management and add the
>> needed mmap iterate code.
>
> I am missing a few words why this patch is needed. Especially why
> grub_machine_mmap_iterate() has to belong to this patch. However,
> I think that it should be introduced by patch in which
> grub_machine_mmap_iterate() is used at some point.
That would again lead to one giant PVH patch which you didn't like.
grub_machine_mmap_iterate() is being used by grub common code like
grub-core/lib/relocator.c or grub-core/mmap/mmap.c
grub_machine_mmap_iterate() belongs into this patch as it is the
main user of the memory map introduced here.
Juergen
>
>> As we are running in 32-bit mode don't add memory above 4GB.
>>
>> Signed-off-by: Juergen Gross <address@hidden>
>> ---
>> grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/grub-core/kern/i386/xen/pvh.c b/grub-core/kern/i386/xen/pvh.c
>> index 93ed68245..c4a8bccf4 100644
>> --- a/grub-core/kern/i386/xen/pvh.c
>> +++ b/grub-core/kern/i386/xen/pvh.c
>> @@ -222,6 +222,30 @@ grub_xen_get_mmap (void)
>> grub_xen_sort_mmap ();
>> }
>>
>> +static void
>> +grub_xen_mm_init_regions (void)
>> +{
>> + grub_uint64_t modend, from, to;
>> + unsigned int i;
>> +
>> + modend = grub_modules_get_end ();
>> +
>> + for (i = 0; i < nr_map_entries; i++)
>> + {
>> + if (map[i].type != GRUB_MEMORY_AVAILABLE)
>> + continue;
>> + from = map[i].addr;
>> + to = from + map[i].len;
>> + if (from < modend)
>> + from = modend;
>> + if (from >= to || from >= 0x100000000ULL)
>> + continue;
>> + if (to > 0x100000000ULL)
>> + to = 0x100000000ULL;
>> + grub_mm_init_region ((void *) (grub_addr_t) from, to - from);
>> + }
>> +}
>> +
>> static grub_uint64_t
>> grub_xen_find_page (grub_uint64_t start)
>> {
>> @@ -302,10 +326,21 @@ grub_xen_setup_pvh (void)
>> grub_xen_shared_info = grub_xen_add_physmap (XENMAPSPACE_shared_info,
>> (void *) par);
>>
>> + grub_xen_mm_init_regions ();
>> +
>> grub_rsdp_addr = pvh_start_info->rsdp_paddr;
>> }
>>
>> grub_err_t
>> grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
>> {
>> + unsigned int i;
>> +
>> + for (i = 0; i < nr_map_entries; i++)
>> + {
>> + if (map[i].len && hook (map[i].addr, map[i].len, map[i].type,
>> hook_data))
>> + break;
>> + }
>> +
>> + return GRUB_ERR_NONE;
>
> Daniel
>
[PATCH v2 14/18] xenpvh: add build runes for grub-core, Juergen Gross, 2018/10/09
[PATCH v2 12/18] xen: setup Xen specific data for PVH, Juergen Gross, 2018/10/09
Re: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH, Roger Pau Monné, 2018/10/19
Re: [Xen-devel] [PATCH v2 12/18] xen: setup Xen specific data for PVH, Roger Pau Monné, 2018/10/19