public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ken Hofsass <hofsass@google.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, david@redhat.com, jmattson@google.com,
	Ken Hofsass <hofsass@google.com>
Subject: [PATCH v4 1/2] KVM: x86: add SYNC_REGS_SIZE_BYTES #define.
Date: Wed, 31 Jan 2018 16:03:35 -0800	[thread overview]
Message-ID: <20180201000336.154170-2-hofsass@google.com> (raw)
In-Reply-To: <20180201000336.154170-1-hofsass@google.com>

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>
---
 Documentation/virtual/kvm/api.txt | 2 +-
 include/uapi/linux/kvm.h          | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index e5f1743e0b3e..de55fe173afe 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -3809,7 +3809,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
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 62c564dd4aa1..e88ed6325e0e 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -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;
 };
 
-- 
2.16.0.rc1.238.g530d649a79-goog

  reply	other threads:[~2018-02-01  0:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01  0:03 [PATCH v4 0/2] KVM: x86: Add SYNC REGS functionality Ken Hofsass
2018-02-01  0:03 ` Ken Hofsass [this message]
2018-02-01  0:03 ` [PATCH v4 2/2] KVM: x86: KVM_CAP_SYNC_REGS Ken Hofsass
2018-02-01 13:05   ` David Hildenbrand
2018-02-02 21:04     ` Radim Krčmář
2018-02-02 23:54       ` Ken Hofsass
2018-02-05  1:29   ` Wanpeng Li
2018-02-06  0:32     ` Ken Hofsass
2018-02-06  0:46       ` Wanpeng Li
2018-02-06 20:03         ` Ken Hofsass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180201000336.154170-2-hofsass@google.com \
    --to=hofsass@google.com \
    --cc=david@redhat.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox