This allows us to store offsets in the kernel/user kvm_run area, and be
sure that userspace has them mapped.  As offsets can be outside the
kvm_run struct, userspace has no way of knowing how much to mmap.
Signed-off-by: Avi Kivity <avi@qumranet.com>
                          unsigned int ioctl, unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
-       int r = -EINVAL;
+       long r = -EINVAL;
 
        switch (ioctl) {
        case KVM_GET_API_VERSION:
                 */
                r = 0;
                break;
+       case KVM_GET_VCPU_MMAP_SIZE:
+               r = -EINVAL;
+               if (arg)
+                       goto out;
+               r = PAGE_SIZE;
+               break;
        default:
                ;
        }
 
  * return is 1 (yes) or 0 (no, sorry).
  */
 #define KVM_CHECK_EXTENSION       _IO(KVMIO,   0x03)
+/*
+ * Get size for mmap(vcpu_fd)
+ */
+#define KVM_GET_VCPU_MMAP_SIZE    _IO(KVMIO,   0x04) /* in bytes */
 
 /*
  * ioctls for VM fds