-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sh: Provide a sane valid_phys_addr_range() to prevent TLB reset with …
…PMB. With the PMB enabled, only P1SEG and up are covered by the PMB mappings, meaning that situations where out-of-bounds physical addresses are read from will lead to TLB reset after the PMB miss, allowing for use cases like dd if=/dev/mem to reset the TLB. Fix this up to make sure the reference is between __MEMORY_START (phys) and __pa(high_memory). This is coherent across all variants of sh/sh64 with and without MMU, though the PMB bug itself is only applicable to SH-4A parts. Reported-by: Hideo Saito <saito@densan.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
- Loading branch information
Paul Mundt
committed
Nov 12, 2008
1 parent
ade7a9b
commit 185aed7
Showing
4 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* arch/sh/mm/mmap.c | ||
* | ||
* Copyright (C) 2008 Paul Mundt | ||
* | ||
* This file is subject to the terms and conditions of the GNU General Public | ||
* License. See the file "COPYING" in the main directory of this archive | ||
* for more details. | ||
*/ | ||
#include <linux/io.h> | ||
#include <linux/mm.h> | ||
#include <asm/page.h> | ||
|
||
/* | ||
* You really shouldn't be using read() or write() on /dev/mem. This | ||
* might go away in the future. | ||
*/ | ||
int valid_phys_addr_range(unsigned long addr, size_t count) | ||
{ | ||
if (addr < (PAGE_OFFSET + (PFN_START << PAGE_SHIFT))) | ||
return 0; | ||
if (addr + count > __pa(high_memory)) | ||
return 0; | ||
|
||
return 1; | ||
} | ||
|
||
int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) | ||
{ | ||
return 1; | ||
} |