diff options
| -rw-r--r-- | arch/x86/mm/pat.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index bb6e8a267bfe..2a50e0fa64a5 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
| @@ -390,14 +390,6 @@ int free_memtype(u64 start, u64 end) | |||
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | 392 | ||
| 393 | /* | ||
| 394 | * /dev/mem mmap interface. The memtype used for mapping varies: | ||
| 395 | * - Use UC for mappings with O_SYNC flag | ||
| 396 | * - Without O_SYNC flag, if there is any conflict in reserve_memtype, | ||
| 397 | * inherit the memtype from existing mapping. | ||
| 398 | * - Else use UC_MINUS memtype (for backward compatibility with existing | ||
| 399 | * X drivers. | ||
| 400 | */ | ||
| 401 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | 393 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, |
| 402 | unsigned long size, pgprot_t vma_prot) | 394 | unsigned long size, pgprot_t vma_prot) |
| 403 | { | 395 | { |
| @@ -435,14 +427,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
| 435 | unsigned long size, pgprot_t *vma_prot) | 427 | unsigned long size, pgprot_t *vma_prot) |
| 436 | { | 428 | { |
| 437 | u64 offset = ((u64) pfn) << PAGE_SHIFT; | 429 | u64 offset = ((u64) pfn) << PAGE_SHIFT; |
| 438 | unsigned long flags = _PAGE_CACHE_UC_MINUS; | 430 | unsigned long flags = -1; |
| 439 | int retval; | 431 | int retval; |
| 440 | 432 | ||
| 441 | if (!range_is_allowed(pfn, size)) | 433 | if (!range_is_allowed(pfn, size)) |
| 442 | return 0; | 434 | return 0; |
| 443 | 435 | ||
| 444 | if (file->f_flags & O_SYNC) { | 436 | if (file->f_flags & O_SYNC) { |
| 445 | flags = _PAGE_CACHE_UC; | 437 | flags = _PAGE_CACHE_UC_MINUS; |
| 446 | } | 438 | } |
| 447 | 439 | ||
| 448 | #ifdef CONFIG_X86_32 | 440 | #ifdef CONFIG_X86_32 |
| @@ -465,13 +457,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
| 465 | #endif | 457 | #endif |
| 466 | 458 | ||
| 467 | /* | 459 | /* |
| 468 | * With O_SYNC, we can only take UC mapping. Fail if we cannot. | 460 | * With O_SYNC, we can only take UC_MINUS mapping. Fail if we cannot. |
| 461 | * | ||
| 469 | * Without O_SYNC, we want to get | 462 | * Without O_SYNC, we want to get |
| 470 | * - WB for WB-able memory and no other conflicting mappings | 463 | * - WB for WB-able memory and no other conflicting mappings |
| 471 | * - UC_MINUS for non-WB-able memory with no other conflicting mappings | 464 | * - UC_MINUS for non-WB-able memory with no other conflicting mappings |
| 472 | * - Inherit from confliting mappings otherwise | 465 | * - Inherit from confliting mappings otherwise |
| 473 | */ | 466 | */ |
| 474 | if (flags != _PAGE_CACHE_UC_MINUS) { | 467 | if (flags != -1) { |
| 475 | retval = reserve_memtype(offset, offset + size, flags, NULL); | 468 | retval = reserve_memtype(offset, offset + size, flags, NULL); |
| 476 | } else { | 469 | } else { |
| 477 | retval = reserve_memtype(offset, offset + size, -1, &flags); | 470 | retval = reserve_memtype(offset, offset + size, -1, &flags); |
