]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: arm64: nv: Fix tracking of shadow list registers
authorMarc Zyngier <maz@kernel.org>
Sun, 15 Jun 2025 15:11:38 +0000 (16:11 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 19 Jun 2025 08:58:20 +0000 (09:58 +0100)
commit8a8ff069c7ad9a359c54683329883e2432cff191
treeb98c6ce0b6fa7e7f43d72680ab3b441c2d329004
parente04c78d86a9699d136910cfc0bdcf01087e3267e
KVM: arm64: nv: Fix tracking of shadow list registers

Wei-Lin reports that the tracking of shadow list registers is
majorly broken when resync'ing the L2 state after a run, as
we confuse the guest's LR index with the host's, potentially
losing the interrupt state.

While this could be fixed by adding yet another side index to
track it (Wei-Lin's fix), it may be better to refactor this
code to avoid having a side index altogether, limiting the
risk to introduce this class of bugs.

A key observation is that the shadow index is always the number
of bits in the lr_map bitmap. With that, the parallel indexing
scheme can be completely dropped.

While doing this, introduce a couple of helpers that abstract
the index conversion and some of the LR repainting, making the
whole exercise much simpler.

Reported-by: Wei-Lin Chang <r09922117@csie.ntu.edu.tw>
Reviewed-by: Wei-Lin Chang <r09922117@csie.ntu.edu.tw>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250614145721.2504524-1-r09922117@csie.ntu.edu.tw
Link: https://lore.kernel.org/r/86qzzkc5xa.wl-maz@kernel.org
arch/arm64/kvm/vgic/vgic-v3-nested.c