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

Re: [Xen-devel] [PATCH v2 29/41] arm : acpi read acpi memory info from uefi



Hi Parth,

On 17/05/2015 21:03, Parth Dixit wrote:
ACPI memory is seperate from conventional memory and should

s/seperate/separate/

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@xxxxxxxxxx>
---
  xen/arch/arm/domain_build.c |  2 ++
  xen/arch/arm/efi/efi-boot.h | 20 +++++++++++++++++---
  xen/include/asm-arm/setup.h |  1 +
  3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 865b81a..9d98f64 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -42,6 +42,8 @@ static void __init parse_dom0_mem(const char *s)
  }
  custom_param("dom0_mem", parse_dom0_mem);

+struct meminfo __initdata acpi_mem;
+

Please protect it with an CONFIG_ACPI and please keep all the ACPI variable in the same place within this file.

  //#define DEBUG_DT

  #ifdef DEBUG_DT
diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index b02cc02..d21cba5 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -127,14 +127,16 @@ static EFI_STATUS __init 
efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
  {
      int Index;
      int i = 0;
+    int j = 0;
      EFI_MEMORY_DESCRIPTOR *desc_ptr = map;

      for ( Index = 0; Index < (mmap_size / desc_size); Index++ )
      {
-        if ( desc_ptr->Type == EfiConventionalMemory
-             || desc_ptr->Type == EfiBootServicesCode
-             || desc_ptr->Type == EfiBootServicesData )
+        switch( desc_ptr->Type )
          {
+        case EfiConventionalMemory:
+        case EfiBootServicesCode:
+        case EfiBootServicesData:
              if ( i >= NR_MEM_BANKS )
              {
                  PrintStr(L"Warning: All " __stringify(NR_MEM_BANKS)
@@ -144,11 +146,23 @@ static EFI_STATUS __init 
efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
              bootinfo.mem.bank[i].start = desc_ptr->PhysicalStart;
              bootinfo.mem.bank[i].size = desc_ptr->NumberOfPages * 
EFI_PAGE_SIZE;
              ++i;
+            break;

#ifdef CONFIG_ACPI

+        case EfiACPIReclaimMemory:
+            if ( j >= NR_MEM_BANKS )
+            {
+                PrintStr(L"Warning: All " __stringify(NR_MEM_BANKS)
+                          " acpi meminfo mem banks exhausted.\r\n");

DOM0 will likely fail to boot if one of the ACPI region is not present because there is not enough place in the array.

Either you allocate dynamically the array or you stop booting on the platform. But a warning is not enough...

+                break;
+            }
+            acpi_mem.bank[j].start = desc_ptr->PhysicalStart;
+            acpi_mem.bank[j].size  = desc_ptr->NumberOfPages * EFI_PAGE_SIZE;
+            ++j;
          }
          desc_ptr = NextMemoryDescriptor(desc_ptr, desc_size);
      }

      bootinfo.mem.nr_banks = i;
+    acpi_mem.nr_banks = j;
      return EFI_SUCCESS;
  }

diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index ba5a67d..1865b72 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -46,6 +46,7 @@ struct bootinfo {
  };

  extern struct bootinfo bootinfo;
+extern struct meminfo acpi_mem;

#ifdef CONFIG_ACPI
...
#endif


  void arch_init_memory(void);



--
Julien Grall

_______________________________________________
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®.