direct-io.hg
changeset 9837:ae0d41bd3bba
[IA64] domain0 builder change
make domain0 builder for dom0 vp model.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
make domain0 builder for dom0 vp model.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author | awilliam@ldap.hp.com |
---|---|
date | Tue Apr 25 13:48:02 2006 -0600 (2006-04-25) |
parents | bb99a6e5456a |
children | 7a9a00c51588 |
files | xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/xensetup.c |
line diff
1.1 --- a/xen/arch/ia64/xen/dom_fw.c Tue Apr 25 13:11:15 2006 -0600 1.2 +++ b/xen/arch/ia64/xen/dom_fw.c Tue Apr 25 13:48:02 2006 -0600 1.3 @@ -10,6 +10,7 @@ 1.4 #include <asm/pgalloc.h> 1.5 1.6 #include <linux/efi.h> 1.7 +#include <linux/sort.h> 1.8 #include <asm/io.h> 1.9 #include <asm/pal.h> 1.10 #include <asm/sal.h> 1.11 @@ -48,12 +49,25 @@ dom_pa(unsigned long imva) 1.12 return dom_fw_base_mpa + (imva - imva_fw_base); 1.13 } 1.14 1.15 +// allocate a page for fw 1.16 +// build_physmap_table() which is called by new_thread() 1.17 +// does for domU. 1.18 +#define ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, mpaddr) \ 1.19 + do { \ 1.20 + if ((d) == dom0) { \ 1.21 + assign_new_domain0_page((d), (mpaddr)); \ 1.22 + } \ 1.23 + } while (0) 1.24 + 1.25 // builds a hypercall bundle at domain physical address 1.26 static void dom_efi_hypercall_patch(struct domain *d, unsigned long paddr, unsigned long hypercall) 1.27 { 1.28 unsigned long *imva; 1.29 1.30 +#ifndef CONFIG_XEN_IA64_DOM0_VP 1.31 if (d == dom0) paddr += dom0_start; 1.32 +#endif 1.33 + ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, paddr); 1.34 imva = (unsigned long *) domain_mpa_to_imva(d, paddr); 1.35 build_hypercall_bundle(imva, d->arch.breakimm, hypercall, 1); 1.36 } 1.37 @@ -64,6 +78,7 @@ static void dom_fw_hypercall_patch(struc 1.38 { 1.39 unsigned long *imva; 1.40 1.41 + ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, paddr); 1.42 imva = (unsigned long *) domain_mpa_to_imva(d, paddr); 1.43 build_hypercall_bundle(imva, d->arch.breakimm, hypercall, ret); 1.44 } 1.45 @@ -72,6 +87,7 @@ static void dom_fw_pal_hypercall_patch(s 1.46 { 1.47 unsigned long *imva; 1.48 1.49 + ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, paddr); 1.50 imva = (unsigned long *) domain_mpa_to_imva(d, paddr); 1.51 build_pal_hypercall_bundles(imva, d->arch.breakimm, FW_HYPERCALL_PAL_CALL); 1.52 } 1.53 @@ -85,7 +101,10 @@ unsigned long dom_fw_setup(struct domain 1.54 struct ia64_boot_param *bp; 1.55 1.56 dom_fw_base_mpa = 0; 1.57 +#ifndef CONFIG_XEN_IA64_DOM0_VP 1.58 if (d == dom0) dom_fw_base_mpa += dom0_start; 1.59 +#endif 1.60 + ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, dom_fw_base_mpa); 1.61 imva_fw_base = domain_mpa_to_imva(d, dom_fw_base_mpa); 1.62 bp = dom_fw_init(d, args, arglen, (char *) imva_fw_base, PAGE_SIZE); 1.63 return dom_pa((unsigned long) bp); 1.64 @@ -645,7 +664,75 @@ dom_fw_fake_acpi(struct domain *d, struc 1.65 } 1.66 1.67 #define NUM_EFI_SYS_TABLES 6 1.68 -#define NUM_MEM_DESCS 5 1.69 +#define NUM_MEM_DESCS 64 //large enough 1.70 + 1.71 +struct dom0_passthrough_arg { 1.72 +#ifdef CONFIG_XEN_IA64_DOM0_VP 1.73 + struct domain* d; 1.74 +#endif 1.75 + efi_memory_desc_t *md; 1.76 + int* i; 1.77 +}; 1.78 + 1.79 +static int 1.80 +dom_fw_dom0_passthrough(efi_memory_desc_t *md, void *arg__) 1.81 +{ 1.82 + struct dom0_passthrough_arg* arg = (struct dom0_passthrough_arg*)arg__; 1.83 + unsigned long paddr; 1.84 + 1.85 +#ifdef CONFIG_XEN_IA64_DOM0_VP 1.86 + struct domain* d = arg->d; 1.87 + u64 start = md->phys_addr; 1.88 + u64 end = start + (md->num_pages << EFI_PAGE_SHIFT); 1.89 + 1.90 + if (md->type == EFI_MEMORY_MAPPED_IO || 1.91 + md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) { 1.92 + 1.93 + //XXX some machine has large mmio area whose size is about several TB. 1.94 + // It requires impractical memory to map such a huge region 1.95 + // to a domain. 1.96 + // For now we don't map it, but later we must fix this. 1.97 + if (md->type == EFI_MEMORY_MAPPED_IO && 1.98 + ((md->num_pages << EFI_PAGE_SHIFT) > 0x100000000UL)) 1.99 + return 0; 1.100 + 1.101 + paddr = assign_domain_mmio_page(d, start, end - start); 1.102 + } else 1.103 + paddr = assign_domain_mach_page(d, start, end - start); 1.104 +#else 1.105 + paddr = md->phys_addr; 1.106 +#endif 1.107 + 1.108 + BUG_ON(md->type != EFI_RUNTIME_SERVICES_CODE && 1.109 + md->type != EFI_RUNTIME_SERVICES_DATA && 1.110 + md->type != EFI_ACPI_RECLAIM_MEMORY && 1.111 + md->type != EFI_MEMORY_MAPPED_IO && 1.112 + md->type != EFI_MEMORY_MAPPED_IO_PORT_SPACE); 1.113 + 1.114 + arg->md->type = md->type; 1.115 + arg->md->pad = 0; 1.116 + arg->md->phys_addr = paddr; 1.117 + arg->md->virt_addr = 0; 1.118 + arg->md->num_pages = md->num_pages; 1.119 + arg->md->attribute = md->attribute; 1.120 + print_md(arg->md); 1.121 + 1.122 + (*arg->i)++; 1.123 + arg->md++; 1.124 + return 0; 1.125 +} 1.126 + 1.127 +static int 1.128 +efi_mdt_cmp(const void *a, const void *b) 1.129 +{ 1.130 + const efi_memory_desc_t *x = a, *y = b; 1.131 + 1.132 + if (x->phys_addr > y->phys_addr) 1.133 + return 1; 1.134 + if (x->phys_addr < y->phys_addr) 1.135 + return -1; 1.136 + return 0; 1.137 +} 1.138 1.139 static struct ia64_boot_param * 1.140 dom_fw_init (struct domain *d, const char *args, int arglen, char *fw_mem, int fw_mem_size) 1.141 @@ -663,7 +750,11 @@ dom_fw_init (struct domain *d, const cha 1.142 char *cp, *cmd_line, *fw_vendor; 1.143 int i = 0; 1.144 unsigned long maxmem = (d->max_pages - d->arch.sys_pgnr) * PAGE_SIZE; 1.145 +#ifdef CONFIG_XEN_IA64_DOM0_VP 1.146 + const unsigned long start_mpaddr = 0; 1.147 +#else 1.148 const unsigned long start_mpaddr = ((d==dom0)?dom0_start:0); 1.149 +#endif 1.150 1.151 # define MAKE_MD(typ, attr, start, end, abs) \ 1.152 do { \ 1.153 @@ -751,11 +842,17 @@ dom_fw_init (struct domain *d, const cha 1.154 efi_tables[i].table = 0; 1.155 } 1.156 if (d == dom0) { 1.157 +#ifdef CONFIG_XEN_IA64_DOM0_VP 1.158 +# define ASSIGN_DOMAIN_MACH_PAGE(d, p) assign_domain_mach_page(d, p, PAGE_SIZE) 1.159 +#else 1.160 +# define ASSIGN_DOMAIN_MACH_PAGE(d, p) ({p;}) 1.161 +#endif 1.162 + 1.163 printf("Domain0 EFI passthrough:"); 1.164 i = 1; 1.165 if (efi.mps) { 1.166 efi_tables[i].guid = MPS_TABLE_GUID; 1.167 - efi_tables[i].table = __pa(efi.mps); 1.168 + efi_tables[i].table = ASSIGN_DOMAIN_MACH_PAGE(d, __pa(efi.mps)); 1.169 printf(" MPS=0x%lx",efi_tables[i].table); 1.170 i++; 1.171 } 1.172 @@ -764,25 +861,25 @@ dom_fw_init (struct domain *d, const cha 1.173 1.174 if (efi.acpi20) { 1.175 efi_tables[i].guid = ACPI_20_TABLE_GUID; 1.176 - efi_tables[i].table = __pa(efi.acpi20); 1.177 + efi_tables[i].table = ASSIGN_DOMAIN_MACH_PAGE(d, __pa(efi.acpi20)); 1.178 printf(" ACPI 2.0=0x%lx",efi_tables[i].table); 1.179 i++; 1.180 } 1.181 if (efi.acpi) { 1.182 efi_tables[i].guid = ACPI_TABLE_GUID; 1.183 - efi_tables[i].table = __pa(efi.acpi); 1.184 + efi_tables[i].table = ASSIGN_DOMAIN_MACH_PAGE(d, __pa(efi.acpi)); 1.185 printf(" ACPI=0x%lx",efi_tables[i].table); 1.186 i++; 1.187 } 1.188 if (efi.smbios) { 1.189 efi_tables[i].guid = SMBIOS_TABLE_GUID; 1.190 - efi_tables[i].table = __pa(efi.smbios); 1.191 + efi_tables[i].table = ASSIGN_DOMAIN_MACH_PAGE(d, __pa(efi.smbios)); 1.192 printf(" SMBIOS=0x%lx",efi_tables[i].table); 1.193 i++; 1.194 } 1.195 if (efi.hcdp) { 1.196 efi_tables[i].guid = HCDP_TABLE_GUID; 1.197 - efi_tables[i].table = __pa(efi.hcdp); 1.198 + efi_tables[i].table = ASSIGN_DOMAIN_MACH_PAGE(d, __pa(efi.hcdp)); 1.199 printf(" HCDP=0x%lx",efi_tables[i].table); 1.200 i++; 1.201 } 1.202 @@ -835,6 +932,7 @@ dom_fw_init (struct domain *d, const cha 1.203 1.204 i = 0; 1.205 if (d == dom0) { 1.206 +#ifndef CONFIG_XEN_IA64_DOM0_VP 1.207 /* 1.208 * This is a bad hack. Dom0 may share other domains' memory 1.209 * through a dom0 physical address. Unfortunately, this 1.210 @@ -849,31 +947,42 @@ dom_fw_init (struct domain *d, const cha 1.211 unsigned long last_end = last_start + IA64_GRANULE_SIZE; 1.212 1.213 /* simulate 1MB free memory at physical address zero */ 1.214 - MAKE_MD(EFI_LOADER_DATA,EFI_MEMORY_WB,0*MB,1*MB, 0); 1.215 + MAKE_MD(EFI_LOADER_DATA,EFI_MEMORY_WB,0*MB,1*MB, 0);//XXX 1.216 +#endif 1.217 /* hypercall patches live here, masquerade as reserved PAL memory */ 1.218 MAKE_MD(EFI_PAL_CODE,EFI_MEMORY_WB,HYPERCALL_START,HYPERCALL_END, 0); 1.219 - MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,HYPERCALL_END,maxmem-IA64_GRANULE_SIZE, 0); 1.220 + MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,HYPERCALL_END,maxmem-IA64_GRANULE_SIZE, 0);//XXX make sure this doesn't overlap on i/o, runtime area. 1.221 +#ifndef CONFIG_XEN_IA64_DOM0_VP 1.222 /* hack */ MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,last_start,last_end,1); 1.223 +#endif 1.224 1.225 /* pass through the I/O port space */ 1.226 if (!running_on_sim) { 1.227 - efi_memory_desc_t *efi_get_io_md(void); 1.228 - efi_memory_desc_t *ia64_efi_io_md; 1.229 - u32 type; 1.230 - u64 iostart, ioend, ioattr; 1.231 - 1.232 - ia64_efi_io_md = efi_get_io_md(); 1.233 - type = ia64_efi_io_md->type; 1.234 - iostart = ia64_efi_io_md->phys_addr; 1.235 - ioend = ia64_efi_io_md->phys_addr + 1.236 - (ia64_efi_io_md->num_pages << 12); 1.237 - ioattr = ia64_efi_io_md->attribute; 1.238 - MAKE_MD(type,ioattr,iostart,ioend, 1); 1.239 + struct dom0_passthrough_arg arg; 1.240 +#ifdef CONFIG_XEN_IA64_DOM0_VP 1.241 + arg.d = d; 1.242 +#endif 1.243 + arg.md = &efi_memmap[i]; 1.244 + arg.i = &i; 1.245 + //XXX Is this needed? 1.246 + efi_memmap_walk_type(EFI_RUNTIME_SERVICES_CODE, 1.247 + dom_fw_dom0_passthrough, &arg); 1.248 + // for ACPI table. 1.249 + efi_memmap_walk_type(EFI_RUNTIME_SERVICES_DATA, 1.250 + dom_fw_dom0_passthrough, &arg); 1.251 + efi_memmap_walk_type(EFI_ACPI_RECLAIM_MEMORY, 1.252 + dom_fw_dom0_passthrough, &arg); 1.253 + efi_memmap_walk_type(EFI_MEMORY_MAPPED_IO, 1.254 + dom_fw_dom0_passthrough, &arg); 1.255 + efi_memmap_walk_type(EFI_MEMORY_MAPPED_IO_PORT_SPACE, 1.256 + dom_fw_dom0_passthrough, &arg); 1.257 } 1.258 else MAKE_MD(EFI_RESERVED_TYPE,0,0,0,0); 1.259 } 1.260 else { 1.261 +#ifndef CONFIG_XEN_IA64_DOM0_VP 1.262 MAKE_MD(EFI_LOADER_DATA,EFI_MEMORY_WB,0*MB,1*MB, 1); 1.263 +#endif 1.264 /* hypercall patches live here, masquerade as reserved PAL memory */ 1.265 MAKE_MD(EFI_PAL_CODE,EFI_MEMORY_WB,HYPERCALL_START,HYPERCALL_END, 1); 1.266 MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,HYPERCALL_END,maxmem, 1); 1.267 @@ -884,9 +993,12 @@ dom_fw_init (struct domain *d, const cha 1.268 MAKE_MD(EFI_RESERVED_TYPE,0,0,0,0); 1.269 } 1.270 1.271 + sort(efi_memmap, i, sizeof(efi_memory_desc_t), efi_mdt_cmp, NULL); 1.272 + 1.273 bp->efi_systab = dom_pa((unsigned long) fw_mem); 1.274 bp->efi_memmap = dom_pa((unsigned long) efi_memmap); 1.275 - bp->efi_memmap_size = NUM_MEM_DESCS*sizeof(efi_memory_desc_t); 1.276 + BUG_ON(i > NUM_MEM_DESCS); 1.277 + bp->efi_memmap_size = i * sizeof(efi_memory_desc_t); 1.278 bp->efi_memdesc_size = sizeof(efi_memory_desc_t); 1.279 bp->efi_memdesc_version = 1; 1.280 bp->command_line = dom_pa((unsigned long) cmd_line); 1.281 @@ -896,6 +1008,8 @@ dom_fw_init (struct domain *d, const cha 1.282 bp->console_info.orig_y = 24; 1.283 bp->fpswa = 0; 1.284 if (d == dom0) { 1.285 + // XXX CONFIG_XEN_IA64_DOM0_VP 1.286 + // initrd_start address is hard coded in start_kernel() 1.287 bp->initrd_start = (dom0_start+dom0_size) - 1.288 (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024); 1.289 bp->initrd_size = ia64_boot_param->initrd_size;
2.1 --- a/xen/arch/ia64/xen/domain.c Tue Apr 25 13:11:15 2006 -0600 2.2 +++ b/xen/arch/ia64/xen/domain.c Tue Apr 25 13:48:02 2006 -0600 2.3 @@ -1078,10 +1078,10 @@ static void loaddomainelfimage(struct do 2.4 2.5 void alloc_dom0(void) 2.6 { 2.7 + if (platform_is_hp_ski()) { 2.8 + dom0_size = 128*1024*1024; //FIXME: Should be configurable 2.9 + } 2.10 #ifdef CONFIG_DOMAIN0_CONTIGUOUS 2.11 - if (platform_is_hp_ski()) { 2.12 - dom0_size = 128*1024*1024; //FIXME: Should be configurable 2.13 - } 2.14 printf("alloc_dom0: starting (initializing %lu MB...)\n",dom0_size/(1024*1024)); 2.15 2.16 /* FIXME: The first trunk (say 256M) should always be assigned to 2.17 @@ -1098,6 +1098,8 @@ void alloc_dom0(void) 2.18 } 2.19 printf("alloc_dom0: dom0_start=0x%lx\n", dom0_start); 2.20 #else 2.21 + // no need to allocate pages for now 2.22 + // pages are allocated by map_new_domain_page() via loaddomainelfimage() 2.23 dom0_start = 0; 2.24 #endif 2.25 2.26 @@ -1128,6 +1130,7 @@ int construct_dom0(struct domain *d, 2.27 unsigned long alloc_start, alloc_end; 2.28 start_info_t *si; 2.29 struct vcpu *v = d->vcpu[0]; 2.30 + unsigned long max_pages; 2.31 2.32 struct domain_setup_info dsi; 2.33 unsigned long p_start; 2.34 @@ -1136,11 +1139,8 @@ int construct_dom0(struct domain *d, 2.35 unsigned long pkern_end; 2.36 unsigned long pinitrd_start = 0; 2.37 unsigned long pstart_info; 2.38 -#if 0 2.39 - char *dst; 2.40 - unsigned long nr_pt_pages; 2.41 - unsigned long count; 2.42 -#endif 2.43 + struct page_info *start_info_page; 2.44 + 2.45 #ifdef VALIDATE_VT 2.46 unsigned long mfn; 2.47 struct page_info *page = NULL; 2.48 @@ -1159,7 +1159,13 @@ int construct_dom0(struct domain *d, 2.49 2.50 alloc_start = dom0_start; 2.51 alloc_end = dom0_start + dom0_size; 2.52 - d->tot_pages = d->max_pages = dom0_size/PAGE_SIZE; 2.53 + max_pages = dom0_size / PAGE_SIZE; 2.54 + d->max_pages = max_pages; 2.55 +#ifndef CONFIG_XEN_IA64_DOM0_VP 2.56 + d->tot_pages = d->max_pages; 2.57 +#else 2.58 + d->tot_pages = 0; 2.59 +#endif 2.60 dsi.image_addr = (unsigned long)image_start; 2.61 dsi.image_len = image_len; 2.62 rc = parseelfimage(&dsi); 2.63 @@ -1196,15 +1202,27 @@ int construct_dom0(struct domain *d, 2.64 return -EINVAL; 2.65 } 2.66 2.67 - if(initrd_start&&initrd_len){ 2.68 - pinitrd_start=(dom0_start+dom0_size) - 2.69 - (PAGE_ALIGN(initrd_len) + 4*1024*1024); 2.70 + pstart_info = PAGE_ALIGN(pkern_end); 2.71 + if(initrd_start && initrd_len){ 2.72 + unsigned long offset; 2.73 + 2.74 + pinitrd_start= (dom0_start + dom0_size) - 2.75 + (PAGE_ALIGN(initrd_len) + 4*1024*1024); 2.76 + if (pinitrd_start <= pstart_info) 2.77 + panic("%s:enough memory is not assigned to dom0", __func__); 2.78 2.79 - memcpy(__va(pinitrd_start), (void *) initrd_start, initrd_len); 2.80 - pstart_info = PAGE_ALIGN(pinitrd_start + initrd_len); 2.81 - } else { 2.82 - pstart_info = PAGE_ALIGN(pkern_end); 2.83 - } 2.84 + for (offset = 0; offset < initrd_len; offset += PAGE_SIZE) { 2.85 + struct page_info *p; 2.86 + p = assign_new_domain_page(d, pinitrd_start + offset); 2.87 + if (p == NULL) 2.88 + panic("%s: can't allocate page for initrd image", __func__); 2.89 + if (initrd_len < offset + PAGE_SIZE) 2.90 + memcpy(page_to_virt(p), (void*)(initrd_start + offset), 2.91 + initrd_len - offset); 2.92 + else 2.93 + copy_page(page_to_virt(p), (void*)(initrd_start + offset)); 2.94 + } 2.95 + } 2.96 2.97 printk("METAPHYSICAL MEMORY ARRANGEMENT:\n" 2.98 " Kernel image: %lx->%lx\n" 2.99 @@ -1214,12 +1232,12 @@ int construct_dom0(struct domain *d, 2.100 pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len, 2.101 pstart_info, pstart_info + PAGE_SIZE); 2.102 2.103 - if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) ) 2.104 + if ( (pkern_end - pkern_start) > (max_pages * PAGE_SIZE) ) 2.105 { 2.106 printk("Initial guest OS requires too much space\n" 2.107 "(%luMB is greater than %luMB limit)\n", 2.108 (pkern_end-pkern_start)>>20, 2.109 - (unsigned long) (d->max_pages<<PAGE_SHIFT)>>20); 2.110 + (max_pages <<PAGE_SHIFT)>>20); 2.111 return -ENOMEM; 2.112 } 2.113 2.114 @@ -1228,13 +1246,6 @@ int construct_dom0(struct domain *d, 2.115 // if pkern end is after end of metaphysical memory, error 2.116 // (we should be able to deal with this... later) 2.117 2.118 - 2.119 - // 2.120 - 2.121 -#if 0 2.122 - strcpy(d->name,"Domain0"); 2.123 -#endif 2.124 - 2.125 /* Mask all upcalls... */ 2.126 for ( i = 1; i < MAX_VIRT_CPUS; i++ ) 2.127 d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1; 2.128 @@ -1251,7 +1262,7 @@ int construct_dom0(struct domain *d, 2.129 if (alloc_vcpu(d, i, i) == NULL) 2.130 printf ("Cannot allocate dom0 vcpu %d\n", i); 2.131 2.132 -#ifdef VALIDATE_VT 2.133 +#if defined(VALIDATE_VT) && !defined(CONFIG_XEN_IA64_DOM0_VP) 2.134 /* Construct a frame-allocation list for the initial domain, since these 2.135 * pages are allocated by boot allocator and pfns are not set properly 2.136 */ 2.137 @@ -1266,9 +1277,8 @@ int construct_dom0(struct domain *d, 2.138 list_add_tail(&page->list, &d->page_list); 2.139 2.140 /* Construct 1:1 mapping */ 2.141 - machine_to_phys_mapping[mfn] = mfn; 2.142 + set_gpfn_from_mfn(mfn, mfn); 2.143 } 2.144 - 2.145 #endif 2.146 2.147 /* Copy the OS image. */ 2.148 @@ -1281,41 +1291,14 @@ int construct_dom0(struct domain *d, 2.149 2.150 /* Set up start info area. */ 2.151 d->shared_info->arch.start_info_pfn = pstart_info >> PAGE_SHIFT; 2.152 - si = __va(pstart_info); 2.153 + start_info_page = assign_new_domain_page(d, pstart_info); 2.154 + if (start_info_page == NULL) 2.155 + panic("can't allocate start info page"); 2.156 + si = page_to_virt(start_info_page); 2.157 memset(si, 0, PAGE_SIZE); 2.158 sprintf(si->magic, "xen-%i.%i-ia64", XEN_VERSION, XEN_SUBVERSION); 2.159 - si->nr_pages = d->tot_pages; 2.160 - 2.161 -#if 0 2.162 - si->shared_info = virt_to_maddr(d->shared_info); 2.163 - si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN; 2.164 - //si->pt_base = vpt_start; 2.165 - //si->nr_pt_frames = nr_pt_pages; 2.166 - //si->mfn_list = vphysmap_start; 2.167 + si->nr_pages = max_pages; 2.168 2.169 - if ( initrd_len != 0 ) 2.170 - { 2.171 - //si->mod_start = vinitrd_start; 2.172 - si->mod_len = initrd_len; 2.173 - printk("Initrd len 0x%lx, start at 0x%08lx\n", 2.174 - si->mod_len, si->mod_start); 2.175 - } 2.176 - 2.177 - dst = si->cmd_line; 2.178 - if ( cmdline != NULL ) 2.179 - { 2.180 - for ( i = 0; i < 255; i++ ) 2.181 - { 2.182 - if ( cmdline[i] == '\0' ) 2.183 - break; 2.184 - *dst++ = cmdline[i]; 2.185 - } 2.186 - } 2.187 - *dst = '\0'; 2.188 - 2.189 - zap_low_mappings(); /* Do the same for the idle page tables. */ 2.190 -#endif 2.191 - 2.192 /* Give up the VGA console if DOM0 is configured to grab it. */ 2.193 if (cmdline != NULL) 2.194 console_endboot(strstr(cmdline, "tty0") != NULL); 2.195 @@ -1332,6 +1315,14 @@ int construct_dom0(struct domain *d, 2.196 new_thread(v, pkern_entry, 0, 0); 2.197 physdev_init_dom0(d); 2.198 2.199 + // dom0 doesn't need build_physmap_table() 2.200 + // see arch_set_info_guest() 2.201 + // instead we allocate pages manually. 2.202 + for (i = 0; i < max_pages; i++) { 2.203 + assign_new_domain0_page(d, i << PAGE_SHIFT); 2.204 + } 2.205 + d->arch.physmap_built = 1; 2.206 + 2.207 // FIXME: Hack for keyboard input 2.208 //serial_input_init(); 2.209
3.1 --- a/xen/arch/ia64/xen/xensetup.c Tue Apr 25 13:11:15 2006 -0600 3.2 +++ b/xen/arch/ia64/xen/xensetup.c Tue Apr 25 13:48:02 2006 -0600 3.3 @@ -294,11 +294,13 @@ void start_kernel(void) 3.4 max_page = 0; 3.5 efi_memmap_walk(find_max_pfn, &max_page); 3.6 printf("find_memory: efi_memmap_walk returns max_page=%lx\n",max_page); 3.7 +#ifndef CONFIG_XEN_IA64_DOM0_VP 3.8 /* this is a bad hack. see dom_fw.c creation of EFI map for dom0 */ 3.9 max_page = (GRANULEROUNDDOWN(max_page << PAGE_SHIFT) 3.10 - IA64_GRANULE_SIZE) >> PAGE_SHIFT; 3.11 printf("find_memory: last granule reserved for dom0; xen max_page=%lx\n", 3.12 max_page); 3.13 +#endif 3.14 efi_print(); 3.15 3.16 heap_start = memguard_init(ia64_imva(&_end));