On Thu, 2 May 2024 at 15:16, Alexandra Diupina <adiup...@astralinux.ru> wrote: > > 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 <adiup...@astralinux.ru>
> @@ -755,8 +811,10 @@ size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, > uint8_t channel, > /* The descriptor need to be updated when it's completed. */ > DPRINTF("update the descriptor with the done flag set.\n"); > xlnx_dpdma_desc_set_done(&desc); > - dma_memory_write(&address_space_memory, desc_addr, &desc, > - sizeof(DPDMADescriptor), > MEMTXATTRS_UNSPECIFIED); > + if (xlnx_dpdma_write_descriptor(desc_addr, &desc)) { > + DPRINTF("Can't write the descriptor.\n"); > + break; > + } This "break" introduces a behaviour change, so if we want it it should not be in this patch, which is supposed to just be fixing the endianness bug. (If we want to try to do the right thing on write errors here we need to check the device datasheet to see what it says about the hardware behaviour in that situation.) I dropped the "break" line and have queued this to target-arm.next. thanks -- PMM