xen: arm: Ensure HCR_EL2.RW is set correctly when building dom0
authorIan Campbell <ian.campbell@citrix.com>
Thu, 10 Oct 2013 14:43:45 +0000 (15:43 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 24 Oct 2013 13:25:11 +0000 (14:25 +0100)
copy_to_user and friends rely on this, since the address transalation
functions (guest VA -> MFN) will truncate VA to the appropriate size.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
xen/arch/arm/domain_build.c

index 4e1badf3fad9eac7d80d1927b682a4dee872cc8e..c644be26208028852e9b7b69118feaa2c6e68e10 100644 (file)
@@ -955,6 +955,13 @@ int construct_dom0(struct domain *d)
 
     /* The following loads use the domain's p2m */
     p2m_load_VTTBR(d);
+#ifdef CONFIG_ARM_64
+    d->arch.type = kinfo.type;
+    if ( is_pv32_domain(d) )
+        WRITE_SYSREG(READ_SYSREG(HCR_EL2) & ~HCR_RW, HCR_EL2);
+    else
+        WRITE_SYSREG(READ_SYSREG(HCR_EL2) | HCR_RW, HCR_EL2);
+#endif
 
     kernel_load(&kinfo);
     /* initrd_load will fix up the fdt, so call it before dtb_load */
@@ -970,9 +977,6 @@ int construct_dom0(struct domain *d)
 
     regs->pc = (register_t)kinfo.entry;
 
-#ifdef CONFIG_ARM_64
-    d->arch.type = kinfo.type;
-#endif
 
     if ( is_pv32_domain(d) )
     {