hw/s390x/ioinst: Fix alignment problem in struct SubchDev
commitcb89b349074310ff9eb7ebe18a8ae24d7d9ea3fb
authorThomas Huth <thuth@redhat.com>
Thu, 27 Sep 2018 08:23:35 +0000 (27 10:23 +0200)
committerCornelia Huck <cohuck@redhat.com>
Thu, 4 Oct 2018 08:32:38 +0000 (4 10:32 +0200)
tree68c0968a1cd0217cf71db89c0b5195925b83896b
parent729315ebca0811c11e937d00231f8e05de5b446d
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>
include/hw/s390x/css.h
include/hw/s390x/ioinst.h