]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/scsi/esp-pci: use correct address register for PCI DMA transfers
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fri, 12 Jan 2024 13:15:26 +0000 (13:15 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 20 Jan 2024 15:25:55 +0000 (18:25 +0300)
commit528496a5d4a2667869f07bdd1ec46f4d41171975
treebe21259c5ac3d9b304344c0897b7f01916cf1bc3
parent16f6a650a8174f1582c14f00c746483fc9a99f3a
hw/scsi/esp-pci: use correct address register for PCI DMA transfers

The current code in esp_pci_dma_memory_rw() sets the DMA address to the value
of the DMA_SPA (Starting Physical Address) register which is incorrect: this
means that for each callback from the SCSI layer the DMA address is set back
to the starting address.

In the case where only a single SCSI callback occurs (currently for transfer
lengths < 128kB) this works fine, however for larger transfers the DMA address
wraps back to the initial starting address, corrupting the buffer holding the
data transferred to the guest.

Fix esp_pci_dma_memory_rw() to use the DMA_WAC (Working Address Counter) for
the DMA address which is correctly incremented across multiple SCSI layer
transfers.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Message-ID: <20240112131529.515642-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 84a6835e004c257037492167d4f266dbb54dc33e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/scsi/esp-pci.c