diff mbox series

[Xen-devel,for-4.12,v2,7/7] DO NOT APPLY Allow testing the new AT speculate workaround code

Message ID 20190128115026.3336-8-julien.grall@arm.com
State New
Headers show
Series xen/arm: Workaround for Cortex-A76 erratum 1165522 | expand

Commit Message

Julien Grall Jan. 28, 2019, 11:50 a.m. UTC
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/cpuerrata.c | 10 ++++++++++
 xen/arch/arm/p2m.c       |  2 ++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 4431b244fd..727c67451d 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -381,6 +381,11 @@  static bool has_ssbd_mitigation(const struct arm_cpu_capabilities *entry)
 }
 #endif
 
+static bool has_at_speculate(const struct arm_cpu_capabilities *entry)
+{
+    return true;
+}
+
 #define MIDR_RANGE(model, min, max)     \
     .matches = is_affected_midr_range,  \
     .midr_model = model,                \
@@ -495,6 +500,11 @@  static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM64_WORKAROUND_AT_SPECULATE,
         MIDR_RANGE(MIDR_CORTEX_A76, 0, 2 << MIDR_VARIANT_SHIFT),
     },
+    {
+        .desc = "AT speculate",
+        .capability = ARM64_WORKAROUND_AT_SPECULATE,
+        .matches = has_at_speculate,
+    },
     {},
 };
 
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index c38bd7e16e..2b25706823 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -124,6 +124,8 @@  void p2m_restore_state(struct vcpu *n)
     if ( is_idle_vcpu(n) )
         return;
 
+    ASSERT(READ_SYSREG64(VTTBR_EL2) == (generate_vttbr(INVALID_VMID, empty_root_mfn)));
+
     WRITE_SYSREG(n->arch.sctlr, SCTLR_EL1);
     WRITE_SYSREG(n->arch.hcr_el2, HCR_EL2);