WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] [PATCH 12/16] domheap: allocate vm buffer before boot a

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 12/16] domheap: allocate vm buffer before boot allocator
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Mon, 7 Jan 2008 16:52:34 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Delivery-date: Sun, 06 Jan 2008 23:55:59 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1198647789 -32400
# Node ID 77cb59b30e8cc1a9ee04f70c462529b1b438b3c7
# Parent  96e207574e536b5ac029e2a1c57ca20ad879a72f
allocate vm buffer before boot allocator
PATCHNAME: allocate_vm_buffer

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 96e207574e53 -r 77cb59b30e8c xen/arch/ia64/linux-xen/setup.c
--- a/xen/arch/ia64/linux-xen/setup.c   Fri Dec 28 13:10:01 2007 +0900
+++ b/xen/arch/ia64/linux-xen/setup.c   Wed Dec 26 14:43:09 2007 +0900
@@ -561,10 +561,10 @@ late_setup_arch (char **cmdline_p)
 #endif
 #ifndef XEN
        find_memory();
-#endif
 
        /* process SAL system table: */
        ia64_sal_init(efi.sal_systab);
+#endif
 
 #ifdef CONFIG_SMP
 #ifdef XEN
@@ -585,10 +585,6 @@ late_setup_arch (char **cmdline_p)
                printk(KERN_INFO
                       "cpu package is Multi-Threading capable: number of 
siblings=%d\n",
                       smp_num_siblings);
-#endif
-
-#ifdef XEN
-       identify_vmx_feature();
 #endif
 
        cpu_init();     /* initialize the bootstrap CPU */
@@ -803,12 +799,6 @@ identify_cpu (struct cpuinfo_ia64 *c)
        }
        c->unimpl_va_mask = ~((7L<<61) | ((1L << (impl_va_msb + 1)) - 1));
        c->unimpl_pa_mask = ~((1L<<63) | ((1L << phys_addr_size) - 1));
-
-#ifdef XEN
-       /* If vmx feature is on, do necessary initialization for vmx */
-       if (vmx_enabled)
-               vmx_init_env();
-#endif
 }
 
 void
diff -r 96e207574e53 -r 77cb59b30e8c xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c      Fri Dec 28 13:10:01 2007 +0900
+++ b/xen/arch/ia64/vmx/vmx_init.c      Wed Dec 26 14:43:09 2007 +0900
@@ -56,7 +56,6 @@
 
 /* Global flag to identify whether Intel vmx feature is on */
 u32 vmx_enabled = 0;
-static u32 vm_order;
 static u64 buffer_size;
 static u64 vp_env_info;
 static u64 vm_buffer = 0;      /* Buffer required to bring up VMX feature */
@@ -97,8 +96,7 @@ identify_vmx_feature(void)
        /* Does xen has ability to decode itself? */
        if (!(vp_env_info & VP_OPCODE))
                printk("WARNING: no opcode provided from hardware(%lx)!!!\n", 
vp_env_info);
-       vm_order = get_order(buffer_size);
-       printk("vm buffer size: %ld, order: %d\n", buffer_size, vm_order);
+       printk("vm buffer size: %ld\n", buffer_size);
 
        vmx_enabled = 1;
 no_vti:
@@ -110,16 +108,33 @@ no_vti:
  * vsa_base is the indicator whether it's first LP to be initialized
  * for current domain.
  */ 
-void
-vmx_init_env(void)
+void*
+vmx_init_env(void *start, unsigned long end_in_pa)
 {
        u64 status, tmp_base;
 
        if (!vm_buffer) {
-               vm_buffer = (unsigned long)alloc_xenheap_pages(vm_order);
-               ASSERT(vm_buffer);
-               vm_buffer = virt_to_xenva((vm_buffer));
-               printk("vm_buffer: 0x%lx\n", vm_buffer);
+               /* VM buffer must must be 4K aligned and 
+                * must be pinned by both itr and dtr. */
+#define VM_BUFFER_ALIGN                (4 * 1024)
+#define VM_BUFFER_ALIGN_UP(x)  (((x) + (VM_BUFFER_ALIGN - 1)) &    \
+                                 ~(VM_BUFFER_ALIGN - 1))
+               unsigned long s_vm_buffer =
+                       VM_BUFFER_ALIGN_UP((unsigned long)start);
+               unsigned long e_vm_buffer = s_vm_buffer + buffer_size;
+               if (__pa(e_vm_buffer) < end_in_pa) {
+                       init_xenheap_pages(__pa(start), __pa(s_vm_buffer));
+                       start = (void*)e_vm_buffer;
+                       vm_buffer = virt_to_xenva(s_vm_buffer);
+                       printk("vm_buffer: 0x%lx\n", vm_buffer);
+               } else {
+                       printk("Can't allocate vm_buffer "
+                              "start 0x%p end_in_pa 0x%lx "
+                              "buffer_size 0x%lx\n",
+                              start, end_in_pa, buffer_size);
+                       vmx_enabled = 0;
+                       return start;
+               }
        }
 
        status=ia64_pal_vp_init_env(__vsa_base ? VP_INIT_ENV : 
VP_INIT_ENV_INITALIZE,
@@ -129,7 +144,8 @@ vmx_init_env(void)
 
        if (status != PAL_STATUS_SUCCESS) {
                printk("ia64_pal_vp_init_env failed.\n");
-               return ;
+               vmx_enabled = 0;
+               return start;
        }
 
        if (!__vsa_base)
@@ -137,6 +153,7 @@ vmx_init_env(void)
        else
                ASSERT(tmp_base == __vsa_base);
 
+       return start;
 }
 
 typedef union {
diff -r 96e207574e53 -r 77cb59b30e8c xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Fri Dec 28 13:10:01 2007 +0900
+++ b/xen/arch/ia64/xen/xensetup.c      Wed Dec 26 14:43:09 2007 +0900
@@ -30,6 +30,7 @@
 #include <xen/rcupdate.h>
 #include <xsm/acm/acm_hooks.h>
 #include <asm/sn/simulator.h>
+#include <linux/asm/sal.h>
 
 unsigned long xenheap_phys_end, total_pages;
 
@@ -456,6 +457,16 @@ void __init start_kernel(void)
 
     trap_init();
 
+    /* process SAL system table:*/
+    /* must be before any pal/sal call */
+    ia64_sal_init(efi.sal_systab);
+
+    /* early_setup_arch() maps PAL ocde. */
+    identify_vmx_feature();
+    /* If vmx feature is on, do necessary initialization for vmx */
+    if (vmx_enabled)
+        xen_heap_start = vmx_init_env(xen_heap_start, xenheap_phys_end);
+
     init_xenheap_pages(__pa(xen_heap_start), xenheap_phys_end);
     printk("Xen heap: %luMB (%lukB)\n",
        (xenheap_phys_end-__pa(xen_heap_start)) >> 20,
diff -r 96e207574e53 -r 77cb59b30e8c xen/include/asm-ia64/vmx.h
--- a/xen/include/asm-ia64/vmx.h        Fri Dec 28 13:10:01 2007 +0900
+++ b/xen/include/asm-ia64/vmx.h        Wed Dec 26 14:43:09 2007 +0900
@@ -29,7 +29,7 @@
 
 extern void identify_vmx_feature(void);
 extern unsigned int vmx_enabled;
-extern void vmx_init_env(void);
+extern void *vmx_init_env(void *start, unsigned long end_in_pa);
 extern int vmx_final_setup_guest(struct vcpu *v);
 extern void vmx_save_state(struct vcpu *v);
 extern void vmx_load_state(struct vcpu *v);

Attachment: 16706_77cb59b30e8c_allocate_vm_buffer.patch
Description: Text Data

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH 12/16] domheap: allocate vm buffer before boot allocator, Isaku Yamahata <=