Skip to content

Commit 5cfb6ce

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: nv: Handle TLBI ALLE1{,IS} operations
TLBI ALLE1* is a pretty big hammer that invalides all S1/S2 TLBs. This translates into the unmapping of all our shadow S2 PTs, itself resulting in the corresponding TLB invalidations. Co-developed-by: Jintack Lim <[email protected]> Co-developed-by: Christoffer Dall <[email protected]> Signed-off-by: Jintack Lim <[email protected]> Signed-off-by: Christoffer Dall <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent e6c9a30 commit 5cfb6ce

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,6 +2757,29 @@ static bool kvm_supported_tlbi_s12_op(struct kvm_vcpu *vpcu, u32 instr)
27572757
return true;
27582758
}
27592759

2760+
static bool handle_alle1is(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
2761+
const struct sys_reg_desc *r)
2762+
{
2763+
u32 sys_encoding = sys_insn(p->Op0, p->Op1, p->CRn, p->CRm, p->Op2);
2764+
2765+
if (!kvm_supported_tlbi_s12_op(vcpu, sys_encoding)) {
2766+
kvm_inject_undefined(vcpu);
2767+
return false;
2768+
}
2769+
2770+
write_lock(&vcpu->kvm->mmu_lock);
2771+
2772+
/*
2773+
* Drop all shadow S2s, resulting in S1/S2 TLBIs for each of the
2774+
* corresponding VMIDs.
2775+
*/
2776+
kvm_nested_s2_unmap(vcpu->kvm);
2777+
2778+
write_unlock(&vcpu->kvm->mmu_lock);
2779+
2780+
return true;
2781+
}
2782+
27602783
/* Only defined here as this is an internal "abstraction" */
27612784
union tlbi_info {
27622785
struct {
@@ -2880,7 +2903,9 @@ static struct sys_reg_desc sys_insn_descs[] = {
28802903
SYS_INSN(TLBI_VALE1, handle_tlbi_el1),
28812904
SYS_INSN(TLBI_VAALE1, handle_tlbi_el1),
28822905

2906+
SYS_INSN(TLBI_ALLE1IS, handle_alle1is),
28832907
SYS_INSN(TLBI_VMALLS12E1IS, handle_vmalls12e1is),
2908+
SYS_INSN(TLBI_ALLE1, handle_alle1is),
28842909
SYS_INSN(TLBI_VMALLS12E1, handle_vmalls12e1is),
28852910
};
28862911

0 commit comments

Comments
 (0)