arch/powerpc/kvm/book3s_64_mmu_radix.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kvm/book3s_64_mmu_radix.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kvm/book3s_64_mmu_radix.c- Extension
.c- Size
- 36462 bytes
- Lines
- 1477
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/string.hlinux/kvm.hlinux/kvm_host.hlinux/anon_inodes.hlinux/file.hlinux/debugfs.hlinux/pgtable.hasm/kvm_ppc.hasm/kvm_book3s.hbook3s_hv.hasm/page.hasm/mmu.hasm/pgalloc.hasm/pte-walk.hasm/ultravisor.hasm/kvm_book3s_uvmem.hasm/plpar_wrappers.hasm/firmware.h
Detected Declarations
struct debugfs_radix_statefunction __kvmhv_copy_tofrom_guest_radixfunction kvmhv_copy_tofrom_guest_radixfunction kvmhv_copy_from_guest_radixfunction kvmhv_copy_to_guest_radixfunction kvmppc_mmu_walk_radix_treefunction kvmppc_mmu_radix_translate_tablefunction kvmppc_mmu_radix_xlatefunction kvmppc_radix_tlbie_pagefunction kvmppc_radix_flush_pwcfunction kvmppc_radix_update_ptefunction kvmppc_radix_set_pte_atfunction kvmppc_pte_freefunction kvmppc_pmd_freefunction kvmppc_unmap_ptefunction kvmppc_unmap_free_ptefunction kvmppc_unmap_free_pmdfunction kvmppc_unmap_free_pudfunction kvmppc_free_pgtable_radixfunction kvmppc_free_radixfunction kvmppc_unmap_free_pmd_entry_tablefunction kvmppc_unmap_free_pud_entry_tablefunction kvmppc_create_ptefunction kvmppc_hv_handle_set_rcfunction kvmppc_book3s_instantiate_pagefunction kvmppc_book3s_radix_page_faultfunction kvm_unmap_radixfunction kvm_age_radixfunction kvm_test_age_radixfunction kvm_radix_test_clear_dirtyfunction kvmppc_hv_get_dirty_log_radixfunction kvmppc_radix_flush_memslotfunction add_rmmu_ap_encodingfunction kvmhv_get_rmmu_infofunction kvmppc_init_vm_radixfunction pte_ctorfunction pmd_ctorfunction debugfs_radix_openfunction debugfs_radix_releasefunction debugfs_radix_readfunction debugfs_radix_writefunction kvmhv_radix_debugfs_initfunction kvmppc_radix_initfunction kvmppc_radix_exit
Annotated Snippet
static const struct file_operations debugfs_radix_fops = {
.owner = THIS_MODULE,
.open = debugfs_radix_open,
.release = debugfs_radix_release,
.read = debugfs_radix_read,
.write = debugfs_radix_write,
.llseek = generic_file_llseek,
};
void kvmhv_radix_debugfs_init(struct kvm *kvm)
{
debugfs_create_file("radix", 0400, kvm->debugfs_dentry, kvm,
&debugfs_radix_fops);
}
int kvmppc_radix_init(void)
{
unsigned long size = sizeof(void *) << RADIX_PTE_INDEX_SIZE;
kvm_pte_cache = kmem_cache_create("kvm-pte", size, size, 0, pte_ctor);
if (!kvm_pte_cache)
return -ENOMEM;
size = sizeof(void *) << RADIX_PMD_INDEX_SIZE;
kvm_pmd_cache = kmem_cache_create("kvm-pmd", size, size, 0, pmd_ctor);
if (!kvm_pmd_cache) {
kmem_cache_destroy(kvm_pte_cache);
return -ENOMEM;
}
return 0;
}
void kvmppc_radix_exit(void)
{
kmem_cache_destroy(kvm_pte_cache);
kmem_cache_destroy(kvm_pmd_cache);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/string.h`, `linux/kvm.h`, `linux/kvm_host.h`, `linux/anon_inodes.h`, `linux/file.h`, `linux/debugfs.h`, `linux/pgtable.h`.
- Detected declarations: `struct debugfs_radix_state`, `function __kvmhv_copy_tofrom_guest_radix`, `function kvmhv_copy_tofrom_guest_radix`, `function kvmhv_copy_from_guest_radix`, `function kvmhv_copy_to_guest_radix`, `function kvmppc_mmu_walk_radix_tree`, `function kvmppc_mmu_radix_translate_table`, `function kvmppc_mmu_radix_xlate`, `function kvmppc_radix_tlbie_page`, `function kvmppc_radix_flush_pwc`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.