dataplane: support non-contigious s/g
commit8347c53243b58ad5e4d623d2403853404e9043a1
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 28 Oct 2015 15:48:04 +0000 (28 17:48 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 9 Nov 2015 09:59:32 +0000 (9 09:59 +0000)
tree83f92608e2bea6db250bcf987e25834ed97c87ac
parent572ec519ed6fe68f10ec65963527536c2322eab0
dataplane: support non-contigious s/g

bring_map currently fails if one of the entries it's mapping is
contigious in GPA but not HVA address space.  Introduce a mapped_len
parameter so it can handle this, returning the actual mapped length.

This will still fail if there's no space left in the sg, but luckily max
queue size in use is currently 256, while max sg size is 1024, so we
should be OK even is all entries happen to cross a single DIMM boundary.

Won't work well with very small DIMM sizes, unfortunately:
e.g. this will fail with 4K DIMMs where a single
request might span a large number of DIMMs.

Let's hope these are uncommon - at least we are not breaking things.

Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Message-id: 1446047243-3221-2-git-send-email-mst@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/virtio/dataplane/vring.c