kvm_mips_map_page(9)
π kvm_mips_map_page(9) β a Kernel API Manual moment
okay bestie so we're diving into kvm_mips_map_page from the Kernel API Manual, and honestly? she's a little workhorse and I'm obsessed. β¨
πΈ NAME πΈ
kvm_mips_map_page β maps a guest physical page, no big deal, just casually making guest memory real π
π SYNOPSIS π
int kvm_mips_map_page (struct kvm_vcpu *vcpu , unsigned long gpa , bool
write_fault , pte_t *out_entry , pte_t *out_buddy );
β¨ ARGUMENTS β¨
okay so the arg list, let's go π«Ά
vcpuβ the VCPU pointer. literally the main character of this call.gpaβ guest physical address of the fault. this is the address that had the audacity to fault πwrite_faultβ abooltelling you whether the fault happened because someone was trying to write.out_entryβ new PTE forgpa. it gets written on success β unless it'sNULL, in which case, nothing happens there, and that's valid.out_buddyβ new PTE forgpa's buddy. also written on success, also skipped ifNULL. friendship goals fr fr π
π₯ DESCRIPTION π₯
so what she does is handle GPA faults by creating a brand new GPA mapping β or updating one that already exists. both, either, she's flexible like that. π
she's also the one taking care of marking pages young or dirty (that's idle/dirty page tracking, iykyk), asking KVM for the corresponding PFN, and creating the mapping inside the GPA page tables. all that? her job. β
β¨ important vibe check: derived mappings (like GVA page tables and TLBs) are not her problem. those must be handled by the caller. don't put that on her π
π RETURN π
0β success!! π and when it's0, the caller is free to use theout_entryandout_buddyPTEs to update derived mappings and resume guest execution. slay.-EFAULTβ this happens if there's no memory region atgpa, or if someone tried to write to a read-only memory region π and ngl this one is usually handled as an MMIO access.
π¦ SEE ALSO π¦
the kernel file is ./arch/mips/kvm/mmu.c bestie, and here's the whole friend group:
kvm_pgd_init(9)kvm_pgd_alloc(9)kvm_mips_walk_pgd(9)kvm_mips_flush_gpa_pt(9)kvm_mips_mkclean_gpa_pt(9)kvm_arch_mmu_enable_log_dirty_pt_masked(9)_kvm_mips_map_page_fast(9)kvm_mips_migrate_count(9)
and that's the page!! source/version lives at ./arch/mips/kvm, dated October 2026, and the page itself is kvm_mips_map_page(9) β go forth and map some guest physical pages, ily, bye πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms