Skip to content

Commit

Permalink
x86: PAT add set_memory_wc() interface
Browse files Browse the repository at this point in the history
Add a set_memory_wc interface(), similar to set_memory_uc interface.
Callers has to call set_memory_uc, set_memory_wb and
set_memory_wc, set_memory_wb as pairs.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
venkatesh.pallipadi@intel.com authored and Ingo Molnar committed Apr 17, 2008
1 parent 03d72aa commit ef354af
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,25 @@ int set_memory_uc(unsigned long addr, int numpages)
}
EXPORT_SYMBOL(set_memory_uc);

int _set_memory_wc(unsigned long addr, int numpages)
{
return change_page_attr_set(addr, numpages,
__pgprot(_PAGE_CACHE_WC));
}

int set_memory_wc(unsigned long addr, int numpages)
{
if (!pat_wc_enabled)
return set_memory_uc(addr, numpages);

if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
_PAGE_CACHE_WC, NULL))
return -EINVAL;

return _set_memory_wc(addr, numpages);
}
EXPORT_SYMBOL(set_memory_wc);

int _set_memory_wb(unsigned long addr, int numpages)
{
return change_page_attr_clear(addr, numpages,
Expand Down
2 changes: 2 additions & 0 deletions include/asm-x86/cacheflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ int set_pages_ro(struct page *page, int numpages);
int set_pages_rw(struct page *page, int numpages);

int _set_memory_uc(unsigned long addr, int numpages);
int _set_memory_wc(unsigned long addr, int numpages);
int _set_memory_wb(unsigned long addr, int numpages);
int set_memory_uc(unsigned long addr, int numpages);
int set_memory_wc(unsigned long addr, int numpages);
int set_memory_wb(unsigned long addr, int numpages);
int set_memory_x(unsigned long addr, int numpages);
int set_memory_nx(unsigned long addr, int numpages);
Expand Down

0 comments on commit ef354af

Please sign in to comment.