ia64/xen-unstable
changeset 15131:26492c6476f0
[IA64] free initmem and add __init and __initdata.
ia64 counter part of xen-unstable.hg 15043:759d924af6d8.
By freeing init area, un/pickle_domain() is broken because
__init_begin < xen_heap_start. This is fixed by introducing xen_pickle_offset.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
ia64 counter part of xen-unstable.hg 15043:759d924af6d8.
By freeing init area, un/pickle_domain() is broken because
__init_begin < xen_heap_start. This is fixed by introducing xen_pickle_offset.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Wed May 23 08:51:42 2007 -0600 (2007-05-23) |
parents | d30576123892 |
children | 03e04b861d91 |
files | xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/mm.c xen/arch/ia64/xen/mm_init.c xen/arch/ia64/xen/regionreg.c xen/arch/ia64/xen/vhpt.c xen/arch/ia64/xen/xenmem.c xen/arch/ia64/xen/xenpatch.c xen/arch/ia64/xen/xensetup.c xen/include/asm-ia64/config.h xen/include/asm-ia64/mm.h |
line diff
1.1 --- a/xen/arch/ia64/xen/domain.c Mon May 21 14:30:09 2007 -0600 1.2 +++ b/xen/arch/ia64/xen/domain.c Wed May 23 08:51:42 2007 -0600 1.3 @@ -52,10 +52,10 @@ 1.4 #include <asm/perfmon.h> 1.5 #include <public/vcpu.h> 1.6 1.7 -unsigned long dom0_size = 512*1024*1024; 1.8 +static unsigned long __initdata dom0_size = 512*1024*1024; 1.9 1.10 /* dom0_max_vcpus: maximum number of VCPUs to create for dom0. */ 1.11 -static unsigned int dom0_max_vcpus = 1; 1.12 +static unsigned int __initdata dom0_max_vcpus = 1; 1.13 integer_param("dom0_max_vcpus", dom0_max_vcpus); 1.14 1.15 extern unsigned long running_on_sim; 1.16 @@ -1109,7 +1109,7 @@ int shadow_mode_control(struct domain *d 1.17 #define privify_memory(x,y) do {} while(0) 1.18 #endif 1.19 1.20 -static void loaddomainelfimage(struct domain *d, struct elf_binary *elf) 1.21 +static void __init loaddomainelfimage(struct domain *d, struct elf_binary *elf) 1.22 { 1.23 const elf_phdr *phdr; 1.24 int phnum, h, filesz, memsz; 1.25 @@ -1163,7 +1163,7 @@ static void loaddomainelfimage(struct do 1.26 } 1.27 } 1.28 1.29 -void alloc_dom0(void) 1.30 +void __init alloc_dom0(void) 1.31 { 1.32 /* Check dom0 size. */ 1.33 if (dom0_size < 4 * 1024 * 1024) { 1.34 @@ -1187,7 +1187,7 @@ void alloc_dom0(void) 1.35 * handled with order > 0 request. Dom0 requires that bit set to 1.36 * allocate memory for other domains. 1.37 */ 1.38 -static void physdev_init_dom0(struct domain *d) 1.39 +static void __init physdev_init_dom0(struct domain *d) 1.40 { 1.41 if (iomem_permit_access(d, 0UL, ~0UL)) 1.42 BUG(); 1.43 @@ -1197,10 +1197,10 @@ static void physdev_init_dom0(struct dom 1.44 BUG(); 1.45 } 1.46 1.47 -int construct_dom0(struct domain *d, 1.48 - unsigned long image_start, unsigned long image_len, 1.49 - unsigned long initrd_start, unsigned long initrd_len, 1.50 - char *cmdline) 1.51 +int __init construct_dom0(struct domain *d, 1.52 + unsigned long image_start, unsigned long image_len, 1.53 + unsigned long initrd_start, unsigned long initrd_len, 1.54 + char *cmdline) 1.55 { 1.56 int i, rc; 1.57 start_info_t *si; 1.58 @@ -1464,7 +1464,7 @@ arch_do_vcpu_op(int cmd, struct vcpu *v, 1.59 return rc; 1.60 } 1.61 1.62 -static void parse_dom0_mem(char *s) 1.63 +static void __init parse_dom0_mem(char *s) 1.64 { 1.65 dom0_size = parse_size_and_unit(s, NULL); 1.66 }
2.1 --- a/xen/arch/ia64/xen/faults.c Mon May 21 14:30:09 2007 -0600 2.2 +++ b/xen/arch/ia64/xen/faults.c Wed May 23 08:51:42 2007 -0600 2.3 @@ -252,7 +252,7 @@ void ia64_do_page_fault(unsigned long ad 2.4 2.5 fpswa_interface_t *fpswa_interface = 0; 2.6 2.7 -void trap_init(void) 2.8 +void __init trap_init(void) 2.9 { 2.10 if (ia64_boot_param->fpswa) 2.11 /* FPSWA fixup: make the interface pointer a virtual address */
3.1 --- a/xen/arch/ia64/xen/mm.c Mon May 21 14:30:09 2007 -0600 3.2 +++ b/xen/arch/ia64/xen/mm.c Wed May 23 08:51:42 2007 -0600 3.3 @@ -779,7 +779,7 @@ assign_new_domain_page(struct domain *d, 3.4 return __assign_new_domain_page(d, mpaddr, pte); 3.5 } 3.6 3.7 -void 3.8 +void __init 3.9 assign_new_domain0_page(struct domain *d, unsigned long mpaddr) 3.10 { 3.11 volatile pte_t *pte; 3.12 @@ -1360,7 +1360,7 @@ dom0vp_add_physmap_with_gmfn(struct doma 3.13 #ifdef CONFIG_XEN_IA64_EXPOSE_P2M 3.14 static struct page_info* p2m_pte_zero_page = NULL; 3.15 3.16 -void 3.17 +void __init 3.18 expose_p2m_init(void) 3.19 { 3.20 pte_t* pte;
4.1 --- a/xen/arch/ia64/xen/mm_init.c Mon May 21 14:30:09 2007 -0600 4.2 +++ b/xen/arch/ia64/xen/mm_init.c Wed May 23 08:51:42 2007 -0600 4.3 @@ -115,7 +115,7 @@ ia64_mmu_init (void *my_cpu_data) 4.4 #endif 4.5 } 4.6 4.7 -void 4.8 +void __init 4.9 mem_init (void) 4.10 { 4.11 #ifdef CONFIG_PCI
5.1 --- a/xen/arch/ia64/xen/regionreg.c Mon May 21 14:30:09 2007 -0600 5.2 +++ b/xen/arch/ia64/xen/regionreg.c Wed May 23 08:51:42 2007 -0600 5.3 @@ -87,7 +87,7 @@ static int implemented_rid_bits = 0; 5.4 static int mp_rid_shift; 5.5 static struct domain *ridblock_owner[MAX_RID_BLOCKS] = { 0 }; 5.6 5.7 -void init_rid_allocator (void) 5.8 +void __init init_rid_allocator (void) 5.9 { 5.10 int log_blocks; 5.11 pal_vm_info_2_u_t vm_info_2;
6.1 --- a/xen/arch/ia64/xen/vhpt.c Mon May 21 14:30:09 2007 -0600 6.2 +++ b/xen/arch/ia64/xen/vhpt.c Wed May 23 08:51:42 2007 -0600 6.3 @@ -117,7 +117,7 @@ void vhpt_multiple_insert(unsigned long 6.4 } 6.5 } 6.6 6.7 -void vhpt_init(void) 6.8 +void __init vhpt_init(void) 6.9 { 6.10 unsigned long paddr; 6.11 struct page_info *page;
7.1 --- a/xen/arch/ia64/xen/xenmem.c Mon May 21 14:30:09 2007 -0600 7.2 +++ b/xen/arch/ia64/xen/xenmem.c Wed May 23 08:51:42 2007 -0600 7.3 @@ -46,7 +46,7 @@ unsigned long max_page; 7.4 */ 7.5 volatile unsigned long *mpt_table __read_mostly; 7.6 7.7 -void 7.8 +void __init 7.9 paging_init (void) 7.10 { 7.11 unsigned int mpt_order; 7.12 @@ -81,7 +81,7 @@ paging_init (void) 7.13 7.14 #ifdef CONFIG_VIRTUAL_FRAME_TABLE 7.15 7.16 -static unsigned long 7.17 +static unsigned long __init 7.18 alloc_dir_page(void) 7.19 { 7.20 unsigned long mfn = alloc_boot_pages(1, 1); 7.21 @@ -94,7 +94,7 @@ alloc_dir_page(void) 7.22 return dir; 7.23 } 7.24 7.25 -static inline unsigned long 7.26 +static inline unsigned long __init 7.27 alloc_table_page(unsigned long fill) 7.28 { 7.29 unsigned long mfn = alloc_boot_pages(1, 1); 7.30 @@ -109,7 +109,7 @@ alloc_table_page(unsigned long fill) 7.31 return mfn; 7.32 } 7.33 7.34 -static void 7.35 +static void __init 7.36 create_page_table(unsigned long start_page, unsigned long end_page, 7.37 unsigned long fill) 7.38 { 7.39 @@ -131,7 +131,7 @@ create_page_table(unsigned long start_pa 7.40 } 7.41 } 7.42 7.43 -static int 7.44 +static int __init 7.45 create_frametable_page_table (u64 start, u64 end, void *arg) 7.46 { 7.47 struct page_info *map_start, *map_end; 7.48 @@ -147,7 +147,7 @@ create_frametable_page_table (u64 start, 7.49 return 0; 7.50 } 7.51 7.52 -static int 7.53 +static int __init 7.54 create_mpttable_page_table (u64 start, u64 end, void *arg) 7.55 { 7.56 unsigned long map_start, map_end; 7.57 @@ -163,7 +163,7 @@ create_mpttable_page_table (u64 start, u 7.58 return 0; 7.59 } 7.60 7.61 -void init_virtual_frametable(void) 7.62 +void __init init_virtual_frametable(void) 7.63 { 7.64 /* Allocate virtual frame_table */ 7.65 frame_table = (struct page_info *) VIRT_FRAME_TABLE_ADDR;
8.1 --- a/xen/arch/ia64/xen/xenpatch.c Mon May 21 14:30:09 2007 -0600 8.2 +++ b/xen/arch/ia64/xen/xenpatch.c Wed May 23 08:51:42 2007 -0600 8.3 @@ -21,6 +21,7 @@ 8.4 8.5 #include <xen/config.h> 8.6 #include <xen/lib.h> 8.7 +#include <xen/init.h> 8.8 #include <asm/xensystem.h> 8.9 #include <asm/intrinsics.h> 8.10 8.11 @@ -96,7 +97,7 @@ extern unsigned long xen_pstart; 8.12 * Add more patch points in seperate functions as appropriate 8.13 */ 8.14 8.15 -static void xen_patch_frametable_miss(u64 offset) 8.16 +static void __init xen_patch_frametable_miss(u64 offset) 8.17 { 8.18 u64 addr, val; 8.19 8.20 @@ -106,7 +107,7 @@ static void xen_patch_frametable_miss(u6 8.21 } 8.22 8.23 8.24 -void xen_patch_kernel(void) 8.25 +void __init xen_patch_kernel(void) 8.26 { 8.27 unsigned long patch_offset; 8.28
9.1 --- a/xen/arch/ia64/xen/xensetup.c Mon May 21 14:30:09 2007 -0600 9.2 +++ b/xen/arch/ia64/xen/xensetup.c Wed May 23 08:51:42 2007 -0600 9.3 @@ -33,7 +33,7 @@ 9.4 unsigned long xenheap_phys_end, total_pages; 9.5 9.6 char saved_command_line[COMMAND_LINE_SIZE]; 9.7 -char dom0_command_line[COMMAND_LINE_SIZE]; 9.8 +char __initdata dom0_command_line[COMMAND_LINE_SIZE]; 9.9 9.10 cpumask_t cpu_present_map; 9.11 9.12 @@ -58,17 +58,17 @@ static int opt_nosmp; 9.13 boolean_param("nosmp", opt_nosmp); 9.14 9.15 /* maxcpus: maximum number of CPUs to activate. */ 9.16 -static unsigned int max_cpus = NR_CPUS; 9.17 +static unsigned int __initdata max_cpus = NR_CPUS; 9.18 integer_param("maxcpus", max_cpus); 9.19 9.20 /* xencons: if true enable xenconsole input (and irq). 9.21 Note: you have to disable 8250 serials in domains (to avoid use of the 9.22 same resource). */ 9.23 -static int opt_xencons = 1; 9.24 +static int __initdata opt_xencons = 1; 9.25 integer_param("xencons", opt_xencons); 9.26 9.27 /* Toggle to allow non-legacy xencons UARTs to run in polling mode */ 9.28 -static int opt_xencons_poll; 9.29 +static int __initdata opt_xencons_poll; 9.30 boolean_param("xencons_poll", opt_xencons_poll); 9.31 9.32 /* 9.33 @@ -85,9 +85,9 @@ unsigned int opt_xenheap_megabytes = XEN 9.34 unsigned long xenheap_size = XENHEAP_DEFAULT_SIZE; 9.35 extern long running_on_sim; 9.36 unsigned long xen_pstart; 9.37 -void *xen_heap_start __read_mostly; 9.38 +void *xen_pickle_offset __read_mostly; 9.39 9.40 -static int 9.41 +static int __init 9.42 xen_count_pages(u64 start, u64 end, void *arg) 9.43 { 9.44 unsigned long *count = arg; 9.45 @@ -119,7 +119,7 @@ static void __init do_initcalls(void) 9.46 */ 9.47 static char null[4] = { 0 }; 9.48 9.49 -void early_cmdline_parse(char **cmdline_p) 9.50 +void __init early_cmdline_parse(char **cmdline_p) 9.51 { 9.52 char *guest_cmd; 9.53 static const char * const split = "--"; 9.54 @@ -164,11 +164,11 @@ struct ns16550_defaults ns16550_com2 = { 9.55 }; 9.56 9.57 /* efi_print: print efi table at boot */ 9.58 -static int opt_efi_print; 9.59 +static int __initdata opt_efi_print; 9.60 boolean_param("efi_print", opt_efi_print); 9.61 9.62 /* print EFI memory map: */ 9.63 -static void 9.64 +static void __init 9.65 efi_print(void) 9.66 { 9.67 void *efi_map_start, *efi_map_end; 9.68 @@ -242,7 +242,19 @@ md_overlaps(efi_memory_desc_t *md, unsig 9.69 9.70 #define MD_SIZE(md) (md->num_pages << EFI_PAGE_SHIFT) 9.71 9.72 -void start_kernel(void) 9.73 +extern char __init_begin[], __init_end[]; 9.74 +static void noinline init_done(void) 9.75 +{ 9.76 + memset(__init_begin, 0, __init_end - __init_begin); 9.77 + flush_icache_range((unsigned long)__init_begin, (unsigned long)__init_end); 9.78 + init_xenheap_pages(__pa(__init_begin), __pa(__init_end)); 9.79 + printk("Freed %ldkB init memory.\n", 9.80 + (long)(__init_end-__init_begin)>>10); 9.81 + 9.82 + startup_cpu_idle_loop(); 9.83 +} 9.84 + 9.85 +void __init start_kernel(void) 9.86 { 9.87 char *cmdline; 9.88 unsigned long nr_pages; 9.89 @@ -252,6 +264,7 @@ void start_kernel(void) 9.90 struct domain *idle_domain; 9.91 struct vcpu *dom0_vcpu0; 9.92 efi_memory_desc_t *kern_md, *last_md, *md; 9.93 + void *xen_heap_start; 9.94 #ifdef CONFIG_SMP 9.95 int i; 9.96 #endif 9.97 @@ -391,6 +404,14 @@ void start_kernel(void) 9.98 efi_memmap_walk(find_max_pfn, &max_page); 9.99 printk("find_memory: efi_memmap_walk returns max_page=%lx\n",max_page); 9.100 efi_print(); 9.101 + 9.102 + /* 9.103 + * later [__init_begin, __init_end) will be freed up as xen heap 9.104 + * so that struct domain might be allocated from the init area 9.105 + * which is < xen_heap_start. so we can't simply set 9.106 + * xen_pickle_offset = xen_heap_start. 9.107 + */ 9.108 + xen_pickle_offset = ia64_imva(__init_begin); 9.109 9.110 xen_heap_start = memguard_init(ia64_imva(&_end)); 9.111 printk("Before xen_heap_start: %p\n", xen_heap_start); 9.112 @@ -546,7 +567,7 @@ printk("num_online_cpus=%d, max_cpus=%d\ 9.113 9.114 domain_unpause_by_systemcontroller(dom0); 9.115 9.116 - startup_cpu_idle_loop(); 9.117 + init_done(); 9.118 } 9.119 9.120 void arch_get_xen_caps(xen_capabilities_info_t *info)
10.1 --- a/xen/include/asm-ia64/config.h Mon May 21 14:30:09 2007 -0600 10.2 +++ b/xen/include/asm-ia64/config.h Wed May 23 08:51:42 2007 -0600 10.3 @@ -83,8 +83,6 @@ typedef unsigned long paddr_t; 10.4 extern unsigned long xenheap_phys_end; 10.5 extern unsigned long xen_pstart; 10.6 extern unsigned long xenheap_size; 10.7 -//extern struct domain *dom0; 10.8 -extern unsigned long dom0_size; 10.9 10.10 // from linux/include/linux/mm.h 10.11 extern struct page_info *mem_map;
11.1 --- a/xen/include/asm-ia64/mm.h Mon May 21 14:30:09 2007 -0600 11.2 +++ b/xen/include/asm-ia64/mm.h Wed May 23 08:51:42 2007 -0600 11.3 @@ -118,9 +118,9 @@ struct page_info 11.4 #define is_xen_heap_frame(pfn) ((page_to_maddr(pfn) < xenheap_phys_end) \ 11.5 && (page_to_maddr(pfn) >= xen_pstart)) 11.6 11.7 -extern void *xen_heap_start; 11.8 -#define __pickle(a) ((unsigned long)a - (unsigned long)xen_heap_start) 11.9 -#define __unpickle(a) (void *)(a + xen_heap_start) 11.10 +extern void* xen_pickle_offset; 11.11 +#define __pickle(a) ((unsigned long)a - (unsigned long)xen_pickle_offset) 11.12 +#define __unpickle(a) (void *)(a + xen_pickle_offset) 11.13 11.14 static inline struct domain *unpickle_domptr(u64 _d) 11.15 { return (_d == 0) ? NULL : __unpickle(_d); }