Differential D9926 Diff 26440 head/emulators/xen-kernel/files/0001-x86-drop-unneeded-__packed-attributes.patch
Changeset View
Changeset View
Standalone View
Standalone View
head/emulators/xen-kernel/files/0001-x86-drop-unneeded-__packed-attributes.patch
Property | Old Value | New Value |
---|---|---|
fbsd:nokeywords | null | yes \ No newline at end of property |
svn:eol-style | null | native \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
From 7de7d07d47cc389bc341f5524ea8415c3c78e378 Mon Sep 17 00:00:00 2001 | |||||
From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= <roger.pau@citrix.com> | |||||
Date: Fri, 10 Mar 2017 01:05:51 +0900 | |||||
Subject: [PATCH 1/2] x86: drop unneeded __packed attributes | |||||
MIME-Version: 1.0 | |||||
Content-Type: text/plain; charset=UTF-8 | |||||
Content-Transfer-Encoding: 8bit | |||||
There where a couple of unneeded packed attributes in several x86-specific | |||||
structures, that are obviously aligned. The only non-trivial one is | |||||
vmcb_struct, which has been checked to have the same layout with and without | |||||
the packed attribute using pahole. In that case add a build-time size check to | |||||
be on the safe side. | |||||
No functional change is expected as a result of this commit. | |||||
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> | |||||
Reviewed-by: Jan Beulich <jbeulich@suse.com> | |||||
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> | |||||
--- | |||||
xen/arch/x86/hvm/svm/vmcb.c | 3 +++ | |||||
xen/arch/x86/x86_emulate/x86_emulate.h | 4 ++-- | |||||
xen/include/asm-x86/hvm/svm/vmcb.h | 12 ++++++------ | |||||
3 files changed, 11 insertions(+), 8 deletions(-) | |||||
diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c | |||||
index 9ea014f..f982fc9 100644 | |||||
--- a/xen/arch/x86/hvm/svm/vmcb.c | |||||
+++ b/xen/arch/x86/hvm/svm/vmcb.c | |||||
@@ -72,6 +72,9 @@ static int construct_vmcb(struct vcpu *v) | |||||
struct arch_svm_struct *arch_svm = &v->arch.hvm_svm; | |||||
struct vmcb_struct *vmcb = arch_svm->vmcb; | |||||
+ /* Build-time check of the size of VMCB AMD structure. */ | |||||
+ BUILD_BUG_ON(sizeof(*vmcb) != PAGE_SIZE); | |||||
+ | |||||
vmcb->_general1_intercepts = | |||||
GENERAL1_INTERCEPT_INTR | GENERAL1_INTERCEPT_NMI | | |||||
GENERAL1_INTERCEPT_SMI | GENERAL1_INTERCEPT_INIT | | |||||
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h | |||||
index 17c86f3..bbdf16a 100644 | |||||
--- a/xen/arch/x86/x86_emulate/x86_emulate.h | |||||
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h | |||||
@@ -71,7 +71,7 @@ enum x86_swint_emulation { | |||||
* Attribute for segment selector. This is a copy of bit 40:47 & 52:55 of the | |||||
* segment descriptor. It happens to match the format of an AMD SVM VMCB. | |||||
*/ | |||||
-typedef union __packed segment_attributes { | |||||
+typedef union segment_attributes { | |||||
uint16_t bytes; | |||||
struct | |||||
{ | |||||
@@ -91,7 +91,7 @@ typedef union __packed segment_attributes { | |||||
* Full state of a segment register (visible and hidden portions). | |||||
* Again, this happens to match the format of an AMD SVM VMCB. | |||||
*/ | |||||
-struct __packed segment_register { | |||||
+struct segment_register { | |||||
uint16_t sel; | |||||
segment_attributes_t attr; | |||||
uint32_t limit; | |||||
diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h | |||||
index bad2382..a3cd1b1 100644 | |||||
--- a/xen/include/asm-x86/hvm/svm/vmcb.h | |||||
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h | |||||
@@ -308,7 +308,7 @@ enum VMEXIT_EXITCODE | |||||
/* Definition of segment state is borrowed by the generic HVM code. */ | |||||
typedef struct segment_register svm_segment_register_t; | |||||
-typedef union __packed | |||||
+typedef union | |||||
{ | |||||
u64 bytes; | |||||
struct | |||||
@@ -322,7 +322,7 @@ typedef union __packed | |||||
} fields; | |||||
} eventinj_t; | |||||
-typedef union __packed | |||||
+typedef union | |||||
{ | |||||
u64 bytes; | |||||
struct | |||||
@@ -340,7 +340,7 @@ typedef union __packed | |||||
} fields; | |||||
} vintr_t; | |||||
-typedef union __packed | |||||
+typedef union | |||||
{ | |||||
u64 bytes; | |||||
struct | |||||
@@ -357,7 +357,7 @@ typedef union __packed | |||||
} fields; | |||||
} ioio_info_t; | |||||
-typedef union __packed | |||||
+typedef union | |||||
{ | |||||
u64 bytes; | |||||
struct | |||||
@@ -366,7 +366,7 @@ typedef union __packed | |||||
} fields; | |||||
} lbrctrl_t; | |||||
-typedef union __packed | |||||
+typedef union | |||||
{ | |||||
uint32_t bytes; | |||||
struct | |||||
@@ -401,7 +401,7 @@ typedef union __packed | |||||
#define IOPM_SIZE (12 * 1024) | |||||
#define MSRPM_SIZE (8 * 1024) | |||||
-struct __packed vmcb_struct { | |||||
+struct vmcb_struct { | |||||
u32 _cr_intercepts; /* offset 0x00 - cleanbit 0 */ | |||||
u32 _dr_intercepts; /* offset 0x04 - cleanbit 0 */ | |||||
u32 _exception_intercepts; /* offset 0x08 - cleanbit 0 */ | |||||
-- | |||||
2.10.1 (Apple Git-78) | |||||