diff options
| author | Fuad Tabba <fuad.tabba@linux.dev> | 2026-10-20 08:43:11 +0100 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-11-03 11:37:05 +0000 |
| commit | cadcd8d70f331044d12aa6a9644f8253cd2bf29a (patch) | |
| tree | 37b690d3cbb68f4aa945e71117a04df8878d0c48 /scripts | |
| parent | a7dd36f7e381025bdf01d8665bf37167368754c4 (diff) | |
KVM: arm64: Ensure TLBs and I-cache are private to each vCPU in pKVM
All vCPUs of a VM share its VMID, so KVM flushes a physical CPU's TLBs
and I-cache for the VM whenever a different vCPU of that VM is loaded
there. pKVM guests, protected or not, run on the hypervisor's stage-2
and VMID, and the host doesn't flush for them. Nothing at EL2 flushes
instead, so a vCPU can hit TLB and I-cache entries that another vCPU of
the same VM left on that CPU.
Track at EL2 the last vCPU of each VM loaded on each CPU, and flush
when it changes. EL2 can't allocate per-CPU memory for each VM, as the
host does, so use one per-CPU array indexed by the VM's table entry.
Reset the entry's slot on every CPU when a VM reserves it, so that a new
VM starts with no last vCPU, whether the entry is unused or was left by
a VM that was torn down.
Fixes: fce886a602073 ("KVM: arm64: Plumb the pKVM MMU in KVM")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
Link: https://patch.msgid.link/20261020074311.1873316-1-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
