Skip to content

Commit 764388c

Browse files
Sean Christophersonbonzini
authored andcommitted
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: 2f2fad0 ("kvm: x86/mmu: Add functions to handle changed TDP SPTEs") Reported-by: Daniel Díaz <daniel.diaz@linaro.org> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Message-Id: <20201024031150.9318-1-sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 29cf0f5 commit 764388c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
209209

210210
WARN_ON(level > PT64_ROOT_MAX_LEVEL);
211211
WARN_ON(level < PG_LEVEL_4K);
212-
WARN_ON(gfn % KVM_PAGES_PER_HPAGE(level));
212+
WARN_ON(gfn & (KVM_PAGES_PER_HPAGE(level) - 1));
213213

214214
/*
215215
* If this warning were to trigger it would indicate that there was a

0 commit comments

Comments
 (0)