arch/hexagon/include/asm/page.h

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

File Facts

System
Linux kernel
Corpus path
arch/hexagon/include/asm/page.h
Extension
.h
Size
3613 bytes
Lines
134
Domain
Architecture Layer
Bucket
arch/hexagon
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

#ifndef _ASM_PAGE_H
#define _ASM_PAGE_H

#include <linux/const.h>

/*  This is probably not the most graceful way to handle this.  */

#ifdef CONFIG_PAGE_SIZE_4KB
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_4KB
#endif

#ifdef CONFIG_PAGE_SIZE_16KB
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_16KB
#endif

#ifdef CONFIG_PAGE_SIZE_64KB
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_64KB
#endif

#ifdef CONFIG_PAGE_SIZE_256KB
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_256KB
#endif

#ifdef CONFIG_PAGE_SIZE_1MB
#define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_1MB
#endif

/*
 *  These should be defined in hugetlb.h, but apparently not.
 *  "Huge" for us should be 4MB or 16MB, which are both represented
 *  in L1 PTE's.  Right now, it's set up for 4MB.
 */
#ifdef CONFIG_HUGETLB_PAGE
#define HPAGE_SHIFT 22
#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
#define HPAGE_MASK (~(HPAGE_SIZE-1))
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
#define HVM_HUGEPAGE_SIZE 0x5
#endif

#include <vdso/page.h>

#ifdef __KERNEL__
#ifndef __ASSEMBLY__

/*
 * This is for PFN_DOWN, which mm.h needs.  Seems the right place to pull it in.
 */
#include <linux/pfn.h>

/*
 * We implement a two-level architecture-specific page table structure.
 * Null intermediate page table level (pmd, pud) definitions will come from
 * asm-generic/pagetable-nopmd.h and asm-generic/pagetable-nopud.h
 */
typedef struct { unsigned long pte; } pte_t;
typedef struct { unsigned long pgd; } pgd_t;
typedef struct { unsigned long pgprot; } pgprot_t;
typedef struct page *pgtable_t;

#define pte_val(x)     ((x).pte)
#define pgd_val(x)     ((x).pgd)
#define pgprot_val(x)  ((x).pgprot)
#define __pte(x)       ((pte_t) { (x) })
#define __pgd(x)       ((pgd_t) { (x) })
#define __pgprot(x)    ((pgprot_t) { (x) })

/* Needed for PAGE_OFFSET used in the macro right below */
#include <asm/mem-layout.h>

/*
 * We need a __pa and a __va routine for kernel space.
 * MIPS says they're only used during mem_init.
 * also, check if we need a PHYS_OFFSET.
 */
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
#define __va(x) ((void *)((unsigned long)(x) - PHYS_OFFSET + PAGE_OFFSET))

/* The "page frame" descriptor is defined in linux/mm.h */
struct page;

/* Returns page frame descriptor for virtual address. */
#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(__pa(kaddr)))

/* Default vm area behavior is non-executable.  */
#define VMA_DATA_DEFAULT_FLAGS	VMA_DATA_FLAGS_NON_EXEC

#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)

/*  Need to not use a define for linesize; may move this to another file.  */

Annotation

Implementation Notes