direct-io.hg

changeset 15508:ecb89c6ce615

Remove no-pv-compat cmdline option.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Jul 09 14:06:22 2007 +0100 (2007-07-09)
parents 231bfe08fdbf
children 646ec1f2b41f
files xen/arch/x86/domain.c xen/arch/x86/e820.c xen/arch/x86/x86_64/mm.c xen/common/compat/kernel.c xen/include/asm-x86/mm.h xen/include/xen/compat.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Mon Jul 09 12:04:20 2007 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Mon Jul 09 14:06:22 2007 +0100
     1.3 @@ -308,8 +308,6 @@ int switch_compat(struct domain *d)
     1.4  
     1.5      if ( d == NULL )
     1.6          return -EINVAL;
     1.7 -    if ( compat_disabled )
     1.8 -        return -ENOSYS;
     1.9      if ( !may_switch_mode(d) )
    1.10          return -EACCES;
    1.11      if ( is_pv_32on64_domain(d) )
     2.1 --- a/xen/arch/x86/e820.c	Mon Jul 09 12:04:20 2007 +0100
     2.2 +++ b/xen/arch/x86/e820.c	Mon Jul 09 14:06:22 2007 +0100
     2.3 @@ -342,39 +342,6 @@ static void __init clip_4gb(void)
     2.4  #define clip_4gb() ((void)0)
     2.5  #endif
     2.6  
     2.7 -#ifdef CONFIG_COMPAT
     2.8 -static void __init clip_compat(void)
     2.9 -{
    2.10 -    unsigned long long limit;
    2.11 -    unsigned int i;
    2.12 -
    2.13 -    if ( compat_disabled )
    2.14 -        return;
    2.15 -    /* 32-bit guests restricted to 166 GB (with current memory allocator). */
    2.16 -    limit = (unsigned long long)(MACH2PHYS_COMPAT_VIRT_END -
    2.17 -                                 __HYPERVISOR_COMPAT_VIRT_START) << 10;
    2.18 -    for ( i = 0; i < e820.nr_map; i++ )
    2.19 -    {
    2.20 -        if ( (e820.map[i].addr + e820.map[i].size) <= limit )
    2.21 -            continue;
    2.22 -        printk("WARNING: Only the first %Lu GB of the physical memory map "
    2.23 -               "can be accessed\n"
    2.24 -               "         by compatibility mode guests. "
    2.25 -               "Truncating the memory map...\n",
    2.26 -	       limit >> 30);
    2.27 -        if ( e820.map[i].addr >= limit )
    2.28 -            e820.nr_map = i;
    2.29 -        else
    2.30 -        {
    2.31 -            e820.map[i].size = limit - e820.map[i].addr;
    2.32 -            e820.nr_map = i + 1;
    2.33 -        }
    2.34 -    }
    2.35 -}
    2.36 -#else
    2.37 -#define clip_compat() ((void)0)
    2.38 -#endif
    2.39 -
    2.40  static void __init clip_mem(void)
    2.41  {
    2.42      int i;
    2.43 @@ -408,7 +375,6 @@ static void __init machine_specific_memo
    2.44      *raw_nr = nr;
    2.45      (void)copy_e820_map(raw, nr);
    2.46      clip_4gb();
    2.47 -    clip_compat();
    2.48      clip_mem();
    2.49  }
    2.50  
     3.1 --- a/xen/arch/x86/x86_64/mm.c	Mon Jul 09 12:04:20 2007 +0100
     3.2 +++ b/xen/arch/x86/x86_64/mm.c	Mon Jul 09 14:06:22 2007 +0100
     3.3 @@ -145,47 +145,42 @@ void __init paging_init(void)
     3.4          l2_ro_mpt++;
     3.5      }
     3.6  
     3.7 -#ifdef CONFIG_COMPAT
     3.8 -    if ( !compat_disabled )
     3.9 +    /* Create user-accessible L2 directory to map the MPT for compat guests. */
    3.10 +    BUILD_BUG_ON(l4_table_offset(RDWR_MPT_VIRT_START) !=
    3.11 +                 l4_table_offset(HIRO_COMPAT_MPT_VIRT_START));
    3.12 +    l3_ro_mpt = l4e_to_l3e(idle_pg_table[l4_table_offset(
    3.13 +        HIRO_COMPAT_MPT_VIRT_START)]);
    3.14 +    if ( (l2_pg = alloc_domheap_page(NULL)) == NULL )
    3.15 +        goto nomem;
    3.16 +    compat_idle_pg_table_l2 = l2_ro_mpt = page_to_virt(l2_pg);
    3.17 +    clear_page(l2_ro_mpt);
    3.18 +    l3e_write(&l3_ro_mpt[l3_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
    3.19 +              l3e_from_page(l2_pg, __PAGE_HYPERVISOR));
    3.20 +    l2_ro_mpt += l2_table_offset(HIRO_COMPAT_MPT_VIRT_START);
    3.21 +    /* Allocate and map the compatibility mode machine-to-phys table. */
    3.22 +    mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1));
    3.23 +    if ( mpt_size > RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START )
    3.24 +        mpt_size = RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START;
    3.25 +    mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
    3.26 +    if ( m2p_compat_vstart + mpt_size < MACH2PHYS_COMPAT_VIRT_END )
    3.27 +        m2p_compat_vstart = MACH2PHYS_COMPAT_VIRT_END - mpt_size;
    3.28 +    for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
    3.29      {
    3.30 -        /* Create user-accessible L2 directory to map the MPT for compatibility guests. */
    3.31 -        BUILD_BUG_ON(l4_table_offset(RDWR_MPT_VIRT_START) !=
    3.32 -                     l4_table_offset(HIRO_COMPAT_MPT_VIRT_START));
    3.33 -        l3_ro_mpt = l4e_to_l3e(idle_pg_table[l4_table_offset(HIRO_COMPAT_MPT_VIRT_START)]);
    3.34 -        if ( (l2_pg = alloc_domheap_page(NULL)) == NULL )
    3.35 +        if ( (l1_pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER, 0)) == NULL )
    3.36              goto nomem;
    3.37 -        compat_idle_pg_table_l2 = l2_ro_mpt = page_to_virt(l2_pg);
    3.38 -        clear_page(l2_ro_mpt);
    3.39 -        l3e_write(&l3_ro_mpt[l3_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
    3.40 -                  l3e_from_page(l2_pg, __PAGE_HYPERVISOR));
    3.41 -        l2_ro_mpt += l2_table_offset(HIRO_COMPAT_MPT_VIRT_START);
    3.42 -        /*
    3.43 -         * Allocate and map the compatibility mode machine-to-phys table.
    3.44 -        */
    3.45 -        mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1));
    3.46 -        if ( mpt_size > RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START )
    3.47 -            mpt_size = RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START;
    3.48 -        mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
    3.49 -        if ( m2p_compat_vstart + mpt_size < MACH2PHYS_COMPAT_VIRT_END )
    3.50 -            m2p_compat_vstart = MACH2PHYS_COMPAT_VIRT_END - mpt_size;
    3.51 -        for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
    3.52 -        {
    3.53 -            if ( (l1_pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER, 0)) == NULL )
    3.54 -                goto nomem;
    3.55 -            map_pages_to_xen(
    3.56 -                RDWR_COMPAT_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT),
    3.57 -                page_to_mfn(l1_pg),
    3.58 -                1UL << PAGETABLE_ORDER,
    3.59 -                PAGE_HYPERVISOR);
    3.60 -            memset((void *)(RDWR_COMPAT_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT)),
    3.61 -                   0x55,
    3.62 -                   1UL << L2_PAGETABLE_SHIFT);
    3.63 -            /* NB. Cannot be GLOBAL as the pt entries get copied into per-VM space. */
    3.64 -            l2e_write(l2_ro_mpt, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT));
    3.65 -            l2_ro_mpt++;
    3.66 -        }
    3.67 +        map_pages_to_xen(
    3.68 +            RDWR_COMPAT_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT),
    3.69 +            page_to_mfn(l1_pg),
    3.70 +            1UL << PAGETABLE_ORDER,
    3.71 +            PAGE_HYPERVISOR);
    3.72 +        memset((void *)(RDWR_COMPAT_MPT_VIRT_START +
    3.73 +                        (i << L2_PAGETABLE_SHIFT)),
    3.74 +               0x55,
    3.75 +               1UL << L2_PAGETABLE_SHIFT);
    3.76 +        /* NB. Cannot be GLOBAL as the ptes get copied into per-VM space. */
    3.77 +        l2e_write(l2_ro_mpt, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT));
    3.78 +        l2_ro_mpt++;
    3.79      }
    3.80 -#endif
    3.81  
    3.82      /* Set up linear page table mapping. */
    3.83      l4e_write(&idle_pg_table[l4_table_offset(LINEAR_PT_VIRT_START)],
    3.84 @@ -255,30 +250,26 @@ void __init subarch_init_memory(void)
    3.85              share_xen_page_with_privileged_guests(page, XENSHARE_readonly);
    3.86          }
    3.87      }
    3.88 -#ifdef CONFIG_COMPAT
    3.89 -    if ( !compat_disabled )
    3.90 +
    3.91 +    for ( v  = RDWR_COMPAT_MPT_VIRT_START;
    3.92 +          v != RDWR_COMPAT_MPT_VIRT_END;
    3.93 +          v += 1 << L2_PAGETABLE_SHIFT )
    3.94      {
    3.95 -        for ( v  = RDWR_COMPAT_MPT_VIRT_START;
    3.96 -              v != RDWR_COMPAT_MPT_VIRT_END;
    3.97 -              v += 1 << L2_PAGETABLE_SHIFT )
    3.98 +        l3e = l4e_to_l3e(idle_pg_table[l4_table_offset(v)])[
    3.99 +            l3_table_offset(v)];
   3.100 +        if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
   3.101 +            continue;
   3.102 +        l2e = l3e_to_l2e(l3e)[l2_table_offset(v)];
   3.103 +        if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
   3.104 +            continue;
   3.105 +        m2p_start_mfn = l2e_get_pfn(l2e);
   3.106 +
   3.107 +        for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
   3.108          {
   3.109 -            l3e = l4e_to_l3e(idle_pg_table[l4_table_offset(v)])[
   3.110 -                l3_table_offset(v)];
   3.111 -            if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) )
   3.112 -                continue;
   3.113 -            l2e = l3e_to_l2e(l3e)[l2_table_offset(v)];
   3.114 -            if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
   3.115 -                continue;
   3.116 -            m2p_start_mfn = l2e_get_pfn(l2e);
   3.117 -
   3.118 -            for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
   3.119 -            {
   3.120 -                struct page_info *page = mfn_to_page(m2p_start_mfn + i);
   3.121 -                share_xen_page_with_privileged_guests(page, XENSHARE_readonly);
   3.122 -            }
   3.123 +            struct page_info *page = mfn_to_page(m2p_start_mfn + i);
   3.124 +            share_xen_page_with_privileged_guests(page, XENSHARE_readonly);
   3.125          }
   3.126      }
   3.127 -#endif
   3.128  }
   3.129  
   3.130  long subarch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
     4.1 --- a/xen/common/compat/kernel.c	Mon Jul 09 12:04:20 2007 +0100
     4.2 +++ b/xen/common/compat/kernel.c	Mon Jul 09 14:06:22 2007 +0100
     4.3 @@ -45,9 +45,6 @@ CHECK_TYPE(domain_handle);
     4.4  
     4.5  #include "../kernel.c"
     4.6  
     4.7 -int compat_disabled = 0;
     4.8 -boolean_param("no-pv-compat", compat_disabled);
     4.9 -
    4.10  /*
    4.11   * Local variables:
    4.12   * mode: C
     5.1 --- a/xen/include/asm-x86/mm.h	Mon Jul 09 12:04:20 2007 +0100
     5.2 +++ b/xen/include/asm-x86/mm.h	Mon Jul 09 14:06:22 2007 +0100
     5.3 @@ -315,8 +315,7 @@ TYPE_SAFE(unsigned long,mfn);
     5.4  #ifdef CONFIG_COMPAT
     5.5  #define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START)
     5.6  #define set_gpfn_from_mfn(mfn, pfn) \
     5.7 -    ((void)(compat_disabled || \
     5.8 -            (mfn) >= (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) / 4 || \
     5.9 +    ((void)((mfn) >= (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) / 4 || \
    5.10              (compat_machine_to_phys_mapping[(mfn)] = (unsigned int)(pfn))), \
    5.11       machine_to_phys_mapping[(mfn)] = (pfn))
    5.12  #else
     6.1 --- a/xen/include/xen/compat.h	Mon Jul 09 12:04:20 2007 +0100
     6.2 +++ b/xen/include/xen/compat.h	Mon Jul 09 14:06:22 2007 +0100
     6.3 @@ -165,8 +165,6 @@
     6.4                  [1 - (&((k xen_ ## n *)0)->f1.f2.f3 != \
     6.5                     &((k compat_ ## n *)0)->f1.f2.f3) * 2]
     6.6  
     6.7 -extern int compat_disabled;
     6.8 -
     6.9  int hypercall_xlat_continuation(unsigned int *id, unsigned int mask, ...);
    6.10  
    6.11  /* In-place translation functons: */