diff mbox

[v4,03/24] arm/acpi: Read acpi memory info from uefi

Message ID 1456658360-16080-4-git-send-email-zhaoshenglong@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shannon Zhao Feb. 28, 2016, 11:18 a.m. UTC
From: Parth Dixit <parth.dixit@linaro.org>

ACPI memory is seperate from conventional memory and should be marked
as reserved while passing to DOM0. Create a new meminfo structure to
store all the acpi tables listed in uefi.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen/arch/arm/efi/efi-boot.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Jan Beulich Feb. 29, 2016, 2:57 p.m. UTC | #1
>>> On 28.02.16 at 12:18, <zhaoshenglong@huawei.com> wrote:
> From: Parth Dixit <parth.dixit@linaro.org>
> 
> ACPI memory is seperate from conventional memory and should be marked
> as reserved while passing to DOM0. Create a new meminfo structure to
> store all the acpi tables listed in uefi.
> 
> Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

With this I'll commit as is, but I'd like to note that ...

> @@ -129,6 +132,9 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
>  {
>      int Index;
>      int i = 0;
> +#ifdef CONFIG_ACPI
> +    int j = 0;
> +#endif
>      EFI_MEMORY_DESCRIPTOR *desc_ptr = map;
>  
>      for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
> @@ -148,10 +154,27 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
>              bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
>              ++i;
>          }
> +#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
> +        else if ( desc_ptr->Type == EfiACPIReclaimMemory )
> +        {
> +            if ( j >= NR_MEM_BANKS )
> +            {
> +                PrintStr(L"Error: All " __stringify(NR_MEM_BANKS)
> +                          " acpi meminfo mem banks exhausted.\r\n");
> +                return EFI_LOAD_ERROR;
> +            }
> +            acpi_mem.bank[j].start = desc_ptr->PhysicalStart;
> +            acpi_mem.bank[j].size  = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
> +            ++j;
> +        }
> +#endif
>          desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
>      }
>  
>      bootinfo.mem.nr_banks = i;
> +#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
> +    acpi_mem.nr_banks = j;
> +#endif
>      return EFI_SUCCESS;
>  }

... the three #ifdef-s here aren't consistent.

Jan
Stefano Stabellini Feb. 29, 2016, 3:07 p.m. UTC | #2
On Mon, 29 Feb 2016, Jan Beulich wrote:
> >>> On 28.02.16 at 12:18, <zhaoshenglong@huawei.com> wrote:
> > From: Parth Dixit <parth.dixit@linaro.org>
> > 
> > ACPI memory is seperate from conventional memory and should be marked
> > as reserved while passing to DOM0. Create a new meminfo structure to
> > store all the acpi tables listed in uefi.
> > 
> > Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> > Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> With this I'll commit as is, but I'd like to note that ...
> 
> > @@ -129,6 +132,9 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
> >  {
> >      int Index;
> >      int i = 0;
> > +#ifdef CONFIG_ACPI
> > +    int j = 0;
> > +#endif
> >      EFI_MEMORY_DESCRIPTOR *desc_ptr = map;
> >  
> >      for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
> > @@ -148,10 +154,27 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
> >              bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
> >              ++i;
> >          }
> > +#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
> > +        else if ( desc_ptr->Type == EfiACPIReclaimMemory )
> > +        {
> > +            if ( j >= NR_MEM_BANKS )
> > +            {
> > +                PrintStr(L"Error: All " __stringify(NR_MEM_BANKS)
> > +                          " acpi meminfo mem banks exhausted.\r\n");
> > +                return EFI_LOAD_ERROR;
> > +            }
> > +            acpi_mem.bank[j].start = desc_ptr->PhysicalStart;
> > +            acpi_mem.bank[j].size  = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
> > +            ++j;
> > +        }
> > +#endif
> >          desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
> >      }
> >  
> >      bootinfo.mem.nr_banks = i;
> > +#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
> > +    acpi_mem.nr_banks = j;
> > +#endif
> >      return EFI_SUCCESS;
> >  }
> 
> ... the three #ifdef-s here aren't consistent.
 
Well spotted, the CONFIG_ARM is redundant, could you please remove it
while committing?
Jan Beulich Feb. 29, 2016, 3:20 p.m. UTC | #3
>>> On 29.02.16 at 16:07, <stefano.stabellini@eu.citrix.com> wrote:
> On Mon, 29 Feb 2016, Jan Beulich wrote:
>> >>> On 28.02.16 at 12:18, <zhaoshenglong@huawei.com> wrote:
>> > From: Parth Dixit <parth.dixit@linaro.org>
>> > 
>> > ACPI memory is seperate from conventional memory and should be marked
>> > as reserved while passing to DOM0. Create a new meminfo structure to
>> > store all the acpi tables listed in uefi.
>> > 
>> > Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
>> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> > Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>> 
>> With this I'll commit as is, but I'd like to note that ...
>> 
>> > @@ -129,6 +132,9 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
>> >  {
>> >      int Index;
>> >      int i = 0;
>> > +#ifdef CONFIG_ACPI
>> > +    int j = 0;
>> > +#endif
>> >      EFI_MEMORY_DESCRIPTOR *desc_ptr = map;
>> >  
>> >      for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
>> > @@ -148,10 +154,27 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
>> >              bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
>> >              ++i;
>> >          }
>> > +#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
>> > +        else if ( desc_ptr->Type == EfiACPIReclaimMemory )
>> > +        {
>> > +            if ( j >= NR_MEM_BANKS )
>> > +            {
>> > +                PrintStr(L"Error: All " __stringify(NR_MEM_BANKS)
>> > +                          " acpi meminfo mem banks exhausted.\r\n");
>> > +                return EFI_LOAD_ERROR;
>> > +            }
>> > +            acpi_mem.bank[j].start = desc_ptr->PhysicalStart;
>> > +            acpi_mem.bank[j].size  = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
>> > +            ++j;
>> > +        }
>> > +#endif
>> >          desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
>> >      }
>> >  
>> >      bootinfo.mem.nr_banks = i;
>> > +#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
>> > +    acpi_mem.nr_banks = j;
>> > +#endif
>> >      return EFI_SUCCESS;
>> >  }
>> 
>> ... the three #ifdef-s here aren't consistent.
>  
> Well spotted, the CONFIG_ARM is redundant, could you please remove it
> while committing?

Too late, will require a fixup patch now.

Jan
diff mbox

Patch

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index e427e5f..a6c3b69 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -17,6 +17,9 @@  void __flush_dcache_area(const void *vaddr, unsigned long size);
 static struct file __initdata dtbfile;
 static void __initdata *fdt;
 static void __initdata *memmap;
+#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
+static struct meminfo __initdata acpi_mem;
+#endif
 
 static int __init setup_chosen_node(void *fdt, int *addr_cells, int *size_cells)
 {
@@ -129,6 +132,9 @@  static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
 {
     int Index;
     int i = 0;
+#ifdef CONFIG_ACPI
+    int j = 0;
+#endif
     EFI_MEMORY_DESCRIPTOR *desc_ptr = map;
 
     for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
@@ -148,10 +154,27 @@  static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
             bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
             ++i;
         }
+#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
+        else if ( desc_ptr->Type == EfiACPIReclaimMemory )
+        {
+            if ( j >= NR_MEM_BANKS )
+            {
+                PrintStr(L"Error: All " __stringify(NR_MEM_BANKS)
+                          " acpi meminfo mem banks exhausted.\r\n");
+                return EFI_LOAD_ERROR;
+            }
+            acpi_mem.bank[j].start = desc_ptr->PhysicalStart;
+            acpi_mem.bank[j].size  = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
+            ++j;
+        }
+#endif
         desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
     }
 
     bootinfo.mem.nr_banks = i;
+#if defined (CONFIG_ACPI) && defined (CONFIG_ARM)
+    acpi_mem.nr_banks = j;
+#endif
     return EFI_SUCCESS;
 }