summaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2024-03-07 13:28:27 +0100
committerHeiko Carstens <hca@linux.ibm.com>2024-03-13 09:23:49 +0100
commit5f58bde7264704fec2058afc219a3557f02f3d8f (patch)
tree752aa0dbbe00bedbac8bc6475c66a21b1f65ab5f /arch/s390/include/asm
parents390/vfio_ccw_cp: use new address translation helpers (diff)
downloadlinux-5f58bde7264704fec2058afc219a3557f02f3d8f.tar.xz
linux-5f58bde7264704fec2058afc219a3557f02f3d8f.zip
s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support
Provide a very simple ARCH_HAS_DEBUG_VIRTUAL implementation. For now errors are only reported for the following cases: - Trying to translate a vmalloc or module address to a physical address - Translating a supposed to be ZONE_DMA virtual address into a physical address, and the resulting physical address is larger than two GiB Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm')
-rw-r--r--arch/s390/include/asm/dma-types.h2
-rw-r--r--arch/s390/include/asm/page.h30
2 files changed, 29 insertions, 3 deletions
diff --git a/arch/s390/include/asm/dma-types.h b/arch/s390/include/asm/dma-types.h
index 7d7f71022aa9..5c5734e6946c 100644
--- a/arch/s390/include/asm/dma-types.h
+++ b/arch/s390/include/asm/dma-types.h
@@ -37,7 +37,7 @@ typedef u64 __bitwise dma64_t;
*/
static inline dma32_t virt_to_dma32(void *ptr)
{
- return (__force dma32_t)__pa(ptr);
+ return (__force dma32_t)__pa32(ptr);
}
static inline void *dma32_to_virt(dma32_t addr)
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index ded9548d11d9..9381879f7ecf 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -181,9 +181,35 @@ int arch_make_page_accessible(struct page *page);
#define __PAGE_OFFSET 0x0UL
#define PAGE_OFFSET 0x0UL
-#define __pa(x) ((unsigned long)(x))
+#define __pa_nodebug(x) ((unsigned long)(x))
+
+#ifdef __DECOMPRESSOR
+
+#define __pa(x) __pa_nodebug(x)
+#define __pa32(x) __pa(x)
#define __va(x) ((void *)(unsigned long)(x))
+#else /* __DECOMPRESSOR */
+
+#ifdef CONFIG_DEBUG_VIRTUAL
+
+unsigned long __phys_addr(unsigned long x, bool is_31bit);
+
+#else /* CONFIG_DEBUG_VIRTUAL */
+
+static inline unsigned long __phys_addr(unsigned long x, bool is_31bit)
+{
+ return __pa_nodebug(x);
+}
+
+#endif /* CONFIG_DEBUG_VIRTUAL */
+
+#define __pa(x) __phys_addr((unsigned long)(x), false)
+#define __pa32(x) __phys_addr((unsigned long)(x), true)
+#define __va(x) ((void *)(unsigned long)(x))
+
+#endif /* __DECOMPRESSOR */
+
#define phys_to_pfn(phys) ((phys) >> PAGE_SHIFT)
#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
@@ -205,7 +231,7 @@ static inline unsigned long virt_to_pfn(const void *kaddr)
#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
#define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
-#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr))
+#define virt_addr_valid(kaddr) pfn_valid(phys_to_pfn(__pa_nodebug(kaddr)))
#define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC