[kvm-unit-tests PATCH 2/2] arm64: ensure tlbi is safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nadav Amit <namit@xxxxxxxxxx>

While no real problem was encountered, having an inline assembly without
volatile keyword and output can allow the compiler to ignore it. And
without a memory clobber, potentially reorder it.

Add volatile and memory clobber.

Signed-off-by: Nadav Amit <namit@xxxxxxxxxx>
---
 lib/arm64/asm/mmu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/arm64/asm/mmu.h b/lib/arm64/asm/mmu.h
index 5c27edb..cf94403 100644
--- a/lib/arm64/asm/mmu.h
+++ b/lib/arm64/asm/mmu.h
@@ -14,7 +14,7 @@
 static inline void flush_tlb_all(void)
 {
 	dsb(ishst);
-	asm("tlbi	vmalle1is");
+	asm volatile("tlbi	vmalle1is" ::: "memory");
 	dsb(ish);
 	isb();
 }
@@ -23,7 +23,7 @@ static inline void flush_tlb_page(unsigned long vaddr)
 {
 	unsigned long page = vaddr >> 12;
 	dsb(ishst);
-	asm("tlbi	vaae1is, %0" :: "r" (page));
+	asm volatile("tlbi	vaae1is, %0" :: "r" (page) : "memory");
 	dsb(ish);
 	isb();
 }
-- 
2.34.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux