KVM
Classes | Macros | Functions | Variables
memory.h File Reference
#include <asm/kvm_mmu.h>
#include <asm/page.h>
#include <linux/types.h>
Include dependency graph for memory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hyp_page
 

Macros

#define hyp_vmemmap   ((struct hyp_page *)__hyp_vmemmap)
 
#define __hyp_va(phys)   ((void *)((phys_addr_t)(phys) - hyp_physvirt_offset))
 
#define hyp_phys_to_pfn(phys)   ((phys) >> PAGE_SHIFT)
 
#define hyp_pfn_to_phys(pfn)   ((phys_addr_t)((pfn) << PAGE_SHIFT))
 
#define hyp_phys_to_page(phys)   (&hyp_vmemmap[hyp_phys_to_pfn(phys)])
 
#define hyp_virt_to_page(virt)   hyp_phys_to_page(__hyp_pa(virt))
 
#define hyp_virt_to_pfn(virt)   hyp_phys_to_pfn(__hyp_pa(virt))
 
#define hyp_page_to_pfn(page)   ((struct hyp_page *)(page) - hyp_vmemmap)
 
#define hyp_page_to_phys(page)   hyp_pfn_to_phys((hyp_page_to_pfn(page)))
 
#define hyp_page_to_virt(page)   __hyp_va(hyp_page_to_phys(page))
 
#define hyp_page_to_pool(page)   (((struct hyp_page *)page)->pool)
 

Functions

static void * hyp_phys_to_virt (phys_addr_t phys)
 
static phys_addr_t hyp_virt_to_phys (void *addr)
 
static int hyp_page_count (void *addr)
 
static void hyp_page_ref_inc (struct hyp_page *p)
 
static void hyp_page_ref_dec (struct hyp_page *p)
 
static int hyp_page_ref_dec_and_test (struct hyp_page *p)
 
static void hyp_set_page_refcounted (struct hyp_page *p)
 

Variables

u64 __hyp_vmemmap
 

Macro Definition Documentation

◆ __hyp_va

#define __hyp_va (   phys)    ((void *)((phys_addr_t)(phys) - hyp_physvirt_offset))

Definition at line 18 of file memory.h.

◆ hyp_page_to_pfn

#define hyp_page_to_pfn (   page)    ((struct hyp_page *)(page) - hyp_vmemmap)

Definition at line 36 of file memory.h.

◆ hyp_page_to_phys

#define hyp_page_to_phys (   page)    hyp_pfn_to_phys((hyp_page_to_pfn(page)))

Definition at line 37 of file memory.h.

◆ hyp_page_to_pool

#define hyp_page_to_pool (   page)    (((struct hyp_page *)page)->pool)

Definition at line 39 of file memory.h.

◆ hyp_page_to_virt

#define hyp_page_to_virt (   page)    __hyp_va(hyp_page_to_phys(page))

Definition at line 38 of file memory.h.

◆ hyp_pfn_to_phys

#define hyp_pfn_to_phys (   pfn)    ((phys_addr_t)((pfn) << PAGE_SHIFT))

Definition at line 31 of file memory.h.

◆ hyp_phys_to_page

#define hyp_phys_to_page (   phys)    (&hyp_vmemmap[hyp_phys_to_pfn(phys)])

Definition at line 32 of file memory.h.

◆ hyp_phys_to_pfn

#define hyp_phys_to_pfn (   phys)    ((phys) >> PAGE_SHIFT)

Definition at line 30 of file memory.h.

◆ hyp_virt_to_page

#define hyp_virt_to_page (   virt)    hyp_phys_to_page(__hyp_pa(virt))

Definition at line 33 of file memory.h.

◆ hyp_virt_to_pfn

#define hyp_virt_to_pfn (   virt)    hyp_phys_to_pfn(__hyp_pa(virt))

Definition at line 34 of file memory.h.

◆ hyp_vmemmap

#define hyp_vmemmap   ((struct hyp_page *)__hyp_vmemmap)

Definition at line 16 of file memory.h.

Function Documentation

◆ hyp_page_count()

static int hyp_page_count ( void *  addr)
inlinestatic

Definition at line 45 of file memory.h.

46 {
47  struct hyp_page *p = hyp_virt_to_page(addr);
48 
49  return p->refcount;
50 }
#define hyp_virt_to_page(virt)
Definition: memory.h:33
unsigned short refcount
Definition: memory.h:11
Here is the caller graph for this function:

◆ hyp_page_ref_dec()

static void hyp_page_ref_dec ( struct hyp_page p)
inlinestatic

Definition at line 58 of file memory.h.

59 {
60  BUG_ON(!p->refcount);
61  p->refcount--;
62 }
Here is the caller graph for this function:

◆ hyp_page_ref_dec_and_test()

static int hyp_page_ref_dec_and_test ( struct hyp_page p)
inlinestatic

Definition at line 64 of file memory.h.

65 {
67  return (p->refcount == 0);
68 }
static void hyp_page_ref_dec(struct hyp_page *p)
Definition: memory.h:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hyp_page_ref_inc()

static void hyp_page_ref_inc ( struct hyp_page p)
inlinestatic

Definition at line 52 of file memory.h.

53 {
54  BUG_ON(p->refcount == USHRT_MAX);
55  p->refcount++;
56 }
Here is the caller graph for this function:

◆ hyp_phys_to_virt()

static void* hyp_phys_to_virt ( phys_addr_t  phys)
inlinestatic

Definition at line 20 of file memory.h.

21 {
22  return __hyp_va(phys);
23 }
#define __hyp_va(phys)
Definition: memory.h:18
Here is the caller graph for this function:

◆ hyp_set_page_refcounted()

static void hyp_set_page_refcounted ( struct hyp_page p)
inlinestatic

Definition at line 70 of file memory.h.

71 {
72  BUG_ON(p->refcount);
73  p->refcount = 1;
74 }
Here is the caller graph for this function:

◆ hyp_virt_to_phys()

static phys_addr_t hyp_virt_to_phys ( void *  addr)
inlinestatic

Definition at line 25 of file memory.h.

26 {
27  return __hyp_pa(addr);
28 }
Here is the caller graph for this function:

Variable Documentation

◆ __hyp_vmemmap

u64 __hyp_vmemmap
extern

Definition at line 10 of file page_alloc.c.