#ifndef _ASM_X86_PARAVIRT_H
#define _ASM_X86_PARAVIRT_H
#include <asm/paravirt_types.h>
#ifndef __ASSEMBLY__
struct mm_struct;
#endif
#ifdef CONFIG_PARAVIRT
#include <asm/pgtable_types.h>
#include <asm/asm.h>
#include <asm/nospec-branch.h>
#ifndef __ASSEMBLY__
#include <linux/bug.h>
#include <linux/types.h>
#include <linux/cpumask.h>
#include <linux/static_call_types.h>
#include <asm/frame.h>
u64 dummy_steal_clock(int cpu);
u64 dummy_sched_clock(void);
DECLARE_STATIC_CALL(pv_steal_clock, dummy_steal_clock);
DECLARE_STATIC_CALL(pv_sched_clock, dummy_sched_clock);
void paravirt_set_sched_clock(u64 (*func)(void));
static __always_inline u64 paravirt_sched_clock(void)
{ … }
struct static_key;
extern struct static_key paravirt_steal_enabled;
extern struct static_key paravirt_steal_rq_enabled;
__visible void __native_queued_spin_unlock(struct qspinlock *lock);
bool pv_is_native_spin_unlock(void);
__visible bool __native_vcpu_is_preempted(long cpu);
bool pv_is_native_vcpu_is_preempted(void);
static inline u64 paravirt_steal_clock(int cpu)
{ … }
#ifdef CONFIG_PARAVIRT_SPINLOCKS
void __init paravirt_set_cap(void);
#endif
static inline void slow_down_io(void)
{ … }
void native_flush_tlb_local(void);
void native_flush_tlb_global(void);
void native_flush_tlb_one_user(unsigned long addr);
void native_flush_tlb_multi(const struct cpumask *cpumask,
const struct flush_tlb_info *info);
static inline void __flush_tlb_local(void)
{ … }
static inline void __flush_tlb_global(void)
{ … }
static inline void __flush_tlb_one_user(unsigned long addr)
{ … }
static inline void __flush_tlb_multi(const struct cpumask *cpumask,
const struct flush_tlb_info *info)
{ … }
static inline void paravirt_tlb_remove_table(struct mmu_gather *tlb, void *table)
{ … }
static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
{ … }
static inline void notify_page_enc_status_changed(unsigned long pfn,
int npages, bool enc)
{ … }
#ifdef CONFIG_PARAVIRT_XXL
static inline void load_sp0(unsigned long sp0)
{ … }
static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{ … }
static __always_inline unsigned long paravirt_get_debugreg(int reg)
{ … }
#define get_debugreg(var, reg) …
static __always_inline void set_debugreg(unsigned long val, int reg)
{ … }
static inline unsigned long read_cr0(void)
{ … }
static inline void write_cr0(unsigned long x)
{ … }
static __always_inline unsigned long read_cr2(void)
{ … }
static __always_inline void write_cr2(unsigned long x)
{ … }
static inline unsigned long __read_cr3(void)
{ … }
static inline void write_cr3(unsigned long x)
{ … }
static inline void __write_cr4(unsigned long x)
{ … }
static __always_inline void arch_safe_halt(void)
{ … }
static inline void halt(void)
{ … }
extern noinstr void pv_native_wbinvd(void);
static __always_inline void wbinvd(void)
{ … }
static inline u64 paravirt_read_msr(unsigned msr)
{ … }
static inline void paravirt_write_msr(unsigned msr,
unsigned low, unsigned high)
{ … }
static inline u64 paravirt_read_msr_safe(unsigned msr, int *err)
{ … }
static inline int paravirt_write_msr_safe(unsigned msr,
unsigned low, unsigned high)
{ … }
#define rdmsr(msr, val1, val2) …
#define wrmsr(msr, val1, val2) …
#define rdmsrl(msr, val) …
static inline void wrmsrl(unsigned msr, u64 val)
{ … }
#define wrmsr_safe(msr, a, b) …
#define rdmsr_safe(msr, a, b) …
static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
{ … }
static inline unsigned long long paravirt_read_pmc(int counter)
{ … }
#define rdpmc(counter, low, high) …
#define rdpmcl(counter, val) …
static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries)
{ … }
static inline void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries)
{ … }
static inline void load_TR_desc(void)
{ … }
static inline void load_gdt(const struct desc_ptr *dtr)
{ … }
static inline void load_idt(const struct desc_ptr *dtr)
{ … }
static inline void set_ldt(const void *addr, unsigned entries)
{ … }
static inline unsigned long paravirt_store_tr(void)
{ … }
#define store_tr(tr) …
static inline void load_TLS(struct thread_struct *t, unsigned cpu)
{ … }
static inline void load_gs_index(unsigned int gs)
{ … }
static inline void write_ldt_entry(struct desc_struct *dt, int entry,
const void *desc)
{ … }
static inline void write_gdt_entry(struct desc_struct *dt, int entry,
void *desc, int type)
{ … }
static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
{ … }
#ifdef CONFIG_X86_IOPL_IOPERM
static inline void tss_invalidate_io_bitmap(void)
{ … }
static inline void tss_update_io_bitmap(void)
{ … }
#endif
static inline void paravirt_enter_mmap(struct mm_struct *next)
{ … }
static inline int paravirt_pgd_alloc(struct mm_struct *mm)
{ … }
static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
{ … }
static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn)
{ … }
static inline void paravirt_release_pte(unsigned long pfn)
{ … }
static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
{ … }
static inline void paravirt_release_pmd(unsigned long pfn)
{ … }
static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn)
{ … }
static inline void paravirt_release_pud(unsigned long pfn)
{ … }
static inline void paravirt_alloc_p4d(struct mm_struct *mm, unsigned long pfn)
{ … }
static inline void paravirt_release_p4d(unsigned long pfn)
{ … }
static inline pte_t __pte(pteval_t val)
{ … }
static inline pteval_t pte_val(pte_t pte)
{ … }
static inline pgd_t __pgd(pgdval_t val)
{ … }
static inline pgdval_t pgd_val(pgd_t pgd)
{ … }
#define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
static inline pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr,
pte_t *ptep)
{ … }
static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
pte_t *ptep, pte_t old_pte, pte_t pte)
{ … }
static inline void set_pte(pte_t *ptep, pte_t pte)
{ … }
static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
{ … }
static inline pmd_t __pmd(pmdval_t val)
{ … }
static inline pmdval_t pmd_val(pmd_t pmd)
{ … }
static inline void set_pud(pud_t *pudp, pud_t pud)
{ … }
static inline pud_t __pud(pudval_t val)
{ … }
static inline pudval_t pud_val(pud_t pud)
{ … }
static inline void pud_clear(pud_t *pudp)
{ … }
static inline void set_p4d(p4d_t *p4dp, p4d_t p4d)
{ … }
#if CONFIG_PGTABLE_LEVELS >= 5
static inline p4d_t __p4d(p4dval_t val)
{ … }
static inline p4dval_t p4d_val(p4d_t p4d)
{ … }
static inline void __set_pgd(pgd_t *pgdp, pgd_t pgd)
{ … }
#define set_pgd(pgdp, pgdval) …
#define pgd_clear(pgdp) …
#endif
static inline void p4d_clear(p4d_t *p4dp)
{ … }
static inline void set_pte_atomic(pte_t *ptep, pte_t pte)
{ … }
static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
pte_t *ptep)
{ … }
static inline void pmd_clear(pmd_t *pmdp)
{ … }
#define __HAVE_ARCH_START_CONTEXT_SWITCH
static inline void arch_start_context_switch(struct task_struct *prev)
{ … }
static inline void arch_end_context_switch(struct task_struct *next)
{ … }
#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
static inline void arch_enter_lazy_mmu_mode(void)
{ … }
static inline void arch_leave_lazy_mmu_mode(void)
{ … }
static inline void arch_flush_lazy_mmu_mode(void)
{ … }
static inline void __set_fixmap(unsigned idx,
phys_addr_t phys, pgprot_t flags)
{ … }
#endif
#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
static __always_inline void pv_queued_spin_lock_slowpath(struct qspinlock *lock,
u32 val)
{ … }
static __always_inline void pv_queued_spin_unlock(struct qspinlock *lock)
{ … }
static __always_inline void pv_wait(u8 *ptr, u8 val)
{ … }
static __always_inline void pv_kick(int cpu)
{ … }
static __always_inline bool pv_vcpu_is_preempted(long cpu)
{ … }
void __raw_callee_save___native_queued_spin_unlock(struct qspinlock *lock);
bool __raw_callee_save___native_vcpu_is_preempted(long cpu);
#endif
#ifdef CONFIG_X86_32
#define PV_SAVE_ALL_CALLER_REGS …
#define PV_RESTORE_ALL_CALLER_REGS …
#else
#define PV_SAVE_ALL_CALLER_REGS …
#define PV_RESTORE_ALL_CALLER_REGS …
#endif
#define PV_THUNK_NAME(func) …
#define __PV_CALLEE_SAVE_REGS_THUNK(func, section) …
#define PV_CALLEE_SAVE_REGS_THUNK(func) …
#define PV_CALLEE_SAVE(func) …
#define __PV_IS_CALLEE_SAVE(func) …
#ifdef CONFIG_PARAVIRT_XXL
static __always_inline unsigned long arch_local_save_flags(void)
{ … }
static __always_inline void arch_local_irq_disable(void)
{ … }
static __always_inline void arch_local_irq_enable(void)
{ … }
static __always_inline unsigned long arch_local_irq_save(void)
{ … }
#endif
#undef PARAVIRT_CALL
#undef __PVOP_CALL
#undef __PVOP_VCALL
#undef PVOP_VCALL0
#undef PVOP_CALL0
#undef PVOP_VCALL1
#undef PVOP_CALL1
#undef PVOP_VCALL2
#undef PVOP_CALL2
#undef PVOP_VCALL3
#undef PVOP_CALL3
#undef PVOP_VCALL4
#undef PVOP_CALL4
extern void default_banner(void);
void native_pv_lock_init(void) __init;
#else
#ifdef CONFIG_X86_64
#ifdef CONFIG_PARAVIRT_XXL
#ifdef CONFIG_DEBUG_ENTRY
#define PARA_INDIRECT …
.macro PARA_IRQ_save_fl
ANNOTATE_RETPOLINE_SAFE;
call PARA_INDIRECT(pv_ops+PV_IRQ_save_fl);
.endm
#define SAVE_FLAGS …
#endif
#endif
#endif
#endif
#else
#define default_banner …
#ifndef __ASSEMBLY__
static inline void native_pv_lock_init(void)
{
}
#endif
#endif
#ifndef __ASSEMBLY__
#ifndef CONFIG_PARAVIRT_XXL
static inline void paravirt_enter_mmap(struct mm_struct *mm)
{
}
#endif
#ifndef CONFIG_PARAVIRT
static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
{
}
#endif
#ifndef CONFIG_PARAVIRT_SPINLOCKS
static inline void paravirt_set_cap(void)
{
}
#endif
#endif
#endif