diff mbox

[Xen-devel,v2,30/41] arm : acpi add placeholder for acpi load address

Message ID 1431893048-5214-31-git-send-email-parth.dixit@linaro.org
State New
Headers show

Commit Message

Parth Dixit May 17, 2015, 8:03 p.m. UTC
EFI table, memory description table and some of acpi tables
will reside in DOM0 memory. Add placeholder for starting
address for loading in DOM0 and get/set acpi size helpers.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
---
 xen/arch/arm/acpi/lib.c    | 12 ++++++++++++
 xen/arch/arm/kernel.c      |  5 ++++-
 xen/arch/arm/kernel.h      |  1 +
 xen/include/asm-arm/acpi.h |  4 ++++
 4 files changed, 21 insertions(+), 1 deletion(-)

Comments

Parth Dixit July 5, 2015, 1:28 p.m. UTC | #1
+shannon

On 8 June 2015 at 21:49, Julien Grall <julien.grall@citrix.com> wrote:
> Hi Parth,
>
> On 17/05/2015 21:03, Parth Dixit wrote:
>>
>> EFI table, memory description table and some of acpi tables
>> will reside in DOM0 memory. Add placeholder for starting
>> address for loading in DOM0 and get/set acpi size helpers.
>>
>> Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
>> ---
>>   xen/arch/arm/acpi/lib.c    | 12 ++++++++++++
>>   xen/arch/arm/kernel.c      |  5 ++++-
>>   xen/arch/arm/kernel.h      |  1 +
>>   xen/include/asm-arm/acpi.h |  4 ++++
>>   4 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
>> index fd9bfa4..9b9f059 100644
>> --- a/xen/arch/arm/acpi/lib.c
>> +++ b/xen/arch/arm/acpi/lib.c
>> @@ -1,6 +1,8 @@
>>   #include <xen/acpi.h>
>>   #include <asm/mm.h>
>>
>> +static int acpi_len = 0;
>> +
>
>
> There is no reason to type this variable signed int. Please use unsigned
> int.
>
> Even better, paddr_t as you use like that after.
>
>>   void __iomem *
>>   acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
>>   {
>> @@ -17,3 +19,13 @@ inline bool_t acpi_psci_hvc_present(void)
>>   {
>>       return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
>>   }
>> +
>> +inline int get_acpi_size(void)
>> +{
>> +    return acpi_len;
>> +}
>> +
>> +inline void set_acpi_size(int size)
>> +{
>> +    acpi_len = size;
>> +}
>
>
> The variable name is misleading, acpi_len doesn't correspond to the real
> size of the ACPI but only whole size of the table generated by Xen.
>
> Furthermore, based the usage I was able to find within the other patch, this
> variable is only used during dom0 creation and should live in kinfo.
>
> --
> Julien Grall
diff mbox

Patch

diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
index fd9bfa4..9b9f059 100644
--- a/xen/arch/arm/acpi/lib.c
+++ b/xen/arch/arm/acpi/lib.c
@@ -1,6 +1,8 @@ 
 #include <xen/acpi.h>
 #include <asm/mm.h>
 
+static int acpi_len = 0;
+
 void __iomem *
 acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
 {
@@ -17,3 +19,13 @@  inline bool_t acpi_psci_hvc_present(void)
 {
     return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
 }
+
+inline int get_acpi_size(void)
+{
+    return acpi_len;
+}
+
+inline void set_acpi_size(int size)
+{
+    acpi_len = size;
+}
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 209c3dd..a9999f6 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -13,6 +13,7 @@ 
 #include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <xen/libfdt/libfdt.h>
+#include <xen/acpi.h>
 
 #include "kernel.h"
 
@@ -74,7 +75,8 @@  static void place_modules(struct kernel_info *info,
     const struct bootmodule *mod = info->initrd_bootmodule;
     const paddr_t initrd_len = ROUNDUP(mod ? mod->size : 0, MB(2));
     const paddr_t dtb_len = ROUNDUP(fdt_totalsize(info->fdt), MB(2));
-    const paddr_t modsize = initrd_len + dtb_len;
+    const paddr_t acpi_len = ROUNDUP(get_acpi_size(), MB(2));
+    const paddr_t modsize = initrd_len + dtb_len + acpi_len;
 
     /* Convenient */
     const paddr_t rambase = info->mem.bank[0].start;
@@ -119,6 +121,7 @@  static void place_modules(struct kernel_info *info,
 
     info->dtb_paddr = modbase;
     info->initrd_paddr = info->dtb_paddr + dtb_len;
+    info->acpi_paddr = info->initrd_paddr + initrd_len;
 }
 
 static paddr_t kernel_zimage_place(struct kernel_info *info)
diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index 0050dfb..f3a67ac 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -26,6 +26,7 @@  struct kernel_info {
     const struct bootmodule *kernel_bootmodule, *initrd_bootmodule;
     paddr_t dtb_paddr;
     paddr_t initrd_paddr;
+    paddr_t acpi_paddr;
 
     /* loader to use for this kernel */
     void (*load)(struct kernel_info *info);
diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h
index 2df9ae0..994c41e 100644
--- a/xen/include/asm-arm/acpi.h
+++ b/xen/include/asm-arm/acpi.h
@@ -37,11 +37,15 @@  bool_t acpi_psci_present(void);
 bool_t acpi_psci_hvc_present(void);
 void __init acpi_init_cpus(void);
 void __init acpi_preinit_xen_time(unsigned int generic_timer_irq[]);
+int get_acpi_size(void);
+void set_acpi_size(int size);
 #else
 static inline bool_t acpi_psci_present(void) { return false; }
 static inline bool_t acpi_psci_hvc_present(void) {return false; }
 static inline void acpi_init_cpus(void) { }
 static inline void acpi_preinit_xen_time(unsigned int generic_timer_irq[]){ }
+static inline int get_acpi_size(void){return 0;}
+static inline void set_acpi_size(int size){}
 #endif /* CONFIG_ACPI */
 
 /* Basic configuration for ACPI */