arch/s390/include/asm/page.h

Source file repositories/reference/linux-study-clean/arch/s390/include/asm/page.h

File Facts

System
Linux kernel
Corpus path
arch/s390/include/asm/page.h
Extension
.h
Size
7246 bytes
Lines
296
Domain
Architecture Layer
Bucket
arch/s390
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct vm_layout {
	unsigned long kaslr_offset;
	unsigned long kaslr_offset_phys;
	unsigned long identity_base;
	unsigned long identity_size;
};

extern struct vm_layout vm_layout;

#define __kaslr_offset		vm_layout.kaslr_offset
#define __kaslr_offset_phys	vm_layout.kaslr_offset_phys
#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
#define __identity_base		vm_layout.identity_base
#else
#define __identity_base		0UL
#endif
#define ident_map_size		vm_layout.identity_size

static inline unsigned long kaslr_offset(void)
{
	return __kaslr_offset;
}

extern int __kaslr_enabled;
static inline int kaslr_enabled(void)
{
	if (IS_ENABLED(CONFIG_RANDOMIZE_BASE))
		return __kaslr_enabled;
	return 0;
}

#define __PAGE_OFFSET		__identity_base
#define PAGE_OFFSET		__PAGE_OFFSET

#ifdef __DECOMPRESSOR

#define __pa_nodebug(x)		((unsigned long)(x))
#define __pa(x)			__pa_nodebug(x)
#define __pa32(x)		__pa(x)
#define __va(x)			((void *)(unsigned long)(x))

#else /* __DECOMPRESSOR */

static inline unsigned long __pa_nodebug(unsigned long x)
{
	if (x < __kaslr_offset)
		return x - __identity_base;
	return x - __kaslr_offset + __kaslr_offset_phys;
}

#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) + __identity_base))

#endif /* __DECOMPRESSOR */

#define phys_to_pfn(phys)	((phys) >> PAGE_SHIFT)
#define pfn_to_phys(pfn)	((pfn) << PAGE_SHIFT)

#define phys_to_folio(phys)	page_folio(phys_to_page(phys))
#define folio_to_phys(page)	pfn_to_phys(folio_pfn(folio))

static inline void *pfn_to_virt(unsigned long pfn)
{
	return __va(pfn_to_phys(pfn));
}

static inline unsigned long virt_to_pfn(const void *kaddr)
{
	return phys_to_pfn(__pa(kaddr));
}

#define pfn_to_kaddr(pfn)	pfn_to_virt(pfn)

#define virt_to_page(kaddr)	pfn_to_page(virt_to_pfn(kaddr))
#define page_to_virt(page)	pfn_to_virt(page_to_pfn(page))

Annotation

Implementation Notes