aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-05-02 22:50:53 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-05-02 07:50:54 -0400
commita007a751d98fe97142e4724a83a4e31ec66b7532 (patch)
treeab9d1d844688834875359c600982a3c8ae738014 /drivers/lguest
parent9f3f746741d917fe3c6c544c7d319d533176d90b (diff)
lguest: make Launcher see device status updates
This brings us closer to Real Life, where we'd examine the device features once it's set the DRIVER_OK status bit. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r--drivers/lguest/lguest_device.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 7a643a6ee9a1..8080249957af 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -144,20 +144,26 @@ static u8 lg_get_status(struct virtio_device *vdev)
144 return to_lgdev(vdev)->desc->status; 144 return to_lgdev(vdev)->desc->status;
145} 145}
146 146
147/* To notify on status updates, we (ab)use the NOTIFY hypercall, with the
148 * descriptor address of the device. A zero status means "reset". */
149static void set_status(struct virtio_device *vdev, u8 status)
150{
151 unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices;
152
153 /* We set the status. */
154 to_lgdev(vdev)->desc->status = status;
155 hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0);
156}
157
147static void lg_set_status(struct virtio_device *vdev, u8 status) 158static void lg_set_status(struct virtio_device *vdev, u8 status)
148{ 159{
149 BUG_ON(!status); 160 BUG_ON(!status);
150 to_lgdev(vdev)->desc->status = status; 161 set_status(vdev, status);
151} 162}
152 163
153/* To reset the device, we (ab)use the NOTIFY hypercall, with the descriptor
154 * address of the device. The Host will zero the status and all the
155 * features. */
156static void lg_reset(struct virtio_device *vdev) 164static void lg_reset(struct virtio_device *vdev)
157{ 165{
158 unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices; 166 set_status(vdev, 0);
159
160 hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0);
161} 167}
162 168
163/* 169/*