diff options
author | neel <neel@FreeBSD.org> | 2013-03-01 02:26:28 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2013-03-01 02:26:28 +0000 |
commit | 9c2aecf6da5fb6aafba1ce1f1488a6b13c8a3174 (patch) | |
tree | 2000067d1528e9e61ee28a8010e91859f3f23e01 /usr.sbin/bhyve/virtio.h | |
parent | 65c312a935cde98a1292b6337cd3c1ece740b835 (diff) | |
download | FreeBSD-src-9c2aecf6da5fb6aafba1ce1f1488a6b13c8a3174.zip FreeBSD-src-9c2aecf6da5fb6aafba1ce1f1488a6b13c8a3174.tar.gz |
Specify the length of the mapping requested from 'paddr_guest2host()'.
This seems prudent to do in its own right but it also opens up the possibility
of not having to mmap the entire guest address space in the 'bhyve' process
context.
Discussed with: grehan
Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyve/virtio.h')
-rw-r--r-- | usr.sbin/bhyve/virtio.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index 04ef586..fe6fb1a 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -85,4 +85,19 @@ struct virtio_used { #define VTCFG_R_CFG1 24 /* With MSI-X */ #define VTCFG_R_MSIX 20 +/* From section 2.3, "Virtqueue Configuration", of the virtio specification */ +static inline u_int +vring_size(u_int qsz) +{ + u_int size; + + size = sizeof(struct virtio_desc) * qsz + sizeof(uint16_t) * (3 + qsz); + size = roundup2(size, VRING_ALIGN); + + size += sizeof(uint16_t) * 3 + sizeof(struct virtio_used) * qsz; + size = roundup2(size, VRING_ALIGN); + + return (size); +} + #endif /* _VIRTIO_H_ */ |