From: Sean Christopherson Date: Sat, 24 Oct 2020 03:11:50 +0000 (-0700) Subject: KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build X-Git-Tag: v5.15~2569^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=764388ce598f0c3f5c7c39f45279104cb9e18be5;p=platform%2Fkernel%2Flinux-starfive.git KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build Replace a modulo operator with the more common pattern for computing the gfn "offset" of a huge page to fix an i386 build error. arch/x86/kvm/mmu/tdp_mmu.c:212: undefined reference to `__umoddi3' In fact, almost all of tdp_mmu.c can be elided on 32-bit builds, but that is a much larger patch. Fixes: 2f2fad0897cb ("kvm: x86/mmu: Add functions to handle changed TDP SPTEs") Reported-by: Daniel Díaz Signed-off-by: Sean Christopherson Message-Id: <20201024031150.9318-1-sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index e246d71..27e381c 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -209,7 +209,7 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, WARN_ON(level > PT64_ROOT_MAX_LEVEL); WARN_ON(level < PG_LEVEL_4K); - WARN_ON(gfn % KVM_PAGES_PER_HPAGE(level)); + WARN_ON(gfn & (KVM_PAGES_PER_HPAGE(level) - 1)); /* * If this warning were to trigger it would indicate that there was a