path: root/arch/mips
diff options
authorAntony Pavlov <>2022-07-26 13:24:12 +0300
committerSascha Hauer <>2022-08-08 15:22:53 +0200
commitf6eccbf5924514087074129dca102f8b632c3f17 (patch)
tree44c2e6f814f4f931cc0c65c95721ebbbe01ddbdf /arch/mips
parent2a3008a347021bc2d3b91e1b252b328f64db7ffe (diff)
asm-generic: provide phys_to_virt() and virt_to_phys()
The arm, riscv, sandbox and x86 architectures use just the same phys_to_virt()/virt_to_phys() implementation. Only the mips architecture has its own special implementation. So we can move phys_to_virt() and virt_to_phys() generic implementation to include/asm-generic/io.h. Use override functions way introduced in the 9216efafc52ff99e ("asm-generic/io.h: Reconcile I/O accessor overrides") linux kernel commit. Signed-off-by: Antony Pavlov <> Link: Signed-off-by: Sascha Hauer <>
Diffstat (limited to 'arch/mips')
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 0d228aa0f5..a3acbd7017 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -27,6 +27,7 @@ void dma_inv_range(unsigned long, unsigned long);
* The returned physical address is the physical (CPU) mapping for
* the memory address given.
+#define virt_to_phys virt_to_phys
static inline unsigned long virt_to_phys(const void *address)
return (unsigned long)CPHYSADDR(address);
@@ -39,6 +40,7 @@ static inline unsigned long virt_to_phys(const void *address)
* The returned virtual address is a current CPU mapping for
* the memory address given.
+#define phys_to_virt phys_to_virt
static inline void *phys_to_virt(unsigned long address)