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-ppc-devel

[XenPPC] [pushed] [ppc] deal with XEN_GUEST_HANDLE definitions

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [pushed] [ppc] deal with XEN_GUEST_HANDLE definitions
From: jimix@xxxxxxxxxxxxxx
Date: Thu, 11 May 2006 15:41:16 -0400
Delivery-date: Thu, 11 May 2006 12:39:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
changeset:   27801:ce5e6ac1abdace30a6a616ece0d6df6f567bf16f
tag:         tip
user:        jimix@xxxxxxxxxxxxxxxxxxxxx
date:        Thu May 11 15:40:11 2006 -0400
files:       arch/powerpc/platforms/xen/hcall.c
description:
[ppc] deal with XEN_GUEST_HANDLE definitions


diff -r 257c44c865e917f285499125c2ca62c199312172 -r 
ce5e6ac1abdace30a6a616ece0d6df6f567bf16f arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c        Thu May 11 15:39:37 2006 -0400
+++ b/arch/powerpc/platforms/xen/hcall.c        Thu May 11 15:40:11 2006 -0400
@@ -12,6 +12,13 @@
 #include <asm/uaccess.h>
 #include <asm/hvcall.h>
 
+/*
+ * There is some serious guest hande effage heppening in this file so
+ * this makes it a little easier to manage 
+ */
+#define xen_guest_handle(hnd)  ((hnd).p)
+
+
 /* we need a xencomm descriptor to cover the dom0 op itself, plus one for every
  * pointer to another data structure. */
 static int xenppc_privcmd_dom0_op(privcmd_hypercall_t *hypercall)
@@ -34,90 +41,106 @@ static int xenppc_privcmd_dom0_op(privcm
                return ret;
 
        switch (kern_op.cmd) {
-               case DOM0_GETMEMLIST:
-                       ret = xencomm_create(kern_op.u.getmemlist.buffer,
-                                               kern_op.u.getmemlist.max_pfns * 
sizeof(unsigned long),
-                                               &desc, GFP_KERNEL);
-                       kern_op.u.getmemlist.buffer = (void *)__pa(desc);
-                       break;
-               case DOM0_SETVCPUCONTEXT:
-                       ret = xencomm_create(kern_op.u.setvcpucontext.ctxt,
-                                            sizeof(vcpu_guest_context_t),
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.setvcpucontext.ctxt = (void *)__pa(desc);
-                       break;
-               case DOM0_READCONSOLE:
-                       ret = xencomm_create(kern_op.u.readconsole.buffer,
-                                            kern_op.u.readconsole.count,
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.readconsole.buffer = (void *)__pa(desc);
-                       break;
-               case DOM0_GETPAGEFRAMEINFO2:
-                       ret = xencomm_create(kern_op.u.getpageframeinfo2.array,
-                                            kern_op.u.getpageframeinfo2.num,
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.getpageframeinfo2.array = (void *)__pa(desc);
-                       break;
-               case DOM0_PERFCCONTROL:
-                       ret = xencomm_create(kern_op.u.perfccontrol.desc,
-                                            kern_op.u.perfccontrol.nr_counters 
*
-                                            sizeof(dom0_perfc_desc_t),
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.perfccontrol.desc = (void *)__pa(desc);
-                       break;
-               case DOM0_GETVCPUCONTEXT:
-                       ret = xencomm_create(kern_op.u.getvcpucontext.ctxt,
-                                            sizeof(vcpu_guest_context_t),
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.getvcpucontext.ctxt = (void *)__pa(desc);
-                       break;
-               case DOM0_GETDOMAININFOLIST:
-                       ret = xencomm_create(kern_op.u.getdomaininfolist.buffer,
-                                            
kern_op.u.getdomaininfolist.num_domains *
-                                            sizeof(dom0_getdomaininfo_t),
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.getdomaininfolist.buffer = (void *)__pa(desc);
-                       break;
-               case DOM0_PHYSICAL_MEMORY_MAP:
-                       ret = 
xencomm_create(kern_op.u.physical_memory_map.memory_map,
-                                            
kern_op.u.physical_memory_map.nr_map_entries *
-                                            sizeof(struct 
dom0_memory_map_entry),
-                                            &desc, GFP_KERNEL);
-                       kern_op.u.physical_memory_map.memory_map = (void 
*)__pa(desc);
-                       break;
-
-               case DOM0_SCHEDCTL:
-               case DOM0_ADJUSTDOM:
-               case DOM0_CREATEDOMAIN:
-               case DOM0_DESTROYDOMAIN:
-               case DOM0_PAUSEDOMAIN:
-               case DOM0_UNPAUSEDOMAIN:
-               case DOM0_GETDOMAININFO:
-               case DOM0_MSR:
-               case DOM0_SETTIME:
-               case DOM0_GETPAGEFRAMEINFO:
-               case DOM0_SETVCPUAFFINITY:
-               case DOM0_TBUFCONTROL:
-               case DOM0_PHYSINFO:
-               case DOM0_SCHED_ID:
-               case DOM0_SETDOMAINMAXMEM:
-               case DOM0_ADD_MEMTYPE:
-               case DOM0_DEL_MEMTYPE:
-               case DOM0_READ_MEMTYPE:
-               case DOM0_IOPORT_PERMISSION:
-               case DOM0_GETVCPUINFO:
-               case DOM0_PLATFORM_QUIRK:
-               case DOM0_MAX_VCPUS:
-               case DOM0_SETDOMAINHANDLE:
-               case DOM0_SETDEBUGGING:
-                       /* no munging needed */
-                       break;
-
-               default:
-                       /* unknown */
-                       ret = -ENOSYS;
-       }
-
+       case DOM0_GETMEMLIST:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.getmemlist.buffer),
+                       kern_op.u.getmemlist.max_pfns * sizeof(unsigned long),
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.getmemlist.buffer,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_SETVCPUCONTEXT:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.setvcpucontext.ctxt),
+                       sizeof(vcpu_guest_context_t),
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.setvcpucontext.ctxt,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_READCONSOLE:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.readconsole.buffer),
+                       kern_op.u.readconsole.count,
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.readconsole.buffer,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_GETPAGEFRAMEINFO2:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.getpageframeinfo2.array),
+                       kern_op.u.getpageframeinfo2.num,
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.getpageframeinfo2.array,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_PERFCCONTROL:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.perfccontrol.desc),
+                       kern_op.u.perfccontrol.nr_counters *
+                       sizeof(dom0_perfc_desc_t),
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.perfccontrol.desc,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_GETVCPUCONTEXT:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.getvcpucontext.ctxt),
+                       sizeof(vcpu_guest_context_t),
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.getvcpucontext.ctxt,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_GETDOMAININFOLIST:
+               ret = xencomm_create(
+                       xen_guest_handle(kern_op.u.getdomaininfolist.buffer),
+                       kern_op.u.getdomaininfolist.num_domains *
+                       sizeof(dom0_getdomaininfo_t),
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.getdomaininfolist.buffer,
+                                    (void *)__pa(desc));
+               break;
+       case DOM0_PHYSICAL_MEMORY_MAP:
+               ret = xencomm_create(
+                       
xen_guest_handle(kern_op.u.physical_memory_map.memory_map),
+                       kern_op.u.physical_memory_map.nr_map_entries *
+                       sizeof(struct dom0_memory_map_entry),
+                       &desc, GFP_KERNEL);
+               set_xen_guest_handle(kern_op.u.physical_memory_map.memory_map,
+                                    (void *)__pa(desc));
+               break;
+               
+       case DOM0_SCHEDCTL:
+       case DOM0_ADJUSTDOM:
+       case DOM0_CREATEDOMAIN:
+       case DOM0_DESTROYDOMAIN:
+       case DOM0_PAUSEDOMAIN:
+       case DOM0_UNPAUSEDOMAIN:
+       case DOM0_GETDOMAININFO:
+       case DOM0_MSR:
+       case DOM0_SETTIME:
+       case DOM0_GETPAGEFRAMEINFO:
+       case DOM0_SETVCPUAFFINITY:
+       case DOM0_TBUFCONTROL:
+       case DOM0_PHYSINFO:
+       case DOM0_SCHED_ID:
+       case DOM0_SETDOMAINMAXMEM:
+       case DOM0_ADD_MEMTYPE:
+       case DOM0_DEL_MEMTYPE:
+       case DOM0_READ_MEMTYPE:
+       case DOM0_IOPORT_PERMISSION:
+       case DOM0_GETVCPUINFO:
+       case DOM0_PLATFORM_QUIRK:
+       case DOM0_MAX_VCPUS:
+       case DOM0_SETDOMAINHANDLE:
+       case DOM0_SETDEBUGGING:
+               /* no munging needed */
+               break;
+               
+       default:
+               /* unknown */
+               ret = -ENOSYS;
+       }
+       
        if (ret) {
                if (ret != -ENOSYS) {
                        /* error mapping the nested pointer */
@@ -158,14 +181,17 @@ static int xenppc_privcmd_memory_op(priv
                case XENMEM_increase_reservation:
                case XENMEM_decrease_reservation: {
                        struct xencomm_desc *desc = NULL;
-                       if (kern_op.extent_start) {
-                               ret = xencomm_create(kern_op.extent_start, 
-                                                    kern_op.nr_extents * 
sizeof(*kern_op.extent_start),
-                                                    &desc, GFP_KERNEL);
+                       if (xen_guest_handle(kern_op.extent_start)) {
+                               ret = xencomm_create(
+                                       xen_guest_handle(kern_op.extent_start), 
+                                       kern_op.nr_extents *
+                                       
sizeof(*xen_guest_handle(kern_op.extent_start)),
+                                       &desc, GFP_KERNEL);
                                if (ret)
                                        goto out;
 
-                               kern_op.extent_start = (void *)__pa(desc);
+                               set_xen_guest_handle(kern_op.extent_start,
+                                                    (void *)__pa(desc));
                        }
 
                        ret = plpar_hcall_norets(XEN_MARK(hypercall->op), 
hypercall->arg[0],



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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [pushed] [ppc] deal with XEN_GUEST_HANDLE definitions, jimix <=