diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2013-02-28 06:33:16 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-03-05 17:12:09 -0500 |
commit | 07e169335ff0570c6e67b5ccf74d793f00ab0834 (patch) | |
tree | f96290e4e141305498fe5cb97a9efffc958c0d7a /drivers/s390/kvm | |
parent | 503cd0c50ac7161eb5c3891b48b620cb0a5521cd (diff) |
virtio_ccw: pass a cookie value to kvm hypercall
Lookups by channel/vq pair on host during virtio notifications might be
expensive. Interpret hypercall return value as a cookie which host can
use to do device lookups for the next notification more efficiently.
[CH: Fix line > 80 chars]
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'drivers/s390/kvm')
-rw-r--r-- | drivers/s390/kvm/virtio_ccw.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c index 2029b6caa595..3d657522b3e2 100644 --- a/drivers/s390/kvm/virtio_ccw.c +++ b/drivers/s390/kvm/virtio_ccw.c | |||
@@ -77,6 +77,7 @@ struct virtio_ccw_vq_info { | |||
77 | void *queue; | 77 | void *queue; |
78 | struct vq_info_block *info_block; | 78 | struct vq_info_block *info_block; |
79 | struct list_head node; | 79 | struct list_head node; |
80 | long cookie; | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | #define KVM_VIRTIO_CCW_RING_ALIGN 4096 | 83 | #define KVM_VIRTIO_CCW_RING_ALIGN 4096 |
@@ -145,15 +146,18 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev, | |||
145 | } | 146 | } |
146 | 147 | ||
147 | static inline long do_kvm_notify(struct subchannel_id schid, | 148 | static inline long do_kvm_notify(struct subchannel_id schid, |
148 | unsigned long queue_index) | 149 | unsigned long queue_index, |
150 | long cookie) | ||
149 | { | 151 | { |
150 | register unsigned long __nr asm("1") = KVM_S390_VIRTIO_CCW_NOTIFY; | 152 | register unsigned long __nr asm("1") = KVM_S390_VIRTIO_CCW_NOTIFY; |
151 | register struct subchannel_id __schid asm("2") = schid; | 153 | register struct subchannel_id __schid asm("2") = schid; |
152 | register unsigned long __index asm("3") = queue_index; | 154 | register unsigned long __index asm("3") = queue_index; |
153 | register long __rc asm("2"); | 155 | register long __rc asm("2"); |
156 | register long __cookie asm("4") = cookie; | ||
154 | 157 | ||
155 | asm volatile ("diag 2,4,0x500\n" | 158 | asm volatile ("diag 2,4,0x500\n" |
156 | : "=d" (__rc) : "d" (__nr), "d" (__schid), "d" (__index) | 159 | : "=d" (__rc) : "d" (__nr), "d" (__schid), "d" (__index), |
160 | "d"(__cookie) | ||
157 | : "memory", "cc"); | 161 | : "memory", "cc"); |
158 | return __rc; | 162 | return __rc; |
159 | } | 163 | } |
@@ -166,7 +170,8 @@ static void virtio_ccw_kvm_notify(struct virtqueue *vq) | |||
166 | 170 | ||
167 | vcdev = to_vc_device(info->vq->vdev); | 171 | vcdev = to_vc_device(info->vq->vdev); |
168 | ccw_device_get_schid(vcdev->cdev, &schid); | 172 | ccw_device_get_schid(vcdev->cdev, &schid); |
169 | do_kvm_notify(schid, virtqueue_get_queue_index(vq)); | 173 | info->cookie = do_kvm_notify(schid, virtqueue_get_queue_index(vq), |
174 | info->cookie); | ||
170 | } | 175 | } |
171 | 176 | ||
172 | static int virtio_ccw_read_vq_conf(struct virtio_ccw_device *vcdev, | 177 | static int virtio_ccw_read_vq_conf(struct virtio_ccw_device *vcdev, |