summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve/pci_virtio_block.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2013-02-26 20:02:17 +0000
committerneel <neel@FreeBSD.org>2013-02-26 20:02:17 +0000
commit97e63956d84c0b3ed37d37872b07c7a4b0ac7fc6 (patch)
tree8a1efe8cfdeb22170ded4404e9828fc81c52355f /usr.sbin/bhyve/pci_virtio_block.c
parent032f2b46961571ad52e29b0fba3cab4bda4ea440 (diff)
downloadFreeBSD-src-97e63956d84c0b3ed37d37872b07c7a4b0ac7fc6.zip
FreeBSD-src-97e63956d84c0b3ed37d37872b07c7a4b0ac7fc6.tar.gz
Ignore the BARRIER flag in the virtio block header.
This capability is not advertised by the host so ignore it even if the guest insists on setting the flag. Reviewed by: grehan Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyve/pci_virtio_block.c')
-rw-r--r--usr.sbin/bhyve/pci_virtio_block.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c
index c8fc914..62bf801 100644
--- a/usr.sbin/bhyve/pci_virtio_block.c
+++ b/usr.sbin/bhyve/pci_virtio_block.c
@@ -110,8 +110,9 @@ CTASSERT(sizeof(struct vtblk_config) == VTBLK_CFGSZ);
* Fixed-size block header
*/
struct virtio_blk_hdr {
-#define VBH_OP_READ 0
-#define VBH_OP_WRITE 1
+#define VBH_OP_READ 0
+#define VBH_OP_WRITE 1
+#define VBH_FLAG_BARRIER 0x80000000 /* OR'ed into vbh_type */
uint32_t vbh_type;
uint32_t vbh_ioprio;
uint64_t vbh_sector;
@@ -198,7 +199,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vring_hqueue *hq)
int iolen;
int nsegs;
int uidx, aidx, didx;
- int writeop;
+ int writeop, type;
off_t offset;
uidx = *hq->hq_used_idx;
@@ -232,7 +233,13 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vring_hqueue *hq)
assert(vid[0].vd_flags & VRING_DESC_F_NEXT);
assert((vid[0].vd_flags & VRING_DESC_F_WRITE) == 0);
- writeop = (vbh->vbh_type == VBH_OP_WRITE);
+ /*
+ * XXX
+ * The guest should not be setting the BARRIER flag because
+ * we don't advertise the capability.
+ */
+ type = vbh->vbh_type & ~VBH_FLAG_BARRIER;
+ writeop = (type == VBH_OP_WRITE);
offset = vbh->vbh_sector * DEV_BSIZE;
OpenPOWER on IntegriCloud