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

Re: [Xen-devel] [PATCH 7/8] xen/arm: efi: Rework acpi_create_efi_mmap_table to avoid memory_map[offset]



On Fri, 3 Feb 2017, Julien Grall wrote:
> The code contains a lot of memory_map[offset]. This could be simplified
> by incrementing the descriptor pointer every time.
> 
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

> ---
>  xen/arch/arm/efi/efi-dom0.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c
> index f307f26..f0ceaa6 100644
> --- a/xen/arch/arm/efi/efi-dom0.c
> +++ b/xen/arch/arm/efi/efi-dom0.c
> @@ -112,25 +112,24 @@ void __init acpi_create_efi_mmap_table(struct domain *d,
>                                         const struct meminfo *mem,
>                                         struct membank tbl_add[])
>  {
> -    EFI_MEMORY_DESCRIPTOR *memory_map;
> -    unsigned int i, offset;
> +    EFI_MEMORY_DESCRIPTOR *desc;
> +    unsigned int i;
>      u8 *base_ptr;
>  
>      base_ptr = d->arch.efi_acpi_table
>                 + acpi_get_table_offset(tbl_add, TBL_MMAP);
> -    memory_map = (EFI_MEMORY_DESCRIPTOR *)base_ptr;
> +    desc = (EFI_MEMORY_DESCRIPTOR *)base_ptr;
>  
> -    offset = 0;
> -    for( i = 0; i < mem->nr_banks; i++, offset++ )
> -        fill_efi_memory_descriptor(&memory_map[offset], 
> EfiConventionalMemory,
> +    for ( i = 0; i < mem->nr_banks; i++, desc++ )
> +        fill_efi_memory_descriptor(desc, EfiConventionalMemory,
>                                     mem->bank[i].start, mem->bank[i].size);
>  
> -    for( i = 0; i < acpi_mem.nr_banks; i++, offset++ )
> -        fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory,
> +    for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ )
> +        fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
>                                     acpi_mem.bank[i].start,
>                                     acpi_mem.bank[i].size);
>  
> -    fill_efi_memory_descriptor(&memory_map[offset], EfiACPIReclaimMemory,
> +    fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
>                                 d->arch.efi_acpi_gpa, d->arch.efi_acpi_len);
>  
>      tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa
> -- 
> 1.9.1
> 

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

 


Rackspace

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