History

vringh: IOTLB support

This patch implements the third memory accessor for vringh besides current kernel and userspace accessors. This idea is to allow vringh to do the address translation through an IOTLB which is implemented via vhost_map interval tree. Users should setup and IOVA to PA mapping in this IOTLB. This allows us to: - Use vringh to access virtqueues with vIOMMU - Use vringh to implement software virtqueues for vDPA devices

Jason Wang committed 6 years ago

Commit 9ad9c491 parent 0bbe3063 files · +435 −23Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/vringh.h+36−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
14#include <linux/virtio_byteorder.h>14#include <linux/virtio_byteorder.h>
15#include <linux/uio.h>15#include <linux/uio.h>
16#include <linux/slab.h>16#include <linux/slab.h>
17#include <linux/dma-direction.h>
18#include <linux/vhost_iotlb.h>
17#include <asm/barrier.h>19#include <asm/barrier.h>
18 20
19/* virtio_ring with information needed for host access. */21/* virtio_ring with information needed for host access. */
@@ -39,6 +41,9 @@ struct vringh { · 19 unmodified lines
39 /* The vring (note: it may contain user pointers!) */41 /* The vring (note: it may contain user pointers!) */
40 struct vring vring;42 struct vring vring;
41 43
44 /* IOTLB for this vring */
45 struct vhost_iotlb *iotlb;
46
42 /* The function to call to notify the guest about added buffers */47 /* The function to call to notify the guest about added buffers */
43 void (*notify)(struct vringh *);48 void (*notify)(struct vringh *);
44};49};
@@ -248,4 +253,35 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val) · 203 unmodified lines
248{253{
249 return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);254 return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);
250}255}
256
257void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb);
258
259int vringh_init_iotlb(struct vringh *vrh, u64 features,
260 unsigned int num, bool weak_barriers,
261 struct vring_desc *desc,
262 struct vring_avail *avail,
263 struct vring_used *used);
264
265int vringh_getdesc_iotlb(struct vringh *vrh,
266 struct vringh_kiov *riov,
267 struct vringh_kiov *wiov,
268 u16 *head,
269 gfp_t gfp);
270
271ssize_t vringh_iov_pull_iotlb(struct vringh *vrh,
272 struct vringh_kiov *riov,
273 void *dst, size_t len);
274ssize_t vringh_iov_push_iotlb(struct vringh *vrh,
275 struct vringh_kiov *wiov,
276 const void *src, size_t len);
277
278void vringh_abandon_iotlb(struct vringh *vrh, unsigned int num);
279
280int vringh_complete_iotlb(struct vringh *vrh, u16 head, u32 len);
281
282bool vringh_notify_enable_iotlb(struct vringh *vrh);
283void vringh_notify_disable_iotlb(struct vringh *vrh);
284
285int vringh_need_notify_iotlb(struct vringh *vrh);
286
251#endif /* _LINUX_VRINGH_H */287#endif /* _LINUX_VRINGH_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t