Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


pci_front bugfix - do not propagate cmd reg write twice
[palacios.git] / linux_usr / v3_core_move.c
1 /* 
2  * V3 Virtual Core Migrate Control
3  * (c) Lei Xia, 2011
4  */
5
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <sys/ioctl.h> 
10 #include <errno.h>
11 #include <assert.h>
12 #include <string.h>
13 #include <fcntl.h>
14 #include <unistd.h>
15
16 #include "v3_ctrl.h"
17
18
19 int main(int argc, char* argv[]) {
20     int vm_fd;
21     char * vm_dev = NULL;
22     struct v3_core_move_cmd cmd; 
23
24     if (argc < 4) {
25         printf("usage: v3_core_move <vm_device> <vcore id> <target physical CPU id>\n");
26         return -1;
27     }
28
29     vm_dev = argv[1];
30     cmd.vcore_id = atoi(argv[2]);
31     cmd.pcore_id = atoi(argv[3]);
32
33     printf("Migrateing vcore %d to physical CPU %d\n", cmd.vcore_id, cmd.pcore_id);
34
35     vm_fd = open(vm_dev, O_RDONLY);
36
37     if (vm_fd == -1) {
38         printf("Error opening VM device: %s\n", vm_dev);
39         return -1;
40     }
41
42     int err = ioctl(vm_fd, V3_VM_MOVE_CORE, &cmd); 
43
44     if (err < 0) {
45         printf("Error write core migrating command to vm\n");
46         return -1;
47     }
48
49     close(vm_fd); 
50
51     return 0; 
52 }
53
54