aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghavendra Rao Ananta <[email protected]>2021-10-07 23:34:32 +0000
committerMarc Zyngier <[email protected]>2021-10-17 11:17:20 +0100
commit5c636d585cfd0d01a89b18fced77a07ab2ef386a (patch)
treeda0f84a9a7a85c11ffc966be46b9b2b031a857be
parent80166904655976bb9babc48fd283c2bba5799920 (diff)
KVM: arm64: selftests: Add support to disable and enable local IRQs
Add functions local_irq_enable() and local_irq_disable() to enable and disable the IRQs from the guest, respectively. Signed-off-by: Raghavendra Rao Ananta <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--tools/testing/selftests/kvm/include/aarch64/processor.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tools/testing/selftests/kvm/include/aarch64/processor.h
index 265054c24481..515d04a3c27d 100644
--- a/tools/testing/selftests/kvm/include/aarch64/processor.h
+++ b/tools/testing/selftests/kvm/include/aarch64/processor.h
@@ -172,4 +172,14 @@ static __always_inline u32 __raw_readl(const volatile void *addr)
#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c));})
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(__v); __v; })
+static inline void local_irq_enable(void)
+{
+ asm volatile("msr daifclr, #3" : : : "memory");
+}
+
+static inline void local_irq_disable(void)
+{
+ asm volatile("msr daifset, #3" : : : "memory");
+}
+
#endif /* SELFTEST_KVM_PROCESSOR_H */