diff options
author | Thomas Huth <thuth@redhat.com> | 2018-09-27 10:23:35 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2018-10-04 10:32:38 +0200 |
commit | cb89b349074310ff9eb7ebe18a8ae24d7d9ea3fb (patch) | |
tree | 68c0968a1cd0217cf71db89c0b5195925b83896b /include/hw/s390x/css.h | |
parent | 729315ebca0811c11e937d00231f8e05de5b446d (diff) |
hw/s390x/ioinst: Fix alignment problem in struct SubchDev
struct SubchDev embeds several other structures which are marked with
QEMU_PACKED. This causes the compiler to not care for proper alignment
of these structures. When we later pass around pointers to the unaligned
struct members during migration, this causes problems on host architectures
like Sparc that can not do unaligned memory access.
Most of the structs in ioinst.h are naturally aligned, so we can fix
most of the problem by removing the QEMU_PACKED statements (and use
QEMU_BUILD_BUG_MSG() statements instead to make sure that there is no
padding). However, for the struct SCHIB, we have to keep the QEMU_PACKED
since the compiler adds some padding here otherwise. Move this struct
to the beginning of struct SubchDev instead to fix the alignment problem
here, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1538036615-32542-4-git-send-email-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'include/hw/s390x/css.h')
-rw-r--r-- | include/hw/s390x/css.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index bec82d0e5b..aae19c4272 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -118,11 +118,12 @@ typedef enum IOInstEnding { typedef struct SubchDev SubchDev; struct SubchDev { /* channel-subsystem related things: */ + SCHIB curr_status; /* Needs alignment and thus must come first */ + ORB orb; uint8_t cssid; uint8_t ssid; uint16_t schid; uint16_t devno; - SCHIB curr_status; uint8_t sense_data[32]; hwaddr channel_prog; CCW1 last_cmd; @@ -131,7 +132,6 @@ struct SubchDev { bool thinint_active; uint8_t ccw_no_data_cnt; uint16_t migrated_schid; /* used for missmatch detection */ - ORB orb; CcwDataStream cds; /* transport-provided data: */ int (*ccw_cb) (SubchDev *, CCW1); |