direct-io.hg

changeset 10378:e32ddb4a90e6

[IA64] This patch fixes dom0 no VGA console bug.

After enabling dom0_vp mode, we lost the VGA console.
The reason is that VGA frame buffer(0xa0000-0xc0000) was set
to conventional memory not IO in dom0's p2m table.

Low conventional memory ranges are also given MDT entries for
dom0 to allow Linux to properly detect whether VGA is present.

Signed-off-by: Zhang xiantao <xiantao.zhang@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Mon Jun 05 14:21:37 2006 -0600 (2006-06-05)
parents 3f8523ce8895
children 279628dc2d6f
files xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/mm.c xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/xen/arch/ia64/xen/dom_fw.c	Sat Jun 03 16:06:23 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Mon Jun 05 14:21:37 2006 -0600
     1.3 @@ -760,6 +760,38 @@ dom_fw_dom0_passthrough(efi_memory_desc_
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +/*
     1.8 + * Create dom0 MDT entries for conventional memory below 1MB.  Without
     1.9 + * this Linux will assume VGA is present because 0xA0000 will always
    1.10 + * be either a hole in the MDT or an I/O region via the passthrough.
    1.11 + */
    1.12 +static int
    1.13 +dom_fw_dom0_lowmem(efi_memory_desc_t *md, void *arg__)
    1.14 +{
    1.15 +    struct dom0_passthrough_arg* arg = (struct dom0_passthrough_arg*)arg__;
    1.16 +    u64 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
    1.17 +
    1.18 +    BUG_ON(md->type != EFI_CONVENTIONAL_MEMORY);
    1.19 +
    1.20 +    if (md->phys_addr >= 1*MB)
    1.21 +        return 0;
    1.22 +
    1.23 +    if (end > 1*MB)
    1.24 +        end = 1*MB;
    1.25 +
    1.26 +    arg->md->type = md->type;
    1.27 +    arg->md->pad = 0;
    1.28 +    arg->md->phys_addr = md->phys_addr;
    1.29 +    arg->md->virt_addr = 0;
    1.30 +    arg->md->num_pages = (end - md->phys_addr) >> EFI_PAGE_SHIFT;
    1.31 +    arg->md->attribute = md->attribute;
    1.32 +    print_md(arg->md);
    1.33 +
    1.34 +    (*arg->i)++;
    1.35 +    arg->md++;
    1.36 +    return 0;
    1.37 +}
    1.38 +
    1.39  static int
    1.40  efi_mdt_cmp(const void *a, const void *b)
    1.41  {
    1.42 @@ -1051,6 +1083,8 @@ dom_fw_init (struct domain *d, const cha
    1.43  			                     dom_fw_dom0_passthrough, &arg);
    1.44  			efi_memmap_walk_type(EFI_MEMORY_MAPPED_IO_PORT_SPACE,
    1.45  			                     dom_fw_dom0_passthrough, &arg);
    1.46 +			efi_memmap_walk_type(EFI_CONVENTIONAL_MEMORY,
    1.47 +			                     dom_fw_dom0_lowmem, &arg);
    1.48  		}
    1.49  		else MAKE_MD(EFI_RESERVED_TYPE,0,0,0,0);
    1.50  
    1.51 @@ -1164,9 +1198,13 @@ dom_fw_init (struct domain *d, const cha
    1.52  				}
    1.53  			}
    1.54  		}
    1.55 -		// work around for legacy device driver.
    1.56 -		for (addr = 0; addr < 1 * MB; addr += PAGE_SIZE) {
    1.57 -			assign_new_domain0_page(d, addr);
    1.58 +		// Map low-memory holes & unmapped MMIO for legacy drivers
    1.59 +		for (addr = 0; addr < 1*MB; addr += PAGE_SIZE) {
    1.60 +			if (domain_page_mapped(d, addr))
    1.61 +				continue;
    1.62 +					
    1.63 +			if (efi_mmio(addr, PAGE_SIZE))
    1.64 +				assign_domain_mmio_page(d, addr, PAGE_SIZE);
    1.65  		}
    1.66  		d->arch.physmap_built = 1;
    1.67  	}
     2.1 --- a/xen/arch/ia64/xen/mm.c	Sat Jun 03 16:06:23 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/mm.c	Mon Jun 05 14:21:37 2006 -0600
     2.3 @@ -579,7 +579,7 @@ assign_domain_same_page(struct domain *d
     2.4      }
     2.5  }
     2.6  
     2.7 -static int
     2.8 +int
     2.9  efi_mmio(unsigned long physaddr, unsigned long size)
    2.10  {
    2.11      void *efi_map_start, *efi_map_end;
    2.12 @@ -968,6 +968,17 @@ domain_page_flush(struct domain* d, unsi
    2.13  {
    2.14      domain_flush_vtlb_all();
    2.15  }
    2.16 +
    2.17 +int
    2.18 +domain_page_mapped(struct domain* d, unsigned long mpaddr)
    2.19 +{
    2.20 +    pte_t * pte;
    2.21 +
    2.22 +    pte=lookup_noalloc_domain_pte(d, mpaddr);
    2.23 +    if(!pte_none(*pte))
    2.24 +       return 1;
    2.25 +    return 0;
    2.26 +}
    2.27  #endif
    2.28  
    2.29  /* Flush cache of domain d.  */
     3.1 --- a/xen/include/asm-ia64/mm.h	Sat Jun 03 16:06:23 2006 -0600
     3.2 +++ b/xen/include/asm-ia64/mm.h	Mon Jun 05 14:21:37 2006 -0600
     3.3 @@ -433,6 +433,8 @@ extern unsigned long lookup_domain_mpa(s
     3.4  #ifdef CONFIG_XEN_IA64_DOM0_VP
     3.5  extern unsigned long assign_domain_mmio_page(struct domain *d, unsigned long mpaddr, unsigned long size);
     3.6  extern unsigned long assign_domain_mach_page(struct domain *d, unsigned long mpaddr, unsigned long size, unsigned long flags);
     3.7 +int domain_page_mapped(struct domain *d, unsigned long mpaddr);
     3.8 +int efi_mmio(unsigned long physaddr, unsigned long size);
     3.9  extern unsigned long __lookup_domain_mpa(struct domain *d, unsigned long mpaddr);
    3.10  extern unsigned long ____lookup_domain_mpa(struct domain *d, unsigned long mpaddr);
    3.11  extern unsigned long do_dom0vp_op(unsigned long cmd, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3);