aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
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/*