KVM: x86/mmu: Avoid indirect call for get_cr3
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 22 Mar 2023 01:37:26 +0000 (02:37 +0100)
committerSean Christopherson <seanjc@google.com>
Wed, 22 Mar 2023 14:46:42 +0000 (07:46 -0700)
commit2fdcc1b324189b5fb20655baebd40cd82e2bdf0c
treeeb33aa6d616d1ff75c66388fe410dd56cf3da08e
parentf3d90f901d18749dca096719540a075f59240051
KVM: x86/mmu: Avoid indirect call for get_cr3

Most of the time, calls to get_guest_pgd result in calling
kvm_read_cr3 (the exception is only nested TDP).  Hardcode
the default instead of using the get_cr3 function, avoiding
a retpoline if they are enabled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Link: https://lore.kernel.org/r/20230322013731.102955-2-minipli@grsecurity.net
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h