#include <asm/kvm_pgtable.h>
#include <asm/spectre.h>
#include <linux/memblock.h>
#include <linux/types.h>
#include <nvhe/memory.h>
#include <nvhe/spinlock.h>
Go to the source code of this file.
◆ __pkvm_create_private_mapping()
int __pkvm_create_private_mapping |
( |
phys_addr_t |
phys, |
|
|
size_t |
size, |
|
|
enum kvm_pgtable_prot |
prot, |
|
|
unsigned long * |
haddr |
|
) |
| |
Definition at line 93 of file mm.c.
100 size = PAGE_ALIGN(
size + offset_in_page(phys));
109 *haddr = addr + offset_in_page(phys);
static int __pkvm_create_mappings(unsigned long start, unsigned long size, unsigned long phys, enum kvm_pgtable_prot prot)
int pkvm_alloc_private_va_range(size_t size, unsigned long *haddr)
◆ hyp_back_vmemmap()
int hyp_back_vmemmap |
( |
phys_addr_t |
back | ) |
|
Definition at line 149 of file mm.c.
151 unsigned long i, start,
size,
end = 0;
162 start = max(start,
end);
static void * hyp_phys_to_virt(phys_addr_t phys)
#define hyp_phys_to_page(phys)
struct memblock_region hyp_memory[HYP_MEMBLOCK_REGIONS]
unsigned int hyp_memblock_nr
◆ hyp_create_idmap()
int hyp_create_idmap |
( |
u32 |
hyp_va_bits | ) |
|
Definition at line 328 of file mm.c.
330 unsigned long start,
end;
333 start = ALIGN_DOWN(start, PAGE_SIZE);
336 end = ALIGN(
end, PAGE_SIZE);
static phys_addr_t hyp_virt_to_phys(void *addr)
◆ hyp_create_pcpu_fixmap()
int hyp_create_pcpu_fixmap |
( |
void |
| ) |
|
Definition at line 305 of file mm.c.
307 unsigned long addr, i;
316 __hyp_pa(__hyp_bss_start), PAGE_HYP);
unsigned long hyp_nr_cpus
static int create_fixmap_slot(u64 addr, u64 cpu)
struct kvm_pgtable pkvm_pgtable
int kvm_pgtable_hyp_map(struct kvm_pgtable *pgt, u64 addr, u64 size, u64 phys, enum kvm_pgtable_prot prot)
◆ hyp_fixmap_map()
void* hyp_fixmap_map |
( |
phys_addr_t |
phys | ) |
|
Definition at line 232 of file mm.c.
238 pte &= ~kvm_phys_to_pte(KVM_PHYS_INVALID);
239 pte |= kvm_phys_to_pte(phys) | KVM_PTE_VALID;
240 WRITE_ONCE(*
ptep, pte);
243 return (
void *)slot->
addr;
◆ hyp_fixmap_unmap()
void hyp_fixmap_unmap |
( |
void |
| ) |
|
Definition at line 268 of file mm.c.
static void fixmap_clear_slot(struct hyp_fixmap_slot *slot)
◆ hyp_map_vectors()
int hyp_map_vectors |
( |
void |
| ) |
|
Definition at line 210 of file mm.c.
213 unsigned long bp_base;
216 if (!kvm_system_needs_idmapped_vectors()) {
221 phys = __hyp_pa(__bp_harden_hyp_vecs);
223 PAGE_HYP_EXEC, &bp_base);
int __pkvm_create_private_mapping(phys_addr_t phys, size_t size, enum kvm_pgtable_prot prot, unsigned long *haddr)
static void * __hyp_bp_vect_base
◆ pkvm_alloc_private_va_range()
int pkvm_alloc_private_va_range |
( |
size_t |
size, |
|
|
unsigned long * |
haddr |
|
) |
| |
pkvm_alloc_private_va_range - Allocates a private VA range. @size: The size of the VA range to reserve. @haddr: The hypervisor virtual start address of the allocation.
The private virtual address (VA) range is allocated above __io_map_base and aligned based on the order of @size.
Return: 0 on success or negative error code on failure.
Definition at line 78 of file mm.c.
hyp_spinlock_t pkvm_pgd_lock
static int __pkvm_alloc_private_va_range(unsigned long start, size_t size)
static void hyp_spin_unlock(hyp_spinlock_t *lock)
static void hyp_spin_lock(hyp_spinlock_t *lock)
◆ pkvm_cpu_set_vector()
int pkvm_cpu_set_vector |
( |
enum arm64_hyp_spectre_vector |
slot | ) |
|
Definition at line 182 of file mm.c.
187 case HYP_VECTOR_DIRECT: {
188 vector = __kvm_hyp_vector;
191 case HYP_VECTOR_SPECTRE_DIRECT: {
192 vector = __bp_harden_hyp_vecs;
195 case HYP_VECTOR_INDIRECT:
196 case HYP_VECTOR_SPECTRE_INDIRECT: {
204 vector = __kvm_vector_slot2addr(vector, slot);
205 *this_cpu_ptr(&kvm_hyp_vector) = (
unsigned long)vector;
◆ pkvm_create_mappings()
int pkvm_create_mappings |
( |
void * |
from, |
|
|
void * |
to, |
|
|
enum kvm_pgtable_prot |
prot |
|
) |
| |
Definition at line 138 of file mm.c.
int pkvm_create_mappings_locked(void *from, void *to, enum kvm_pgtable_prot prot)
◆ pkvm_create_mappings_locked()
int pkvm_create_mappings_locked |
( |
void * |
from, |
|
|
void * |
to, |
|
|
enum kvm_pgtable_prot |
prot |
|
) |
| |
Definition at line 113 of file mm.c.
115 unsigned long start = (
unsigned long)from;
116 unsigned long end = (
unsigned long)to;
117 unsigned long virt_addr;
122 start = start & PAGE_MASK;
125 for (virt_addr = start; virt_addr <
end; virt_addr += PAGE_SIZE) {
static void hyp_assert_lock_held(hyp_spinlock_t *lock)
◆ pkvm_create_stack()
int pkvm_create_stack |
( |
phys_addr_t |
phys, |
|
|
unsigned long * |
haddr |
|
) |
| |
Definition at line 353 of file mm.c.
355 unsigned long addr, prev_base;
366 size = PAGE_SIZE * 2;
381 PAGE_SIZE, phys, PAGE_HYP);
387 *haddr = addr +
size;
◆ pkvm_pgd_lock
Definition at line 22 of file mm.c.
◆ pkvm_pgtable
struct kvm_pgtable pkvm_pgtable |
|
extern |
Definition at line 1 of file mm.c.