]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.128/mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.9.128 / mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
CommitLineData
13e8e92f
GKH
1From foo@baz Mon Sep 17 12:22:41 CEST 2018
2From: Paul Burton <paul.burton@mips.com>
3Date: Fri, 27 Jul 2018 18:23:19 -0700
4Subject: MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
5
6From: Paul Burton <paul.burton@mips.com>
7
8[ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ]
9
10isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
11as being identical to physical addresses, but they fail to do so in the
12presence of a non-zero PHYS_OFFSET.
13
14Correct this by having them use virt_to_phys() & phys_to_virt(), which
15consolidates the calculations to one place & ensures that ISA bus
16addresses do indeed match physical addresses.
17
18Signed-off-by: Paul Burton <paul.burton@mips.com>
19Patchwork: https://patchwork.linux-mips.org/patch/20047/
20Cc: James Hogan <jhogan@kernel.org>
21Cc: Ralf Baechle <ralf@linux-mips.org>
22Cc: linux-mips@linux-mips.org
23Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
24Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
25Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26---
27 arch/mips/include/asm/io.h | 8 ++++----
28 1 file changed, 4 insertions(+), 4 deletions(-)
29
30--- a/arch/mips/include/asm/io.h
31+++ b/arch/mips/include/asm/io.h
32@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsign
33 /*
34 * ISA I/O bus memory addresses are 1:1 with the physical address.
35 */
36-static inline unsigned long isa_virt_to_bus(volatile void * address)
37+static inline unsigned long isa_virt_to_bus(volatile void *address)
38 {
39- return (unsigned long)address - PAGE_OFFSET;
40+ return virt_to_phys(address);
41 }
42
43-static inline void * isa_bus_to_virt(unsigned long address)
44+static inline void *isa_bus_to_virt(unsigned long address)
45 {
46- return (void *)(address + PAGE_OFFSET);
47+ return phys_to_virt(address);
48 }
49
50 #define isa_page_to_bus page_to_phys