Lines Matching +full:enum +full:- +full:as +full:- +full:flags
1 // SPDX-License-Identifier: GPL-2.0-only
14 #define KVM_PGTABLE_FIRST_LEVEL -1
18 * The largest supported block sizes for KVM (no 52-bit PA support):
19 * - 4K (level 1): 1GB
20 * - 16K (level 2): 32MB
21 * - 64K (level 2): 512MB
60 #define KVM_PHYS_INVALID (-1ULL)
142 * struct kvm_pgtable_mm_ops - Memory management callbacks.
184 * enum kvm_pgtable_stage2_flags - Stage-2 page-table flags.
185 * @KVM_PGTABLE_S2_NOFWB: Don't enforce Normal-WB even if the CPUs have
189 enum kvm_pgtable_stage2_flags {
195 * enum kvm_pgtable_prot - Page-table permissions and attributes.
205 enum kvm_pgtable_prot {
230 enum kvm_pgtable_prot prot);
233 * enum kvm_pgtable_walk_flags - Flags to control a depth-first page-table walk.
240 * @KVM_PGTABLE_WALK_SHARED: Indicates the page-tables may be shared
242 * @KVM_PGTABLE_WALK_HANDLE_FAULT: Indicates the page-table walk was
245 * without Break-before-make's
251 enum kvm_pgtable_walk_flags {
270 enum kvm_pgtable_walk_flags flags; member
274 enum kvm_pgtable_walk_flags visit);
278 return ctx->flags & KVM_PGTABLE_WALK_SHARED; in kvm_pgtable_walk_shared()
282 * struct kvm_pgtable_walker - Hook into a page-table walk.
285 * @flags: Bitwise-OR of flags to identify the entry types on which to
291 const enum kvm_pgtable_walk_flags flags; member
295 * RCU cannot be used in a non-kernel context such as the hyp. As such, page
297 * synchronization mechanisms (such as a spinlock).
313 * non-shared table walkers are allowed in the hypervisor. in kvm_pgtable_walk_begin()
315 if (walker->flags & KVM_PGTABLE_WALK_SHARED) in kvm_pgtable_walk_begin()
316 return -EPERM; in kvm_pgtable_walk_begin()
335 return rcu_dereference_check(pteref, !(walker->flags & KVM_PGTABLE_WALK_SHARED)); in kvm_dereference_pteref()
340 if (walker->flags & KVM_PGTABLE_WALK_SHARED) in kvm_pgtable_walk_begin()
348 if (walker->flags & KVM_PGTABLE_WALK_SHARED) in kvm_pgtable_walk_end()
360 * struct kvm_pgtable - KVM page-table.
362 * @start_level: Level at which the page-table walk starts.
363 * @pgd: Pointer to the first top-level entry of the page-table.
365 * @mmu: Stage-2 KVM MMU struct. Unused for stage-1 page-tables.
366 * @flags: Stage-2 page-table flags.
376 /* Stage-2 only */
378 enum kvm_pgtable_stage2_flags flags; member
383 * kvm_pgtable_hyp_init() - Initialise a hypervisor stage-1 page-table.
384 * @pgt: Uninitialised page-table structure to initialise.
394 * kvm_pgtable_hyp_destroy() - Destroy an unused hypervisor stage-1 page-table.
395 * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init().
397 * The page-table is assumed to be unreachable by any hardware walkers prior
403 * kvm_pgtable_hyp_map() - Install a mapping in a hypervisor stage-1 page-table.
404 * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init().
410 * The offset of @addr within a page is ignored, @size is rounded-up to
411 * the next page boundary and @phys is rounded-down to the previous page
422 enum kvm_pgtable_prot prot);
425 * kvm_pgtable_hyp_unmap() - Remove a mapping from a hypervisor stage-1 page-table.
426 * @pgt: Page-table structure initialised by kvm_pgtable_hyp_init().
430 * The offset of @addr within a page is ignored, @size is rounded-up to
431 * the next page boundary and @phys is rounded-down to the previous page
434 * TLB invalidation is performed for each page-table entry cleared during the
435 * unmapping operation and the reference count for the page-table page
438 * invalid page-table entry or a valid block mapping which maps beyond the range
446 * kvm_get_vtcr() - Helper to construct VTCR_EL2
453 * except for Hardware Management of Access Flags. HA Flag is set
454 * unconditionally on all CPUs, as it is safe to run with or without
462 * kvm_pgtable_stage2_pgd_size() - Helper to compute size of a stage-2 PGD
465 * Return: the size (in bytes) of the stage-2 PGD
470 * __kvm_pgtable_stage2_init() - Initialise a guest stage-2 page-table.
471 * @pgt: Uninitialised page-table structure to initialise.
474 * @flags: Stage-2 configuration flags.
482 enum kvm_pgtable_stage2_flags flags,
489 * kvm_pgtable_stage2_destroy() - Destroy an unused guest stage-2 page-table.
490 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
492 * The page-table is assumed to be unreachable by any hardware walkers prior
498 * kvm_pgtable_stage2_free_unlinked() - Free an unlinked stage-2 paging structure.
500 * @pgtable: Unlinked stage-2 paging structure to be freed.
501 * @level: Level of the stage-2 paging structure to be freed.
503 * The page-table is assumed to be unreachable by any hardware walkers prior to
509 * kvm_pgtable_stage2_create_unlinked() - Create an unlinked stage-2 paging structure.
510 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
512 * @level: Starting level of the stage-2 paging structure to be created.
514 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
515 * page-table pages.
518 * Returns an unlinked page-table tree. This new page-table tree is
520 * therefore unreachableby the hardware page-table walker. No TLB
526 * Return: The fully populated (unlinked) stage-2 paging structure, or
531 enum kvm_pgtable_prot prot,
535 * kvm_pgtable_stage2_map() - Install a mapping in a guest stage-2 page-table.
536 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
541 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
542 * page-table pages.
543 * @flags: Flags to control the page-table walk (ex. a shared walk)
545 * The offset of @addr within a page is ignored, @size is rounded-up to
546 * the next page boundary and @phys is rounded-down to the previous page
558 * existing block mappings, relying on page-faults to fault back areas outside
564 u64 phys, enum kvm_pgtable_prot prot,
565 void *mc, enum kvm_pgtable_walk_flags flags);
568 * kvm_pgtable_stage2_set_owner() - Unmap and annotate pages in the IPA space to
570 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
573 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
574 * page-table pages.
577 * By default, all page-tables are owned by identifier 0. This function can be
578 * used to mark portions of the IPA space as owned by other entities. When a
579 * stage 2 is used with identity-mappings, these annotations allow to use the
580 * page-table data structure as a simple rmap.
588 * kvm_pgtable_stage2_unmap() - Remove a mapping from a guest stage-2 page-table.
589 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
593 * The offset of @addr within a page is ignored and @size is rounded-up to
596 * TLB invalidation is performed for each page-table entry cleared during the
597 * unmapping operation and the reference count for the page-table page
607 * kvm_pgtable_stage2_wrprotect() - Write-protect guest stage-2 address range
609 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
610 * @addr: Intermediate physical address from which to write-protect,
613 * The offset of @addr within a page is ignored and @size is rounded-up to
625 * kvm_pgtable_stage2_mkyoung() - Set the access flag in a page-table entry.
626 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
627 * @addr: Intermediate physical address to identify the page-table entry.
631 * If there is a valid, leaf page-table entry used to translate @addr, then
634 * Return: The old page-table entry prior to setting the flag, 0 on failure.
639 * kvm_pgtable_stage2_test_clear_young() - Test and optionally clear the access
640 * flag in a page-table entry.
641 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
642 * @addr: Intermediate physical address to identify the page-table entry.
649 * page-table entry used to translate the range [@addr, @addr + @size).
661 * kvm_pgtable_stage2_relax_perms() - Relax the permissions enforced by a
662 * page-table entry.
663 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
664 * @addr: Intermediate physical address to identify the page-table entry.
669 * If there is a valid, leaf page-table entry used to translate @addr, then
678 enum kvm_pgtable_prot prot);
681 * kvm_pgtable_stage2_flush_range() - Clean and invalidate data cache to Point
682 * of Coherency for guest stage-2 address
684 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
688 * The offset of @addr within a page is ignored and @size is rounded-up to
696 * kvm_pgtable_stage2_split() - Split a range of huge pages into leaf PTEs pointing
698 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init().
701 * @mc: Cache of pre-allocated and zeroed memory from which to allocate
702 * page-table pages.
708 * kvm_pgtable_stage2_split() is best effort: it tries to break as many
709 * blocks in the input range as allowed by @mc_capacity.
715 * kvm_pgtable_walk() - Walk a page-table.
716 * @pgt: Page-table structure initialised by kvm_pgtable_*_init().
721 * The offset of @addr within a page is ignored and @size is rounded-up to
724 * The walker will walk the page-table entries corresponding to the input
725 * address range specified, visiting entries according to the walker flags.
726 * Invalid entries are treated as leaf entries. The visited page table entry is
739 * kvm_pgtable_get_leaf() - Walk a page-table and retrieve the leaf entry
741 * @pgt: Page-table structure initialised by kvm_pgtable_*_init()
749 * The walker will walk the page-table entries corresponding to the input
751 * Invalid entries are treated as leaf entries.
759 * kvm_pgtable_stage2_pte_prot() - Retrieve the protection attributes of a
760 * stage-2 Page-Table Entry.
761 * @pte: Page-table entry
763 * Return: protection attributes of the page-table entry in the enum
766 enum kvm_pgtable_prot kvm_pgtable_stage2_pte_prot(kvm_pte_t pte);
769 * kvm_pgtable_hyp_pte_prot() - Retrieve the protection attributes of a stage-1
770 * Page-Table Entry.
771 * @pte: Page-table entry
773 * Return: protection attributes of the page-table entry in the enum
776 enum kvm_pgtable_prot kvm_pgtable_hyp_pte_prot(kvm_pte_t pte);
779 * kvm_tlb_flush_vmid_range() - Invalidate/flush a range of TLB entries
781 * @mmu: Stage-2 KVM MMU struct