mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 06:34:12 +08:00
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>
This commit is contained in:
parent
bd36cfbbb9
commit
5f58bde726
@ -63,6 +63,7 @@ config S390
|
||||
select ARCH_ENABLE_MEMORY_HOTREMOVE
|
||||
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
|
||||
select ARCH_HAS_CURRENT_STACK_POINTER
|
||||
select ARCH_HAS_DEBUG_VIRTUAL
|
||||
select ARCH_HAS_DEBUG_VM_PGTABLE
|
||||
select ARCH_HAS_DEBUG_WX
|
||||
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
||||
|
@ -29,6 +29,7 @@ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
|
||||
endif
|
||||
KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack
|
||||
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
|
||||
KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
|
||||
KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
|
||||
KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
|
||||
KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding
|
||||
|
@ -810,6 +810,7 @@ CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
|
||||
CONFIG_DEBUG_STACK_USAGE=y
|
||||
CONFIG_DEBUG_VM=y
|
||||
CONFIG_DEBUG_VM_PGFLAGS=y
|
||||
CONFIG_DEBUG_VIRTUAL=y
|
||||
CONFIG_DEBUG_MEMORY_INIT=y
|
||||
CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
|
||||
CONFIG_DEBUG_PER_CPU_MAPS=y
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -7,6 +7,7 @@ obj-y := init.o fault.o extmem.o mmap.o vmem.o maccess.o
|
||||
obj-y += page-states.o pageattr.o pgtable.o pgalloc.o extable.o
|
||||
|
||||
obj-$(CONFIG_CMM) += cmm.o
|
||||
obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o
|
||||
obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
|
||||
obj-$(CONFIG_PTDUMP_CORE) += dump_pagetables.o
|
||||
obj-$(CONFIG_PGSTE) += gmap.o
|
||||
|
15
arch/s390/mm/physaddr.c
Normal file
15
arch/s390/mm/physaddr.c
Normal file
@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/mmdebug.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/mm.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
unsigned long __phys_addr(unsigned long x, bool is_31bit)
|
||||
{
|
||||
VIRTUAL_BUG_ON(is_vmalloc_or_module_addr((void *)(x)));
|
||||
x = __pa_nodebug(x);
|
||||
if (is_31bit)
|
||||
VIRTUAL_BUG_ON(x >> 31);
|
||||
return x;
|
||||
}
|
||||
EXPORT_SYMBOL(__phys_addr);
|
Loading…
Reference in New Issue
Block a user