diff mbox

[Xen-devel,3/6] xen/arm: kernel: Move kernel loading code in init section

Message ID 1421425248-8727-4-git-send-email-julien.grall@linaro.org
State New
Headers show

Commit Message

Julien Grall Jan. 16, 2015, 4:20 p.m. UTC
The code to load the kernel is only used when Xen builds dom0. It
happens during the boot.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/kernel.c | 30 +++++++++++++++---------------
 xen/arch/arm/kernel.h |  4 ++--
 2 files changed, 17 insertions(+), 17 deletions(-)

Comments

Julien Grall Jan. 16, 2015, 5:49 p.m. UTC | #1
Hello,

On 16/01/15 17:33, Vitaly Kuznetsov wrote:
> Julien Grall <julien.grall@linaro.org> writes:
> 
>> The code to load the kernel is only used when Xen builds dom0. It
>> happens during the boot.
> 
> I suppose we don't have dom0 kexec for ARM now or this code is not
> (won't be) required?

We don't have support for DOM0 Kexec and this code is only able to load
kernel from the physical RAM (not from a guest memory).

Regards,
diff mbox

Patch

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 209c3dd..5b72c77 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -67,8 +67,8 @@  void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
     clear_fixmap(FIXMAP_MISC);
 }
 
-static void place_modules(struct kernel_info *info,
-                          paddr_t kernbase, paddr_t kernend)
+static void __init place_modules(struct kernel_info *info,
+                                 paddr_t kernbase, paddr_t kernend)
 {
     /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignment */
     const struct bootmodule *mod = info->initrd_bootmodule;
@@ -121,7 +121,7 @@  static void place_modules(struct kernel_info *info,
     info->initrd_paddr = info->dtb_paddr + dtb_len;
 }
 
-static paddr_t kernel_zimage_place(struct kernel_info *info)
+static paddr_t __init kernel_zimage_place(struct kernel_info *info)
 {
     paddr_t load_addr;
 
@@ -153,7 +153,7 @@  static paddr_t kernel_zimage_place(struct kernel_info *info)
     return load_addr;
 }
 
-static void kernel_zimage_load(struct kernel_info *info)
+static void __init kernel_zimage_load(struct kernel_info *info)
 {
     paddr_t load_addr = kernel_zimage_place(info);
     paddr_t paddr = info->zimage.kernel_addr;
@@ -200,8 +200,8 @@  static void kernel_zimage_load(struct kernel_info *info)
 /*
  * Check if the image is a uImage and setup kernel_info
  */
-static int kernel_uimage_probe(struct kernel_info *info,
-                                 paddr_t addr, paddr_t size)
+static int __init kernel_uimage_probe(struct kernel_info *info,
+                                      paddr_t addr, paddr_t size)
 {
     struct {
         __be32 magic;   /* Image Header Magic Number */
@@ -261,8 +261,8 @@  static int kernel_uimage_probe(struct kernel_info *info,
 /*
  * Check if the image is a 64-bit Image.
  */
-static int kernel_zimage64_probe(struct kernel_info *info,
-                                 paddr_t addr, paddr_t size)
+static int __init kernel_zimage64_probe(struct kernel_info *info,
+                                        paddr_t addr, paddr_t size)
 {
     /* linux/Documentation/arm64/booting.txt */
     struct {
@@ -315,8 +315,8 @@  static int kernel_zimage64_probe(struct kernel_info *info,
 /*
  * Check if the image is a 32-bit zImage and setup kernel_info
  */
-static int kernel_zimage32_probe(struct kernel_info *info,
-                                 paddr_t addr, paddr_t size)
+static int __init kernel_zimage32_probe(struct kernel_info *info,
+                                        paddr_t addr, paddr_t size)
 {
     uint32_t zimage[ZIMAGE32_HEADER_LEN/4];
     uint32_t start, end;
@@ -364,7 +364,7 @@  static int kernel_zimage32_probe(struct kernel_info *info,
     return 0;
 }
 
-static void kernel_elf_load(struct kernel_info *info)
+static void __init kernel_elf_load(struct kernel_info *info)
 {
     /*
      * TODO: can the ELF header be used to find the physical address
@@ -387,8 +387,8 @@  static void kernel_elf_load(struct kernel_info *info)
     free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order);
 }
 
-static int kernel_elf_probe(struct kernel_info *info,
-                            paddr_t addr, paddr_t size)
+static int __init kernel_elf_probe(struct kernel_info *info,
+                                   paddr_t addr, paddr_t size)
 {
     int rc;
 
@@ -439,7 +439,7 @@  err:
     return rc;
 }
 
-int kernel_probe(struct kernel_info *info)
+int __init kernel_probe(struct kernel_info *info)
 {
     struct bootmodule *mod = boot_module_find_by_kind(BOOTMOD_KERNEL);
     int rc;
@@ -476,7 +476,7 @@  int kernel_probe(struct kernel_info *info)
     return rc;
 }
 
-void kernel_load(struct kernel_info *info)
+void __init kernel_load(struct kernel_info *info)
 {
     info->load(info);
 }
diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index 0050dfb..512b573 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -56,7 +56,7 @@  struct kernel_info {
  *  ->type
  *  ->load hook, and sets loader specific variables ->{zimage,elf}
  */
-int kernel_probe(struct kernel_info *info);
+int __init kernel_probe(struct kernel_info *info);
 
 /*
  * Loads the kernel into guest RAM.
@@ -70,7 +70,7 @@  int kernel_probe(struct kernel_info *info);
  *  ->dtb_paddr
  *  ->initrd_paddr
  */
-void kernel_load(struct kernel_info *info);
+void __init kernel_load(struct kernel_info *info);
 
 #endif /* #ifdef __ARCH_ARM_KERNEL_H__ */