Skip to content

Commit fa71531

Browse files
covracerwildea01
authored andcommitted
arm64: Use __tlbi() macros in KVM code
Refactor the KVM code to use the __tlbi macros, which will allow an errata workaround that repeats tlbi dsb sequences to only change one location. This is not intended to change the generated assembly and comparing before and after vmlinux objdump shows no functional changes. Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Christopher Covington <cov@codeaurora.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent ea5f9d1 commit fa71531

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

arch/arm64/kvm/hyp/tlb.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
#include <asm/kvm_hyp.h>
19+
#include <asm/tlbflush.h>
1920

2021
void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
2122
{
@@ -32,7 +33,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
3233
* whole of Stage-1. Weep...
3334
*/
3435
ipa >>= 12;
35-
asm volatile("tlbi ipas2e1is, %0" : : "r" (ipa));
36+
__tlbi(ipas2e1is, ipa);
3637

3738
/*
3839
* We have to ensure completion of the invalidation at Stage-2,
@@ -41,7 +42,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
4142
* the Stage-1 invalidation happened first.
4243
*/
4344
dsb(ish);
44-
asm volatile("tlbi vmalle1is" : : );
45+
__tlbi(vmalle1is);
4546
dsb(ish);
4647
isb();
4748

@@ -57,7 +58,7 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm)
5758
write_sysreg(kvm->arch.vttbr, vttbr_el2);
5859
isb();
5960

60-
asm volatile("tlbi vmalls12e1is" : : );
61+
__tlbi(vmalls12e1is);
6162
dsb(ish);
6263
isb();
6364

@@ -72,7 +73,7 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
7273
write_sysreg(kvm->arch.vttbr, vttbr_el2);
7374
isb();
7475

75-
asm volatile("tlbi vmalle1" : : );
76+
__tlbi(vmalle1);
7677
dsb(nsh);
7778
isb();
7879

@@ -82,7 +83,7 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
8283
void __hyp_text __kvm_flush_vm_context(void)
8384
{
8485
dsb(ishst);
85-
asm volatile("tlbi alle1is \n"
86-
"ic ialluis ": : );
86+
__tlbi(alle1is);
87+
asm volatile("ic ialluis" : : );
8788
dsb(ish);
8889
}

0 commit comments

Comments
 (0)