debuggers.hg

annotate xen/common/dom0_ops.c @ 3658:0ef6e8e6e85d

bitkeeper revision 1.1159.212.71 (4200f0afX_JumfbEHQex6TdFENULMQ)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/iap10/xeno-clone/xen-unstable.bk
author iap10@labyrinth.cl.cam.ac.uk
date Wed Feb 02 15:24:31 2005 +0000 (2005-02-02)
parents 610068179f96 beb0887c54bc
children 1c55bbe02576
rev   line source
iap10@274 1 /******************************************************************************
iap10@274 2 * dom0_ops.c
iap10@274 3 *
iap10@274 4 * Process command requests from domain-0 guest OS.
iap10@274 5 *
iap10@274 6 * Copyright (c) 2002, K A Fraser
iap10@274 7 */
iap10@274 8
kaf24@1248 9 #include <xen/config.h>
kaf24@1248 10 #include <xen/types.h>
kaf24@1248 11 #include <xen/lib.h>
kaf24@1248 12 #include <xen/mm.h>
kaf24@2827 13 #include <public/dom0_ops.h>
kaf24@1248 14 #include <xen/sched.h>
kaf24@1248 15 #include <xen/event.h>
iap10@274 16 #include <asm/domain_page.h>
kaf24@1110 17 #include <asm/pdb.h>
kaf24@1248 18 #include <xen/trace.h>
kaf24@1248 19 #include <xen/console.h>
kaf24@1787 20 #include <asm/shadow.h>
kaf24@2827 21 #include <public/sched_ctl.h>
iap10@274 22
iap10@1444 23 #define TRC_DOM0OP_ENTER_BASE 0x00020000
iap10@1444 24 #define TRC_DOM0OP_LEAVE_BASE 0x00030000
iap10@1402 25
kaf24@1543 26 extern unsigned int alloc_new_dom_mem(struct domain *, unsigned int);
djm@1687 27 extern long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op);
kaf24@2336 28 extern void arch_getdomaininfo_ctxt(
cl349@2957 29 struct exec_domain *, full_execution_context_t *);
iap10@851 30
mjw@1929 31 static inline int is_free_domid(domid_t dom)
mjw@1929 32 {
kaf24@1974 33 struct domain *d;
kaf24@1974 34
kaf24@2336 35 if ( dom >= DOMID_FIRST_RESERVED )
kaf24@1974 36 return 0;
mjw@1929 37
kaf24@1974 38 if ( (d = find_domain_by_id(dom)) == NULL )
mjw@1929 39 return 1;
kaf24@1974 40
kaf24@1974 41 put_domain(d);
kaf24@1974 42 return 0;
mjw@1929 43 }
mjw@1929 44
kaf24@2730 45 /*
kaf24@2730 46 * Allocate a free domain id. We try to reuse domain ids in a fairly low range,
kaf24@2730 47 * only expanding the range when there are no free domain ids. This is to keep
kaf24@2730 48 * domain ids in a range depending on the number that exist simultaneously,
mjw@1929 49 * rather than incrementing domain ids in the full 32-bit range.
mjw@1929 50 */
mjw@1929 51 static int allocate_domid(domid_t *pdom)
mjw@1929 52 {
mjw@1929 53 static spinlock_t domid_lock = SPIN_LOCK_UNLOCKED;
mjw@1929 54 static domid_t curdom = 0;
mjw@1929 55 static domid_t topdom = 101;
mjw@1929 56 int err = 0;
kaf24@1974 57 domid_t dom;
kaf24@1974 58
kaf24@1974 59 spin_lock(&domid_lock);
mjw@1929 60
mjw@1929 61 /* Try to use a domain id in the range 0..topdom, starting at curdom. */
kaf24@1974 62 for ( dom = curdom + 1; dom != curdom; dom++ )
kaf24@1974 63 {
kaf24@1974 64 if ( dom == topdom )
mjw@1929 65 dom = 1;
kaf24@1974 66 if ( is_free_domid(dom) )
kaf24@1974 67 goto exit;
kaf24@1974 68 }
kaf24@1974 69
mjw@1929 70 /* Couldn't find a free domain id in 0..topdom, try higher. */
kaf24@2336 71 for ( dom = topdom; dom < DOMID_FIRST_RESERVED; dom++ )
kaf24@1974 72 {
kaf24@1974 73 if ( is_free_domid(dom) )
kaf24@1974 74 {
kaf24@1974 75 topdom = dom + 1;
kaf24@1974 76 goto exit;
kaf24@1974 77 }
mjw@1929 78 }
kaf24@1974 79
mjw@1929 80 /* No free domain ids. */
mjw@1929 81 err = -ENOMEM;
kaf24@1974 82
mjw@1929 83 exit:
kaf24@1974 84 if ( err == 0 )
kaf24@1974 85 {
mjw@1929 86 curdom = dom;
mjw@1929 87 *pdom = dom;
mjw@1929 88 }
kaf24@1974 89
kaf24@1974 90 spin_unlock(&domid_lock);
mjw@1929 91 return err;
mjw@1929 92 }
mjw@1929 93
iap10@274 94 long do_dom0_op(dom0_op_t *u_dom0_op)
iap10@274 95 {
iap10@274 96 long ret = 0;
kaf24@1548 97 dom0_op_t curop, *op = &curop;
iap10@274 98
cl349@2957 99 if ( !IS_PRIV(current->domain) )
iap10@274 100 return -EPERM;
iap10@274 101
kaf24@1096 102 if ( copy_from_user(op, u_dom0_op, sizeof(*op)) )
iap10@1373 103 return -EFAULT;
kaf24@918 104
kaf24@1096 105 if ( op->interface_version != DOM0_INTERFACE_VERSION )
iap10@1373 106 return -EACCES;
kaf24@1096 107
kaf24@1464 108 TRACE_5D(TRC_DOM0OP_ENTER_BASE + op->cmd,
kaf24@1464 109 0, op->u.dummy[0], op->u.dummy[1],
kaf24@1464 110 op->u.dummy[2], op->u.dummy[3] );
iap10@1402 111
kaf24@1096 112 switch ( op->cmd )
iap10@274 113 {
iap10@274 114
tlh20@461 115 case DOM0_BUILDDOMAIN:
iap10@274 116 {
kaf24@1548 117 struct domain *d = find_domain_by_id(op->u.builddomain.domain);
kaf24@505 118 ret = -EINVAL;
kaf24@1548 119 if ( d != NULL )
kaf24@505 120 {
kaf24@1548 121 ret = final_setup_guestos(d, &op->u.builddomain);
kaf24@1548 122 put_domain(d);
kaf24@505 123 }
tlh20@461 124 }
tlh20@461 125 break;
tlh20@461 126
kaf24@1574 127 case DOM0_PAUSEDOMAIN:
tlh20@461 128 {
kaf24@1574 129 struct domain *d = find_domain_by_id(op->u.pausedomain.domain);
kaf24@1543 130 ret = -ESRCH;
kaf24@1543 131 if ( d != NULL )
kaf24@484 132 {
kaf24@1543 133 ret = -EINVAL;
cl349@2957 134 if ( d != current->domain )
kaf24@512 135 {
kaf24@1574 136 domain_pause_by_systemcontroller(d);
kaf24@1045 137 ret = 0;
kaf24@512 138 }
kaf24@1543 139 put_domain(d);
kaf24@484 140 }
iap10@274 141 }
iap10@274 142 break;
iap10@274 143
kaf24@1574 144 case DOM0_UNPAUSEDOMAIN:
tlh20@461 145 {
kaf24@1574 146 struct domain *d = find_domain_by_id(op->u.unpausedomain.domain);
kaf24@1543 147 ret = -ESRCH;
kaf24@1543 148 if ( d != NULL )
kaf24@1464 149 {
kaf24@1550 150 ret = -EINVAL;
cl349@2957 151 if ( test_bit(DF_CONSTRUCTED, &d->d_flags) )
kaf24@1550 152 {
kaf24@1574 153 domain_unpause_by_systemcontroller(d);
kaf24@1550 154 ret = 0;
kaf24@1550 155 }
kaf24@1543 156 put_domain(d);
kaf24@1464 157 }
tlh20@461 158 }
tlh20@461 159 break;
tlh20@461 160
tlh20@461 161 case DOM0_CREATEDOMAIN:
iap10@274 162 {
kaf24@2788 163 struct domain *d;
kaf24@2788 164 unsigned int pro = 0;
kaf24@2788 165 domid_t dom;
kaf24@1548 166
mjw@1929 167 dom = op->u.createdomain.domain;
kaf24@2336 168 if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) )
kaf24@1464 169 {
kaf24@1974 170 ret = -EINVAL;
mjw@1929 171 if ( !is_free_domid(dom) )
kaf24@1464 172 break;
mjw@1929 173 }
kaf24@1974 174 else if ( (ret = allocate_domid(&dom)) != 0 )
kaf24@1974 175 break;
kaf24@1464 176
kaf24@1548 177 if ( op->u.createdomain.cpu == -1 )
kaf24@2788 178 {
kaf24@2788 179 /* Do an initial placement. Pick the least-populated CPU. */
kaf24@2788 180 struct domain *d;
cl349@2957 181 struct exec_domain *ed;
kaf24@2788 182 unsigned int i, cnt[NR_CPUS] = { 0 };
iap10@2671 183
kaf24@2844 184 read_lock(&domlist_lock);
cl349@2957 185 for_each_domain ( d ) {
cl349@2957 186 for_each_exec_domain ( d, ed )
cl349@2957 187 cnt[ed->processor]++;
cl349@2957 188 }
kaf24@2844 189 read_unlock(&domlist_lock);
iap10@2671 190
kaf24@2788 191 for ( i = 0; i < smp_num_cpus; i++ )
kaf24@2788 192 if ( cnt[i] < cnt[pro] )
kaf24@2788 193 pro = i;
kaf24@2788 194 }
kaf24@1464 195 else
kaf24@1464 196 pro = op->u.createdomain.cpu % smp_num_cpus;
iap10@1382 197
kaf24@1974 198 ret = -ENOMEM;
kaf24@2217 199 if ( (d = do_createdomain(dom, pro)) == NULL )
kaf24@1428 200 break;
kaf24@2217 201
kaf24@1548 202 ret = alloc_new_dom_mem(d, op->u.createdomain.memory_kb);
kaf24@414 203 if ( ret != 0 )
kaf24@414 204 {
kaf24@1548 205 domain_kill(d);
kaf24@1428 206 break;
kaf24@414 207 }
iap10@274 208
kaf24@1120 209 ret = 0;
iap10@274 210
kaf24@2748 211 op->u.createdomain.domain = d->id;
kaf24@1096 212 copy_to_user(u_dom0_op, op, sizeof(*op));
iap10@274 213 }
iap10@274 214 break;
iap10@274 215
tlh20@461 216 case DOM0_DESTROYDOMAIN:
iap10@274 217 {
kaf24@1543 218 struct domain *d = find_domain_by_id(op->u.destroydomain.domain);
kaf24@1543 219 ret = -ESRCH;
kaf24@1543 220 if ( d != NULL )
kaf24@1543 221 {
kaf24@1543 222 ret = -EINVAL;
cl349@2957 223 if ( d != current->domain )
kaf24@1543 224 {
kaf24@1543 225 domain_kill(d);
kaf24@1543 226 ret = 0;
kaf24@1543 227 }
kaf24@1550 228 put_domain(d);
kaf24@1543 229 }
iap10@274 230 }
iap10@274 231 break;
iap10@274 232
iap10@1022 233 case DOM0_PINCPUDOMAIN:
iap10@1022 234 {
mwilli2@1253 235 domid_t dom = op->u.pincpudomain.domain;
kaf24@1550 236 struct domain *d = find_domain_by_id(dom);
cl349@2957 237 struct exec_domain *ed;
kaf24@1550 238 int cpu = op->u.pincpudomain.cpu;
kaf24@1550 239
kaf24@1550 240 if ( d == NULL )
kaf24@1550 241 {
kaf24@1550 242 ret = -ESRCH;
kaf24@1550 243 break;
kaf24@1550 244 }
mwilli2@1253 245
cl349@2957 246 ed = d->exec_domain[op->u.pincpudomain.exec_domain];
cl349@2957 247 if ( ed == NULL )
cl349@2957 248 {
cl349@2957 249 ret = -ESRCH;
cl349@2957 250 put_domain(d);
cl349@2957 251 break;
cl349@2957 252 }
cl349@2957 253
cl349@2957 254 if ( ed == current )
kaf24@1550 255 {
mwilli2@1253 256 ret = -EINVAL;
kaf24@1550 257 put_domain(d);
kaf24@1550 258 break;
kaf24@1550 259 }
kaf24@1550 260
kaf24@1550 261 if ( cpu == -1 )
kaf24@1550 262 {
cl349@2957 263 clear_bit(EDF_CPUPINNED, &ed->ed_flags);
kaf24@1550 264 }
mwilli2@1253 265 else
iap10@1022 266 {
cl349@2957 267 exec_domain_pause(ed);
kaf24@2688 268 synchronise_pagetables(~0UL);
cl349@2957 269 if ( ed->processor != (cpu % smp_num_cpus) )
cl349@2957 270 set_bit(EDF_MIGRATED, &ed->ed_flags);
cl349@2957 271 set_bit(EDF_CPUPINNED, &ed->ed_flags);
cl349@2957 272 ed->processor = cpu % smp_num_cpus;
cl349@2957 273 exec_domain_unpause(ed);
mwilli2@1253 274 }
kaf24@1550 275
kaf24@1550 276 put_domain(d);
iap10@1022 277 }
iap10@1022 278 break;
iap10@1022 279
mwilli2@1232 280 case DOM0_SCHEDCTL:
rn@341 281 {
mwilli2@1232 282 ret = sched_ctl(&op->u.schedctl);
mwilli2@1284 283 copy_to_user(u_dom0_op, op, sizeof(*op));
rn@341 284 }
rn@341 285 break;
rn@341 286
rn@316 287 case DOM0_ADJUSTDOM:
rn@316 288 {
mwilli2@1232 289 ret = sched_adjdom(&op->u.adjustdom);
mwilli2@1284 290 copy_to_user(u_dom0_op, op, sizeof(*op));
rn@316 291 }
rn@316 292 break;
rn@316 293
iap10@274 294 case DOM0_GETMEMLIST:
iap10@274 295 {
iap10@274 296 int i;
kaf24@1548 297 struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
kaf24@1096 298 unsigned long max_pfns = op->u.getmemlist.max_pfns;
kaf24@646 299 unsigned long pfn;
kaf24@1096 300 unsigned long *buffer = op->u.getmemlist.buffer;
iap10@274 301 struct list_head *list_ent;
iap10@274 302
kaf24@646 303 ret = -EINVAL;
kaf24@1548 304 if ( d != NULL )
iap10@274 305 {
kaf24@1048 306 ret = 0;
kaf24@1048 307
kaf24@1678 308 spin_lock(&d->page_alloc_lock);
kaf24@1548 309 list_ent = d->page_list.next;
kaf24@1548 310 for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
kaf24@646 311 {
kaf24@1048 312 pfn = list_entry(list_ent, struct pfn_info, list) -
kaf24@1048 313 frame_table;
kaf24@646 314 if ( put_user(pfn, buffer) )
kaf24@646 315 {
kaf24@646 316 ret = -EFAULT;
kaf24@1048 317 break;
kaf24@646 318 }
kaf24@646 319 buffer++;
kaf24@646 320 list_ent = frame_table[pfn].list.next;
kaf24@646 321 }
kaf24@1678 322 spin_unlock(&d->page_alloc_lock);
kaf24@646 323
kaf24@1096 324 op->u.getmemlist.num_pfns = i;
kaf24@1096 325 copy_to_user(u_dom0_op, op, sizeof(*op));
kaf24@1048 326
kaf24@1548 327 put_domain(d);
iap10@274 328 }
iap10@274 329 }
iap10@274 330 break;
iap10@274 331
djm@1723 332 case DOM0_GETDOMAININFO:
djm@1723 333 {
djm@1723 334 full_execution_context_t *c;
djm@1723 335 struct domain *d;
cl349@2957 336 struct exec_domain *ed;
djm@1723 337
kaf24@2844 338 read_lock(&domlist_lock);
djm@1723 339
djm@1723 340 for_each_domain ( d )
djm@1723 341 {
kaf24@2748 342 if ( d->id >= op->u.getdomaininfo.domain )
djm@1723 343 break;
djm@1723 344 }
djm@1723 345
djm@1723 346 if ( (d == NULL) || !get_domain(d) )
djm@1723 347 {
kaf24@2844 348 read_unlock(&domlist_lock);
djm@1723 349 ret = -ESRCH;
djm@1723 350 break;
djm@1723 351 }
djm@1723 352
kaf24@2844 353 read_unlock(&domlist_lock);
djm@1723 354
kaf24@2748 355 op->u.getdomaininfo.domain = d->id;
cl349@2957 356
mafetter@3473 357 if ( (op->u.getdomaininfo.exec_domain >= MAX_VIRT_CPUS) ||
mafetter@3473 358 !d->exec_domain[op->u.getdomaininfo.exec_domain] )
mafetter@3473 359 {
mafetter@3473 360 ret = -EINVAL;
mafetter@3473 361 break;
mafetter@3473 362 }
djm@1723 363
mafetter@3473 364 ed = d->exec_domain[op->u.getdomaininfo.exec_domain];
cl349@2957 365
djm@1723 366 op->u.getdomaininfo.flags =
cl349@2957 367 (test_bit( DF_DYING, &d->d_flags) ? DOMFLAGS_DYING : 0) |
cl349@2957 368 (test_bit( DF_CRASHED, &d->d_flags) ? DOMFLAGS_CRASHED : 0) |
cl349@2957 369 (test_bit( DF_SHUTDOWN, &d->d_flags) ? DOMFLAGS_SHUTDOWN : 0) |
cl349@2957 370 (test_bit(EDF_CTRLPAUSE, &ed->ed_flags) ? DOMFLAGS_PAUSED : 0) |
cl349@2957 371 (test_bit(EDF_BLOCKED, &ed->ed_flags) ? DOMFLAGS_BLOCKED : 0) |
cl349@2957 372 (test_bit(EDF_RUNNING, &ed->ed_flags) ? DOMFLAGS_RUNNING : 0);
djm@1723 373
cl349@2957 374 op->u.getdomaininfo.flags |= ed->processor << DOMFLAGS_CPUSHIFT;
djm@1723 375 op->u.getdomaininfo.flags |=
djm@1723 376 d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
djm@1723 377
djm@1723 378 op->u.getdomaininfo.tot_pages = d->tot_pages;
djm@1723 379 op->u.getdomaininfo.max_pages = d->max_pages;
cl349@2957 380 op->u.getdomaininfo.cpu_time = ed->cpu_time;
djm@1723 381 op->u.getdomaininfo.shared_info_frame =
djm@1723 382 __pa(d->shared_info) >> PAGE_SHIFT;
djm@1723 383
djm@1723 384 if ( op->u.getdomaininfo.ctxt != NULL )
djm@1723 385 {
iap10@3650 386 if ( (c = xmalloc(full_execution_context_t)) == NULL )
djm@1723 387 {
djm@1723 388 ret = -ENOMEM;
djm@1723 389 put_domain(d);
djm@1723 390 break;
djm@1723 391 }
djm@1723 392
cl349@2957 393 if ( ed != current )
cl349@2957 394 exec_domain_pause(ed);
djm@1723 395
cl349@2957 396 arch_getdomaininfo_ctxt(ed,c);
djm@1723 397
cl349@2957 398 if ( ed != current )
cl349@2957 399 exec_domain_unpause(ed);
djm@1723 400
djm@1723 401 if ( copy_to_user(op->u.getdomaininfo.ctxt, c, sizeof(*c)) )
djm@1723 402 ret = -EINVAL;
djm@1723 403
djm@1723 404 if ( c != NULL )
kaf24@1958 405 xfree(c);
djm@1723 406 }
djm@1723 407
djm@1723 408 if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
djm@1723 409 ret = -EINVAL;
djm@1723 410
djm@1723 411 put_domain(d);
djm@1723 412 }
djm@1723 413 break;
djm@1723 414
kaf24@1482 415 #ifdef XEN_DEBUGGER
ach61@883 416 case DOM0_DEBUG:
ach61@883 417 {
kaf24@1096 418 pdb_do_debug(op);
kaf24@1096 419 copy_to_user(u_dom0_op, op, sizeof(*op));
kaf24@890 420 ret = 0;
ach61@883 421 }
ach61@883 422 break;
kaf24@1482 423 #endif
ach61@883 424
kaf24@890 425 case DOM0_SETTIME:
kaf24@890 426 {
kaf24@1096 427 do_settime(op->u.settime.secs,
kaf24@1096 428 op->u.settime.usecs,
kaf24@1096 429 op->u.settime.system_time);
kaf24@890 430 ret = 0;
kaf24@890 431 }
kaf24@890 432 break;
mwilli2@1151 433
mwilli2@1151 434 #ifdef TRACE_BUFFER
mwilli2@1151 435 case DOM0_GETTBUFS:
mwilli2@1151 436 {
mwilli2@1163 437 ret = get_tb_info(&op->u.gettbufs);
kaf24@1464 438 copy_to_user(u_dom0_op, op, sizeof(*op));
mwilli2@1151 439 }
mwilli2@1151 440 break;
mwilli2@1151 441 #endif
br260@975 442
br260@975 443 case DOM0_READCONSOLE:
br260@975 444 {
kaf24@1096 445 ret = read_console_ring(op->u.readconsole.str,
kaf24@1464 446 op->u.readconsole.count,
kaf24@1464 447 op->u.readconsole.cmd);
br260@975 448 }
mwilli2@1159 449 break;
mwilli2@1159 450
kaf24@1209 451 case DOM0_PCIDEV_ACCESS:
kaf24@1209 452 {
kaf24@1209 453 extern int physdev_pci_access_modify(domid_t, int, int, int, int);
kaf24@1209 454 ret = physdev_pci_access_modify(op->u.pcidev_access.domain,
kaf24@1209 455 op->u.pcidev_access.bus,
kaf24@1209 456 op->u.pcidev_access.dev,
kaf24@1209 457 op->u.pcidev_access.func,
kaf24@1209 458 op->u.pcidev_access.enable);
kaf24@1209 459 }
kaf24@1209 460 break;
mwilli2@1284 461
mwilli2@1284 462 case DOM0_SCHED_ID:
mwilli2@1284 463 {
mwilli2@1284 464 op->u.sched_id.sched_id = sched_id();
mwilli2@1284 465 copy_to_user(u_dom0_op, op, sizeof(*op));
mwilli2@1284 466 ret = 0;
mwilli2@1284 467 }
iap10@1357 468 break;
iap10@1357 469
iap10@1357 470 case DOM0_SETDOMAININITIALMEM:
iap10@1357 471 {
kaf24@1548 472 struct domain *d;
kaf24@1464 473 ret = -ESRCH;
kaf24@1548 474 d = find_domain_by_id(op->u.setdomaininitialmem.domain);
kaf24@1548 475 if ( d != NULL )
kaf24@1464 476 {
kaf24@1464 477 /* should only be used *before* domain is built. */
cl349@2957 478 if ( !test_bit(DF_CONSTRUCTED, &d->d_flags) )
kaf24@1464 479 ret = alloc_new_dom_mem(
kaf24@1548 480 d, op->u.setdomaininitialmem.initial_memkb );
kaf24@1464 481 else
kaf24@1464 482 ret = -EINVAL;
kaf24@1548 483 put_domain(d);
kaf24@1464 484 }
iap10@1357 485 }
iap10@1357 486 break;
iap10@1357 487
iap10@1357 488 case DOM0_SETDOMAINMAXMEM:
iap10@1357 489 {
kaf24@1548 490 struct domain *d;
kaf24@1548 491 ret = -ESRCH;
kaf24@1548 492 d = find_domain_by_id( op->u.setdomainmaxmem.domain );
kaf24@1548 493 if ( d != NULL )
kaf24@1464 494 {
kaf24@1548 495 d->max_pages =
kaf24@1464 496 (op->u.setdomainmaxmem.max_memkb+PAGE_SIZE-1)>> PAGE_SHIFT;
kaf24@1548 497 put_domain(d);
kaf24@1548 498 ret = 0;
kaf24@1464 499 }
iap10@1357 500 }
iap10@1357 501 break;
iap10@1357 502
cl349@2487 503 case DOM0_SETDOMAINVMASSIST:
cl349@2487 504 {
cl349@2487 505 struct domain *d;
cl349@2487 506 ret = -ESRCH;
sos22@3497 507 d = find_domain_by_id( op->u.setdomainvmassist.domain );
cl349@2487 508 if ( d != NULL )
cl349@2487 509 {
kaf24@2788 510 vm_assist(d, op->u.setdomainvmassist.cmd,
cl349@2487 511 op->u.setdomainvmassist.type);
cl349@2487 512 put_domain(d);
cl349@2487 513 ret = 0;
cl349@2487 514 }
cl349@2487 515 }
cl349@2487 516 break;
cl349@2487 517
kaf24@3269 518 #ifdef PERF_COUNTERS
kaf24@3269 519 case DOM0_PERFCCONTROL:
kaf24@3269 520 {
kaf24@3269 521 extern int perfc_control(dom0_perfccontrol_t *);
kaf24@3269 522 ret = perfc_control(&op->u.perfccontrol);
kaf24@3269 523 copy_to_user(u_dom0_op, op, sizeof(*op));
kaf24@3269 524 }
kaf24@3269 525 break;
kaf24@3269 526 #endif
kaf24@3269 527
iap10@274 528 default:
djm@1687 529 ret = arch_do_dom0_op(op,u_dom0_op);
iap10@274 530
iap10@274 531 }
iap10@274 532
kaf24@1464 533 TRACE_5D(TRC_DOM0OP_LEAVE_BASE + op->cmd, ret,
kaf24@1464 534 op->u.dummy[0], op->u.dummy[1], op->u.dummy[2], op->u.dummy[3]);
iap10@1402 535
iap10@1402 536
iap10@274 537 return ret;
iap10@274 538 }