KVM
Macros | Functions
kvm_mm.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define KVM_MMU_LOCK_INIT(kvm)   spin_lock_init(&(kvm)->mmu_lock)
 
#define KVM_MMU_LOCK(kvm)   spin_lock(&(kvm)->mmu_lock)
 
#define KVM_MMU_UNLOCK(kvm)   spin_unlock(&(kvm)->mmu_lock)
 

Functions

kvm_pfn_t hva_to_pfn (unsigned long addr, bool atomic, bool interruptible, bool *async, bool write_fault, bool *writable)
 
static void gfn_to_pfn_cache_invalidate_start (struct kvm *kvm, unsigned long start, unsigned long end, bool may_block)
 
static void kvm_gmem_init (struct module *module)
 
static int kvm_gmem_bind (struct kvm *kvm, struct kvm_memory_slot *slot, unsigned int fd, loff_t offset)
 
static void kvm_gmem_unbind (struct kvm_memory_slot *slot)
 

Macro Definition Documentation

◆ KVM_MMU_LOCK

#define KVM_MMU_LOCK (   kvm)    spin_lock(&(kvm)->mmu_lock)

Definition at line 19 of file kvm_mm.h.

◆ KVM_MMU_LOCK_INIT

#define KVM_MMU_LOCK_INIT (   kvm)    spin_lock_init(&(kvm)->mmu_lock)

Definition at line 18 of file kvm_mm.h.

◆ KVM_MMU_UNLOCK

#define KVM_MMU_UNLOCK (   kvm)    spin_unlock(&(kvm)->mmu_lock)

Definition at line 20 of file kvm_mm.h.

Function Documentation

◆ gfn_to_pfn_cache_invalidate_start()

static void gfn_to_pfn_cache_invalidate_start ( struct kvm *  kvm,
unsigned long  start,
unsigned long  end,
bool  may_block 
)
inlinestatic

Definition at line 32 of file kvm_mm.h.

36 {
37 }

◆ hva_to_pfn()

kvm_pfn_t hva_to_pfn ( unsigned long  addr,
bool  atomic,
bool  interruptible,
bool *  async,
bool  write_fault,
bool *  writable 
)

Definition at line 2980 of file kvm_main.c.

2982 {
2983  struct vm_area_struct *vma;
2984  kvm_pfn_t pfn;
2985  int npages, r;
2986 
2987  /* we can do it either atomically or asynchronously, not both */
2988  BUG_ON(atomic && async);
2989 
2990  if (hva_to_pfn_fast(addr, write_fault, writable, &pfn))
2991  return pfn;
2992 
2993  if (atomic)
2994  return KVM_PFN_ERR_FAULT;
2995 
2996  npages = hva_to_pfn_slow(addr, async, write_fault, interruptible,
2997  writable, &pfn);
2998  if (npages == 1)
2999  return pfn;
3000  if (npages == -EINTR)
3001  return KVM_PFN_ERR_SIGPENDING;
3002 
3003  mmap_read_lock(current->mm);
3004  if (npages == -EHWPOISON ||
3005  (!async && check_user_page_hwpoison(addr))) {
3006  pfn = KVM_PFN_ERR_HWPOISON;
3007  goto exit;
3008  }
3009 
3010 retry:
3011  vma = vma_lookup(current->mm, addr);
3012 
3013  if (vma == NULL)
3014  pfn = KVM_PFN_ERR_FAULT;
3015  else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
3016  r = hva_to_pfn_remapped(vma, addr, write_fault, writable, &pfn);
3017  if (r == -EAGAIN)
3018  goto retry;
3019  if (r < 0)
3020  pfn = KVM_PFN_ERR_FAULT;
3021  } else {
3022  if (async && vma_is_valid(vma, write_fault))
3023  *async = true;
3024  pfn = KVM_PFN_ERR_FAULT;
3025  }
3026 exit:
3027  mmap_read_unlock(current->mm);
3028  return pfn;
3029 }
static int hva_to_pfn_remapped(struct vm_area_struct *vma, unsigned long addr, bool write_fault, bool *writable, kvm_pfn_t *p_pfn)
Definition: kvm_main.c:2897
static bool vma_is_valid(struct vm_area_struct *vma, bool write_fault)
Definition: kvm_main.c:2876
static int check_user_page_hwpoison(unsigned long addr)
Definition: kvm_main.c:2787
static int hva_to_pfn_slow(unsigned long addr, bool *async, bool write_fault, bool interruptible, bool *writable, kvm_pfn_t *pfn)
Definition: kvm_main.c:2828
static bool hva_to_pfn_fast(unsigned long addr, bool write_fault, bool *writable, kvm_pfn_t *pfn)
Definition: kvm_main.c:2800
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvm_gmem_bind()

static int kvm_gmem_bind ( struct kvm *  kvm,
struct kvm_memory_slot *  slot,
unsigned int  fd,
loff_t  offset 
)
inlinestatic

Definition at line 52 of file kvm_mm.h.

55 {
56  WARN_ON_ONCE(1);
57  return -EIO;
58 }

◆ kvm_gmem_init()

static void kvm_gmem_init ( struct module *  module)
inlinestatic

Definition at line 47 of file kvm_mm.h.

48 {
49 
50 }

◆ kvm_gmem_unbind()

static void kvm_gmem_unbind ( struct kvm_memory_slot *  slot)
inlinestatic

Definition at line 60 of file kvm_mm.h.

61 {
62  WARN_ON_ONCE(1);
63 }