Re: [PATCH v3 39/40] KVM: x86/mmu: Move kvm_mmu_do_page_fault() from mmu_internal.h => mmu.c
From: Yosry Ahmed
Date: Fri May 29 2026 - 21:18:17 EST
On Fri, May 29, 2026 at 03:22:22PM -0700, Sean Christopherson wrote:
> Move kvm_mmu_do_page_fault() into mmu.c, as there are no users outside of
> mmu.c, and the function typically isn't inlined by the compiler anyways.
> This will allow moving the EMULTYPE_xxx definitions into x86.h without
> having to include x86.h in mmu_internal.h, i.e. will help preserve the
> goal of making x86.h KVM x86's "top-level" include.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Reviewed-by: Yosry Ahmed <yosry@xxxxxxxxxx>
[..]
> + /*
> + * Not sure what's happening, but punt to userspace and hope that
> + * they can fix it by changing memory to shared, or they can
> + * provide a better error.
> + */
LOL
> + if (r == RET_PF_EMULATE && fault.is_private) {
> + pr_warn_ratelimited("kvm: unexpected emulation request on private memory\n");
> + kvm_mmu_prepare_memory_fault_exit(vcpu, &fault);
> + return -EFAULT;
> + }
> +
> + if (fault.write_fault_to_shadow_pgtable && emulation_type)
> + *emulation_type |= EMULTYPE_WRITE_PF_TO_SP;
> + if (level)
> + *level = fault.goal_level;
> +
> + return r;
> +}