[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v8][PATCH 05/16] hvmloader: get guest memory map into memory_map[]



>>> On 16.07.15 at 08:52, <tiejun.chen@xxxxxxxxx> wrote:
> Now we get this map layout by call XENMEM_memory_map then
> save them into one global variable memory_map[]. It should
> include lowmem range, rdm range and highmem range. Note
> rdm range and highmem range may not exist in some cases.
> 
> And here we need to check if any reserved memory conflicts with
> [RESERVED_MEMORY_DYNAMIC_START, RESERVED_MEMORY_DYNAMIC_END].

[RESERVED_MEMORY_DYNAMIC_START, RESERVED_MEMORY_DYNAMIC_END)

> --- a/tools/firmware/hvmloader/e820.c
> +++ b/tools/firmware/hvmloader/e820.c
> @@ -23,6 +23,41 @@
>  #include "config.h"
>  #include "util.h"
>  
> +struct e820map memory_map;
> +
> +void memory_map_setup(void)
> +{
> +    unsigned int nr_entries = E820MAX, i;
> +    int rc;
> +    uint64_t alloc_addr = RESERVED_MEMORY_DYNAMIC_START;
> +    uint64_t alloc_size = RESERVED_MEMORY_DYNAMIC_END - alloc_addr;
> +
> +    rc = get_mem_mapping_layout(memory_map.map, &nr_entries);
> +
> +    if ( rc || !nr_entries )
> +    {
> +        printf("Get guest memory maps[%d] failed. (%d)\n", nr_entries, rc);
> +        BUG();
> +    }
> +
> +    memory_map.nr_map = nr_entries;
> +
> +    for ( i = 0; i < nr_entries; i++ )
> +    {
> +        if ( memory_map.map[i].type == E820_RESERVED )
> +        {
> +            if ( check_overlap(alloc_addr, alloc_size,
> +                               memory_map.map[i].addr,
> +                               memory_map.map[i].size) )
> +            {
> +                printf("Fail to setup memory map due to conflict");
> +                printf(" on dynamic reserved memory range.\n");
> +                BUG();
> +            }
> +        }

Another case of two if()-s which should be folded.

Again, no need to re-submit just because of this; with it fixed
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.