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

[Xen-devel] [PATCH 33/45] xen: arm: make dom0 builder work on 64-bit hypervisor



This still only builds a 32-bit dom0, although it lays a bit of
simple ground work for 64-bit dom0.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c |   59 +++++++++++++++++++++++++++++-------------
 1 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 30d014a..914ff3d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -68,7 +68,7 @@ static int set_memory_reg(struct domain *d, struct 
kernel_info *kinfo,
             size = kinfo->unassigned_mem;
         device_tree_set_reg(&new_cell, address_cells, size_cells, start, size);
 
-        printk("Populate P2M %#llx->%#llx\n", start, start + size);
+        printk("Populate P2M %#"PRIx64"->%#"PRIx64"\n", start, start + size);
         p2m_populate_ram(d, start, start + size);
         kinfo->mem.bank[kinfo->mem.nr_banks].start = start;
         kinfo->mem.bank[kinfo->mem.nr_banks].size = size;
@@ -268,7 +268,7 @@ static int prepare_dtb(struct domain *d, struct kernel_info 
*kinfo)
 
 static void dtb_load(struct kernel_info *kinfo)
 {
-    void * __user dtb_virt = (void *)(register_t)kinfo->dtb_paddr;
+    void * __user dtb_virt = (void * __user)(register_t)kinfo->dtb_paddr;
 
     raw_copy_to_guest(dtb_virt, kinfo->fdt, fdt_totalsize(kinfo->fdt));
     xfree(kinfo->fdt);
@@ -299,6 +299,12 @@ int construct_dom0(struct domain *d)
     if ( rc < 0 )
         return rc;
 
+#ifdef CONFIG_ARM_64
+    printk(" Xen kernel: 64-bit, AArch64, AArch32\n");
+#else
+    printk(" Xen kernel: 32-bit, AArch32\n");
+#endif
+
     printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 
0x18000000ULL, 0x1BFFFFFFULL);
     map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
     printk("Map CS3 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 
0x1C000000ULL, 0x1FFFFFFFULL);
@@ -319,7 +325,8 @@ int construct_dom0(struct domain *d)
     gic_route_irq_to_guest(d, 47, "eth");
 
     /* Enable second stage translation */
-    WRITE_CP32(READ_CP32(HCR) | HCR_VM, HCR); isb();
+    WRITE_SYSREG(READ_SYSREG(HCR_EL2) | HCR_VM, HCR_EL2);
+    isb();
 
     /* The following loads use the domain's p2m */
     p2m_load_VTTBR(d);
@@ -337,24 +344,40 @@ int construct_dom0(struct domain *d)
 
     regs->cpsr = PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC;
 
-/* FROM LINUX head.S
-
- * Kernel startup entry point.
- * ---------------------------
- *
- * This is normally called from the decompressor code.  The requirements
- * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
- * r1 = machine nr, r2 = atags or dtb pointer.
- *...
- */
+#ifdef CONFIG_ARM_64
+    d->arch.type = kinfo.type;
+#endif
 
-    regs->r0 = 0; /* SBZ */
-    regs->r1 = 0xffffffff; /* We use DTB therefore no machine id */
-    regs->r2 = kinfo.dtb_paddr;
+    if ( is_pv32_domain(d) )
+    {
+        /* FROM LINUX head.S
+         *
+         * Kernel startup entry point.
+         * ---------------------------
+         *
+         * This is normally called from the decompressor code.  The 
requirements
+         * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
+         * r1 = machine nr, r2 = atags or dtb pointer.
+         *...
+         */
+        regs->r0 = 0; /* SBZ */
+        regs->r1 = 0xffffffff; /* We use DTB therefore no machine id */
+        regs->r2 = kinfo.dtb_paddr;
+    }
+#ifdef CONFIG_ARM_64
+    else
+    {
+        /* From linux/Documentation/arm64/booting.txt */
+        regs->x0 = kinfo.dtb_paddr;
+        regs->x1 = 0; /* Reserved for future use */
+        regs->x2 = 0; /* Reserved for future use */
+        regs->x3 = 0; /* Reserved for future use */
+    }
+#endif
 
-    WRITE_CP32(SCTLR_BASE, SCTLR);
+    v->arch.sctlr = SCTLR_BASE;
 
-    WRITE_CP32(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM, HCR);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM, HCR_EL2);
     isb();
 
     local_abort_enable();
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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