aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-07 08:05:36 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-30 06:50:13 -0500
commit5e232f4f428c4266ba5cdae9f23ba19a0913dcf9 (patch)
tree591e21cb88959373e495eac7eb8ee2c2865771ae /drivers
parent4665ac8e28c30c2a015c617c55783c0bf3a49c05 (diff)
lguest: make pending notifications per-vcpu
this patch makes the pending_notify field, used to control pending notifications, per-vcpu, instead of per-guest Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/lguest/core.c6
-rw-r--r--drivers/lguest/hypercalls.c6
-rw-r--r--drivers/lguest/lg.h3
-rw-r--r--drivers/lguest/lguest_user.c4
4 files changed, 10 insertions, 9 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 66c3d3b17fe4..6023872e32d0 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -186,10 +186,10 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
186 186
187 /* It's possible the Guest did a NOTIFY hypercall to the 187 /* It's possible the Guest did a NOTIFY hypercall to the
188 * Launcher, in which case we return from the read() now. */ 188 * Launcher, in which case we return from the read() now. */
189 if (lg->pending_notify) { 189 if (cpu->pending_notify) {
190 if (put_user(lg->pending_notify, user)) 190 if (put_user(cpu->pending_notify, user))
191 return -EFAULT; 191 return -EFAULT;
192 return sizeof(lg->pending_notify); 192 return sizeof(cpu->pending_notify);
193 } 193 }
194 194
195 /* Check for signals */ 195 /* Check for signals */
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index ab70bbebdf25..be8f04685767 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -91,7 +91,7 @@ static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args)
91 cpu->halted = 1; 91 cpu->halted = 1;
92 break; 92 break;
93 case LHCALL_NOTIFY: 93 case LHCALL_NOTIFY:
94 lg->pending_notify = args->arg1; 94 cpu->pending_notify = args->arg1;
95 break; 95 break;
96 default: 96 default:
97 /* It should be an architecture-specific hypercall. */ 97 /* It should be an architecture-specific hypercall. */
@@ -154,7 +154,7 @@ static void do_async_hcalls(struct lg_cpu *cpu)
154 154
155 /* Stop doing hypercalls if they want to notify the Launcher: 155 /* Stop doing hypercalls if they want to notify the Launcher:
156 * it needs to service this first. */ 156 * it needs to service this first. */
157 if (lg->pending_notify) 157 if (cpu->pending_notify)
158 break; 158 break;
159 } 159 }
160} 160}
@@ -219,7 +219,7 @@ void do_hypercalls(struct lg_cpu *cpu)
219 /* If we stopped reading the hypercall ring because the Guest did a 219 /* If we stopped reading the hypercall ring because the Guest did a
220 * NOTIFY to the Launcher, we want to return now. Otherwise we do 220 * NOTIFY to the Launcher, we want to return now. Otherwise we do
221 * the hypercall. */ 221 * the hypercall. */
222 if (!cpu->lg->pending_notify) { 222 if (!cpu->pending_notify) {
223 do_hcall(cpu, cpu->hcall); 223 do_hcall(cpu, cpu->hcall);
224 /* Tricky point: we reset the hcall pointer to mark the 224 /* Tricky point: we reset the hcall pointer to mark the
225 * hypercall as "done". We use the hcall pointer rather than 225 * hypercall as "done". We use the hcall pointer rather than
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 05637648a174..95b473cdd0e0 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -51,6 +51,8 @@ struct lg_cpu {
51 u32 esp1; 51 u32 esp1;
52 u8 ss1; 52 u8 ss1;
53 53
54 unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
55
54 /* At end of a page shared mapped over lguest_pages in guest. */ 56 /* At end of a page shared mapped over lguest_pages in guest. */
55 unsigned long regs_page; 57 unsigned long regs_page;
56 struct lguest_regs *regs; 58 struct lguest_regs *regs;
@@ -95,7 +97,6 @@ struct lguest
95 struct pgdir pgdirs[4]; 97 struct pgdir pgdirs[4];
96 98
97 unsigned long noirq_start, noirq_end; 99 unsigned long noirq_start, noirq_end;
98 unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
99 100
100 unsigned int stack_pages; 101 unsigned int stack_pages;
101 u32 tsc_khz; 102 u32 tsc_khz;
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 980b3550db7f..f4f6df85bece 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -89,8 +89,8 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
89 89
90 /* If we returned from read() last time because the Guest notified, 90 /* If we returned from read() last time because the Guest notified,
91 * clear the flag. */ 91 * clear the flag. */
92 if (lg->pending_notify) 92 if (cpu->pending_notify)
93 lg->pending_notify = 0; 93 cpu->pending_notify = 0;
94 94
95 /* Run the Guest until something interesting happens. */ 95 /* Run the Guest until something interesting happens. */
96 return run_guest(cpu, (unsigned long __user *)user); 96 return run_guest(cpu, (unsigned long __user *)user);