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-changelog

[Xen-changelog] [xen-unstable] [IA64] Make Xen relocatable

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] Make Xen relocatable
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Nov 2007 04:20:21 -0800
Delivery-date: Fri, 09 Nov 2007 04:23:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1193765635 21600
# Node ID c17bfb09179095567c0cdae0aef3177afd6fad53
# Parent  9adec82f7bfe2f2538012ce2e698c58c06bf9527
[IA64] Make Xen relocatable

1. Put xenheap at 0xf400000004000000, then xenheap doesn't
   overlap with identity mapping.
2. Xen itself can be relocated by OS loader if there is no
   low memory in platform.
3. Use another DTR for mapping xenheap

Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx>
---
 xen/arch/ia64/linux-xen/head.S          |   12 +++++++++++-
 xen/arch/ia64/vmx/vmx_entry.S           |   18 ++++++++++++++----
 xen/arch/ia64/vmx/vmx_init.c            |    2 ++
 xen/arch/ia64/xen/xenasm.S              |   22 +++++++++++++++++-----
 xen/include/asm-ia64/linux-xen/asm/io.h |    4 ++++
 xen/include/asm-ia64/xenkregs.h         |    3 ++-
 xen/include/asm-ia64/xenpage.h          |   28 ++++++++++++++++++++++------
 xen/include/asm-ia64/xensystem.h        |    2 +-
 8 files changed, 73 insertions(+), 18 deletions(-)

diff -r 9adec82f7bfe -r c17bfb091790 xen/arch/ia64/linux-xen/head.S
--- a/xen/arch/ia64/linux-xen/head.S    Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/arch/ia64/linux-xen/head.S    Tue Oct 30 11:33:55 2007 -0600
@@ -263,6 +263,16 @@ start_ap:
        itr.d dtr[r16]=r18
        ;;
        srlz.i
+       ;;
+       /* XEN HEAP is identity mapped */
+       mov r16 = IA64_TR_XEN_HEAP_REGS
+       dep r17 = -1, r2, 60, 4
+       ;;
+       mov cr.ifa = r17
+       ;;
+       itr.d dtr[r16]=r18
+       ;;
+       srlz.i
 
        /*
         * Switch into virtual mode:
@@ -294,7 +304,7 @@ 1:  // now we are in virtual mode
        ;;
        srlz.i
        movl gp=__gp
-
+       ;;
        mov ar.fpsr=r2
        ;;
 
diff -r 9adec82f7bfe -r c17bfb091790 xen/arch/ia64/vmx/vmx_entry.S
--- a/xen/arch/ia64/vmx/vmx_entry.S     Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/arch/ia64/vmx/vmx_entry.S     Tue Oct 30 11:33:55 2007 -0600
@@ -677,13 +677,23 @@ 1:
     ;;
     dep r2=0,r3,0,KERNEL_TR_PAGE_SHIFT
     ;;
-    or r18=r2,r25
+    or r24=r2,r25
     ;;
    srlz.i
    ;;
-   itr.i itr[r16]=r18
-   ;;
-   itr.d dtr[r16]=r18
+   itr.i itr[r16]=r24
+   ;;
+   itr.d dtr[r16]=r24
+   ;;
+   /* xen heap is also identity mapped */
+   mov r16 = IA64_TR_XEN_HEAP_REGS
+   dep r17=-1,r3,60,4
+   ;;
+   ptr.d r17, r18
+   ;;
+   mov cr.ifa=r17
+   ;;
+   itr.d dtr[r16]=r24
    ;;
 
    // re-pin mappings for per-cpu data
diff -r 9adec82f7bfe -r c17bfb091790 xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c      Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/arch/ia64/vmx/vmx_init.c      Tue Oct 30 11:33:55 2007 -0600
@@ -117,6 +117,7 @@ vmx_init_env(void)
        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);
        }
 
@@ -162,6 +163,7 @@ static vpd_t *alloc_vpd(void)
                printk("VPD allocation failed.\n");
                return NULL;
        }
+       vpd = (vpd_t *)virt_to_xenva(vpd);
 
        printk(XENLOG_DEBUG "vpd base: 0x%p, vpd size:%ld\n",
               vpd, sizeof(vpd_t));
diff -r 9adec82f7bfe -r c17bfb091790 xen/arch/ia64/xen/xenasm.S
--- a/xen/arch/ia64/xen/xenasm.S        Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/arch/ia64/xen/xenasm.S        Tue Oct 30 11:33:55 2007 -0600
@@ -60,19 +60,21 @@ 1:  {
        mov ar.rsc=0                    // put RSE in enforced lazy, LE mode
        or loc3=loc3,r17                // add in psr the bits to set
        ;;
+       movl loc5=pal_vaddr             // get pal_vaddr
+       ;;
+       ld8 loc5=[loc5]                 // read pal_vaddr
+       ;;
        andcm r16=loc3,r16              // removes bits to clear from psr
        dep loc6=0,r8,0,KERNEL_TR_PAGE_SHIFT // Xen code paddr
        br.call.sptk.many rp=ia64_switch_mode_phys
 1:
        // now in physical mode with psr.i/ic off so do rr7 switch
-       movl r16=pal_vaddr              // Note: belong to region 7!
+       dep r16=-1,r0,61,3              // Note: belong to region 7!
        ;; 
        mov     rr[r16]=in0
        ;; 
        srlz.d
-       dep     r16=0,r16,60,4          // Get physical address.
-       ;;
-       ld8 loc5=[r16]                  // read pal_vaddr
+       ;;
        movl    r26=PAGE_KERNEL
        ;; 
 
@@ -90,7 +92,17 @@ 1:
        itr.i itr[r16]=r18
        ;; 
        itr.d dtr[r16]=r18
-
+       ;;
+       /* xen heap is also identity mapped */
+       mov r16 = IA64_TR_XEN_HEAP_REGS  
+       dep r17=-1,loc6,60,4
+       ;;
+       ptr.d r17,r24
+       ;;
+       mov cr.ifa=r17
+       ;;
+       itr.d dtr[r16]=r18
+       ;;
        // re-pin mappings for stack (current)
 
        // unless overlaps with KERNEL_TR
diff -r 9adec82f7bfe -r c17bfb091790 xen/include/asm-ia64/linux-xen/asm/io.h
--- a/xen/include/asm-ia64/linux-xen/asm/io.h   Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/include/asm-ia64/linux-xen/asm/io.h   Tue Oct 30 11:33:55 2007 -0600
@@ -82,6 +82,8 @@ extern unsigned int num_io_spaces;
 #include <asm/system.h>
 #include <asm-generic/iomap.h>
 
+
+#ifndef XEN
 /*
  * Change virtual addresses to physical addresses and vv.
  */
@@ -90,12 +92,14 @@ virt_to_maddr (volatile void *address)
 {
        return (unsigned long) address - PAGE_OFFSET;
 }
+#endif
 
 static inline void*
 maddr_to_virt (unsigned long address)
 {
        return (void *) (address + PAGE_OFFSET);
 }
+
 
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
 extern int valid_phys_addr_range (unsigned long addr, size_t *count); /* efi.c 
*/
diff -r 9adec82f7bfe -r c17bfb091790 xen/include/asm-ia64/xenkregs.h
--- a/xen/include/asm-ia64/xenkregs.h   Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/include/asm-ia64/xenkregs.h   Tue Oct 30 11:33:55 2007 -0600
@@ -7,7 +7,8 @@
 #define IA64_TR_SHARED_INFO    3       /* dtr3: page shared with domain */
 #define        IA64_TR_VHPT            4       /* dtr4: vhpt */
 #define IA64_TR_MAPPED_REGS    5       /* dtr5: vcpu mapped regs */
-#define IA64_DTR_GUEST_KERNEL   6
+#define IA64_TR_XEN_HEAP_REGS  6       /* dtr6: xen heap identity mapped regs 
*/
+#define IA64_DTR_GUEST_KERNEL   7
 #define IA64_ITR_GUEST_KERNEL   2
 /* Processor status register bits: */
 #define IA64_PSR_VM_BIT                46
diff -r 9adec82f7bfe -r c17bfb091790 xen/include/asm-ia64/xenpage.h
--- a/xen/include/asm-ia64/xenpage.h    Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/include/asm-ia64/xenpage.h    Tue Oct 30 11:33:55 2007 -0600
@@ -1,14 +1,13 @@
 #ifndef _ASM_IA64_XENPAGE_H
 #define _ASM_IA64_XENPAGE_H
 
+#ifndef __ASSEMBLY__
 #undef mfn_valid
 #undef page_to_mfn
 #undef mfn_to_page
 #ifdef CONFIG_VIRTUAL_FRAME_TABLE
 #undef ia64_mfn_valid
-#ifndef __ASSEMBLY__
 extern int ia64_mfn_valid (unsigned long pfn);
-#endif
 # define mfn_valid(_pfn)       (((_pfn) < max_page) && ia64_mfn_valid(_pfn))
 #else
 # define mfn_valid(_pfn)       ((_pfn) < max_page)
@@ -16,10 +15,24 @@ extern int ia64_mfn_valid (unsigned long
 # define page_to_mfn(_page)    ((unsigned long) ((_page) - frame_table))
 # define mfn_to_page(_pfn)     (frame_table + (_pfn))
 
+
+#include <asm/xensystem.h>
+
+static inline unsigned long __virt_to_maddr(unsigned long va)
+{
+       if (va - KERNEL_START < xenheap_size)
+               return xen_pstart + (va - KERNEL_START);
+       else
+               return (va & ((1UL << 60) - 1));
+}
+
+#define virt_to_maddr(va)      (__virt_to_maddr((unsigned long)va))
+
+
 #undef page_to_maddr
 #undef virt_to_page
 #define page_to_maddr(page)    (page_to_mfn(page) << PAGE_SHIFT)
-#define virt_to_page(kaddr)    mfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
+#define virt_to_page(kaddr)    (mfn_to_page(virt_to_maddr(kaddr) >> 
PAGE_SHIFT))
 
 #define page_to_virt(_page)    maddr_to_virt(page_to_maddr(_page))
 #define maddr_to_page(kaddr)   mfn_to_page(((kaddr) >> PAGE_SHIFT))
@@ -28,7 +41,6 @@ extern int ia64_mfn_valid (unsigned long
 #define virt_to_mfn(va)                (virt_to_maddr(va) >> PAGE_SHIFT)
 #define mfn_to_virt(mfn)       maddr_to_virt(mfn << PAGE_SHIFT)
 
-#ifndef __ASSEMBLY__
 typedef union xen_va {
        struct {
                unsigned long off : 60;
@@ -63,14 +75,18 @@ static inline int get_order_from_shift(u
     else
        return shift - PAGE_SHIFT;
 }
-#endif
+/* from identity va to xen va */
+#define virt_to_xenva(va)      ((unsigned long)va - PAGE_OFFSET - \
+                                xen_pstart + KERNEL_START)
+
 
 #undef __pa
 #undef __va
-#define __pa(x)                ({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; 
_v.l;})
+#define __pa(x)                (virt_to_maddr(x))
 #define __va(x)                ({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; 
_v.p;})
 
 /* It is sometimes very useful to have unsigned long as result.  */
 #define __va_ul(x)     ({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.l;})
 
+#endif
 #endif /* _ASM_IA64_XENPAGE_H */
diff -r 9adec82f7bfe -r c17bfb091790 xen/include/asm-ia64/xensystem.h
--- a/xen/include/asm-ia64/xensystem.h  Tue Oct 30 11:21:23 2007 -0600
+++ b/xen/include/asm-ia64/xensystem.h  Tue Oct 30 11:33:55 2007 -0600
@@ -30,7 +30,7 @@
 
 #define XEN_VIRT_UC_BIT         57
 
-#define KERNEL_START            0xf000000004000000
+#define KERNEL_START            0xf400000004000000
 #define GATE_ADDR               KERNEL_START
 
 #define IS_VMM_ADDRESS(addr) ((((addr) >> 60) ^ ((addr) >> 59)) & 1)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] Make Xen relocatable, Xen patchbot-unstable <=