20 printf("usage: v3_reset <vm_device> all|hrt|ros|range [first_core num_cores]\n\n");
21 printf("Resets the VM or a part of it.\n");
22 printf(" all : full reset of entire VM\n");
23 printf(" hrt : reset of all HRT cores for an HVM VM\n");
24 printf(" ros : reset of ROS cores for an HVM VM\n");
25 printf(" range : reset of cores first_core to first_core+num_cores-1\n\n");
28 int main(int argc, char* argv[]) {
31 struct v3_reset_cmd cmd;
40 if (!strcasecmp(argv[2],"all")) {
41 cmd.type=V3_RESET_VM_ALL;
42 } else if (!strcasecmp(argv[2],"hrt")) {
43 cmd.type=V3_RESET_VM_HRT;
44 } else if (!strcasecmp(argv[2],"ros")) {
45 cmd.type=V3_RESET_VM_ROS;
46 } else if (!strcasecmp(argv[2],"range")) {
47 cmd.type=V3_RESET_VM_CORE_RANGE;
52 cmd.first_core = atoi(argv[3]);
53 cmd.num_cores = atoi(argv[4]);
60 printf("Doing VM reset: %s ",
61 cmd.type==V3_RESET_VM_ALL ? "ALL" :
62 cmd.type==V3_RESET_VM_HRT ? "HRT" :
63 cmd.type==V3_RESET_VM_ROS ? "ROS" :
64 cmd.type==V3_RESET_VM_CORE_RANGE ? "RANGE" : "UNKNOWN");
65 if (cmd.type==V3_RESET_VM_CORE_RANGE) {
66 printf("cores %u to %u\n", cmd.first_core, cmd.first_core+cmd.num_cores-1);
71 vm_fd = open(vm_dev, O_RDONLY);
74 printf("Error opening VM device: %s\n", vm_dev);
78 int err = ioctl(vm_fd, V3_VM_RESET, &cmd);
81 printf("Error sending reset commad to vm\n");