Paolo Bonzini | efd8e5a | 2017-10-22 15:19:32 +0200 | [diff] [blame] | 1 | #ifndef VMALLOC_H |
| 2 | #define VMALLOC_H 1 |
| 3 | |
Paolo Bonzini | dcda215 | 2017-10-23 15:00:53 +0200 | [diff] [blame] | 4 | #include <asm/page.h> |
| 5 | |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 6 | /* Allocate consecutive virtual pages (without backing) */ |
Paolo Bonzini | efd8e5a | 2017-10-22 15:19:32 +0200 | [diff] [blame] | 7 | extern void *alloc_vpages(ulong nr); |
Claudio Imbrenda | 0d622fc | 2020-07-06 18:43:24 +0200 | [diff] [blame] | 8 | /* Allocate consecutive and aligned virtual pages (without backing) */ |
| 9 | extern void *alloc_vpages_aligned(ulong nr, unsigned int alignment_order); |
| 10 | |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 11 | /* Allocate one virtual page (without backing) */ |
Paolo Bonzini | efd8e5a | 2017-10-22 15:19:32 +0200 | [diff] [blame] | 12 | extern void *alloc_vpage(void); |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 13 | /* Set the top of the virtual address space */ |
Paolo Bonzini | efd8e5a | 2017-10-22 15:19:32 +0200 | [diff] [blame] | 14 | extern void init_alloc_vpage(void *top); |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 15 | /* Set up the virtual allocator; also sets up the page allocator if needed */ |
Thomas Huth | da7eceb | 2018-04-03 10:10:52 +0200 | [diff] [blame] | 16 | extern void setup_vm(void); |
Paolo Bonzini | 937e239 | 2017-10-23 04:13:30 +0200 | [diff] [blame] | 17 | |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 18 | /* Set up paging */ |
Paolo Bonzini | 937e239 | 2017-10-23 04:13:30 +0200 | [diff] [blame] | 19 | extern void *setup_mmu(phys_addr_t top); |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 20 | /* Walk the page table and resolve the virtual address to a physical address */ |
Paolo Bonzini | c41e032 | 2017-10-23 13:03:16 +0200 | [diff] [blame] | 21 | extern phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *virt); |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 22 | /* Map the virtual address to the physical address for the given page tables */ |
Paolo Bonzini | dcda215 | 2017-10-23 15:00:53 +0200 | [diff] [blame] | 23 | extern pteval_t *install_page(pgd_t *pgtable, phys_addr_t phys, void *virt); |
| 24 | |
Claudio Imbrenda | dee4223 | 2020-06-22 18:21:38 +0200 | [diff] [blame] | 25 | /* Map consecutive physical pages */ |
Paolo Bonzini | dcda215 | 2017-10-23 15:00:53 +0200 | [diff] [blame] | 26 | void *vmap(phys_addr_t phys, size_t size); |
Paolo Bonzini | efd8e5a | 2017-10-22 15:19:32 +0200 | [diff] [blame] | 27 | |
| 28 | #endif |