]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
KVM: x86: add SYNC_REGS_SIZE_BYTES #define.
authorKen Hofsass <hofsass@google.com>
Thu, 1 Feb 2018 00:03:35 +0000 (16:03 -0800)
committerRadim Krčmář <rkrcmar@redhat.com>
Tue, 6 Mar 2018 17:40:43 +0000 (18:40 +0100)
Replace hardcoded padding size value for struct kvm_sync_regs
with #define SYNC_REGS_SIZE_BYTES.

Also update the value specified in api.txt from outdated hardcoded
value to SYNC_REGS_SIZE_BYTES.

Signed-off-by: Ken Hofsass <hofsass@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Documentation/virtual/kvm/api.txt
include/uapi/linux/kvm.h

index db992e036bdf7ca512c76b5b901550f4d3141dc2..55867a2a460c76ef37845bbd06015f4023ca75f0 100644 (file)
@@ -3905,7 +3905,7 @@ in userspace.
        __u64 kvm_dirty_regs;
        union {
                struct kvm_sync_regs regs;
-               char padding[1024];
+               char padding[SYNC_REGS_SIZE_BYTES];
        } s;
 
 If KVM_CAP_SYNC_REGS is defined, these fields allow userspace to access
index 2d2d926113bac06c10419fab643cb6b492436919..088c2c92db55782319bd5cfbbb44a74140a2e03b 100644 (file)
@@ -396,6 +396,10 @@ struct kvm_run {
                char padding[256];
        };
 
+       /* 2048 is the size of the char array used to bound/pad the size
+        * of the union that holds sync regs.
+        */
+       #define SYNC_REGS_SIZE_BYTES 2048
        /*
         * shared registers between kvm and userspace.
         * kvm_valid_regs specifies the register classes set by the host
@@ -407,7 +411,7 @@ struct kvm_run {
        __u64 kvm_dirty_regs;
        union {
                struct kvm_sync_regs regs;
-               char padding[2048];
+               char padding[SYNC_REGS_SIZE_BYTES];
        } s;
 };