direct-io.hg

changeset 11511:990bd509a5f5

[XEN][POWERPC] Split dom0_ops.c into domctl.c and sysctl.c.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Tue Sep 12 14:28:16 2006 -0500 (2006-09-12)
parents 2ba5452795d2
children 7b350fc692d5
files xen/arch/powerpc/Makefile xen/arch/powerpc/dom0_ops.c xen/arch/powerpc/domctl.c xen/arch/powerpc/sysctl.c
line diff
     1.1 --- a/xen/arch/powerpc/Makefile	Tue Sep 12 11:01:04 2006 -0400
     1.2 +++ b/xen/arch/powerpc/Makefile	Tue Sep 12 14:28:16 2006 -0500
     1.3 @@ -13,7 +13,7 @@ obj-y += dart.o
     1.4  obj-y += dart_u3.o
     1.5  obj-y += dart_u4.o
     1.6  obj-y += delay.o
     1.7 -obj-y += dom0_ops.o
     1.8 +obj-y += domctl.o
     1.9  obj-y += domain_build.o
    1.10  obj-y += domain.o
    1.11  obj-y += exceptions.o
    1.12 @@ -37,6 +37,7 @@ obj-y += setup.o
    1.13  obj-y += shadow.o
    1.14  obj-y += smp.o
    1.15  obj-y += smp-tbsync.o
    1.16 +obj-y += sysctl.o
    1.17  obj-y += time.o
    1.18  obj-y += usercopy.o
    1.19  
     2.1 --- a/xen/arch/powerpc/dom0_ops.c	Tue Sep 12 11:01:04 2006 -0400
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,154 +0,0 @@
     2.4 -/*
     2.5 - * This program is free software; you can redistribute it and/or modify
     2.6 - * it under the terms of the GNU General Public License as published by
     2.7 - * the Free Software Foundation; either version 2 of the License, or
     2.8 - * (at your option) any later version.
     2.9 - *
    2.10 - * This program is distributed in the hope that it will be useful,
    2.11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.13 - * GNU General Public License for more details.
    2.14 - *
    2.15 - * You should have received a copy of the GNU General Public License
    2.16 - * along with this program; if not, write to the Free Software
    2.17 - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    2.18 - *
    2.19 - * Copyright (C) IBM Corp. 2005
    2.20 - *
    2.21 - * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    2.22 - */
    2.23 -
    2.24 -#include <xen/config.h>
    2.25 -#include <xen/types.h>
    2.26 -#include <xen/lib.h>
    2.27 -#include <xen/sched.h>
    2.28 -#include <xen/guest_access.h>
    2.29 -#include <xen/shadow.h>
    2.30 -#include <public/xen.h>
    2.31 -#include <public/domctl.h>
    2.32 -#include <public/sysctl.h>
    2.33 -#include <asm/processor.h>
    2.34 -
    2.35 -void arch_getdomaininfo_ctxt(struct vcpu *, vcpu_guest_context_t *);
    2.36 -void arch_getdomaininfo_ctxt(struct vcpu *v, vcpu_guest_context_t *c)
    2.37 -{ 
    2.38 -    memcpy(&c->user_regs, &v->arch.ctxt, sizeof(struct cpu_user_regs));
    2.39 -    /* XXX fill in rest of vcpu_guest_context_t */
    2.40 -}
    2.41 -
    2.42 -long arch_do_domctl(struct xen_domctl *domctl,
    2.43 -                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
    2.44 -long arch_do_domctl(struct xen_domctl *domctl,
    2.45 -                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
    2.46 -{
    2.47 -    long ret = 0;
    2.48 -
    2.49 -    switch (domctl->cmd) {
    2.50 -    case XEN_DOMCTL_getmemlist:
    2.51 -    {
    2.52 -        int i;
    2.53 -        struct domain *d = find_domain_by_id(domctl->domain);
    2.54 -        unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
    2.55 -        xen_pfn_t mfn;
    2.56 -        struct list_head *list_ent;
    2.57 -
    2.58 -        ret = -EINVAL;
    2.59 -        if ( d != NULL )
    2.60 -        {
    2.61 -            ret = 0;
    2.62 -
    2.63 -            spin_lock(&d->page_alloc_lock);
    2.64 -            list_ent = d->page_list.next;
    2.65 -            for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
    2.66 -            {
    2.67 -                mfn = page_to_mfn(list_entry(
    2.68 -                    list_ent, struct page_info, list));
    2.69 -                if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
    2.70 -                                          i, &mfn, 1) )
    2.71 -                {
    2.72 -                    ret = -EFAULT;
    2.73 -                    break;
    2.74 -                }
    2.75 -                list_ent = mfn_to_page(mfn)->list.next;
    2.76 -            }
    2.77 -            spin_unlock(&d->page_alloc_lock);
    2.78 -
    2.79 -            domctl->u.getmemlist.num_pfns = i;
    2.80 -            copy_to_guest(u_domctl, domctl, 1);
    2.81 -            
    2.82 -            put_domain(d);
    2.83 -        }
    2.84 -    }
    2.85 -    break;
    2.86 -    case XEN_DOMCTL_shadow_op:
    2.87 -    {
    2.88 -        struct domain *d;
    2.89 -        ret = -ESRCH;
    2.90 -        d = find_domain_by_id(domctl->domain);
    2.91 -        if ( d != NULL )
    2.92 -        {
    2.93 -            ret = shadow_domctl(d, &domctl->u.shadow_op, u_domctl);
    2.94 -            put_domain(d);
    2.95 -            copy_to_guest(u_domctl, domctl, 1);
    2.96 -        } 
    2.97 -    }
    2.98 -    break;
    2.99 -    case XEN_DOMCTL_real_mode_area:
   2.100 -    {
   2.101 -        struct domain *d;
   2.102 -        unsigned int log = domctl->u.real_mode_area.log;
   2.103 -
   2.104 -        ret = -ESRCH;
   2.105 -        d = find_domain_by_id(domctl->domain);
   2.106 -        if (d != NULL) {
   2.107 -            ret = -EINVAL;
   2.108 -            if (cpu_rma_valid(log))
   2.109 -                ret = allocate_rma(d, log - PAGE_SHIFT);
   2.110 -            put_domain(d);
   2.111 -        }
   2.112 -    }
   2.113 -    break;
   2.114 -
   2.115 -    default:
   2.116 -        ret = -ENOSYS;
   2.117 -        break;
   2.118 -    }
   2.119 -
   2.120 -    return ret;
   2.121 -}
   2.122 -
   2.123 -long arch_do_sysctl(struct xen_sysctl *sysctl,
   2.124 -                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
   2.125 -long arch_do_sysctl(struct xen_sysctl *sysctl,
   2.126 -                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
   2.127 -{
   2.128 -    long ret = 0;
   2.129 -
   2.130 -    switch (sysctl->cmd) {
   2.131 -    case XEN_SYSCTL_physinfo:
   2.132 -    {
   2.133 -        xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
   2.134 -
   2.135 -        pi->threads_per_core = 1;
   2.136 -        pi->cores_per_socket = 1;
   2.137 -        pi->sockets_per_node = 1;
   2.138 -        pi->nr_nodes         = 1;
   2.139 -        pi->total_pages      = total_pages;
   2.140 -        pi->free_pages       = avail_domheap_pages();
   2.141 -        pi->cpu_khz          = cpu_khz;
   2.142 -        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
   2.143 -        ret = 0;
   2.144 -        if ( copy_to_guest(u_sysctl, sysctl, 1) )
   2.145 -            ret = -EFAULT;
   2.146 -    }
   2.147 -    break;
   2.148 -
   2.149 -    default:
   2.150 -        printk("%s: unsupported sysctl: 0x%x\n", __func__, (sysctl->cmd));
   2.151 -        ret = -ENOSYS;
   2.152 -        break;
   2.153 -    }
   2.154 -
   2.155 -    return ret;
   2.156 -}
   2.157 -
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/arch/powerpc/domctl.c	Tue Sep 12 14:28:16 2006 -0500
     3.3 @@ -0,0 +1,118 @@
     3.4 +/*
     3.5 + * This program is free software; you can redistribute it and/or modify
     3.6 + * it under the terms of the GNU General Public License as published by
     3.7 + * the Free Software Foundation; either version 2 of the License, or
     3.8 + * (at your option) any later version.
     3.9 + *
    3.10 + * This program is distributed in the hope that it will be useful,
    3.11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.13 + * GNU General Public License for more details.
    3.14 + *
    3.15 + * You should have received a copy of the GNU General Public License
    3.16 + * along with this program; if not, write to the Free Software
    3.17 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    3.18 + *
    3.19 + * Copyright (C) IBM Corp. 2005
    3.20 + *
    3.21 + * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    3.22 + */
    3.23 +
    3.24 +#include <xen/config.h>
    3.25 +#include <xen/types.h>
    3.26 +#include <xen/lib.h>
    3.27 +#include <xen/sched.h>
    3.28 +#include <xen/guest_access.h>
    3.29 +#include <xen/shadow.h>
    3.30 +#include <public/xen.h>
    3.31 +#include <public/domctl.h>
    3.32 +#include <public/sysctl.h>
    3.33 +#include <asm/processor.h>
    3.34 +
    3.35 +void arch_getdomaininfo_ctxt(struct vcpu *, vcpu_guest_context_t *);
    3.36 +void arch_getdomaininfo_ctxt(struct vcpu *v, vcpu_guest_context_t *c)
    3.37 +{ 
    3.38 +    memcpy(&c->user_regs, &v->arch.ctxt, sizeof(struct cpu_user_regs));
    3.39 +    /* XXX fill in rest of vcpu_guest_context_t */
    3.40 +}
    3.41 +
    3.42 +long arch_do_domctl(struct xen_domctl *domctl,
    3.43 +                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
    3.44 +long arch_do_domctl(struct xen_domctl *domctl,
    3.45 +                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
    3.46 +{
    3.47 +    long ret = 0;
    3.48 +
    3.49 +    switch (domctl->cmd) {
    3.50 +    case XEN_DOMCTL_getmemlist:
    3.51 +    {
    3.52 +        int i;
    3.53 +        struct domain *d = find_domain_by_id(domctl->domain);
    3.54 +        unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
    3.55 +        xen_pfn_t mfn;
    3.56 +        struct list_head *list_ent;
    3.57 +
    3.58 +        ret = -EINVAL;
    3.59 +        if ( d != NULL )
    3.60 +        {
    3.61 +            ret = 0;
    3.62 +
    3.63 +            spin_lock(&d->page_alloc_lock);
    3.64 +            list_ent = d->page_list.next;
    3.65 +            for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
    3.66 +            {
    3.67 +                mfn = page_to_mfn(list_entry(
    3.68 +                    list_ent, struct page_info, list));
    3.69 +                if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
    3.70 +                                          i, &mfn, 1) )
    3.71 +                {
    3.72 +                    ret = -EFAULT;
    3.73 +                    break;
    3.74 +                }
    3.75 +                list_ent = mfn_to_page(mfn)->list.next;
    3.76 +            }
    3.77 +            spin_unlock(&d->page_alloc_lock);
    3.78 +
    3.79 +            domctl->u.getmemlist.num_pfns = i;
    3.80 +            copy_to_guest(u_domctl, domctl, 1);
    3.81 +            
    3.82 +            put_domain(d);
    3.83 +        }
    3.84 +    }
    3.85 +    break;
    3.86 +    case XEN_DOMCTL_shadow_op:
    3.87 +    {
    3.88 +        struct domain *d;
    3.89 +        ret = -ESRCH;
    3.90 +        d = find_domain_by_id(domctl->domain);
    3.91 +        if ( d != NULL )
    3.92 +        {
    3.93 +            ret = shadow_domctl(d, &domctl->u.shadow_op, u_domctl);
    3.94 +            put_domain(d);
    3.95 +            copy_to_guest(u_domctl, domctl, 1);
    3.96 +        } 
    3.97 +    }
    3.98 +    break;
    3.99 +    case XEN_DOMCTL_real_mode_area:
   3.100 +    {
   3.101 +        struct domain *d;
   3.102 +        unsigned int log = domctl->u.real_mode_area.log;
   3.103 +
   3.104 +        ret = -ESRCH;
   3.105 +        d = find_domain_by_id(domctl->domain);
   3.106 +        if (d != NULL) {
   3.107 +            ret = -EINVAL;
   3.108 +            if (cpu_rma_valid(log))
   3.109 +                ret = allocate_rma(d, log - PAGE_SHIFT);
   3.110 +            put_domain(d);
   3.111 +        }
   3.112 +    }
   3.113 +    break;
   3.114 +
   3.115 +    default:
   3.116 +        ret = -ENOSYS;
   3.117 +        break;
   3.118 +    }
   3.119 +
   3.120 +    return ret;
   3.121 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/arch/powerpc/sysctl.c	Tue Sep 12 14:28:16 2006 -0500
     4.3 @@ -0,0 +1,65 @@
     4.4 +/*
     4.5 + * This program is free software; you can redistribute it and/or modify
     4.6 + * it under the terms of the GNU General Public License as published by
     4.7 + * the Free Software Foundation; either version 2 of the License, or
     4.8 + * (at your option) any later version.
     4.9 + *
    4.10 + * This program is distributed in the hope that it will be useful,
    4.11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.13 + * GNU General Public License for more details.
    4.14 + *
    4.15 + * You should have received a copy of the GNU General Public License
    4.16 + * along with this program; if not, write to the Free Software
    4.17 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    4.18 + *
    4.19 + * Copyright (C) IBM Corp. 2005
    4.20 + *
    4.21 + * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    4.22 + */
    4.23 +
    4.24 +#include <xen/config.h>
    4.25 +#include <xen/types.h>
    4.26 +#include <xen/lib.h>
    4.27 +#include <xen/sched.h>
    4.28 +#include <xen/guest_access.h>
    4.29 +#include <xen/shadow.h>
    4.30 +#include <public/xen.h>
    4.31 +#include <public/domctl.h>
    4.32 +#include <public/sysctl.h>
    4.33 +#include <asm/processor.h>
    4.34 +
    4.35 +long arch_do_sysctl(struct xen_sysctl *sysctl,
    4.36 +                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
    4.37 +long arch_do_sysctl(struct xen_sysctl *sysctl,
    4.38 +                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
    4.39 +{
    4.40 +    long ret = 0;
    4.41 +
    4.42 +    switch (sysctl->cmd) {
    4.43 +    case XEN_SYSCTL_physinfo:
    4.44 +    {
    4.45 +        xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
    4.46 +
    4.47 +        pi->threads_per_core = 1;
    4.48 +        pi->cores_per_socket = 1;
    4.49 +        pi->sockets_per_node = 1;
    4.50 +        pi->nr_nodes         = 1;
    4.51 +        pi->total_pages      = total_pages;
    4.52 +        pi->free_pages       = avail_domheap_pages();
    4.53 +        pi->cpu_khz          = cpu_khz;
    4.54 +        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
    4.55 +        ret = 0;
    4.56 +        if ( copy_to_guest(u_sysctl, sysctl, 1) )
    4.57 +            ret = -EFAULT;
    4.58 +    }
    4.59 +    break;
    4.60 +
    4.61 +    default:
    4.62 +        printk("%s: unsupported sysctl: 0x%x\n", __func__, (sysctl->cmd));
    4.63 +        ret = -ENOSYS;
    4.64 +        break;
    4.65 +    }
    4.66 +
    4.67 +    return ret;
    4.68 +}