Skip to content

Commit

Permalink
x86: PAT: add pgprot_writecombine() interface for drivers - v3
Browse files Browse the repository at this point in the history
Impact: New mm functionality.

Add pgprot_writecombine. pgprot_writecombine will be aliased to
pgprot_noncached when not supported by the architecture.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
venkatesh.pallipadi@intel.com authored and H. Peter Anvin committed Dec 18, 2008
1 parent 8a7b12f commit 2520bd3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@

#ifndef __ASSEMBLY__

#define pgprot_writecombine pgprot_writecombine
extern pgprot_t pgprot_writecombine(pgprot_t prot);

/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
Expand Down
8 changes: 8 additions & 0 deletions arch/x86/mm/pat.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,14 @@ void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
}
}

pgprot_t pgprot_writecombine(pgprot_t prot)
{
if (pat_enabled)
return __pgprot(pgprot_val(prot) | _PAGE_CACHE_WC);
else
return pgprot_noncached(prot);
}

#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT)

/* get Nth element of the linked list */
Expand Down
4 changes: 4 additions & 0 deletions include/asm-generic/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
#define move_pte(pte, prot, old_addr, new_addr) (pte)
#endif

#ifndef pgprot_writecombine
#define pgprot_writecombine pgprot_noncached
#endif

/*
* When walking page tables, get the address of the next boundary,
* or the end address of the range if that comes earlier. Although no
Expand Down

0 comments on commit 2520bd3

Please sign in to comment.