Lines Matching +full:enum +full:- +full:as +full:- +full:flags
1 // SPDX-License-Identifier: GPL-2.0-only
17 * The largest supported block sizes for KVM (no 52-bit PA support):
18 * - 4K (level 1): 1GB
19 * - 16K (level 2): 32MB
20 * - 64K (level 2): 512MB
45 #define KVM_PHYS_INVALID (-1ULL)
114 * struct kvm_pgtable_mm_ops - Memory management callbacks.
156 * enum kvm_pgtable_stage2_flags - Stage-2 page-table flags.
157 * @KVM_PGTABLE_S2_NOFWB: Don't enforce Normal-WB even if the CPUs have
161 enum kvm_pgtable_stage2_flags {
167 * enum kvm_pgtable_prot - Page-table permissions and attributes.
177 enum kvm_pgtable_prot {
202 enum kvm_pgtable_prot prot);
205 * enum kvm_pgtable_walk_flags - Flags to control a depth-first page-table walk.
212 * @KVM_PGTABLE_WALK_SHARED: Indicates the page-tables may be shared
214 * @KVM_PGTABLE_WALK_HANDLE_FAULT: Indicates the page-table walk was
217 * without Break-before-make's
223 enum kvm_pgtable_walk_flags {
242 enum kvm_pgtable_walk_flags flags; member
246 enum kvm_pgtable_walk_flags visit);
250 return ctx->flags & KVM_PGTABLE_WALK_SHARED; in kvm_pgtable_walk_shared()
254 * struct kvm_pgtable_walker - Hook into a page-table walk.
257 * @flags: Bitwise-OR of flags to identify the entry types on which to
263 const enum kvm_pgtable_walk_flags flags; member
267 * RCU cannot be used in a non-kernel context such as the hyp. As such, page
269 * synchronization mechanisms (such as a spinlock).
285 * non-shared table walkers are allowed in the hypervisor. in kvm_pgtable_walk_begin()
287 if (walker->flags & KVM_PGTABLE_WALK_SHARED) in kvm_pgtable_walk_begin()
288 return -EPERM; in kvm_pgtable_walk_begin()
307 return rcu_dereference_check(pteref, !(walker->flags & KVM_PGTABLE_WALK_SHARED)); in kvm_dereference_pteref()
312 if (walker->flags & KVM_PGTABLE_WALK_SHARED) in kvm_pgtable_walk_begin()
320 if (walker->flags & KVM_PGTABLE_WALK_SHARED) in kvm_pgtable_walk_end()
332 * struct kvm_pgtable - KVM page-table.
334 * @start_level: Level at which the page-table walk starts.
335 * @pgd: Pointer to the first top-level entry of the page-table.
337 * @mmu: Stage-2 KVM MMU struct. Unused for stage-1 page-tables.
338 * @flags: Stage-2 page-table flags.
348 /* Stage-2 only */
350 enum kvm_pgtable_stage2_flags flags; member
355 * kvm_pgtable_hyp_init() - Initialise a hypervisor stage-1 page-table.
356 * @pgt: Uninitialised page-table structure to initialise.
366 * kvm_pgtable_hyp_destroy() - Destroy an unused hypervisor stage-1 page-table.
367 * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init().
369 * The page-table is assumed to be unreachable by any hardware walkers prior
375 * kvm_pgtable_hyp_map() - Install a mapping in a hypervisor stage-1 page-table.
376 * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init().
382 * The offset of @addr within a page is ignored, @size is rounded-up to
383 * the next page boundary and @phys is rounded-down to the previous page
394 enum kvm_pgtable_prot prot);
397 * kvm_pgtable_hyp_unmap() - Remove a mapping from a hypervisor stage-1 page-table.
398 * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init().
402 * The offset of @addr within a page is ignored, @size is rounded-up to
403 * the next page boundary and @phys is rounded-down to the previous page
406 * TLB invalidation is performed for each page-table entry cleared during the
407 * unmapping operation and the reference count for the page-table page
410 * invalid page-table entry or a valid block mapping which maps beyond the range
418 * kvm_get_vtcr() - Helper to construct VTCR_EL2
425 * except for Hardware Management of Access Flags. HA Flag is set
426 * unconditionally on all CPUs, as it is safe to run with or without
434 * kvm_pgtable_stage2_pgd_size() - Helper to compute size of a stage-2 PGD
437 * Return: the size (in bytes) of the stage-2 PGD
442 * __kvm_pgtable_stage2_init() - Initialise a guest stage-2 page-table.
443 * @pgt: Uninitialised page-table structure to initialise.
446 * @flags: Stage-2 configuration flags.
454 enum kvm_pgtable_stage2_flags flags,
461 * kvm_pgtable_stage2_destroy() - Destroy an unused guest stage-2 page-table.
462 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
464 * The page-table is assumed to be unreachable by any hardware walkers prior
470 * kvm_pgtable_stage2_free_unlinked() - Free an unlinked stage-2 paging structure.
472 * @pgtable: Unlinked stage-2 paging structure to be freed.
473 * @level: Level of the stage-2 paging structure to be freed.
475 * The page-table is assumed to be unreachable by any hardware walkers prior to
481 * kvm_pgtable_stage2_create_unlinked() - Create an unlinked stage-2 paging structure.
482 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
484 * @level: Starting level of the stage-2 paging structure to be created.
486 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
487 * page-table pages.
490 * Returns an unlinked page-table tree. This new page-table tree is
492 * therefore unreachableby the hardware page-table walker. No TLB
498 * Return: The fully populated (unlinked) stage-2 paging structure, or
503 enum kvm_pgtable_prot prot,
507 * kvm_pgtable_stage2_map() - Install a mapping in a guest stage-2 page-table.
508 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
513 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
514 * page-table pages.
515 * @flags: Flags to control the page-table walk (ex. a shared walk)
517 * The offset of @addr within a page is ignored, @size is rounded-up to
518 * the next page boundary and @phys is rounded-down to the previous page
530 * existing block mappings, relying on page-faults to fault back areas outside
536 u64 phys, enum kvm_pgtable_prot prot,
537 void *mc, enum kvm_pgtable_walk_flags flags);
540 * kvm_pgtable_stage2_set_owner() - Unmap and annotate pages in the IPA space to
542 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
545 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
546 * page-table pages.
549 * By default, all page-tables are owned by identifier 0. This function can be
550 * used to mark portions of the IPA space as owned by other entities. When a
551 * stage 2 is used with identity-mappings, these annotations allow to use the
552 * page-table data structure as a simple rmap.
560 * kvm_pgtable_stage2_unmap() - Remove a mapping from a guest stage-2 page-table.
561 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
565 * The offset of @addr within a page is ignored and @size is rounded-up to
568 * TLB invalidation is performed for each page-table entry cleared during the
569 * unmapping operation and the reference count for the page-table page
579 * kvm_pgtable_stage2_wrprotect() - Write-protect guest stage-2 address range
581 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
582 * @addr: Intermediate physical address from which to write-protect,
585 * The offset of @addr within a page is ignored and @size is rounded-up to
597 * kvm_pgtable_stage2_mkyoung() - Set the access flag in a page-table entry.
598 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
599 * @addr: Intermediate physical address to identify the page-table entry.
603 * If there is a valid, leaf page-table entry used to translate @addr, then
606 * Return: The old page-table entry prior to setting the flag, 0 on failure.
611 * kvm_pgtable_stage2_test_clear_young() - Test and optionally clear the access
612 * flag in a page-table entry.
613 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
614 * @addr: Intermediate physical address to identify the page-table entry.
621 * page-table entry used to translate the range [@addr, @addr + @size).
633 * kvm_pgtable_stage2_relax_perms() - Relax the permissions enforced by a
634 * page-table entry.
635 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
636 * @addr: Intermediate physical address to identify the page-table entry.
641 * If there is a valid, leaf page-table entry used to translate @addr, then
650 enum kvm_pgtable_prot prot);
653 * kvm_pgtable_stage2_flush_range() - Clean and invalidate data cache to Point
654 * of Coherency for guest stage-2 address
656 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
660 * The offset of @addr within a page is ignored and @size is rounded-up to
668 * kvm_pgtable_stage2_split() - Split a range of huge pages into leaf PTEs pointing
670 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init().
673 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
674 * page-table pages.
680 * kvm_pgtable_stage2_split() is best effort: it tries to break as many
681 * blocks in the input range as allowed by @mc_capacity.
687 * kvm_pgtable_walk() - Walk a page-table.
688 * @pgt: Page-table structure initialised by kvm_pgtable_*_init().
693 * The offset of @addr within a page is ignored and @size is rounded-up to
696 * The walker will walk the page-table entries corresponding to the input
697 * address range specified, visiting entries according to the walker flags.
698 * Invalid entries are treated as leaf entries. The visited page table entry is
711 * kvm_pgtable_get_leaf() - Walk a page-table and retrieve the leaf entry
713 * @pgt: Page-table structure initialised by kvm_pgtable_*_init()
721 * The walker will walk the page-table entries corresponding to the input
723 * Invalid entries are treated as leaf entries.
731 * kvm_pgtable_stage2_pte_prot() - Retrieve the protection attributes of a
732 * stage-2 Page-Table Entry.
733 * @pte: Page-table entry
735 * Return: protection attributes of the page-table entry in the enum
738 enum kvm_pgtable_prot kvm_pgtable_stage2_pte_prot(kvm_pte_t pte);
741 * kvm_pgtable_hyp_pte_prot() - Retrieve the protection attributes of a stage-1
742 * Page-Table Entry.
743 * @pte: Page-table entry
745 * Return: protection attributes of the page-table entry in the enum
748 enum kvm_pgtable_prot kvm_pgtable_hyp_pte_prot(kvm_pte_t pte);
751 * kvm_tlb_flush_vmid_range() - Invalidate/flush a range of TLB entries
753 * @mmu: Stage-2 KVM MMU struct