diff options
author | Juergen Gross <jgross@suse.com> | 2016-06-29 17:50:48 +0200 |
---|---|---|
committer | Stefano Stabellini <sstabellini@kernel.org> | 2016-08-30 15:01:01 -0700 |
commit | 4ada797b05a52ac824a710c67216b37739026a64 (patch) | |
tree | 27be3109cb23d8f228b32ea6ae801d88ad02ddb7 /hw/block | |
parent | 12d2c4184c5ab60be3428b2bdea5ae66e8d5d960 (diff) | |
download | qemu-4ada797b05a52ac824a710c67216b37739026a64.zip qemu-4ada797b05a52ac824a710c67216b37739026a64.tar.gz qemu-4ada797b05a52ac824a710c67216b37739026a64.tar.bz2 |
xen: use native disk xenbus protocol if possible
The qdisk implementation is using the native xenbus protocol only in
case of no protocol specified at all. As using the explicit 32- or
64-bit protocol is slower than the native one due to copying requests
not by memcpy but element for element, this is not optimal.
Correct this by using the native protocol in case word sizes of
frontend and backend match.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/xen_disk.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 3b8ad33..3428689 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -976,14 +976,16 @@ static int blk_connect(struct XenDevice *xendev) blkdev->feature_persistent = !!pers; } - blkdev->protocol = BLKIF_PROTOCOL_NATIVE; - if (blkdev->xendev.protocol) { - if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { - blkdev->protocol = BLKIF_PROTOCOL_X86_32; - } - if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { - blkdev->protocol = BLKIF_PROTOCOL_X86_64; - } + if (!blkdev->xendev.protocol) { + blkdev->protocol = BLKIF_PROTOCOL_NATIVE; + } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_NATIVE) == 0) { + blkdev->protocol = BLKIF_PROTOCOL_NATIVE; + } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { + blkdev->protocol = BLKIF_PROTOCOL_X86_32; + } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { + blkdev->protocol = BLKIF_PROTOCOL_X86_64; + } else { + blkdev->protocol = BLKIF_PROTOCOL_NATIVE; } blkdev->sring = xengnttab_map_grant_ref(blkdev->xendev.gnttabdev, |