Hi Alex, The updated patch should be happy for all platforms. If EFI doesn't provide md for range(0xa0000-0xc0000) to OS. It maybe a hole or occupied by legacy vga. Therefore, I used the efi_mmio function to check it. If these pages was not mapped yet and efi_mmio return true, we can map them as MMIO safely. BTW, this patch based on Yamahata's check memory descriptor overlap patch. Please give comments. :) Thanks -Xiantao
> -----Original Message----- > From: Alex Williamson [mailto:[EMAIL PROTECTED] > Sent: 2006年6月1日 10:11 > To: Zhang, Xiantao > Cc: xen-ia64-devel@lists.xensource.com > Subject: RE: [Xen-ia64-devel] [PATCH]Fix domain0 no VGA console bug. > > On Thu, 2006-06-01 at 09:45 +0800, Zhang, Xiantao wrote: > > Hi Alex, > > We are using tiger4 platform. I didn't find md about space: > > 0xa0000-0xc0000 in efi memmap, maybe it was assumed > > EFI_MEMORY_MAPPED_IO in native OS. But dom_fw_init shouldn't neglect > > it to set IO space according to MDs efi provides. Seems your platform > > has VGA console. So this patch can enable VGA console on all platforms > > explicitly, maybe as you said this step is better to do in > > dom_fw_init :) > > Hi Xiantao, > > One of my test systems has VGA, the other does not. We cannot assume > VGA in the system. If the MDT on the tiger4 doesn't describe that > range, then we probably need to at least revert to the test the Linux > kernel uses and test whether that range has a WB memory attribute before > assuming it's VGA. Also, try not to double map the range for platforms > that do describe this as type EFI_MEMORY_MAPPED_IO. Thanks, > > Alex > > -- > Alex Williamson HP Open Source & Linux Org.
xen0_console.patch
Description: xen0_console.patch
--- Begin Message ---This patch tries to check MD's overlap and tries not to assign page to non conventional area. Maybe you may want to apply this patch before VGA-related modifications. On Wed, May 31, 2006 at 08:10:42PM -0600, Alex Williamson wrote: > On Thu, 2006-06-01 at 09:45 +0800, Zhang, Xiantao wrote: > > Hi Alex, > > We are using tiger4 platform. I didn't find md about space: > > 0xa0000-0xc0000 in efi memmap, maybe it was assumed > > EFI_MEMORY_MAPPED_IO in native OS. But dom_fw_init shouldn't neglect > > it to set IO space according to MDs efi provides. Seems your platform > > has VGA console. So this patch can enable VGA console on all platforms > > explicitly, maybe as you said this step is better to do in > > dom_fw_init :) > > Hi Xiantao, > > One of my test systems has VGA, the other does not. We cannot assume > VGA in the system. If the MDT on the tiger4 doesn't describe that > range, then we probably need to at least revert to the test the Linux > kernel uses and test whether that range has a WB memory attribute before > assuming it's VGA. Also, try not to double map the range for platforms > that do describe this as type EFI_MEMORY_MAPPED_IO. Thanks, > > Alex > > -- > Alex Williamson HP Open Source & Linux Org. > > > _______________________________________________ > Xen-ia64-devel mailing list > Xen-ia64-devel@lists.xensource.com > http://lists.xensource.com/xen-ia64-devel > -- yamahata# HG changeset patch # User [EMAIL PROTECTED] # Node ID e3e02e227b3e8d97537c38d5cdba9959bdd05d6a # Parent f6774d15d763fead75e6320e63fa1f14fabab26a check memory descriptor over lap in dom_fw_init() and assign page to dom0 precisely. PATCHNAME: assign_page_to_dom0_precisely Signed-off-by: Isaku Yamahata <[EMAIL PROTECTED]> diff -r f6774d15d763 -r e3e02e227b3e xen/arch/ia64/xen/dom_fw.c --- a/xen/arch/ia64/xen/dom_fw.c Thu Jun 01 11:39:04 2006 +0900 +++ b/xen/arch/ia64/xen/dom_fw.c Thu Jun 01 11:39:06 2006 +0900 @@ -1017,11 +1017,16 @@ dom_fw_init (struct domain *d, const cha /* simulate 1MB free memory at physical address zero */ MAKE_MD(EFI_LOADER_DATA,EFI_MEMORY_WB,0*MB,1*MB, 0);//XXX +#else + int num_mds; + int j; #endif /* hypercall patches live here, masquerade as reserved PAL memory */ MAKE_MD(EFI_PAL_CODE,EFI_MEMORY_WB|EFI_MEMORY_RUNTIME,HYPERCALL_START,HYPERCALL_END, 0); + + +#ifndef CONFIG_XEN_IA64_DOM0_VP 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. -#ifndef CONFIG_XEN_IA64_DOM0_VP /* hack */ MAKE_MD(EFI_CONVENTIONAL_MEMORY,EFI_MEMORY_WB,last_start,last_end,1); #endif @@ -1054,6 +1059,52 @@ dom_fw_init (struct domain *d, const cha dom_fw_dom0_passthrough, &arg); } else MAKE_MD(EFI_RESERVED_TYPE,0,0,0,0); + +#ifdef CONFIG_XEN_IA64_DOM0_VP + // simple + // MAKE_MD(EFI_CONVENTIONAL_MEMORY, EFI_MEMORY_WB, + // HYPERCALL_END, maxmem, 0); + // is not good. Check overlap. + sort(efi_memmap, i, sizeof(efi_memory_desc_t), efi_mdt_cmp, NULL); + + num_mds = i; + for (j = 0; j < num_mds; j++) { + unsigned long start; + unsigned long end; + unsigned long next_start; + int k; + + md = &efi_memmap[j]; + start = md->phys_addr; + end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); + + if (maxmem < start) + break; + + // find gap + next_start = maxmem; + for (k = j + 1; k < num_mds; k++) { + efi_memory_desc_t* next_md = &efi_memmap[k]; + + if (end != next_md->phys_addr) { + next_start = next_md->phys_addr; + break; + } + end = next_md->phys_addr + + (next_md->num_pages << EFI_PAGE_SHIFT); + } + + if (next_start < HYPERCALL_END) + continue; + + if (end < HYPERCALL_END) + end = HYPERCALL_END; + if (next_start > maxmem) + next_start = maxmem; + MAKE_MD(EFI_CONVENTIONAL_MEMORY, EFI_MEMORY_WB, + end, next_start, 0); + } +#endif } else { #ifndef CONFIG_XEN_IA64_DOM0_VP @@ -1084,11 +1135,45 @@ dom_fw_init (struct domain *d, const cha bp->console_info.orig_y = 24; bp->fpswa = dom_pa((unsigned long) fpswa_inf); if (d == dom0) { + int j; + u64 addr; + // XXX CONFIG_XEN_IA64_DOM0_VP - // initrd_start address is hard coded in start_kernel() + // initrd_start address is hard coded in construct_dom0() bp->initrd_start = (dom0_start+dom0_size) - (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024); bp->initrd_size = ia64_boot_param->initrd_size; + + // dom0 doesn't need build_physmap_table() + // see arch_set_info_guest() + // instead we allocate pages manually. + for (j = 0; j < i; j++) { + md = &efi_memmap[j]; + if (md->phys_addr > maxmem) + break; + + if (md->type == EFI_LOADER_DATA || + md->type == EFI_PAL_CODE || + md->type == EFI_CONVENTIONAL_MEMORY) { + unsigned long start = (md->phys_addr & PAGE_MASK); + unsigned long end = md->phys_addr + + (md->num_pages << EFI_PAGE_SHIFT); + + if (end == start) + end += PAGE_SIZE;// md->num_pages = 0 is allowed. + if (end > (max_page << PAGE_SHIFT)) + end = (max_page << PAGE_SHIFT); + + for (addr = start; addr < end; addr += PAGE_SIZE) { + assign_new_domain0_page(d, addr); + } + } + } + // work around for legacy device driver. + for (addr = 0; addr < 1 * MB; addr += PAGE_SIZE) { + assign_new_domain0_page(d, addr); + } + d->arch.physmap_built = 1; } else { bp->initrd_start = d->arch.initrd_start; diff -r f6774d15d763 -r e3e02e227b3e xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Thu Jun 01 11:39:04 2006 +0900 +++ b/xen/arch/ia64/xen/domain.c Thu Jun 01 11:39:06 2006 +0900 @@ -1882,14 +1882,6 @@ int construct_dom0(struct domain *d, new_thread(v, pkern_entry, 0, 0); physdev_init_dom0(d); - // dom0 doesn't need build_physmap_table() - // see arch_set_info_guest() - // instead we allocate pages manually. - for (i = 0; i < max_pages; i++) { - assign_new_domain0_page(d, i << PAGE_SHIFT); - } - d->arch.physmap_built = 1; - // FIXME: Hack for keyboard input //serial_input_init();
--- End Message ---
_______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel