#include <linux/sched/mm.h>
#include <linux/debugfs.h>
#include <linux/bug.h>
#include <linux/vmalloc.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/memblock.h>
#include <linux/seq_file.h>
#include <linux/crash_dump.h>
#include <linux/pgtable.h>
#ifdef CONFIG_KEXEC_CORE
#include <linux/kexec.h>
#endif
#include <trace/events/xen.h>
#include <asm/tlbflush.h>
#include <asm/fixmap.h>
#include <asm/mmu_context.h>
#include <asm/setup.h>
#include <asm/paravirt.h>
#include <asm/e820/api.h>
#include <asm/linkage.h>
#include <asm/page.h>
#include <asm/init.h>
#include <asm/memtype.h>
#include <asm/smp.h>
#include <asm/tlb.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
#include <xen/xen.h>
#include <xen/page.h>
#include <xen/interface/xen.h>
#include <xen/interface/hvm/hvm_op.h>
#include <xen/interface/version.h>
#include <xen/interface/memory.h>
#include <xen/hvc-console.h>
#include <xen/swiotlb-xen.h>
#include "xen-ops.h"
pteval_t xen_pte_val(pte_t pte);
pgdval_t xen_pgd_val(pgd_t pgd);
pmdval_t xen_pmd_val(pmd_t pmd);
pudval_t xen_pud_val(pud_t pud);
p4dval_t xen_p4d_val(p4d_t p4d);
pte_t xen_make_pte(pteval_t pte);
pgd_t xen_make_pgd(pgdval_t pgd);
pmd_t xen_make_pmd(pmdval_t pmd);
pud_t xen_make_pud(pudval_t pud);
p4d_t xen_make_p4d(p4dval_t p4d);
pte_t xen_make_pte_init(pteval_t pte);
#ifdef CONFIG_X86_VSYSCALL_EMULATION
static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss;
#endif
static DEFINE_SPINLOCK(xen_reservation_lock);
DEFINE_PER_CPU(unsigned long, xen_cr3);
static DEFINE_PER_CPU(unsigned long, xen_current_cr3);
static phys_addr_t xen_pt_base, xen_pt_size __initdata;
static DEFINE_STATIC_KEY_FALSE(xen_struct_pages_ready);
#define USER_LIMIT …
void make_lowmem_page_readonly(void *vaddr)
{ … }
void make_lowmem_page_readwrite(void *vaddr)
{ … }
static bool xen_page_pinned(void *ptr)
{ … }
static void xen_extend_mmu_update(const struct mmu_update *update)
{ … }
static void xen_extend_mmuext_op(const struct mmuext_op *op)
{ … }
static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
{ … }
static void xen_set_pmd(pmd_t *ptr, pmd_t val)
{ … }
void __init set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags)
{ … }
static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
{ … }
static inline void __xen_set_pte(pte_t *ptep, pte_t pteval)
{ … }
static void xen_set_pte(pte_t *ptep, pte_t pteval)
{ … }
static pte_t xen_ptep_modify_prot_start(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep)
{ … }
static void xen_ptep_modify_prot_commit(struct vm_area_struct *vma,
unsigned long addr,
pte_t *ptep, pte_t pte)
{ … }
static pteval_t pte_mfn_to_pfn(pteval_t val)
{ … }
static pteval_t pte_pfn_to_mfn(pteval_t val)
{ … }
__visible pteval_t xen_pte_val(pte_t pte)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible pgdval_t xen_pgd_val(pgd_t pgd)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible pte_t xen_make_pte(pteval_t pte)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible pgd_t xen_make_pgd(pgdval_t pgd)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible pmdval_t xen_pmd_val(pmd_t pmd)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
static void xen_set_pud_hyper(pud_t *ptr, pud_t val)
{ … }
static void xen_set_pud(pud_t *ptr, pud_t val)
{ … }
__visible pmd_t xen_make_pmd(pmdval_t pmd)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible pudval_t xen_pud_val(pud_t pud)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible pud_t xen_make_pud(pudval_t pud)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
static pgd_t *xen_get_user_pgd(pgd_t *pgd)
{ … }
static void __xen_set_p4d_hyper(p4d_t *ptr, p4d_t val)
{ … }
static void __init xen_set_p4d_hyper(p4d_t *ptr, p4d_t val)
{ … }
static void xen_set_p4d(p4d_t *ptr, p4d_t val)
{ … }
#if CONFIG_PGTABLE_LEVELS >= 5
__visible p4dval_t xen_p4d_val(p4d_t p4d)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
__visible p4d_t xen_make_p4d(p4dval_t p4d)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
#endif
static void xen_pmd_walk(struct mm_struct *mm, pmd_t *pmd,
void (*func)(struct mm_struct *mm, struct page *,
enum pt_level),
bool last, unsigned long limit)
{ … }
static void xen_pud_walk(struct mm_struct *mm, pud_t *pud,
void (*func)(struct mm_struct *mm, struct page *,
enum pt_level),
bool last, unsigned long limit)
{ … }
static void xen_p4d_walk(struct mm_struct *mm, p4d_t *p4d,
void (*func)(struct mm_struct *mm, struct page *,
enum pt_level),
bool last, unsigned long limit)
{ … }
static void __xen_pgd_walk(struct mm_struct *mm, pgd_t *pgd,
void (*func)(struct mm_struct *mm, struct page *,
enum pt_level),
unsigned long limit)
{ … }
static void xen_pgd_walk(struct mm_struct *mm,
void (*func)(struct mm_struct *mm, struct page *,
enum pt_level),
unsigned long limit)
{ … }
static spinlock_t *xen_pte_lock(struct page *page, struct mm_struct *mm)
{ … }
static void xen_pte_unlock(void *v)
{ … }
static void xen_do_pin(unsigned level, unsigned long pfn)
{ … }
static void xen_pin_page(struct mm_struct *mm, struct page *page,
enum pt_level level)
{ … }
static void __xen_pgd_pin(struct mm_struct *mm, pgd_t *pgd)
{ … }
static void xen_pgd_pin(struct mm_struct *mm)
{ … }
void xen_mm_pin_all(void)
{ … }
static void __init xen_mark_pinned(struct mm_struct *mm, struct page *page,
enum pt_level level)
{ … }
static void __init xen_after_bootmem(void)
{ … }
static void xen_unpin_page(struct mm_struct *mm, struct page *page,
enum pt_level level)
{ … }
static void __xen_pgd_unpin(struct mm_struct *mm, pgd_t *pgd)
{ … }
static void xen_pgd_unpin(struct mm_struct *mm)
{ … }
void xen_mm_unpin_all(void)
{ … }
static void xen_enter_mmap(struct mm_struct *mm)
{ … }
static void drop_mm_ref_this_cpu(void *info)
{ … }
#ifdef CONFIG_SMP
static void xen_drop_mm_ref(struct mm_struct *mm)
{ … }
#else
static void xen_drop_mm_ref(struct mm_struct *mm)
{
drop_mm_ref_this_cpu(mm);
}
#endif
static void xen_exit_mmap(struct mm_struct *mm)
{ … }
static void xen_post_allocator_init(void);
static void __init pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
{ … }
static void __init xen_cleanhighmap(unsigned long vaddr,
unsigned long vaddr_end)
{ … }
static void __init xen_free_ro_pages(unsigned long paddr, unsigned long size)
{ … }
static void __init xen_cleanmfnmap_free_pgtbl(void *pgtbl, bool unpin)
{ … }
static void __init xen_cleanmfnmap_pmd(pmd_t *pmd, bool unpin)
{ … }
static void __init xen_cleanmfnmap_pud(pud_t *pud, bool unpin)
{ … }
static void __init xen_cleanmfnmap_p4d(p4d_t *p4d, bool unpin)
{ … }
static void __init xen_cleanmfnmap(unsigned long vaddr)
{ … }
static void __init xen_pagetable_p2m_free(void)
{ … }
static void __init xen_pagetable_cleanhighmap(void)
{ … }
static void __init xen_pagetable_p2m_setup(void)
{ … }
static void __init xen_pagetable_init(void)
{ … }
static noinstr void xen_write_cr2(unsigned long cr2)
{ … }
static noinline void xen_flush_tlb(void)
{ … }
static void xen_flush_tlb_one_user(unsigned long addr)
{ … }
static void xen_flush_tlb_multi(const struct cpumask *cpus,
const struct flush_tlb_info *info)
{ … }
static unsigned long xen_read_cr3(void)
{ … }
static void set_current_cr3(void *v)
{ … }
static void __xen_write_cr3(bool kernel, unsigned long cr3)
{ … }
static void xen_write_cr3(unsigned long cr3)
{ … }
static void __init xen_write_cr3_init(unsigned long cr3)
{ … }
static int xen_pgd_alloc(struct mm_struct *mm)
{ … }
static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
{ … }
static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
{ … }
__visible pte_t xen_make_pte_init(pteval_t pte)
{ … }
PV_CALLEE_SAVE_REGS_THUNK(…);
static void __init xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn)
{ … }
static void __init xen_alloc_pmd_init(struct mm_struct *mm, unsigned long pfn)
{ … }
static void __init xen_release_pte_init(unsigned long pfn)
{ … }
static void __init xen_release_pmd_init(unsigned long pfn)
{ … }
static inline void __pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
{ … }
static inline void __set_pfn_prot(unsigned long pfn, pgprot_t prot)
{ … }
static inline void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn,
unsigned level)
{ … }
static void xen_alloc_pte(struct mm_struct *mm, unsigned long pfn)
{ … }
static void xen_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
{ … }
static inline void xen_release_ptpage(unsigned long pfn, unsigned level)
{ … }
static void xen_release_pte(unsigned long pfn)
{ … }
static void xen_release_pmd(unsigned long pfn)
{ … }
static void xen_alloc_pud(struct mm_struct *mm, unsigned long pfn)
{ … }
static void xen_release_pud(unsigned long pfn)
{ … }
static void * __init __ka(phys_addr_t paddr)
{ … }
static unsigned long __init m2p(phys_addr_t maddr)
{ … }
static void * __init m2v(phys_addr_t maddr)
{ … }
static void __init set_page_prot_flags(void *addr, pgprot_t prot,
unsigned long flags)
{ … }
static void __init set_page_prot(void *addr, pgprot_t prot)
{ … }
void __init xen_setup_machphys_mapping(void)
{ … }
static void __init convert_pfn_mfn(void *v)
{ … }
static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end,
unsigned long addr)
{ … }
void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
{ … }
static unsigned long __init xen_read_phys_ulong(phys_addr_t addr)
{ … }
static phys_addr_t __init xen_early_virt_to_phys(unsigned long vaddr)
{ … }
void __init xen_relocate_p2m(void)
{ … }
void __init xen_reserve_special_pages(void)
{ … }
void __init xen_pt_check_e820(void)
{ … }
static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss;
static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
{ … }
static void xen_enter_lazy_mmu(void)
{ … }
static void xen_flush_lazy_mmu(void)
{ … }
static void __init xen_post_allocator_init(void)
{ … }
static void xen_leave_lazy_mmu(void)
{ … }
static const typeof(pv_ops) xen_mmu_ops __initconst = …;
void __init xen_init_mmu_ops(void)
{ … }
#define MAX_CONTIG_ORDER …
static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];
#define VOID_PTE …
static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order,
unsigned long *in_frames,
unsigned long *out_frames)
{ … }
static void xen_remap_exchanged_ptes(unsigned long vaddr, int order,
unsigned long *mfns,
unsigned long first_mfn)
{ … }
static int xen_exchange_memory(unsigned long extents_in, unsigned int order_in,
unsigned long *pfns_in,
unsigned long extents_out,
unsigned int order_out,
unsigned long *mfns_out,
unsigned int address_bits)
{ … }
int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
unsigned int address_bits,
dma_addr_t *dma_handle)
{ … }
void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
{ … }
static noinline void xen_flush_tlb_all(void)
{ … }
#define REMAP_BATCH_SIZE …
struct remap_data { … };
static int remap_area_pfn_pte_fn(pte_t *ptep, unsigned long addr, void *data)
{ … }
int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,
unsigned int domid, bool no_translate)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_VMCORE_INFO
phys_addr_t paddr_vmcoreinfo_note(void)
{ … }
#endif