Skip to contentSkip to conversation

sparc dma length bug(and fix) seen with NetBSD

Qemu-devel Cliff Wright 2 participants 2 messages Jul 1, 2008

lore
Share & tools
lore
#0 lore raw

Using QEMU 0.9.1 for sparc emulation, a dma length bug is seen with NetBSD. When an 8192 byte block is read to memory using dma into non-contiguous memory, the 2nd 4k block of contiguous memory is also written to. This is due to an incorrect variable being used for length.
See the attached patch. I see the same bug on subversion trunk.

Signature · 1 line
Cliff Wright <[email protected]>
hw/iommu.c renamed from hw/iommu.c.orig +2 -2
@@ -293,9 +293,9 @@
                 iommu_bad_addr(opaque, page, is_write);
                 return;
             }
-            cpu_physical_memory_write(phys_addr, buf, len);
+            cpu_physical_memory_write(phys_addr, buf, l);
         } else {
-            cpu_physical_memory_read(phys_addr, buf, len);
+            cpu_physical_memory_read(phys_addr, buf, l);
         }
         len -= l;
         buf += l;
#1 lore raw
Quoted 5 lines · Cliff Wright

Using QEMU 0.9.1 for sparc emulation, a dma length bug is seen with NetBSD.
When an 8192 byte block is read to memory using dma into non-contiguous memory, the 2nd 4k block of contiguous memory is also written to. This is due to an incorrect variable being used for length. See the attached patch. I see the same bug on subversion trunk.

Excellent, with the patch in place I was able to install NetBSD 4.0 to hard disk and boot to the installed system! The only wart was that installer could not reboot the system, but that's probably a bug in OpenBIOS (need to make reboot HW MMIO mapping more robust).