ANDROID: KVM: arm64: Fix MMU context save/restore over TLB invalidation
The 'mmu' parameter to enter_vmid_context() represents the target MMU
to switch to, so we should stash away the current MMU for restoration
by exit_vmid_context() rather than the one we're about to switch to!
Bug: 291568386
Fixes: 47318559bc ("ANDROID: KVM: arm64: Support TLB invalidation in guest context")
Tested-by: Mostafa Saleh <smostafa@google.com>
Reported-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5d76c159424e32a6d70c598d0007f98ea80c1db4
This commit is contained in:
parent
7f0f58f97b
commit
a16d62a296
1 changed files with 9 additions and 3 deletions
|
|
@ -32,13 +32,19 @@ static void enter_vmid_context(struct kvm_s2_mmu *mmu,
|
|||
* to do.
|
||||
*/
|
||||
if (vcpu) {
|
||||
/* We're in guest context */
|
||||
if (mmu == vcpu->arch.hw_mmu || WARN_ON(mmu != host_s2_mmu))
|
||||
return;
|
||||
} else if (mmu == host_s2_mmu) {
|
||||
return;
|
||||
|
||||
cxt->mmu = vcpu->arch.hw_mmu;
|
||||
} else {
|
||||
/* We're in host context */
|
||||
if (mmu == host_s2_mmu)
|
||||
return;
|
||||
|
||||
cxt->mmu = host_s2_mmu;
|
||||
}
|
||||
|
||||
cxt->mmu = mmu;
|
||||
if (cpus_have_final_cap(ARM64_WORKAROUND_SPECULATIVE_AT)) {
|
||||
u64 val;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue