diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-07 08:05:25 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-01-30 06:50:06 -0500 |
commit | d0953d42c3445a120299fac9ad70e672d77898e9 (patch) | |
tree | a631abb2c154bec66cec05508423da705d02f35b /drivers/lguest/lguest_user.c | |
parent | 4dcc53da49c2387078fe8ceb7a420d125e027fc6 (diff) |
lguest: per-cpu run guest
This patch makes the run_guest() routine use the lg_cpu struct.
This is required since in a smp guest environment, there's no
more the notion of "running the guest", but rather, it is "running the vcpu"
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lguest_user.c')
-rw-r--r-- | drivers/lguest/lguest_user.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index c4bfe5a2b6b7..9f0a44329947 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c | |||
@@ -55,11 +55,19 @@ static int user_send_irq(struct lguest *lg, const unsigned long __user *input) | |||
55 | static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) | 55 | static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) |
56 | { | 56 | { |
57 | struct lguest *lg = file->private_data; | 57 | struct lguest *lg = file->private_data; |
58 | struct lg_cpu *cpu; | ||
59 | unsigned int cpu_id = *o; | ||
58 | 60 | ||
59 | /* You must write LHREQ_INITIALIZE first! */ | 61 | /* You must write LHREQ_INITIALIZE first! */ |
60 | if (!lg) | 62 | if (!lg) |
61 | return -EINVAL; | 63 | return -EINVAL; |
62 | 64 | ||
65 | /* Watch out for arbitrary vcpu indexes! */ | ||
66 | if (cpu_id >= lg->nr_cpus) | ||
67 | return -EINVAL; | ||
68 | |||
69 | cpu = &lg->cpus[cpu_id]; | ||
70 | |||
63 | /* If you're not the task which owns the Guest, go away. */ | 71 | /* If you're not the task which owns the Guest, go away. */ |
64 | if (current != lg->tsk) | 72 | if (current != lg->tsk) |
65 | return -EPERM; | 73 | return -EPERM; |
@@ -85,7 +93,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) | |||
85 | lg->pending_notify = 0; | 93 | lg->pending_notify = 0; |
86 | 94 | ||
87 | /* Run the Guest until something interesting happens. */ | 95 | /* Run the Guest until something interesting happens. */ |
88 | return run_guest(lg, (unsigned long __user *)user); | 96 | return run_guest(cpu, (unsigned long __user *)user); |
89 | } | 97 | } |
90 | 98 | ||
91 | static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) | 99 | static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) |
@@ -147,7 +155,7 @@ static int initialize(struct file *file, const unsigned long __user *input) | |||
147 | lg->pfn_limit = args[1]; | 155 | lg->pfn_limit = args[1]; |
148 | 156 | ||
149 | /* This is the first cpu */ | 157 | /* This is the first cpu */ |
150 | err = cpu_start(&lg->cpus[0], 0, args[3]); | 158 | err = lg_cpu_start(&lg->cpus[0], 0, args[3]); |
151 | if (err) | 159 | if (err) |
152 | goto release_guest; | 160 | goto release_guest; |
153 | 161 | ||