diff options
author | Luka Pivk <luka.pivk@toradex.com> | 2019-01-08 07:02:41 +0100 |
---|---|---|
committer | Luka Pivk <luka.pivk@toradex.com> | 2019-01-08 07:02:41 +0100 |
commit | 43f61e8df71c474cd56b5c971096b9cf8d36cd95 (patch) | |
tree | 0031be65fcc2fd2fd3eceeee9558b5526a19e431 /arch/x86/mm/pat.c | |
parent | 5656ec50dc9950db865d53306326b1a732e3738e (diff) | |
parent | c04c050f5bf98845bfe22164b8a1503d696a6e26 (diff) |
Merge remote-tracking branch 'remotes/origin/linux-4.19.y'toradex_4.19.y
Signed-off-by: Luka Pivk <luka.pivk@toradex.com>
Diffstat (limited to 'arch/x86/mm/pat.c')
-rw-r--r-- | arch/x86/mm/pat.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 3d0c83ef6aab..a3c9ea29d7cc 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -519,8 +519,13 @@ static u64 sanitize_phys(u64 address) * for a "decoy" virtual address (bit 63 clear) passed to * set_memory_X(). __pa() on a "decoy" address results in a * physical address with bit 63 set. + * + * Decoy addresses are not present for 32-bit builds, see + * set_mce_nospec(). */ - return address & __PHYSICAL_MASK; + if (IS_ENABLED(CONFIG_X86_64)) + return address & __PHYSICAL_MASK; + return address; } /* @@ -546,7 +551,11 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type, start = sanitize_phys(start); end = sanitize_phys(end); - BUG_ON(start >= end); /* end is exclusive */ + if (start >= end) { + WARN(1, "%s failed: [mem %#010Lx-%#010Lx], req %s\n", __func__, + start, end - 1, cattr_name(req_type)); + return -EINVAL; + } if (!pat_enabled()) { /* This is identical to page table setting without PAT */ |