[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.4] xen/arm: Use p2m_restore_state in construct_dom0



commit b657cb9c00862b72a4ef8b0af996649d392f5fb7
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Wed Mar 19 15:43:38 2014 +0000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Jun 5 13:20:33 2014 +0100

    xen/arm: Use p2m_restore_state in construct_dom0
    
    The address translation functions used while building dom0 rely on certain 
EL1
    state being configured. In particular they are subject to the behaviour of
    SCTLR_EL1.M (stage 1 MMU enabled).
    
    The Xen (and Linux) boot protocol require that the kernel be entered with 
the
    MMU disabled but they don't say anything explicitly about exception levels
    other than the one which is active when entering the kernels. Arguably the
    protocol could be said to apply to all exception levels but in any case we
    should cope with this and setup the EL1 state as necessary.
    
    Fu Wei discovered this when booting Xen from grub.efi over UEFI, it's not
    clear whether grub or UEFI is responsible for leaving stage 1 MMU enabled.
    
    Use directly the newly created function p2m_restore_state to retrieve a
    correct EL1 state to translate an address.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Reported-by: Fu Wei <fu.wei@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    (cherry picked from commit d6dd3a9ae7adead322e8ce96f83db96dce64c982)
    [ ijc -- adjusted because this and 278283cd0b81 were backported in the 
opposite
         order from their application to staging. The result is as if they had
             been backported in the correct order. ]
---
 xen/arch/arm/domain_build.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c1497f8..8cbd776 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1021,17 +1021,13 @@ int construct_dom0(struct domain *d)
     if ( rc < 0 )
         return rc;
 
-    /* The following loads use the domain's p2m */
+    /*
+     * The following loads use the domain's p2m and require current to
+     * be a vcpu of the domain, temporarily switch
+     */
     saved_current = current;
-    p2m_load_VTTBR(d);
+    p2m_restore_state(v);
     set_current(v);
-#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 will determine the placement of the initrd & fdt in
@@ -1044,7 +1040,7 @@ int construct_dom0(struct domain *d)
 
     /* Now that we are done restore the original p2m and current. */
     set_current(saved_current);
-    p2m_load_VTTBR(current->domain);
+    p2m_restore_state(saved_current);
 
     discard_initial_modules();
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.