[parisc-linux] PATCH: xxxx_alloc_range()

Grant Grundler grundler@cup.hp.com
Wed, 13 Sep 2000 13:44:14 -0700 (PDT)


Summary -----------
Thanks to Ryan Bradetich for asking the right questions...we found
a resource management bug I created in both ccio-dma.c and sba_iommu.c.
Ryan will update ccio-dma.c and I'll do the same for sba_iommu.c
once we've had a chance to test it on the respective machines.

Details -----------
This bug would cause the system to HPMC or corrupt memory if more
than one DMA is outstanding at a time. This generally won't occur
until the system starts multitasking.

Doesn't affect A180 or similar machines w/o an I/O MMU.

The problem is the resource bit map gets out of sync
with the I/O Pdir usage and we can end up using the same I/O
pdir entries for more than one DMA...obivously this won't
work. The symptom will depend on when the first consumer
unmap's the DMA WRT when the second consumer uses it.

sorry,
grant

Index: sba_iommu.c
===================================================================
RCS file: /home/cvs/parisc/linux-2.3/arch/parisc/kernel/sba_iommu.c,v
retrieving revision 1.21
diff -u -p -r1.21 sba_iommu.c
--- sba_iommu.c 2000/08/30 15:43:52     1.21
+++ sba_iommu.c 2000/09/13 20:30:33
@@ -394,7 +394,7 @@ static int sba_alloc_range(struct ioc *i
        ASSERT(pages_order < (BITS_PER_LONG - IOVP_SHIFT));
 
        pages_mask= (u_long) -1L;
-       pages_mask >>= BITS_PER_LONG - pages_order;     /* clear top bits */
+       pages_mask >>= BITS_PER_LONG - pages_needed;    /* clear top bits */
 
 #if 0
        /*