summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2015-12-01 13:48:56 +0000
committerAlex Shi <alex.shi@linaro.org>2016-11-09 22:15:40 +0800
commitac185e4487ba0b3684f511fcacbc63b0359f679b (patch)
treefe38e24803dc9a9a3cb914b99cf3a92d1526eca1 /include
parent2ddc142e465be4a0f11223e1a882f0317dde6763 (diff)
KVM: arm/arm64: vgic-v3: Make the LR indexing macro public
We store GICv3 LRs in reverse order so that the CPU can save/restore them in rever order as well (don't ask why, the design is crazy), and yet generate memory traffic that doesn't completely suck. We need this macro to be available to the C version of save/restore. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> (cherry picked from commit 3c13b8f435acb452eac62d966148a8b6fa92151f) Signed-off-by: Alex Shi <alex.shi@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/kvm/arm_vgic.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index d2f41477f8ae..13a3d537811b 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -279,6 +279,12 @@ struct vgic_v2_cpu_if {
u32 vgic_lr[VGIC_V2_MAX_LRS];
};
+/*
+ * LRs are stored in reverse order in memory. make sure we index them
+ * correctly.
+ */
+#define VGIC_V3_LR_INDEX(lr) (VGIC_V3_MAX_LRS - 1 - lr)
+
struct vgic_v3_cpu_if {
#ifdef CONFIG_KVM_ARM_VGIC_V3
u32 vgic_hcr;