xref: /kvm-unit-tests/lib/vmalloc.h (revision dee4223b46b90103b2fd953764e3e430802a9624)
1efd8e5aaSPaolo Bonzini #ifndef VMALLOC_H
2efd8e5aaSPaolo Bonzini #define VMALLOC_H 1
3efd8e5aaSPaolo Bonzini 
4dcda215bSPaolo Bonzini #include <asm/page.h>
5dcda215bSPaolo Bonzini 
6*dee4223bSClaudio Imbrenda /* Allocate consecutive virtual pages (without backing) */
7efd8e5aaSPaolo Bonzini extern void *alloc_vpages(ulong nr);
8*dee4223bSClaudio Imbrenda /* Allocate one virtual page (without backing) */
9efd8e5aaSPaolo Bonzini extern void *alloc_vpage(void);
10*dee4223bSClaudio Imbrenda /* Set the top of the virtual address space */
11efd8e5aaSPaolo Bonzini extern void init_alloc_vpage(void *top);
12*dee4223bSClaudio Imbrenda /* Set up the virtual allocator; also sets up the page allocator if needed */
13da7eceb3SThomas Huth extern void setup_vm(void);
14937e2392SPaolo Bonzini 
15*dee4223bSClaudio Imbrenda /* Set up paging */
16937e2392SPaolo Bonzini extern void *setup_mmu(phys_addr_t top);
17*dee4223bSClaudio Imbrenda /* Walk the page table and resolve the virtual address to a physical address */
18c41e032aSPaolo Bonzini extern phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *virt);
19*dee4223bSClaudio Imbrenda /* Map the virtual address to the physical address for the given page tables */
20dcda215bSPaolo Bonzini extern pteval_t *install_page(pgd_t *pgtable, phys_addr_t phys, void *virt);
21dcda215bSPaolo Bonzini 
22*dee4223bSClaudio Imbrenda /* Map consecutive physical pages */
23dcda215bSPaolo Bonzini void *vmap(phys_addr_t phys, size_t size);
24efd8e5aaSPaolo Bonzini 
25efd8e5aaSPaolo Bonzini #endif
26