aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2012-10-08 19:28:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:22:16 -0400
commit5180da410db6369d1f95c9014da1c9bc33fb043e (patch)
tree1d92975710b33a90f77f39d0ad33669329dea949 /include
parentb1a86e15dc0304366f50ba1720834bc419c801b1 (diff)
x86, pat: separate the pfn attribute tracking for remap_pfn_range and vm_insert_pfn
With PAT enabled, vm_insert_pfn() looks up the existing pfn memory attribute and uses it. Expectation is that the driver reserves the memory attributes for the pfn before calling vm_insert_pfn(). remap_pfn_range() (when called for the whole vma) will setup a new attribute (based on the prot argument) for the specified pfn range. This addresses the legacy usage which typically calls remap_pfn_range() with a desired memory attribute. For ranges smaller than the vma size (which is typically not the case), remap_pfn_range() will use the existing memory attribute for the pfn range. Expose two different API's for these different behaviors. track_pfn_insert() for tracking the pfn attribute set by vm_insert_pfn() and track_pfn_remap() for the remap_pfn_range(). This cleanup also prepares the ground for the track/untrack pfn vma routines to take over the ownership of setting PAT specific vm_flag in the 'vma'. [khlebnikov@openvz.org: Clear checks in track_pfn_remap()] [akpm@linux-foundation.org: tweak a few comments] Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Venkatesh Pallipadi <venki@google.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Ingo Molnar <mingo@redhat.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Carsten Otte <cotte@de.ibm.com> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Eric Paris <eparis@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: James Morris <james.l.morris@oracle.com> Cc: Jason Baron <jbaron@redhat.com> Cc: Kentaro Takeda <takedakn@nttdata.co.jp> Cc: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Matt Helsley <matthltc@us.ibm.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/pgtable.h55
1 files changed, 32 insertions, 23 deletions
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index ff4947b7a976..d4d4592c97fc 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -381,48 +381,57 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
381 381
382#ifndef __HAVE_PFNMAP_TRACKING 382#ifndef __HAVE_PFNMAP_TRACKING
383/* 383/*
384 * Interface that can be used by architecture code to keep track of 384 * Interfaces that can be used by architecture code to keep track of
385 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn) 385 * memory type of pfn mappings specified by the remap_pfn_range,
386 * 386 * vm_insert_pfn.
387 * track_pfn_vma_new is called when a _new_ pfn mapping is being established 387 */
388 * for physical range indicated by pfn and size. 388
389/*
390 * track_pfn_remap is called when a _new_ pfn mapping is being established
391 * by remap_pfn_range() for physical range indicated by pfn and size.
389 */ 392 */
390static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, 393static inline int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
391 unsigned long pfn, unsigned long size) 394 unsigned long pfn, unsigned long size)
392{ 395{
393 return 0; 396 return 0;
394} 397}
395 398
396/* 399/*
397 * Interface that can be used by architecture code to keep track of 400 * track_pfn_insert is called when a _new_ single pfn is established
398 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn) 401 * by vm_insert_pfn().
399 * 402 */
400 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets 403static inline int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
404 unsigned long pfn)
405{
406 return 0;
407}
408
409/*
410 * track_pfn_copy is called when vma that is covering the pfnmap gets
401 * copied through copy_page_range(). 411 * copied through copy_page_range().
402 */ 412 */
403static inline int track_pfn_vma_copy(struct vm_area_struct *vma) 413static inline int track_pfn_copy(struct vm_area_struct *vma)
404{ 414{
405 return 0; 415 return 0;
406} 416}
407 417
408/* 418/*
409 * Interface that can be used by architecture code to keep track of
410 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
411 *
412 * untrack_pfn_vma is called while unmapping a pfnmap for a region. 419 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
413 * untrack can be called for a specific region indicated by pfn and size or 420 * untrack can be called for a specific region indicated by pfn and size or
414 * can be for the entire vma (in which case size can be zero). 421 * can be for the entire vma (in which case pfn, size are zero).
415 */ 422 */
416static inline void untrack_pfn_vma(struct vm_area_struct *vma, 423static inline void untrack_pfn(struct vm_area_struct *vma,
417 unsigned long pfn, unsigned long size) 424 unsigned long pfn, unsigned long size)
418{ 425{
419} 426}
420#else 427#else
421extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, 428extern int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
422 unsigned long pfn, unsigned long size); 429 unsigned long pfn, unsigned long size);
423extern int track_pfn_vma_copy(struct vm_area_struct *vma); 430extern int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
424extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, 431 unsigned long pfn);
425 unsigned long size); 432extern int track_pfn_copy(struct vm_area_struct *vma);
433extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
434 unsigned long size);
426#endif 435#endif
427 436
428#ifdef CONFIG_MMU 437#ifdef CONFIG_MMU