[PATCH 02/14] KVM: arm64: Define a macro for storing a value inside a per_cpu variable

George-Aurelian Popescu
2020-09-14T17:34:26Z

From: George Popescu <georgepope@google.com>

Use the hyp_str_this_cpu assembly macro to store a value in a per_cpu
variable. This macro is designed to be used inside of the hyp code.

Signed-off-by: George Popescu <georgepope@google.com>
---
arch/arm64/include/asm/kvm_asm.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index 6f98fbd0ac81..200bb8d0a720 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -211,6 +211,11 @@ extern char __smccc_workaround_1_smc[__SMCCC_WORKAROUND_1_SMC_SZ];
ldr \reg, [\reg, \tmp]
.endm

+.macro hyp_str_this_cpu sym, reg, tmp1, tmp2
+ hyp_adr_this_cpu \tmp1, \sym, \tmp2
+ str \reg, [\tmp1]
+.endm
+
.macro get_host_ctxt reg, tmp
hyp_adr_this_cpu \reg, kvm_host_data, \tmp
add \reg, \reg, #HOST_DATA_CONTEXT
--
2.28.0.618.gf4bc123cb7-goog