]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 24 Apr 2023 16:50:52 +0000 (17:50 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 18 May 2023 18:09:59 +0000 (21:09 +0300)
commit4b02ac725a5e65a838c8a21be54d6325365b5e1f
tree918acb55c9393435a57aa3689856dafc2bca4936
parente4e79c8e00753a317adbd69f89c79072b5bb397a
hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields

In allwinner_sdhost_process_desc() we just read directly from
guest memory into a host TransferDescriptor struct and back.
This only works on little-endian hosts. Abstract the reading
and writing of descriptors into functions that handle the
byte-swapping so that TransferDescriptor structs as seen by
the rest of the code are always in host-order.

This fixes a failure of one of the avocado tests on s390.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230424165053.1428857-2-peter.maydell@linaro.org
(cherry picked from commit 3e20d90824c262de6887aa1bc52af94db69e4310)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/sd/allwinner-sdhost.c