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] Updated version to dom0_ops.c. After some discussion wit

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Updated version to dom0_ops.c. After some discussion with Ian,
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 21 Jun 2005 19:37:26 +0000
Cc: james@xxxxxxxxxxxxx
Delivery-date: Thu, 23 Jun 2005 11:03:18 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1713.2.17, 2005/06/21 13:37:26-06:00, djm@xxxxxxxxxxxxxxx

        Updated version to dom0_ops.c. After some discussion with Ian,
        we decided to remove newly added hypercall and instead turn
        to other means in user application level. Then rest stuff is
        all IA64 specific without any touch to common code.
        
        Signed-off-by Kevin Tian <Kevin.tian@xxxxxxxxx>



 dom0_ops.c |  157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 157 insertions(+)


diff -Nru a/xen/arch/ia64/dom0_ops.c b/xen/arch/ia64/dom0_ops.c
--- a/xen/arch/ia64/dom0_ops.c  2005-06-23 07:04:29 -04:00
+++ b/xen/arch/ia64/dom0_ops.c  2005-06-23 07:04:29 -04:00
@@ -27,6 +27,128 @@
 
     switch ( op->cmd )
     {
+    case DOM0_GETPAGEFRAMEINFO:
+    {
+        struct pfn_info *page;
+        unsigned long pfn = op->u.getpageframeinfo.pfn;
+        domid_t dom = op->u.getpageframeinfo.domain;
+        struct domain *d;
+
+        ret = -EINVAL;
+
+        if ( unlikely(pfn >= max_page) || 
+             unlikely((d = find_domain_by_id(dom)) == NULL) )
+            break;
+
+        page = &frame_table[pfn];
+
+        if ( likely(get_page(page, d)) )
+        {
+            ret = 0;
+
+            op->u.getpageframeinfo.type = NOTAB;
+
+            if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
+            {
+                switch ( page->u.inuse.type_info & PGT_type_mask )
+                {
+               default:
+                   panic("No such page type\n");
+                    break;
+                }
+            }
+            
+            put_page(page);
+        }
+
+        put_domain(d);
+
+        copy_to_user(u_dom0_op, op, sizeof(*op));
+    }
+    break;
+
+    case DOM0_GETPAGEFRAMEINFO2:
+    {
+#define GPF2_BATCH 128
+        int n,j;
+        int num = op->u.getpageframeinfo2.num;
+        domid_t dom = op->u.getpageframeinfo2.domain;
+        unsigned long *s_ptr = (unsigned long*) op->u.getpageframeinfo2.array;
+        struct domain *d;
+        unsigned long *l_arr;
+        ret = -ESRCH;
+
+        if ( unlikely((d = find_domain_by_id(dom)) == NULL) )
+            break;
+
+        if ( unlikely(num > 1024) )
+        {
+            ret = -E2BIG;
+            break;
+        }
+
+        l_arr = (unsigned long *)alloc_xenheap_page();
+ 
+        ret = 0;
+        for( n = 0; n < num; )
+        {
+            int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n);
+
+            if ( copy_from_user(l_arr, &s_ptr[n], k*sizeof(unsigned long)) )
+            {
+                ret = -EINVAL;
+                break;
+            }
+     
+            for( j = 0; j < k; j++ )
+            {      
+                struct pfn_info *page;
+                unsigned long mfn = l_arr[j];
+
+                if ( unlikely(mfn >= max_page) )
+                    goto e2_err;
+
+                page = &frame_table[mfn];
+  
+                if ( likely(get_page(page, d)) )
+                {
+                    unsigned long type = 0;
+
+                    switch( page->u.inuse.type_info & PGT_type_mask )
+                    {
+                   default:
+                       panic("No such page type\n");
+                       break;
+                    }
+
+                    if ( page->u.inuse.type_info & PGT_pinned )
+                        type |= LPINTAB;
+                    l_arr[j] |= type;
+                    put_page(page);
+                }
+                else
+                {
+                e2_err:
+                    l_arr[j] |= XTAB;
+                }
+
+            }
+
+            if ( copy_to_user(&s_ptr[n], l_arr, k*sizeof(unsigned long)) )
+            {
+                ret = -EINVAL;
+                break;
+            }
+
+            n += j;
+        }
+
+        free_xenheap_page((unsigned long)l_arr);
+
+        put_domain(d);
+    }
+    break;
+#ifndef CONFIG_VTI
     /*
      * NOTE: DOM0_GETMEMLIST has somewhat different semantics on IA64 -
      * it actually allocates and maps pages.
@@ -70,7 +192,42 @@
         }
     }
     break;
+#else
+    case DOM0_GETMEMLIST:
+    {
+       int i;
+       struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
+       unsigned long max_pfns = op->u.getmemlist.max_pfns;
+       unsigned long pfn;
+       unsigned long *buffer = op->u.getmemlist.buffer;
+       struct list_head *list_ent;
+
+       ret = -EINVAL;
+       if (!d) {
+           ret = 0;
+
+           spin_lock(&d->page_alloc_lock);
+           list_ent = d->page_list.next;
+           for (i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++) {
+               pfn = list_entry(list_ent, struct pfn_info, list) -
+                   frame_table;
+               if (put_user(pfn, buffer)) {
+                   ret = -EFAULT;
+                   break;
+               }
+               buffer++;
+               list_ent = frame_table[pfn].list.next;
+           }
+           spin_unlock(&d->page_alloc_lock);
 
+           op->u.getmemlist.num_pfns = i;
+           copy_to_user(u_dom0_op, op, sizeof(*op));
+
+           put_domain(d);
+       }
+    }
+    break;
+#endif // CONFIG_VTI
     default:
         ret = -ENOSYS;
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Updated version to dom0_ops.c. After some discussion with Ian,, BitKeeper Bot <=