ia64/xen-unstable

changeset 18769:6bd021d987d7

x86: allow grant table originating ptes to have their guest available
bits set.

In order to allow 2.6.27's get_user_pages_fast() to correctly detect
granted pages (so they would be passed to get_user_pages()), it must
be possible to tell the grant table code in Xen to set the three
available bits in the pte-s it creates.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Nov 04 11:46:00 2008 +0000 (2008-11-04)
parents 43a079fd50fd
children 4bfc67b09e9c
files xen/arch/x86/mm.c xen/common/kernel.c xen/include/public/features.h xen/include/public/grant_table.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Mon Nov 03 13:36:24 2008 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Tue Nov 04 11:46:00 2008 +0000
     1.3 @@ -3332,6 +3332,10 @@ int create_grant_host_mapping(uint64_t a
     1.4      if ( !(flags & GNTMAP_readonly) )
     1.5          l1e_add_flags(pte,_PAGE_RW);
     1.6  
     1.7 +    l1e_add_flags(pte,
     1.8 +                  ((flags >> _GNTMAP_guest_avail0) * _PAGE_AVAIL0)
     1.9 +                   & _PAGE_AVAIL);
    1.10 +
    1.11      l1e_add_flags(pte, cacheattr_to_pte_flags(cache_flags >> 5));
    1.12  
    1.13      if ( flags & GNTMAP_contains_pte )
     2.1 --- a/xen/common/kernel.c	Mon Nov 03 13:36:24 2008 +0000
     2.2 +++ b/xen/common/kernel.c	Tue Nov 04 11:46:00 2008 +0000
     2.3 @@ -222,7 +222,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
     2.4  #ifdef CONFIG_X86
     2.5              if ( !is_hvm_vcpu(current) )
     2.6                  fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
     2.7 -                             (1U << XENFEAT_highmem_assist);
     2.8 +                             (1U << XENFEAT_highmem_assist) |
     2.9 +                             (1U << XENFEAT_gnttab_map_avail_bits);
    2.10  #endif
    2.11              break;
    2.12          default:
     3.1 --- a/xen/include/public/features.h	Mon Nov 03 13:36:24 2008 +0000
     3.2 +++ b/xen/include/public/features.h	Tue Nov 04 11:46:00 2008 +0000
     3.3 @@ -62,6 +62,12 @@
     3.4  /* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */
     3.5  #define XENFEAT_highmem_assist             6
     3.6  
     3.7 +/*
     3.8 + * If set, GNTTABOP_map_grant_ref honors flags to be placed into guest kernel
     3.9 + * available pte bits.
    3.10 + */
    3.11 +#define XENFEAT_gnttab_map_avail_bits      7
    3.12 +
    3.13  #define XENFEAT_NR_SUBMAPS 1
    3.14  
    3.15  #endif /* __XEN_PUBLIC_FEATURES_H__ */
     4.1 --- a/xen/include/public/grant_table.h	Mon Nov 03 13:36:24 2008 +0000
     4.2 +++ b/xen/include/public/grant_table.h	Tue Nov 04 11:46:00 2008 +0000
     4.3 @@ -360,7 +360,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and
     4.4  
     4.5  
     4.6  /*
     4.7 - * Bitfield values for update_pin_status.flags.
     4.8 + * Bitfield values for gnttab_map_grant_ref.flags.
     4.9   */
    4.10   /* Map the grant entry for access by I/O devices. */
    4.11  #define _GNTMAP_device_map      (0)
    4.12 @@ -388,6 +388,13 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and
    4.13  #define GNTMAP_contains_pte     (1<<_GNTMAP_contains_pte)
    4.14  
    4.15  /*
    4.16 + * Bits to be placed in guest kernel available PTE bits (architecture
    4.17 + * dependent; only supported when XENFEAT_gnttab_map_avail_bits is set).
    4.18 + */
    4.19 +#define _GNTMAP_guest_avail0    (16)
    4.20 +#define GNTMAP_guest_avail_mask ((uint32_t)~0 << _GNTMAP_guest_avail0)
    4.21 +
    4.22 +/*
    4.23   * Values for error status returns. All errors are -ve.
    4.24   */
    4.25  #define GNTST_okay             (0)  /* Normal return.                        */