Re: [BUG] x86_64 pci_map_sg modifies sg list - fails multiplemap/unmaps

From: David S. Miller
Date: Mon Jan 05 2004 - 14:23:23 EST


On Mon, 05 Jan 2004 10:57:35 -0700
"Justin T. Gibbs" <gibbs@xxxxxxxxxxx> wrote:

> DMA-API.txt doesn't seem to cover this issue. Should the low-level DMA
> code restore the S/G list to its original state on unmap or should the
> SCSI HBA drivers be changed to update "use_sg" with the segment count
> reported by the pci_map_sg() API? If the latter, this seems to contradict
> the mandate in DMA-API that the nseg parameter passed into the unmap call
> be the same as that passed into the map call. Most of the kernel assumes
> that an S/G list can be mapped an unmapped multiple times using the same
> arguments. This doesn't seem to me to be an unreasonable expectation.

No, the PCI layer is not required at all to restore the SG to it's original state
if it does DMA page coalescing as sparc64 and x86_64 do.

But I don't see what the real problem is, all the PCI layer is doing is setting up
the DMA address/length pairs in the entries that are needed, then returning
the number of such slots that exist. You, in your driver, can remember the original
total number of physical entries and use that value to pass things back in.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/