提交 380108d8 编写于 作者: J Julien Grall 提交者: Konrad Rzeszutek Wilk

xen/block: Correctly define structures in public headers on ARM32 and ARM64

On ARM (32 bits and 64 bits), the double-word is 8-bytes aligned. This will
result on different structure from Xen and Linux repositories.

As Linux is using __packed__ attribute, it must have a 4-bytes padding before
each "id" field.

This change breaks guest block support with older kernel. IMHO, it's acceptable
because Xen on ARM is still on Tech Preview and the hypercall ABI is not yet
freezed.

Only one architecture (x86_32) doesn't have 64-bit ABI for the block interface.
Don't add padding if Linux is compiled for this architecture.
Signed-off-by: NJulien Grall <julien.grall@linaro.org>
Acked-by: NRoger Pau Monne <roger.pau@citrix.com>
Acked-by: NDavid Vrabel <david.vrabel@citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
[I had asked for confirmation that it did not break x86 and Ian went
beyound the call of duty to confirm it. Also a internal regression
bucket with 32/64 dom0 with 32/64 domU (PV and HVM) confirmed no
regressions. ABI changes are a drag..]
Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
上级 a7892f32
...@@ -146,7 +146,7 @@ struct blkif_request_segment_aligned { ...@@ -146,7 +146,7 @@ struct blkif_request_segment_aligned {
struct blkif_request_rw { struct blkif_request_rw {
uint8_t nr_segments; /* number of segments */ uint8_t nr_segments; /* number of segments */
blkif_vdev_t handle; /* only for read/write requests */ blkif_vdev_t handle; /* only for read/write requests */
#ifdef CONFIG_X86_64 #ifndef CONFIG_X86_32
uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */ uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */
#endif #endif
uint64_t id; /* private guest value, echoed in resp */ uint64_t id; /* private guest value, echoed in resp */
...@@ -163,7 +163,7 @@ struct blkif_request_discard { ...@@ -163,7 +163,7 @@ struct blkif_request_discard {
uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */ uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */
#define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */ #define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */
blkif_vdev_t _pad1; /* only for read/write requests */ blkif_vdev_t _pad1; /* only for read/write requests */
#ifdef CONFIG_X86_64 #ifndef CONFIG_X86_32
uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/ uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/
#endif #endif
uint64_t id; /* private guest value, echoed in resp */ uint64_t id; /* private guest value, echoed in resp */
...@@ -175,7 +175,7 @@ struct blkif_request_discard { ...@@ -175,7 +175,7 @@ struct blkif_request_discard {
struct blkif_request_other { struct blkif_request_other {
uint8_t _pad1; uint8_t _pad1;
blkif_vdev_t _pad2; /* only for read/write requests */ blkif_vdev_t _pad2; /* only for read/write requests */
#ifdef CONFIG_X86_64 #ifndef CONFIG_X86_32
uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/ uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/
#endif #endif
uint64_t id; /* private guest value, echoed in resp */ uint64_t id; /* private guest value, echoed in resp */
...@@ -184,7 +184,7 @@ struct blkif_request_other { ...@@ -184,7 +184,7 @@ struct blkif_request_other {
struct blkif_request_indirect { struct blkif_request_indirect {
uint8_t indirect_op; uint8_t indirect_op;
uint16_t nr_segments; uint16_t nr_segments;
#ifdef CONFIG_X86_64 #ifndef CONFIG_X86_32
uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */ uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
#endif #endif
uint64_t id; uint64_t id;
...@@ -192,7 +192,7 @@ struct blkif_request_indirect { ...@@ -192,7 +192,7 @@ struct blkif_request_indirect {
blkif_vdev_t handle; blkif_vdev_t handle;
uint16_t _pad2; uint16_t _pad2;
grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
#ifdef CONFIG_X86_64 #ifndef CONFIG_X86_32
uint32_t _pad3; /* make it 64 byte aligned */ uint32_t _pad3; /* make it 64 byte aligned */
#else #else
uint64_t _pad3; /* make it 64 byte aligned */ uint64_t _pad3; /* make it 64 byte aligned */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册