* MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
@ 2018-07-28 1:23 Paul Burton
0 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2018-07-28 1:23 UTC (permalink / raw)
From: Paul Burton <paul.burton@mips.com>
[ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ]
isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
as being identical to physical addresses, but they fail to do so in the
presence of a non-zero PHYS_OFFSET.
Correct this by having them use virt_to_phys() & phys_to_virt(), which
consolidates the calculations to one place & ensures that ISA bus
addresses do indeed match physical addresses.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20047/
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/include/asm/io.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsign
/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
-static inline unsigned long isa_virt_to_bus(volatile void * address)
+static inline unsigned long isa_virt_to_bus(volatile void *address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return virt_to_phys(address);
}
-static inline void * isa_bus_to_virt(unsigned long address)
+static inline void *isa_bus_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return phys_to_virt(address);
}
#define isa_page_to_bus page_to_phys
Patches currently in stable-queue which might be from paul.burton@mips.com are
queue-4.9/mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
queue-4.9/mips-generic-fix-missing-of_node_put.patch
queue-4.9/mips-warn_on-invalid-dma-cache-maintenance-not-bug_on.patch
queue-4.9/mips-octeon-add-missing-of_node_put.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
@ 2018-07-28 1:23 Paul Burton
0 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2018-07-28 1:23 UTC (permalink / raw)
From: Paul Burton <paul.burton@mips.com>
[ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ]
isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
as being identical to physical addresses, but they fail to do so in the
presence of a non-zero PHYS_OFFSET.
Correct this by having them use virt_to_phys() & phys_to_virt(), which
consolidates the calculations to one place & ensures that ISA bus
addresses do indeed match physical addresses.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20047/
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/include/asm/io.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsign
/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
-static inline unsigned long isa_virt_to_bus(volatile void * address)
+static inline unsigned long isa_virt_to_bus(volatile void *address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return virt_to_phys(address);
}
-static inline void * isa_bus_to_virt(unsigned long address)
+static inline void *isa_bus_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return phys_to_virt(address);
}
#define isa_page_to_bus page_to_phys
Patches currently in stable-queue which might be from paul.burton@mips.com are
queue-3.18/mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
queue-3.18/mips-warn_on-invalid-dma-cache-maintenance-not-bug_on.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
@ 2018-07-28 1:23 Paul Burton
0 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2018-07-28 1:23 UTC (permalink / raw)
From: Paul Burton <paul.burton@mips.com>
[ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ]
isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
as being identical to physical addresses, but they fail to do so in the
presence of a non-zero PHYS_OFFSET.
Correct this by having them use virt_to_phys() & phys_to_virt(), which
consolidates the calculations to one place & ensures that ISA bus
addresses do indeed match physical addresses.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20047/
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/include/asm/io.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsign
/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
-static inline unsigned long isa_virt_to_bus(volatile void * address)
+static inline unsigned long isa_virt_to_bus(volatile void *address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return virt_to_phys(address);
}
-static inline void * isa_bus_to_virt(unsigned long address)
+static inline void *isa_bus_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return phys_to_virt(address);
}
#define isa_page_to_bus page_to_phys
Patches currently in stable-queue which might be from paul.burton@mips.com are
queue-4.14/mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
queue-4.14/mips-generic-fix-missing-of_node_put.patch
queue-4.14/mips-warn_on-invalid-dma-cache-maintenance-not-bug_on.patch
queue-4.14/mips-vdso-match-data-page-cache-colouring-when-d-aliases.patch
queue-4.14/mips-octeon-add-missing-of_node_put.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
@ 2018-07-28 1:23 Paul Burton
0 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2018-07-28 1:23 UTC (permalink / raw)
From: Paul Burton <paul.burton@mips.com>
[ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ]
isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
as being identical to physical addresses, but they fail to do so in the
presence of a non-zero PHYS_OFFSET.
Correct this by having them use virt_to_phys() & phys_to_virt(), which
consolidates the calculations to one place & ensures that ISA bus
addresses do indeed match physical addresses.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20047/
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/include/asm/io.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsign
/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
-static inline unsigned long isa_virt_to_bus(volatile void * address)
+static inline unsigned long isa_virt_to_bus(volatile void *address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return virt_to_phys(address);
}
-static inline void * isa_bus_to_virt(unsigned long address)
+static inline void *isa_bus_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return phys_to_virt(address);
}
#define isa_page_to_bus page_to_phys
Patches currently in stable-queue which might be from paul.burton@mips.com are
queue-4.18/mips-mscc-ocelot-fix-length-of-memory-address-space-for-miim.patch
queue-4.18/mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
queue-4.18/mips-generic-fix-missing-of_node_put.patch
queue-4.18/mips-warn_on-invalid-dma-cache-maintenance-not-bug_on.patch
queue-4.18/mips-vdso-match-data-page-cache-colouring-when-d-aliases.patch
queue-4.18/mips-octeon-add-missing-of_node_put.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
@ 2018-07-28 1:23 Paul Burton
0 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2018-07-28 1:23 UTC (permalink / raw)
From: Paul Burton <paul.burton@mips.com>
[ Upstream commit 0494d7ffdcebc6935410ea0719b24ab626675351 ]
isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
as being identical to physical addresses, but they fail to do so in the
presence of a non-zero PHYS_OFFSET.
Correct this by having them use virt_to_phys() & phys_to_virt(), which
consolidates the calculations to one place & ensures that ISA bus
addresses do indeed match physical addresses.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20047/
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/include/asm/io.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsign
/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
-static inline unsigned long isa_virt_to_bus(volatile void * address)
+static inline unsigned long isa_virt_to_bus(volatile void *address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return virt_to_phys(address);
}
-static inline void * isa_bus_to_virt(unsigned long address)
+static inline void *isa_bus_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return phys_to_virt(address);
}
#define isa_page_to_bus page_to_phys
Patches currently in stable-queue which might be from paul.burton@mips.com are
queue-4.4/mips-fix-isa-virt-bus-conversion-for-non-zero-phys_offset.patch
queue-4.4/mips-warn_on-invalid-dma-cache-maintenance-not-bug_on.patch
queue-4.4/mips-octeon-add-missing-of_node_put.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-28 1:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-28 1:23 MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET Paul Burton
-- strict thread matches above, loose matches on Subject: below --
2018-07-28 1:23 Paul Burton
2018-07-28 1:23 Paul Burton
2018-07-28 1:23 Paul Burton
2018-07-28 1:23 Paul Burton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.