aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2013-07-07 12:00:27 -0400
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:39:54 +0100
commite7e2950aa6ab3467e15ef7506793a0e582f5c667 (patch)
treeed6448ee922b0814f611b0eee985158277f6eae6 /include
parente2b9812560762229a3d038d2eb83421ccded9e22 (diff)
downloadkvmtool-e7e2950aa6ab3467e15ef7506793a0e582f5c667.tar.gz
kvm tools: fix boot of guests with more than 4gb of ram
Commit "kvm tools: virtio: remove hardcoded assumptions about guest page size" has introduced a bug that prevented guests with more than 4gb of ram from booting. The issue is that 'pfn' is a 32bit integer, so when multiplying it by page size to get the actual page will cause an overflow if the pfn referred to a memory area above 4gb. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/kvm/virtio.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/kvm/virtio.h b/include/kvm/virtio.h
index 269ea4a9..820b94a4 100644
--- a/include/kvm/virtio.h
+++ b/include/kvm/virtio.h
@@ -90,4 +90,10 @@ int virtio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
struct virtio_ops *ops, enum virtio_trans trans,
int device_id, int subsys_id, int class);
int virtio_compat_add_message(const char *device, const char *config);
+
+static inline void *virtio_get_vq(struct kvm *kvm, u32 pfn, u32 page_size)
+{
+ return guest_flat_to_host(kvm, (u64)pfn * page_size);
+}
+
#endif /* KVM__VIRTIO_H */