KVM
|
#include <linux/kvm_host.h>
#include <asm/kvm_emulate.h>
#include <asm/kvm_hyp.h>
#include <asm/kvm_mmu.h>
#include <asm/kvm_pgtable.h>
#include <asm/kvm_pkvm.h>
#include <asm/stage2_pgtable.h>
#include <hyp/fault.h>
#include <nvhe/gfp.h>
#include <nvhe/memory.h>
#include <nvhe/mem_protect.h>
#include <nvhe/mm.h>
Go to the source code of this file.
Classes | |
struct | kvm_mem_range |
struct | pkvm_mem_transition |
struct | pkvm_mem_share |
struct | pkvm_mem_donation |
struct | check_walk_data |
Macros | |
#define | KVM_HOST_S2_FLAGS (KVM_PGTABLE_S2_NOFWB | KVM_PGTABLE_S2_IDMAP) |
#define | current_vm (*this_cpu_ptr(&__current_vm)) |
#define | host_stage2_try(fn, ...) |
Functions | |
static | DEFINE_PER_CPU (struct pkvm_hyp_vm *, __current_vm) |
static void | guest_lock_component (struct pkvm_hyp_vm *vm) |
static void | guest_unlock_component (struct pkvm_hyp_vm *vm) |
static void | host_lock_component (void) |
static void | host_unlock_component (void) |
static void | hyp_lock_component (void) |
static void | hyp_unlock_component (void) |
static void * | host_s2_zalloc_pages_exact (size_t size) |
static void * | host_s2_zalloc_page (void *pool) |
static void | host_s2_get_page (void *addr) |
static void | host_s2_put_page (void *addr) |
static void | host_s2_free_unlinked_table (void *addr, s8 level) |
static int | prepare_s2_pool (void *pgt_pool_base) |
static void | prepare_host_vtcr (void) |
static bool | host_stage2_force_pte_cb (u64 addr, u64 end, enum kvm_pgtable_prot prot) |
int | kvm_host_prepare_stage2 (void *pgt_pool_base) |
static bool | guest_stage2_force_pte_cb (u64 addr, u64 end, enum kvm_pgtable_prot prot) |
static void * | guest_s2_zalloc_pages_exact (size_t size) |
static void | guest_s2_free_pages_exact (void *addr, unsigned long size) |
static void * | guest_s2_zalloc_page (void *mc) |
static void | guest_s2_get_page (void *addr) |
static void | guest_s2_put_page (void *addr) |
static void | clean_dcache_guest_page (void *va, size_t size) |
static void | invalidate_icache_guest_page (void *va, size_t size) |
int | kvm_guest_prepare_stage2 (struct pkvm_hyp_vm *vm, void *pgd) |
void | reclaim_guest_pages (struct pkvm_hyp_vm *vm, struct kvm_hyp_memcache *mc) |
int | __pkvm_prot_finalize (void) |
static int | host_stage2_unmap_dev_all (void) |
static struct memblock_region * | find_mem_range (phys_addr_t addr, struct kvm_mem_range *range) |
bool | addr_is_memory (phys_addr_t phys) |
static bool | addr_is_allowed_memory (phys_addr_t phys) |
static bool | is_in_mem_range (u64 addr, struct kvm_mem_range *range) |
static bool | range_is_memory (u64 start, u64 end) |
static int | __host_stage2_idmap (u64 start, u64 end, enum kvm_pgtable_prot prot) |
static bool | range_included (struct kvm_mem_range *child, struct kvm_mem_range *parent) |
static int | host_stage2_adjust_range (u64 addr, struct kvm_mem_range *range) |
int | host_stage2_idmap_locked (phys_addr_t addr, u64 size, enum kvm_pgtable_prot prot) |
int | host_stage2_set_owner_locked (phys_addr_t addr, u64 size, u8 owner_id) |
static int | host_stage2_idmap (u64 addr) |
void | handle_host_mem_abort (struct kvm_cpu_context *host_ctxt) |
static int | __check_page_state_visitor (const struct kvm_pgtable_visit_ctx *ctx, enum kvm_pgtable_walk_flags visit) |
static int | check_page_state_range (struct kvm_pgtable *pgt, u64 addr, u64 size, struct check_walk_data *data) |
static enum pkvm_page_state | host_get_page_state (kvm_pte_t pte, u64 addr) |
static int | __host_check_page_state_range (u64 addr, u64 size, enum pkvm_page_state state) |
static int | __host_set_page_state_range (u64 addr, u64 size, enum pkvm_page_state state) |
static int | host_request_owned_transition (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static int | host_request_unshare (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static int | host_initiate_share (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static int | host_initiate_unshare (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static int | host_initiate_donation (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static bool | __host_ack_skip_pgtable_check (const struct pkvm_mem_transition *tx) |
static int | __host_ack_transition (u64 addr, const struct pkvm_mem_transition *tx, enum pkvm_page_state state) |
static int | host_ack_donation (u64 addr, const struct pkvm_mem_transition *tx) |
static int | host_complete_donation (u64 addr, const struct pkvm_mem_transition *tx) |
static enum pkvm_page_state | hyp_get_page_state (kvm_pte_t pte, u64 addr) |
static int | __hyp_check_page_state_range (u64 addr, u64 size, enum pkvm_page_state state) |
static int | hyp_request_donation (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static int | hyp_initiate_donation (u64 *completer_addr, const struct pkvm_mem_transition *tx) |
static bool | __hyp_ack_skip_pgtable_check (const struct pkvm_mem_transition *tx) |
static int | hyp_ack_share (u64 addr, const struct pkvm_mem_transition *tx, enum kvm_pgtable_prot perms) |
static int | hyp_ack_unshare (u64 addr, const struct pkvm_mem_transition *tx) |
static int | hyp_ack_donation (u64 addr, const struct pkvm_mem_transition *tx) |
static int | hyp_complete_share (u64 addr, const struct pkvm_mem_transition *tx, enum kvm_pgtable_prot perms) |
static int | hyp_complete_unshare (u64 addr, const struct pkvm_mem_transition *tx) |
static int | hyp_complete_donation (u64 addr, const struct pkvm_mem_transition *tx) |
static int | check_share (struct pkvm_mem_share *share) |
static int | __do_share (struct pkvm_mem_share *share) |
static int | do_share (struct pkvm_mem_share *share) |
static int | check_unshare (struct pkvm_mem_share *share) |
static int | __do_unshare (struct pkvm_mem_share *share) |
static int | do_unshare (struct pkvm_mem_share *share) |
static int | check_donation (struct pkvm_mem_donation *donation) |
static int | __do_donate (struct pkvm_mem_donation *donation) |
static int | do_donate (struct pkvm_mem_donation *donation) |
int | __pkvm_host_share_hyp (u64 pfn) |
int | __pkvm_host_unshare_hyp (u64 pfn) |
int | __pkvm_host_donate_hyp (u64 pfn, u64 nr_pages) |
int | __pkvm_hyp_donate_host (u64 pfn, u64 nr_pages) |
int | hyp_pin_shared_mem (void *from, void *to) |
void | hyp_unpin_shared_mem (void *from, void *to) |
int | __pkvm_host_share_ffa (u64 pfn, u64 nr_pages) |
int | __pkvm_host_unshare_ffa (u64 pfn, u64 nr_pages) |
Variables | |
struct host_mmu | host_mmu |
static struct hyp_pool | host_s2_pool |
#define current_vm (*this_cpu_ptr(&__current_vm)) |
Definition at line 29 of file mem_protect.c.
#define host_stage2_try | ( | fn, | |
... | |||
) |
Definition at line 423 of file mem_protect.c.
#define KVM_HOST_S2_FLAGS (KVM_PGTABLE_S2_NOFWB | KVM_PGTABLE_S2_IDMAP) |
Definition at line 22 of file mem_protect.c.
|
static |
Definition at line 581 of file mem_protect.c.
|
static |
Definition at line 1032 of file mem_protect.c.
|
static |
Definition at line 859 of file mem_protect.c.
|
static |
Definition at line 946 of file mem_protect.c.
|
static |
|
static |
Definition at line 688 of file mem_protect.c.
|
static |
Definition at line 612 of file mem_protect.c.
|
static |
Definition at line 624 of file mem_protect.c.
|
inlinestatic |
Definition at line 410 of file mem_protect.c.
|
static |
|
static |
Definition at line 720 of file mem_protect.c.
int __pkvm_host_donate_hyp | ( | u64 | pfn, |
u64 | nr_pages | ||
) |
Definition at line 1152 of file mem_protect.c.
int __pkvm_host_share_ffa | ( | u64 | pfn, |
u64 | nr_pages | ||
) |
Definition at line 1261 of file mem_protect.c.
int __pkvm_host_share_hyp | ( | u64 | pfn | ) |
Definition at line 1086 of file mem_protect.c.
int __pkvm_host_unshare_ffa | ( | u64 | pfn, |
u64 | nr_pages | ||
) |
Definition at line 1284 of file mem_protect.c.
int __pkvm_host_unshare_hyp | ( | u64 | pfn | ) |
Definition at line 1119 of file mem_protect.c.
int __pkvm_hyp_donate_host | ( | u64 | pfn, |
u64 | nr_pages | ||
) |
Definition at line 1184 of file mem_protect.c.
int __pkvm_prot_finalize | ( | void | ) |
|
static |
Definition at line 385 of file mem_protect.c.
bool addr_is_memory | ( | phys_addr_t | phys | ) |
Definition at line 378 of file mem_protect.c.
|
static |
Definition at line 998 of file mem_protect.c.
|
static |
Definition at line 589 of file mem_protect.c.
|
static |
Definition at line 824 of file mem_protect.c.
|
static |
Definition at line 914 of file mem_protect.c.
|
static |
Definition at line 220 of file mem_protect.c.
|
static |
|
static |
Definition at line 1075 of file mem_protect.c.
|
static |
Definition at line 903 of file mem_protect.c.
|
static |
Definition at line 987 of file mem_protect.c.
|
static |
|
static |
Definition at line 31 of file mem_protect.c.
|
static |
Definition at line 180 of file mem_protect.c.
|
static |
Definition at line 210 of file mem_protect.c.
|
static |
Definition at line 215 of file mem_protect.c.
|
static |
Definition at line 189 of file mem_protect.c.
|
static |
Definition at line 170 of file mem_protect.c.
|
static |
|
static |
Definition at line 37 of file mem_protect.c.
void handle_host_mem_abort | ( | struct kvm_cpu_context * | host_ctxt | ) |
Definition at line 529 of file mem_protect.c.
|
static |
Definition at line 699 of file mem_protect.c.
|
static |
Definition at line 704 of file mem_protect.c.
|
static |
Definition at line 589 of file mem_protect.c.
|
static |
Definition at line 672 of file mem_protect.c.
|
static |
Definition at line 652 of file mem_protect.c.
|
static |
Definition at line 662 of file mem_protect.c.
|
static |
Definition at line 43 of file mem_protect.c.
|
static |
Definition at line 632 of file mem_protect.c.
|
static |
Definition at line 642 of file mem_protect.c.
|
static |
Definition at line 94 of file mem_protect.c.
|
static |
Definition at line 84 of file mem_protect.c.
|
static |
Definition at line 89 of file mem_protect.c.
|
static |
Definition at line 79 of file mem_protect.c.
|
static |
Definition at line 63 of file mem_protect.c.
|
static |
Definition at line 442 of file mem_protect.c.
|
static |
Definition at line 486 of file mem_protect.c.
|
static |
Definition at line 508 of file mem_protect.c.
int host_stage2_idmap_locked | ( | phys_addr_t | addr, |
u64 | size, | ||
enum kvm_pgtable_prot | prot | ||
) |
Definition at line 474 of file mem_protect.c.
int host_stage2_set_owner_locked | ( | phys_addr_t | addr, |
u64 | size, | ||
u8 | owner_id | ||
) |
Definition at line 480 of file mem_protect.c.
|
static |
Definition at line 326 of file mem_protect.c.
|
static |
Definition at line 48 of file mem_protect.c.
|
static |
Definition at line 787 of file mem_protect.c.
|
static |
Definition at line 759 of file mem_protect.c.
|
static |
Definition at line 773 of file mem_protect.c.
|
static |
Definition at line 815 of file mem_protect.c.
|
static |
Definition at line 797 of file mem_protect.c.
|
static |
Definition at line 807 of file mem_protect.c.
|
static |
Definition at line 704 of file mem_protect.c.
|
static |
Definition at line 742 of file mem_protect.c.
|
static |
Definition at line 53 of file mem_protect.c.
int hyp_pin_shared_mem | ( | void * | from, |
void * | to | ||
) |
Definition at line 1216 of file mem_protect.c.
|
static |
Definition at line 732 of file mem_protect.c.
|
static |
Definition at line 58 of file mem_protect.c.
void hyp_unpin_shared_mem | ( | void * | from, |
void * | to | ||
) |
Definition at line 1246 of file mem_protect.c.
|
static |
Definition at line 226 of file mem_protect.c.
|
static |
int kvm_guest_prepare_stage2 | ( | struct pkvm_hyp_vm * | vm, |
void * | pgd | ||
) |
Definition at line 232 of file mem_protect.c.
int kvm_host_prepare_stage2 | ( | void * | pgt_pool_base | ) |
Definition at line 138 of file mem_protect.c.
|
static |
Definition at line 124 of file mem_protect.c.
|
static |
Definition at line 99 of file mem_protect.c.
|
inlinestatic |
|
static |
Definition at line 400 of file mem_protect.c.
void reclaim_guest_pages | ( | struct pkvm_hyp_vm * | vm, |
struct kvm_hyp_memcache * | mc | ||
) |
Definition at line 269 of file mem_protect.c.
Definition at line 1 of file mem_protect.c.
|
static |
Definition at line 1 of file mem_protect.c.