Skip to contentSkip to conversation

fix initialisation of physaddr_bitsize etc.

PATCH New Ian Jackson 1 participant 1 message Feb 7, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix initialisation of physaddr_bitsize etc.

In 64-bit hypervisors with 32-bit dom0, the dom0 domain builder only initialises d->arch.physaddr_bitsize if it has the ELF tag which sets virt_hv_start_low. This causes memory allocation to fail very early.

The attached patch fixes this, using __HYPERVISOR_COMPAT_VIRT_START as a default value for the elf tag.

xen/arch/x86/domain_build.c +8 -4
diff -r 99b8ffe25088 xen/arch/x86/domain_build.c
@@ -349,8 +349,9 @@ int __init construct_dom0(
     if ( parms.pae == PAEKERN_extended_cr3 )
             set_bit(VMASST_TYPE_pae_extended_cr3, &d->vm_assist);
 
-    if ( UNSET_ADDR != parms.virt_hv_start_low && elf_32bit(&elf) )
-    {
+    if ( elf_32bit(&elf) )
+    {
+        uint64_t virt_hv_start_low;
 #if CONFIG_PAGING_LEVELS < 4
         unsigned long mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
 #else
@@ -358,8 +359,11 @@ int __init construct_dom0(
                              ? (1UL << L2_PAGETABLE_SHIFT) - 1
                              : (1UL << L4_PAGETABLE_SHIFT) - 1;
 #endif
-
-        value = (parms.virt_hv_start_low + mask) & ~mask;
+        virt_hv_start_low = parms.virt_hv_start_low;
+        if (virt_hv_start_low == UNSET_ADDR)
+            virt_hv_start_low = __HYPERVISOR_COMPAT_VIRT_START;
+
+        value = (virt_hv_start_low + mask) & ~mask;
 #ifdef CONFIG_COMPAT
         HYPERVISOR_COMPAT_VIRT_START(d) =
             max_t(unsigned int, m2p_compat_vstart, value);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel