Re: [PATCH 5.15.y v3 3/7] KVM: x86/mmu: Derive shadow MMU page role from parent

From: Sasha Levin

Date: Mon Sep 14 2026 - 22:10:50 EST


> - role.direct = direct;
> - if (role.direct)
> - role.gpte_is_8_bytes = true;
> [...]
> + if (!role.gpte_is_8_bytes) {
> + struct kvm_mmu_page *parent_sp = sptep_to_sp(sptep);
> + role.quadrant = (sptep - parent_sp->spt) % 2;

The "if (role.direct) role.gpte_is_8_bytes = true;" that kvm_mmu_get_page()
used to do is removed here, and kvm_mmu_child_role() does not put it back.

That works upstream because the field there is has_4_byte_gpte, which
defaults to 0. On 5.15 the field is gpte_is_8_bytes, the inverse, so the
translation flips: for a non-paging guest
kvm_calc_shadow_root_page_role_common() leaves gpte_is_8_bytes at 0 while
kvm_calc_shadow_mmu_root_page_role() sets direct to 1, and a direct shadow
page ends up with a quadrant stamped onto it.

Keeping "if (role.direct) role.gpte_is_8_bytes = true;" in
kvm_mmu_child_role() preserves the upstream behaviour. The alternative is to
backport the upstream role-computation change first so the field carries the
mainline sense.

--
Thanks,
Sasha