Skip to content

Commit 9a5bff7

Browse files
committed
KVM: x86/mmu: Use KVM_PAGES_PER_HPAGE() instead of an open coded equivalent
Use KVM_PAGES_PER_HPAGE() instead of open coding equivalent logic that is anything but obvious. No functional change intended, and verified by compiling with the below assertions: BUILD_BUG_ON((1UL << KVM_HPAGE_GFN_SHIFT(PG_LEVEL_4K)) != KVM_PAGES_PER_HPAGE(PG_LEVEL_4K)); BUILD_BUG_ON((1UL << KVM_HPAGE_GFN_SHIFT(PG_LEVEL_2M)) != KVM_PAGES_PER_HPAGE(PG_LEVEL_2M)); BUILD_BUG_ON((1UL << KVM_HPAGE_GFN_SHIFT(PG_LEVEL_1G)) != KVM_PAGES_PER_HPAGE(PG_LEVEL_1G)); Link: https://lore.kernel.org/r/20240809194335.1726916-19-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 7645829 commit 9a5bff7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ static bool slot_rmap_walk_okay(struct slot_rmap_walk_iterator *iterator)
14641464
static void slot_rmap_walk_next(struct slot_rmap_walk_iterator *iterator)
14651465
{
14661466
while (++iterator->rmap <= iterator->end_rmap) {
1467-
iterator->gfn += (1UL << KVM_HPAGE_GFN_SHIFT(iterator->level));
1467+
iterator->gfn += KVM_PAGES_PER_HPAGE(iterator->level);
14681468

14691469
if (iterator->rmap->val)
14701470
return;

0 commit comments

Comments
 (0)