]>
Commit | Line | Data |
---|---|---|
13e8e92f GKH |
1 | From foo@baz Mon Sep 17 12:22:41 CEST 2018 |
2 | From: Paul Burton <paul.burton@mips.com> | |
3 | Date: Fri, 27 Jul 2018 18:23:19 -0700 | |
4 | Subject: MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET | |
5 | ||
6 | From: Paul Burton <paul.burton@mips.com> | |
7 | ||
8 | [ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ] | |
9 | ||
10 | isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses | |
11 | as being identical to physical addresses, but they fail to do so in the | |
12 | presence of a non-zero PHYS_OFFSET. | |
13 | ||
14 | Correct this by having them use virt_to_phys() & phys_to_virt(), which | |
15 | consolidates the calculations to one place & ensures that ISA bus | |
16 | addresses do indeed match physical addresses. | |
17 | ||
18 | Signed-off-by: Paul Burton <paul.burton@mips.com> | |
19 | Patchwork: https://patchwork.linux-mips.org/patch/20047/ | |
20 | Cc: James Hogan <jhogan@kernel.org> | |
21 | Cc: Ralf Baechle <ralf@linux-mips.org> | |
22 | Cc: linux-mips@linux-mips.org | |
23 | Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com> | |
24 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
25 | Signed-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 |