UPSTREAM: kvm: fix zero length mmio searching

[ Upstream commit 8f4216c7d28976f7ec1b2bcbfa0a9f787133c45e ]

Currently, if we had a zero length mmio eventfd assigned on
KVM_MMIO_BUS. It will never be found by kvm_io_bus_cmp() since it
always compares the kvm_io_range() with the length that guest
wrote. This will cause e.g for vhost, kick will be trapped by qemu
userspace instead of vhost. Fixing this by using zero length if an
iodevice is zero length.

BUG=chromium:846515
TEST=build/boot on hana with USE=kvm_host

Change-Id: I49c4b669d6910041c502b2c0d46a6dad67ccbb5e
Cc: stable@vger.kernel.org
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 7d765ce07eff78ab78d09d4acaa3aecb71e322a4
 in https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/)
Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1088099
1 file changed