xlnx_dpdma: fix descriptor endianness bug
commitfdf029762f50101a3d7927d8db1be015e00f441c
authorAlexandra Diupina <adiupina@astralinux.ru>
Thu, 23 May 2024 15:06:19 +0000 (23 16:06 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 28 May 2024 13:20:48 +0000 (28 14:20 +0100)
tree80033bcccfe68d02259f2d1a52d3e3a365f79df1
parentad10b4badc1dd5b28305f9b9f1168cf0aa3ae946
xlnx_dpdma: fix descriptor endianness bug

Add xlnx_dpdma_read_descriptor() and
xlnx_dpdma_write_descriptor() functions.
xlnx_dpdma_read_descriptor() combines reading a
descriptor from desc_addr by calling dma_memory_read()
and swapping the desc fields from guest memory order
to host memory order. xlnx_dpdma_write_descriptor()
performs similar actions when writing a descriptor.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: d3c6369a96 ("introduce xlnx-dpdma")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
[PMM: tweaked indent, dropped behaviour change for write-failure case]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/dma/xlnx_dpdma.c