diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-05-02 21:50:53 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-05-02 21:50:54 +1000 |
commit | a007a751d98fe97142e4724a83a4e31ec66b7532 (patch) | |
tree | ab9d1d844688834875359c600982a3c8ae738014 /drivers/lguest/lguest_device.c | |
parent | 9f3f746741d917fe3c6c544c7d319d533176d90b (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/lguest_device.c')
-rw-r--r-- | drivers/lguest/lguest_device.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 7a643a6ee9a..8080249957a 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) return to_lgdev(vdev)->desc->status; } +/* To notify on status updates, we (ab)use the NOTIFY hypercall, with the + * descriptor address of the device. A zero status means "reset". */ +static void set_status(struct virtio_device *vdev, u8 status) +{ + unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices; + + /* We set the status. */ + to_lgdev(vdev)->desc->status = status; + hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0); +} + static void lg_set_status(struct virtio_device *vdev, u8 status) { BUG_ON(!status); - to_lgdev(vdev)->desc->status = status; + set_status(vdev, status); } -/* To reset the device, we (ab)use the NOTIFY hypercall, with the descriptor - * address of the device. The Host will zero the status and all the - * features. */ static void lg_reset(struct virtio_device *vdev) { - unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices; - - hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0); + set_status(vdev, 0); } /* |