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] Merged.

# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID a5195bf5671d383372005366ffe190c59276d801
# Parent  8e170309005301ab9a4149846806b5fbde7b3b25
# Parent  1470a9d40072546c390f0dfa89c7cb22d99018c8
Merged.

diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre
--- a/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre        Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre        Tue Nov  8 
11:31:43 2005
@@ -48,10 +48,10 @@
 cp arch/ia64/xen/drivers/motherboard.c drivers/acpi/motherboard.c
 
 #still a few x86-ism's in various drivers/xen files, patch them
-cd drivers/xen
-if [ ! -e ia64.patch.semaphore ]
-then
-       cat ../../arch/ia64/xen/drivers/patches/* | patch -p1 -b
-fi
-touch ia64.patch.semaphore
-cd ../..
+#cd drivers/xen
+#if [ ! -e ia64.patch.semaphore ]
+#then
+#      cat ../../arch/ia64/xen/drivers/patches/* | patch -p1 -b
+#fi
+#touch ia64.patch.semaphore
+#cd ../..
diff -r 8e1703090053 -r a5195bf5671d linux-2.6-xen-sparse/arch/ia64/xen/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/xen/Makefile       Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/Makefile       Tue Nov  8 11:31:43 2005
@@ -2,4 +2,4 @@
 # Makefile for Xen components
 #
 
-obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o 
xenconsole.o
+obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o 
xenconsole.o xen_ksyms.o
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c  Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c  Tue Nov  8 
11:31:43 2005
@@ -22,6 +22,7 @@
 
     op.cmd = EVTCHNOP_bind_virq;
     op.u.bind_virq.virq = virq;
+    op.u.bind_virq.vcpu = 0;
     if ( HYPERVISOR_event_channel_op(&op) != 0 )
         BUG();
 
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/console.c.patch
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/console.c.patch        
Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/console.c.patch        
Tue Nov  8 11:31:43 2005
@@ -1,7 +1,6 @@
-diff -Naur xen/console/console.c xen.patched/console/console.c
---- xen/console/console.c      2005-09-23 10:54:50.000000000 -0600
-+++ xen.patched/console/console.c      2005-09-23 10:57:51.000000000 -0600
-@@ -768,9 +768,16 @@
+--- xen/console/console.c      2005-11-02 14:13:07.000000000 +0100
++++ xen.patched/console/console.c      2005-11-02 14:21:20.000000000 +0100
+@@ -768,9 +771,15 @@
  #endif
  
        if (xen_start_info->flags & SIF_INITDOMAIN) {
@@ -10,8 +9,7 @@
 +              bind_evtchn_to_irqhandler(xencons_priv_irq,
 +                              xencons_priv_interrupt, 0, "console", NULL);
 +#else
-+
-               xencons_priv_irq = bind_virq_to_irq(VIRQ_CONSOLE);
+               xencons_priv_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
                (void)request_irq(xencons_priv_irq,
                                  xencons_priv_interrupt, 0, "console", NULL);
 +#endif
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/devmem.c.patch
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/devmem.c.patch Tue Nov 
 8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/devmem.c.patch Tue Nov 
 8 11:31:43 2005
@@ -1,13 +1,3 @@
 diff -Naur xen/core/devmem.c xen.patched/core/devmem.c
 --- xen/core/devmem.c  2005-09-23 10:54:50.000000000 -0600
 +++ xen.patched/core/devmem.c  2005-09-23 10:57:51.000000000 -0600
-@@ -93,6 +93,9 @@
-       if (uncached_access(file))
-               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
- 
-+#ifdef __ia64__
-+#define       direct_remap_pfn_range(a,b,c,d,e,f)     
remap_pfn_range(a,b,c,d,e)
-+#endif
-       if (direct_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
-                                  vma->vm_end - vma->vm_start,
-                                  vma->vm_page_prot, DOMID_IO))
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/gnttab.c.patch
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/gnttab.c.patch Tue Nov 
 8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/gnttab.c.patch Tue Nov 
 8 11:31:43 2005
@@ -1,17 +1,6 @@
 diff -Naur xen/core/gnttab.c xen.patched/core/gnttab.c
 --- xen/core/gnttab.c  2005-09-23 10:54:50.000000000 -0600
 +++ xen.patched/core/gnttab.c  2005-09-23 10:57:51.000000000 -0600
-@@ -19,6 +19,10 @@
- #include <asm-xen/gnttab.h>
- #include <asm/synch_bitops.h>
- 
-+#ifdef __ia64__
-+#define synch_cmpxchg ia64_cmpxchg4_acq
-+#endif
-+
- #if 1
- #define ASSERT(_p)                                                          \
-       if ( !(_p) ) { printk(KERN_ALERT"Assertion '%s': line %d, file %s\n", \
 @@ -346,6 +350,10 @@
        if ( hypercall.op != __HYPERVISOR_grant_table_op )
                return -ENOSYS;
@@ -45,17 +34,6 @@
  
        return 0;
  }
-@@ -434,8 +448,10 @@
- {
-       int i;
- 
-+#ifndef __ia64__
-       for (i = 0; i < NR_GRANT_FRAMES; i++)
-               clear_fixmap(FIX_GNTTAB_END - i);
-+#endif
- 
-       return 0;
- }
 @@ -450,7 +466,9 @@
  
        BUG_ON(gnttab_resume());
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/privcmd.c.patch
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/privcmd.c.patch        
Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/patches/privcmd.c.patch        
Tue Nov  8 11:31:43 2005
@@ -1,49 +1,43 @@
 diff -Naur xen/privcmd/privcmd.c xen.patched/privcmd/privcmd.c
 --- xen/privcmd/privcmd.c      2005-09-23 10:54:50.000000000 -0600
 +++ xen.patched/privcmd/privcmd.c      2005-09-23 10:57:51.000000000 -0600
-@@ -134,6 +134,9 @@
-                                   > vma->vm_end )
-                                       return -EINVAL;
+@@ -180,6 +183,15 @@
+               for (i = 0; i < m.num; i++, addr += PAGE_SIZE, p++) {
+                       if (get_user(mfn, p))
+                               return -EFAULT;
++#ifdef __ia64__
++                      ret = remap_pfn_range(vma,
++                                            addr&PAGE_MASK,
++                                            mfn,
++                                            1<<PAGE_SHIFT,
++                                            vma->vm_page_prot);
++                      if (ret < 0)
++                          goto batch_err;
++#else
  
-+#ifdef __ia64__
-+#define       direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
+                       ret = create_lookup_pte_addr(vma->vm_mm, addr, &ptep);
+                       if (ret)
+@@ -190,6 +202,7 @@
+ 
+                       if (HYPERVISOR_mmu_update(&u, 1, NULL, m.dom) < 0)
+                               put_user(0xF0000000 | mfn, p);
 +#endif
-                               if ((rc = direct_remap_pfn_range(
-                                       vma,
-                                       msg[j].va&PAGE_MASK, 
-@@ -148,6 +151,7 @@
-       }
-       break;
+               }
  
-+#ifndef __ia64__
-       case IOCTL_PRIVCMD_MMAPBATCH: {
-               mmu_update_t u;
-               privcmd_mmapbatch_t m;
-@@ -206,7 +210,9 @@
-       }
+               ret = 0;
+@@ -205,6 +218,7 @@
        break;
  #endif
-+#endif
  
 +#ifndef __ia64__
        case IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN: {
                unsigned long m2pv = (unsigned long)machine_to_phys_mapping;
                pgd_t *pgd = pgd_offset_k(m2pv);
-@@ -218,6 +224,7 @@
+@@ -216,6 +230,7 @@
                        -EFAULT: 0;
        }
        break;
 +#endif
  
-       case IOCTL_PRIVCMD_INITDOMAIN_STORE: {
-               extern int do_xenbus_probe(void*);
-@@ -241,6 +248,9 @@
- 
-               /* Initial connect. Setup channel and page. */
-               xen_start_info->store_evtchn = data;
-+#ifdef __ia64__
-+#define       pfn_to_mfn(x)   (x)
-+#endif
-               xen_start_info->store_mfn =
-                       pfn_to_mfn(virt_to_phys((void *)page) >>
-                                  PAGE_SHIFT);
+       default:
+               ret = -EINVAL;
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S     Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S     Tue Nov  8 11:31:43 2005
@@ -25,3 +25,9 @@
 (p7)   mov cr.iva=r10
        br.ret.sptk.many rp;;
 END(xen_init)
+
+GLOBAL_ENTRY(is_running_on_xen)
+       movl r9=running_on_xen;;
+       ld4 r8=[r9];;
+       br.ret.sptk.many rp;;
+END(is_running_on_xen)
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/xen/kernel/devmem.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c     Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/devmem.c     Tue Nov  8 11:31:43 2005
@@ -26,6 +26,7 @@
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
+#include <asm/hypervisor.h>
 
 static inline int uncached_access(struct file *file)
 {
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Tue Nov  8 11:31:43 2005
@@ -337,49 +337,7 @@
 #ifdef CONFIG_PROC_FS
 
 static struct proc_dir_entry *grant_pde;
-
-static int
-grant_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-           unsigned long data)
-{
-       int                     ret;
-       privcmd_hypercall_t     hypercall;
-
-       /*
-        * XXX Need safety checks here if using for anything other
-        *     than debugging.
-        */
-       return -ENOSYS;
-
-       if ( cmd != IOCTL_PRIVCMD_HYPERCALL )
-               return -ENOSYS;
-
-       if ( copy_from_user(&hypercall, (void *)data, sizeof(hypercall)) )
-               return -EFAULT;
-
-       if ( hypercall.op != __HYPERVISOR_grant_table_op )
-               return -ENOSYS;
-
-       /* hypercall-invoking asm taken from privcmd.c */
-       __asm__ __volatile__ (
-               "pushl %%ebx; pushl %%ecx; pushl %%edx; "
-               "pushl %%esi; pushl %%edi; "
-               "movl  4(%%eax),%%ebx ;"
-               "movl  8(%%eax),%%ecx ;"
-               "movl 12(%%eax),%%edx ;"
-               "movl 16(%%eax),%%esi ;"
-               "movl 20(%%eax),%%edi ;"
-               "movl   (%%eax),%%eax ;"
-               TRAP_INSTR "; "
-               "popl %%edi; popl %%esi; popl %%edx; popl %%ecx; popl %%ebx"
-               : "=a" (ret) : "0" (&hypercall) : "memory" );
-
-       return ret;
-}
-
-static struct file_operations grant_file_ops = {
-       ioctl:  grant_ioctl,
-};
+static struct file_operations grant_file_ops;
 
 static int
 grant_read(char *page, char **start, off_t off, int count, int *eof,
@@ -437,8 +395,13 @@
        BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1));
        BUG_ON(setup.status != 0);
 
+#ifdef __ia64__
+       shared = __va(frames[0] << PAGE_SHIFT);
+       printk("grant table at %p\n", shared);
+#else
        for (i = 0; i < NR_GRANT_FRAMES; i++)
                set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
+#endif
 
        return 0;
 }
@@ -464,7 +427,9 @@
 
        BUG_ON(gnttab_resume());
 
+#ifndef __ia64__
        shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
+#endif
 
        for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++)
                gnttab_list[i] = i + 1;
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Tue Nov  8 
11:31:43 2005
@@ -13,6 +13,7 @@
 
 #include <linux/spinlock.h>
 #include <asm-xen/balloon.h>
+#include <asm/hypervisor.h>
 #include "common.h"
 
 /*
@@ -30,10 +31,16 @@
 static unsigned long mmap_vstart;
 #define MMAP_PAGES                                             \
        (MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST)
+#ifdef __ia64__
+static void *pending_vaddrs[MMAP_PAGES];
+#define MMAP_VADDR(_idx, _i) \
+       (unsigned long)(pending_vaddrs[((_idx) * 
BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
+#else
 #define MMAP_VADDR(_req,_seg)                                          \
        (mmap_vstart +                                                  \
         ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) +        \
         ((_seg) * PAGE_SIZE))
+#endif
 
 /*
  * Each outstanding request that we've passed to the lower device layers has a 
@@ -376,9 +383,13 @@
        for (i = 0; i < nseg; i++) {
                if (likely(map[i].handle >= 0)) {
                        pending_handle(pending_idx, i) = map[i].handle;
+#ifdef __ia64__
+                       MMAP_VADDR(pending_idx,i) = gnttab_map_vaddr(map[i]);
+#else
                        phys_to_machine_mapping[__pa(MMAP_VADDR(
                                pending_idx, i)) >> PAGE_SHIFT] =
                                FOREIGN_FRAME(map[i].dev_bus_addr>>PAGE_SHIFT);
+#endif
                        fas        = req->frame_and_sects[i];
                        seg[i].buf = map[i].dev_bus_addr | 
                                (blkif_first_sect(fas) << 9);
@@ -501,11 +512,27 @@
        for (i = 0; i < MMAP_PAGES; i++)
                pending_grant_handles[i] = BLKBACK_INVALID_HANDLE;
 
+       if (xen_init() < 0)
+               return -ENODEV;
+
        blkif_interface_init();
 
+#ifdef __ia64__
+    {
+       extern unsigned long alloc_empty_foreign_map_page_range(unsigned long 
pages);
+       int i;
+
+       mmap_vstart =  alloc_empty_foreign_map_page_range(MMAP_PAGES);
+       printk("Allocated mmap_vstart: 0x%lx\n", mmap_vstart);
+       for(i = 0; i < MMAP_PAGES; i++)
+           pending_vaddrs[i] = mmap_vstart + (i << PAGE_SHIFT);
+       BUG_ON(mmap_vstart == NULL);
+    }
+#else
        page = balloon_alloc_empty_page_range(MMAP_PAGES);
        BUG_ON(page == NULL);
        mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
+#endif
 
        pending_cons = 0;
        pending_prod = MAX_PENDING_REQS;
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Tue Nov  8 
11:31:43 2005
@@ -49,6 +49,7 @@
 #include <asm-xen/xenbus.h>
 #include <asm-xen/xen-public/grant_table.h>
 #include <asm-xen/gnttab.h>
+#include <asm/hypervisor.h>
 
 #define BLKIF_STATE_DISCONNECTED 0
 #define BLKIF_STATE_CONNECTED    1
@@ -728,6 +729,9 @@
 
 static int __init xlblk_init(void)
 {
+       if (xen_init() < 0)
+               return -ENODEV;
+
        xenbus_register_driver(&blkfront);
        return 0;
 }
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Tue Nov  8 
11:31:43 2005
@@ -196,6 +196,9 @@
 void xen_console_init(void)
 #endif
 {
+       if (xen_init() < 0)
+               return __RETCODE;
+
        if (xen_start_info->flags & SIF_INITDOMAIN) {
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_SERIAL;
@@ -768,9 +771,15 @@
 #endif
 
        if (xen_start_info->flags & SIF_INITDOMAIN) {
+#ifdef __ia64__
+               xencons_priv_irq = bind_virq_to_evtchn(VIRQ_CONSOLE);
+               bind_evtchn_to_irqhandler(xencons_priv_irq,
+                               xencons_priv_interrupt, 0, "console", NULL);
+#else
                xencons_priv_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
                (void)request_irq(xencons_priv_irq,
                                  xencons_priv_interrupt, 0, "console", NULL);
+#endif
        } else {
                xencons_ring_register_receiver(xencons_rx);
        }
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Tue Nov  8 
11:31:43 2005
@@ -20,6 +20,7 @@
 #include <linux/pagemap.h>
 #include <linux/seq_file.h>
 #include <linux/kthread.h>
+#include <asm/hypervisor.h>
 
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
@@ -180,6 +181,15 @@
                for (i = 0; i < m.num; i++, addr += PAGE_SIZE, p++) {
                        if (get_user(mfn, p))
                                return -EFAULT;
+#ifdef __ia64__
+                       ret = remap_pfn_range(vma,
+                                             addr&PAGE_MASK,
+                                             mfn,
+                                             1<<PAGE_SHIFT,
+                                             vma->vm_page_prot);
+                       if (ret < 0)
+                           goto batch_err;
+#else
 
                        ret = create_lookup_pte_addr(vma->vm_mm, addr, &ptep);
                        if (ret)
@@ -190,6 +200,7 @@
 
                        if (HYPERVISOR_mmu_update(&u, 1, NULL, m.dom) < 0)
                                put_user(0xF0000000 | mfn, p);
+#endif
                }
 
                ret = 0;
@@ -205,6 +216,7 @@
        break;
 #endif
 
+#ifndef __ia64__
        case IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN: {
                unsigned long m2pv = (unsigned long)machine_to_phys_mapping;
                pgd_t *pgd = pgd_offset_k(m2pv);
@@ -216,6 +228,7 @@
                        -EFAULT: 0;
        }
        break;
+#endif
 
        default:
                ret = -EINVAL;
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h        Tue Nov  8 
11:31:43 2005
@@ -36,7 +36,12 @@
 #endif
 
 #ifndef __ASSEMBLY__
+#ifdef MODULE
+extern int is_running_on_xen(void);
+#define running_on_xen (is_running_on_xen())
+#else
 extern int running_on_xen;
+#endif
 
 #define        XEN_HYPER_SSM_I                 asm("break 0x7");
 #define        XEN_HYPER_GET_IVR               asm("break 0x8");
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/include/asm-xen/asm-ia64/fixmap.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/fixmap.h    Tue Nov  8 
11:30:38 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/fixmap.h    Tue Nov  8 
11:31:43 2005
@@ -1,1 +1,2 @@
-/* empty */
+#define clear_fixmap(x)        do {} while (0)
+#define        set_fixmap(x,y) do {} while (0)
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/include/asm-xen/asm-ia64/synch_bitops.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/synch_bitops.h      Tue Nov 
 8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/synch_bitops.h      Tue Nov 
 8 11:31:43 2005
@@ -51,6 +51,8 @@
     return test_bit(nr, addr);
 }
 
+#define synch_cmpxchg  ia64_cmpxchg4_acq
+
 #define synch_test_bit(nr,addr) \
 (__builtin_constant_p(nr) ? \
  synch_const_test_bit((nr),(addr)) : \
diff -r 8e1703090053 -r a5195bf5671d tools/examples/Makefile
--- a/tools/examples/Makefile   Tue Nov  8 11:30:38 2005
+++ b/tools/examples/Makefile   Tue Nov  8 11:31:43 2005
@@ -26,14 +26,14 @@
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
-XEN_SCRIPTS += xen-script-common.sh
-XEN_SCRIPTS += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
-XEN_SCRIPTS += block-common.sh
+XEN_SCRIPT_DATA = xen-script-common.sh
+XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
+XEN_SCRIPT_DATA += block-common.sh
 
 XEN_HOTPLUG_DIR = /etc/hotplug
 XEN_HOTPLUG_SCRIPTS = xen-backend.agent
 
-UDEV_RULES_DIR = /etc/udev/rules.d
+UDEV_RULES_DIR = /etc/udev
 UDEV_RULES = xen-backend.rules
 
 DI = $(shell readlink -f $(DISTDIR))
@@ -77,6 +77,10 @@
            do \
            $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
        done
+       for i in $(XEN_SCRIPT_DATA); \
+           do \
+           $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
+       done
 
 install-hotplug:
        [ -d $(DESTDIR)$(XEN_HOTPLUG_DIR) ] || \
@@ -88,10 +92,12 @@
 
 install-udev:
        [ -d $(DESTDIR)$(UDEV_RULES_DIR) ] || \
-               $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR)
+               $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR)/rules.d
        for i in $(UDEV_RULES); \
            do \
-           $(INSTALL_PROG) $$i $(DESTDIR)$(UDEV_RULES_DIR); \
+           $(INSTALL_DATA) $$i $(DESTDIR)$(UDEV_RULES_DIR); \
+           ( cd $(DESTDIR)$(UDEV_RULES_DIR)/rules.d ; \
+               ln -sf ../$$i . ) \
        done
 
 clean:
diff -r 8e1703090053 -r a5195bf5671d tools/examples/README
--- a/tools/examples/README     Tue Nov  8 11:30:38 2005
+++ b/tools/examples/README     Tue Nov  8 11:31:43 2005
@@ -9,20 +9,29 @@
 send it (preferably with a little summary to go in this file) to
 <xen-devel@xxxxxxxxxxxxxxxxxxxxx> so we can add it to this directory.
 
+block               - called by xen-backend.agent to bind/unbind dev  
+block-common.sh     - sourced by block, block-*
 block-enbd          - binds/unbinds network block devices
-block-file          - binds/unbinds file to loopback device
-mem-map.sxp         - memory map xend configuration file.
-network             - default network setup script called by xend at startup.
-network-route       - default xen network start/stop script.
-network-nat         - default xen network start/stop script when using NAT.
-vif-bridge          - default virtual network interface setup script.
-vif-route           - default xen virtual network start/stop script
-vif-nat             - configures vif in routed-nat mode.
-xend-config.sxp     - default xend configuration file.
-xmexample1          - example configuration script for 'xm create'.
-xmexample2          - a more complex configuration script for 'xm create'.
+block-nbd           - binds/unbinds network block devices
+network-bridge      - xen network start/stop script when using bridging
+network-nat         - xen network start/stop script when using NAT
+network-route       - xen network start/stop script when using routing
+vif-bridge          - virtual network start/stop script in bridged mode
+vif-common.sh       - sourced by vif-bridge 
+vif-nat             - xen virtual network start/stop script in NAT mode 
+vif-route           - xen virtual network start/stop script in routed mode
+xen-backend.agent   - calls block, vif-* scripts to add, remove, hotplug 
+                      devices  
+xen-backend.rules   - hotplug script rules
+xend-config.sxp     - default xend configuration file
+xen-hotplug-common.sh - sourced by vif-common.sh
+xen-network-common.sh - sourced by vif-common.sh
+xen-script-common.sh  - sourced by network-bridge, xen-hotplug-common.sh
+xmexample1          - example configuration script for 'xm create'
+xmexample2          - a more complex configuration script for 'xm create'
 xmexample3          - an advanced configuration script for 'xm create' 
-                      that utilizes the vmid.
+                      that utilizes the vmid
+xmexample.nbd       - configuration script that uses NBD filesystems
 xmexample.vmx       - a configuration script for creating a vmx domain with
-                      'xm create'.
-
+                      'xm create'
+xmexample.vti       - a configuration script for creating a domain on vti
diff -r 8e1703090053 -r a5195bf5671d tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Nov  8 11:30:38 2005
+++ b/tools/python/xen/xend/image.py    Tue Nov  8 11:31:43 2005
@@ -24,6 +24,7 @@
 from xen.xend import sxp
 from xen.xend.XendError import VmError
 from xen.xend.XendLogging import log
+from xen.xend.server.netif import randomMAC
 
 
 xc = xen.lowlevel.xc.new()
@@ -276,6 +277,8 @@
                ret.append("%s" % vbdparam)
             if name == 'vif':
                mac = sxp.child_value(info, 'mac')
+               if mac == None:
+                   mac = randomMAC()
                ret.append("-macaddr")
                ret.append("%s" % mac)
             if name == 'vtpm':
diff -r 8e1703090053 -r a5195bf5671d tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   Tue Nov  8 11:30:38 2005
+++ b/tools/xenstore/Makefile   Tue Nov  8 11:31:43 2005
@@ -77,7 +77,7 @@
 clean: testsuite-clean
        rm -f *.o *.opic *.so
        rm -f xenstored xs_random xs_stress xs_crashme
-       rm -f xs_test xenstored_test xs_tdb_dump
+       rm -f xs_test xenstored_test xs_tdb_dump xsls $(CLIENTS)
        $(RM) $(PROG_DEP)
 
 print-dir:
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c     Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/linux-xen/efi.c     Tue Nov  8 11:31:43 2005
@@ -24,7 +24,6 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/time.h>
-#include <linux/efi.h>
 
 #include <asm/io.h>
 #include <asm/kregs.h>
@@ -32,6 +31,8 @@
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/mca.h>
+
+#include <linux/efi.h>
 
 #define EFI_DEBUG      0
 
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/linux-xen/mm_contig.c
--- a/xen/arch/ia64/linux-xen/mm_contig.c       Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/linux-xen/mm_contig.c       Tue Nov  8 11:31:43 2005
@@ -16,7 +16,6 @@
  */
 #include <linux/config.h>
 #include <linux/bootmem.h>
-#include <linux/efi.h>
 #include <linux/mm.h>
 #include <linux/swap.h>
 
@@ -26,6 +25,7 @@
 #include <asm/sections.h>
 #include <asm/mca.h>
 
+#include <linux/efi.h>
 #ifdef CONFIG_VIRTUAL_MEM_MAP
 static unsigned long num_dma_physpages;
 #endif
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/hypercall.c     Tue Nov  8 11:31:43 2005
@@ -187,6 +187,10 @@
                regs->r8 = do_console_io(regs->r14, regs->r15, regs->r16);
                break;
 
+           case __HYPERVISOR_xen_version:
+               regs->r8 = do_xen_version(regs->r14, regs->r15);
+               break;
+
            default:
                printf("unknown hypercall %x\n", regs->r2);
                regs->r8 = (unsigned long)-1;
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/hyperprivop.S
--- a/xen/arch/ia64/xen/hyperprivop.S   Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/hyperprivop.S   Tue Nov  8 11:31:43 2005
@@ -14,6 +14,7 @@
 #include <asm/system.h>
 #include <public/arch-ia64.h>
 
+
 #define        _PAGE_PPN_MASK  0x0003fffffffff000 //asm/pgtable.h doesn't do 
assembly
 #define PAGE_PHYS      0x0010000000000761 
//__pgprot(__DIRTY_BITS|_PAGE_PL_2|_PAGE_AR_RWX)
 #define _PAGE_PL_2     (2<<7)
@@ -22,13 +23,14 @@
 #define FAST_HYPERPRIVOPS
 #define FAST_HYPERPRIVOP_CNT
 #define FAST_REFLECT_CNT
-//#define FAST_TICK
+//#define FAST_TICK // mostly working (unat problems) but default off for now
+//#define FAST_TLB_MISS_REFLECT        // mostly working but default off for 
now
+//#define FAST_ITC     // working but default off for now
 #define FAST_BREAK
 #define FAST_ACCESS_REFLECT
 #define FAST_RFI
 #define FAST_SSM_I
 #define FAST_PTC_GA
-#undef FAST_ITC        // working but default off for now
 #undef RFI_TO_INTERRUPT // not working yet
 #endif
 
@@ -57,7 +59,7 @@
 #endif
 
 // FIXME: turn off for now... but NaTs may crash Xen so re-enable soon!
-//#define HANDLE_AR_UNAT
+#define HANDLE_AR_UNAT
 
 // FIXME: This is defined in include/asm-ia64/hw_irq.h but this
 // doesn't appear to be include'able from assembly?
@@ -495,19 +497,29 @@
        .mem.offset 0,0; st8.spill [r2]=r30,16;
        .mem.offset 8,0; st8.spill [r3]=r31,16 ;;
 #ifdef HANDLE_AR_UNAT
-       // bank0 regs have no NaT bit, so ensure they are NaT clean
-       mov r16=r0; mov r17=r0; mov r18=r0; mov r19=r0;
-       mov r20=r0; mov r21=r0; mov r22=r0; mov r23=r0;
-       mov r24=r0; mov r25=r0; mov r26=r0; mov r27=r0;
-       mov r28=r0; mov r29=r0; mov r30=r0; movl r31=XSI_IPSR;;
-#endif
-       bsw.0 ;;
-       mov r2=r30; mov r3=r29;;
+       // r16~r23 are preserved regsin bank0 regs, we need to restore them,
+    // r24~r31 are scratch regs, we don't need to handle NaT bit,
+    // because OS handler must assign it before access it
+    ld8 r16=[r2],16;
+    ld8 r17=[r3],16;;
+    ld8 r18=[r2],16;
+    ld8 r19=[r3],16;;
+    ld8 r20=[r2],16;
+    ld8 r21=[r3],16;;
+    ld8 r22=[r2],16;
+    ld8 r23=[r3],16;;
+#endif
+    movl r31=XSI_IPSR;;
+    bsw.0 ;;
+    mov r24=ar.unat;
+    mov r2=r30; mov r3=r29;;
 #ifdef HANDLE_AR_UNAT
-       mov ar.unat=r28;
-#endif
-       adds r20=XSI_BANKNUM_OFS-XSI_PSR_IC_OFS,r18 ;;
-       st4 [r20]=r0 ;;
+    mov ar.unat=r28;
+#endif
+    adds r25=XSI_B1NATS_OFS-XSI_PSR_IC_OFS,r18 ;
+    adds r20=XSI_BANKNUM_OFS-XSI_PSR_IC_OFS,r18 ;;
+    st8 [r25]=r24;
+    st4 [r20]=r0 ;;
 fast_tick_reflect_done:
        mov pr=r31,-1 ;;
        rfi
@@ -649,19 +661,28 @@
        .mem.offset 0,0; st8.spill [r2]=r30,16;
        .mem.offset 8,0; st8.spill [r3]=r31,16 ;;
 #ifdef HANDLE_AR_UNAT
-       // bank0 regs have no NaT bit, so ensure they are NaT clean
-       mov r16=r0; mov r17=r0; mov r18=r0; mov r19=r0;
-       mov r20=r0; mov r21=r0; mov r22=r0; mov r23=r0;
-       mov r24=r0; mov r25=r0; mov r26=r0; mov r27=r0;
-       mov r28=r0; mov r29=r0; mov r30=r0; movl r31=XSI_IPSR;;
+       // r16~r23 are preserved regsin bank0 regs, we need to restore them,
+    // r24~r31 are scratch regs, we don't need to handle NaT bit,
+    // because OS handler must assign it before access it
+       ld8 r16=[r2],16;
+    ld8 r17=[r3],16;;
+    ld8 r18=[r2],16;
+    ld8 r19=[r3],16;;
+       ld8 r20=[r2],16;
+    ld8 r21=[r3],16;;
+    ld8 r22=[r2],16;
+    ld8 r23=[r3],16;;
 #endif
        movl r31=XSI_IPSR;;
        bsw.0 ;;
+    mov r24=ar.unat;
        mov r2=r30; mov r3=r29;;
 #ifdef HANDLE_AR_UNAT
        mov ar.unat=r28;
 #endif
+    adds r25=XSI_B1NATS_OFS-XSI_PSR_IC_OFS,r18 ;
        adds r20=XSI_BANKNUM_OFS-XSI_PSR_IC_OFS,r18 ;;
+    st8 [r25]=r24;
        st4 [r20]=r0 ;;
        mov pr=r31,-1 ;;
        rfi
@@ -705,6 +726,251 @@
        st8 [r23]=r22;;
        br.cond.sptk.many fast_reflect;;
 
+// when we get to here, VHPT_CCHAIN_LOOKUP has failed and everything
+// is as it was at the time of original miss.  We want to preserve that
+// so if we get a nested fault, we can just branch to page_fault
+GLOBAL_ENTRY(fast_tlb_miss_reflect)
+#ifndef FAST_TLB_MISS_REFLECT // see beginning of file
+       br.spnt.few page_fault ;;
+#endif
+       mov r31=pr
+       mov r30=cr.ipsr
+       mov r29=cr.iip
+       mov r16=cr.isr
+       mov r17=cr.ifa;;
+       // for now, always take slow path for region 0 (e.g. metaphys mode)
+       extr.u r21=r17,61,3;;
+       cmp.eq p7,p0=r0,r21
+(p7)   br.spnt.few page_fault ;;
+       // always take slow path for PL0 (e.g. __copy_from_user)
+       extr.u r21=r30,IA64_PSR_CPL0_BIT,2 ;;
+       cmp.eq p7,p0=r21,r0
+(p7)   br.spnt.few page_fault ;;
+       // slow path if strange ipsr or isr bits set
+       extr.u r21=r30,IA64_PSR_BE_BIT,1 ;;
+       cmp.ne p7,p0=r21,r0
+(p7)   br.spnt.few page_fault ;;
+       extr.u r21=r30,IA64_PSR_PP_BIT,1 ;;
+       cmp.ne p7,p0=r21,r0
+(p7)   br.spnt.few page_fault ;;
+       movl r21=IA64_ISR_IR|IA64_ISR_SP|IA64_ISR_NA ;;
+       and r21=r16,r21;;
+       cmp.ne p7,p0=r0,r21
+(p7)   br.spnt.few page_fault ;;
+       // also take slow path if virtual psr.ic=0
+       movl r18=XSI_PSR_IC;;
+       ld4 r21=[r18];;
+       cmp.eq p7,p0=r0,r21
+(p7)   br.spnt.few page_fault ;;
+       // OK, if we get to here, we are doing a fast vcpu_translate.  Need to:
+       // 1) look in the virtual TR's (pinned), if not there
+       // 2) look in the 1-entry TLB (pinned), if not there
+       // 3) check the domain VHPT (NOT pinned, accesses domain memory!)
+       // If we find it in any of these places, we need to effectively do
+       // a hyper_itc_i/d
+
+       // short-term hack for now, if in region 5-7, take slow path
+       // since all Linux TRs are in region 5 or 7, we need not check TRs
+       extr.u r21=r17,61,3;;
+       cmp.le p7,p0=5,r21
+(p7)   br.spnt.few page_fault ;;
+fast_tlb_no_tr_match:
+       movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
+       ld8 r27=[r27];;
+       tbit.nz p6,p7=r16,IA64_ISR_X_BIT;;
+(p6)   adds r25=IA64_VCPU_ITLB_OFFSET,r27;;
+(p7)   adds r25=IA64_VCPU_DTLB_OFFSET,r27;;
+       ld8 r20=[r25],8;;
+       tbit.z p7,p0=r20,0;;    // present?
+(p7)   br.cond.spnt.few 1f;;
+       // if ifa is in range of tlb, don't bother to check rid, go slow path
+       ld8 r21=[r25],8;;
+       mov r23=1
+       extr.u r21=r21,2,6;;
+       shl r22=r23,r21
+       ld8 r21=[r25],8;;
+       cmp.ltu p7,p0=r17,r21
+(p7)   br.cond.sptk.many 1f;
+       add r21=r22,r21;;
+       cmp.ltu p7,p0=r17,r21
+(p7)   br.cond.spnt.few page_fault;;
+       
+1:     // check the guest VHPT
+       adds r19 = XSI_PTA_OFS-XSI_PSR_IC_OFS, r18;;
+       ld8 r19=[r19];;
+       tbit.nz p7,p0=r19,IA64_PTA_VF_BIT;;     // long format VHPT
+(p7)   br.cond.spnt.few page_fault;;
+       // if (!rr.ve || !(pta & IA64_PTA_VE)) take slow way for now
+       // FIXME: later, we deliver an alt_d/i vector after thash and itir
+       tbit.z p7,p0=r19,IA64_PTA_VE_BIT;;      // 
+(p7)   br.cond.spnt.few page_fault;;
+       extr.u r25=r17,61,3;;
+       adds r21=XSI_RR0_OFS-XSI_PSR_IC_OFS,r18 ;;
+       shl r25=r25,3;;
+       add r21=r21,r25;;
+       ld8 r22=[r21];;
+       tbit.z p7,p0=r22,0
+(p7)   br.cond.spnt.few page_fault;;
+
+       // compute and save away itir (r22 & RR_PS_MASK)
+       movl r21=0xfc;;
+       and r22=r22,r21;;
+       adds r21=XSI_ITIR_OFS-XSI_PSR_IC_OFS,r18 ;;
+       st8 [r21]=r22;;
+       
+       // save away ifa
+       adds r21=XSI_IFA_OFS-XSI_PSR_IC_OFS,r18 ;;
+       st8 [r21]=r17;;
+       // see vcpu_thash to save away iha
+       shr.u r20 = r17, 61
+       addl r25 = 1, r0
+       movl r30 = 0xe000000000000000
+       ;;
+       and r21 = r30, r17              // VHPT_Addr1
+       ;;
+       shladd r28 = r20, 3, r18
+       adds r19 = XSI_PTA_OFS-XSI_PSR_IC_OFS, r18
+       ;;
+       adds r27 = XSI_RR0_OFS-XSI_PSR_IC_OFS, r28
+       addl r28 = 32767, r0
+       ld8 r24 = [r19]                 // pta
+       ;;
+       ld8 r23 = [r27]                 // rrs[vadr>>61]
+       extr.u r26 = r24, 2, 6
+       ;;
+       extr.u r22 = r23, 2, 6
+       shl r30 = r25, r26
+       ;;
+       shr.u r19 = r17, r22
+       shr.u r29 = r24, 15
+       ;;
+       adds r30 = -1, r30
+       ;;
+       shladd r27 = r19, 3, r0
+       extr.u r26 = r30, 15, 46
+       ;;
+       andcm r24 = r29, r26
+       and r19 = r28, r27
+       shr.u r25 = r27, 15
+       ;;
+       and r23 = r26, r25
+       ;;
+       or r22 = r24, r23
+       ;;
+       dep.z r20 = r22, 15, 46
+       ;;
+       or r30 = r20, r21
+       ;;
+       //or r8 = r19, r30
+       or r19 = r19, r30
+       ;;
+       adds r23=XSI_IHA_OFS-XSI_PSR_IC_OFS,r18 ;;
+       st8 [r23]=r19;;
+       // done with thash, check guest VHPT
+
+       adds r20 = XSI_PTA_OFS-XSI_PSR_IC_OFS, r18;;
+       ld8 r24 = [r20];;                       // pta
+       // avoid recursively walking the VHPT
+       // if (((r17=address ^ r24=pta) & ((itir_mask(pta) << 3) >> 3)) != 0) {
+       mov r20=-8
+       xor r21=r17,r24
+       extr.u r24=r24,2,6;;
+       shl r20=r20,r24;;
+       shr.u r20=r20,3;;
+       and r21=r20,r21;;
+       cmp.eq p7,p0=r21,r0
+(p7)   br.cond.spnt.few 1f;;
+       // __copy_from_user(&pte, r19=(void *)(*iha), sizeof(pte)=8)
+       // prepare for possible nested dtlb fault
+       mov r29=b0
+       movl r30=guest_vhpt_miss;;
+       // now go fetch the entry from the guest VHPT
+       ld8 r20=[r19];;
+       // if we wind up here, we successfully loaded the VHPT entry
+
+       // this VHPT walker aborts on non-present pages instead
+       // of inserting a not-present translation, this allows
+       // vectoring directly to the miss handler
+       tbit.z p7,p0=r20,0
+(p7)   br.cond.spnt.few page_not_present;;
+
+#ifdef FAST_REFLECT_CNT
+       movl r21=fast_vhpt_translate_count;;
+       ld8 r22=[r21];;
+       adds r22=1,r22;;
+       st8 [r21]=r22;;
+#endif
+
+// prepare for fast_insert(PSCB(ifa),PSCB(itir),r16=pte)
+//     r16 == pte
+//     r17 == bit0: 1=inst, 0=data; bit1: 1=itc, 0=vcpu_translate
+//     r18 == XSI_PSR_IC_OFS
+//     r24 == ps
+//     r29 == saved value of b0 in case of recovery
+//     r30 == recovery ip if failure occurs
+//     r31 == pr
+       tbit.nz p6,p7=r16,IA64_ISR_X_BIT;;
+(p6)   mov r17=1;;
+(p7)   mov r17=0;;
+       mov r16=r20
+       mov r29=b0 ;;
+       movl r30=recover_and_page_fault ;;
+       adds r21=XSI_ITIR_OFS-XSI_PSR_IC_OFS,r18 ;;
+       ld8 r24=[r21];;
+       extr.u r24=r24,2,6;;
+       // IFA already in PSCB
+       br.cond.sptk.many fast_insert;;
+
+// we get here if fast_insert fails (e.g. due to metaphysical lookup)
+ENTRY(recover_and_page_fault)
+#ifdef FAST_REFLECT_CNT
+       movl r21=recover_to_page_fault_count;;
+       ld8 r22=[r21];;
+       adds r22=1,r22;;
+       st8 [r21]=r22;;
+#endif
+       mov b0=r29;;
+       br.cond.sptk.many page_fault;;
+
+// if we wind up here, we missed in guest VHPT so recover
+// from nested dtlb fault and reflect a tlb fault to the guest
+guest_vhpt_miss:
+       mov b0=r29;;
+       // fault = IA64_VHPT_FAULT
+       mov r20=r0
+       br.cond.sptk.many 1f;
+
+       // if we get to here, we are ready to reflect
+       // need to set up virtual ifa, iha, itir (fast_reflect handles
+       // virtual isr, iip, ipsr, ifs
+       // see vcpu_get_itir_on_fault: get ps,rid,(FIXME key) from rr[ifa]
+page_not_present:
+       tbit.nz p6,p7=r16,IA64_ISR_X_BIT;;
+(p6)   movl r20=0x400;;
+(p7)   movl r20=0x800;;
+
+1:     extr.u r25=r17,61,3;;
+       adds r21=XSI_RR0_OFS-XSI_PSR_IC_OFS,r18 ;;
+       shl r25=r25,3;;
+       add r21=r21,r25;;
+       ld8 r22=[r21];;
+       extr.u r22=r22,2,30;;
+       dep.z r22=r22,2,30;;
+       adds r23=XSI_ITIR_OFS-XSI_PSR_IC_OFS,r18 ;;
+       st8 [r23]=r22;;
+
+       // fast reflect expects
+       //      r16 == cr.isr
+       //      r18 == XSI_PSR_IC
+       //      r20 == offset into ivt
+       //      r29 == iip
+       //      r30 == ipsr
+       //      r31 == pr
+       //mov r16=cr.isr
+       mov r29=cr.iip
+       mov r30=cr.ipsr
+       br.sptk.many fast_reflect;;
+END(fast_tlb_miss_reflect)
 
 // ensure that, if giving up, registers at entry to fast_hyperprivop unchanged
 ENTRY(hyper_rfi)
@@ -807,6 +1073,7 @@
        // OK, now all set to go except for switch to virtual bank1
        mov r22=1;; st4 [r20]=r22;
        mov r30=r2; mov r29=r3;;
+    mov r17=ar.unat;;
     adds r16=XSI_B1NATS_OFS-XSI_PSR_IC_OFS,r18
        adds r2=XSI_BANK1_OFS-XSI_PSR_IC_OFS,r18;
        adds r3=(XSI_BANK1_OFS+8)-XSI_PSR_IC_OFS,r18;;
@@ -832,6 +1099,7 @@
        .mem.offset 8,0; ld8.fill r30=[r2],16 ;
        .mem.offset 8,0; ld8.fill r31=[r3],16 ;;
        bsw.0 ;;
+    mov ar.unat=r17;;
        mov r2=r30; mov r3=r29;;
 1:     mov pr=r31,-1
        ;;
@@ -1485,7 +1753,7 @@
        adds r21=XSI_KR0_OFS-XSI_PSR_IC_OFS,r18 ;;
        shl r20=r8,3;;
        add r22=r20,r21;;
-       st8 [r21]=r9;;
+       st8 [r22]=r9;;
        cmp.eq p7,p0=r8,r0
        adds r8=-1,r8;;
 (p7)   mov ar0=r9;;
@@ -1671,6 +1939,17 @@
        ;;
 END(hyper_ptc_ga)
 
+// recovery block for hyper_itc metaphysical memory lookup
+ENTRY(recover_and_dispatch_break_fault)
+#ifdef FAST_REFLECT_CNT
+       movl r21=recover_to_break_fault_count;;
+       ld8 r22=[r21];;
+       adds r22=1,r22;;
+       st8 [r21]=r22;;
+#endif
+       mov b0=r29 ;;
+       br.sptk.many dispatch_break_fault;;
+
 //  Registers at entry
 //     r17 = break immediate (XEN_HYPER_ITC_D or I)
 //     r18 == XSI_PSR_IC_OFS
@@ -1680,24 +1959,14 @@
        // fall through, hyper_itc_d handles both i and d
 ENTRY(hyper_itc_d)
 #ifndef FAST_ITC
-       br.spnt.many dispatch_break_fault ;;
-#endif
+       br.sptk.many dispatch_break_fault ;;
+#endif
+       // ensure itir.ps >= xen's pagesize
        adds r23=XSI_ITIR_OFS-XSI_PSR_IC_OFS,r18 ;;
        ld8 r23=[r23];;
        extr.u r24=r23,2,6;;            // r24==logps
        cmp.gt p7,p0=PAGE_SHIFT,r24
 (p7)   br.spnt.many dispatch_break_fault ;;
-       // translate_domain_pte(r8=pteval,PSCB(ifa)=address,r24=itir)
-       mov r19=1;;
-       shl r20=r19,r24;;
-       adds r20=-1,r20;;       // r20 == mask
-       movl r19=_PAGE_PPN_MASK;;
-       and r22=r8,r19;;        // r22 == pteval & _PAGE_PPN_MASK
-       andcm r19=r22,r20;;
-       adds r21=XSI_IFA_OFS-XSI_PSR_IC_OFS,r18 ;;
-       ld8 r21=[r21];;
-       and r20=r21,r20;;
-       or r19=r19,r20;;        // r19 == mpaddr
        movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
        ld8 r27=[r27];;
        adds r27=IA64_VCPU_DOMAIN_OFFSET,r27;;
@@ -1708,7 +1977,6 @@
 // FIXME: for now, only handle dom0 (see lookup_domain_mpa below)
        cmp.ne p7,p0=r27,r28
 (p7)   br.spnt.many dispatch_break_fault ;;
-       // if region 6, go slow way
 #ifdef FAST_HYPERPRIVOP_CNT
        cmp.eq p6,p7=XEN_HYPER_ITC_D,r17;;
 (p6)   movl r20=fast_hyperpriv_cnt+(8*XEN_HYPER_ITC_D);;
@@ -1717,19 +1985,47 @@
        adds r21=1,r21;;
        st8 [r20]=r21;;
 #endif
+(p6)   mov r17=2;;
+(p7)   mov r17=3;;
+       mov r29=b0 ;;
+       movl r30=recover_and_dispatch_break_fault ;;
+       mov r16=r8;;
+       // fall through
+
+
+// fast_insert(PSCB(ifa),r24=ps,r16=pte)
+//     r16 == pte
+//     r17 == bit0: 1=inst, 0=data; bit1: 1=itc, 0=vcpu_translate
+//     r18 == XSI_PSR_IC_OFS
+//     r24 == ps
+//     r29 == saved value of b0 in case of recovery
+//     r30 == recovery ip if failure occurs
+//     r31 == pr
+GLOBAL_ENTRY(fast_insert)
+       // translate_domain_pte(r16=pteval,PSCB(ifa)=address,r24=itir)
+       mov r19=1;;
+       shl r20=r19,r24;;
+       adds r20=-1,r20;;       // r20 == mask
+       movl r19=_PAGE_PPN_MASK;;
+       and r22=r16,r19;;       // r22 == pteval & _PAGE_PPN_MASK
+       andcm r19=r22,r20;;
+       adds r21=XSI_IFA_OFS-XSI_PSR_IC_OFS,r18 ;;
+       ld8 r21=[r21];;
+       and r20=r21,r20;;
+       or r19=r19,r20;;        // r19 == mpaddr
 // FIXME: for now, just do domain0 and skip mpaddr range checks
        dep r20=r0,r19,0,PAGE_SHIFT
        movl r21=PAGE_PHYS ;;
        or r20=r20,r21 ;;       // r20==return value from lookup_domain_mpa
-       // r8=pteval,r20=pteval2
+       // r16=pteval,r20=pteval2
        movl r19=_PAGE_PPN_MASK
        movl r21=_PAGE_PL_2;;
-       andcm r25=r8,r19;;      // r25==pteval & ~_PAGE_PPN_MASK
+       andcm r25=r16,r19;;     // r25==pteval & ~_PAGE_PPN_MASK
        and r22=r20,r19;;
        or r22=r22,r21;;
        or r22=r22,r25;;        // r22==return value from translate_domain_pte
        // done with translate_domain_pte
-       // now do vcpu_itc_no_srlz(vcpu,IorD,ifa,r22=pte,r8=mppte,r24=logps)
+       // now do vcpu_itc_no_srlz(vcpu,IorD,ifa,r22=pte,r16=mppte,r24=logps)
 // FIXME: for now, just domain0 and skip range check
        // psr.ic already cleared
        // NOTE: r24 still contains ps (from above)
@@ -1738,7 +2034,7 @@
        adds r23=XSI_IFA_OFS-XSI_PSR_IC_OFS,r18 ;;
        ld8 r23=[r23];;
        mov cr.ifa=r23;;
-       cmp.eq p6,p7=XEN_HYPER_ITC_D,r17;;
+       tbit.z p6,p7=r17,0;;
 (p6)   itc.d r22;;
 (p7)   itc.i r22;;
        dv_serialize_data
@@ -1755,7 +2051,7 @@
        st8 [r20]=r21;;
        // vcpu_set_tr_entry(trp,r22=pte|1,r24=itir,r23=ifa)
        // TR_ENTRY = {page_flags,itir,addr,rid}
-       cmp.eq p6,p7=XEN_HYPER_ITC_D,r17
+       tbit.z p6,p7=r17,0;;
        movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
        ld8 r27=[r27];;
        adds r28=IA64_VCPU_STARTING_RID_OFFSET,r27
@@ -1766,7 +2062,6 @@
        mov r19=-4096;;
        and r23=r23,r19;;
        st8 [r27]=r23,8;;       // ifa & ~0xfff
-// ?? is virtualize_rid(v,get_rr(ifa))==vcpu_get_rr(ifa)?? YES!!
        adds r29 = XSI_RR0_OFS-XSI_PSR_IC_OFS,r18
        extr.u r25=r23,61,3;;
        shladd r29=r25,3,r29;;
@@ -1804,13 +2099,16 @@
        //PSCBX(vcpu,i/dtlb_pte) = mp_pte
        movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
        ld8 r27=[r27];;
-       cmp.eq p6,p7=XEN_HYPER_ITC_D,r17;;
+       tbit.z p6,p7=r17,0;;
 (p6)   adds r27=IA64_VCPU_DTLB_PTE_OFFSET,r27
 (p7)   adds r27=IA64_VCPU_ITLB_PTE_OFFSET,r27;;
-       st8 [r27]=r8;;
+       st8 [r27]=r16;;
        // done with vcpu_itc_no_srlz
 
-       // done, increment to point to next instruction
+       // if hyper_itc, increment to point to next instruction
+       tbit.z p7,p0=r17,1
+(p7)   br.cond.sptk.few no_inc_iip;;
+
        mov r29=cr.ipsr
        mov r30=cr.iip;;
        extr.u r26=r29,41,2 ;;
@@ -1822,8 +2120,11 @@
        dep r29=r26,r29,41,2
        ;;
        mov cr.ipsr=r29
-       mov cr.iip=r30
+       mov cr.iip=r30;;
+
+no_inc_iip:
        mov pr=r31,-1 ;;
        rfi
        ;;
-END(hyper_itc_d)
+END(fast_insert)
+
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/ivt.S
--- a/xen/arch/ia64/xen/ivt.S   Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/ivt.S   Tue Nov  8 11:31:43 2005
@@ -246,7 +246,8 @@
 #ifdef XEN
        VHPT_CCHAIN_LOOKUP(itlb_miss,i)
 #ifdef VHPT_GLOBAL
-       br.cond.sptk page_fault
+//     br.cond.sptk page_fault
+       br.cond.sptk fast_tlb_miss_reflect
        ;;
 #endif
 #endif
@@ -297,7 +298,8 @@
 #ifdef XEN
        VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
 #ifdef VHPT_GLOBAL
-       br.cond.sptk page_fault
+//     br.cond.sptk page_fault
+       br.cond.sptk fast_tlb_miss_reflect
        ;;
 #endif
 #endif
@@ -485,6 +487,11 @@
 // 0x1400 Entry 5 (size 64 bundles) Data nested TLB (6,45)
 ENTRY(nested_dtlb_miss)
        DBG_FAULT(5)
+#ifdef XEN
+       mov b0=r30
+       br.sptk.many b0                         // return to continuation point
+       ;;
+#endif
        /*
         * In the absence of kernel bugs, we get here when the virtually mapped 
linear
         * page table is accessed non-speculatively (e.g., in the Dirty-bit, 
Instruction
@@ -562,7 +569,11 @@
 
        
//-----------------------------------------------------------------------------------
        // call do_page_fault (predicates are in r31, psr.dt may be off, r16 is 
faulting address)
+#ifdef XEN
+GLOBAL_ENTRY(page_fault)
+#else
 ENTRY(page_fault)
+#endif
        ssm psr.dt
        ;;
        srlz.i
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/privop.c
--- a/xen/arch/ia64/xen/privop.c        Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/privop.c        Tue Nov  8 11:31:43 2005
@@ -1040,6 +1040,9 @@
 extern unsigned long tr_translate_count;
 extern unsigned long phys_translate_count;
 extern unsigned long vhpt_translate_count;
+extern unsigned long fast_vhpt_translate_count;
+extern unsigned long recover_to_page_fault_count;
+extern unsigned long recover_to_break_fault_count;
 extern unsigned long lazy_cover_count;
 extern unsigned long idle_when_pending;
 extern unsigned long pal_halt_light_count;
@@ -1049,9 +1052,12 @@
 {
        char *s = buf;
        s += sprintf(s,"Virtual TR translations: %d\n",tr_translate_count);
-       s += sprintf(s,"Virtual VHPT translations: %d\n",vhpt_translate_count);
+       s += sprintf(s,"Virtual VHPT slow translations: 
%d\n",vhpt_translate_count);
+       s += sprintf(s,"Virtual VHPT fast translations: 
%d\n",fast_vhpt_translate_count);
        s += sprintf(s,"Virtual DTLB translations: %d\n",dtlb_translate_count);
        s += sprintf(s,"Physical translations: %d\n",phys_translate_count);
+       s += sprintf(s,"Recoveries to page fault: 
%d\n",recover_to_page_fault_count);
+       s += sprintf(s,"Recoveries to break fault: 
%d\n",recover_to_break_fault_count);
        s += sprintf(s,"Idle when pending: %d\n",idle_when_pending);
        s += sprintf(s,"PAL_HALT_LIGHT (no pending): 
%d\n",pal_halt_light_count);
        s += sprintf(s,"context switches: %d\n",context_switch_count);
@@ -1065,6 +1071,9 @@
        tr_translate_count = 0;
        phys_translate_count = 0;
        vhpt_translate_count = 0;
+       fast_vhpt_translate_count = 0;
+       recover_to_page_fault_count = 0;
+       recover_to_break_fault_count = 0;
        lazy_cover_count = 0;
        pal_halt_light_count = 0;
        idle_when_pending = 0;
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/process.c
--- a/xen/arch/ia64/xen/process.c       Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/process.c       Tue Nov  8 11:31:43 2005
@@ -83,9 +83,8 @@
     if(VMX_DOMAIN(current)){
        vmx_load_all_rr(current);
     }else{
-           if (rr7 = load_region_regs(current)) {
-                   printk("schedule_tail: change to rr7 not yet 
implemented\n");
-       }
+           load_region_regs(current);
+            vcpu_load_kernel_regs(current);
     }
 }
 
@@ -185,6 +184,7 @@
        if (!(PSCB(v,ipsr) & IA64_PSR_DT)) {
                panic_domain(regs,"psr.dt off, trying to deliver nested 
dtlb!\n");
        }
+       vector &= ~0xf;
        if (vector != IA64_DATA_TLB_VECTOR &&
                vector != IA64_ALT_DATA_TLB_VECTOR &&
                vector != IA64_VHPT_TRANS_VECTOR) {
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/regionreg.c
--- a/xen/arch/ia64/xen/regionreg.c     Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/regionreg.c     Tue Nov  8 11:31:43 2005
@@ -341,23 +341,13 @@
 // rr7 (because we have to to assembly and physical mode
 // to change rr7).  If no change to rr7 is required, returns 0.
 //
-unsigned long load_region_regs(struct vcpu *v)
+void load_region_regs(struct vcpu *v)
 {
        unsigned long rr0, rr1,rr2, rr3, rr4, rr5, rr6, rr7;
        // TODO: These probably should be validated
        unsigned long bad = 0;
 
        if (VCPU(v,metaphysical_mode)) {
-               ia64_rr rrv;
-
-#if 0
-               rrv.rrval = 0;
-               rrv.rid = v->domain->arch.metaphysical_rr0;
-               rrv.ps = PAGE_SHIFT;
-               rrv.ve = 1;
-               rr0 = rrv.rrval;
-               set_rr_no_srlz(0x0000000000000000L, rr0);
-#endif
                rr0 = v->domain->arch.metaphysical_rr0;
                ia64_set_rr(0x0000000000000000L, rr0);
                ia64_srlz_d();
@@ -383,5 +373,4 @@
        if (bad) {
                panic_domain(0,"load_region_regs: can't set! bad=%lx\n",bad);
        }
-       return 0;
-}
+}
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/vcpu.c  Tue Nov  8 11:31:43 2005
@@ -134,6 +134,18 @@
 /**************************************************************************
  VCPU privileged application register access routines
 **************************************************************************/
+
+void vcpu_load_kernel_regs(VCPU *vcpu)
+{
+       ia64_set_kr(0, VCPU(vcpu, krs[0]));
+       ia64_set_kr(1, VCPU(vcpu, krs[1]));
+       ia64_set_kr(2, VCPU(vcpu, krs[2]));
+       ia64_set_kr(3, VCPU(vcpu, krs[3]));
+       ia64_set_kr(4, VCPU(vcpu, krs[4]));
+       ia64_set_kr(5, VCPU(vcpu, krs[5]));
+       ia64_set_kr(6, VCPU(vcpu, krs[6]));
+       ia64_set_kr(7, VCPU(vcpu, krs[7]));
+}
 
 IA64FAULT vcpu_set_ar(VCPU *vcpu, UINT64 reg, UINT64 val)
 {
@@ -1271,6 +1283,9 @@
 #define itir_mask(itir) (~((1UL << itir_ps(itir)) - 1))
 
 unsigned long vhpt_translate_count = 0;
+unsigned long fast_vhpt_translate_count = 0;
+unsigned long recover_to_page_fault_count = 0;
+unsigned long recover_to_break_fault_count = 0;
 
 IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 
*pteval, UINT64 *itir, UINT64 *iha)
 {
@@ -1872,4 +1887,3 @@
        // don't forget to recompute itr_regions
        return (IA64_ILLOP_FAULT);
 }
-
diff -r 8e1703090053 -r a5195bf5671d xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c       Tue Nov  8 11:30:38 2005
+++ b/xen/arch/ia64/xen/xenmisc.c       Tue Nov  8 11:31:43 2005
@@ -290,8 +290,8 @@
 
//prev->domain->domain_id,(long)prev&0xffffff,next->domain->domain_id,(long)next&0xffffff);
 //if (prev->domain->domain_id == 1 && next->domain->domain_id == 0) cs10foo();
 //if (prev->domain->domain_id == 0 && next->domain->domain_id == 1) cs01foo();
-printk("@@sw%d/%x %d->%d\n",smp_processor_id(), hard_smp_processor_id (),
-       prev->domain->domain_id,next->domain->domain_id);
+//printk("@@sw%d/%x %d->%d\n",smp_processor_id(), hard_smp_processor_id (),
+//       prev->domain->domain_id,next->domain->domain_id);
     if(VMX_DOMAIN(prev)){
        vtm_domain_out(prev);
     }
@@ -320,6 +320,7 @@
                VHPT_ENABLED);
        if (!is_idle_task(current->domain)) {
                load_region_regs(current);
+               vcpu_load_kernel_regs(current);
                    if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
        }
            if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
diff -r 8e1703090053 -r a5195bf5671d xen/include/asm-ia64/time.h
--- a/xen/include/asm-ia64/time.h       Tue Nov  8 11:30:38 2005
+++ b/xen/include/asm-ia64/time.h       Tue Nov  8 11:31:43 2005
@@ -1,1 +1,2 @@
 #include <asm/linux/time.h>
+#include <asm/timex.h>
diff -r 8e1703090053 -r a5195bf5671d 
linux-2.6-xen-sparse/arch/ia64/xen/xen_ksyms.c
--- /dev/null   Tue Nov  8 11:30:38 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xen_ksyms.c    Tue Nov  8 11:31:43 2005
@@ -0,0 +1,12 @@
+/*
+ * Architecture-specific kernel symbols
+ *
+ * Don't put any exports here unless it's defined in an assembler file.
+ * All other exports should be put directly after the definition.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+
+extern int is_running_on_xen(void);
+EXPORT_SYMBOL(is_running_on_xen);

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

<Prev in Thread] Current Thread [Next in Thread>