Re: [PATCH] KVM: arm64: nv: Initialize hw_mmu to NULL for nested vCPUs

From: Dan Carpenter

Date: Thu Nov 12 2026 - 00:35:35 EST


On Wed, Nov 11, 2026 at 07:46:53PM +0000, Marc Zyngier wrote:
>
> I think this really needs a comment to explain why we repaint hw_mmu
> to NULL, because the next idiot who looks at this (likely me) will
> probably remove this line...
>
> The other thing is that this means that nothing can evaluate
> vcpu->arch.hw_mmu anywhere outside of the loaded path, as it can be
> NULL. I *think* this is OK, but I need to really convince myself...
>
> I'd like to add something like:
>
> /*
> * We can't rely on the S2 MMU being the canonical one,
> * as userspace can restore a nested context. Nuke the
> * hw_mmu early to ensure that we pick the correct one
> * load time. It also means that we can't rely on hw_mmu
> * being set to anything useful if the vcpu isn't loaded.
> */
>
> If that works for you, I'll squash that in.

Absolutely. Thanks so much.

regards,
dan carpenter