debuggers.hg

view xen/common/compat/domain.c @ 19826:2f9e1348aa98

x86_64: allow more vCPU-s per guest

Since the shared info layout is fixed, guests are required to use
VCPUOP_register_vcpu_info prior to booting any vCPU beyond the
traditional limit of 32.

MAX_VIRT_CPUS, being an implemetation detail of the hypervisor, is no
longer being exposed in the public headers.

The tools changes are clearly incomplete (and done only so things
would
build again), and the current state of the tools (using scalar
variables all over the place to represent vCPU bitmaps) very likely
doesn't permit booting DomU-s with more than the traditional number of
vCPU-s. Testing of the extended functionality was done with Dom0 (96
vCPU-s, as well as 128 vCPU-s out of which the kernel elected - by way
of a simple kernel side patch - to use only some, resulting in a
sparse
bitmap).

ia64 changes only to make things build, and build-tested only (and the
tools part only as far as the build would go without encountering
unrelated problems in the blktap code).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 18 10:14:16 2009 +0100 (2009-06-18)
parents ebbd0e8c3e72
children bcee82a0e9d6
line source
1 /******************************************************************************
2 * domain.c
3 *
4 */
6 #include <xen/config.h>
7 #include <xen/lib.h>
8 #include <xen/sched.h>
9 #include <xen/domain.h>
10 #include <xen/guest_access.h>
11 #include <xen/hypercall.h>
12 #include <compat/vcpu.h>
14 #define xen_vcpu_set_periodic_timer vcpu_set_periodic_timer
15 CHECK_vcpu_set_periodic_timer;
16 #undef xen_vcpu_set_periodic_timer
18 int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
19 {
20 struct domain *d = current->domain;
21 struct vcpu *v;
22 int rc = 0;
24 if ( (vcpuid < 0) || (vcpuid >= MAX_VIRT_CPUS) )
25 return -EINVAL;
27 if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
28 return -ENOENT;
30 switch ( cmd )
31 {
32 case VCPUOP_initialise:
33 {
34 struct compat_vcpu_guest_context *cmp_ctxt;
36 if ( (cmp_ctxt = xmalloc(struct compat_vcpu_guest_context)) == NULL )
37 {
38 rc = -ENOMEM;
39 break;
40 }
42 if ( copy_from_guest(cmp_ctxt, arg, 1) )
43 {
44 xfree(cmp_ctxt);
45 rc = -EFAULT;
46 break;
47 }
49 domain_lock(d);
50 rc = -EEXIST;
51 if ( !v->is_initialised )
52 rc = boot_vcpu(d, vcpuid, cmp_ctxt);
53 domain_unlock(d);
55 xfree(cmp_ctxt);
56 break;
57 }
59 case VCPUOP_up:
60 case VCPUOP_down:
61 case VCPUOP_is_up:
62 case VCPUOP_set_periodic_timer:
63 case VCPUOP_stop_periodic_timer:
64 case VCPUOP_stop_singleshot_timer:
65 case VCPUOP_send_nmi:
66 rc = do_vcpu_op(cmd, vcpuid, arg);
67 break;
69 case VCPUOP_get_runstate_info:
70 {
71 union {
72 struct vcpu_runstate_info nat;
73 struct compat_vcpu_runstate_info cmp;
74 } runstate;
76 vcpu_runstate_get(v, &runstate.nat);
77 xlat_vcpu_runstate_info(&runstate.nat);
78 if ( copy_to_guest(arg, &runstate.cmp, 1) )
79 rc = -EFAULT;
80 break;
81 }
83 case VCPUOP_set_singleshot_timer:
84 {
85 struct compat_vcpu_set_singleshot_timer cmp;
86 struct vcpu_set_singleshot_timer *nat;
88 if ( copy_from_guest(&cmp, arg, 1) )
89 return -EFAULT;
90 nat = (void *)COMPAT_ARG_XLAT_VIRT_BASE;
91 XLAT_vcpu_set_singleshot_timer(nat, &cmp);
92 rc = do_vcpu_op(cmd, vcpuid, guest_handle_from_ptr(nat, void));
93 break;
94 }
96 default:
97 rc = arch_compat_vcpu_op(cmd, v, arg);
98 break;
99 }
101 return rc;
102 }
104 /*
105 * Local variables:
106 * mode: C
107 * c-set-style: "BSD"
108 * c-basic-offset: 4
109 * tab-width: 4
110 * indent-tabs-mode: nil
111 * End:
112 */