diff options
author | Toshi Kani <toshi.kani@hp.com> | 2015-06-04 12:55:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-06-07 09:28:55 -0400 |
commit | 0d69bdff451a10aa48f80509e8bf18fb24683c06 (patch) | |
tree | 2bbc125e72acc87da9e1fb3dd26f164ea8b43954 | |
parent | d79a40caf8e15a2a15ecdefdc9d05865d4f37baa (diff) |
x86/mm/pat: Change reserve_memtype() for Write-Through type
When a target range is in RAM, reserve_ram_pages_type() verifies
the requested type. Change it to fail WT and WP requests with
-EINVAL since set_page_memtype() is limited to handle three
types: WB, WC and UC-.
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Elliott@hp.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: arnd@arndb.de
Cc: hch@lst.de
Cc: hmh@hmh.eng.br
Cc: jgross@suse.com
Cc: konrad.wilk@oracle.com
Cc: linux-mm <linux-mm@kvack.org>
Cc: linux-nvdimm@lists.01.org
Cc: stefan.bader@canonical.com
Cc: yigal@plexistor.com
Link: http://lkml.kernel.org/r/1433436928-31903-6-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/mm/pat.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 59ab1a0fe21b..6311193fd1a2 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -401,9 +401,12 @@ static int pat_pagerange_is_ram(resource_size_t start, resource_size_t end) | |||
401 | 401 | ||
402 | /* | 402 | /* |
403 | * For RAM pages, we use page flags to mark the pages with appropriate type. | 403 | * For RAM pages, we use page flags to mark the pages with appropriate type. |
404 | * Here we do two pass: | 404 | * The page flags are limited to three types, WB, WC and UC-. WT and WP requests |
405 | * - Find the memtype of all the pages in the range, look for any conflicts | 405 | * fail with -EINVAL, and UC gets redirected to UC-. |
406 | * - In case of no conflicts, set the new memtype for pages in the range | 406 | * |
407 | * Here we do two passes: | ||
408 | * - Find the memtype of all the pages in the range, look for any conflicts. | ||
409 | * - In case of no conflicts, set the new memtype for pages in the range. | ||
407 | */ | 410 | */ |
408 | static int reserve_ram_pages_type(u64 start, u64 end, | 411 | static int reserve_ram_pages_type(u64 start, u64 end, |
409 | enum page_cache_mode req_type, | 412 | enum page_cache_mode req_type, |
@@ -412,6 +415,13 @@ static int reserve_ram_pages_type(u64 start, u64 end, | |||
412 | struct page *page; | 415 | struct page *page; |
413 | u64 pfn; | 416 | u64 pfn; |
414 | 417 | ||
418 | if ((req_type == _PAGE_CACHE_MODE_WT) || | ||
419 | (req_type == _PAGE_CACHE_MODE_WP)) { | ||
420 | if (new_type) | ||
421 | *new_type = _PAGE_CACHE_MODE_UC_MINUS; | ||
422 | return -EINVAL; | ||
423 | } | ||
424 | |||
415 | if (req_type == _PAGE_CACHE_MODE_UC) { | 425 | if (req_type == _PAGE_CACHE_MODE_UC) { |
416 | /* We do not support strong UC */ | 426 | /* We do not support strong UC */ |
417 | WARN_ON_ONCE(1); | 427 | WARN_ON_ONCE(1); |
@@ -461,6 +471,7 @@ static int free_ram_pages_type(u64 start, u64 end) | |||
461 | * - _PAGE_CACHE_MODE_WC | 471 | * - _PAGE_CACHE_MODE_WC |
462 | * - _PAGE_CACHE_MODE_UC_MINUS | 472 | * - _PAGE_CACHE_MODE_UC_MINUS |
463 | * - _PAGE_CACHE_MODE_UC | 473 | * - _PAGE_CACHE_MODE_UC |
474 | * - _PAGE_CACHE_MODE_WT | ||
464 | * | 475 | * |
465 | * If new_type is NULL, function will return an error if it cannot reserve the | 476 | * If new_type is NULL, function will return an error if it cannot reserve the |
466 | * region with req_type. If new_type is non-NULL, function will return | 477 | * region with req_type. If new_type is non-NULL, function will return |