From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: [PATCH 3/9] privcmd interface addition to support share operations from Dom0 userspace Date: Tue, 06 Jun 2006 15:50:02 +1000 Message-ID: <1149573002.5183.32.camel@localhost.localdomain> References: <1149572143.5183.25.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1149572143.5183.25.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Mailing List List-Id: xen-devel@lists.xenproject.org Subject: privcmd interface addition to support share operations from Dom0 userspace We create to simple privcmd ops to create and grant access to shares. diff -r 6d476981e3a5 -r 07a00d96357d linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Sun May 28 14:49:17 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Wed May 31 05:33:38 2006 @@ -268,6 +268,7 @@ set_bit(__HYPERVISOR_xen_version, hypercall_permission_map); set_bit(__HYPERVISOR_sched_op, hypercall_permission_map); set_bit(__HYPERVISOR_sched_op_compat, hypercall_permission_map); + set_bit(__HYPERVISOR_share_op, hypercall_permission_map); set_bit(__HYPERVISOR_event_channel_op_compat, hypercall_permission_map); diff -r 6d476981e3a5 -r 07a00d96357d tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Sun May 28 14:49:17 2006 +++ b/tools/libxc/xc_domain.c Wed May 31 05:33:38 2006 @@ -482,6 +482,25 @@ return rc; } + +share_ref_t xc_create_shared_pages(int xc_handle, unsigned int num_pages) +{ + DECLARE_DOM0_OP; + + op.cmd = DOM0_CREATESHAREDPAGES; + op.u.createsharedpages.num = num_pages; + return do_dom0_op(xc_handle, &op); +} + +int xc_grant_shared_pages(int xc_handle, domid_t domid, share_ref_t share_ref) +{ + DECLARE_DOM0_OP; + + op.cmd = DOM0_GRANTSHAREDPAGES; + op.u.grantsharedpages.domain = domid; + op.u.grantsharedpages.share_ref = share_ref; + return do_dom0_op(xc_handle, &op); +} int xc_domain_irq_permission(int xc_handle, uint32_t domid, diff -r 6d476981e3a5 -r 07a00d96357d tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Sun May 28 14:49:17 2006 +++ b/tools/libxc/xenctrl.h Wed May 31 05:33:38 2006 @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef __ia64__ #define XC_PAGE_SHIFT 14 @@ -584,6 +585,10 @@ int xc_version(int xc_handle, int cmd, void *arg); +/* Create & add permissions to sharable pages. */ +share_ref_t xc_create_shared_pages(int xc_handle, unsigned int num_pages); +int xc_grant_shared_pages(int xc_handle, domid_t domid, share_ref_t share_ref); + /* * MMU updates. */ -- ccontrol: http://ccontrol.ozlabs.org